Hello, i have a javscript that is called from xml-dialplan ... function on_hangup(hup_session, how) { console_log("info","got hungup"); exit(); } session.execute('bridge','sofia/internal....'); session.setHangupHook(on_hangup); ... Now i experience, that this function is only called if the session is not answered yet. Once its answered and then got hung up, the function on_hangup is not called anymore. Any ideas ? Kind regards Christian Hiller
Hi Christian, The hangup hook api should be set in the dialplan: <action application="set" data="api_hangup_hook=jsrun cleanup.js ${uuid}"/> This will trigger the hangup api once the session is destroyed. Regards, Erik -----Oorspronkelijk bericht----- Van: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Namens Christian Hiller Verzonden: dinsdag 15 februari 2011 16:48 Aan: freeswitch-users@lists.freeswitch.org Onderwerp: [Freeswitch-users] javascript hanguphook Hello, i have a javscript that is called from xml-dialplan ... function on_hangup(hup_session, how) { console_log("info","got hungup"); exit(); } session.execute('bridge','sofia/internal....'); session.setHangupHook(on_hangup); ... Now i experience, that this function is only called if the session is not answered yet. Once its answered and then got hung up, the function on_hangup is not called anymore. Any ideas ? Kind regards Christian Hiller _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
hello Erik, i have set <action application="set" data="my_var=123"/> <action application="set" data="session_in_hangup_hook=true"/> <action application="set" data="api_hangup_hook=jsrun cleanup.js ${my_var}"/> <action application="javascript" data="routing.js"/> The channel_variable ${my_var} gets updated in routing.js but whenever cleanup.js is executed, then ${my_var} still has the old value of 123. Why that? Kind regards Am 20:59, schrieb Erik Dekkers:
Hi Christian,
The hangup hook api should be set in the dialplan: <action application=et" data="api_hangup_hook=jsrun cleanup.js ${uuid}"/>
This will trigger the hangup api once the session is destroyed.
Regards,
Erik
-----Oorspronkelijk bericht----- Van: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Namens Christian Hiller Verzonden: dinsdag 15 februari 2011 16:48 Aan: freeswitch-users@lists.freeswitch.org Onderwerp: [Freeswitch-users] javascript hanguphook
Hello,
i have a javscript that is called from xml-dialplan ... function on_hangup(hup_session, how) { console_log("info","got hungup"); exit(); }
session.execute('bridge','sofia/internal....'); session.setHangupHook(on_hangup); ...
Now i experience, that this function is only called if the session is not answered yet. Once its answered and then got hung up, the function on_hangup is not called anymore. Any ideas ?
Kind regards
Christian Hiller
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
On Sun, Feb 20, 2011 at 4:29 PM, Christian Hiller <christian@yellox.de>wrote:
hello Erik,
i have set
<action application="set" data="my_var=123"/> <action application="set" data="session_in_hangup_hook=true"/> <action application="set" data="api_hangup_hook=jsrun cleanup.js ${my_var}"/> <action application="javascript" data="routing.js"/>
The channel_variable ${my_var} gets updated in routing.js but whenever cleanup.js is executed, then ${my_var} still has the old value of 123. Why that?
At the time that the api_hangup_hook=jsrun cleanup.js ${my_var} action is parsed, the value of ${my_var} is "123" so that is what is set. The good news is that if you have session_in_hangup_hook set to true you should be able to see the updated value of my_var. I'm afraid I don't see any wiki examples of how to do this in Javascript. Does anyone have a code sample of how to access the channel variables in a js hangup hook when session_in_hangup_hook is true? For reference, the Lua method is shown here: http://wiki.freeswitch.org/wiki/Lua#Special_Case:_env_object -MC
participants (3)
-
Christian Hiller
-
Erik Dekkers
-
Michael Collins