Sip.conf: callerid= and trustrpid=no

Hello everyone!
I have an Asterisk 11.13.1 and I’m trying to make sure my users go out with the correct outbound CID for them.

User end points are not trusted.

Currently I’m using these example peer settings in sip.conf for each user:

callerid=“John Doe” <7301234>

are these settings enough to guarantee that anything John Doe sends regarding his cid number in his SIP headers will not be used, and his outbound CID will always be 7301234?

Not exactly. That explicitly sets the caller id on calls received from the device. If you subsequently modify it in the dialplan then the caller id will be changed, and if an outgoing call is made then the caller id will not be the same as configured in sip.conf. If you don’t modify the caller id in dialplan then it will be as configured in sip.conf.

You have to set up your callerid right before you dial out from your line.
Also bare in mind that you must setup a valid callerid as your provider expects it to be or else he will overwrite the sent value and put the default number of your line.

Thank you, I am concerned with end users (end devices) somehow overriding the CID I set in sip.conf with their own values in order to spoof someone else’s number. I am concerned because in the documentation it says that Asterisk will use the value of “callerid=” in sip.conf only if no other source is available.

So my concern is exactly this: if I set trustrpid=no and callerid=“John Doe” <1111> in sip.conf in the user’s section, will the sip user be able to somehow override those values with his/her own made up ones?

[quote=“alx”]You have to set up your callerid right before you dial out from your line.

I use a common route for a number of users and I don’t know how to match user calls based on their SIP username within the dialplan. All I know is matching based on CID (like in exten => 100/1111).

Giving each end user their own context (specifying it in sip.conf context= option) seems redundant.

Setting the callerid value will override what the remote endpoint provides.

But what does this section in the docs mean then:

It is not very clear.

It means that if in your dialplan you haven’t set up the callerid variable, asterisk will use the value that is found under the sip options of the originating extension.
This will override the callerid value that the endpoint sends.

The end user can pass the callerid that he wants if you don’t setup the callerid variable in the conf files or the dialplan.

Related to the problem try this

exten => XXXX.,1,Noop(Outbound calling)
same => n,GotoIf($["${CALLERID(num)}" = “101”]:ex101)
same => n,GotoIf($["${CALLERID(num)}" = “102”]:ex102)
same => n,GotoIf($["${CALLERID(num)}" = “103”]:ex103)
same => n(ex101),Set(CALLERID(num)=7301234101)
same => n,Goto(dial)
same => n(ex102),Set(CALLERID(num)=7301234102)
same => n,Goto(dial)
same => n(ex103),Set(CALLERID(num)=7301234103)
same => n(dial),Dial(SIP/provider/${EXTEN})
same => n,Hangup

Instead of XXXX. put your preferred pattern.