[asterisk-commits] qwell: branch qwell/pjsip-shared-libs r382850 - in /team/qwell/pjsip-shared-l...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 12 11:26:32 CDT 2013


Author: qwell
Date: Tue Mar 12 11:26:27 2013
New Revision: 382850

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382850
Log:
Multiple revisions 382587,382589,382600,382604,382621,382636,382648,382670-382671,382685,382705,382721,382724,382746,382764,382787,382828

........
  r382587 | kmoore | 2013-03-07 09:36:52 -0600 (Thu, 07 Mar 2013) | 5 lines
  
  Fix minor memory leak in xmldoc
  
  Strings retrieved via ast_xml_get_text() must be freed with
  ast_xml_free_text().
........
  r382589 | mjordan | 2013-03-07 09:48:06 -0600 (Thu, 07 Mar 2013) | 28 lines
  
  Add a 'secret' probation strictrtp mode to handle delayed changes in RTP source
  
  Often, Asterisk may realize that a change in the source of an RTP stream is
  about to occur and ask that the RTP engine reset it's lock on the current RTP
  source. In certain scenarios, it may take awhile for the new remote system to
  send RTP packets, while the old remote system may continue providing RTP during
  that time period. This causes Asterisk to re-lock onto the old source, thereby
  rejecting the new source when the old source stops sending RTP and the new
  source begins.
  
  This patch prevents that by having a constant secondary, 'secret' probation
  mode enabled when an RTP source has been chosen. RTP packets from other sources
  are always considered, but never chosen unless the current RTP source stops
  sending RTP.
  
  Review: https://reviewboard.asterisk.org/r/2364
  
  (closes issue AST-1124)
  Reported by: John Bigelow
  Tested by: John Bigelow
  
  (closes issue AST-1125)
  Reported by: John Bigelow
  Tested by: John Bigelow
  ........
  
  Merged revisions 382573 from http://svn.asterisk.org/svn/asterisk/branches/11
........
  r382600 | kmoore | 2013-03-07 10:21:52 -0600 (Thu, 07 Mar 2013) | 5 lines
  
  Resolve more memory leaks in xmldoc
  
  Many places that allocated to pull out an attribute are now freed
  properly.
........
  r382604 | kmoore | 2013-03-07 10:48:19 -0600 (Thu, 07 Mar 2013) | 4 lines
  
  Fix a memory leak in xmldoc
  
  Another instance of attribute retrieval not being freed properly.
........
  r382621 | mjordan | 2013-03-07 13:14:46 -0600 (Thu, 07 Mar 2013) | 12 lines
  
  Let vm_mailbox_snapshot combine "Urgent" when no folder is specified
  
  r381835 fixed a bug in vm_mailbox_snapshot where combining INBOX and Old forgot
  that Urgent also "counts" as new messages. This fixed the problem when any of
  the three folders was specified and the combine option was used.
  
  It missed the case where the folder isn't specified and we build a snapshot of
  all folders. This patch corrects that.
  ........
  
  Merged revisions 382617 from http://svn.asterisk.org/svn/asterisk/branches/11
........
  r382636 | qwell | 2013-03-07 15:14:18 -0600 (Thu, 07 Mar 2013) | 2 lines
  
  Load sorcery modules earlier, so they can actually be used.
........
  r382648 | dlee | 2013-03-07 15:55:28 -0600 (Thu, 07 Mar 2013) | 2 lines
  
  Changing log level of "Not changing threadpool size" from notice to debug.
........
  r382670 | mjordan | 2013-03-07 21:54:38 -0600 (Thu, 07 Mar 2013) | 21 lines
  
  Don't reset the RTP address on a glare re-INVITE
  
  Originally, way back in r201583, we added the alternate RTP address so
  that the RTP engine would expect to receive audio from a new source
  when a glare re-INVITE occurred. In r382589, we remove the alternate
  RTP source, as the 'secret' probation mode allows for switching to a new
  RTP source when a previous source stops sending RTP. At the time, it
  seemed appropriate to set the RTP source based on the information in the
  glared re-INVITE.
  
  Unfortunately, that doesn't work so well - in a glared re-INVITE that occurs
  with no SDP - such as in a connected line update that glances - we'll set
  the RTP source to an invalid address. In subsequent re-INVITE requests from
  this Asterisk instance, we'll then send an invalid media address, which will
  result in the remote side sending a 488. Whoops.
  
  There isn't any need to reset the RTP source - if we're using strictrtp, we'll
  simply synchronize to a new source when we stop getting packets from the old
  one. If we aren't using strictrtp, then again there shouldn't be a problem.
  
  Note that the Asterisk Test Suite's connectedline test caught this error.
........
  r382671 | mjordan | 2013-03-07 22:11:12 -0600 (Thu, 07 Mar 2013) | 4 lines
  
  Remove unused function
  
  After r382670, get_ip_and_port_from_sdp was no longer used.
........
  r382685 | dlee | 2013-03-08 09:15:13 -0600 (Fri, 08 Mar 2013) | 21 lines
  
  This patch adds a new message bus API to Asterisk.
  
  For the initial use of this bus, I took some work kmoore did creating
  channel snapshots. So rather than create AMI events directly in the
  channel code, this patch generates Stasis events, which manager.c uses
  to then publish the AMI event.
  
  This message bus provides a generic publish/subscribe mechanism within
  Asterisk. This message bus is:
  
   - Loosely coupled; new message types can be added in seperate modules.
   - Easy to use; publishing and subscribing are straightforward
     operations.
  
  In addition to basic publish/subscribe, the patch also provides
  mechanisms for message forwarding, and for message caching.
  
  (issue ASTERISK-20887)
  (closes issue ASTERISK-20959)
  Review: https://reviewboard.asterisk.org/r/2339/
