[asterisk-users] partially match a SIP header

Jeff LaCoursiere jeff at jeff.net
Fri Oct 23 13:18:41 CDT 2015


I have a need to pass through SIP headers that start with a particular 
prefix, without knowing beforehand what the full name of the header 
actually is.  For example I need to test for any headers on an inbound 
channel that start with "FOO_" and then use SIPAddHeader() to add them 
to the outbound channel.  Straightforward when I know the whole name, 
but I'd like something more generic that I won't have to update when we 
come up with a new header to add on the client side.

This is working fine:

exten => _X.,1,Set(FOO_ONE=${SIP_HEADER(FOO_ONE)})
exten => _X.,n,NoOp(Got Header ${FOO_ONE})
exten => _X.,n,SIPAddHeader(FOO_ONE: ${FOO_ONE})
exten => _X.,n,Dial(SIP/${EXTEN},80)
exten => _X.,n,Hangup

Any ideas?



More information about the asterisk-users mailing list