Inbound callerid showing Anonymous

Hi guys, this is my first post and fist time exploring into Asterisk. I’m currently on version 18.15.0-rc1 which i wanted to test out the uri tel support. But what i encounter here is the inbound callerid showing as anonymous, from the sip trace, i could see the telco sending the callerid by the “contact” header field, is there a way to tackle that field as screen shot below? Thanks in advance.

The user part of the Contact header is an opaque value that only means anything to the UAC sending it. It should not be interpreted as a caller ID.

If they are sending Anonymous in the From header, I would suggest that they have a security bug if they are leaking the value in the Contact header.

I would expect you to be able to use PJSIP_HEADER to read the contact header, which you can then parse.

It’s possible that the target_uri option, on the CHANNEL function contains the URI you want, but the documentation is a bit terse.

Found the solution:
[fix_for_callerid]
exten => _.,1,Set(CALLERID(num)=${CUT(CUT(PJSIP_HEADER(read,Contact),@,1),:,2)}).
exten => _.,n,Set(CALLERID(name)=${CUT(CUT(PJSIP_HEADER(read,Contact),@,1),:,2)}).
exten => _.,n,Goto(from-pstn,${EXTEN},1)

Thanks David :wink:

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