How to originate a new call from mod_managed?
Hi, I am trying to create a mod_managed API application that takes 2 phone numbers as params. These numbers should then be used to make 2 calls and to bridge them. The issue i am having is working out how to place the first call leg from in mod_managed. All the methods i have found are for the second leg and require you to pass in the first call leg. I know there are easier way to do this out of the managed code but i want it in the managed code as this is just a proof of concept to prove we can do a callback like system via managed code to be hooked into other external systems. In wiki http://wiki.freeswitch.org/wiki/Session there is this example s = new Session("{ignore_early_media=true}sofia/default/foo@bar.com"); while (s.ready()) { // The call has been answered } This seems to be exactly what i am looking for but seems to be missing from mod_managed. I am hoping someone can tell me how to do something similar in mod_managed since even if it is not part of the managed code mod_managed is meant to have the native access as well so i would assume it would be possible. Thanks in advance Chris
You could use the api: FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api(); string apiResult = string.Empty; string Uuid; string NumberToDial = "3475558308"; string OutgoingCallerID = "2155556666"; Uuid = fsApi.ExecuteString("create_uuid"); apiResult = fsApi.Execute("originate", string.Format("{{ignore_early_media=false,absolute_codec_string='PCMU'}}[origination_uuid={0},origination_caller_id_number={1}]sofia/gateway/broadvox/{2}", Uuid, OutgoingCallerID, NumberToDial)); On Sun, Mar 7, 2010 at 12:02 AM, Chris <freeswitch@gilligan.id.au> wrote:
Hi, I am trying to create a mod_managed API application that takes 2 phone numbers as params. These numbers should then be used to make 2 calls and to bridge them. The issue i am having is working out how to place the first call leg from in mod_managed. All the methods i have found are for the second leg and require you to pass in the first call leg.
I know there are easier way to do this out of the managed code but i want it in the managed code as this is just a proof of concept to prove we can do a callback like system via managed code to be hooked into other external systems. In wiki http://wiki.freeswitch.org/wiki/Session there is this example
s = new Session("{ignore_early_media=true}sofia/default/foo@bar.com"); while (s.ready()) { // The call has been answered }
This seems to be exactly what i am looking for but seems to be missing from mod_managed. I am hoping someone can tell me how to do something similar in mod_managed since even if it is not part of the managed code mod_managed is meant to have the native access as well so i would assume it would be possible.
Thanks in advance
Chris
_______________________________________________ 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
Thanks phillip. I assume i could then use the command new ManagedSession(uuid); to get access to the session after it is created. I will give it a go later today but i think you are right that should work. For a mater of interest would you have any idea where in the source code for FS i could find the implementation for the originate method called via the API command you just suggested? If the implementation is not too complicated I may look at adding it to the managed code as the managed code is meant to have access to the native APIs so it should be able to issue the same commands i would have thought. If it is impossible i will stick with the way you just suggested. Thanks Chris On Tue, Mar 9, 2010 at 7:04 AM, Phillip Jones <pjintheusa@gmail.com> wrote:
You could use the api:
FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api(); string apiResult = string.Empty; string Uuid; string NumberToDial = "3475558308"; string OutgoingCallerID = "2155556666";
Uuid = fsApi.ExecuteString("create_uuid");
apiResult = fsApi.Execute("originate", string.Format("{{ignore_early_media=false,absolute_codec_string='PCMU'}}[origination_uuid={0},origination_caller_id_number={1}]sofia/gateway/broadvox/{2}", Uuid, OutgoingCallerID, NumberToDial));
On Sun, Mar 7, 2010 at 12:02 AM, Chris <freeswitch@gilligan.id.au> wrote:
Hi, I am trying to create a mod_managed API application that takes 2 phone numbers as params. These numbers should then be used to make 2 calls and to bridge them. The issue i am having is working out how to place the first call leg from in mod_managed. All the methods i have found are for the second leg and require you to pass in the first call leg.
I know there are easier way to do this out of the managed code but i want it in the managed code as this is just a proof of concept to prove we can do a callback like system via managed code to be hooked into other external systems. In wiki http://wiki.freeswitch.org/wiki/Session there is this example
s = new Session("{ignore_early_media=true}sofia/default/foo@bar.com"); while (s.ready()) { // The call has been answered }
This seems to be exactly what i am looking for but seems to be missing from mod_managed. I am hoping someone can tell me how to do something similar in mod_managed since even if it is not part of the managed code mod_managed is meant to have the native access as well so i would assume it would be possible.
Thanks in advance
Chris
_______________________________________________ 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
_______________________________________________ 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
That decently woks to originate the call but passing that UUID into a new ManagedSession does not seem to like to the session created using that UUID. Once i create a session used the API you suggested how would i then access the session in the Managed Code? Chris On Tue, Mar 9, 2010 at 7:04 AM, Phillip Jones <pjintheusa@gmail.com> wrote:
You could use the api:
FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api(); string apiResult = string.Empty; string Uuid; string NumberToDial = "3475558308"; string OutgoingCallerID = "2155556666";
Uuid = fsApi.ExecuteString("create_uuid");
apiResult = fsApi.Execute("originate", string.Format("{{ignore_early_media=false,absolute_codec_string='PCMU'}}[origination_uuid={0},origination_caller_id_number={1}]sofia/gateway/broadvox/{2}", Uuid, OutgoingCallerID, NumberToDial));
On Sun, Mar 7, 2010 at 12:02 AM, Chris <freeswitch@gilligan.id.au> wrote:
Hi, I am trying to create a mod_managed API application that takes 2 phone numbers as params. These numbers should then be used to make 2 calls and to bridge them. The issue i am having is working out how to place the first call leg from in mod_managed. All the methods i have found are for the second leg and require you to pass in the first call leg.
I know there are easier way to do this out of the managed code but i want it in the managed code as this is just a proof of concept to prove we can do a callback like system via managed code to be hooked into other external systems. In wiki http://wiki.freeswitch.org/wiki/Session there is this example
s = new Session("{ignore_early_media=true}sofia/default/foo@bar.com"); while (s.ready()) { // The call has been answered }
This seems to be exactly what i am looking for but seems to be missing from mod_managed. I am hoping someone can tell me how to do something similar in mod_managed since even if it is not part of the managed code mod_managed is meant to have the native access as well so i would assume it would be possible.
Thanks in advance
Chris
_______________________________________________ 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
_______________________________________________ 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
After originate I call a method: Uuid = fsApi.ExecuteString("create_uuid"); apiResult = fsApi.Execute("originate", string.Format("{{ignore_early_media=false,absolute_codec_string='PCMU'}}[origination_uuid={0},origination_caller_id_number={1}]sofia/gateway/g1/{2} '&managed(MyFSProjects.TestCallAnswered)'", Uuid, OutgoingCallerID, NumberToDial)); My "TestCallAnswered" has reference to the session: public void Run(AppContext context) { BLegSession = context.Session; .... With the UUID you can also call other API functions: apiResult = fsApi.ExecuteString(string.Format("uuid_bridge {0} {1}", Aleg.Uuid, BLegSession.GetUuid())); apiResult = fsApi.Execute("uuid_media", "off " + call.Uuid); apiResult = fsApi.ExecuteString(string.Format("uuid_kill {0}", call.Uuid)); Hope that helps On Mon, Mar 8, 2010 at 9:30 PM, Chris <freeswitch@gilligan.id.au> wrote:
That decently woks to originate the call but passing that UUID into a new ManagedSession does not seem to like to the session created using that UUID. Once i create a session used the API you suggested how would i then access the session in the Managed Code?
Chris
On Tue, Mar 9, 2010 at 7:04 AM, Phillip Jones <pjintheusa@gmail.com>wrote:
You could use the api:
FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api(); string apiResult = string.Empty; string Uuid; string NumberToDial = "3475558308"; string OutgoingCallerID = "2155556666";
Uuid = fsApi.ExecuteString("create_uuid");
apiResult = fsApi.Execute("originate", string.Format("{{ignore_early_media=false,absolute_codec_string='PCMU'}}[origination_uuid={0},origination_caller_id_number={1}]sofia/gateway/broadvox/{2}", Uuid, OutgoingCallerID, NumberToDial));
On Sun, Mar 7, 2010 at 12:02 AM, Chris <freeswitch@gilligan.id.au> wrote:
Hi, I am trying to create a mod_managed API application that takes 2 phone numbers as params. These numbers should then be used to make 2 calls and to bridge them. The issue i am having is working out how to place the first call leg from in mod_managed. All the methods i have found are for the second leg and require you to pass in the first call leg.
I know there are easier way to do this out of the managed code but i want it in the managed code as this is just a proof of concept to prove we can do a callback like system via managed code to be hooked into other external systems. In wiki http://wiki.freeswitch.org/wiki/Session there is this example
s = new Session("{ignore_early_media=true}sofia/default/foo@bar.com"); while (s.ready()) { // The call has been answered }
This seems to be exactly what i am looking for but seems to be missing from mod_managed. I am hoping someone can tell me how to do something similar in mod_managed since even if it is not part of the managed code mod_managed is meant to have the native access as well so i would assume it would be possible.
Thanks in advance
Chris
_______________________________________________ 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
_______________________________________________ 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
_______________________________________________ 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
participants (2)
-
Chris
-
Phillip Jones