[SOLVED] callerID update wrong in 183 progress PAI header after Dial command

Hello,

I have a Dialplan that does the following.

[from-internal]
include => out-route

[out-route]
exten => _0ZXXXXX.,1,Gosub(dial-out,s,1(${EXTEN}) 
 same => n,Hangup()

[dial-out]
exten  => s,1,set(CALLERID(num)=${ARG1})
 same =>    n,set(Set(CONNECTEDLINE(name,i)=CID:${ARG1})
 same =>    n,Dial(PJSIP/trunkoutbound/${ARG1})
 same =>    n,return()

When the user dials the number the CallerID in the phone display is correct, as soon as the Dial continues i receive a SIP 183 Progress message the CallerID(num) changes, this because then Pai header has the wrong part and contains the ā€˜sā€™ extension.

SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.51.230:5060;rport=55409;received=95.97.59.139;branch=z9hG4bK2310283810
Call-ID: 1_1037424360@192.168.51.230
From: "MT-301" <sip:10001-001@pbx.host.eu>;tag=3055177252
To: <sip:0123456789@pbx.host.eu>;tag=mRj05FfphYf99V4CRK0GCnJBATATznqX
CSeq: 2 INVITE
Server: PBX host.EU
Contact: <sip:87.1.2.3:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
P-Asserted-Identity: "CID:0123456789" <sip:s@pbx.host.eu>
Content-Type: application/sdp
Content-Length:   251

Even when is set the CallerID or CONNECTEDLINE before the Dial the part still holds the dialplan exten ā€˜sā€™ , Even a DumpChan gives back the CallerID and ConnectedLineID as set bij the diaplan.

Has anyone have a solution for this, or knows if there is a bug report?

Devices are PJSIP and have context=from-internal
using the PJSIP channel driver.
Asterisk version = 13.17.2

Thanks

I believe you need to use a pre-dial handler or your connected line update will be applied to the wrong leg of the call.

https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers

1 Like

Had not though of that.
But i still find it strange that Asterisk is using the EXTEN value (s in this case) as the content of the Pai header to the phone. (Party A)

I will try and see if a pre-dial handler would solve my problem.

Thanks for you quick response.

Richard

Well, a bit unexpected but the pre-dial handler is just what i needed, it correctly set the CallerID(num) for the Pai header.

I Changed my Dial command to :

same => n,Dial(PJSIP/${DIAL_NUMBER}@${DIAL_TRUNK},${DIAL_TRUNK_TIMEOUT},${DIAL_TRUNK_OPTIONS}b(pre-dialout-trunk^s^1(${DIAL_NUMBER})))

And Created a pre-dial handler like :

[pre-dialout-trunk]
exten => s,1,Verbose(1,Executing pre-dialout-trunk Handler ....)
 same =>   n,Set(CALLERID(num)=${ARG1})
 same =>   n,Return()

And now my Pai Header is changed from :
P-Asserted-Identity: "CID:0123456789" <sip:s@pbx.host.eu>

To :
P-Asserted-Identity: "CID:0123456789" <sip:0123456789@pbx.host.eu>

So my problem seems to have been resolved.

Again, thank you for your suggestion.

Regards,
Richard

1 Like