........
  r382705 | kmoore | 2013-03-08 10:00:14 -0600 (Fri, 08 Mar 2013) | 11 lines
  
  Add message dump capability to stasis cache layer
  
  The cache dump mechanism allows the developer to retreive multiple
  items of a given type (or of all types) from the cache residing in a
  stasis caching topic in addition to the existing single-item cache
  retreival mechanism.  This also adds to the caching unit tests to
  ensure that the new cache dump mechanism is functioning properly.
  
  Review: https://reviewboard.asterisk.org/r/2367/
  (issue ASTERISK-21097)
........
  r382721 | dlee | 2013-03-08 10:25:58 -0600 (Fri, 08 Mar 2013) | 7 lines
  
  Ensure dummy channels get a stasis topic.
  
  Fixes test failure introduced in r382685.
  
  (issue ASTERISK-20887)
  (issue ASTERISK-20959)
........
  r382724 | dlee | 2013-03-08 10:59:02 -0600 (Fri, 08 Mar 2013) | 6 lines
  
  Stasis documentation updates.
  
  (issue ASTERISK-20887)
  (issue ASTERISK-20959)
........
  r382746 | jrose | 2013-03-08 14:26:03 -0600 (Fri, 08 Mar 2013) | 16 lines
  
  chan_sip: Update the via header when relaying SMS MESSAGE
  
  Prior to this change, certain conditions for sending the message would
  result in an address of '(null)' being used in the via header of the
  SIP message because a NULl value of pvt->ourip was used when initially
  generating the via header. This is fixed by adding a call to build_via
  when the address is set before sending the message.
  
  (closes issue ASTERISK-21148)
  Reported by: Zhi Cheng
  Patches:
  	700-sip_msg_send_via_fix.patch uploaded by Zhi Cheng (license 6475)
  ........
  
  Merged revisions 382739 from http://svn.asterisk.org/svn/asterisk/branches/11
........
  r382764 | rmudgett | 2013-03-08 18:21:46 -0600 (Fri, 08 Mar 2013) | 18 lines
  
  confbridge: Rename items for clarity and consistency.
  
  struct conference_bridge_user -> struct confbridge_user
  struct conference_bridge -> struct confbridge_conference
  struct conference_state -> struct confbridge_state
  
  struct conference_bridge_user *conference_bridge_user -> struct confbridge_user *user
  struct conference_bridge_user *cbu -> struct confbridge_user *user
  struct conference_bridge *conference_bridge -> struct confbridge_conference *conference
  
  The names are now generally shorter, consistently used, and don't conflict
  with the struct names.
  
  This patch handles the renaming part of the issue.
  
  (issue ASTERISK-20776)
  Reported by: rmudgett
........
  r382787 | kharwell | 2013-03-11 10:22:02 -0500 (Mon, 11 Mar 2013) | 10 lines
  
  Added an option to disallow music on hold
  
  Added an option "discard_remote_hold_retrieval" (default "no") that if set does
  not trigger the music on hold event.  This essentially stops telling the peer
  to start music on hold.
  
  (issue ABE-2899)
  Reported by: Denis Alberto Martinez
  Review: https://reviewboard.asterisk.org/r/2336/
........
  r382828 | igorg | 2013-03-12 03:55:14 -0500 (Tue, 12 Mar 2013) | 7 lines
  
  Fix core dump on CLI usage
  
  Fix issue with 'unistim show info' CLI command when device connected not configured
  ........
  
  Merged revisions 382827 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 382587,382589,382600,382604,382621,382636,382648,382670-382671,382685,382705,382721,382724,382746,382764,382787,382828 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/qwell/pjsip-shared-libs/include/asterisk/stasis.h
      - copied unchanged from r382828, trunk/include/asterisk/stasis.h
    team/qwell/pjsip-shared-libs/main/stasis.c
      - copied unchanged from r382828, trunk/main/stasis.c
    team/qwell/pjsip-shared-libs/main/stasis_cache.c
      - copied unchanged from r382828, trunk/main/stasis_cache.c
    team/qwell/pjsip-shared-libs/main/stasis_message.c
      - copied unchanged from r382828, trunk/main/stasis_message.c
    team/qwell/pjsip-shared-libs/tests/test_stasis.c
      - copied unchanged from r382828, trunk/tests/test_stasis.c
