Cannot force outbound caller id

I am attempting to use a custom dial plan and queues to create a tech support phone tree that rings both internal extensions and external cell phones. One of the items that I would like to be able to do is set the outbound caller id prior to force the caller id to a specific number so that the person answering the call on their cellphone will know it is this call tree. The dial plan has…

exten => s,n,Set(CALLERID(all)=“Tech Support” <{redacted}6102>)
exten => s,n,Goto(ext-queues,610201,1)

If I trace the logs I see that the number and id are used for a brief while but the receiving call will get the original caller id. Tracing through the dial plan I see that at several points the [macro-userid-callerid] is invoked and in that code the lines…

exten => s,n(continue),Set(CALLERID(number)=${CALLERID(number):0:40})
exten => s,n,Set(CALLERID(name)=${CALLERID(name):0:40})
exten => s,n,Set(CDR(cnum)=${CALLERID(num)})
exten => s,n,Set(CDR(cnam)=${CALLERID(name)})

… seem to revert it back to the original caller id number and name.

Is there any way to coerce it so that this macro will not keep resetting back?

Your trunk needs to be configured to allow “internal” Caller IDs using the “Intracompany” option AND you can’t force the outbound trunk ID. Once you do those things, whatever CID you supply should show up.

This also means that you need to make sure your outbound caller IDs are reasonable. You can’t have it both ways - if you don’t set the IDs at the trunk, they won’t get set automatically, so you have to craft your caller ID settings with forethought.

When I was playing with this last, a lot of people that I called got calls from “<510> Office Computer” which really confused a couple of them.

I don’t quite understand what you are suggesting but don’t think it is what I am talking about.

We routinely set outbound caller id for direct dialed outbound and our trunk lines will take the value - and if I simply call Set(CALLERID(all)) and issue a Dial command it will work.

exten => s,n,Set(CALLERID(all)=“Tech Support” <{redacted}6102>)
exten => s,n,Dial(“DAHDI/g0/{redacted}7083”,25,m)

In this case the caller ID shown on the external line is the 6102 line as expected.

The issue is that embedded in all the nested calls of the queueing system - it is calling the [macro-userid-callerid] at several points - and in this code it is explicitly forcing the caller id back to the original caller id using this line…


… this macro seems to be trying to look up AMPUSER information and guarantee that the callerid does not extend beyond 40 characters. So somewhere in the call sequence the CALLERID(number) is getting forced back to the original caller id PRIOR to opening the trunk line to make the external call.

The series of internal calls is complicated to trace - but I was hoping that there was some other setting that people knew about that would cause it to keep using the override that I have in the dialplan.

Instead of trying to write the outbound CID early in the call flow as you are currently, set a unique channel variable to track the call, i.e.:

exten => s,n,Set(__queue_cid="Tech Support" <{redacted}6102>)  ; leading double underscore may or may not be necessary
exten => s,n,Goto(ext-queues,610201,1)

The channel var will carry the desired CID, which you can then set at the very last point prior to leaving the system by:

exten => s,1,ExecIf($["${queue_cid}"!=""]?Set(CALLERID(all)=${queue_cid})

mw;dt (might work; didn’t test)