Hi guys,<br><br>First some good news:  we&#39;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&#39;s happening much later than we originally anticipated as we&#39;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&#39;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 &#39;192.168.0.10&#39; 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 &#39;hangup&#39;).<br>
<br>For FreeSWITCH, the process is slightly different.  Currently, rather than create a separate socket connection for each incoming call, we&#39;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>&lt;extension name=&quot;9194&quot;&gt;<br>      &lt;condition field=&quot;destination_number&quot; expression=&quot;9194$&quot;&gt;<br>        &lt;action inline=&quot;true&quot; application=&quot;set&quot; data=&quot;saficall=true&quot;/&gt;<br>
        &lt;action application=&quot;event&quot; data=&quot;Event-Subclass=saficall::incoming,Event-Name=CUSTOM,saflet_project=test,saflet=flow1,new_saficall=true&quot;/&gt;<br>       <br>       &lt;!-- &lt;action application=&quot;set&quot; data=&quot;park_timeout=10&quot;/&gt; --&gt;<br>
        &lt;action application=&quot;park&quot; /&gt;<br>      &lt;/condition&gt;<br>    &lt;/extension&gt;<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&#39;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&#39;d like to initiate a &#39;session&#39; of some kind when the SafiServer is &quot;controlling&quot; 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&#39;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&#39;s something more I could do in code that would allow me to be notified when the session is complete.  Here&#39;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, &quot;saficall&quot;);<br>
<br>    if (!safiCallFlag)<br>        switch_channel_set_variable(channel, &quot;saficall&quot;, &quot;true&quot;);<br>   <br>   <br>    if (switch_event_create_subclass(&amp;event, SWITCH_EVENT_CUSTOM, &quot;saficall::incoming&quot;) == SWITCH_STATUS_SUCCESS) {<br>
      <br>        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;new_saficall&quot;, safiCallFlag ? &quot;false&quot; : &quot;true&quot;);<br><br>        switch_channel_event_set_data(channel, event);<br>
        switch_event_fire(&amp;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>