Setting the Caller ID

There are many legitimate reasons why you may want to set the caller ID on outbound calls. For example, if you are calling an external number through a SIP softphone then you may want to make the call look like it’s coming from your cellphone. Asterisk doesn’t place any limitations on setting (or changing) the caller ID, so do not abuse this power by “spoofing” other people’s caller-id.

Setting the caller ID is very simple. Simply change the CALLERID variable. You can either change both the name and number-

exten => _1NXXNXXXXXX,1,Set(CALLERID(all)="Joe Smith" <2095551212>)
exten => _1NXXNXXXXXX,n,Dial(SIP/flowroute/${EXTEN},30,r)

– or you can change just the number.

exten => _1NXXNXXXXXX,1,Set(CALLERID(num)=2095551212)
exten => _1NXXNXXXXXX,n,Dial(SIP/flowroute/${EXTEN},30,r)

(In case you were wondering about the pattern used in the extension, it will match any valid phone number in USA/Canada, but will not match an international number.)