How To Get An Info From “To:” Header?

Home » Asterisk Users » How To Get An Info From “To:” Header?
Asterisk Users 1 Comment

Hello list!
Sorry for kinda dumb question, I guess, but I have too little time to research it by myself. I have a SIP packet, which looks like this:

<--- SIP read from UDP:10.186.0.38:5060 --->
INVITE sip:XXXXXXX@10.186.35.98:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.186.0.38:5060;branch=z9hG4bKh4utm43008vheqk093b0.1
Call-ID: ba9vp4zsbbsfi0vagdafg0vpzpp0z9wh@SoftX3000
From: ;tag=zwbzfehp-CC-22
To:
CSeq: 1 INVITE
Contact:
Min-SE: 90
Session-Expires: 300
Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,REGISTER,INFO,PRACK,SUBSCRIBE,NOTIFY,UPDATE,MESSAGE,REFER
User-Agent: Huawei SoftX3000 V300R011
Diversion: ;reason=unconditional;counter=1
Supported: 100rel,timer Max-Forwards: 69
Content-Length: 338
Content-Type: application/sdp Priority: urgent

I need to use info from fields “To:” and “Contact:” later in my dialplan. I belive, I have to do something like “exten => _X.,1,Set(VAR=${WHAT_SHOULD_I_TYPE_HERE?})”

Could you kindly help me, please?

WBR, Dorofeev Sergey

One thought on - How To Get An Info From “To:” Header?

  • Le 17/09/2015 12:37, Дорофеев Сергей a écrit :

    Hello

    Sample:

    exten => s,1,Set(__DIALEDNUMBER=${SIP_HEADER(TO):5})
    exten => s,n,Set(__DIALEDNUMBER=${CUT(DIALEDNUMBER,@,1)})

    Regards


    Daniel