No reINVITE when bridging two sessions from mod_managed with bypass_media_after_bridge=true
Hi, Iam trying to bypass media from FS after two call legs are bridged using mod_managed. The code looks like public void Run(AppContext context) { var fsApi = new FreeSWITCH.Native.Api(); var aLegSession = context.Session; // Answer the incoming call aLegSession.Answer(); // Play the prompt aLegSession.StreamFile("ivr/ThankYou.wav", 0); // Create outBound session var bLegSession = new ManagedSession("sofia/gateway/95/4151230000"); // Bypass Media aLegSession.SetVariable("bypass_media_after_bridge", "true"); bLegSession.SetVariable("bypass_media_after_bridge", "true"); fsApi.ExecuteString(string.Format("uuid_bridge {0} {1}", aLegSession.GetUuid(), bLegSession.GetUuid())); } I don't see FreeSWITCH sending re-Invite after the call is bridged. What I've already tried and did not succeed: 1) set bypass_media=true, on A leg only, on B leg only, on both legs 2) set bypass_media_after_bridge=true, on A leg only, on B leg only, on both legs When I tried without using mod_managed using only dialplan, FS sends re-Invite. <action application="answer"/> <action application="sleep" data="1500"/> <action application="set" data="bypass_media_after_bridge=true"/> <action application="playback" data="ivr/ThankYou.wav"/> <action application="bridge" data="sofia/gateway/95/4151230000"/> Whether Iam doing anything stupid in mod_managed? Regards Srini
Try using uuid_media after the bridge instaed, see if that helps? http://wiki.freeswitch.org/wiki/Mod_commands#uuid_media On 20 July 2012 21:30, Srini K <aksrini@hotmail.com> wrote:
Hi, Iam trying to bypass media from FS after two call legs are bridged using mod_managed. The code looks like public void Run(AppContext context) { var fsApi = new FreeSWITCH.Native.Api(); var aLegSession = context.Session; // Answer the incoming call aLegSession.Answer(); // Play the prompt aLegSession.StreamFile("ivr/ThankYou.wav", 0); // Create outBound session var bLegSession = new ManagedSession("sofia/gateway/95/4151230000");
// Bypass Media aLegSession.SetVariable("bypass_media_after_bridge", "true"); bLegSession.SetVariable("bypass_media_after_bridge", "true"); fsApi.ExecuteString(string.Format("uuid_bridge {0} {1}", aLegSession.GetUuid(), bLegSession.GetUuid())); }
I don't see FreeSWITCH sending re-Invite after the call is bridged. What I've already tried and did not succeed: 1) set bypass_media=true, on A leg only, on B leg only, on both legs 2) set bypass_media_after_bridge=true, on A leg only, on B leg only, on both legs
When I tried without using mod_managed using only dialplan, FS sends re-Invite. <action application="answer"/> <action application="sleep" data="1500"/> <action application="set" data="bypass_media_after_bridge=true"/> <action application="playback" data="ivr/ThankYou.wav"/> <action application="bridge" data="sofia/gateway/95/4151230000"/>
Whether Iam doing anything stupid in mod_managed?
Regards Srini
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- *Andrew Cassidy BSc (Hons) MBCS SSCA* Managing Director *T <info@cassidywebservices.co.uk> *03300 100 960 *F<info@cassidywebservices.co.uk> *03300 100 961 *E <info@cassidywebservices.co.uk> *andrew@cassidywebservices.co.uk *W <info@cassidywebservices.co.uk> *www.cassidywebservices.co.uk
Andrew, There are a bunch of things wrong with your example for what you're trying to do. The first has nothing to do w/ mod_managed, which is that you are trying to set variables on the a_leg, that are used by the bridge application, after the b_leg is up. The media variables that you set on the a_leg, are arguments to the dial plan app "bridge". Since you are never using it to place the outbound call for the b_leg, they're not going to work. Another problem is that mod_managed doesen't really work right to place an outbound call with the "new ManagedSession". That is left over from old days. What's wrong with doing a "Session.Execute("bridge","sofia/gateway...")"? If you do this then any flags that are used as parameters by the bridge applicaiton will work, since you are just calling it as you would from the dialplan. --Dave _____ From: Andrew Cassidy [mailto:andrew@cassidywebservices.co.uk] To: FreeSWITCH Users Help [mailto:freeswitch-users@lists.freeswitch.org] Sent: Sat, 21 Jul 2012 10:12:06 -0700 Subject: Re: [Freeswitch-users] No reINVITE when bridging two sessions from mod_managed with bypass_media_after_bridge=true Try using uuid_media after the bridge instaed, see if that helps? http://wiki.freeswitch.org/wiki/Mod_commands#uuid_media On 20 July 2012 21:30, Srini K <aksrini@hotmail.com> wrote: Hi, Iam trying to bypass media from FS after two call legs are bridged using mod_managed. The code looks like public void Run(AppContext context) { var fsApi = new FreeSWITCH.Native.Api(); var aLegSession = context.Session; // Answer the incoming call aLegSession.Answer(); // Play the prompt aLegSession.StreamFile("ivr/ThankYou.wav", 0); // Create outBound session var bLegSession = new ManagedSession("sofia/gateway/95/4151230000"); // Bypass Media aLegSession.SetVariable("bypass_media_after_bridge", "true"); bLegSession.SetVariable("bypass_media_after_bridge", "true"); fsApi.ExecuteString(string.Format("uuid_bridge {0} {1}", aLegSession.GetUuid(), bLegSession.GetUuid())); } I don't see FreeSWITCH sending re-Invite after the call is bridged. What I've already tried and did not succeed: 1) set bypass_media=true, on A leg only, on B leg only, on both legs 2) set bypass_media_after_bridge=true, on A leg only, on B leg only, on both legs When I tried without using mod_managed using only dialplan, FS sends re-Invite. <action application="answer"/> <action application="sleep" data="1500"/> <action application="set" data="bypass_media_after_bridge=true"/> <action application="playback" data="ivr/ThankYou.wav"/> <action application="bridge" data="sofia/gateway/95/4151230000"/> Whether Iam doing anything stupid in mod_managed? Regards Srini _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com Join Us At ClueCon - Aug 7-9, 2012 FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Andrew Cassidy BSc (Hons) MBCS SSCA Managing Director T 03300 100 960 F 03300 100 961 E andrew@cassidywebservices.co.uk W www.cassidywebservices.co.uk
Thanks Dave, for pointing out mistakes. It did help and I can bypass media. The issue with Session.Execute("bridge","sofia/gateway...") is not getting a finer control over outbound leg before bridge. For eg, I need to play a prompt on bLeg(outbound) before bridging. How do I do it? Is there a way? I tried Session.Execute("bridge","{bypass_media_after_bridge=true, group_confirm_file=/path/to/prompt.wav}sofia/gateway/...") and also Session.Execute("bridge","{bypass_media_after_bridge=true, playback=/path/to/prompt.wav}sofia/gateway/...") without any success. I was able to do it with ease using new ManagedSession. -SriniFrom: drk@drkngs.net To: freeswitch-users@lists.freeswitch.org Date: Sat, 21 Jul 2012 11:15:14 -0700 Subject: Re: [Freeswitch-users] No reINVITE when bridging two sessions from mod_managed with bypass_media_after_bridge=true Andrew, There are a bunch of things wrong with your example for what you're trying to do. The first has nothing to do w/ mod_managed, which is that you are trying to set variables on the a_leg, that are used by the bridge application, after the b_leg is up. The media variables that you set on the a_leg, are arguments to the dial plan app "bridge". Since you are never using it to place the outbound call for the b_leg, they're not going to work. Another problem is that mod_managed doesen't really work right to place an outbound call with the "new ManagedSession". That is left over from old days. What's wrong with doing a "Session.Execute("bridge","sofia/gateway...")"? If you do this then any flags that are used as parameters by the bridge applicaiton will work, since you are just calling it as you would from the dialplan. --Dave From: Andrew Cassidy [mailto:andrew@cassidywebservices.co.uk] To: FreeSWITCH Users Help [mailto:freeswitch-users@lists.freeswitch.org] Sent: Sat, 21 Jul 2012 10:12:06 -0700 Subject: Re: [Freeswitch-users] No reINVITE when bridging two sessions from mod_managed with bypass_media_after_bridge=true Try using uuid_media after the bridge instaed, see if that helps? http://wiki.freeswitch.org/wiki/Mod_commands#uuid_media On 20 July 2012 21:30, Srini K <aksrini@hotmail.com> wrote: Hi, Iam trying to bypass media from FS after two call legs are bridged using mod_managed. The code looks like public void Run(AppContext context) { var fsApi = new FreeSWITCH.Native.Api(); var aLegSession = context.Session; // Answer the incoming call aLegSession.Answer(); // Play the prompt aLegSession.StreamFile("ivr/ThankYou.wav", 0); // Create outBound session var bLegSession = new ManagedSession("sofia/gateway/95/4151230000"); // Bypass Media aLegSession.SetVariable("bypass_media_after_bridge", "true"); bLegSession.SetVariable("bypass_media_after_bridge", "true"); fsApi.ExecuteString(string.Format("uuid_bridge {0} {1}", aLegSession.GetUuid(), bLegSession.GetUuid())); } I don't see FreeSWITCH sending re-Invite after the call is bridged. What I've already tried and did not succeed: 1) set bypass_media=true, on A leg only, on B leg only, on both legs 2) set bypass_media_after_bridge=true, on A leg only, on B leg only, on both legs When I tried without using mod_managed using only dialplan, FS sends re-Invite. <action application="answer"/> <action application="sleep" data="1500"/> <action application="set" data="bypass_media_after_bridge=true"/> <action application="playback" data="ivr/ThankYou.wav"/> <action application="bridge" data="sofia/gateway/95/4151230000"/> Whether Iam doing anything stupid in mod_managed? Regards Srini _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com Join Us At ClueCon - Aug 7-9, 2012 FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org -- Andrew Cassidy BSc (Hons) MBCS SSCA Managing Director T 03300 100 960 F 03300 100 961 E andrew@cassidywebservices.co.uk W www.cassidywebservices.co.uk _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com Join Us At ClueCon - Aug 7-9, 2012 FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Do you exit the app after you call uuid bridge? Your code is running in the session thread so you need to exit so it can change states. On Jul 20, 2012 3:32 PM, "Srini K" <aksrini@hotmail.com> wrote:
Hi, Iam trying to bypass media from FS after two call legs are bridged using mod_managed. The code looks like public void Run(AppContext context) { var fsApi = new FreeSWITCH.Native.Api(); var aLegSession = context.Session; // Answer the incoming call aLegSession.Answer(); // Play the prompt aLegSession.StreamFile("ivr/ThankYou.wav", 0); // Create outBound session var bLegSession = new ManagedSession("sofia/gateway/95/4151230000");
// Bypass Media aLegSession.SetVariable("bypass_media_after_bridge", "true"); bLegSession.SetVariable("bypass_media_after_bridge", "true"); fsApi.ExecuteString(string.Format("uuid_bridge {0} {1}", aLegSession.GetUuid(), bLegSession.GetUuid())); }
I don't see FreeSWITCH sending re-Invite after the call is bridged. What I've already tried and did not succeed: 1) set bypass_media=true, on A leg only, on B leg only, on both legs 2) set bypass_media_after_bridge=true, on A leg only, on B leg only, on both legs
When I tried without using mod_managed using only dialplan, FS sends re-Invite. <action application="answer"/> <action application="sleep" data="1500"/> <action application="set" data="bypass_media_after_bridge=true"/> <action application="playback" data="ivr/ThankYou.wav"/> <action application="bridge" data="sofia/gateway/95/4151230000"/>
Whether Iam doing anything stupid in mod_managed?
Regards Srini
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
So how for instance would you do logic like: set rate=0.01 bridge to foo if failure { Set rate = 0.02 Bridge to bar } If you have to exit after each bridge? Set continue after bridge to true, then re-enter your app after stashing away state? -Michael From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Anthony Minessale Sent: Friday, July 27, 2012 4:10 PM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] No reINVITE when bridging two sessions from mod_managed with bypass_media_after_bridge=true Do you exit the app after you call uuid bridge? Your code is running in the session thread so you need to exit so it can change states. On Jul 20, 2012 3:32 PM, "Srini K" <aksrini@hotmail.com<mailto:aksrini@hotmail.com>> wrote: Hi, Iam trying to bypass media from FS after two call legs are bridged using mod_managed. The code looks like public void Run(AppContext context) { var fsApi = new FreeSWITCH.Native.Api(); var aLegSession = context.Session; // Answer the incoming call aLegSession.Answer(); // Play the prompt aLegSession.StreamFile("ivr/ThankYou.wav", 0); // Create outBound session var bLegSession = new ManagedSession("sofia/gateway/95/4151230000"); // Bypass Media aLegSession.SetVariable("bypass_media_after_bridge", "true"); bLegSession.SetVariable("bypass_media_after_bridge", "true"); fsApi.ExecuteString(string.Format("uuid_bridge {0} {1}", aLegSession.GetUuid(), bLegSession.GetUuid())); } I don't see FreeSWITCH sending re-Invite after the call is bridged. What I've already tried and did not succeed: 1) set bypass_media=true, on A leg only, on B leg only, on both legs 2) set bypass_media_after_bridge=true, on A leg only, on B leg only, on both legs When I tried without using mod_managed using only dialplan, FS sends re-Invite. <action application="answer"/> <action application="sleep" data="1500"/> <action application="set" data="bypass_media_after_bridge=true"/> <action application="playback" data="ivr/ThankYou.wav"/> <action application="bridge" data="sofia/gateway/95/4151230000"/> Whether Iam doing anything stupid in mod_managed? Regards Srini _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org<mailto:consulting@freeswitch.org> http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com Join Us At ClueCon - Aug 7-9, 2012 FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (5)
-
Andrew Cassidy
-
Anthony Minessale
-
Dave R. Kompel
-
Michael Giagnocavo
-
Srini K