[Freeswitch-users] Trying to get my head around threads...

Alex Lake alex at digitalmail.com
Fri Mar 14 14:08:20 MSK 2014


I'm in the process of tidying up the way in which our dialplans and 
scripts are constructed, but am slightly struggling to understand how 
threads relate to channels and stuff like that.

For example, we have a call that comes in, a bridge is made to a 
recipient and at the same time, we bind ** to a "mid-call menu" so that 
the b-party can hit ** and then do stuff (eg. initiate a transfer).

This has all been working fine using a basic dialplan approach, but as 
we add more features in, the dialplans are getting somewhat unreadable 
and hard to understand.  I would like to adopt a more modular approach 
such that if we wanted (for example) an a-party mid-call menu, we would 
share the same code, but with flags to indicate the differences in call 
handling. So the idea of trying to go a little more lua-centric strikes 
me as a good one in theory.

However, my first attempt at this seems to have fallen foul of the 
"defying physics" problem that Anthony has mentioned before - when the 
b-party hits **, the a-party doesn't get on-hold music (their line just 
goes quiet) until the b-party hangs up.

I'll be looking into the differences between the working script (with 
dialplan) and the prototypical (lua-rich) version, but in the meantime 
there is something about the working script that seems to be using some 
undocumented feature - uuid_transfer with -aleg (not sure what this is 
doing, if indeed anything at all!).

Also, I get the impression that bgapi doesn't really work from within 
lua. I've seen reference to running luarun within lua to start a new 
thread, but am unsure as to how to tame it.



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