Picture of Aiman 3206
Registered 8 years 175 days
Aiman 3206 Tuesday, 20 December 2016, 12:31 PM
XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
I am writing an XML script for the voicemail object in which I wish to send multiple HTTP GET requests. 

Here's a simplified example:

<?xml version="1.0" encoding="utf-8" ?>
<voicemail xmlns="http://www.innovaphone.com/xsd/voicemail6.xsd" >
<function define="Main">
 <exec url="http://192.168.50.200:4444"/>
 <exec url="http://192.168.50.200:55555"/>
</function>
</voicemail>

This script when tested would send only the first HTTP GET request and ignore the second one. 

Am I missing something? How do I solve this problem? 
Picture of Christoph Künkel (innovaphone)
Moderator Registered 15 years 189 days
Christoph Künkel (innovaphone) Tuesday, 20 December 2016, 12:40 PM
1 of 1 users consider this post helpful
Re: XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
Aiman,

never tried that before, but it should work.

Keep in mind that the URL provided for the exec tag is queried and the content returned is used as voice mail script language. So it may well be that your first URL returns something that confuses the script processor.

I'd suggest that you tock the "trace" check mark in the voicemail object and then examine the trace.

Regards, Christoph
Picture of Aiman 3206
Registered 8 years 175 days
Aiman 3206 Tuesday, 20 December 2016, 12:59 PM
Re: XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
Thanks for the quick reply Christoph.

Assuming the problem is that the first URL returns something that confuses the script, is there a way to make the script ignore whatever the url returns and continue running?

