Internal Extension to Internal Extension call does not apply Outbound Route caller ID when call is forwarded to external number using Follow Me

When making an Internal Extension to Internal Extension call, the Outbound Caller ID configured on the Outbound Route does not get applied when call is forwarded to external number configured in the follow me settings.

So say, for example, that extension 202 has 8195551234# configured as a follow me destination. When 201 dials 202, the call gets sent out over the proper Outbound Route to 8195551234, however, the caller ID is not applied. The only way for me to get a caller ID applied during this follow me scenario is to add the caller ID to the extension or to the trunk.

How do I configure the system so that the follow me call applies the Outbound Route’s caller ID?

Your post is somewhat ambiguous. If Alice on 201 calls Bob on 202 and he has FM set, the normal behavior should be to send the value of Outbound CID for 201, i.e. Alice’s external number, so Bob’s mobile shows Alice calling. If for some reason you want to show CID for the outbound route, setting Override Extension for the route should work. Otherwise, please explain.

I do not want to have to define an Oubound CID per extension (because of the sheer quantity of extensions). Setting the Override Extension flag on the Outbound Route does not set the Caller ID for follow me calls.

You can use Bulk Handler to export your extensions as a CSV file, add the Outbound CIDs with Excel and re-import. If you are using the same CID value for many extensions, this is very easy.

Or, change the Follow Me to use a prefix that routes to a trunk set up with Force Trunk CID.

Or, add a dialplan hook that rewrites invalid CIDs.

None of your suggestions have anything to do with getting the Outbound Route to apply its Caller ID when a call is sent using Follow Me.

Ext to ext call on the same PBX? Because I have no issues with this in that scenario.

There you have it.

1 Like

Blank out the Outbound CID on the extension, blank out the Outbound CallerID on the trunk, leave only the Route CID on the outbound route, then make dial 103 from 121, and you’ll see that the Route CID does not get set.

Ok, that is repeatable. So the immediate answer is to put a non-forced CID on your trunk.

The line that is different between a direct call out and a FM call out is this

# direct call out
[2020-05-08 17:39:19] VERBOSE[10516][C-0000017b] pbx.c: Executing [314NXXXXXX@from-internal:6] ExecIf("PJSIP/121-0000030c", "1?Set(TRUNKCIDOVERRIDE="Bundy Associates" <16364413926>)") in new stack
# follow me call out
[2020-05-08 17:34:55] VERBOSE[9932][C-0000017a] pbx.c: Executing [314NXXXXXX@from-internal:6] ExecIf("Local/314NXXXXXX@from-internal-00000120;2", "0?Set(TRUNKCIDOVERRIDE="Bundy Associates" <16364413926>)") in new stack

That difference affects the final caller ID decision later

# direct call out
[2020-05-08 17:39:19] VERBOSE[10516][C-0000017b] pbx.c: Executing [s@macro-outbound-callerid:30] ExecIf("PJSIP/121-0000030c", "0?Set(CALLERID(all)=)") in new stack
[2020-05-08 17:39:19] VERBOSE[10516][C-0000017b] pbx.c: Executing [s@macro-outbound-callerid:31] ExecIf("PJSIP/121-0000030c", "0?Set(CALLERID(all)=)") in new stack
[2020-05-08 17:39:19] VERBOSE[10516][C-0000017b] pbx.c: Executing [s@macro-outbound-callerid:32] ExecIf("PJSIP/121-0000030c", "1?Set(CALLERID(all)=Bundy Associates <16364413926>)") in new stack
[2020-05-08 17:39:19] VERBOSE[10516][C-0000017b] pbx.c: Executing [s@macro-outbound-callerid:33] ExecIf("PJSIP/121-0000030c", "0?Set(CALLERID(all)=121)") in new stack
# follow me call out.
[2020-05-08 17:34:55] VERBOSE[9932][C-0000017a] pbx.c: Executing [s@macro-outbound-callerid:30] ExecIf("Local/314NXXXXXX@from-internal-00000120;2", "0?Set(CALLERID(all)=)") in new stack
[2020-05-08 17:34:55] VERBOSE[9932][C-0000017a] pbx.c: Executing [s@macro-outbound-callerid:31] ExecIf("Local/314NXXXXXX@from-internal-00000120;2", "0?Set(CALLERID(all)=)") in new stack
[2020-05-08 17:34:55] VERBOSE[9932][C-0000017a] pbx.c: Executing [s@macro-outbound-callerid:32] ExecIf("Local/314NXXXXXX@from-internal-00000120;2", "0?Set(CALLERID(all)=)") in new stack
[2020-05-08 17:34:55] VERBOSE[9932][C-0000017a] pbx.c: Executing [s@macro-outbound-callerid:33] ExecIf("Local/314NXXXXXX@from-internal-00000120;2", "0?Set(CALLERID(all)=121)") in new stack

The longer answer is to open a bug report now and reference this thread. But the correct problem is that the outbound route CID is not applied to FM/FM calls to external numbers. Because the title of this thread is not correct.

For a call to an extension with FM/FM enabled and has an external number in the follow me list the:

  • outbound CID defined in the extension is applied if present.
  • outbound CID defined in the outbound route is NOT applied if present.
  • outbound CID defined in the trunk is applied if present.

Edit: The above decision is made in /etc/asterisk/extensions_additional.conf in the auto generated route contexts. Specific to my system i checked this on it is [outrt-1] ; Normal_Out

exten => _NXXNXXXXXX,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _NXXNXXXXXX,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
exten => _NXXNXXXXXX,n,Noop([TRACE](1) Calling Out Route: ${SET(OUTBOUND_ROUTE_NAME=Normal_Out)})
exten => _NXXNXXXXXX,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=${CALLEE_ACCOUNCODE}))
exten => _NXXNXXXXXX,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _NXXNXXXXXX,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${DB(AMPUSER/${AMPUSER}/outboundcid)})}=0 & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE="Bundy Associates" <16364413926>))
exten => _NXXNXXXXXX,n,Set(_NODEST=)
exten => _NXXNXXXXXX,n,Macro(dialout-trunk,2,1${EXTEN},,on)
exten => _NXXNXXXXXX,n,Macro(dialout-trunk,9,1${EXTEN},,on)
exten => _NXXNXXXXXX,n,Macro(dialout-trunk,3,1${EXTEN},,on)
exten => _NXXNXXXXXX,n,Noop([TRACE](3) All trunks failed calling ${EXTEN}, playing default congestion)
exten => _NXXNXXXXXX,n,Macro(outisbusy,)

Specifically, this line.

exten => _NXXNXXXXXX,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${DB(AMPUSER/${AMPUSER}/outboundcid)})}=0 & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE="Bundy Associates" <16364413926>))

I fixed the title of the post. I was able to figure out the following thanks to your digging.

In my outbound route, the following line doesn’t apply the caller ID because KEEPCID is set to TRUE:
exten => _NXXNXXXXXX,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${DB(AMPUSER/${AMPUSER}/outboundcid)})}=0 & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE="ACME PARTS" <5145551234>))

If I remove the ${KEEPCID}"!=“TRUE” evaluation and change it to:
exten => _NXXNXXXXXX,n,ExecIf($["${LEN(${DB(AMPUSER/${AMPUSER}/outboundcid)})}=0 & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE="ACME PARTS" <5145551234>))

Then the outbound route’s caller ID does get set. I have not been able to figure out where KEEPCID gets set. I even tried deleting the lines in dial-one and dialparties that sets it to TRUE and it still sticks to a TRUE value when dialing from a follow me.

A JIRA issue has been created by Sangoma here : https://issues.freepbx.org/browse/FREEPBX-21519

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