[Freeswitch-dev] bridging calls using mod_managed

Peter Olsson peter.olsson at visionutveckling.se
Fri Jan 6 19:45:15 MSK 2012


Please pastebin some debug logs, so we know where to start looking.

/Peter
________________________________
Från: freeswitch-dev-bounces at lists.freeswitch.org [freeswitch-dev-bounces at lists.freeswitch.org] för Michael Lutz [mytemike72 at gmail.com]
Skickat: den 6 januari 2012 16:56
Till: freeswitch-dev at lists.freeswitch.org
Ämne: Re: [Freeswitch-dev] bridging calls using mod_managed

Hi,

Anyone here who can help me with this problem? I got really stuck on this one..

Thanks for helping!,
Mike

Op 4 jan. 2012 om 18:58 heeft Michael Giagnocavo <mgg at giagnocavo.net<mailto:mgg at giagnocavo.net>> het volgende geschreven:

Can you paste the debug log from FreeSWITCH when this happens?

From: freeswitch-dev-bounces at lists.freeswitch.org<mailto:freeswitch-dev-bounces at lists.freeswitch.org> [mailto:freeswitch-dev-bounces at lists.freeswitch.org] On Behalf Of Michael Lutz
Sent: Wednesday, January 04, 2012 10:10 AM
To: freeswitch-dev at lists.freeswitch.org<mailto:freeswitch-dev at lists.freeswitch.org>
Subject: [Freeswitch-dev] bridging calls using mod_managed


Hi,
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.
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.
I have als set the HandleHangUp handler to finalize the cdr and call when the calller disconnects.
This whole mechanism works as a charm. This application then plays voicefiles, getdigits, and everything as I would expect.
Hoewever at some point I want to dialout to an external number and connect these two calls together.
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).
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.

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).

                    Debug("Got a route=>"+route+", Let the network play the ringtone...");
                    leg_a.Execute("ring_ready", "");

                    Debug("Creating the new session...");
                    ManagedSession leg_b = new ManagedSession("sofia/external/"+route);  // route holds {destinationNumber}@{myExternalGateway<mailto:%7bdestinationNumber%7d@%7bmyExternalGateway>}
                    if (leg_b.Ready())
                    {
                        Debug("Session_B ready!");
                        string fsuuid_b = leg_b.GetVariable("uuid");

                        Debug("Waiting for B-Leg to answer and A-Leg not to hangup...");
                        while (!leg_b.answered() && leg_a.Ready() ) { /* Ringing... */ }

                        if (leg_b.answered())
                        {
                            Debug("...B-Leg is answered");
                            AnswerCall(leg_a);
                            while (!leg_a.answered()) { }
                            Debug("...A-Leg is answered");

                            // ****** BRIDGE SHOULD BE HERE ******

                            Debug("As long as both legs are Ready(), we wait......");
                            while (leg_b.Ready() && leg_a.Ready())
                            {
                                Play(leg_b, "Test\\dir-no_matching_results.wav"); // REMOVE WHEN BRIDGED
                                Play(leg_a, "Test\\dir-no_matching_results.wav"); // REMOVE WHEN BRIDGED
                            }

                            Debug("There is one leg no longer ready...");
                            if (leg_a.Ready()) { Debug("Session A still ready..."); } else { Debug("Session A NO LONGER ready...");}
                            if (leg_b.Ready()) { Debug("Session B still ready..."); } else { Debug("Session B NO LONGER ready...");}
                        }
                        else
                        {
                            Debug("A-Leg aborted while dialing...");
                        }

                        if (leg_b.Ready())
                        {
                            Debug("B-Leg still here, so hanging up B-Leg...");
                            leg_b.Hangup("NORMAL_CALL_CLEARING");
                            leg_b.destroy();
                        }
                    }
                    else
                    {
                        string obCause = leg_b.hangupCause();

                        leg_a.HangUp(obCause);
                        Debug("Route failed with: "+obCause);
                    }
                    return true;

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:

leg_a.sleep(1000, 0);
string apiResult = fsApi.ExecuteString(string.Format("uuid_bridge {1} {0}", leg_a.GetUuid(), leg_b.GetUuid()));
Debug("apiResult="+apiResult);

The console log shows "+OK {guid of leg_a}

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.
I have checked without bridge to check if codecs are the the same and they both are PCMU 8000.
Please any help is appreciated! I have been trying to make this work for over a week now, but it won''t work.

note. I have also tried originate with the api, but gives me the same problem when I try to bridge these two legs together...

Best Regards,

Mike.

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-dev mailing list
FreeSWITCH-dev at lists.freeswitch.org<mailto:FreeSWITCH-dev at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org
!DSPAM:4f07185e32767836217473!



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list