[Freeswitch-users] mod_python post-processing after hangup
Novak Joe
joes.mailing.lists at gmail.com
Fri Sep 12 20:45:59 PDT 2008
Hi,
I received loads of useful hints on IRC yesterday regarding this
problem, and as a result was able to come up with a decent solution
which just involves using the API and 'runtime' functions to run my
post-processing job in a thread after hangup. I don't think it is
possible to pass objects via this method, but what I've worked out is
sufficient for my needs.
I also updated the wiki to include this example in hopes of saving
the good souls at IRC from having to repeat this again.
http://wiki.freeswitch.org/wiki/Mod_python#Run_something_in_a_thread_using_API
I'd also appreciate it if someone could take a look at the wiki and
confirm that the example I've described is appropriate.
If possible, I'd also like to add something about usage of the API
in general. I spent a good amount of time searching about on my own,
but still ended up asking some pretty silly questions in this vein on
IRC.
I'm still a bit shaky regarding what is what, as the word API
appears in many different places throughout the wiki but appears to
refer to several different APIs. The mod_python API wiki entry refers
to the Lua entry, and the Lua entry simply provides an example of how
to instantiate a new API object, which is then followed by a lengthy
section titled API:
http://wiki.freeswitch.org/wiki/Mod_lua#API
which doesn't mention the executeString method anywhere except in
the context of stream:write.
The one I've actually been interested - I think! - is this guy,
http://www.freeswitch.org/docs/class_a_p_i.html
If I can get confirmation/further_explanation of this, I'll be happy
to update the mod_python wiki accordingly, and hopefully stave off
this particular variety of confusion in future!
Cheers,
Joe
>IIRC, Anthony mentioned an elegant way of handling this not too long
>ago, although it was with a different language. The gist of it was this:
>
>While (session.is.active) {
> Do stuff
>}
>Do stuff after hangup
>
>Obviously you'll need to use Python-ish syntax but you get the idea.
>
>Alternatively you can research using the api_hangup_hook channel
>variable and see if possibly this will let you do what you wish to do:
>http://wiki.freeswitch.org/wiki/Channel_Variables#api_hangup_hook
>
>in any event, please report back what you tried and if you get it to
>work please add it to the more samples section of the mod_python wiki
>page since that needs a little love from the Pythoners out there.
More information about the FreeSWITCH-users
mailing list