[Freeswitch-users] What is so dangeres in "freeswitch.msleep()" in LUA?

Dmitry Saratsky simpot at simpot.com
Tue Mar 8 02:18:50 MSK 2011


Hi Peter,

You are right, session:sleep works well.
Thanks a lot!

-----Original Message-----
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Peter Olsson
Sent: 07 Mar 2011 14:49
To: 'FreeSWITCH Users Help'
Subject: Re: [Freeswitch-users] What is so dangeres in "freeswitch.msleep()" in LUA?

My understanding is that Session:sleep() continues to handle the loop thread within the sleep. msleep() will stop the thread totally during the sleep, so I think you should use session:sleep().

/Peter

-----Ursprungligt meddelande-----
Från: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] För Dmitry Saratsky
Skickat: den 7 mars 2011 11:38
Till: FreeSWITCH Users Help
Ämne: Re: [Freeswitch-users] What is so dangeres in "freeswitch.msleep()" in LUA?

Hi Steve,

Thank you for your reply.

The problem is that I need script to sleep, while session ready and transmits fax in same time until session will not be ready or fax transmitted. So I mean that I want script to sleep, not the session, just because my session may work in that time (transmit a fax). I think if I use session:sleep() in my case - my fax transmission will fail... Do you think I'm right? Do you think I can use freeswitch.msleep() in my case? And do you know which (if it will at all) troubles should I get?

Thanks,
Dmitry.

-----Original Message-----
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Steven Ayre
Sent: 07 Mar 2011 11:17
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] What is so dangeres in "freeswitch.msleep()" in LUA?

AFAIK it stops all processing of the call during the sleep, you should
use session:sleep()

-Steve


On 6 March 2011 22:48, Dmitry Saratsky <simpot at simpot.com> wrote:
> Hi All,
>
>
>
> According to: http://wiki.freeswitch.org/wiki/Mod_lua#freeswitch.msleep
>
> It is not good to use: "freeswitch.msleep()" in session-based script:
>
> NOTE: Do not use this on a session-based script or bad things will happen.
>
>
>
> Can anyone explain please why not and what does author mean with
> "session-based script".
>
>
>
> I want to use it inside some function between I originate session and hangup
> it in the following way:
>
>
>
>    repeat
>
> --      os.execute("sleep 1");
>
>         freeswitch.msleep(1000);
>
>         until ((not new_session:ready() == true) or
> (new_session:getVariable("fax_result_code") >= "0"))
>
>    new_session:hangup();
>
>
>
> Is it danger for me to use this?
>
> _______________________________________________
> 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

!DSPAM:4d74b6b532762805214069!


_______________________________________________
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



More information about the FreeSWITCH-users mailing list