Michael Hirschbichler
2008-May-07 14:24 UTC
[asterisk-users] Problem using the sip_header-function
Hi all, I want to get the first three Via-Header of an INVITE request to commit them into an AGI script: In the documentation is stated, that there are two possibilities to call this function, the first one using only one parameter for the SIP_HEADER-function is working: exten => 1226,n,agi,checksomething.pl|${SIP_HEADER(VIA)} I get the first Via-header: --------------------------------------------------------- Executing [1226 at sip-incoming:2] AGI("SIP/1226-081d65f0", "checksomething.pl|SIP/2.0/UDP 21.1.7.1:5060;branch=z9hG4bK845e.ce916cc.0") in new stack -- Launched AGI Script /usr/share/asterisk/agi-bin/checksomething.pl -- AGI Script checksomething.pl completed, returning 0 --------------------------------------------------------- The other possibility is to add a second parameter to define, which of the Via-header I want: exten => 1226,n,agi,checksomething.pl|${SIP_HEADER(VIA,1)} exten => 1226,n,agi,checksomething.pl|${SIP_HEADER(VIA,2)} exten => 1226,n,agi,checksomething.pl|${SIP_HEADER(VIA,3)} This does not work, I get an empty string: --------------------------------------------------------- -- Executing [1226 at sip-incoming:3] AGI("SIP/1226-081d65f0", "checksomething.pl|") in new stack -- Launched AGI Script /usr/share/asterisk/agi-bin/checksomething.pl -- AGI Script checksomething.pl completed, returning 0 -- Executing [1226 at sip-incoming:4] AGI("SIP/1226-081d65f0", "checksomething.pl|") in new stack -- Launched AGI Script /usr/share/asterisk/agi-bin/checksomething.pl -- AGI Script checksomething.pl completed, returning 0 -- Executing [1226 at sip-incoming:5] AGI("SIP/1226-081d65f0", "checksomething.pl|") in new stack -- Launched AGI Script /usr/share/asterisk/agi-bin/checksomething.pl -- AGI Script checksomething.pl completed, returning 0 --------------------------------------------------------- What am I doing wrong? I am using Asterisk 1.4.17~dfsg-2ubuntu1 br and thanks in advance Michael