[asterisk-users] SIP_HEADER() read-only

Vincent Regnard devel at regnard.org
Fri Aug 4 00:38:25 MST 2006


Joshua Colp a écrit :
> You can use the SIPAddHeader application:
> 
>   SIPAddHeader(Header: Content)
> Adds a header to a SIP call placed with DIAL.
> Remember to user the X-header if you are adding non-standard SIP
> headers, like "X-Asterisk-Accountcode:". Use this with care.
> Adding the wrong headers may jeopardize the SIP dialog.
> Always returns 0


Yes, you're right, that's what I did. It works for simple calls, when 
you perform a dial() soon after you set the sip header. But If you want 
to do "more elaborate" things like use a queue, the sip header get lost 
when a new channel is created. One then has to play with some variables 
directly (namely ADDSIPHEADERXX, where XX is a number <50), I don't 
think this is a really nice solution. SIPAddHeader (and its later 
expected replacement function SIP_HEADER()) sould have an option to 
allow to set the sip header for child (and all child) channels.


Here is how I did to have "persistant" sip headers:

exten => setsipheaders,1,NoOP(Adding reftbs: ${TBSREF} to sip X-TBSREF 
header)
exten => setsipheaders,n,SipAddHeader(X-TBSREF: ${TBSREF})
exten => setsipheaders,n,Set(__SIPADDHEADER01="X-TBSREF: ${TBSREF}")
exten => setsipheaders,n,NoOP(Setting tbs ref type to: ${TBSREFTYPE})
exten => setsipheaders,n,SipAddHeader(X-TBSREF-TYPE: ${TBSREFTYPE})
exten => setsipheaders,n,Set(__SIPADDHEADER02="X-TBSREF-TYPE: 
${TBSREFTYPE}")
exten => setsipheaders,n,GoTo(call,1)

exten => call,1,NoOp(Sip x-test ${SIPADDHEADER01})
exten => call,n,NoOp(Sip x-test ${SIPADDHEADER02})
exten => call,n,Goto(ext-queues,701,1)






More information about the asterisk-users mailing list