[asterisk-commits] file: branch file/pimp_sip_location r382784 - in /team/file/pimp_sip_location...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 11 06:55:12 CDT 2013


Author: file
Date: Mon Mar 11 06:55:07 2013
New Revision: 382784

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382784
Log:
Multiple revisions 382606,382623,382638,382650,382673,382687,382711,382728,382752,382767

........
  r382606 | root | 2013-03-07 13:17:55 -0400 (Thu, 07 Mar 2013) | 19 lines
  
  Multiple revisions 382600,382604
  
  ........
    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.
  ........
  
  Merged revisions 382600,382604 from file:///srv/subversion/repos/asterisk/trunk
........
  r382623 | root | 2013-03-07 15:17:57 -0400 (Thu, 07 Mar 2013) | 15 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
  ........
  
  Merged revisions 382621 from file:///srv/subversion/repos/asterisk/trunk
........
  r382638 | root | 2013-03-07 17:18:00 -0400 (Thu, 07 Mar 2013) | 5 lines
  
  Load sorcery modules earlier, so they can actually be used.
  ........
  
  Merged revisions 382636 from file:///srv/subversion/repos/asterisk/trunk
........
  r382650 | root | 2013-03-07 18:17:53 -0400 (Thu, 07 Mar 2013) | 5 lines
  
  Changing log level of "Not changing threadpool size" from notice to debug.
  ........
  
  Merged revisions 382648 from file:///srv/subversion/repos/asterisk/trunk
........
  r382673 | root | 2013-03-08 00:17:55 -0400 (Fri, 08 Mar 2013) | 36 lines
  
  Multiple revisions 382670-382671
  
  ........
    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.
  ........
  
  Merged revisions 382670-382671 from file:///srv/subversion/repos/asterisk/trunk
........
  r382687 | root | 2013-03-08 11:18:30 -0400 (Fri, 08 Mar 2013) | 26 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.
   - Consistent memory management; all message bus objects are AO2
     managed objects, using ao2_ref() and ao2_cleanup() to manage the
     reference counting.
  
  In addition to basic publish/subscribe, the patch also provides
  mechanisms for message forwarding, and for message caching.
  
  (closes issue ASTERISK-20959)
  Review: https://reviewboard.asterisk.org/r/2339/
  ........
  
  Merged revisions 382685 from file:///srv/subversion/repos/asterisk/trunk
........
  r382711 | root | 2013-03-08 12:17:55 -0400 (Fri, 08 Mar 2013) | 14 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)
  ........
  
  Merged revisions 382705 from file:///srv/subversion/repos/asterisk/trunk
........
  r382728 | root | 2013-03-08 13:17:56 -0400 (Fri, 08 Mar 2013) | 22 lines
  
  Multiple revisions 382721,382724
  
  ........
    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)
  ........
  
  Merged revisions 382721,382724 from file:///srv/subversion/repos/asterisk/trunk
........
  r382752 | root | 2013-03-08 17:17:56 -0400 (Fri, 08 Mar 2013) | 19 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
  ........
  
  Merged revisions 382746 from file:///srv/subversion/repos/asterisk/trunk
........
  r382767 | root | 2013-03-08 21:17:32 -0400 (Fri, 08 Mar 2013) | 21 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
  ........
  
  Merged revisions 382764 from file:///srv/subversion/repos/asterisk/trunk
........

Merged revisions 382606,382623,382638,382650,382673,382687,382711,382728,382752,382767 from http://svn.asterisk.org/svn/asterisk/team/group/pimp_my_sip

Added:
    team/file/pimp_sip_location/include/asterisk/stasis.h
      - copied unchanged from r382767, team/group/pimp_my_sip/include/asterisk/stasis.h
    team/file/pimp_sip_location/main/stasis.c
      - copied unchanged from r382767, team/group/pimp_my_sip/main/stasis.c
    team/file/pimp_sip_location/main/stasis_cache.c
      - copied unchanged from r382767, team/group/pimp_my_sip/main/stasis_cache.c
    team/file/pimp_sip_location/main/stasis_message.c
      - copied unchanged from r382767, team/group/pimp_my_sip/main/stasis_message.c
    team/file/pimp_sip_location/tests/test_stasis.c
      - copied unchanged from r382767, team/group/pimp_my_sip/tests/test_stasis.c
