<p>Hi, </p><div>I've been working with FS for some time now, and are progressing. I am working on a platform (in/ivr) which is handled by .net managed code completely. I am using just 1 application which is always launched on incomming calls.<br>
This application immedeately connects with my MSSQL server and checks validity of gateways, inbound number etc. Also a cdr is written and updated periodically while the call is active.<br>I have als set the HandleHangUp handler to finalize the cdr and call when the calller disconnects.<br>
This whole mechanism works as a charm. This application then plays voicefiles, getdigits, and everything as I would expect.<br>Hoewever at some point I want to dialout to an external number and connect these two calls together.<br>
I do not want to leave the originating .net app as long as my incomming caller is still online (to update the cdr and finalize the call). While these two are connected I need to update my database periodicaly (keepalive).<br>
I have been looking the internet to find what I need but i can't get it to work 100%. In fact everything works, but when I bridge the two calls together it fails.</div><div><br>I use the following and this whole peace of code actually works, it dials out, aborts when someone hangsup and when the b_leg picks up they both get audiofile turn by turn.... It even checks outbuond status and maps this to the original call. (so really acts like a switch).</div>
<p> Debug("Got a route=>"+route+", Let the network play the ringtone...");<br> leg_a.Execute("ring_ready", "");</p><p> Debug("Creating the new session...");<br>
ManagedSession leg_b = new ManagedSession("sofia/external/"+route); // route holds <a href="mailto:{destinationNumber}@{myExternalGateway">{destinationNumber}@{myExternalGateway</a>}<br> if (leg_b.Ready())<br>
{<br> Debug("Session_B ready!");<br> string fsuuid_b = leg_b.GetVariable("uuid");</p><p> Debug("Waiting for B-Leg to answer and A-Leg not to hangup...");<br>
while (!leg_b.answered() && leg_a.Ready() ) { /* Ringing... */ }</p><p> if (leg_b.answered())<br> {<br> Debug("...B-Leg is answered");<br>
AnswerCall(leg_a);<br> while (!leg_a.answered()) { }<br> Debug("...A-Leg is answered");</p><p> // ****** BRIDGE SHOULD BE HERE ****** </p>
<p> Debug("As long as both legs are Ready(), we wait......");<br> while (leg_b.Ready() && leg_a.Ready()) <br> {<br> Play(leg_b, "Test\\dir-no_matching_results.wav"); // REMOVE WHEN BRIDGED<br>
Play(leg_a, "Test\\dir-no_matching_results.wav"); // REMOVE WHEN BRIDGED<br> }</p><p> Debug("There is one leg no longer ready...");<br>
if (leg_a.Ready()) { Debug("Session A still ready..."); } else { Debug("Session A NO LONGER ready...");}<br> if (leg_b.Ready()) { Debug("Session B still ready..."); } else { Debug("Session B NO LONGER ready...");}<br>
}<br> else<br> {<br> Debug("A-Leg aborted while dialing...");<br> }</p><p> if (leg_b.Ready())<br>
{<br> Debug("B-Leg still here, so hanging up B-Leg...");<br> leg_b.Hangup("NORMAL_CALL_CLEARING");<br> leg_b.destroy();<br>
}<br> }<br> else<br> {<br> string obCause = leg_b.hangupCause();</p><p> leg_a.HangUp(obCause);<br>
Debug("Route failed with: "+obCause);<br> } <br> return true;</p><p>Of course I need to bridge the two calls together so they can speak to each other.. I am trying to bridge the call at "// ****** BRIDGE SHOULD BE HERE ****** " like this:</p>
<p>leg_a.sleep(1000, 0);<br>string apiResult = fsApi.ExecuteString(string.Format("uuid_bridge {1} {0}", leg_a.GetUuid(), leg_b.GetUuid())); <br>Debug("apiResult="+apiResult);</p><p>The console log shows "+OK {guid of leg_a} </p>
<p>but at the very same moment the incomming calls is beging hung up, (I can see the Debug message of my HandleHangUp() at exactly the as me time as the apiResult of the bridge.<br>I have checked without bridge to check if codecs are the the same and they both are PCMU 8000.<br>
Please any help is appreciated! I have been trying to make this work for over a week now, but it won''t work.</p><p>note. I have also tried originate with the api, but gives me the same problem when I try to bridge these two legs together...</p>
<div> </div><div>Best Regards,</div><p>Mike.</p>