[asterisk-dev] Problem using the sip_header-function

Michael Hirschbichler sipp at hirschbichler.biz
Thu May 8 03:38:23 CDT 2008


Hi all,

(I already posted this question to the asterisk-user - list, but this 
list is probably the better ressource for my question - so sorry if 
someone has to read this mail twice ... ;-) )

Well ...
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



More information about the asterisk-dev mailing list