[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    [asterisk-dev] Patch:  add MeetMe-like 'x' option to ConfBridge
From:       Ian Pilcher <arequipeno () gmail ! com>
Date:       2011-01-21 4:30:48
Message-ID: ihb25q$1r6$1 () dough ! gmane ! org
[Download RAW message or body]

This my first go at adding a feature, so please be gentle (or at least
constructive ;-) ).

The attached patch adds a MeetMe-like 'x' option to the ConfBridge
application.  (Note that *all* marked users must specify this option for
it to work reliably; I'm not sure if this is true of MeetMe or not.)  I
also added a 'Q' option, which suppresses playing the "the leader has
left the conference" message without disabling entry and exit sounds.

I have this deployed in "production" at home, where I use ConfBridge to
set up "dynamic" bridges when one person wants to join another's call.
The need for the 'x' option is pretty strong in this scenario, since we
don't want to allow an external call to keep the bridge going after all
of the home extensions hang up.

(Note:  I'm using 1.6 at home, but the attached patch is against SVN
trunk.)

I'm obviously interested in any pointers and feedback.  I'd be
particularly appreciative if someone who understands the locking
requirements could take a look; I basically just copied what I saw
elsewhere in app_confbridge.c.

The other question is ... where to go from here.  Should I open a
feature request in the Issue Tracker?  Different pages say different
things on that subject.  If not, are patches which add features tracked
anywhere?  (I have created an account and signed the contributor
agreement.)

Thanks!

-- 
========================================================================
Ian Pilcher                                         arequipeno@gmail.com
========================================================================

["asterisk-confbridge.patch" (text/x-patch)]

--- apps/app_confbridge.c.orig	2011-01-19 15:44:40.395558917 -0600
+++ apps/app_confbridge.c	2011-01-20 21:28:42.698066679 -0600
@@ -91,6 +91,16 @@
                                         <option name="q">
                                                 <para>Quiet mode (don't play \
enter/leave sounds).</para>  </option>
+                                        <option name="x">
+                                                <para>End the conference when the \
last marked user disconnects. Note that all +                                         \
ConfBridge settings are per-user, rather than conference-wide. Thus, this +           \
option must be specified for all marked users.</para> +                               \
</option> +                                        <option name="Q">
+                                                <para>Do not play a message when the \
last marked user disconnects. (Unlike +                                               \
the <literal>q</literal> option, which also suppresses this message, this +           \
option does not prevent entry and exit sounds from being played.)</para> +            \
</option>  </optionlist>
 		      </parameter>
                 </syntax>
@@ -124,6 +134,8 @@
 	OPTION_MARKEDUSER = (1 << 6),        /*!< Set if the caller is a marked user */
 	OPTION_WAITMARKED = (1 << 7),        /*!< Set if the conference must wait for a \
marked user before starting */  OPTION_QUIET = (1 << 8),             /*!< Set if no \
audio prompts should be played */ +	OPTION_MARKEDEXIT = (1 << 9),        /*!< Set if \
the conference should end when the last marked user disconnects */ \
+	OPTION_NOLEADERHASLEFT = (1 << 10),  /*!< Set if the "the leader has left the \
conference" sound file should not be played */  };
 
 enum {
@@ -142,6 +154,8 @@
 	AST_APP_OPTION('s', OPTION_MENU),
 	AST_APP_OPTION('w', OPTION_WAITMARKED),
 	AST_APP_OPTION('q', OPTION_QUIET),
+    AST_APP_OPTION('x', OPTION_MARKEDEXIT),
+    AST_APP_OPTION('Q', OPTION_NOLEADERHASLEFT),
 });
 
 /* Maximum length of a conference bridge name */
@@ -513,7 +527,7 @@
 			}
 
 			/* Play back the audio prompt saying the leader has left the conference */
-			if (!ast_test_flag(&conference_bridge_user->flags, OPTION_QUIET)) {
+			if (!ast_test_flag(&conference_bridge_user->flags, OPTION_QUIET) && \
!ast_test_flag(&conference_bridge_user->flags, OPTION_NOLEADERHASLEFT)) {  \
ao2_unlock(conference_bridge);  ast_autoservice_start(conference_bridge_user->chan);
 				play_sound_file(conference_bridge, "conf-leaderhasleft");
@@ -521,13 +535,22 @@
 				ao2_lock(conference_bridge);
 			}
 
-			/* Now on to starting MOH if needed */
-			AST_LIST_TRAVERSE(&conference_bridge->users_list, other_participant, list) {
-				if (ast_test_flag(&other_participant->flags, OPTION_MUSICONHOLD) && \
                !ast_bridge_suspend(conference_bridge->bridge, \
                other_participant->chan)) {
-					ast_moh_start(other_participant->chan, \
                other_participant->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
-					ast_bridge_unsuspend(conference_bridge->bridge, other_participant->chan);
-				}
-			}
+			/* End the conference? */
+            if (ast_test_flag(&conference_bridge_user->flags, OPTION_MARKEDEXIT)) {
+                ao2_lock(conference_bridge);
+                AST_LIST_TRAVERSE(&conference_bridge->users_list, other_participant, \
list) { +                    ast_bridge_remove(conference_bridge->bridge, \
other_participant->chan); +                }
+                ao2_unlock(conference_bridge);
+            } else {
+                /* Now on to starting MOH if needed */
+                AST_LIST_TRAVERSE(&conference_bridge->users_list, other_participant, \
list) { +                    if (ast_test_flag(&other_participant->flags, \
OPTION_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, \
other_participant->chan)) { +                        \
ast_moh_start(other_participant->chan, \
other_participant->opt_args[OPTION_MUSICONHOLD_CLASS], NULL); +                       \
ast_bridge_unsuspend(conference_bridge->bridge, other_participant->chan); +           \
} +                }
+            }
 		} else if (conference_bridge->users == 1) {
 			/* Of course if there is one other person in here we may need to start up MOH on \
them */  struct conference_bridge_user *first_participant = \
AST_LIST_FIRST(&conference_bridge->users_list);



--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic