[Freeswitch-users] can't get channel variables after hangup
Chad Phillips -- Apartment Lines
chad at apartmentlines.com
Thu Dec 2 22:23:42 MSK 2010
on a related note, i wanted to point out that if you're already inside a running script and need to perform actions when the call is hung up, you can do it right inside the script, no need to set a hangup hook. in this case, when the call hangs up, session:ready() (in Lua's case) returns false, the entire session object is still available (including channel variables), and you can perform hangup tasks and end the script when you're finished.
the fact that FreeSWITCH allows your script to continue running after hangup is quite handy, but it also means that you should be thorough in your use of session:ready() to ensure the call is still up when you're taking actions that depend on it. this is especially important when using loops in your script -- very unpleasant things can happen if you don't include session:ready() in your loop conditional!
hope this further clarification helps.
chad
On Dec 1, 2010, at 12:48 PM, Michael Collins wrote:
> 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.
More information about the FreeSWITCH-users
mailing list