[Freeswitch-dev] Make waiting around an option for consumer callbacks in mod_fifo [patch]

Herman Griffin herman at hermangriffin.com
Sun Mar 15 17:23:11 PDT 2009


The consumer callback that has been added to mod_fifo is great. I've been
looking for this feature for a long time.
However, in it's current state it still has the problem that I was trying to
avoid in the first place; I don't want agents
to just be sitting around waiting for callers with their phone off the hook.

I made a slight modification mod_fifo.c that makes the "waiting around" an
option. If you set the channel following channel
variable in the originate string for agents in fifo.conf.xml, then the
consumers phone will either hangup or stay off hook when
they answer a queue calls:

member_wait = wait|nowait

nowait: agents phone hangs up
wait: agents wait around


I'm including a patched for mod_fifo.c and fifo.conf.xml.

li53-164:~/fstrunk# svn diff src/mod/applications/mod_fifo/mod_fifo.c
conf/autoload_configs/fifo.conf.xml
Index: src/mod/applications/mod_fifo/mod_fifo.c
===================================================================
--- src/mod/applications/mod_fifo/mod_fifo.c    (revision 12607)
+++ src/mod/applications/mod_fifo/mod_fifo.c    (working copy)
@@ -462,10 +462,23 @@


        channel = switch_core_session_get_channel(session);
+
+       /*Add option to wait on not wait*/
+       const char *member_wait = NULL;
+       member_wait = switch_channel_get_variable(channel, "member_wait");
+
+       /*if the member_wait channel variable is NULL or not set to "wait"
or 'nowait"
+               then default to "wait"
+       */
+       if( NULL == member_wait || !( !strcasecmp(member_wait, "wait") ||
!strcasecmp(member_wait, "nowait") ) )
+       {
+               member_wait = "wait";
+       }
+
        switch_channel_set_variable(channel, "fifo_outbound_uuid", h->uuid);
        switch_core_event_hook_add_state_change(session, hanguphook);
        app_name = "fifo";
-       arg = switch_core_session_sprintf(session, "%s out wait",
h->node_name);
+       arg = switch_core_session_sprintf(session, "%s out %s",
h->node_name, member_wait); /*Add option to wait or not wait*/
        extension = switch_caller_extension_new(session, app_name, arg);
        switch_caller_extension_add_application(session, extension,
app_name, arg);
        switch_channel_set_caller_extension(channel, extension);
Index: conf/autoload_configs/fifo.conf.xml
===================================================================
--- conf/autoload_configs/fifo.conf.xml (revision 12607)
+++ conf/autoload_configs/fifo.conf.xml (working copy)
@@ -1,7 +1,7 @@
 <configuration name="fifo.conf" description="FIFO Configuration">
   <fifos>
     <fifo name="cool_fifo@$${domain}" importance="0">
-      <!--<member timeout="60" simo="1" lag="20">user/1005@
$${domain}</member>-->
+      <!--<member timeout="60" simo="1"
lag="20">{member_wait=nowait}user/1005@$${domain}</member>-->
     </fifo>
   </fifos>
 </configuration>


An alternate approach is to make the 'member_wait" option an attribute in
the member tag, which would be more elegant.
However is would require changes to funtions and the fifo_outbound table.
I'm sure I could whip that up pretty quickly too.

However, I don't want to spend my time doing it without feedback from you
all? Please provide some input to the usefulness
of this option and and ideas that you have.

./herman
freenode: frek310
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20090315/abe6780b/attachment.html 


More information about the Freeswitch-dev mailing list