[Freeswitch-users] Re4: Lua "two steps" bridging
Chrisbware
chrisbware at interfree.it
Wed Sep 14 01:52:29 MSD 2011
Thank you for your answer: I'll follow your advice.
Anyway, IMHO, Lua must be able to manage situations like this. Languages
strong integration is a plus
of FS that helps programmers to invent new services. Telling them they
still have to play with events
sounds a bit "old school". Again: it's only my opinon. Keep up the good
work!
Il 13/09/2011 23:27, Michael Collins ha scritto:
> Chris,
>
> We're glad you like FS - we like it as well.
>
> What you're trying to do is completely possible, but the way you're
> trying to do it is probably not the best choice. Instead of a local
> Lua script to control both calls, you are better off using either one
> of two options: event socket entirely or event socket + dialplan. It
> depends on the level of control that you need. If you want ultimate
> control then just use ESL right from PHP (or whichever scripting
> language you are comfortable with) and create your call legs, watching
> for the requisite CHANNEL_XXX events.
> (See http://wiki.freeswitch.org/wiki/Event_List for a nice list.)
>
> I suppose you could do it all in Lua but you'd have to keep polling
> legA channel for the endpoint_disposition variable in a while loop and
> then break out on various conditions. I'm not at all a fan of that
> method. With the event socket you listen for the events that are of
> interest to you and then act on them. Very elegant.
>
> -MC
>
> On Tue, Sep 13, 2011 at 1:59 PM, Chrisbware <chrisbware at interfree.it
> <mailto:chrisbware at interfree.it>> wrote:
>
> Hi Michael,
>
> a PHP script connect to Event socket and launch "luarun call.lua
> <legA number> <legB number> <sip account number>
>
> Script call.lua, upload sip account password from a DB and then
> call A number and B number using the same SIP account, bridging them.
> What I'd like to do is:
>
> - place call to legB number only after legA has answered the call
> - detect hangupCause on both legs to check if something goes wrong
> - return SUCCESS or hangup cause to the PHP script
>
> Is it science fiction? With Asterisk isn't so hard to do and,
> since I'm in love with FS, please don't disappoint me :-)
>
> Chris B.
>
>
> Il 13/09/2011 18:44, Michael Collins ha scritto:
>> How are you calling this Lua script to begin with? What is the
>> big picture, that is, what is the problem you're solving? Some
>> context might help us give you a better answer.
>>
>> -MC
>>
>> On Tue, Sep 13, 2011 at 5:21 AM, <chrisbware at interfree.it
>> <mailto:chrisbware at interfree.it>> wrote:
>>
>> Hi,
>>
>> thank you for your help, but doesn't work.
>> legA:ready() is true when the first session start and not
>> when the call is answered.
>> So legB is called at the same time.
>>
>> Any other suggestion?
>>
>>
>>
>>
>> -----Messaggio originale-----
>> Da: Sergey Scheglov <sid at eltc.ru <mailto:sid at eltc.ru>>
>> Inviato il: 13 Set 2011 - 17:15
>> A: freeswitch-users at lists.freeswitch.org
>> <mailto:freeswitch-users at lists.freeswitch.org>
>>
>>
>>
>> ? 13 Sep 2011 09:39:33 -0000
>> chrisbware at interfree.it <mailto:chrisbware at interfree.it> wrote:
>>
>> >
>> > Hi guys,
>> >
>> > I've read anything on this argument on Wiki but I can't find a
>> > complete answer.
>> >
>> > I need to bridge two calls in Lua, waiting the first to be
>> answered.
>> > My basic script is:
>> >
>> > local GwParams =
>> > "origination_caller_id_number="..gateway..",sip_auth_username="..gateway..",sip_auth_password="..sip_passwd
>> > local slegA =
>> > "[ignore_early_media=false,"..GwParams.."]sofia/external/"..callee.."@"..sip_domain
>> > local slegB =
>> > "[ignore_early_media=true,"..GwParams.."]sofia/external/"..called.."@"..sip_domain
>> >
>> > legA = freeswitch.Session(slegA);
>> > legB = freeswitch.Session(slegB);
>> > freeswitch.bridge(legA, legB);
>> >
>> >
>> > It works but legA and legB are called at the same time. Using:
>> >
>> > while (legA:answered()== false) do end;
>> >
>> > between the two session do the job but called parties can't hear
>> > audio.
>> >
>> > I promise to add a script on wiki if you help me ! :)
>> >
>> > Thanks in advance.
>> >
>> >
>> > -------------------------------------------------------------------------------
>> > Valore legale alle tue mail
>> > InterfreePEC - la tua Posta Elettronica Certificata
>> > http://pec.interfree.it
>> > -------------------------------------------------------------------------------
>> >
>> >
>> >
>> > FreeSWITCH-users mailing list
>> > FreeSWITCH-users at lists.freeswitch.org
>> <mailto: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
>> >
>>
>> Try:
>>
>> legA = freeswitch.Session(slegA);
>> if (legA:ready()) then
>> legB = freeswitch.Session(slegB, legA);
>> freeswitch.bridge(legA, legB);
>> end
>>
>> ----
>>
>> Scheglov Sergey
>>
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> <mailto: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
>>
>> -------------------------------------------------------------------------------
>> Valore legale alle tue mail
>> InterfreePEC - la tua Posta Elettronica Certificata
>> http://pec.interfree.it
>> -------------------------------------------------------------------------------
>>
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> <mailto: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 <mailto: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
> <mailto: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/20110913/d66f94a9/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list