Modified:
    team/qwell/pjsip-shared-libs/   (props changed)
    team/qwell/pjsip-shared-libs/CHANGES
    team/qwell/pjsip-shared-libs/apps/app_confbridge.c
    team/qwell/pjsip-shared-libs/apps/app_voicemail.c
    team/qwell/pjsip-shared-libs/apps/confbridge/conf_config_parser.c
    team/qwell/pjsip-shared-libs/apps/confbridge/conf_state.c
    team/qwell/pjsip-shared-libs/apps/confbridge/conf_state_empty.c
    team/qwell/pjsip-shared-libs/apps/confbridge/conf_state_inactive.c
    team/qwell/pjsip-shared-libs/apps/confbridge/conf_state_multi.c
    team/qwell/pjsip-shared-libs/apps/confbridge/conf_state_multi_marked.c
    team/qwell/pjsip-shared-libs/apps/confbridge/conf_state_single.c
    team/qwell/pjsip-shared-libs/apps/confbridge/conf_state_single_marked.c
    team/qwell/pjsip-shared-libs/apps/confbridge/include/conf_state.h
    team/qwell/pjsip-shared-libs/apps/confbridge/include/confbridge.h
    team/qwell/pjsip-shared-libs/channels/chan_sip.c
    team/qwell/pjsip-shared-libs/channels/chan_unistim.c
    team/qwell/pjsip-shared-libs/channels/sip/include/sip.h
    team/qwell/pjsip-shared-libs/include/asterisk/channel.h
    team/qwell/pjsip-shared-libs/include/asterisk/channel_internal.h
    team/qwell/pjsip-shared-libs/include/asterisk/rtp_engine.h
    team/qwell/pjsip-shared-libs/main/asterisk.c
    team/qwell/pjsip-shared-libs/main/asterisk.exports.in
    team/qwell/pjsip-shared-libs/main/channel.c
    team/qwell/pjsip-shared-libs/main/channel_internal_api.c
    team/qwell/pjsip-shared-libs/main/manager.c
    team/qwell/pjsip-shared-libs/main/pbx.c
    team/qwell/pjsip-shared-libs/main/rtp_engine.c
    team/qwell/pjsip-shared-libs/main/threadpool.c
    team/qwell/pjsip-shared-libs/main/xmldoc.c
    team/qwell/pjsip-shared-libs/res/res_rtp_asterisk.c
    team/qwell/pjsip-shared-libs/res/res_sorcery_config.c
    team/qwell/pjsip-shared-libs/res/res_sorcery_memory.c

Propchange: team/qwell/pjsip-shared-libs/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/qwell/pjsip-shared-libs/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Mar 12 11:26:27 2013
@@ -1,1 +1,1 @@
-/trunk:1-382581
+/trunk:1-382848

Modified: team/qwell/pjsip-shared-libs/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/qwell/pjsip-shared-libs/CHANGES?view=diff&rev=382850&r1=382849&r2=382850
==============================================================================
--- team/qwell/pjsip-shared-libs/CHANGES (original)
+++ team/qwell/pjsip-shared-libs/CHANGES Tue Mar 12 11:26:27 2013
@@ -472,6 +472,9 @@
    when using Transfer application. See refer_addheaders in sip.conf.sample.
 
  * Added support to use private party ID information with calls.
+
+ * Adds an option discard_remote_hold_retrieval that when set stops telling
+   the peer to start music on hold.
 
 
 chan_skinny

Modified: team/qwell/pjsip-shared-libs/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/pjsip-shared-libs/apps/app_confbridge.c?view=diff&rev=382850&r1=382849&r2=382850
==============================================================================
--- team/qwell/pjsip-shared-libs/apps/app_confbridge.c (original)
+++ team/qwell/pjsip-shared-libs/apps/app_confbridge.c Tue Mar 12 11:26:27 2013
@@ -305,10 +305,10 @@
 /*! \brief Container to hold all conference bridges in progress */
 static struct ao2_container *conference_bridges;
 
-static void leave_conference(struct conference_bridge_user *user);
-static int play_sound_number(struct conference_bridge *conference_bridge, int say_number);
-static int execute_menu_entry(struct conference_bridge *conference_bridge,
-	struct conference_bridge_user *conference_bridge_user,
+static void leave_conference(struct confbridge_user *user);
+static int play_sound_number(struct confbridge_conference *conference, int say_number);
+static int execute_menu_entry(struct confbridge_conference *conference,
+	struct confbridge_user *user,
 	struct ast_bridge_channel *bridge_channel,
 	struct conf_menu_entry *menu_entry,
 	struct conf_menu *menu);
@@ -316,15 +316,15 @@
 /*! \brief Hashing function used for conference bridges container */
 static int conference_bridge_hash_cb(const void *obj, const int flags)
 {
-	const struct conference_bridge *conference_bridge = obj;
-	return ast_str_case_hash(conference_bridge->name);
+	const struct confbridge_conference *conference = obj;
+	return ast_str_case_hash(conference->name);
 }
 
 /*! \brief Comparison function used for conference bridges container */
 static int conference_bridge_cmp_cb(void *obj, void *arg, int flags)
 {
-	const struct conference_bridge *conference_bridge0 = obj, *conference_bridge1 = arg;
-	return (!strcasecmp(conference_bridge0->name, conference_bridge1->name) ? CMP_MATCH | CMP_STOP : 0);
+	const struct confbridge_conference *conference0 = obj, *conference1 = arg;
+	return (!strcasecmp(conference0->name, conference1->name) ? CMP_MATCH | CMP_STOP : 0);
 }
 
 const char *conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds)
@@ -596,13 +596,13 @@
 	return tmp;
 }
 
-static void set_rec_filename(struct conference_bridge *bridge, struct ast_str **filename, int is_new)
-{
-	char *rec_file = bridge->b_profile.rec_file;
+static void set_rec_filename(struct confbridge_conference *conference, struct ast_str **filename, int is_new)
+{
+	char *rec_file = conference->b_profile.rec_file;
 	time_t now;
 	char *ext;
 
-	if (ast_str_strlen(*filename) && ast_test_flag(&bridge->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND) && !is_new) {
+	if (ast_str_strlen(*filename) && ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND) && !is_new) {
 		    return;
 	}
 
@@ -610,7 +610,7 @@
 
 	ast_str_reset(*filename);
 	if (ast_strlen_zero(rec_file)) {
-		ast_str_set(filename, 0, "confbridge-%s-%u.wav", bridge->name, (unsigned int)now);
+		ast_str_set(filename, 0, "confbridge-%s-%u.wav", conference->name, (unsigned int)now);
 	} else {
 		/* insert time before file extension */
 		ext = strrchr(rec_file, '.');
@@ -622,7 +622,7 @@
 		}
 	}
 
-	if (ast_test_flag(&bridge->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND)) {
+	if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND)) {
 		ast_str_append(filename, 0, ",a");
 	}
 }
