[asterisk-dev] Problem using the sip_header-function

Watkins, Bradley Bradley.Watkins at compuware.com
Thu May 8 08:05:24 CDT 2008


Michael Hirschbichler wrote:
> 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:

Any possibility it's a timing-related issue such as this one I reported
awhile back?

http://bugs.digium.com/view.php?id=9516

Try doing a NoOp(First Via: ${SIP_HEADER(VIA,1)} Second Via:
${SIP_HEADER(VIA,2)} Third Via: ${SIP_HEADER(VIA,3)}) and then watch the
console to see if the SIP_HEADER function is retrieving the variables
correctly in the first place.

- Brad



More information about the asterisk-dev mailing list