How to use the PJSIP_HEADER for Paging in PJSIP?

Hi,

I had a working dialing code for paging with the Chansip channel. I’m having a hard time to get it to work with the PJSIP driver.

I had the following dialplan working in Chansip:

;Paging

exten => *71,1,Verbose(2,Paging) same => n,SIPAddHeader(Call-Info:\;answer-after=0) same => n,Set(PageDevice=SIP/U_6995) same => n,Page(${PageDevice},i) same => n,Hangup()

I have now this in PJSIP and the phone rings but it looks like the header is not added because the phone (Cisco) will not auto answer.

[code];Paging
exten => *71,1,Verbose(2,Paging device)
same => n,Set(PageDevice=PJSIP/U_6995)
same => n,Page(${PageDevice},i)
same => n,Page(${PageDevice},i,b(paging_handler^addheader^1))
same => n,Hangup()

[paging_handler]
exten => addheader,1,Set(PJSIP_HEADER(add,Call-Info:;Answer-After=0)=)
[/code]

I have also tried without the handler and I see no header added in wireshark.

;Paging exten => *71,1,Verbose(2,Paging) same => n,Set(PJSIP_HEADER(add,Call-Info:\;answer-after=0)=) same => n,Set(PageDevice=PJSIP/U_6995) same => n,Page(${PageDevice},i) same => n,Hangup()

Your dialplan using a pre-dial handler has a normal Page followed by the Page with the pre-dial handler. It’s unlikely that the Page with the pre-dial handler actually got invoked. What is the console output, and what is the SIP signaling (pjsip set logger on)?

Ok here is the final dialplan corrected (without the normal page before the pre-dialer)
It is still not working.

[code];Paging
;Paging
exten => *71,1,Verbose(2,Paging device)
same => n,Set(PageDevice=PJSIP/U_6995)
same => n,Page(${PageDevice},i,b(paging_handler^addheader^1))
same => n,Hangup()

[paging_handler]
exten => addheader,1,Set(PJSIP_HEADER(add,Call-Info:;Answer-After=0)=)[/code]

