[Freeswitch-users] Is there any way to loop a dialplan?

Tim St. Pierre tim at communicatefreely.net
Mon Feb 22 20:06:15 PST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Why not just use transfer?

Break your dialplan up into segments - one that does the authentication, and another that has the
call flow to the parking pool, and the post call work.  You can use the transfer application to
connect these segments together.  Variables are preserved across transfers, so things like the agent
ID and their authenticated status can be set in a variable.  You can also make routing decisions
based on the value of a variable.  In your condition statement, use the variable name
"${my_variable}" as the field, and then a very simple pattern match that decides if it's valid or
not.  You can also use the execute_extension application as a sort of "macro", to execute another
dialplan block, but return when it completes.  At the bottom of your dialplan, transfer back to the top.

Hope that's helpful.  Sorry I don't have any example code.  I'm generating XML dynamically in PHP,
but the above concept seems to work well.

- -Tim

Mark Sobkow wrote:
> Let me explain what it is I'm trying to do.  Maybe there's another way 
> to achieve it.
> 
> When an operator dials in to the log-in line (e.g. Extension 6000), I 
> use play_and_get_digits to collect the operator's PIN.  I then need to 
> be able to fire up some Erlang (or Javascript) to verify the PIN, and 
> after verification, put the call into a park state, collecting the 
> UUID.  I then need to fire an event to Erlang passing along the parked 
> UUID and the operator's PIN so that Erlang can direct received customer 
> calls to the operators based on relatively complex criteria that won't 
> fit in a dialplan.
> 
> The catch is that when I get a customer call, I collect their info via 
> IVR menus, park the call, and fire an event to Erlang with the UUID of 
> the parked call and info collected from the IVR.  Erlang analyses the 
> info, selects an operator who is free, and bridges the calls.
> 
> The problem I'm having is figuring out a way to get the operator leg to 
> go back into a park state after handling the customer's call.  Ideally I 
> want the operator to be presented with a short IVR to collect info about 
> how the call was handled, but I can do that through a custom application 
> GUI if I need to.  Regardless, once an operator logs in, they need to 
> _stay_ logged in until they explicityly log out, but I can't figure out 
> how I'm supposed to do that without some sort of looping capability.
> 
> One thing I was thinking that might work is to set up a set of "dummy" 
> extensions that I can have Erlang dial and bridge which contain a 
> dialplan fragment to collect the IVR call result, park the call, and 
> issue the operator PIN and parked UUID again to Erlang.  That way 
> between Erlang events and the dialplan fragment I end up with an 
> effective "loop".  (Though I've yet to figure out how I can break out of 
> that loop.  Maybe it'll have to be an IVR option for logging out.)
> 
> Sample code/dialplans would be good, but for now I'll settle for knowing 
> whether I'm at least on the right track for how to implement this beast.
> 
> Note that I only want to drop into Javascript if I can't figure out how 
> to do it with dialplans and Erlang.
> 
> Thanks for any ideas and suggestions.
> 

- --
Tim St. Pierre
IP Voice technician
Communicate Freely
1-877-291-8647 x5101
sip:5101 at communicatefreely.net
tim at communicatefreely.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBS4NUN4qVcvNCnHOrAQIDcgP/SpzpLUpsnFjGaamy4EbUw95l2mDHrEYa
ay1cbciSV5qICRLoDvTrleqYkrMhgRlvzxvkLRRzFIOPjm4+cFQMojmMS5HZZQiJ
TWndXAiZGgtlKqEDfgqr1ea2BcXi/oozsJIk0iePgPLIGlMUa/O2p3kaizQzPMc7
fbMNwcSYSc8=
=KtCw
-----END PGP SIGNATURE-----




More information about the FreeSWITCH-users mailing list