Custom destinations not working after Set Caller ID

Hello Everyone,

It is my first post in this community forum, Please also pardon my English as I am not a native English speaker.

We have just migrated from PASCOM to FreePBX 15 (All configurations on freepbx are done via GUI). Everything is working fine and setup seems to be very promising. Recently, my manager ask me to add additional “0” in the beginning of all incoming CID’s (I don’t know why or what will be their planning for future). I google out little bit and found Set caller ID module for this purpose. I use following parameters in Set Caller ID module:

Description: Add 0 in Caller ID - All extensions
CallerID Name: ${CALLERID(name)}
CallerID Number: 0${CALLERID(num)}
Destination: Ring Group/Queue/Extension/Custom Destinations

So, I made things work in this way:

||-Incoming Route (Inbound)-|| ------------> ||-Set caller ID (Add 0)-|| ---------> ||-Destinations-||

The above solutions working fine with 90% of my incoming:

Inbounds —> Set Caller ID ----> Ring group {Working}
Inbounds —> Set Caller ID ----> Queues {Working}
Inbounds —> Set Caller ID ----> Specific internal Extension {Working}

But when working with custom destinations, it broke somehow:

Inbounds —> Set Caller ID ----> Custom Destination ----> All extensions {Not Working}

My Custom Destination is forwarding incoming calls to desired internal extension after evaluating last three digits of incoming DID. The configuration of custom destination is as follow:

Target: ext-local,${EXTEN:-3},1
Description: Inbound Calls to Extensions
Return: NO

And lastly The inbound route for these custom destinations is following:

Description: Inbound Calls to Extensions
CallerID Number:
CID Priority Route: NO
Alert Info: None
Ringer Volume Override: None
CID name prefix:
Music On Hold: Default
Set Destination: Set CallerID
Add 0 in caller ID - All extensions

Debugging Results from CLI after test call:

– Executing [[email protected]:20] Set(“SIP/COLT-0000091b”, “__CRM_DIRECTION=INBOUND”) in new stack
– Executing [[email protected]:21] Set(“SIP/COLT-0000091b”, “__CRM_SOURCE=01577412XXXX”) in new stack
– Executing [[email protected]:22] Set(“SIP/COLT-0000091b”, “__CRM_LINKEDID=1626699760.3150”) in new stack
– Executing [[email protected]:23] AGI(“SIP/COLT-0000091b”, “agi://,true”) in new stack
– <SIP/COLT-0000091b>AGI Script agi:// completed, returning 0
– Executing [[email protected]:24] ExecIf(“SIP/COLT-0000091b”, “1?Set(CHANNEL(hangup_handler_push)=crm-hangup,s,1)”) in new stack
– Executing [[email protected]:25] Goto(“SIP/COLT-0000091b”, “app-setcid,17,1”) in new stack
– Goto (app-setcid,17,1)
– Executing [[email protected]:1] NoOp(“SIP/COLT-0000091b”, "(Add 0 in Caller ID - All extensions) Changing cid to +491577412XXXX <001577412XXXX>") in new stack
– Executing [[email protected]:2] Set(“SIP/COLT-0000091b”, “CALLERID(name)=+491577412XXXX”) in new stack
– Executing [[email protected]:3] Set(“SIP/COLT-0000091b”, “CALLERID(num)=001577412XXXX”) in new stack
– Executing [[email protected]:4] Goto(“SIP/COLT-0000091b”, “ext-local,17,1”) in new stack
– Goto (ext-local,17,1)
[2021-07-19 15:02:40] WARNING[30446][C-0000056f]: pbx.c:4510 __ast_pbx_run: Channel ‘SIP/COLT-0000091b’ sent to invalid extension but no invalid handler: context,exten,priority=ext-local,17,1
– Executing [[email protected]:1] Macro(“SIP/COLT-0000091b”, “hangupcall,”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/COLT-0000091b”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)

XXXXXXXXX My assessments: I think ${EXTEN} in custom destination target is replace by 17 and causing disruptions. I am also not an expert on this topic and seek some expertise for this issue from all of you. Thanks


It’s not appropriate to reference the channel var function EXTEN in a custom destination, as it’s value will change depending on what destinations come before it. In this case, you probably want to use FROM_DID in which case your target will change to

Target: ext-local,${FROM_DID:-3},1

Most likely because your country’s standard dial plan is to normally dial a 0+number for standard calls?

CallerID standardization is a good thing.

In the US, people are used to seeing only a 10 digit telephone number. Some providers send the number as 10 digits, some send it with a 1 in front and some send it with a +1 (E.164).

On the inbound call, I always manipulate it to be just 10 digits. Then in my outbound routes, I prepend anything I need to send it back to the carrier.

voilaaaaa, Issue resolved. Thanks @lgaetz :grinning:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.