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 add dynamic data to vxml?

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 add dynamic data to vxml?

Post by f0028c5 »

Hi,

We have a requirement like, we need to add dynamic data to the vxml using java.

Vxml file is stored in File repository.

Can you please let us know how to pass dynamic data to vxml file.

Thanks,
Srinivas

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

Re: How to add dynamic data to vxml?

Post by support »

Hi Srinivas,

There are a few ways to incorporate dynamic data into your VXML application.

The first way is to host and dynamically create VXML files on your own webserver, using the scripting language of your choice. As long as you return valid VXML when we attempt fetch your URL, the platform will run your application.

The second way is to use <submit>, <subdialog>, and <data> tags to retrieve data from your own application server. The submit and subdialog tags expect a VXML result to be returned from the server, whereas the data tag expects an XML result.

Details and examples on how to integrate dynamic data into your application can be found on the Data Exchange guide in our documentation.

Regards,
Plum Support

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

Re: How to add dynamic data to vxml?

Post by f0028c5 »

Hi,

Thanks for the update.

We are able to make voice calls using the <data> tag, but there is 2-3 mins delay in receiving the calls when we are using <data> tab.

One more thing observed is when we are making the voice calls to 2 different numbers at the same time, we are getting only one voice call.(For the latest one we are getting the call and for the the other we are getting any calls).

Can you please look in to this issues.

Thanks,
Srinivas A

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

Re: How to add dynamic data to vxml?

Post by support »

Hi Srinivas,

The issues you are experience may be due to how you are queuing outbound calls.

Could you provide code snippets of your script that queues outbound calls?

Regards,
Plum Support

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

Re: How to add dynamic data to vxml?

Post by f0028c5 »

Hi,

We are having the our Parent.vxml file and data.xml files in plum voice repository.

Now I am trying to update the data.xml file from our custom java code.

Can you please let me know is this possible to update the data.xml from our custom java file.

Thanks,
Srinivas. A

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

Re: How to add dynamic data to vxml?

Post by support »

Hi Srinivas,

Any file stored in the file repository, by nature, is a static file. If you need to dynamically generate your vxml code from Java, this java code will need to be hosted externally and you will need to provide a start_url to your java code that will serve up your dynamically created vxml code.

Here's a very basic example of a php script that dynamically generates vxml code. This example takes a GET parameter and chooses whether to play an optional into message based on the value of the variable. However, you could do whatever dynamic manipulation you may need in your java file that generates vxml code; this is only a simple example.

Code: Select all

<?php
header("Content-type: text/xml");
$play_intro = $_GET['play_intro'];
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
        <form>
                <block>
                        <?php if ($play_intro) { ?>
                        <prompt> Hello, and thank you for calling. </prompt>
                        <?php } ?>
                        <prompt> Let's get started with the call. </prompt>
                </block>
        </form>
</vxml>
You would then set this script as your start_url in your hosting account as such:
http://example.com/index.php?play_intro=true

Regards,
Plum Support

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

Re: How to add dynamic data to vxml?

Post by f0028c5 »

Hi,

Thanks for the update, as per my understanding, our java code should be deployed in public IP, so that it can be accessed by plum voice.

Please let me know whether my understanding is correct or not.

Thanks,
Srinivas. A

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

Re: How to add dynamic data to vxml?

Post by support »

Hi Srinivas,

Yes, if your application is available via a URL, you can set that as your start_url for one of you phone numbers in your hosting account and you should be able to call into that number and our platform will fetch your vxml script from that start_url.

To do this:

Log in to your hosting account.
Click the Applications tab and select "Application Configuration"
Click 'edit' in the edit column for the desired number
In the "Application Source" drop down, select "Remote URL"
Add your URL in the Remote URL text box
To check if your script is valid, click "Validate"
Click "Save" to assign this remote url to your phone number

Regards,
Plum Support

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

Re: How to add dynamic data to vxml?

Post by f0028c5 »

Hi,

Thanks for the update.

We followed the steps which you provided.

Development URL is http://172.16.12.163:8080/Voice/Parent.xml

As we are trying to validate the URL we are getting the message like

This document is not valid VoiceXML!
Empty string supplied as input

As per my understanding plum voice requires access to our start-url.