[Jun 12 08:34:00] – Executing [*71@internal:1] Verbose(“PJSIP/01-A-A4934CFE2736-0000199f”, “2,Paging device”) in new stack
[Jun 12 08:34:00] == Paging device
[Jun 12 08:34:00] – Executing [*71@internal:2] Set(“PJSIP/01-A-A4934CFE2736-0000199f”, “PageDevice=PJSIP/U_6995”) in new stack
[Jun 12 08:34:00] – Executing [*71@internal:3] Page(“PJSIP/01-A-A4934CFE2736-0000199f”, “PJSIP/U_6995,i,b(paging_handler^addheader^1)”) in new stack
[Jun 12 08:34:00] – Called U_6995
[Jun 12 08:34:00] – <PJSIP/01-A-A4934CFE2736-0000199f> Playing ‘beep.ulaw’ (language ‘fr’)
[Jun 12 08:34:00] == Using SIP RTP Audio TOS bits 184
[Jun 12 08:34:00] == Using SIP RTP Audio CoS mark 6
[Jun 12 08:34:00] – PJSIP/U_6995-000019a0 is ringing
[Jun 12 08:34:00] <— Transmitting SIP response (822 bytes) to UDP:10.188.6.24:5061 —>
[Jun 12 08:34:00] SIP/2.0 200 OK
[Jun 12 08:34:00] Via: SIP/2.0/UDP 10.188.6.24:5061;rport=5061;received=10.188.6.24;branch=z9hG4bK-46295178
[Jun 12 08:34:00] Call-ID: 6c1ef1bf-2e980314@10.188.6.24
[Jun 12 08:34:00] From: sip:01-A-A4934CFE2736@XXX.XXX.XXX.XX;tag=438399c348e9dae0o0
[Jun 12 08:34:00] To: sip:*71@XXX.XXX.XXX.XX;tag=68089e91-fc10-4405-ba80-fca0698656d1
[Jun 12 08:34:00] CSeq: 102 INVITE
[Jun 12 08:34:00] Server: Asterisk PBX 13.4.0
[Jun 12 08:34:00] Contact: sip:XXX.XXX.XXX.XX:5060
[Jun 12 08:34:00] Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
[Jun 12 08:34:00] Supported: 100rel, timer, replaces, norefersub
[Jun 12 08:34:00] Content-Type: application/sdp
[Jun 12 08:34:00] Content-Length: 237
[Jun 12 08:34:00]
[Jun 12 08:34:00] v=0
[Jun 12 08:34:00] o=- 25603912 25603914 IN IP4 XXX.XXX.XXX.XX
[Jun 12 08:34:00] s=Asterisk
[Jun 12 08:34:00] c=IN IP4 XXX.XXX.XXX.XX
[Jun 12 08:34:00] t=0 0
[Jun 12 08:34:00] m=audio 14664 RTP/AVP 0 101
[Jun 12 08:34:00] a=rtpmap:0 PCMU/8000
[Jun 12 08:34:00] a=rtpmap:101 telephone-event/8000
[Jun 12 08:34:00] a=fmtp:101 0-16
[Jun 12 08:34:00] a=ptime:20
[Jun 12 08:34:00] a=maxptime:150
[Jun 12 08:34:00] a=sendrecv
[Jun 12 08:34:00]
[Jun 12 08:34:00] <— Received SIP request (693 bytes) from UDP:10.188.6.24:5061 —>
[Jun 12 08:34:00] ACK sip:XXX.XXX.XXX.XX:5060 SIP/2.0
[Jun 12 08:34:00] Via: SIP/2.0/UDP 10.188.6.24:5061;branch=z9hG4bK-e079fedc
[Jun 12 08:34:00] From: sip:01-A-A4934CFE2736@XXX.XXX.XXX.XX;tag=438399c348e9dae0o0
[Jun 12 08:34:00] To: sip:*71@XXX.XXX.XXX.XX;tag=68089e91-fc10-4405-ba80-fca0698656d1
[Jun 12 08:34:00] Call-ID: 6c1ef1bf-2e980314@10.188.6.24
[Jun 12 08:34:00] CSeq: 102 ACK
[Jun 12 08:34:00] Max-Forwards: 70
[Jun 12 08:34:00] Authorization: Digest username=“01-A-A4934CFE2736”,realm=“XXX.XXX.XXX.XX”,nonce=“1434112440/42140018146b120209c0f890da7c9347”,uri="sip:71@XXX.XXX.XXX.XX",algorithm=MD5,response=“e12fdd60191d101536a4bab7ff8012f0”,opaque=“315ef92c615f0d69”,qop=auth,nc=00000001,cnonce=“ee64ed90”
[Jun 12 08:34:00] Contact: sip:01-A-A4934CFE2736@10.188.6.24:5061
[Jun 12 08:34:00] User-Agent: Cisco/SPA514G-7.5.7
[Jun 12 08:34:00] Content-Length: 0
[Jun 12 08:34:00]
[Jun 12 08:34:00]
[Jun 12 08:34:00] > 0x7f82acc18bc0 – Probation passed - setting RTP source address to 10.188.6.24:16462
[Jun 12 08:34:00] – Channel PJSIP/01-A-A4934CFE2736-0000199f joined ‘softmix’ base-bridge
dti-asterisk
CLI>
Disconnected from Asterisk server
[Jun 12 08:34:02] Asterisk cleanly ending (0).
[Jun 12 08:34:02] Executing last minute cleanups

You’ll want to do:

same  => n,Page(${PageDevice},ib(paging_handler^addheader^1))

And not have a comma separating the i and b options.

Still no luck.

Ah, your PJSIP_HEADER usage is also incorrect.

If you want “Call-Info: ;Answer-After=0” in the SIP message then:

exten => addheader,1,Set(PJSIP_HEADER(add,Call-Info)=\;Answer-After=0)

If you want “Call-Info: Answer-After=0” in the SIP message then:

exten => addheader,1,Set(PJSIP_HEADER(add,Call-Info)=Answer-After=0)

Oh, and you’ll also want to add a priority to your gosub which does Return

Thanx a lot! It is working now.

Here is the final dialplan for anyone paging cisco phone with PJSIP:

[code];Paging
exten => *71,1,Verbose(2,Paging device)
same => n,Set(PageDevice=PJSIP/U_6995)
same => n,Page(${PageDevice},ib(paging_handler^addheader^1))
same => n,Hangup()

[paging_handler]
exten => addheader,1,Set(PJSIP_HEADER(add,Call-Info)=;Answer-After=0)
same => n,Return()[/code]