[SOLVED] PJSIP not recognising callerid in dialplan

Using Asterisk 15.0.0, I’ve finally been able to switch over from SIP to PJSIP (a nightmare - for another time!)

Unfortunately I’m stuck on one final issue which I cannot figure out.

I have endpoints defined for mobile phones so that we can use sip clients to make calls through our company PBX. Rather than create outgoing trunks for every mobile (which isn’t feasible), under SIP I used callerid set to the extension name of the office VoIP phone, i.e. if the VoIP phone extension is Joe, the mobile extension is Joe-Mobile with callerid=Joe. With SIP this has worked perfectly.

With PJSIP the $CALLERID(name) function in all our outgoing dialplans return null when called by the Joe-Mobile endpoint but does show correctly if I run pjsip show endpoint Joe-Mobile in the cli.

Is this a bug or have I missed something? And is there a work-around?

I need to solve this urgently as we have people in the field relying on this facility.

Thanks

How have you set the caller ID? Is it configured in the endpoint callerid?

The relevant section from my pjsip.conf file is

Joe-Mobile
auth = Joe-Mobile
aors = Joe-Mobile
callerid = Office
callerid_tag = Office
;rewrite_contact = yes
from_user = Office

I don’t think I need the callerid_tag or from_user but I’m trying everything!

The endpoint-internal template is

endpoint-internal
type = endpoint
context = User
allow = !all,g722,alaw
direct_media = no
rtp_symmetric = yes
trust_id_outbound = yes
device_state_busy_at = 1

The correct dialplans are being called

Thanks

I’d remove callerid_tag and also try including a number in the callerid. For example:

callerid=Office <1000>

And this is for a call into Asterisk from the endpoint and using ${CALLERID(name)} to examine it, correct?

1 Like

Sorry for the delayed reply - I’ve been testing stuff around your suggestion.

Anyway your suggestion works! We don’t use extension numbers here so I wasn’t sure how to implement this without re-engineering the whole system. However it turns out that I can put any number inside the <> and the dialplan will correctly extract the CALLERID(name) part so I’ve got what I/we need.

Many thanks.

This solution has thrown up another issue - all calls from mobiles come up as anonymous on the receiver’s phone rather than with the trunk number - so I may need to post another question once I’ve finished pulling out what’s left of my hair!

Suffice to say you are a STAR. Thanks again.

If you don’t put a number in then the string provided is considered the number without a name.

Ahh that makes sense. What threw me is that this has been working without a number for several years under chan_sip :wink:

The chan_sip implementation may have been “helpful” and used it for both.

2 Likes