Page 1 of 1

How do I take start a different VXML based on "callee_type"?

Posted: Wed Sep 08, 2010 9:57 am
by magicsoft
I have my "start URL" set to return a given VXML script. But I'd like to be able to return a different VXML file based on whether the call is answered by a person or a machine. From what I'm understanding, the "callee_type" is only available after the call is completed, as a parameter sent to the "result URL". But by that time, it doesn't do me any good, as the call is already finished. Is there any way to determine the "callee_type" based on a parameter sent to the "start URL", or in the VXML itself (so that I could then pass control to a different file if it's a machine). I guess I'm looking for something like the built-in property that gives you the phone numbers involved.

Thanks,

Andrew

Re: How do I take start a different VXML based on "callee_ty

Posted: Wed Sep 08, 2010 11:21 am
by support
Hi Andrew,

The "callee_type" variable is actually returned as a POST parameter to your start_url, not the result_url. If you want to pass control to different pages based on the detected callee type, you could use a <goto> tag with some branching logic in your start_url page such as:

start_url.php

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
  <var name="callee_type" expr="'<?= $_POST['callee_type'] ?>'" /> 
  <form>
    <block>
      <if cond="callee_type=='voice'">
	     <goto next="http://voice-app.php" />
      <elseif cond="callee_type=='answeringmachine'" />
	     <goto next="http://answering-machine-app.php" />
      </if>
    </block>
  </form>
</vxml>
Hope this helps!

Regards,
Plum Support

Re: How do I take start a different VXML based on "callee_ty

Posted: Wed Sep 08, 2010 12:13 pm
by magicsoft
That's actually exactly what I wanted. But I was getting an error when I had made the change to try to capture that. I must have been doing something else wrong, I'll try it again. Thanks.

Re: How do I take start a different VXML based on "callee_ty

Posted: Wed Sep 08, 2010 12:27 pm
by magicsoft
Okay, I'm a little lost here again. I was under the impression from what you said that "callee_type" would be appended as a parameter to the start URL, much like this:

http://www.xxx.com?callee_type=voice

where "http://www.xxx.com" is the start URL I provided on the queue call screen.

But when I try to retrieve that in code, I get an error, which leads me to believe that the parameter is not being passed in such a way.

Andrew

Re: How do I take start a different VXML based on "callee_ty

Posted: Wed Sep 08, 2010 1:08 pm
by magicsoft
Okay, I've learned that instead of doing

context.request.querystring["callee_type"]

which would make sense if the data was being passed as parameters as I had thought, what I really need to do is

context.request.form["callee_type"]

This is supposed to get the variable "callee_type" that has been posted to the page in question. However, I am still getting an error that would lead me to believe that it can't find the "callee_type" variable in what has been posted. Why would this be?

Thanks,

Andrew

Re: How do I take start a different VXML based on "callee_ty

Posted: Wed Sep 08, 2010 1:45 pm
by support
Hi Andrew,

We don't have any in-house ASP expertise, but from previous forum posts, we've gathered that you can get the callee_type by using the following line of code:

Code: Select all

<%
dim calleetype
calleetype = Request.Form("callee_type")
%>
You can reference the following previous post for more ASP IVR code examples:

http://support.plumgroup.com/viewtopic. ... 4ee3#p4407

Regards,
Plum Support

Re: How do I take start a different VXML based on "callee_ty

Posted: Wed Sep 08, 2010 2:59 pm
by magicsoft
I just wanted to let you know I got this working, and to hopefully provide a tip for anyone else who stumbles into this problem.

On the start URL page, you need to check to make sure that whatever form variable you're looking for exists, and provide a default if it doesn't, at least when you're testing using the "queuecall" page on your site. Apparently your site tries to access the start URL to determine its existence, but when doing so, the form variables are not passed. Therefore, you can't just assume that variable will be available, because the page will return an error during this check (when it doesn't) and the queue call will fail, indicating that the start URL is invalid.

Andrew