Hi guys,<br><br>First some good news: we're finally close to releasing our free IVR Development platform SafiServer/SafiWorkshop (<a href="http://www.safisystems.com">www.safisystems.com</a>) with FreeSWITCH support! It's happening much later than we originally anticipated as we've been unexpectedly busy with contracting opportunities but I think it will be worth the wait. Currently everything is working fine with one minor exception: if the user-created script (we call them Saflets) doesn't explicitly hang up the call, the call will remain parked until the caller hangs up. Some details:<br clear="all">
<br>In Asterisk we invoke our server-side scripting applications via the extensions.conf using the following syntax:<br><br>exten = 1111,1,Agi(agi://<a href="http://192.168.0.10:3573/safletEngine.agi?saflet=project1/callflow1">192.168.0.10:3573/safletEngine.agi?saflet=project1/callflow1</a>)<br>
<br>Here '192.168.0.10' is the IP address of the SafiServer and project1/callflow1 identifies the Saflet to be executed. Asterisk creates a socket connection to the SafiServer and, once the socket is disconnected, the call proceeds to the next entry in the dialplan (typically 'hangup').<br>
<br>For FreeSWITCH, the process is slightly different. Currently, rather than create a separate socket connection for each incoming call, we're invoking an event that informs the SafiServer that there is a new incoming call. The event contains the contextual information including the Saflet name. For example:<br>
<br><extension name="9194"><br> <condition field="destination_number" expression="9194$"><br> <action inline="true" application="set" data="saficall=true"/><br>
<action application="event" data="Event-Subclass=saficall::incoming,Event-Name=CUSTOM,saflet_project=test,saflet=flow1,new_saficall=true"/><br> <br> <!-- <action application="set" data="park_timeout=10"/> --><br>
<action application="park" /><br> </condition><br> </extension><br><br>So once the event is fired, the call is parked to prevent further execution within the dialplan. From there on, SafiServer is controlling the call via Inbound Mod event socket. <br>
<br>So this works perfectly, except that if the invoked Saflet doesn't explicitly hang-up the call it will remain parked until the caller hangs up. My question is, is there a better way to do this? Is there some better alternative to park in this case? Ideally I'd like to initiate a 'session' of some kind when the SafiServer is "controlling" the call and then exit that session as soon as the Saflet is complete, at which point the call would continue on to the next entry in the dialplan. I understand I could use Outbound sockets to achieve this but, as I mentioned, I'd like to avoid the overhead of a separate socket connection for each incoming call. <br>
<br>I actually have a mod_saficall.c app that does basically the the same thing as I described in the dialplan entry. Perhaps there's something more I could do in code that would allow me to be notified when the session is complete. Here's the relevant code I have so far:<br>
<br> switch_channel_t *channel = NULL;<br> switch_event_t *event;<br> const char *safiCallFlag = NULL;<br> channel = switch_core_session_get_channel(session);<br><br> safiCallFlag = switch_channel_get_variable(channel, "saficall");<br>
<br> if (!safiCallFlag)<br> switch_channel_set_variable(channel, "saficall", "true");<br> <br> <br> if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, "saficall::incoming") == SWITCH_STATUS_SUCCESS) {<br>
<br> switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "new_saficall", safiCallFlag ? "false" : "true");<br><br> switch_channel_event_set_data(channel, event);<br>
switch_event_fire(&event);<br> switch_ivr_park(session, NULL);<br> }<br> <br>Any ideas you might have on this are welcome.<br><br>Thanks,<br>Zac Wolfe<br>Safi Systems LLC<br><a href="http://www.safisystems.com">www.safisystems.com</a><br>