Content of Parent.xml is
<?xml version="1.0"?>
<vxml version="2.1">
<form>
<data name="thedata" src="data.xml"/>
<block>
Your One Time Pass Code is <value expr=
"thedata.documentElement.childNodes.item(0).firstChild.toString()"/>.
</block>
</form>
</vxml>

And the content of data.xml is
<otp>
<code>12345</code>
</otp>



Thanks,
Srinivas. A

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

Re: How to add dynamic data to vxml?

Post by support »

Hi Srinivas,

Let's take a step back for a moment and asses what it is you're looking to do here. If you need to dynamically generate your vxml code, you will need to host and server your vxml content from external hosting. If you are looking to use static vxml pages and load dynamic data into these static pages from remote urls or external xml files, you should be able to do all of this without the use of an external web server or web hosting by utilizing the <data> tag.

With that being said, our platform cannot access the remote url you are using. We tried loading that page in a regular web browser and were unable to do so. We also were unable to ping the url of your server, which means it's either not accessible to the public net or your firewall is filtering out our requests (both on port 8080 and icmp ping requests).

Regards,
Plum Support

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

Re: How to add dynamic data to vxml?

Post by f0028c5 »

Hi,

Thanks for the update.

We are placing the our Vxml files in public domain, and we are able to get the calls.

But now my issue is we are getting the voice call delay by 2-3 minutes.

This is the code snippet we are using to make the voice calls.

URL obj = new URL(myVoiceURL);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();

/*Adding the Request to the Header*/
con.setRequestMethod("POST");
con.setRequestProperty("enctype", "multipart/form-data");
con.setRequestProperty("Accept", text/html,text/php,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
con.setRequestProperty("Accept-Encoding", "gzip, deflate");
con.setRequestProperty("Accept-Language", "en-US,en;q=0.8,ta;q=0.6");
con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36");

String myurlParameters = "login="+myVoiceLogin+"&pin="+myVoicePin+"&phone_number="+phone+"&start_url="+myVXMLURL;

/*Posting the parameter to the URL*/
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(myurlParameters);
wr.flush();
wr.close();

And I am having one more question like what happens at the same if two users trying to access the resource at the same time.

Thanks,
Srinivas. A

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

Re: How to add dynamic data to vxml?

Post by support »

Hi Srinivas,

When you queue an outbound call, the call is entered into a pool of balanced queued calls and will begin dialing when it has reached the top of the queue. This delay you are experiencing is due to this outbound queue and this is expected behavior. You can read more about outbound calling and the outbound queue here:
http://www.plumvoice.com/docs/dev/plumd ... nddevguide

We're a little unsure what you mean by two users trying to access the resource at the same time. We have sufficient capacity that concurrent calls will not be an issue. To give you an idea about how outbound works, when you queue multiple calls at once, the platform will fetch the start_url for your script when the call begins for each call. Your calls will each be self contained in their own unique session. There will never be any overlap or concurrency issues for your calls.

Also, as a side note, you are including what appears to be a number of unnecessary http headers in your outbound request. You can remove the following headers and should still be able to successfully queue outbound calls:
con.setRequestProperty("Accept", text/html,text/php,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
con.setRequestProperty("Accept-Encoding", "gzip, deflate");
con.setRequestProperty("Accept-Language", "en-US,en;q=0.8,ta;q=0.6");
con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36");

Regards,
Plum Support

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

Re: How to add dynamic data to vxml?

Post by f0028c5 »

Hi,

We have one more issues here.
Now we are generating the vxml dynamically and placing it in public domain and we are able to get the calls.

But my problem is if two users are accessing our code to generate the vxml file dynamically at the same time.
For the first user we will generate one vxml and we will place the call, if there is delay in getting the call, second user will generate the vxml file, so the first vxml file will be overridden.

So both the users get the same vxml file.

How to handle this situation.

Thanks,
Srinivas. A

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

Re: How to add dynamic data to vxml?

Post by f0028c5 »

Hi,

I have one more question like, does plum voice sends us any response code or some thing when we get the voice call.

Thanks,
Srinivas. A

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

Re: How to add dynamic data to vxml?

Post by support »

Hi Srinivas,

We're still unsure of the situation you have posed. Basic web server functionality would not allow for the type of situation that you're describing.

We do offer a way to get information about a call after the call has been completed. This would be the result_url. You can find more information about the result_url at http://www.plumvoice.com/docs/dev/plumd ... ifications.

Regards,
Plum Support

Post Reply