Call-ID Header Info


I need to know the Call-ID header of the outgoing leg ( Leg B) before the invite is sent to the endpoint. So I can tell the endpoint(phone) to uniquely identify the call for Push Notification.

How can I get this information either in Dialplan or in AMI?

Such information is not available on any AMI event, and the SIP_HEADERS()
Gets the list of SIP header names from an incoming INVITE message.

Which channel driver are you using?

I was not able to find Call-ID header in SIP_HEADERS() for outgoing channel because I was using gosub of called channel . It gets executed before the invite is sent to the called party so I was not receiving in SIP_HEADERS().
I had to find it out before the invite is sent to the called party so I can send Push notification with Call-ID.

Fortunately a SIP Variable SIPCALLID was getting set as I saw in debug.

exten => _X.,1,Set(CALLERID(name)=Dont Giveup)
exten => _X.,n,Set(foo={SIP_HEADER(Call-ID,1)}) exten => _X.,n,Dial(SIP/{EXTEN},60,b(checkcallid^callid^1))
exten => _X.,n,Hangup

exten => callid,1,Verbose( sending push)
same => n,Set(foo=${SIPCALLID})
same => n,AGI(apns)
same => n,Wait(3)
same => n,Return()

And also make sure who wish to send push in this way. Keep the qualify off for unregisterd endpoints because when qualify turned on asterisk will check the status of the endpoint if it finds unreachable it will not execute the gosub and throw message for unreachable endpoint.


I used chansip and pjsip both.

SIP_HEADERS() works only when the invite is sent. I needed Call-ID before the invite is sent.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.