How to get Caller number in case the caller is calling via SIP


I have configured asterisk to accept SIP calls but when I got a call via SIP the caller ID is not showing. instead I got the name of the context that has been used to configure the SIP account.

for example, This is what exists in sip.conf file


once the user called using the above context information. I see the call in the CDR table in the SRC column as “user” same value as callerid property I set in the sip.conf file.

Now, How to make CDR save caller number not the callerid value from the sip.conf file ?


There are 2 ways of doing this either from sip peer or by using set caller ID keyword in the dialplan

set trustrpid,=yes and then use the CALLLERID() FUNCTION

That should be trustrpid, not sendrpid. It requires that the ITSP actually send the caller ID using either P-Asserted-Idenity, or Remote-Party-ID headers.

However, in this case, the problem is the use of callerid. There seems no sensible reason for including this options, so please explain why this has been don. callerid will override even trustrpid, and is only really suitable for lines from individual phones.

Yes you right, I did not read it is an inbound call.