Suppress CID with call forwarding

I’ve tried multiple methods to forward calls placed to an internal extension to be forwarded to an external number - misc. destination, custom extension, custom ring group, UCP call forward, etc. - and all methods are passing the incoming CID through to the outbound trunk. The problem is that our trunks will only allow internally owned DIDs to be passed to the SIP trunk instead of a forwarded CID or any other falsified number in the header.

Is there a FreePBX setting that disables the passing of a forwarded CID to the outbound trunk? If so, I haven’t been able to find it. I have looked at at least 6 other posts in these forums about this, but they all refer to doing this the reverse way ie. they WANT to pass the forwarded CID.

I have the correct DID configured on both the outbound route and the trunk, and it is passed correctly on all endpoint-created outbound calls. But when the call is being forwarded using one method or another, it is ignoring this and overriding it with the CID of the forwarded call. I confirmed this by watching the call progress in the Asterisk console logging:
Calling CID - 3135984310
Inbound DID dialed - 3139786090
Forwarding to - 3135644444

       > agi://127.0.0.1/dialparties.agi: Extension 107 has call forward set to +13135644444
       > agi://127.0.0.1/dialparties.agi: Primary ext is CF so disabling mastermode if it was set
       > agi://127.0.0.1/dialparties.agi: extnum +13135644444# has:  cw: 0; hascfb: 0 [] hascfu: 0 []
       > agi://127.0.0.1/dialparties.agi: Built External dialstring component for +13135644444: Local/[email protected]/n
    -- agi://127.0.0.1/dialparties.agi: Filtered ARG3: +13135644444
 -- Executing [[email protected]:30] ExecIf("PJSIP/Twilio-0000fe9c", "1?Set(CALLERID(all)=<+13139786090>)") in new stack
    -- Executing [[email protected]:31] ExecIf("PJSIP/Twilio-0000fe9c", "1?Set(CALLERID(all)=3135984310 3135984310 <3135984310>)") in new stack
    -- Executing [[email protected]:32] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CALLERID(all)=)") in new stack
    -- Executing [[email protected]:33] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CALLERID(all)=3135984310)") in new stack
    -- Executing [[email protected]:34] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CALLERID(all)=3135984310)") in new stack
    -- Executing [[email protected]:35] Set("PJSIP/Twilio-0000fe9c", "TIOHIDE=no") in new stack
    -- Executing [[email protected]:36] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CALLERPRES(name-pres)=prohib_passed_screen)") in new stack
    -- Executing [[email protected]:37] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CALLERPRES(num-pres)=prohib_passed_screen)") in new stack
    -- Executing [[email protected]:38] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CALLERPRES(name-pres)=prohib_passed_screen)") in new stack
    -- Executing [[email protected]:39] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CALLERPRES(num-pres)=prohib_passed_screen)") in new stack
    -- Executing [[email protected]:40] Set("PJSIP/Twilio-0000fe9c", "CDR(outbound_cnum)=3135984310") in new stack
    -- Executing [[email protected]:41] Set("PJSIP/Twilio-0000fe9c", "CDR(outbound_cnam)=3135984310 3135984310") in new stack
    -- Executing [[email protected]:14] GosubIf("PJSIP/Twilio-0000fe9c", "0?sub-flp-1,s,1()") in new stack
    -- Executing [[email protected]:15] Set("PJSIP/Twilio-0000fe9c", "OUTNUM=+13135644444") in new stack
    -- Executing [[email protected]:16] Set("PJSIP/Twilio-0000fe9c", "custom=PJSIP") in new stack
    -- Executing [[email protected]:17] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)") in new stack
    -- Executing [[email protected]:18] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))") in new stack
    -- Executing [[email protected]:19] GotoIf("PJSIP/Twilio-0000fe9c", "1?gocall") in new stack
    -- Goto (macro-dialout-trunk,s,21)
    -- Executing [[email protected]:21] Macro("PJSIP/Twilio-0000fe9c", "dialout-trunk-predial-hook,") in new stack
    -- Executing [[email protected]:1] MacroExit("PJSIP/Twilio-0000fe9c", "") in new stack
    -- Executing [[email protected]:22] GotoIf("PJSIP/Twilio-0000fe9c", "1?skipcrm") in new stack
    -- Goto (macro-dialout-trunk,s,28)
    -- Executing [[email protected]:28] NoOp("PJSIP/Twilio-0000fe9c", "CRM Finished") in new stack
    -- Executing [[email protected]:29] GotoIf("PJSIP/Twilio-0000fe9c", "0?bypass,1") in new stack
    -- Executing [[email protected]:30] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CONNECTEDLINE(num,i)=+13135644444)") in new stack
    -- Executing [[email protected]:31] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CONNECTEDLINE(name,i)=CID:3135984310)") in new stack
    -- Executing [[email protected]:32] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)3135984310)") in new stack
    -- Executing [[email protected]:33] GotoIf("PJSIP/Twilio-0000fe9c", "0?customtrunk") in new stack
    -- Executing [[email protected]:34] ExecIf("PJSIP/Twilio-0000fe9c", "1?Set(DIAL_TRUNK_OPTIONS=)") in new stack
    -- Executing [[email protected]:35] Set("PJSIP/Twilio-0000fe9c", "HASH(__SIPHEADERS,Alert-Info)=unset") in new stack
    -- Executing [[email protected]:36] Dial("PJSIP/Twilio-0000fe9c", "PJSIP/[email protected],300,b(func-apply-sipheaders^s^1,(1))U(sub-send-obroute-email^+13135644444^13135644444^1^129937404^3135984310 3135984310^3135984310)") in new stack
    -- PJSIP/Twilio-0000fe9d Internal Gosub(func-apply-sipheaders,s,1(1)) start