Modified:
    team/file/pimp_sip_location/   (props changed)
    team/file/pimp_sip_location/apps/app_confbridge.c
    team/file/pimp_sip_location/apps/app_voicemail.c
    team/file/pimp_sip_location/apps/confbridge/conf_config_parser.c
    team/file/pimp_sip_location/apps/confbridge/conf_state.c
    team/file/pimp_sip_location/apps/confbridge/conf_state_empty.c
    team/file/pimp_sip_location/apps/confbridge/conf_state_inactive.c
    team/file/pimp_sip_location/apps/confbridge/conf_state_multi.c
    team/file/pimp_sip_location/apps/confbridge/conf_state_multi_marked.c
    team/file/pimp_sip_location/apps/confbridge/conf_state_single.c
    team/file/pimp_sip_location/apps/confbridge/conf_state_single_marked.c
    team/file/pimp_sip_location/apps/confbridge/include/conf_state.h
    team/file/pimp_sip_location/apps/confbridge/include/confbridge.h
    team/file/pimp_sip_location/channels/chan_sip.c
    team/file/pimp_sip_location/include/asterisk/channel.h
    team/file/pimp_sip_location/include/asterisk/channel_internal.h
    team/file/pimp_sip_location/main/asterisk.c
    team/file/pimp_sip_location/main/asterisk.exports.in
    team/file/pimp_sip_location/main/channel.c
    team/file/pimp_sip_location/main/channel_internal_api.c
    team/file/pimp_sip_location/main/manager.c
    team/file/pimp_sip_location/main/pbx.c
    team/file/pimp_sip_location/main/threadpool.c
    team/file/pimp_sip_location/main/xmldoc.c
    team/file/pimp_sip_location/res/res_sorcery_config.c
    team/file/pimp_sip_location/res/res_sorcery_memory.c

Propchange: team/file/pimp_sip_location/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/file/pimp_sip_location/
------------------------------------------------------------------------------
--- pimp-integrated (original)
+++ pimp-integrated Mon Mar 11 06:55:07 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-382594
+/team/group/pimp_my_sip:1-382783

Modified: team/file/pimp_sip_location/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/apps/app_confbridge.c?view=diff&rev=382784&r1=382783&r2=382784
==============================================================================
--- team/file/pimp_sip_location/apps/app_confbridge.c (original)
+++ team/file/pimp_sip_location/apps/app_confbridge.c Mon Mar 11 06:55:07 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)
-{
-	ao2_lock(user->conference_bridge);
+static void conf_moh_suspend(struct confbridge_user *user)
+{
+	ao2_lock(user->conference);
 	if (user->suspended_moh++ == 0 && user->playing_moh) {
 		ast_moh_stop(user->chan);
 	}
-	ao2_unlock(user->conference_bridge);
-}
-
-int conf_handle_first_marked_common(struct conference_bridge_user *cbu)
-{
-	if (!ast_test_flag(&cbu->u_profile, USER_OPT_QUIET) && play_prompt_to_user(cbu, conf_get_sound(CONF_SOUND_PLACE_IN_CONF, cbu->b_profile.sounds))) {
+	ao2_unlock(user->conference);
+}
+
+int conf_handle_first_marked_common(struct confbridge_user *user)
+{
+	if (!ast_test_flag(&user->u_profile, USER_OPT_QUIET) && play_prompt_to_user(user, conf_get_sound(CONF_SOUND_PLACE_IN_CONF, user->b_profile.sounds))) {
 		return -1;
 	}
 	return 0;
 }
 
-int conf_handle_inactive_waitmarked(struct conference_bridge_user *cbu)
+int conf_handle_inactive_waitmarked(struct confbridge_user *user)
 {
 	/* If we have not been quieted play back that they are waiting for the leader */
-	if (!ast_test_flag(&cbu->u_profile, USER_OPT_QUIET) && play_prompt_to_user(cbu,
-			conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, cbu->b_profile.sounds))) {
+	if (!ast_test_flag(&user->u_profile, USER_OPT_QUIET) && play_prompt_to_user(user,
+			conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, user->b_profile.sounds))) {
 		/* user hungup while the sound was playing */
 		return -1;
 	}
 	return 0;
 }
 
-int conf_handle_only_unmarked(struct conference_bridge_user *cbu)
+int conf_handle_only_unmarked(struct confbridge_user *user)
 {
 	/* If audio prompts have not been quieted or this prompt quieted play it on out */

[... 4231 lines stripped ...]



More information about the asterisk-commits mailing list