Different internal and external caller IDs?

I have ~100 phones set up in /etc/asterisk/users.conf, each of which has its own internal extension (i.e. dialing 101 will call Phone 101, dialing 144 will call Phone 144). However, every phone needs to have the same caller ID when placing external calls (i.e. when Phone 144 calls a cell phone, the caller ID should read “John Smith 555-5555”). So far this is accomplished by setting callerid in /etc/asterisk/users.conf to "John Smith" <555-5555> for all 100 phones.

This has led to a lot of confusion for internal callers because even internal calls show the same “John Smith 555-5555” caller ID. I’d like it to show the actual internal caller, such as “Phone 144 x144”. Setting callerid to "Phone 144" <144> accomplishes this on internal calls, but totally messes up external caller ID.

Is there some way to tell Asterisk: “I don’t care what is set in /etc/asterisk/users, ALL external calls should use this caller ID”? If it helps, users must dial 1 before an external number to place an external call but I’m not sure which config file sets this.

1 Like

Set the caller ID in the dialplan.

1 Like

I don’t think you can set custom external caller ID because external caller ID provided by the service provider.

Hi @david551, thank you for your reply! I’ve tried setting CALLERID in /etc/asterisk/extensions.conf:

exten => 144,1,Dial(${phone144},25,hkt)
exten => 144,n,Set(CALLERID(all)="Phone 144" <144>)

However, it still displays the full external caller ID when placing an internal call. Did I use Set(CALLERID(all) incorrectly? I didn’t realize this was an option to set in the dialplan.

Can you provide us with a example endpoint configuration from your users.conf?

For example I set an account code on my endpoints and on my internal to internal dialing I set callerID based on the account code.

same => n,Set(caller1=${CDR(accountcode)})
same => n,Set(CALLERID(num)=${CUT(caller1,-,3)})

Sure @johnkiniston, here’s Phone 144’s entry in /etc/asterisk/users.conf:

[phone144]; videophone
secret = XXXXXXXX
fullname = phone144
hasvoicemail = no
hassip = yes
hasiax = no
callwaiting = no
context = internals
requirecalltoken = no
host = dynamic
nat = yes
allow = g722
allow = h264
videosupport = yes
callerid = "John Smith" <+1 555-5555>
linenumber = 1
encryption = yes

This is very doable. I have 6 different callerIds that are used depending on which region my users are calling (so I can provide a local caller id for them to return calls to)

It’s a question of when to set the value, there is a portion of your dialplan that deals with connecting to your outbound trunk, change the callerID there aswell and you are golden.

Dialplan is executed in sequence, so you need to change the callerid BEFORE you dial.

1 Like

Hi @jcolp, I’m not sure what you mean (I inherited a finished Asterisk setup with no training). I tried switching the lines in my earlier example to read like so:

exten => 144,1,Set(CALLERID(all)="Phone 144" <144>)
exten => 144,n,Dial(${phone144},25,hkt)

This didn’t produce any change in internal caller ID however.

After changing did you reload the configuration? And did you confirm in the Asterisk console the logic which was executed?

Yep, I’ve reloaded the config. I can see == Setting global variable 'phone144' to 'SIP/phone144'. To be honest I’m not sure what else to look for. Other changes, such as setting Phone 144 to a different extension, did work.

OK, so just to verify, you are editing users.conf yourself correct? It’s not being managed by FreePBX or any other tools?

Do you only ever send one caller ID out for external calls? Are they all ‘555-555-5555’ or could one user have ‘555-555-1234’ ?

Yep, all changes are made manually by editing config files. They are all using the exact same 555-5555 number, no need to add other numbers.

OK, in my mind the easiest thing to do would be to change the caller ID for all your phones in users.conf to be in the format of

callerid = "John Smith" <144>"

Then in your extensions.conf wherever you dial out to the PSTN do a

exten => s,n,Set(CALLERID(NUM)=5555555555) before the dial.

2 Likes

Thanks @johnkiniston, you were absolutely right! The trick is finding the correct spot in your dial plan.

Thank you everyone for your help!