Forward Call via Trunk


we just configured a call forward inside one of the yealink-phones. when you call the extension (from outside) within that phone, the phones sends “moved temporarily” with new destination back to asterisk. the forward-destination is getting called from asterisk inside a new call, but we want, that asterisk sends “moved temporarily” back to the provider (the trunk), so that the connection is done over there without asterisk beeing a stupid “bridge” between the two call-members.
the provider supports this type of call deflection, so is there any way to tell asterisk/freepbx to behave like this? i couldnt find an answer to this question…

Sounds to me like you’d need to set that up in your provider’s portal. Once the call has been answered by Asterisk, you want the “diversion” call to be originated at your provider’s end, i.e. for the bridge to occur outside Asterisk. If they support that they’ll have a specific protocol for it.

But why do you have a problem with Asterisk acting as the bridge? You’re going to be paying for the onward call (and using your channel capacity) whichever way it’s done.

Hi jes1111,

thanks for your reply. asterisk makes a new call for the forwarding, and then there are two active calls, the incoming, and the outgoing, and asterisk bridges the rdp (it should, that is not working correctly), that causes traffic and an additional party in a call for two members, which makes no sense at all.
there is nothing to setup at the provider’s portal and there is no special protocol for it!
it’s just related to the freepbx-dialplan, i guess. so, anybody has some details for me on that?

Then what did you mean when you said earlier:


the provider accepts “moved temporarily” sip-messages with the new reciepient, that is part of the sip-standard, but not all providers accepts/supports this.

I didn’t say “special” protocol, I said “specific” protocol. If your provider supports this, then they should be able to tell you everything about the SIP message format that you need to send their system. But, like I said - they’re not going to make that forward call for free: they will charge you for that call and, of course, it will count as as an “in use” channel against your subscribed capacity. So, whether the call is bridged in your PBX or at their end has no bearing on the a) the cost to you and b) your channel availability. So why worry about where it is bridged?


we are just talking about sip, that we all use when we talk about voip. there is nothing to talk about regarding the sip message format and i told you already what asterisk/freepbx should send to the provider, also it’s not the question if somebody is charged for something or not! of course, the NEW CALL is charged aswell and the in-use-capacity is not the problem at all, and, by the way, of course, a new call also needs an additional channel! … so, i dont want to discuss with you if this makes sense or not, because i know this already. i just want to know, if this is possible with freepbx without writing my own dialplan/custom_destination or not, and if so, how.

Search the web for this. You can do what you want, but will require some custom dialplan. Here’s a possible solution that you would have to adapt for FreePBX:

thanks for your answer.
of course, i did a search, but i didnt found this discussion.

well, i tried the promiscredir=yes in advanced settings/channel sip settings, without success, freepbx is still just creating a new call.

in the logfile right before the new call i can see this:
[2016-07-19 16:50:50] VERBOSE[28705][C-0000049a] app_dial.c: Now forwarding SIP/HSEPeer-00000456 to ‘Local/[email protected]’ (thanks to PJSIP/92-000004bc)
[2016-07-19 16:50:50] NOTICE[28705][C-0000049a] app_dial.c: Not accepting call completion offers from call-forward recipient Local/[email protected];1

so, of course we can “somehow” write an own dialplan to do the transfer-command at the right point, and your link is for sure helpful to do this, but that is not really a clean way and the more beautiful way would be to have this inside freepbx out of the box. i guess, it is a very common thing to forward the temporary moved-message back to the provider! there should be an option in freepbx to enable this.
so, if this is not possible at the moment, i would like to create a feature request for that…
or are there some other hints on how to realize this in freepbx without a custom dialplan-modification?


Per this part of the thread:

It would be about 8 lines of dialplan in FreePBX’s extensions_custom.conf. Not much of a burden; pretty simple to try.

it’s not that easy! our inbound routes are not send to [incoming-trunk], they are forwarded to the usual from-internal-context and i would have to override the dial-one-macro or something like this!
sure it is simple to do this transfer SOMEHOW, and i know it will work as i used the transfer-command earlier already, but it’s not a clean way to do it like this!

everybody would expect that freepbx would send the “moved temporarily” back to the provider if the promiscredir=yes option is set… so why do we have to discuss about “simple to try”?

No, everyone wouldn’t expect that. I personally would expect you to try something that you were freely given and is 8 lines of dial plan. But if you’re too lazy and just want to complain about the niche thing that freepbx can’t do out-of-the-box, then I’m sorry I offered you any help.

billsimon, thanks for your reply.

can you please explain why not everybody would expect that?
here is the description of the option taken from

(both)You can set promiscredir to yes or no. Normally, when you perform call
forwarding on a phone, Asterisk will use the Local channel (for
example, local/[email protected]). If you set
promiscredir=yes, Asterisk will
use the SIP channel instead, which enables you to forward the
calls to remote boxes

it is exactly what i am talking about, or not? please clarify why somebody should NOT expect the behavier i described.

please dont misunderstood me! i dont tell this to make things easy or because i am to lazy to do something, for sure i am not! i just try to help to improve freepbx. for sure i will find any solution for my problem (indeed it has not really much todo with this stuff here, because we just missing audio-transmitting on the forwarded call…), but that’s not the reason why i am here!

Couple of points:-

Asterisk by nature a B2BUA
FreePBX is a PBX frontend to Asterisk
So the whole engine is designed to work on bridged calls
You are asking to provide a SIP REFER message and you need to do that before answering the call but you need to get that requirement from the phone itself.

SIP REFERS are trivially performed by a SIP proxy.

The “hack” in the link above tries to make a B2BUA behave like a proxy using ChannelRedirect(Transfer) back to the caller. This is at best ugly and not the intention of either Asterisk nor FreePBX

One solution , add a real proxy (Kamailio comes to mind) before your asterisk box
Another solution, if you are worried about bandwidth but not bridged calls, look into directmedia=(option) but if “we just missing audio-transmitting” then it likely won’t work.

First of all, did you actually set promiscredir=yes on the extension? There’s not an option for that in FreePBX, so you have to do it in the sip_custom_post.conf file.

I modified one of my extensions in this way and then set up a forward and it behaves exactly as described. It redirects the call to the SIP URI I put in my phone’s forwarding.

That might work for you, but you will need to make sure the phone forwards to a valid URI that points back to your provider. This is where I am saying that this is not the kind of behavior most people want or expect. Most people would want Asterisk to take care of the routing and logic through a local channel.

1 Like


thanks a lot for you clairifying reply.
i understand what you tell about B2BUA (never heard of this), but i still beleive, that it would make sence to add an option to freepbx, where you can enable or disable the promiscredir-option and in dependence, the dialplan would handle the calls differently, without the need of setup a proxy for that. i mean, it’s just “send a transfer instead of making a new call” … what’s the problem with that? why dont give the user the freedom to decide what the system should do?

i added this option to the chan-sip-settings->other sip settings and thought, than it is kind of globally enabled for all extensions. if you check the state on CLI with sip show settings you can see, that it is enabled…
it makes no sense for me to change this behavier for single extensions. because every time we would add an extension we would have to rechange the sip_custom_post, what is not really practicable in daily workflow. if that’s the solution, we would keep it like it is. but for sure, this advice is really helpful for somebody else which REALLY need this “feature”.

Well, you could ask for that feature to be added, the loss of pbx functionality would be something most folks would not like though.