Make waiting around an option for consumer callbacks in mod_fifo [patch]
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
The variable way is ok since you can set it in the dial string you set in the config anyway so you have the best of both worlds. Can you submit the patch via jira please http://jira.freeswitch.org, patches in email tend to get broken by whitespace changes etc. On Sun, Mar 15, 2009 at 7:23 PM, Herman Griffin <herman@hermangriffin.com>wrote:
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
_______________________________________________ Freeswitch-dev mailing list Freeswitch-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
participants (2)
-
Anthony Minessale
-
Herman Griffin