[Freeswitch-users] How to ensure Lua script runs completely before hangup is executed

Tom Fielding tomfieldingpersonal at gmail.com
Thu Aug 2 18:36:07 UTC 2018


Thanks all.

So what’s the best practice if I have:

Main.lua
-does a bunch of setup like creating user accounts for a caller that is not
in the system

Hangup.lua
-cleanup after call hangs up

If the call hangs up (e.g. short duration call) before the setup is
complete, will Hangu.lua need to check that the setup was done and perform
the setup tasks before the cleanup tasks? This would mean a bunch more work
for checks and redundant code to perform setup tasks in Hangup.lua

I was thinking about this as a solution - spawn a new Setup.lua in Main.lua
and create some locks to make sure Setup.lua is done before Main.Lua
proceeds, and in Hangup.lua make sure Setup.lua is done before Hangup.lua
proceeds?

Or am I overthinking this?

Thanks!
T





On Thu, Aug 2, 2018 at 7:15 AM, Abaci B <abaci64 at gmail.com> wrote:

> if you have a hangup hook it will go to that at hangup time if you don't
> have a hangup it will continue the script, skipping anything session
> related, so you have to be careful as you might get unexpected results.
>
> On Wed, Aug 1, 2018 at 10:27 PM, Tom Fielding <
> tomfieldingpersonal at gmail.com> wrote:
>
>> Thanks Abaci.
>>
>> I do have hangup hook set up.
>>
>> I see, so I can only have the Lua script called from the dial plan run to
>> completion or a hangup script.
>>
>> On Wed, Aug 1, 2018 at 9:49 AM, Abaci B <abaci64 at gmail.com> wrote:
>>
>>> by default the script should continue running after the the hangup
>>> unless you have something like hangup hook.
>>>
>>> On Tue, Jul 31, 2018 at 9:12 PM, Tom Fielding <
>>> tomfieldingpersonal at gmail.com> wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> I have a Lua script running from dial plan.
>>>>
>>>> However, when the call hangs up, the Lua script stops. I need the
>>>> script to run completely before being stopped by Hangup.
>>>>
>>>> Is this possible?
>>>>
>>>> Do I need to spawn another script using luarun to accomplish this?
>>>>
>>>> Thanks,
>>>> T
>>>>
>>>> ____________________________________________________________
>>>> _____________
>>>> Professional FreeSWITCH Services
>>>> sales at freeswitch.com
>>>> https://freeswitch.com
>>>>
>>>> Official FreeSWITCH Sites
>>>> https://freeswitch.com/oss
>>>> https://freeswitch.org/confluence
>>>> https://cluecon.com
>>>>
>>>> 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/free
>>>> switch-users
>>>> https://freeswitch.com
>>>>
>>>
>>>
>>> ____________________________________________________________
>>> _____________
>>> Professional FreeSWITCH Services
>>> sales at freeswitch.com
>>> https://freeswitch.com
>>>
>>> Official FreeSWITCH Sites
>>> https://freeswitch.com/oss
>>> https://freeswitch.org/confluence
>>> https://cluecon.com
>>>
>>> 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
>>> https://freeswitch.com
>>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Services
>> sales at freeswitch.com
>> https://freeswitch.com
>>
>> Official FreeSWITCH Sites
>> https://freeswitch.com/oss
>> https://freeswitch.org/confluence
>> https://cluecon.com
>>
>> 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
>> https://freeswitch.com
>>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Services
> sales at freeswitch.com
> https://freeswitch.com
>
> Official FreeSWITCH Sites
> https://freeswitch.com/oss
> https://freeswitch.org/confluence
> https://cluecon.com
>
> 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
> https://freeswitch.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20180802/3a8c1b36/attachment.html>


More information about the FreeSWITCH-users mailing list