Outbound CID after transfer


We have a number of areas of our company, all using one FreePBX install. Each company area has their own inbound (and outbound) CID.
Our provider requires us to send a CID for outbound calls, and it must be one we own.
We only have one trunk setup, all the calls go out of this trunk with different CID’s depending on where the call came from.

The issue we are having is when a member of staff transfers a call externally, or uses an auto-forward feature on a phone. This is sending the caller id of the inbound caller as the outbound CID.

We have tried using the “block foreign caller id” feature on the trunk, however this just sends the trunk CID to the provider, so it looks like all the calls affected are sent from this one CID.

What we would like to do is send the CID of the person who forwarded the call. For example, if someone in Department A has auto-forwarding setup on their phone, receives an external call, the forwarded call should have the CID of Department A set.

Any ideas / suggestions would be most appreciated.


you should look into customizing


you will need to build your logic and derive your new ${CALLERID(num)} from the channel variables to suit.

From asterisk’s extensions.conf

; macro-dialout-trunk-predial-hook:
; this macro intentionally left blank so it may be safely overwritten for any custom
; requirements that an installation may have.
; the macro is called by macro-dialout-trunk just prior to making a Dial() attempt
; to a trunk.
; if set to “BYPASS” then this trunk will be skipped
exten => s,1,MacroExit()

For a bit of a how-to:-


season to suit


Many thanks for your reply. Looks like I have lots of reading to do!

I’m surprised this isn’t more standard as passing an external CID onto a call transferred externally seems wrong, and looks to be against the T’s and C’s of most providers who allow CID passing - certainly here in the UK I’ve checked with a few.

Thanks again.