Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Fixed Caller ID when using CFwdALL feature with Asterisk

Posted on 2014-01-06
Medium Priority
Last Modified: 2014-01-27
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?
Question by:thenos
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
LVL 80

Expert Comment

ID: 39761142
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!

Author Comment

ID: 39766788
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?
LVL 80

Expert Comment

ID: 39767216
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?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 39775745
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

LVL 80

Expert Comment

ID: 39776853
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.

Author Comment

ID: 39777926
I do not believe you need to alter anything, you simply need to set
What do I need to set?
LVL 80

Expert Comment

ID: 39778046
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?

Author Comment

ID: 39778098
The Caller ID when making a call from an extension to an external number is that extension's specific DID.
LVL 80

Expert Comment

ID: 39778354
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.

Author Comment

ID: 39778368
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.

Author Comment

ID: 39778490
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
LVL 80

Expert Comment

ID: 39779402
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.

Author Comment

ID: 39780929
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 http://issues.freepbx.org/browse/FREEPBX-2370

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
LVL 80

Assisted Solution

arnold earned 400 total points
ID: 39780955
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.

Accepted Solution

thenos earned 0 total points
ID: 39802107

Author Closing Comment

ID: 39811525
Arnold gave some helpful advise but didn't really give me an answer

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question