Inbound calling number not shown on external forwarding

(Vintschente) #1

An inbound calling number that calls an extension and gets forwarded from the extension to a misc destination (mobile number) is not shown on the misc destination but our trunk number instead.

A classic it seems. We have CLIP no screening enabled at our trunk provider so we can call with any number we want to (so this is out of the way). This worked on an elastix (I checked everything also the unembedded PBX) but after we switched to FreePBX it just doesn’t work anymore (I thought it would just work if possible). I checked tons of settings in the FreePBX and looked into all threads I could find with the same topic but there was no solution to it. I also checked the forwarded call with a tcpdump and it wants to call with our trunk number instead of the callers number.

FreePBX version:

So my “simple” question is…what needs to be set so the misc destination sees the inbound callers number?

Thank you guys in advance!

(Dave Burgess) #2

There are a few places that you can set this up. There are options (trust-rport, for example I think) and you can also set the calls caller-id through the SetCallerID Function.

The logs will tell you when in the process the caller ID is getting set - that information should help us make recommendations.

(Vintschente) #3

Here is a log of a call:

I think it is around the line

“[2020-10-21 13:02:58] VERBOSE[12949][C-000002f4] pbx.c: Executing [s@macro-outbound-callerid:32] ExecIf(“PJSIP/trunk-hlkomm-000004fd”, “1?Set(CALLERID(all)=our trunk number)”) in new stack”

Any help or advice is really appreciated!


Also here is the [macro-outbound-callerid] part of the extensions_additional.conf file:

include => macro-outbound-callerid-custom
exten => s,1,Noop(${REALCALLERIDNUM})
exten => s,n,Noop(${KEEPCID})
exten => s,n,Noop(${OUTKEEPCID_${ARG1}})
exten => s,n,ExecIf($["${CALLINGNAMEPRES_SV}" != “”]?Set(CALLERPRES(name-pres)=${CALLINGNAMEPRES_SV}))
exten => s,n,ExecIf($["${CALLINGNUMPRES_SV}" != “”]?Set(CALLERPRES(num-pres)=${CALLINGNUMPRES_SV}))
exten => s,n,Set(HOTDESCKCHAN=${CUT(CHANNEL,/,2)})
exten => s,n,Set(HOTDESKCALL=0)
exten => s,n,ExecIf($["${DB(EDEVICE/${HOTDESKEXTEN}/user)}"=“DummyUser”]?Set(HOTDESKCALL=1))
exten => s,n,ExecIf($[${HOTDESKCALL}=1]?Set(CALLERID(name)=${DB(EDEVICE/${HOTDESKEXTEN}/location)}))
exten => s,n,Set(ALLOWTHISROUTE=NO)
exten => s,n,ExecIf($["${EMERGENCYROUTE}" = “YES”]?Set(ALLOWTHISROUTE=YES))
exten => s,n,ExecIf($[${HOTDESKCALL}= 1 & ${ALLOWTHISROUTE} = NO ]?Hangup())
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n,ExecIf($[$["${CIDMASQUERADING}" = “TRUE”] & $[$["${AMPUSER}" = “”] | $["${AMPUSER}" = “${DB(AMPUSER/${FROMEXTEN}/cidnum)}”]]]?Set(AMPUSER=${FROMEXTEN}))
exten => s,n(start),GotoIf($[ $[${LEN(${REALCALLERIDNUM})} = 0] | $["${KEEPCID}" != “TRUE”] | $["${OUTKEEPCID_${ARG1}}" = “on”] ]?normcid)
exten => s,n,GotoIf($["${CIDMASQUERADING}" = “TRUE”]?normcid)
exten => s,n,GotoIf($["${DB(AMPUSER/${REALCALLERIDNUM}/device)}" = “” & “${DB(DEVICE/${REALCALLERIDNUM}/user)}” = “”]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${AMPUSER}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,ExecIf($[${HOTDESKCALL}= 1]?Set(EMERGENCYCID=${DB(EDEVICE/${HOTDESKEXTEN}/emergency_cid)}))
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($["${EMERGENCYROUTE:1:2}" = “” | “${EMERGENCYCID:1:2}” = “”]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n,GotoIf($["${CALLERID(name)}" = “”]?cnum)
exten => s,n,Set(CDR(outbound_cnam)=${CALLERID(name)})
exten => s,n(cnum),Set(CDR(outbound_cnum)=${CALLERID(num)})
exten => s,n(exit),MacroExit()
exten => s,n(trunkcid),ExecIf($[${LEN(${TRUNKOUTCID})} != 0]?Set(CALLERID(all)=${TRUNKOUTCID}))
exten => s,n(usercid),ExecIf($[${LEN(${USEROUTCID})} != 0]?Set(CALLERID(all)=${USEROUTCID}))
exten => s,n,ExecIf($[${LEN(${TRUNKCIDOVERRIDE})} != 0 | ${LEN(${FORCEDOUTCID_${ARG1}})} != 0]?Set(CALLERID(all)=${IF($[${LEN(${FORCEDOUTCID_${ARG1}})}=0]?${TRUNKCIDOVERRIDE}:${FORCEDOUTCID_${ARG1}})}))
exten => s,n,ExecIf($["${QCALLBACK}" = “1” & ${LEN(${FORCEDOUTCID_${ARG1}})} = 0]?Set(CALLERID(all)=${REALCALLERIDNUM}))
exten => s,n,Set(TIOHIDE=no)
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"=“hidden”]?Set(CALLERPRES(name-pres)=prohib_passed_screen))
exten => s,n,ExecIf($["${CALLERID(name)}"=“hidden”]?Set(CALLERPRES(num-pres)=prohib_passed_screen))
exten => s,n,ExecIf($["${TIOHIDE}"=“yes”]?Set(CALLERPRES(name-pres)=prohib_passed_screen))
exten => s,n,ExecIf($["${TIOHIDE}"=“yes”]?Set(CALLERPRES(num-pres)=prohib_passed_screen))
exten => s,n,Set(CDR(outbound_cnum)=${CALLERID(num)})
exten => s,n,Set(CDR(outbound_cnam)=${CALLERID(name)})

(Vintschente) #4

I think this is what’s wrong:

“0?Set(CONNECTEDLINE(num,i)=external forwarding mobile number)”) in new stack
“0?Set(CONNECTEDLINE(name,i)=CID:our trunk number)”) in new stack

It sets the num correctly but not the name. The macro to set them has the following lines:


How do I configure the pbx to set ${DIAL_NUMBER} as the name too?

Btw this is also not the solution. I even created the extensions_override_freepbx.conf and set all the vars to ${CallerID} that seemed to set it wrong. Still nothing.

(system) closed #5

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