We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Outbound Result_url post variable invalid URL

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
Sparker
Posts: 14
Joined: Tue Jan 27, 2015 10:48 am

Outbound Result_url post variable invalid URL

Post by Sparker »

First-I'm doing my application in asp.net. I want to "log" my end results in a table in sql server once the call is completed--either "really" completed or a hang-up, or whatever.

I am trying to use the result_url in my initial request to the Plum Voice server; however, I must be doing something wrong. I include the URL to my aspx page, but the initial call to queuecall.php fails with the following error:
"result_url post variable does not contain a valid url"
I know it's a "valid" url because it does indeed exist in my project...

Do I understand correctly that once the call is complete, the result_url is called (I do not have to explicitly call it) and the parameters "automatically" are posted, correct? I do not have to append them as in a querystring to my url, right?

I just have not been able to find an example that I can use...

Thanks in advance

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: Outbound Result_url post variable invalid URL

Post by support »

Hi,

The way the result_url works is that once the call has concluded, whether the caller has accepted the call, rejected the call, completed the call, hung up early, or what have you, the outbound system will post the following parameters to your result_url:

phone_number
call_id
message_reference
result
callee_type
attempts
last_attempt_timestamp
duration

Details on these parameters can be found here:
http://www.plumvoice.com/docs/dev/plumd ... l_callback

Here's a complete example, to give you a thorough example of how this works:

Let's say we have a very basic vxml script:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
	<form>
		<block>
			<prompt> This is a test message </prompt>
		</block>
	</form>
</vxml>
All this script does is play "This is a test message" to the recipient.

Now, let's take a look at a simple php script to queue the outbound call:

Code: Select all

<?php
// initialize post params
$post_vars = array(
	'phone_number'=>'destination_phone_number',
	'login'=>'your_login',
	'pin'=>'your_outbound_pin',
	'start_url'=>"url_to_your_application",
	'result_url'=>"url_to_your_script_to_process_post_call_params"
	);

$ch = curl_init();
// set curl options
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, "http://outbound.plumvoice.com/webservice/queuecall.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_vars));
// execute curl request
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
Doing so should produce the following output, indicating a successfully queued call:

Code: Select all

<?xml version="1.0"?>
<queuecall status="queued" call_id="32300833">
<login>your_login</login>
<pin>your_outbound_pin</pin>
<phone_number>destination_phone_number</phone_number>
<start_url>url_to_your_application</start_url>
<result_url>url_to_your_script_to_process_post_call_params</result_url>
</queuecall>
Now, let's create the most basic result_url script to simply dump the posted result parameters to a text file:

Code: Select all

<?php
$fh = fopen("/tmp/outboundtest.txt","w+");
fwrite($fh, var_export($_POST,TRUE));
fclose($fh);
All this script does is write the posted params to a text file in /tmp/outboundtext.txt on the server.

When this result_url is called at the end of the call, the result should be similar to:

Code: Select all

array (
  'phone_number' => 'destination_phone_number',
  'call_id' => '32299748',
  'message_reference' => '',
  'result' => 'completed',
  'callee_type' => 'voice',
  'attempts' => '2',
  'last_attempt_timestamp' => 'Thu, 07 May 2015 14:08:01 -0400',
  'duration' => '2',
)
The variables are posted automatically to your result_url. All you need to do is to supply a result_url when the call is queued.

With this being said, hopefully you should have a good understanding of how the outbound system works. However, you can get additional details about the outbound system at:
http://www.plumvoice.com/docs/dev/plumd ... nddevguide

With this being said, it seems that your result_url is malformed. The result_url must be a valid url that is on the web and can be accessed by our systems.

For debugging purposes, what result_url are you supplying when you queue your call? Note that you must include http:// at the beginning of your result_url for it to be accepted as valid.

Regards,
Plum Support

Sparker
Posts: 14
Joined: Tue Jan 27, 2015 10:48 am

Re: Outbound Result_url post variable invalid URL

Post by Sparker »

Thanks for your reply--very refreshing to have it verified that I was indeed understanding things correctly! :)

My result_url was formed correctly. It's strange that I was getting that particular error because I was referencing an object in my script that I had already disposed--really had nothing to do with an invalid URL at all! Took me a while to troubleshoot this, but finally figured it out with some help from co-workers.

Post Reply