Search:
     
3CX Phone System for Windows Download the Free Edition

Asterisk func sip_header

Synopsis

 Gets the specified SIP header

Description

 SIP_HEADER(<name>)

Notes

  • SIP_HEADER() gives you only access to headers of the initial INVITE request (and not, for example, the final BYE message)
  • This function may only be read from
  • CLI> show function SIP_HEADER

Return value

Returns the resulting string.

Example 1:


 exten => s,1,Set(foo=${SIP_HEADER(headername)})

Example2:


 exten => +49123456789,1,Set(DN=${SIP_HEADER(TO):5})
 exten => +49123456789,2,Set(DN=${CUT(DN,@,1)}) 

Example 3:


To get Ip address of From (takes into account no caller id info i.e. no 555@192.168.1.1 in the header):


exten => 1,1,Set(TESTAT=${CUT(SIP_HEADER(From),@,2)})
exten => 1,n,GotoIf($["${TESTAT}" != ""]?hasat)
exten => 1,n,Set(FROM_IP=${CUT(CUT(SIP_HEADER(From),>,1),:,2)})
exten => 1,n,Goto(gotip)
exten => 1,20(hasat),Set(FROM_IP=${CUT(CUT(CUT(SIP_HEADER(From),@,2),>,1),:,1)})
exten => 1,n(gotip),NoOp(Gateway IP is ${FROM_IP})


Example 4:

ip address of local ip phone

 exten => s,n,Set(IP=${CUT(CUT(SIP_HEADER(Via), ,2),:,1)})

Bugs and limitations

Contrary to previously claimed,SIP_HEADER is read-only. This example does not work, use SipAddHeader() instead:

 exten => s,1,Set(SIP_HEADER(headername)=Foo Fighters)

Bug: SIP_HEADER is timing sensitive, see bug 9516 and the devel-discussion

See also



Created by: murf,Last modification on Tue 30 of Nov, 2010 [18:32 UTC] by JustRumours


Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

 





Search: