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

how to access call_parameters in vxml file.

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
f0028c5
Posts: 12
Joined: Wed May 27, 2015 9:12 am

how to access call_parameters in vxml file.

Post by f0028c5 »

Hi,

Can you please clarify me below questions,

1. What is the role of "call_parameters" in voice calls?
2. Can we access the data of "call_parameters" in VXML file which is stored in plum file repository?

ex:

1. I am calling the vxml file which is stored in plum file repository from JAVA as follow,

String url = "http://outbound.plumgroup.com/webservice/queuecall.php";
String login = "xxxxxxxxxxx";
String pin = "xxxxxxx";
String phone_number = "xxxxxxxxx";
String start_url = "http://repo.local.plumgroup.com/xxxx/xx ... cecall.xml";
String urlParameters = "login="+login+"&pin="+pin+"&phone_number="+phone_number+"&start_url="+start_url+"&call_parameters=2 5 8 7 4";

URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("enctype", "multipart/form-data");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();


2. Below is the VXML file,

<vxml version="2.0">
<var name="varCallID" expr="call_parameters" />
<form>
<block>
<prompt>
Your call parameter is: <value expr="varCallID"/>.
</prompt>
</block>
</form>
</vxml>

-------
Now, i would like to access the value of call_parameters, inside the vxml file. is this possible?

If not, how can we pass the values to vxml file dynamically, can you please suggest me your best solution?

We already tried using the <value> & <data> tags by giving the source as xml file and getting the value from that xml file as below, thedata.documentElement.childNodes.item(0).firstChild.toString(). But, this will not work out in our case because if multiple users are accessing the same VXML file at the same time, the last updated xml value sent to all the users.

We are going through a high priority requirement so if you can help us out ASAP that would be a great help.

Thanks,
Gouse

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

Re: how to access call_parameters in vxml file.

Post by support »

Hi Gouse,

1) The call parameters field is designed for users to send arbitrary data to their start_url when placing an outbound call. This data is sent as a POST variable to the start url you have provided.

2) You cannot access these parameters in VXML files stored in the file repository. This is because those files are, by nature, static files that cannot access POST variables. You will want to dynamically generate your VXML code using a programming language of your choice on your own application server onto a URL that Plum can fetch. Here is an example in PHP:

Code: Select all

<?php
  header("Content-type: text/xml");
  $call_parameters = $_POST['call_parameters'];
  echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
  <form>
    <block>
      <prompt>
        Your call parameter is <?= $call_parameters ?>.
      </prompt>
    </block>
  </form>
</vxml>
Note that this PHP outputs valid VXML, but handles the logic concerning the dynamic data.

Regards,
Plum Support

f0028c5
Posts: 12
Joined: Wed May 27, 2015 9:12 am

Re: how to access call_parameters in vxml file.

Post by f0028c5 »

Hi,

Thanks for the PHP code, but as this will not work in mycase. So, i created a JSP page as follow,

---->call.jsp

<%@LANGUAGE="JSP"%>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page contentType="text/html; charset=UTF-8" %>
<%

String otp = request.getParameter('call_parameters');

%>
<vxml version="2.0">
<var name="varCallID" expr="<%= otp %>" />
<form>
<block>
<prompt>
Your One Time passcode is: <value expr="varCallID"/>.
</prompt>
</block>
</form>
</vxml>


and i am trying to pass this jsp as start_url, as follow

<form name="sendOTPForm" id="sendOTPForm" method="post" action="http://outbound.plumgroup.com/webservice/queuecall.php">

<input type="hidden" id="login" name="login" value="xxxxxxxxxx"/>
<input type="hidden" id="pin" name="pin" value="xxxxxxx"/>
<input type="hidden" id="phone_number" name="phone_number" value="xxxxxxxx"/>
<input type="hidden" id="start_url" name="start_url" value="http://xxxx/xxxxxx/call.jsp">
<input type="hidden" id="call_parameters" name="call_parameters" value="1 2 2 2 4 7"/>

<script type="text/javascript" src="/jquery-1.9.0.min.js"></script>
<script language="javascript" type="text/javascript" charset="UTF-8">

window.addEventListener('load', getOTP, false);
var http;
function getOTP(){

var form = document.getElementById("sendOTPForm");
form.submit();
alert('inside getOTP');
}

</script>
</form>


when i launch the jsp page i am getting the failure response as:

<queuecall status="failed">
"start_url" POST variable does not contain a valid URL.
</queuecall>

------------

can you provide me a working sample example like above in ASP, i.e. other than PHP. We are going through a high priority requirement and we need a solution in Java related technology i.e. JSP. I can handle the JSP code if you can provide me any working example in ASP.

I have gone through all the Plum-Dev support site, and everywhere i see is PHP examples, and the documentation says "Use the message parameters to pass call personalization information directly to the call script." dose this mean we can access call_parameters in vxml <script> tag? if yes, how can we do that in ASP and VXML?

and in prebuild applications it is accepting the WSDL URL, that means we can pass any value to VXML dynamically? i.e. i will create a application with call flow and i pass the values retured from WSDL to the VXML?

Regards,
Gouse

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

Re: how to access call_parameters in vxml file.

Post by support »

Hi Gouse,

The outbound system will validate that the start_url sent is a valid URL structure and will attempt to access the start_url to validate that it is there. If it is not a valid URL or the URL is not there, it will return the error code that you see.

All of our examples are PHP since that is the server-side language we utilize in our own environment. We do not have any engineers that are familiar with JSP/ASP, so we cannot provide examples in those languages.

The message parameters mentioned in the documentation refer specifically to campaign_parameters and call_parameters that you can provide when queuing the outbound call. These parameters are sent to the script as POST values and are not available to the VXML unless you pass them into the VXML via your server-side language.

The prebuilt applications utilize PHP to handle the WSDL integration. The information would be passed in the same way as the call_parameters of an outbound call.

Regards,
Plum Support

f0028c5
Posts: 12
Joined: Wed May 27, 2015 9:12 am

Re: how to access call_parameters in vxml file.

Post by f0028c5 »

Never mind. I resolved the issue. Thanks for your support.

Post Reply