I played around with a couple options and found that issuing a hupall normal_clearing on the initiated call after a few seconds was the most reliable way to do this. The next best option I found was hanging up after a few seconds of receiving CS_EXECUTE state update, though this seemed to cause the timing to vary.
Thanks Michael, I was looking for code examples to receive events over ESL, and found them in libs/esl/.I'm still not clear on the following:
- I have a controller script that originates calls; it runs "show channels" between calls and parses out the number of active channels. If below threshold, originate next call. If not, wait a couple seconds and run "show channels" again, repeating till below threshold. Is this the best way? Can this be done more efficiently through events? How?
- For placing missed calls to SIP endpoints, it sounds like I can wait for a signal 180 or 183 to know when to hang up. How do I check for those signals? Is this another job for events?
- For placing missed calls over openzap/PRI, it sounds like I can check for call states PROGRESS or ALERTING? Where are those states from, and how do I check them? Again, can I use events? The other option you gave is checking for endpoint_disposition. This is in the cdr, but how do I use it for detecting when I should hang up for a missed call? Is there an event associated with it? What are the call states it goes through?
-NeilOn Wed, May 12, 2010 at 2:47 PM, Michael Collins <msc@freeswitch.org> wrote:
On Wed, May 12, 2010 at 11:59 AM, Neil Patel <neilp@cs.stanford.edu> wrote:Thanks for the tips.Where are there examples of using ESL to register and handle events? For e.g. I don't see any example of how to register for a change in channel variable endpoint_disposition. Or even to check the CHANNEL_STATE event.-NeilNeil,
Check out the event socket documentation, specifically the "events plain all" and "filter" commands. You can listen to all events or just specific ones:
http://wiki.freeswitch.org/wiki/Event_socket
If you want to experiment with the event socket and the various events then use fs_cli. Connect with fs_cli and then issue "/log 0" which turns off all debug messages. Now you have basically a raw event socket. Try some of these commands:
/event plain all
watch the fun messages fly. :)
You can filter them as well:
/filter Event-Name CHANNEL_STATE
/filter Event-Name CHANNEL_HANGUP
when you apply a filter you will receive only those things you choose. A it's a "filter in" not filter out. Another way of saying it is "show me events named CHANNEL_STATE" and "show me events named CHANNEL_HANGUP"
just note that in your script you will be using the ESL abstractions for these:
http://wiki.freeswitch.org/wiki/Esl#ESLconnection_Object
I hope that helps! Have fun.
-MC
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org