Set(PJSIP_HEADER(remove,Alert-Info)=)") in new stack
[2022-04-28 16:23:32] ERROR[32334]: res_pjsip_header_funcs.c:547 remove_header: No headers had been previously added to this session.
    -- Executing [[email protected]:9] ExecIf("PJSIP/Twilio-0000fe9d", "0?Set(sipheader=<http://127.0.0.1>;info=unset)") in new stack
    -- Executing [[email protected]:10] ExecIf("PJSIP/Twilio-0000fe9d", "0?Set(sipheader=<http://127.0.0.1>unset)") in new stack
    -- Executing [[email protected]:11] ExecIf("PJSIP/Twilio-0000fe9d", "0?SIPAddHeader(Alert-Info:unset)") in new stack
    -- Executing [[email protected]:12] ExecIf("PJSIP/Twilio-0000fe9d", "0?Set(PJSIP_HEADER(add,Alert-Info)=unset)") in new stack
    -- Executing [[email protected]:13] EndWhile("PJSIP/Twilio-0000fe9d", "") in new stack
    -- Executing [[email protected]:5] While("PJSIP/Twilio-0000fe9d", "0") in new stack
    -- Executing [[email protected]:14] Return("PJSIP/Twilio-0000fe9d", "") in new stack
  == Spawn extension (from-pstn-e164-us, 13135644444, 1) exited non-zero on 'PJSIP/Twilio-00000c9d'
    -- PJSIP/Twilio-00000c9d Internal Gosub(func-apply-sipheaders,s,1(1)) complete GOSUB_RETVAL=
    -- Called PJSIP/[email protected]
    -- PJSIP/Twilio-00000c9d Internal Gosub(crm-hangup,s,1) start
    -- Executing [[email protected]:1] NoOp("PJSIP/Twilio-0000fe9d", "Sending Hangup to CRM") in new stack
    -- Executing [[email protected]:2] NoOp("PJSIP/Twilio-0000fe9d", "HANGUP CAUSE: 127") in new stack
    -- Executing [[email protected]:3] ExecIf("PJSIP/Twilio-0000fe9d", "0?Set(__CRM_VOICEMAIL=)") in new stack
    -- Executing [[email protected]:4] NoOp("PJSIP/Twilio-0000fe9d", "MASTER CHANNEL: 1651177412.3739 = 1651177404.3736") in new stack
    -- Executing [[email protected]:5] GotoIf("PJSIP/Twilio-0000fe9d", "1?return") in new stack
    -- Goto (crm-hangup,s,8)
    -- Executing [[email protected]:8] Return("PJSIP/Twilio-0000fe9d", "") in new stack
  == Spawn extension (from-pstn-e164-us, 13135644444, 1) exited non-zero on 'PJSIP/Twilio-00000c9d'
    -- PJSIP/Twilio-00000c9d Internal Gosub(crm-hangup,s,1) complete GOSUB_RETVAL=
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [[email protected]:37] NoOp("PJSIP/Twilio-0000fe9c", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 127") in new stack
    -- Executing [[email protected]:38] GotoIf("PJSIP/Twilio-0000fe9c", "0?continue,1:s-CHANUNAVAIL,1") in new stack
    -- Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
    -- Executing [[email protected]:1] Set("PJSIP/Twilio-0000fe9c", "RC=127") in new stack
    -- Executing [[email protected]:2] Goto("PJSIP/Twilio-0000fe9c", "127,1") in new stack
    -- Goto (macro-dialout-trunk,127,1)
    -- Executing [[email protected]:1] Goto("PJSIP/Twilio-0000fe9c", "continue,1") in new stack
    -- Goto (macro-dialout-trunk,continue,1)
    -- Executing [[email protected]:1] NoOp("PJSIP/Twilio-0000fe9c", "TRUNK Dial failed due to CHANUNAVAIL HANGUPCAUSE: 127 - failing through to other trunks") in new stack
    -- Executing [[email protected]:2] ExecIf("PJSIP/Twilio-0000fe9c", "0?Set(CALLERID(number)=)") in new stack
    -- Executing [[email protected]:12] Macro("PJSIP/Twilio-0000fe9c", "outisbusy,") in new stack
    -- Executing [[email protected]:1] Progress("PJSIP/Twilio-0000fe9c", "") in new stack
    -- Executing [[email protected]:2] GotoIf("PJSIP/Twilio-0000fe9c", "0?emergency,1") in new stack
    -- Executing [[email protected]:3] GotoIf("PJSIP/Twilio-0000fe9c", "0?intracompany,1") in new stack
    -- Executing [[email protected]:4] Playback("PJSIP/Twilio-0000fe9c", "all-circuits-busy-now&please-try-call-later, noanswer") in new stack
    -- <PJSIP/Twilio-0000fe9c> Playing 'all-circuits-busy-now.ulaw' (language 'en')
    

Use follow me on the extension and change the caller ID to Fixed CID Value. You can type in one of the numbers you own and it will be used as the caller ID.

1 Like

@adell4444 Thank you, I looked and looked and never saw that option! I just tested it and it works properly.

That being said, does anyone know if there is a global configuration for this somewhere within FreePBX? I eventually would prefer to transfer this task to be the responsibility of each user so that they can control call forwarding using their own numbers and on their own schedule through the UCP. I was under the impression that setting the Outbound CallerID field on the trunk was supposed to override everything, but clearly the forwarded CID supersedes this even on the trunk.

This should be doable at the trunk config:

Absolutely perfect! I missed this setting.

Thank you both for the assistance.

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