Prevent callforward to a mobile phone


When a user configure the call forward on his/her phone to a mobile phone, I would like to redirect the call to an internal extension.

This is because the policy of my company does not allow to redirect calls to an external number.

We use FreePBX 2.8 and Asterisk 1.8


You can do this with a misc. destination and an outbound route.


Thanks for your answer, but how can I identify calls that are forwarded against calls that are made from the phones?

I want to accept calls made to mobile, when it is not a call forward.


I am sorry, but can you guide me a little more?

I have been trying to think of a way that would only effect forwarding and I can’t. It would all involve custom code.

You would also have to turn off call forwarding in the endpoint as it is not under control of Asterisk.

I noticed on the cdr that when a call is forwarded to an exteral number (00123456789), il use a channel like “Local/00123456789@from-internal-470e;2”.

But when I make the call directly from an internal phone, the channel is like “SIP/1234-00000011”.

How can I redirect calls with “Local/00123456789@from-internal-470e;2” channel type to a internal number?

I am really stuck with this.

I tried to use a custom trunk, but I can not figure out how to match only the calls that are like “Local/…” to send it to that trunk.

Any clues would really be appreciated.

I did the following in extensions_custom.conf

exten => _X.,1,Noop(CHANNEL=${CHANNEL})
exten => _X.,n,GotoIf($["${CHANNEL}":“Local/0”]?:CarryOnCall)
exten => _X.,n,Playback(demo-congrats) ; action to take for forbiden calls
exten => _X.,n(CarryOnCall),Noop(GOOD) ; permited calls carry on normal process

Is it a correct way to do it?