[asterisk-app-dev] Using ARI to set callerid for an outdial using pjsip?

Richard Frith-Macdonald richard.frith-macdonald at theengagehub.com
Fri Sep 15 03:00:42 CDT 2017


Help please  ... I've spent a couple of days experimenting and trawling documentation and the web in general about this, without success.

I'm initiating an out-dial using ARI, and want to set the callerid number for that outgoing call.
What I'm expecting to see is the number I specify in the Contact header of the SIP INVITE request asterisk is sending out (perhaps also in the From header ... I'm not actually sure where the callerid needs to be in the SIP request).

My test rig is two instances of asterisk on the same box;  the one listening on port 5060 is making the out-dial, the other (listening on 5062) accepts the call and has a trivial dialplan to answer and playback a few words.  This works fine.

The pjsip endpoint config Iooks like this:

[devtest]
type=endpoint
context=default
disallow=all
allow=ulaw
outbound_auth=devtest
trust_id_outbound=yes
send_pai=yes
send_rpid=yes
auth=devtest
aors=devtest

As you can see, I found various pages on the internet telling me to set trust_id_outbound, send_pai, and send_rpid to get callerid working

If I edit my pjsip.conf to set 'from_num=777',  I see
Contact: <sip:777 at 127.0.0.1:5060>
but my expectation was that leaving 'from_num' unset the value from CALLERID(num) should appear there.
In fact if I leave it unset I see
Contact: <sip:asterisk at 127.0.0.1:5060>

The sequence of ARI operations I'm using is really simple:
1. channels/create (with app = myapp, channelId = "XXX, endpoint = PJSIP/123456 at devtest)
2. channels/XXX/variable (with variable=CALLERID(num) and value=777)
3. channels/XXX/dial (with timeout=30)

I'm hoping someone can easily spot my stupid mistake and tell me how ARI can set the callerid for an outbound call via pjsip.
Thanks.




More information about the asterisk-app-dev mailing list