<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 20, 2021 at 11:14 PM Paweł Femur Wojtal <<a href="mailto:freeswitch@femur.pl">freeswitch@femur.pl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hello!<br>
<br>
Imagine the situation.<br>
<br>
I call internal extension. It is busy. So I press *0 and hangup. When <br>
leg B finishes its connection, freeswitch calls us both and bridges.<br>
<br>
How do I get such functionality? I will be grateful for any suggestion.<br></blockquote><div><br></div><div>Maybe someone knows an easier way but if I needed something like this, I would try:</div><div> - send the call to a lua script after the bridge fails due to BUSY (channel variable last_bridge_hangup_cause==USER_BUSY)</div><div> - ask the user to confirm if he/she wants to get a callback</div><div> - if yes, find the UUID of the extension call. This could be obtained from channel variables (probably originate_signal_bond or originated_legs) if not, I would use Freeswitch.dbh (<a href="https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference">https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference</a>) to search for the extension that is busy.</div><div> - set a hangup hook to be execute when the extension call terminates (<a href="https://freeswitch.org/confluence/display/FREESWITCH/api_hangup_hook">https://freeswitch.org/confluence/display/FREESWITCH/api_hangup_hook</a>)</div><div> - the hook would be a lua script that would make the callback to you and after answer try to call the extension.</div><div><br></div><div>obs: </div><div> - if the hangup hook fails to be set, it could be because the call ended while we were doing the processing so I would execute the callback right away).</div><div> - in the callback, before calling the extension I would ask for confirmation again as by that time you might not want to call the extension anymore</div><div><br></div><div><br></div></div></div>