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

Hanging up a ringing call

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
immersive
Posts: 1
Joined: Wed May 20, 2015 12:45 am

Hanging up a ringing call

Post by immersive »

A call can be uniquely identified with a message_reference - is this correct?

Is it then possible to hang up a call that is ringing, based on an event originating from an external web server, that is serving the VoiceXML, using this message_reference?

Thank you.

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

Re: Hanging up a ringing call

Post by support »

Hi,

The message_reference used in outbound is an optional parameter that can be utilized by the client to uniquely identify a call.

For example, if you supply a message_reference when you queue your call, this message_reference will be supplied as a post parameter to your start_url and at the conclusion of the call will be posted to your result_url.

It's a little unclear what you're looking to do, but if we understand correctly that you're looking to disconnect a call based on the message_reference value supplied when the call was queued, you could do so as such.

First, when you queue your call, you will need to provide a unique message_reference parameter to be associated with that specific call. Here is an example php script to queue a single outbound call with the message_reference sent.

Code: Select all

<?php
// initialize post paramsOB
$post_vars = array(
	'phone_number'=>'0000000000',
	'login'=>'your_login',
	'pin'=>'your_pin',
	'message_reference'=>'some_unique_id',
	'start_url'=>"http://example.com/start.php",
	'result_url'=>"http://example.com/result.php"
	);

$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);
$errors = curl_error($ch);
var_dump($errors);
curl_close($ch);
echo $result;
?>
This will queue a single outbound call and the message_reference set will be posted to your start_url when the platform fetches your start_url script.

Here's an example where in your start_url script, you consume the message_reference and branch the action of your call script based on this value.

Code: Select all

<?php
header("Content-type: text/xml");
// here you can consume your message_reference you queued with the call
$cancel_call = false;
if ($_POST['message_reference'] = 'some_unique_id') {
	$cancel_call = true;
}
?>
<vxml version="2.0">
<?php
if ($cancel_call) { ?>
	<form id="cancel">
		<block>
			<prompt>I'm about to hang up on you.</prompt>
			<disconnect/>
		</block>
	</form>
<?php  } ?>
	<form id="intro">
		<block>
			<prompt> This is a test message </prompt>
		</block>
	</form>
</vxml>
In this example, the script looks at the message_reference post parameter and checks if it matches some arbitrary id (in this case the string 'some_unique_id'). It then decides whether to hang up on the caller or to continue to the intro message.

In your result_url (if one was supplied when you queued the call) you will receive the message_reference as well as other call details for the single outbound call posted to your result_url.

Hopefully this help you accomplish what you're looking to do, but if not, please let us know and we would be more than happy to assist further.

You can read more about outbound here, in our developer docs:
http://www.plumvoice.com/docs/dev/plumd ... nddevguide

Regards,
Plum Support

Post Reply