I am not interested in what the url returns (and can't control it) because the script is used to control doors and lights that support remote control using http. Is there a way to work around this issue? 



Picture of Christoph Künkel (innovaphone)
Moderator Registered 15 years 189 days
Christoph Künkel (innovaphone) Tuesday, 20 December 2016, 01:24 PM
1 of 1 users consider this post helpful
Re: XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
no, the exec tag has no options.
When you have a Linux App Plattform at hand, you craft a little php script that throws away any returned content?
Picture of Aiman 3206
Registered 8 years 175 days
Aiman 3206 Tuesday, 20 December 2016, 01:43 PM
Re: XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
>no, the exec tag has no options. 

Now I know what I want for Christmas big grin


>When you have a Linux App Plattform at hand, you craft a little php script that throws away any returned content?

Seems like a long walk for a short drink of water, but I can't think of an alternative right now so I'll work on that. 

Thanks Christoph.
Andreas Fink
Moderator Registered 13 years 110 days
Andreas Fink (innovaphone) Tuesday, 20 December 2016, 03:46 PM
Re: XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
Hello Aiman,

could you do an RPCAP trace with following options enabled

trace=active und $_trace=251

See http://wiki.innovaphone.com/index.php?title=Howto:Debug_your_own_PBX_voicemail_script for more info.

Please also activate All TCP/IP Trace to be able to see the HTTP traffic.

Best Regards
Andreas Fink
Picture of Aiman 3206
Registered 8 years 175 days
Aiman 3206 Wednesday, 21 December 2016, 09:23 AM
Re: XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
Hi Andreas,
Are you sure about the trace flag 251? I tried it and nothing relating to the voicemail script seems to show in the trace. So I did the trace as recommended in the wiki link you provided using the 123 trace. I'll copy the results (using 123) here.

The tested script:

<?xml version="1.0" encoding="utf-8" ?>
<voicemail xmlns="http://www.innovaphone.com/xsd/voicemail6.xsd" >
<function define="Main">
 <dbg string="Before first request."/>
 <exec url="http://192.168.232.155:55555"/>
 <dbg string="Between the two requests."/> 
 <exec url="http://192.168.232.155:4444"/>
 <dbg string="After the second request."/> 
</function>
</voicemail>

The resulting trace (flag 123 + All IPv4 TCP/UDP Traffic):
1:0496:957:2 - vm(T):new call id=39
1:0496:957:2 - vm.39(T):new session on call=39
1:0496:957:2 - vm.39(T):dialed number=''
1:0496:957:2 - PBX-VM.6 -> IP.0 : SOCKET_ADDR_CHECK_LOCAL_HOST(192.168.232.250)
1:0496:957:2 - vm.39(T):setvar=$_pbxfwd val='true'
1:0496:957:2 - PCAP
      00001000000e9b4200000036000000360050563ade0500903300000008004568
      0028000000008006e7a5c0a8e876c0a8e8fa080e08033ed340e3f3cd98f75010
      ff7141130000
1:0496:957:2 - iprt.39.0(T):fs=FAT32 local=true
1:0496:957:2 - vm:cache_search: url='http://192.168.232.250/DRIVE/CF0/httpTest/test.xml' found=false
1:0496:957:2 - iprt.39.0(T): read_file path=/httpTest/test.xml
1:0496:957:2 - iprt.39.0(T): create_open_file path=/httpTest/test.xml
1:0496:957:2 - vm.39(T):rx=SIG_ACCEPT_COMPLETE call=39 state=SETUP dir=inc vmstate=0
1:0496:957:2 - VM_STORE.0 -> CF_FILE.2 : FILE_OPEN(R)
1:0496:957:2 - CF_FILE.2 -> VM_STORE.0 : FILE_OPEN_RESULT(SUCCESS)
1:0496:957:2 - VM_STORE.0 -> CF_FILE.2 : FILE_READ(800)
1:0496:957:2 - CF_FILE.2 -> IDE_DEV.1 : CF-READ(82359, 403)
1:0496:957:4 - PCAP
      00001000000e9c3c00000036000000360050563ade0500903300000008004500
      0028000000008006e7e8c0a8e89bc0a8e8fac2fa0050b7d36e9e7d8d6b465010
      f5b394a80000
1:0496:957:6 - IDE_DEV.1 -> CF_FILE.2 : CF-READ-RESPONSE(82359, 403)
1:0496:957:6 - CF_FILE.2 -> VM_STORE.0 : FILE_READ_RESULT(403,EOF)
1:0496:957:6 - iprt.39.0(T):read result len=403
1:0496:957:6 - iprt.39.0(T):event=READSCRIPT rc=0
1:0496:957:6 - iprt.39.0(T): dumping code..
1:0496:957:6 - 0xfabf0c:addr=0 voicemail .unknown=http://www.innovaphone.com/xsd/voicemail6.xsd
1:0496:957:6 - 0xfa8ad4:addr=1   function define=Main
1:0496:957:6 - 0xfa2440:addr=2     dbg string=Before first request.
1:0496:957:6 - 0xfa5734:addr=3     exec url=http://192.168.232.155:55555
1:0496:957:6 - 0xf9e5ec:addr=4     dbg string=Between the two requests.
1:0496:957:6 - 0xf9e3b8:addr=5     exec url=http://192.168.232.155:4444
1:0496:957:6 - 0xf9d53c:addr=6     dbg string=After the second request.
1:0496:957:6 - 0xfa9a24:addr=7   return
1:0496:957:6 - iprt.39.0(T):running file='http://192.168.232.250/DRIVE/CF0/httpTest/test.xml' ver=''
1:0496:957:6 - iprt.39.0(T):0xfa8ad4:addr=1 function
1:0496:957:6 - iprt.39.0(T):0xfa2440:addr=2 dbg
1:0496:957:6 - iprt.39.0(DBG):Before first request.
1:0496:957:6 - iprt.39.0(T):0xfa5734:addr=3 exec
1:0496:957:6 - iprt.39.0(T):exec url=http://192.168.232.155:55555
1:0496:957:6 - iprt.39.1(T):httpget url=http://192.168.232.155:55555 api-ctx=0x25
1:0496:957:7 - PCAP
      00001000000e9db30000003a0000003a0090330000000050563ade0508004500
      002c000000008006e7e4c0a8e8fac0a8e89b09dfd903d2fc6dd6000000006002
      ffff21890000020405b4
1:0496:957:7 - VM_STORE.0 -> CF_FILE.2 : FILE_CLOSE(USER,SUCCESS)
1:0496:957:7 - CF_FILE.2 -> VM_STORE.0 : FILE_CLOSE(USER,SUCCESS)
1:0496:957:7 - VM_STORE.0 -> FAT32.0 : SERIAL_CLOSE
1:0496:958:2 - PCAP
      00001000000e9f2a0000003a0000003a0050563ade0500903300000008004500
      002c000000008006e7e4c0a8e89bc0a8e8fad90309dfe78d229ed2fc6dd76012
      2000f74b0000020405b4
1:0496:958:2 - PCAP

As you can see, the script never makes it past the first exec command. On the receiving end of the http requests, the first request works as intended but the second request is obviously never received.
 
Let me know if I should try again with the 251 trace flag in case it is needed anyway.

Picture of Frederik 420
Registered 14 years 278 days
Frederik 420 Wednesday, 21 December 2016, 12:01 PM
Re: XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
Hi Andreas,

I'm not sure if this works, but if the exec is waiting for a return, try this.

<?xml version="1.0" encoding="utf-8" ?>
<voicemail xmlns="http://www.innovaphone.com/xsd/voicemail6.xsd" >
<function define="Main">
 <dbg string="Before first request."/>
<assign out="$exec-err" value="0"/>
 <exec url="http://192.168.232.155:55555" out-error="$exec-err"/>
 <dbg string="Between the two requests."/> 
 <exec url="http://192.168.232.155:4444" out-error="$exec-err"/>
 <dbg string="After the second request."/> 
</function>
</voicemail>
Picture of Aiman 3206
Registered 8 years 175 days
Aiman 3206 Wednesday, 21 December 2016, 02:22 PM
Re: XML voicemail script / Is it possible to send more than one HTTP GET request per-script?
Tried it. It doesn't work past the first request unfortunately.

Unless I'm mistaken, out-error can't be assigned by the user, rather it is the result of executing the command.

Thanks for trying though.
← You can define your color theme preference here