[Freeswitch-users] How to originate a new call from mod_managed?

Phillip Jones pjintheusa at gmail.com
Tue Mar 9 18:15:15 PST 2010


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 at 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 at 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 at 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 at 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 at 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 at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100309/b79f282a/attachment-0002.html 


More information about the FreeSWITCH-users mailing list