@@ -644,69 +644,69 @@
 
 static void *record_thread(void *obj)
 {
-	struct conference_bridge *conference_bridge = obj;
+	struct confbridge_conference *conference = obj;
 	struct ast_app *mixmonapp = pbx_findapp("MixMonitor");
 	struct ast_channel *chan;
 	struct ast_str *filename = ast_str_alloca(PATH_MAX);
 	struct ast_str *orig_rec_file = NULL;
 
-	ast_mutex_lock(&conference_bridge->record_lock);
+	ast_mutex_lock(&conference->record_lock);
 	if (!mixmonapp) {
 		ast_log(LOG_WARNING, "Can not record ConfBridge, MixMonitor app is not installed\n");
-		conference_bridge->record_thread = AST_PTHREADT_NULL;
-		ast_mutex_unlock(&conference_bridge->record_lock);
-		ao2_ref(conference_bridge, -1);
+		conference->record_thread = AST_PTHREADT_NULL;
+		ast_mutex_unlock(&conference->record_lock);
+		ao2_ref(conference, -1);
 		return NULL;
 	}
 
 	/* XXX If we get an EXIT right here, START will essentially be a no-op */
-	while (conference_bridge->record_state != CONF_RECORD_EXIT) {
-		set_rec_filename(conference_bridge, &filename,
-				 is_new_rec_file(conference_bridge->b_profile.rec_file, &orig_rec_file));
-		chan = ast_channel_ref(conference_bridge->record_chan);
+	while (conference->record_state != CONF_RECORD_EXIT) {
+		set_rec_filename(conference, &filename,
+				 is_new_rec_file(conference->b_profile.rec_file, &orig_rec_file));
+		chan = ast_channel_ref(conference->record_chan);
 		ast_answer(chan);
 		pbx_exec(chan, mixmonapp, ast_str_buffer(filename));
-		ast_bridge_join(conference_bridge->bridge, chan, NULL, NULL, NULL);
+		ast_bridge_join(conference->bridge, chan, NULL, NULL, NULL);
 
 		ast_hangup(chan); /* This will eat this thread's reference to the channel as well */
 		/* STOP has been called. Wait for either a START or an EXIT */
-		ast_cond_wait(&conference_bridge->record_cond, &conference_bridge->record_lock);
+		ast_cond_wait(&conference->record_cond, &conference->record_lock);
 	}
 	ast_free(orig_rec_file);
-	ast_mutex_unlock(&conference_bridge->record_lock);
-	ao2_ref(conference_bridge, -1);
+	ast_mutex_unlock(&conference->record_lock);
+	ao2_ref(conference, -1);
 	return NULL;
 }
 
 /*! \brief Returns whether or not conference is being recorded.
- * \param conference_bridge The bridge to check for recording
+ * \param conference The bridge to check for recording
  * \retval 1, conference is recording.
  * \retval 0, conference is NOT recording.
  */
-static int conf_is_recording(struct conference_bridge *conference_bridge)
-{
-	return conference_bridge->record_state == CONF_RECORD_START;
+static int conf_is_recording(struct confbridge_conference *conference)
+{
+	return conference->record_state == CONF_RECORD_START;
 }
 
 /*! \brief Stop recording a conference bridge
  * \internal
- * \param conference_bridge The conference bridge on which to stop the recording
+ * \param conference The conference bridge on which to stop the recording
  * \retval -1 Failure
  * \retval 0 Success
  */
-static int conf_stop_record(struct conference_bridge *conference_bridge)
+static int conf_stop_record(struct confbridge_conference *conference)
 {
 	struct ast_channel *chan;
-	if (conference_bridge->record_thread == AST_PTHREADT_NULL || !conf_is_recording(conference_bridge)) {
+	if (conference->record_thread == AST_PTHREADT_NULL || !conf_is_recording(conference)) {
 		return -1;
 	}
-	conference_bridge->record_state = CONF_RECORD_STOP;
-	chan = ast_channel_ref(conference_bridge->record_chan);
-	ast_bridge_remove(conference_bridge->bridge, chan);
+	conference->record_state = CONF_RECORD_STOP;
+	chan = ast_channel_ref(conference->record_chan);
+	ast_bridge_remove(conference->bridge, chan);
 	ast_queue_frame(chan, &ast_null_frame);
 	chan = ast_channel_unref(chan);
-	ast_test_suite_event_notify("CONF_STOP_RECORD", "Message: stopped conference recording channel\r\nConference: %s", conference_bridge->b_profile.name);
-	send_stop_record_event(conference_bridge->name);
+	ast_test_suite_event_notify("CONF_STOP_RECORD", "Message: stopped conference recording channel\r\nConference: %s", conference->b_profile.name);
+	send_stop_record_event(conference->name);
 
 	return 0;
 }
@@ -715,26 +715,26 @@
  * \internal
  * \brief Stops the confbridge recording thread.
  *
- * \note Must be called with the conference_bridge locked
+ * \note Must be called with the conference locked
  */
-static int conf_stop_record_thread(struct conference_bridge *conference_bridge)
-{
-	if (conference_bridge->record_thread == AST_PTHREADT_NULL) {
+static int conf_stop_record_thread(struct confbridge_conference *conference)
+{
+	if (conference->record_thread == AST_PTHREADT_NULL) {
 		return -1;
 	}
-	conf_stop_record(conference_bridge);
-
-	ast_mutex_lock(&conference_bridge->record_lock);
-	conference_bridge->record_state = CONF_RECORD_EXIT;
-	ast_cond_signal(&conference_bridge->record_cond);
-	ast_mutex_unlock(&conference_bridge->record_lock);
-
-	pthread_join(conference_bridge->record_thread, NULL);
-	conference_bridge->record_thread = AST_PTHREADT_NULL;
+	conf_stop_record(conference);
+
+	ast_mutex_lock(&conference->record_lock);
+	conference->record_state = CONF_RECORD_EXIT;
+	ast_cond_signal(&conference->record_cond);
+	ast_mutex_unlock(&conference->record_lock);
+
+	pthread_join(conference->record_thread, NULL);
+	conference->record_thread = AST_PTHREADT_NULL;
 
 	/* this is the reference given to the channel during the channel alloc */
-	if (conference_bridge->record_chan) {
-		conference_bridge->record_chan = ast_channel_unref(conference_bridge->record_chan);
+	if (conference->record_chan) {
+		conference->record_chan = ast_channel_unref(conference->record_chan);
 	}
 
 	return 0;
@@ -742,18 +742,18 @@
 
 /*! \brief Start recording the conference
  * \internal
- * \note conference_bridge must be locked when calling this function
- * \param conference_bridge The conference bridge to start recording
+ * \note The conference must be locked when calling this function
+ * \param conference The conference bridge to start recording
  * \retval 0 success
  * \rteval non-zero failure
  */
-static int conf_start_record(struct conference_bridge *conference_bridge)
+static int conf_start_record(struct confbridge_conference *conference)
 {
 	struct ast_format_cap *cap;
 	struct ast_format tmpfmt;
 	int cause;
 
-	if (conference_bridge->record_state != CONF_RECORD_STOP) {
+	if (conference->record_state != CONF_RECORD_STOP) {
 		return -1;
 	}
 
@@ -768,45 +768,45 @@
 
 	ast_format_cap_add(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
 
-	if (!(conference_bridge->record_chan = ast_request("ConfBridgeRec", cap, NULL, conference_bridge->name, &cause))) {
+	if (!(conference->record_chan = ast_request("ConfBridgeRec", cap, NULL, conference->name, &cause))) {
 		cap = ast_format_cap_destroy(cap);
 		return -1;
 	}
 
 	cap = ast_format_cap_destroy(cap);
 
-	conference_bridge->record_state = CONF_RECORD_START;
-	ast_mutex_lock(&conference_bridge->record_lock);
-	ast_cond_signal(&conference_bridge->record_cond);
-	ast_mutex_unlock(&conference_bridge->record_lock);
-	ast_test_suite_event_notify("CONF_START_RECORD", "Message: started conference recording channel\r\nConference: %s", conference_bridge->b_profile.name);
-	send_start_record_event(conference_bridge->name);
+	conference->record_state = CONF_RECORD_START;
+	ast_mutex_lock(&conference->record_lock);
+	ast_cond_signal(&conference->record_cond);
+	ast_mutex_unlock(&conference->record_lock);
+	ast_test_suite_event_notify("CONF_START_RECORD", "Message: started conference recording channel\r\nConference: %s", conference->b_profile.name);
+	send_start_record_event(conference->name);
 
 	return 0;
 }
 
 /*! \brief Start the recording thread on a conference bridge
  * \internal
- * \param conference_bridge The conference bridge on which to start the recording thread
+ * \param conference The conference bridge on which to start the recording thread
  * \retval 0 success
  * \retval -1 failure
  */
-static int start_conf_record_thread(struct conference_bridge *conference_bridge)
-{
-	conf_start_record(conference_bridge);
+static int start_conf_record_thread(struct confbridge_conference *conference)
+{
+	conf_start_record(conference);
 
 	/*
 	 * if the thread has already been started, don't start another
 	 */
-	if (conference_bridge->record_thread != AST_PTHREADT_NULL) {
-		return 0;
-	}
-
-	ao2_ref(conference_bridge, +1); /* give the record thread a ref */
-
-	if (ast_pthread_create_background(&conference_bridge->record_thread, NULL, record_thread, conference_bridge)) {
-		ast_log(LOG_WARNING, "Failed to create recording channel for conference %s\n", conference_bridge->name);
-		ao2_ref(conference_bridge, -1); /* error so remove ref */
+	if (conference->record_thread != AST_PTHREADT_NULL) {
+		return 0;
+	}
+
+	ao2_ref(conference, +1); /* give the record thread a ref */
+
+	if (ast_pthread_create_background(&conference->record_thread, NULL, record_thread, conference)) {
+		ast_log(LOG_WARNING, "Failed to create recording channel for conference %s\n", conference->name);
+		ao2_ref(conference, -1); /* error so remove ref */
 		return -1;
 	}
 
@@ -833,52 +833,52 @@
 /*!
  * \brief Announce number of users in the conference bridge to the caller
  *
- * \param conference_bridge Conference bridge to peek at
- * \param conference_bridge_user Optional Caller
+ * \param conference Conference bridge to peek at
+ * \param user Optional Caller
  *
  * \note if caller is NULL, the announcment will be sent to all participants in the conference.
  * \return Returns 0 on success, -1 if the user hung up
  */
-static int announce_user_count(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
-{
-	const char *other_in_party = conf_get_sound(CONF_SOUND_OTHER_IN_PARTY, conference_bridge->b_profile.sounds);
-	const char *only_one = conf_get_sound(CONF_SOUND_ONLY_ONE, conference_bridge->b_profile.sounds);
-	const char *there_are = conf_get_sound(CONF_SOUND_THERE_ARE, conference_bridge->b_profile.sounds);
-
-	if (conference_bridge->activeusers <= 1) {
+static int announce_user_count(struct confbridge_conference *conference, struct confbridge_user *user)
+{
+	const char *other_in_party = conf_get_sound(CONF_SOUND_OTHER_IN_PARTY, conference->b_profile.sounds);
+	const char *only_one = conf_get_sound(CONF_SOUND_ONLY_ONE, conference->b_profile.sounds);
+	const char *there_are = conf_get_sound(CONF_SOUND_THERE_ARE, conference->b_profile.sounds);
+
+	if (conference->activeusers <= 1) {
 		/* Awww we are the only person in the conference bridge OR we only have waitmarked users */
 		return 0;
-	} else if (conference_bridge->activeusers == 2) {
-		if (conference_bridge_user) {
+	} else if (conference->activeusers == 2) {
+		if (user) {
 			/* Eep, there is one other person */
-			if (ast_stream_and_wait(conference_bridge_user->chan,
+			if (ast_stream_and_wait(user->chan,
 				only_one,
 				"")) {
 				return -1;
 			}
 		} else {
-			play_sound_file(conference_bridge, only_one);
+			play_sound_file(conference, only_one);
 		}
 	} else {
 		/* Alas multiple others in here */
-		if (conference_bridge_user) {
-			if (ast_stream_and_wait(conference_bridge_user->chan,
+		if (user) {
+			if (ast_stream_and_wait(user->chan,
 				there_are,
 				"")) {
 				return -1;
 			}
-			if (ast_say_number(conference_bridge_user->chan, conference_bridge->activeusers - 1, "", ast_channel_language(conference_bridge_user->chan), NULL)) {
+			if (ast_say_number(user->chan, conference->activeusers - 1, "", ast_channel_language(user->chan), NULL)) {
 				return -1;
 			}
-			if (ast_stream_and_wait(conference_bridge_user->chan,
+			if (ast_stream_and_wait(user->chan,
 				other_in_party,
 				"")) {
 				return -1;
 			}
 		} else if (sound_file_exists(there_are) && sound_file_exists(other_in_party)) {
-			play_sound_file(conference_bridge, there_are);
-			play_sound_number(conference_bridge, conference_bridge->activeusers - 1);
-			play_sound_file(conference_bridge, other_in_party);
+			play_sound_file(conference, there_are);
+			play_sound_number(conference, conference->activeusers - 1);
+			play_sound_file(conference, other_in_party);
 		}
 	}
 	return 0;
@@ -887,7 +887,7 @@
 /*!
  * \brief Play back an audio file to a channel
  *
- * \param cbu User to play audio prompt to
+ * \param user User to play audio prompt to
  * \param filename Prompt to play
  *
  * \return Returns 0 on success, -1 if the user hung up
@@ -895,78 +895,79 @@
  * the entire conference while the sound is played. But don't unlock the conference bridge
  * in the middle of a state transition.
  */
-static int play_prompt_to_user(struct conference_bridge_user *cbu, const char *filename)
-{
-	return ast_stream_and_wait(cbu->chan, filename, "");
-}
-
-static void handle_video_on_join(struct conference_bridge *conference_bridge, struct ast_channel *chan, int marked)
+static int play_prompt_to_user(struct confbridge_user *user, const char *filename)
+{
+	return ast_stream_and_wait(user->chan, filename, "");
+}
+
+static void handle_video_on_join(struct confbridge_conference *conference, struct ast_channel *chan, int marked)
 {
 	/* Right now, only marked users are automatically set as the single src of video.*/
 	if (!marked) {
 		return;
 	}
 
-	if (ast_test_flag(&conference_bridge->b_profile, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED)) {
+	if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED)) {
 		int set = 1;
-		struct conference_bridge_user *tmp_user = NULL;
-		ao2_lock(conference_bridge);
+		struct confbridge_user *user = NULL;
+
+		ao2_lock(conference);
 		/* see if anyone is already the video src */
-		AST_LIST_TRAVERSE(&conference_bridge->active_list, tmp_user, list) {
-			if (tmp_user->chan == chan) {
+		AST_LIST_TRAVERSE(&conference->active_list, user, list) {
+			if (user->chan == chan) {
 				continue;
 			}
-			if (ast_bridge_is_video_src(conference_bridge->bridge, tmp_user->chan)) {
+			if (ast_bridge_is_video_src(conference->bridge, user->chan)) {
 				set = 0;
 				break;
 			}
 		}
-		ao2_unlock(conference_bridge);
+		ao2_unlock(conference);
 		if (set) {
-			ast_bridge_set_single_src_video_mode(conference_bridge->bridge, chan);
-		}
-	} else if (ast_test_flag(&conference_bridge->b_profile, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED)) {
+			ast_bridge_set_single_src_video_mode(conference->bridge, chan);
+		}
+	} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED)) {
 		/* we joined and are video capable, we override anyone else that may have already been the video feed */
-		ast_bridge_set_single_src_video_mode(conference_bridge->bridge, chan);
-	}
-}
-
-static void handle_video_on_exit(struct conference_bridge *conference_bridge, struct ast_channel *chan)
-{
-	struct conference_bridge_user *tmp_user = NULL;
+		ast_bridge_set_single_src_video_mode(conference->bridge, chan);
+	}
+}
+
+static void handle_video_on_exit(struct confbridge_conference *conference, struct ast_channel *chan)
+{
+	struct confbridge_user *user = NULL;
 
 	/* if this isn't a video source, nothing to update */
-	if (!ast_bridge_is_video_src(conference_bridge->bridge, chan)) {
+	if (!ast_bridge_is_video_src(conference->bridge, chan)) {
 		return;
 	}
 
-	ast_bridge_remove_video_src(conference_bridge->bridge, chan);
+	ast_bridge_remove_video_src(conference->bridge, chan);
 
 	/* If in follow talker mode, make sure to restore this mode on the
 	 * bridge when a source is removed.  It is possible this channel was
 	 * only set temporarily as a video source by an AMI or DTMF action. */
-	if (ast_test_flag(&conference_bridge->b_profile, BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER)) {
-		ast_bridge_set_talker_src_video_mode(conference_bridge->bridge);
+	if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER)) {
+		ast_bridge_set_talker_src_video_mode(conference->bridge);
 	}
 
 	/* if the video_mode isn't set to automatically pick the video source, do nothing on exit. */
-	if (!ast_test_flag(&conference_bridge->b_profile, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED) &&
-		!ast_test_flag(&conference_bridge->b_profile, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED)) {
+	if (!ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED) &&
+		!ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED)) {
 		return;
 	}
 
 	/* Make the next available marked user the video src.  */
-	ao2_lock(conference_bridge);
-	AST_LIST_TRAVERSE(&conference_bridge->active_list, tmp_user, list) {
-		if (tmp_user->chan == chan) {
+	ao2_lock(conference);
+	AST_LIST_TRAVERSE(&conference->active_list, user, list) {
+		if (user->chan == chan) {
 			continue;
 		}
-		if (ast_test_flag(&tmp_user->u_profile, USER_OPT_MARKEDUSER)) {
-			ast_bridge_set_single_src_video_mode(conference_bridge->bridge, tmp_user->chan);
+		if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
+			ast_bridge_set_single_src_video_mode(conference->bridge, user->chan);
 			break;
 		}
 	}
-	ao2_unlock(conference_bridge);
+	ao2_unlock(conference);
 }
 
 /*!
@@ -978,75 +979,75 @@
  */
 static void destroy_conference_bridge(void *obj)
 {
-	struct conference_bridge *conference_bridge = obj;
-
-	ast_debug(1, "Destroying conference bridge '%s'\n", conference_bridge->name);
-
-	if (conference_bridge->playback_chan) {
-		struct ast_channel *underlying_channel = ast_channel_tech(conference_bridge->playback_chan)->bridged_channel(conference_bridge->playback_chan, NULL);
+	struct confbridge_conference *conference = obj;
+
+	ast_debug(1, "Destroying conference bridge '%s'\n", conference->name);
+
+	if (conference->playback_chan) {
+		struct ast_channel *underlying_channel = ast_channel_tech(conference->playback_chan)->bridged_channel(conference->playback_chan, NULL);
 		if (underlying_channel) {
 			ast_hangup(underlying_channel);
 		}
-		ast_hangup(conference_bridge->playback_chan);
-		conference_bridge->playback_chan = NULL;
+		ast_hangup(conference->playback_chan);
+		conference->playback_chan = NULL;
 	}
 
 	/* Destroying a conference bridge is simple, all we have to do is destroy the bridging object */
-	if (conference_bridge->bridge) {
-		ast_bridge_destroy(conference_bridge->bridge);
-		conference_bridge->bridge = NULL;
-	}
-
-	conf_bridge_profile_destroy(&conference_bridge->b_profile);
-	ast_cond_destroy(&conference_bridge->record_cond);
-	ast_mutex_destroy(&conference_bridge->record_lock);
-	ast_mutex_destroy(&conference_bridge->playback_lock);
+	if (conference->bridge) {
+		ast_bridge_destroy(conference->bridge);
+		conference->bridge = NULL;
+	}
+
+	conf_bridge_profile_destroy(&conference->b_profile);
+	ast_cond_destroy(&conference->record_cond);
+	ast_mutex_destroy(&conference->record_lock);
+	ast_mutex_destroy(&conference->playback_lock);
 }
 
 /*! \brief Call the proper join event handler for the user for the conference bridge's current state
  * \internal
- * \param cbu The conference bridge user that is joining
+ * \param user The conference bridge user that is joining
  * \retval 0 success
  * \retval -1 failure
  */
-static int handle_conf_user_join(struct conference_bridge_user *cbu)
+static int handle_conf_user_join(struct confbridge_user *user)
 {
 	conference_event_fn handler;
-	if (ast_test_flag(&cbu->u_profile, USER_OPT_MARKEDUSER)) {
-		handler = cbu->conference_bridge->state->join_marked;
-	} else if (ast_test_flag(&cbu->u_profile, USER_OPT_WAITMARKED)) {
-		handler = cbu->conference_bridge->state->join_waitmarked;
+	if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
+		handler = user->conference->state->join_marked;
+	} else if (ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)) {
+		handler = user->conference->state->join_waitmarked;
 	} else {
-		handler = cbu->conference_bridge->state->join_unmarked;
+		handler = user->conference->state->join_unmarked;
 	}
 
 	ast_assert(handler != NULL);
 
 	if (!handler) {
-		conf_invalid_event_fn(cbu);
+		conf_invalid_event_fn(user);
 		return -1;
 	}
 
-	handler(cbu);
+	handler(user);
 
 	return 0;
 }
 
 /*! \brief Call the proper leave event handler for the user for the conference bridge's current state
  * \internal
- * \param cbu The conference bridge user that is leaving
+ * \param user The conference bridge user that is leaving
  * \retval 0 success
  * \retval -1 failure
  */
-static int handle_conf_user_leave(struct conference_bridge_user *cbu)
+static int handle_conf_user_leave(struct confbridge_user *user)
 {
 	conference_event_fn handler;
-	if (ast_test_flag(&cbu->u_profile, USER_OPT_MARKEDUSER)) {
-		handler = cbu->conference_bridge->state->leave_marked;
-	} else if (ast_test_flag(&cbu->u_profile, USER_OPT_WAITMARKED)) {
-		handler = cbu->conference_bridge->state->leave_waitmarked;
+	if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
+		handler = user->conference->state->leave_marked;
+	} else if (ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)) {
+		handler = user->conference->state->leave_waitmarked;
 	} else {
-		handler = cbu->conference_bridge->state->leave_unmarked;
+		handler = user->conference->state->leave_unmarked;
 	}
 
 	ast_assert(handler != NULL);
@@ -1055,16 +1056,16 @@
 		/* This should never happen. If it does, though, it is bad. The user will not have been removed
 		 * from the appropriate list, so counts will be off and stuff. The conference won't be torn down, etc.
 		 * Shouldn't happen, though. */
-		conf_invalid_event_fn(cbu);
+		conf_invalid_event_fn(user);
 		return -1;
 	}
 
-	handler(cbu);
+	handler(user);
 
 	return 0;
 }
 
-void conf_moh_stop(struct conference_bridge_user *user)
+void conf_moh_stop(struct confbridge_user *user)
 {
 	user->playing_moh = 0;
 	if (!user->suspended_moh) {
@@ -1075,23 +1076,23 @@
 		 * call to ast_bridge_join() in confbridge_exec() from
 		 * interfering with the bridge and MOH operations here.
 		 */
-		ast_bridge_lock(user->conference_bridge->bridge);
+		ast_bridge_lock(user->conference->bridge);
 
 		/*
 		 * Temporarily suspend the user from the bridge so we have
 		 * control to stop MOH if needed.
 		 */
-		in_bridge = !ast_bridge_suspend(user->conference_bridge->bridge, user->chan);
+		in_bridge = !ast_bridge_suspend(user->conference->bridge, user->chan);
 		ast_moh_stop(user->chan);
 		if (in_bridge) {
-			ast_bridge_unsuspend(user->conference_bridge->bridge, user->chan);
-		}
-
-		ast_bridge_unlock(user->conference_bridge->bridge);
-	}
-}
-
-void conf_moh_start(struct conference_bridge_user *user)
+			ast_bridge_unsuspend(user->conference->bridge, user->chan);
+		}
+
+		ast_bridge_unlock(user->conference->bridge);
+	}
+}
+
+void conf_moh_start(struct confbridge_user *user)
 {
 	user->playing_moh = 1;
 	if (!user->suspended_moh) {
@@ -1102,19 +1103,19 @@
 		 * call to ast_bridge_join() in confbridge_exec() from
 		 * interfering with the bridge and MOH operations here.
 		 */
-		ast_bridge_lock(user->conference_bridge->bridge);
+		ast_bridge_lock(user->conference->bridge);
 
 		/*
 		 * Temporarily suspend the user from the bridge so we have
 		 * control to start MOH if needed.
 		 */
-		in_bridge = !ast_bridge_suspend(user->conference_bridge->bridge, user->chan);
+		in_bridge = !ast_bridge_suspend(user->conference->bridge, user->chan);
 		ast_moh_start(user->chan, user->u_profile.moh_class, NULL);
 		if (in_bridge) {
-			ast_bridge_unsuspend(user->conference_bridge->bridge, user->chan);
-		}
-
-		ast_bridge_unlock(user->conference_bridge->bridge);
+			ast_bridge_unsuspend(user->conference->bridge, user->chan);
+		}
+
+		ast_bridge_unlock(user->conference->bridge);
 	}
 }
 
@@ -1126,13 +1127,13 @@
  *
  * \return Nothing
  */
-static void conf_moh_unsuspend(struct conference_bridge_user *user)
-{
-	ao2_lock(user->conference_bridge);
+static void conf_moh_unsuspend(struct confbridge_user *user)
+{
+	ao2_lock(user->conference);
 	if (--user->suspended_moh == 0 && user->playing_moh) {
 		ast_moh_start(user->chan, user->u_profile.moh_class, NULL);
 	}
-	ao2_unlock(user->conference_bridge);
+	ao2_unlock(user->conference);
 }
 
 /*!
@@ -1143,40 +1144,40 @@
  *
  * \return Nothing
  */
-static void conf_moh_suspend(struct conference_bridge_user *user)
-{

[... 4668 lines stripped ...]



More information about the asterisk-commits mailing list