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

Token initiated call by clicking a button on a Web page

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

Token initiated call by clicking a button on a Web page

Post by vikas »

Hi Plum

I wanted to check if Plum supports something like Token initiated call by clicking a button on a Web page.

I am working on a requirement where Customer can click on a button like "Call me" on a web page and IVR calls the Customer.
I also need to be able to pass a few fields from the web page as parameters to the IVR.

I see option for "Outbound Calling" under developer tools when I login to http://hosting.plumgroup.com/.
However I am not sure if my account has the required access.

I found some information on a old ticket from 2010 but it seems like the information is outdated now.
http://support.plumgroup.com/viewtopic. ... 7aed#p2616

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

Re: Token initiated call by clicking a button on a Web page

Post by support »

Hi Vikas,

Yes, you're definitely on the right track, outbound calling is exactly what you're looking for. It looks like a few of your accounts do have outbound enabled already. If you log into hosting.plumgroup.com and then click "Developer Tools" and then "Outbound Calling" you should see your login and outbound pin, which is everything you need to place outbound calls. If you see this menu in your account, then your account is able to queue outbound calls. If you don't see this menu, please let us know the account and we can enable that for you.

What you're looking to accomplish is certainly possible. Simplifying the process a bit, the way outbound works is you POST to our queue call web service and provide the start_url for your script as well as a few other parameters (you can pass custom parameters in as well) and once your call reaches the top of the queue, the platform begins the outbound call and POSTs a number of call parameters to the start_url you specified for the call. You'll have these POST parameters available in your script at the start of the call. Full details documenting this process can be found in our outbound developer guide here: http://www.plumvoice.com/docs/dev/plumd ... nddevguide

Hopefully that's enough to get you started, but please let us know if you have any questions.

Regards,
Plum Support

vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

Re: Token initiated call by clicking a button on a Web page

Post by vikas »

Thanks.

Now I am able to get the outbound call sent to the phone number I put in "Phone_number" parameter.
But after getting the call I hear a prompt for Bad fetch.

It looks like the the server hosting outbound.plumvoice.com is not able to access the "start_url".
But I don't know which server is hosting outbound.plumvoice.com? How to get the access setup done?

Below is the error log from the outbound call. As you can note the URL is the standard URL for our test environment.

HTTP/1.1 405 Method Not Allowed - https://ivrpv-vppp.blackhawk-net.com/BH ... l/Root.xml
DocumentParser::FetchBuffer - could not open URL: https://ivrpv-vppp.blackhawk-net.com/BH ... l/Root.xml
DocumentParser::FetchDocument - exiting with error result 2
errno: 203 uri https://ivrpv-vppp.blackhawk-net.com/BH ... l/Root.xml

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

Re: Token initiated call by clicking a button on a Web page

Post by support »

Hi Vikas,

Looking at the error you posted it looks like the issue lies with your web server. When the call is queued, the platform attempts to fetch the start_url via GET just to ensure the url is valid before queuing the call. However, when the call is initiated, the start_url is hit via POST. It looks like your web server is configured to only accept GET requests for this script and is generating a 405 Method Not Allowed error code when the platform POSTs to this script at the start of the call. The solution should be to allow the start_url script to be accessed via GET and POST and then everything should work. Please let us know if you have any questions.

Regards,
Plum Support

vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

Re: Token initiated call by clicking a button on a Web page

Post by vikas »

Thanks. Yes, it's working after I changed the handler setting on my IIS server to allow POST.
However I have few more doubts.

1) I am using an HTML page with a Submit button to post to the queuecall.php.
After clicking the "Submit" button on my HTML page the web browser transitions to "http://outbound.plumvoice.com/webservice/queuecall.php" and shows below output.
I don't want web browser to display below info instead I was expecting it to transition to "result_url". But seems like the "result_url" sent by me is getting ignored. Is there a way I can prevent below output from getting displayed in my web browser?

2) What call parameters are sent to "result_url"? Is there a list?

3) From below you can see that I am sending "message_reference" and "call_parameters". How do I access it in the outbound IVR (start_url)? Do I use Session.message_reference & Session.call_parameters?

**************************************************************************************************************************************************
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<queuecall status="queued" call_id="39404527">
<login>**************</login>
<pin>*******</pin>
<phone_number>************</phone_number>
<start_url>
https://ivrpv-vppp.blackhawk-net.com/BH ... l/Root.xml
</start_url>
<result_url>
https://ivrpv-vppp.blackhawk-net.com/BH ... esult.html
</result_url>
<message_reference>ttyyy</message_reference>
<call_parameters>jklu</call_parameters>
</queuecall>

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

Re: Token initiated call by clicking a button on a Web page

Post by support »

Hi Vikas,

1. What web page you display after submitting to the queue call web service is up to you. If you're making a POST to the queue call service in PHP or something similar what you can do is use the Location header to redirect after making the request. For instance, if you're in the page index.php, what you can do is POST to that page, then process the request and hit the queue call web service, and then use the location header to redirect to whatever page you'd like. You could also use Ajax to make the request asynchronously and stay on the same page without a page reload. Here's a very basic sample in PHP that accepts a call parameter, submits the request to queue the call, and then redirects to the same page (index.php in this case). You could easily utilize sessions to display success or failure queuing and any other things you might need, but the general idea should be the same.

Just to clarify as well, the result_url you set when queuing a call is a callback url that will be POSTed to when the call completes or all attempts have been made. It's just a web service you can create such that you can get the result of all outbound calls.

index.php

Code: Select all

<?php
// process the POST
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
	$params = [
		'phone_number' => '1234567890',
		'login' => 'your_login',
		'pin' => 'your_pin',
		'start_url' => 'http://yourstarturl.com/script.php',
		'message_reference' => $_POST['call_parameter'],
	];
	// make the request to queue calls web service
	$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($params));
	// execute curl request
	$result = curl_exec($ch);
	curl_close($ch);
	// redirect wherever we want, in this case the same page
	header('Location: index.php');
}
?>
<!doctype html>
<html lang="en">
	<head>
	</head>
	<body>
		<form action="" method="post">
			<label>Enter call parameter</label>
			<input type="text" name="call_parameter"/>
			<input type="submit" value="Call Me"/>
		</form>
	</body>
</html>


2. Here's a list of the parameters POSTed to the result_url: http://www.plumvoice.com/docs/dev/plumd ... l_callback

3. The parameters you set when queuing the call are POSTed to your start_url script itself when your call initiates, so you can access them as you would any regular POST parameters. In PHP this would be $_POST['message_reference'] and $_POST['call_parameters'] to access these parameters in your start_url script.

Hopefully that helps, but please let us know if you have any additional questions.

Regards,
Plum Support

Post Reply