Fixed Caller ID when using CFwdALL feature with Asterisk

I am running Trixbox with a Cisco 7961 handset. Our upstream provider is about to restrict our outbound Caller ID to the incoming number ranges we have with them.

If I use the CFwdALL button on the 7961 handset to forward all calls to a mobile the Caller ID shown on the receiver's mobile is the originating caller's.

1. All calls to 0299222222 (handsets external number) are forwarded to 0411111111
2. External caller, 0433333333 makes a call to 0299222222.
3. Call is forwarded to 0411111111 and shows caller ID of 0433333333.

Once our upstream provider starts restricting our outbound caller id this call will be rejected by them as we don't own the number 0433333333.

Is there a way to force the forwarded call to use the forwarded extension's external number (0299222222) instead of the calling party's (0433333333) for the outbound Caller ID?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Generally speaking, your configuration needs to change not to pass through the Received caller ID.
Have not dealt with your setup to point you to a specific remedy.

In your configuration you likely have settings to maintain caller id, sendrid=yes, or orig callerid which is fine internally! your outgoing translation has to be configured to strip that information and attach your designated caller id!
thenosAuthor Commented:
Thanks for your input Arnold.

When you say outgoing translation is there a particular configuration file/context you can point me to in relation to Asterisk?
The suggestion made are generally applicable to any VOIP based system.

Not sure what management of your setup exists.

See if the link below helps.

Deals with configuring outgoing call rules.

What caller ID Is reflected when you dial out from that location?
Get Blueprints for Increased Customer Retention

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

thenosAuthor Commented:
Thanks for that Arnold.

After some test calls and investigation of our dial plan I worked out it was the macro-outbound-called that sets the outgoing Caller ID.

From analysing the logs I think I need to edit the logic on line 5 in the code snippet below.

Lines 6 and 7 are skipped when forwarding IS NOT set (CID = 0299222222) and line 7 is skipped when forwarding IS set (CID = 0422222222)

include => macro-outbound-callerid-custom
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != ""]?Set(CALLERPRES()=${CALLINGPRES_SV}))
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = ""] | $["${KEEPCID}" != "TRUE"] | $["${OUTKEEPCID_${ARG1}}" = "on"] ]?normcid)
exten => s,n,GotoIf($["foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}" = "foo"]?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,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(exit),MacroExit()
exten => s,n(trunkcid),ExecIf($["${TRUNKOUTCID:1:2}" != ""]?Set(CALLERID(all)=${TRUNKOUTCID}))
exten => s,n(usercid),ExecIf($["${USEROUTCID:1:2}" != ""]?Set(CALLERID(all)=${USEROUTCID}))
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"="hidden"]?Set(CALLERPRES()=prohib_passed_screen))

; end of [macro-outbound-callerid]

Open in new window

I do not believe you need to alter anything, you simply need to set

Your current setup includes the option to preserve incoming callerID on transfer between extensions


Lines 6-8 deal with extention specific CallerID settings.
i.e. user on extension 3245 may have a direct dial line, so you would configure the user DB with extension 3245 when dialing out to have the caller id as xxxxx3245 as an example

TRUNKOUTCID='yourdefault' within the configuration which will override prior line 14
Line 10 gets the TRUNKOUTCID from ${OUTCID_${ARG1}}

The rule deals with the variances. in the current setup if you do not have TRUNKOUTCID set on line 10, and this is an incoming call with a caller ID being forwarded out and thus being set with the outgoing caller ID. Any other call that does not have a user extension with a phone mapping, will mean that there will be no caller ID transmitted.

possibly unknown/anonymous/blocked not sure what variations you may have.
thenosAuthor Commented:
I do not believe you need to alter anything, you simply need to set
What do I need to set?
Look at line 10 of what you posted.  It refers to a variable outsid_.

Look in your configuration files for OUTCID_(not sure what it might be as I do not have this setup.)

Check your default outgoing callerID settings.

What if any caller ID is displayed when you dial from that location out?
thenosAuthor Commented:
The Caller ID when making a call from an extension to an external number is that extension's specific DID.
Ok, that data is pulled from the user database in the macro, lines 6-9

Ref line 5 that deals with whether to keepCID.

You seem to be missing the default CID setting.  if you have an unassigned phone, create an extension that is not assigned a direct DID dial.  Then dial using that extension out and see what if any caller ID shows up.  My guess is that there will be no caller ID associated because the current configuration does not have a default caller-id set.

Double check your outgoing call rules to make sure you have a default outgoing CALLER ID set that applies to all non-DID extensions.

i.e. you have 10 numbers, you must have an extenssion that is not mapped to a specific DID.
thenosAuthor Commented:
Ok so I just created an extension 1092 with no attached DID. I made an outgoing call to my mobile using that extension and the called ID showed as 01092 so I think you could be right.
thenosAuthor Commented:
Just to be clear I was hoping to pass the Caller ID of the extension that is forwarding the call, not just a single DID for all extensions that forward calls.

I can get the Caller ID to pass the default outbound trunk Caller ID but not the extension's DID that the call is being forwarded from
One thing at a time.  Based on your own comment, you must have a default outgoing CallerID set and configured or once your provider starts enforcing the outgoing callerID restriction a call such as the one you made using the newly created extension will not be completed. The caller  will hear dead air.

I think the system treats forwarding by a user from an extension differently than an incoming call that is automatically forwarded through a configuration on the system.

Not sure whether your setup allows for preserving incoming CallerID while transfering among internal extension while at the same time when the call is destined to the outside not have the incoming callerID preserved.
thenosAuthor Commented:
Yes I realised if I set the trunk outgoing caller id and tick the option "Never Override CallerID" I get a better result. The forwarded call gets through the provider and display's the Outbound Caller ID set on the trunk.

This was quite helpful

It's better but not the exact result I am looking for as it is still not showing the caller extension's DID who is forwarding the call as the Caller ID
Are you distinguishing whether the forward out is automated or whether the user forwards out the incoming call?

Lines 14,15,16 from your code suggest that if the usercallerID is set, it is the one that will be pushed set, but line 13 seems to terminate the macro processing.  

As I do not have this setup, it is not clear to me whether line 13 needs to be there or not.
Or whether it is a modified version of the original that had lines 14,15,16 above the current line 17.
thenosAuthor Commented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thenosAuthor Commented:
Arnold gave some helpful advise but didn't really give me an answer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Voice Over IP

From novice to tech pro — start learning today.