Is there a system “variable” in Asterisk 16 where I can get just the phone number part of the P-Assserted_Identity? Or do I just need to do a string manipulation on ${SIP_HEADER(P-Asserted-Identity)}?
But I just want asterisk to return +17145551212, is there a system variable where I can get that already?
CallerID(num/name) would not do as it return what is in the “from” header which sometime is “fake”. From the carrier, in the “from” header it would show “anonymous”, but they put the “true” callerid in the p-asswerted-identity.
P-Asserted-Identity
Asterisk does nothing when it receives a P-Asserted-Identity header. It ignores it totally no matter what settings you use for “trustrpid” or “sendrpid”. It does not copy it from an inbound call leg to an outbound call leg for a bridged SIP-to-SIP call.
Remote-Party-ID
If you have set “sendrpid=yes” in the settings for the destination peer in sip.conf then Asterisk will always add an RPI header. Here is a typical example:
However, why do you need to do this? Asterisk does this automatically for the request URI, setting ${EXTEN}, and that is the only place where you should be getting that full syntax.
thank you ambiorixg12! I guess I didn’t read carefully enough. The CUT function is like a “split” funciton in .net. It will split string using a “delimiter”. So, yes, using that function I was able to extract the information from the p-assert string.
And to David, I can’t use EXTEN as exten is the DNIS (the TO header number). I need the FROM number. The reason I have to use p-assert is that because the Carrier (Verizon in this case), they pass the call to me that way. It is a toll free (8xx) inbound service to us. Normally 8xx they will ALWAYS show the “true” callerid, no matter if the guy have callerid block (out going) or not. In this particular case, Verizon send us the caller-id (the blocked) in the regular FROM header. Which sometime shows as “anonymous”. But I need the “true” caller-id which Verizon then put in the p-assert section of the INVITE. Thus I have to use SIP_HEADER(p-assert) function to get it.
Unless, of course, you know an easier way of doing this?
Ya, that was another thing I just tried to start to do. In my database that field was set to “null”, so I changed to “yes” now. I will just have to wait until I see anther “anonymous” call to verify.