[Freeswitch-users] replace b-leg in a bridge on 302 moved temporarily

Dist Lists dist.lists at gmail.com
Thu Jun 1 10:55:55 UTC 2017


I am using ESL for my dial plan and I have the following scenario.

Leg-a is being bridged with the bridge() app to multiple endpoints
(b-legs). One of the b-legs sends 302 Moved Temporarily back. What I'd like
to do is to process the new destination number from the 302, because it may
be mapped to multiple endpoints and after figuring out the additional b-leg
endpoints to initiate calls to them, while at same time also keeping the
original (already ringing) b-legs from the initial call. Obviously on
answer the wining b-leg needs to be bridged to the a-leg, regardless if it
is an "original" b-leg or a "new" one.

To put it another way, I'd like to somehow "replace" the b-leg that sent
the 302 Moved Temporarily with multiple new endpoints (b-legs), while also
keeping the rest of the originally called b-legs. Sort of adding additional
endpoints via ESL to the bridge() application after the fact.

And the whole setup needs to work with bypass_media.

There is more to the story like the need to check if the endpoint is
authorized to redirect the call to the new destination and so on, but I'm
skipping this for the sake of simplicity. I have been trying to find a
solution or a workaround for a few days now, but nothing worked. What I
tested so far:

- letting Freeswith handle the 302 within the stack doesn't work, because I
cannot handle the mapping of the destination number to multiple endpoints.

- manual-redirect, which transfers the a-leg in the redirect context, but
also cancels all the other b-legs, didn't help either.

- outbound_redirect_fatal=true leaves the other b-legs ringing, but I
cannot "add" new b-legs to the bridge() app.

- originate-ing the b-legs via API and then trying to somehow link them
within the dial plan to the a-leg. This kind of works if I use api_on_ring,
api_on_media, etc to pass progress to the a-leg, but it feels too fragile.
Most importantly I couldn't figure out how to make bypass_media work, since
the a-leg and the b-legs are only loosely linked to one another via the
dial plan, but Freeswitch itself doesn't know anything about this relation.
I even tied setting some variables like originate_signal_bond and
originator, but it didn't help either.

- loopback endpoints, which I tried hoping that the loopback a-leg, which
can be transferred in a new context after a 302, will allow me to call
multiple new endpoint. Unfortunately this doesn't seem to work with

I am out of ideas what to try next and was hoping for some feedback from
the list. It looks like what I'm trying to achieve is not possible with the
current set of features. If that is indeed the case, what would be the best
approach to add this functionality? Maybe by extending an existing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170601/17a3e027/attachment-0001.html>

More information about the FreeSWITCH-users mailing list