[Freeswitch-users] can't get channel variables after hangup
Madovsky
infos at madovsky.org
Wed Dec 1 23:59:22 MSK 2010
Thanks Mike,
and with PHP is $session available ?
----- Original Message -----
From: Michael Collins
To: FreeSWITCH Users Help
Sent: Wednesday, December 01, 2010 3:48 PM
Subject: Re: [Freeswitch-users] can't get channel variables after hangup
This won't work. The "session_in_hangup_hook" literally means that the $session object is available in the hangup hook script. You need to use Lua, Perl, or Javascript to access the $session object. What you are doing is actually trying to access a uuid that does not exist. Once the call is over it's gone. The "session" object will be available only in the script that is called in the hangup hook.
Here's a simple script you can tinker with:
-- hook-test.lua
dat = env:serialize()
--freeswitch.consoleLog("INFO","Here you go:\n" .. dat .. "\nn")
uuid = env:getHeader("uuid")
freeswitch.consoleLog("INFO","Inside hangup hook, uuid is: " .. dat .. "\n")
my_var = env:getHeader("my_custom_var")
freeswitch.consoleLog("INFO","my_custom_var is '" .. dat .. "'\n")
api = freeswitch.API()
res = api:execute("uuid_dump",uuid)
freeswitch.consoleLog("INFO","result of 'uuid_dump " .. uuid .. "' is:\n" .. res .. "\n\n")
Hopefully that will illustrate the issue...
-MC
On Wed, Dec 1, 2010 at 8:53 AM, Madovsky <infos at madovsky.org> wrote:
I set this in my dialplan :
<action application="set" data="session_in_hangup_hook=true"/>
<action application="set" data="api_hangup_hook=system /usr/local/bin/php /usr/local/freeswitch/scripts/php/test.php ${uuid}"/>
and this in test.php:
exec("/usr/local/freeswitch/bin/fs_cli -x \"uuid_getvar ".$argv[1]." test_var\"", $exTabRet, $req);
it results :
-ERR No Such Channel!
I tried to replace ${uuid} by ${call_uuid} without success.
Thanks
Franck
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101201/98b35590/attachment-0001.html
More information about the FreeSWITCH-users
mailing list