XML CallBacks

Talk with others about developing applications for Switchvox

Moderators: bmdhacks, dpodolsky, tristand, jwitt, joshuas

XML CallBacks

Postby IraH » Wed Mar 07, 2012 11:27 am

Greetings Programmers;

I can see in the IVR one can send a URL with variables, ie %CALLERID%.
Receiving the URL as a POST in my VB6 HTML server applicaiton is no problem.
Within my program I can get whatever is sent, decifer it, and assign return values.

BUT, how does one do a "Callback" to return values to the IVR?

I see that it has to be done in XML format.

Will the IVR send me a "return URL" in which I just POST to that URL the same as one would do with an API, sending an XML document? (of which I can do)

Any help would be appreciated.
IraH
Newsterisk
 
Posts: 28
Joined: Thu Jan 27, 2011 9:19 am

Re: XML CallBacks

Postby sterlingmarking » Wed Mar 14, 2012 7:03 am

you simply serve an XML response to the post

http://developers.digium.com/switchvox/wiki/index.php/UrlManagerAPI_xml

Code: Select all
<response>
  <result>
    <call_info>
      <caller_id_number>8585551212</caller_id_number>
      <caller_id_name>John Doe</caller_id_name>
      <transfer_extension>850</transfer_extension>
      <display_url>http://intranet.example.com/cust_view?cust_id=2</display_url>
    </call_info>
  </result>
</response>
Jesse Carlton
Systems Administrator
Sterling Marking Products Inc.
sterlingmarking
Oldsterisk
 
Posts: 100
Joined: Mon Mar 22, 2010 9:42 am
Location: London, Ontario

Re: XML CallBacks

Postby jlong » Mon Jun 11, 2012 4:34 pm

This thread seems like it's discussing the same problem that I'm having currently, so I'm going to reply here with my problem as well. (Server information has been replaced with placeholder information for this post.)

In our switchvox IVR, We have a 'Send Call Values to IVR' Action sending to
Code: Select all
http://OUR.SERVER.IP/CardCheck/CheckDigitRoutine.aspx?&account=%account_num%


The Asp page then does some math to determine if the account number is correct, and write out an xml response.

This should return Variable gblnCardValid with a 1 or 0 to
Code: Select all
http://OUR.SWITCHVOX.IP/xml

(This is the URL we were told to send responses to when we called Digium Support.)

gblnCardValid is set in the 1st position for 'Enter any variable names that will be passed back' in the Send Call Values to IVR Action above.

While we are testing, we have a 'Say Number' Action set to say the value of gblnCardValid later in the IVR.

It isn't saying anything, so it would appear that gblnCardValid isn't getting set.

Example for The XML that
Code: Select all
http://OUR.SERVER.IP/CardCheck/CheckDigitRoutine.aspx?&account=%account_num%

returns is:
Code: Select all
<response>
    <result>
       <ivr_info>
          <variables>
            <variable>
             <name>gblnCardValid</name>
                <value>1</value>
            </variable>
         </variables>
      </ivr_info>
   </result>
</response>


We need to know why the Variable isn't getting set? Are we sending to the correct place? If you need any more information in order to help, please let me know and I'll get back to you as soon as possible.
Last edited by jlong on Mon Jun 11, 2012 4:55 pm, edited 1 time in total.
jlong
Newsterisk
 
Posts: 3
Joined: Mon Jun 11, 2012 4:20 pm

Re: XML CallBacks

Postby dpodolsky » Mon Jun 11, 2012 4:54 pm

http://OUR.SWITCHVOX.IP/xml

(This is the URL we were told to send responses to when we called Digium Support.)



This is where you are making a wrong turn. This step is not needed. Just send the XML response back from your webrequest.

So the steps are:

1. IVR requests this URL: http://OUR.SERVER.IP/CardCheck/CheckDig ... ccount_num%
2. Your web services returns an XML response from this XML request.

Thats it.

If you are already responding with that XML, try removing that extra request. It may be slowing down the request and hitting the 5 second timeout. Also check your Error Logs and see if they say anything about invalid or missing XML.
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: XML CallBacks

Postby jlong » Mon Jun 11, 2012 5:02 pm

Please bear with me, as I'm not well versed with XML.

sending the xml request back to http://OUR.SWITCHVOX.IP/xml as I described above is the only way I know of sending the information back.

Is there a standard webrequest / response for xml that I'm supposed to be using?

If need be, I'll speak with my Manager and see if I can post the code from our asp page to see if I'm handling the XML correctly.
jlong
Newsterisk
 
Posts: 3
Joined: Mon Jun 11, 2012 4:20 pm

Re: XML CallBacks

Postby sterlingmarking » Tue Jun 12, 2012 8:54 am

There is no "sending the request back" stage. Your Switchvox sends a request to http://OUR.SERVER.IP/CardCheck/CheckDig ... ccount_num% and your web server displays your xml packet in the http response.
Jesse Carlton
Systems Administrator
Sterling Marking Products Inc.
sterlingmarking
Oldsterisk
 
Posts: 100
Joined: Mon Mar 22, 2010 9:42 am
Location: London, Ontario

Re: XML CallBacks

Postby jlong » Tue Jun 12, 2012 10:51 am

Thank you everyone for your help. We read up on http Responses and have got it working now. You have all been a great help, and we really appreciate it.
jlong
Newsterisk
 
Posts: 3
Joined: Mon Jun 11, 2012 4:20 pm


Return to Switchvox Developers

Who is online

Users browsing this forum: No registered users and 4 guests