Page 1 of 1
Question about posting to outbound and passing to VXML
Posted: Thu Sep 16, 2010 9:32 am
by magicsoft
I know I can post a value to "queuecall.php" and have it then forward this value to my "start_url". At the moment, my "start_url" simply returns a static VXML file for the call specified, but I need to actually have a variable in that VXML set to this value. Is there some accepted method of accomplishing this? At the moment, the only way I can think of to do it is to actually read in the static VXML and then insert the line
Code: Select all
<assign name="varCallID" expr="postedvariable"/>
where "varCallID" is my variable and "postedvariable" is the value I had originally posted to "queuecall.php". I would then return the VXML (with the inserted line). Does this make sense? I need to have that value available in the outbound call script so I know what records to update during the call.
Thanks,
Andrew
Re: Question about posting to outbound and passing to VXML
Posted: Thu Sep 16, 2010 1:47 pm
by support
Hi Andrew,
In order to have parameters that you POSTed to queuecall.php passed along to your start_url, you first must ensure that you're start_url is a dynamic script such as PHP that can accept POST parameters. There are two optional strings that can be POSTed to queuecall.php that are then POSTed to your start_url; they are 'message_reference' and 'call_parameters'.
You would then access these variables in your start_url by using some code similar to the following example:
start_url.php
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<var name="msg_ref" expr="'<?= $_POST['message_reference'] ?>'" />
<var name="varCallID" expr="'<?= $_POST['call_parameters'] ?>'" />
<form>
<block>
<prompt>
Your call parameter is: <value expr="varCallID"/>.
Your message reference is: <value expr="msg_ref"/>.
</prompt>
</block>
</form>
</vxml>
You can find more information detailing outbound and the queuecall.php script
here.
Hope this helps!
Regards,
Plum Support
Re: Question about posting to outbound and passing to VXML
Posted: Fri Sep 17, 2010 7:23 am
by magicsoft
The problem isn't getting the variable in the start URL page, I can do that. The problem is then getting these values to be available in the actual VXML that I pass back from the start URL. Am I missing something, or do I just need to somehow inject the code that assigns that variable's value into the VXML before returning it from the start URL? The value that I'm passing to start URL doesn't do me any good unless it's available during the call itself.
Andrew
Re: Question about posting to outbound and passing to VXML
Posted: Fri Sep 17, 2010 7:43 am
by magicsoft
I think I see why we've misunderstood each other. In your example, you're assuming that the start URL itself contains the VXML to return. On my start URL, I'm actually reading in a VXML file and then returning this string. So for me to have this value available, I would have to insert the "assign" line into the VXML that I'm reading in before returning it from the start URL. That seems to be the only viable method of getting that value to where I need it. Which is essentially the same as doing what you said, except that the VXML isn't actually visible from my start URL like it is in your example. I just want to verify that this makes sense to you. Not sure if any of you know C#, but this is what I'm doing:
Code: Select all
TextReader tr = File.OpenText(context.Server.MapPath("test_order_intro_machine.vxml"));
string file = tr.ReadToEnd();
// "<assign name="varAnswer" expr="answer"/>"
tr.Close();
context.Response.ContentType = "text/plain";
context.Response.Write(file);
The page actually outputs the contents of the file I read in on the first line. So I would have to somehow add the "assign" line into that VXML before sending it back on the last line (context.Response.Write(file);).
Thanks,
Andrew
Re: Question about posting to outbound and passing to VXML
Posted: Fri Sep 17, 2010 8:17 am
by support
Hi Andrew,
We don't have any C# expertise in-house, but what you're saying does make sense. You would be able to access the variable in the VXML code itself by adding the <assign> tag to your VXML before returning it from your start URL.
Regards,
Plum Support