[Freeswitch-dev] Hangup hook gets destroyed when calling a script in conference caller controls

Anthony Minessale anthony.minessale at gmail.com
Mon Nov 18 23:00:02 MSK 2013


Sine conference is a blocking call that only ends when you exit the
conference, The next line of code after you execute conference is basically
a hangup hook.  If you test if the channel is still up you should be able
to tell the difference between hangup and transfer.

Calling a conference from inside a lua script is a bit resource intensive
compared to exiting the lua, calling the conference from the regular
dialplan and going back to lua in an api_hangup_hook instead.







On Fri, Nov 15, 2013 at 3:58 AM, Melanie Treitinger <
treitinger at as-infodienste.de> wrote:

>  Hi,
>
> I have the following scenario: When using a script in the conference
> caller controls, the hangup hook gets destroyed.
> Affected script languages: Lua, Spidermonkey, Python, Perl
>
> You can easily reproduce this effect using the below Lua scripts and
> adding the script application to the caller controls.
> This is what happens:
> - hangup without pressing a digit: hangup hook is called
> - press a digit without script call, then hangup: hangup hook is called
> - press a digit with script call, then hangup: hangup hook is not called
>
> Looking into the source code of session_destroy, you can see that the
> hangup hook is in fact removed - which shold not happen when calling a
> script.
> And there is no way to set it again after pressing the "*" digit.
>
> Any ideas on this?
>
>
> Thanks,
> Melanie
>
>
>
> test-conferece.lua:
> --------------
> function session_hangup_hook(status)
>   freeswitch.consoleLog("NOTICE", "Session hangup: " .. status .. "\n")
>   error()
> end
>
> session:answer();
> session:setHangupHook("session_hangup_hook")
> conf_num = "3000"
> session:execute("conference", string.format("%s at default", conf_num))
> session:hangup()
>
>
> caller_controls.lua:
> --------------------
> freeswitch.consoleLog("NOTICE","---- DTMF detect ----\n");
>
>
> conference.conf.xml:
> --------------------
> <caller-controls>
> <group name="default">
>   <control action="mute" digits="0"/>
>   <control action="execute_application" digits="*" data="lua
> caller_controls.lua"/>
>   <control action="energy up" digits="9"/>
>   <control action="energy equ" digits="8"/>
>   <control action="energy dn" digits="7"/>
>   <control action="vol talk up" digits="3"/>
>   <control action="vol talk zero" digits="2"/>
>   <control action="vol talk dn" digits="1"/>
>   <control action="vol listen up" digits="6"/>
>   <control action="vol listen zero" digits="5"/>
>   <control action="vol listen dn" digits="4"/>
>   <control action="hangup" digits="#"/>
> </group>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20131118/388accad/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-dev mailing list