[asterisk-commits] dlee: branch dlee/amqp-cdr-cel r431095 - in /team/dlee/amqp-cdr-cel: ./ addon...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 26 09:13:13 CST 2015


Author: dlee
Date: Mon Jan 26 09:13:08 2015
New Revision: 431095

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431095
Log:
Merged revisions 430902-431092 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    team/dlee/amqp-cdr-cel/   (props changed)
    team/dlee/amqp-cdr-cel/addons/ooh323c/src/ooh245.c
    team/dlee/amqp-cdr-cel/apps/app_alarmreceiver.c
    team/dlee/amqp-cdr-cel/apps/app_confbridge.c
    team/dlee/amqp-cdr-cel/apps/app_minivm.c
    team/dlee/amqp-cdr-cel/apps/app_voicemail.c
    team/dlee/amqp-cdr-cel/apps/confbridge/conf_chan_record.c
    team/dlee/amqp-cdr-cel/channels/chan_iax2.c
    team/dlee/amqp-cdr-cel/channels/chan_misdn.c
    team/dlee/amqp-cdr-cel/channels/chan_sip.c
    team/dlee/amqp-cdr-cel/channels/chan_unistim.c
    team/dlee/amqp-cdr-cel/channels/sip/include/route.h
    team/dlee/amqp-cdr-cel/configure
    team/dlee/amqp-cdr-cel/configure.ac
    team/dlee/amqp-cdr-cel/contrib/utils/eagi_proxy.c
    team/dlee/amqp-cdr-cel/funcs/func_groupcount.c
    team/dlee/amqp-cdr-cel/funcs/func_hangupcause.c
    team/dlee/amqp-cdr-cel/funcs/func_presencestate.c
    team/dlee/amqp-cdr-cel/include/asterisk/autoconfig.h.in
    team/dlee/amqp-cdr-cel/include/asterisk/bridge.h
    team/dlee/amqp-cdr-cel/include/asterisk/bridge_channel_internal.h
    team/dlee/amqp-cdr-cel/include/asterisk/bridge_internal.h
    team/dlee/amqp-cdr-cel/include/asterisk/channel.h
    team/dlee/amqp-cdr-cel/include/asterisk/sem.h
    team/dlee/amqp-cdr-cel/include/asterisk/stasis_app.h
    team/dlee/amqp-cdr-cel/main/app.c
    team/dlee/amqp-cdr-cel/main/asterisk.c
    team/dlee/amqp-cdr-cel/main/bridge.c
    team/dlee/amqp-cdr-cel/main/bridge_channel.c
    team/dlee/amqp-cdr-cel/main/config.c
    team/dlee/amqp-cdr-cel/main/manager_bridges.c
    team/dlee/amqp-cdr-cel/main/rtp_engine.c
    team/dlee/amqp-cdr-cel/main/sem.c
    team/dlee/amqp-cdr-cel/res/parking/parking_applications.c
    team/dlee/amqp-cdr-cel/res/res_ari_channels.c
    team/dlee/amqp-cdr-cel/res/res_ari_endpoints.c
    team/dlee/amqp-cdr-cel/res/res_ari_events.c
    team/dlee/amqp-cdr-cel/res/res_fax.c
    team/dlee/amqp-cdr-cel/res/res_pjsip/pjsip_global_headers.c
    team/dlee/amqp-cdr-cel/res/res_pjsip_mwi.c
    team/dlee/amqp-cdr-cel/res/res_pjsip_outbound_registration.c
    team/dlee/amqp-cdr-cel/res/res_pjsip_pubsub.c
    team/dlee/amqp-cdr-cel/res/res_stasis.c
    team/dlee/amqp-cdr-cel/res/res_timing_kqueue.c
    team/dlee/amqp-cdr-cel/res/stasis/app.c
    team/dlee/amqp-cdr-cel/res/stasis/stasis_bridge.c
    team/dlee/amqp-cdr-cel/rest-api-templates/param_parsing.mustache

Propchange: team/dlee/amqp-cdr-cel/
------------------------------------------------------------------------------
--- branch-11-merged (original)
+++ branch-11-merged Mon Jan 26 09:13:08 2015
@@ -1,1 +1,1 @@
-/branches/11:1-429517,429539,429632,429783,429804,429825,429867,429893,429982,430009,430126,430415,430487,430506,430564,430589,430795,430798
+/branches/11:1-429517,429539,429632,429783,429804,429825,429867,429893,429982,430009,430126,430415,430487,430506,430564,430589,430795,430798,430920,430993,430996-430997,431049

Propchange: team/dlee/amqp-cdr-cel/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan 26 09:13:08 2015
@@ -1,1 +1,1 @@
-/branches/13:1-430898
+/branches/13:1-431094

Modified: team/dlee/amqp-cdr-cel/addons/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/addons/ooh323c/src/ooh245.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/addons/ooh323c/src/ooh245.c (original)
+++ team/dlee/amqp-cdr-cel/addons/ooh323c/src/ooh245.c Mon Jan 26 09:13:08 2015
@@ -1909,7 +1909,7 @@
                                      T_H245TransportAddress_unicastAddress)
    	{
       	 OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media control "
-                  "channel addres type is not unicast (%s, %s)\n", 
+                  "channel address type is not unicast (%s, %s)\n", 
                    call->callType, call->callToken);
       	 return OO_FAILED;
    	}

Modified: team/dlee/amqp-cdr-cel/apps/app_alarmreceiver.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/apps/app_alarmreceiver.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/apps/app_alarmreceiver.c (original)
+++ team/dlee/amqp-cdr-cel/apps/app_alarmreceiver.c Mon Jan 26 09:13:08 2015
@@ -484,7 +484,7 @@
 }
 
 /*!
- * \brief Send a single tone burst for a specifed duration and frequency.
+ * \brief Send a single tone burst for a specified duration and frequency.
  * \since 11.0
  *
  * \param chan Asterisk Channel

Modified: team/dlee/amqp-cdr-cel/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/apps/app_confbridge.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/apps/app_confbridge.c (original)
+++ team/dlee/amqp-cdr-cel/apps/app_confbridge.c Mon Jan 26 09:13:08 2015
@@ -557,29 +557,31 @@
 static void set_rec_filename(struct confbridge_conference *conference, struct ast_str **filename, int is_new)
 {
 	char *rec_file = conference->b_profile.rec_file;
+	char *ext;
 	time_t now;
-	char *ext;
-
-	if (ast_str_strlen(*filename) && ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND) && !is_new) {
-		    return;
+
+	if (ast_str_strlen(*filename)
+		&& ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND)
+		&& !is_new) {
+		return;
 	}
 
 	time(&now);
 
 	ast_str_reset(*filename);
 	if (ast_strlen_zero(rec_file)) {
-		ast_str_set(filename, 0, "confbridge-%s-%u.wav", conference->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, '.');
 		if (ext) {
 			ast_str_set_substr(filename, 0, rec_file, ext - rec_file);
-			ast_str_append(filename, 0, "-%u%s", (unsigned int)now, ext);
+			ast_str_append(filename, 0, "-%u%s", (unsigned int) now, ext);
 		} else {
-			ast_str_set(filename, 0, "%s-%u", rec_file, (unsigned int)now);
-		}
-	}
-
+			ast_str_set(filename, 0, "%s-%u", rec_file, (unsigned int) now);
+		}
+	}
 	if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND)) {
 		ast_str_append(filename, 0, ",a");
 	}

Modified: team/dlee/amqp-cdr-cel/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/apps/app_minivm.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/apps/app_minivm.c (original)
+++ team/dlee/amqp-cdr-cel/apps/app_minivm.c Mon Jan 26 09:13:08 2015
@@ -1366,7 +1366,7 @@
 	prep_email_sub_vars(ast, vmu, cidnum, cidname, dur, date, counter);
 
 	/* Find email address to use */
-	/* If there's a server e-mail adress in the account, user that, othterwise template */
+	/* If there's a server e-mail address in the account, use that, othterwise template */
 	fromemail = ast_strlen_zero(vmu->serveremail) ?  template->serveremail : vmu->serveremail;
 
 	/* Find name to user for server e-mail */

Modified: team/dlee/amqp-cdr-cel/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/apps/app_voicemail.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/apps/app_voicemail.c (original)
+++ team/dlee/amqp-cdr-cel/apps/app_voicemail.c Mon Jan 26 09:13:08 2015
@@ -1098,6 +1098,8 @@
 static int write_password_to_file(const char *secretfn, const char *password);
 static const char *substitute_escapes(const char *value);
 static int message_range_and_existence_check(struct vm_state *vms, const char *msg_ids [], size_t num_msgs, int *msg_nums, struct ast_vm_user *vmu);
+static void notify_new_state(struct ast_vm_user *vmu);
+
 /*!
  * Place a message in the indicated folder
  *
@@ -3741,7 +3743,7 @@
 
 /*!
  * \brief Retrieves a file from an ODBC data store.
- * \param dir the path to the file to be retreived.
+ * \param dir the path to the file to be retrieved.
  * \param msgnum the message number, such as within a mailbox folder.
  * 
  * This method is used by the RETRIEVE macro when mailboxes are stored in an ODBC back end.
@@ -6373,6 +6375,7 @@
 		}
 
 		STORE(dir, recipient->mailbox, recipient->context, msgnum, NULL, recipient, fmt, 0, vms, "", msg_id);
+		notify_new_state(recipient);
 	}
 
 	free_user(recipient);
@@ -8011,7 +8014,7 @@
  *   - attempt to determine the context and and mailbox, and then invoke leave_message() function to record and store the message.
  *
  * When in the forward message mode (is_new_message == 0):
- *   - retreives the current message to be forwarded
+ *   - retrieves the current message to be forwarded
  *   - copies the original message to a temporary file, so updates to the envelope can be done.
  *   - determines the target mailbox and folders
  *   - copies the message into the target mailbox, using copy_message() or by generating the message into an email attachment if using imap folders.

Modified: team/dlee/amqp-cdr-cel/apps/confbridge/conf_chan_record.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/apps/confbridge/conf_chan_record.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/apps/confbridge/conf_chan_record.c (original)
+++ team/dlee/amqp-cdr-cel/apps/confbridge/conf_chan_record.c Mon Jan 26 09:13:08 2015
@@ -38,6 +38,8 @@
 
 /* ------------------------------------------------------------------- */
 
+static unsigned int name_sequence = 0;
+
 static int rec_call(struct ast_channel *chan, const char *addr, int timeout)
 {
 	/* Make sure anyone calling ast_call() for this channel driver is going to fail. */
@@ -59,6 +61,7 @@
 	struct ast_channel *chan;
 	const char *conf_name = data;
 	RAII_VAR(struct ast_format_cap *, capabilities, NULL, ao2_cleanup);
+	int generated_seqno = ast_atomic_fetchadd_int((int *) &name_sequence, +1);
 
 	capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
 	if (!capabilities) {
@@ -67,8 +70,8 @@
 	ast_format_cap_append_by_type(capabilities, AST_MEDIA_TYPE_UNKNOWN);
 
 	chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
-		"CBRec/conf-%s-uid-%d",
-		conf_name, (int) ast_random());
+		"CBRec/conf-%s-uid-%08x",
+		conf_name, (unsigned) generated_seqno);
 	if (!chan) {
 		return NULL;
 	}

Modified: team/dlee/amqp-cdr-cel/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/channels/chan_iax2.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/channels/chan_iax2.c (original)
+++ team/dlee/amqp-cdr-cel/channels/chan_iax2.c Mon Jan 26 09:13:08 2015
@@ -4364,7 +4364,7 @@
 		if (var && !ast_sockaddr_isnull(addr)) {
 			for (tmp = var; tmp; tmp = tmp->next) {
 				if (!strcasecmp(tmp->name, "host")) {
-					struct ast_sockaddr *hostaddr;
+					struct ast_sockaddr *hostaddr = NULL;
 
 					if (!ast_sockaddr_resolve(&hostaddr, tmp->value, PARSE_PORT_FORBID, AST_AF_UNSPEC)
 						|| ast_sockaddr_cmp_addr(hostaddr, addr)) {
@@ -4372,6 +4372,7 @@
 						ast_variables_destroy(var);
 						var = NULL;
 					}
+					ast_free(hostaddr);
 					break;
 				}
 			}
@@ -4486,7 +4487,7 @@
 		if (var) {
 			for (tmp = var; tmp; tmp = tmp->next) {
 				if (!strcasecmp(tmp->name, "host")) {
-					struct ast_sockaddr *hostaddr;
+					struct ast_sockaddr *hostaddr = NULL;
 
 					if (!ast_sockaddr_resolve(&hostaddr, tmp->value, PARSE_PORT_FORBID, AST_AF_UNSPEC)
 						|| ast_sockaddr_cmp_addr(hostaddr, addr)) {
@@ -4494,6 +4495,7 @@
 						ast_variables_destroy(var);
 						var = NULL;
 					}
+					ast_free(hostaddr);
 					break;
 				}
 			}

Modified: team/dlee/amqp-cdr-cel/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/channels/chan_misdn.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/channels/chan_misdn.c (original)
+++ team/dlee/amqp-cdr-cel/channels/chan_misdn.c Mon Jan 26 09:13:08 2015
@@ -9450,11 +9450,11 @@
 		break;
 #endif	/* We don't handle this yet */
 	case Fac_SubaddressTransfer:
-		/* We do not have anything to do for this message since we do not handle subaddreses. */
+		/* We do not have anything to do for this message since we do not handle subaddresses. */
 		break;
 	case Fac_RequestSubaddress:
 		/*
-		 * We do not have anything to do for this message since we do not handle subaddreses.
+		 * We do not have anything to do for this message since we do not handle subaddresses.
 		 * However, we do care about some other ie's that should be present.
 		 */
 		if (bc->redirecting.to_changed) {

Modified: team/dlee/amqp-cdr-cel/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/channels/chan_sip.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/channels/chan_sip.c (original)
+++ team/dlee/amqp-cdr-cel/channels/chan_sip.c Mon Jan 26 09:13:08 2015
@@ -8808,7 +8808,7 @@
  * This function will update the destination of the response according to the
  * Via header in the request and RFC 3261 section 18.2.2. We do not have a
  * transport layer so we ignore certain values like the 'received' param (we
- * set the destination address to the addres the request came from in the
+ * set the destination address to the address the request came from in the
  * respprep() function).
  *
  * \retval -1 error
@@ -30578,7 +30578,7 @@
 				if (peer->callingpres == -1) {
 					peer->callingpres = atoi(v->value);
 				}
-			} else if (!strcasecmp(v->name, "username") || !strcmp(v->name, "defaultuser")) {	/* "username" is deprecated */
+			} else if (!strcasecmp(v->name, "username") || !strcasecmp(v->name, "defaultuser")) {	/* "username" is deprecated */
 				ast_string_field_set(peer, username, v->value);
 				if (!strcasecmp(v->name, "username")) {
 					if (deprecation_warning) {

Modified: team/dlee/amqp-cdr-cel/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/channels/chan_unistim.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/channels/chan_unistim.c (original)
+++ team/dlee/amqp-cdr-cel/channels/chan_unistim.c Mon Jan 26 09:13:08 2015
@@ -468,7 +468,7 @@
 	int state;				      /*!< state of the phone (see phone_state) */
 	int size_buff_entry;	    /*!< size of the buffer used to enter datas */
 	char buff_entry[16];	    /*!< Buffer for temporary datas */
-	char macaddr[18];		       /*!< mac adress of the phone (not always available) */
+	char macaddr[18];		       /*!< mac address of the phone (not always available) */
 	char firmware[8];		       /*!< firmware of the phone (not always available) */
 	struct wsabuf wsabufsend[MAX_BUF_NUMBER];      /*!< Size of each paquet stored in the buffer array & pointer to this buffer */
 	unsigned char buf[MAX_BUF_NUMBER][MAX_BUF_SIZE];	/*!< Buffer array used to keep the lastest non-acked paquets */

Modified: team/dlee/amqp-cdr-cel/channels/sip/include/route.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/channels/sip/include/route.h?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/channels/sip/include/route.h (original)
+++ team/dlee/amqp-cdr-cel/channels/sip/include/route.h Mon Jan 26 09:13:08 2015
@@ -98,7 +98,7 @@
  * \retval NULL on failure
  */
 struct ast_str *sip_route_list(const struct sip_route *route, int formatcli, int skip)
-		__attribute_malloc__ __attribute_warn_unused_result__;
+	__attribute__((__malloc__)) __attribute__((__warn_unused_result__));
 
 /*!
  * \brief Check if the route is strict

Modified: team/dlee/amqp-cdr-cel/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/configure.ac?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/configure.ac (original)
+++ team/dlee/amqp-cdr-cel/configure.ac Mon Jan 26 09:13:08 2015
@@ -661,7 +661,25 @@
 AC_FUNC_STRTOD
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
+AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
+
+AC_MSG_CHECKING(for htonll)
+AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM([#include <arpa/inet.h>],
+		[return htonll(0);])],
+	AC_MSG_RESULT(yes)
+	AC_DEFINE(HAVE_HTONLL, 1, [Define to 1 if arpa/inet.h includes a htonll definition.]),
+	AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(for ntohll)
+AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM([#include <arpa/inet.h>],
+		[return ntohll(0);])],
+	AC_MSG_RESULT(yes)
+	AC_DEFINE(HAVE_NTOHLL, 1, [Define to 1 if arpa/inet.h includes a ntohll definition.]),
+	AC_MSG_RESULT(no)
+)
 
 # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
 # so that AC_CHECK_FUNCS can detect functions in that library.
@@ -2435,10 +2453,9 @@
 PBX_LAUNCHD=0
 if test "${cross_compiling}" = "no";
 then
-  AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
-  if test "${HAVE_SBIN_LAUNCHD}" = 1; then
-    PBX_LAUNCHD=1
-  fi
+  AC_CHECK_FILE(/sbin/launchd,
+    [PBX_LAUNCHD=1]
+    AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
 fi
 AC_SUBST(PBX_LAUNCHD)
 

Modified: team/dlee/amqp-cdr-cel/contrib/utils/eagi_proxy.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/contrib/utils/eagi_proxy.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/contrib/utils/eagi_proxy.c (original)
+++ team/dlee/amqp-cdr-cel/contrib/utils/eagi_proxy.c Mon Jan 26 09:13:08 2015
@@ -223,7 +223,7 @@
 	struct sockaddr_in host;
 	
 
-	/* get adress */	
+	/* get address */	
 	if(!strcmp(name,"localhost"))
 		address=htonl(2130706433); /*127.0.0.1*/
 	else

Modified: team/dlee/amqp-cdr-cel/funcs/func_groupcount.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/funcs/func_groupcount.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/funcs/func_groupcount.c (original)
+++ team/dlee/amqp-cdr-cel/funcs/func_groupcount.c Mon Jan 26 09:13:08 2015
@@ -50,7 +50,7 @@
 		</syntax>
 		<description>
 			<para>Calculates the group count for the specified group, or uses the
-			channel's current group if not specifed (and non-empty).</para>
+			channel's current group if not specified (and non-empty).</para>
 		</description>
 	</function>
 	<function name="GROUP_MATCH_COUNT" language="en_US">

Modified: team/dlee/amqp-cdr-cel/funcs/func_hangupcause.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/funcs/func_hangupcause.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/funcs/func_hangupcause.c (original)
+++ team/dlee/amqp-cdr-cel/funcs/func_hangupcause.c Mon Jan 26 09:13:08 2015
@@ -48,7 +48,7 @@
 		</synopsis>
 		<syntax>
 			<parameter name="channel" required="true">
-				<para>The name of the channel for which to retreive cause information.</para>
+				<para>The name of the channel for which to retrieve cause information.</para>
 			</parameter>
 			<parameter name="type" required="true">
 				<para>Parameter describing which type of information is requested. Types are:</para>

Modified: team/dlee/amqp-cdr-cel/funcs/func_presencestate.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/funcs/func_presencestate.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/funcs/func_presencestate.c (original)
+++ team/dlee/amqp-cdr-cel/funcs/func_presencestate.c Mon Jan 26 09:13:08 2015
@@ -41,7 +41,7 @@
 #include "asterisk/app.h"
 #ifdef TEST_FRAMEWORK
 #include "asterisk/test.h"
-#include <semaphore.h>
+#include "asterisk/sem.h"
 #endif
 
 /*** DOCUMENTATION
@@ -664,7 +664,7 @@
 struct test_cb_data {
 	struct ast_presence_state_message *presence_state;
 	/* That's right. I'm using a semaphore */
-	sem_t sem;
+	struct ast_sem sem;
 };
 
 static struct test_cb_data *test_cb_data_alloc(void)
@@ -675,7 +675,7 @@
 		return NULL;
 	}
 
-	if (sem_init(&cb_data->sem, 0, 0)) {
+	if (ast_sem_init(&cb_data->sem, 0, 0)) {
 		ast_free(cb_data);
 		return NULL;
 	}
@@ -686,7 +686,7 @@
 static void test_cb_data_destroy(struct test_cb_data *cb_data)
 {
 	ao2_cleanup(cb_data->presence_state);
-	sem_destroy(&cb_data->sem);
+	ast_sem_destroy(&cb_data->sem);
 	ast_free(cb_data);
 }
 
@@ -699,7 +699,7 @@
 	cb_data->presence_state = stasis_message_data(msg);
 	ao2_ref(cb_data->presence_state, +1);
 
-	sem_post(&cb_data->sem);
+	ast_sem_post(&cb_data->sem);
 }
 
 static enum ast_test_result_state presence_change_common(struct ast_test *test,
@@ -727,7 +727,7 @@
 		return AST_TEST_FAIL;
 	}
 
-	sem_wait(&cb_data->sem);
+	ast_sem_wait(&cb_data->sem);
 
 	ast_copy_string(out_state, ast_presence_state2str(cb_data->presence_state->state), out_state_size);
 	ast_copy_string(out_subtype, cb_data->presence_state->subtype, out_subtype_size);

Modified: team/dlee/amqp-cdr-cel/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/include/asterisk/autoconfig.h.in?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/include/asterisk/autoconfig.h.in (original)
+++ team/dlee/amqp-cdr-cel/include/asterisk/autoconfig.h.in Mon Jan 26 09:13:08 2015
@@ -324,7 +324,7 @@
 /* Define to 1 if you have the Hoard Memory Allocator library. */
 #undef HAVE_HOARD
 
-/* Define to 1 if you have the `htonll' function. */
+/* Define to 1 if arpa/inet.h includes a htonll definition. */
 #undef HAVE_HTONLL
 
 /* Define to 1 if you have the iCal library. */
@@ -524,7 +524,7 @@
 /* Define to 1 if you have the newt library. */
 #undef HAVE_NEWT
 
-/* Define to 1 if you have the `ntohll' function. */
+/* Define to 1 if arpa/inet.h includes a ntohll definition. */
 #undef HAVE_NTOHLL
 
 /* Define to 1 if your C library can safely print NULL to string formats. */

Modified: team/dlee/amqp-cdr-cel/include/asterisk/bridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/include/asterisk/bridge.h?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/include/asterisk/bridge.h (original)
+++ team/dlee/amqp-cdr-cel/include/asterisk/bridge.h Mon Jan 26 09:13:08 2015
@@ -444,14 +444,18 @@
 };
 
 /*!
- * \brief Join (blocking) a channel to a bridge
+ * \brief Join a channel to a bridge (blocking)
  *
  * \param bridge Bridge to join
  * \param chan Channel to join
- * \param swap Channel to swap out if swapping
+ * \param swap Channel to swap out if swapping (A channel reference is stolen.)
  * \param features Bridge features structure
  * \param tech_args Optional Bridging tech optimization parameters for this channel.
  * \param flags defined by enum ast_bridge_join_flags.
+ *
+ * \note The passed in swap channel is always unreffed on return.  It is not a
+ * good idea to access the swap channel on return or for the caller to keep a
+ * reference to it.
  *
  * \note Absolutely _NO_ locks should be held before calling
  * this function since it blocks.
@@ -495,7 +499,7 @@
 };
 
 /*!
- * \brief Impart (non-blocking) a channel onto a bridge
+ * \brief Impart a channel to a bridge (non-blocking)
  *
  * \param bridge Bridge to impart on
  * \param chan Channel to impart (The channel reference is stolen if impart successful.)

Modified: team/dlee/amqp-cdr-cel/include/asterisk/bridge_channel_internal.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/include/asterisk/bridge_channel_internal.h?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/include/asterisk/bridge_channel_internal.h (original)
+++ team/dlee/amqp-cdr-cel/include/asterisk/bridge_channel_internal.h Mon Jan 26 09:13:08 2015
@@ -103,6 +103,9 @@
  *
  * \param bridge_channel Channel to push.
  *
+ * \note A ref is not held by bridge_channel->swap when calling because the
+ * push with swap happens immediately.
+ *
  * \note On entry, bridge_channel->bridge is already locked.
  *
  * \retval 0 on success.
@@ -128,16 +131,22 @@
 
 /*!
  * \internal
- * \brief Join the bridge_channel to the bridge
+ * \brief Join the bridge_channel to the bridge (blocking)
  *
  * \param bridge_channel The Channel in the bridge
+ *
+ * \note The bridge_channel->swap holds a channel reference for the swap
+ * channel going into the bridging system.  The ref ensures that the swap
+ * pointer is valid for the bridge subclass push callbacks.  The pointer
+ * will be NULL on return if the ref was consumed.
+ *
+ * \details
+ * This API call puts the bridge_channel into the bridge and handles the
+ * bridge_channel's processing of events while it is in the bridge.  It
+ * will return when the channel has been instructed to leave the bridge.
  *
  * \retval 0 bridge channel successfully joined the bridge
  * \retval -1 bridge channel failed to join the bridge
- *
- * \note This API call starts the bridge_channel's processing of events while
- * it is in the bridge. It will return when the channel has been instructed to
- * leave the bridge.
  */
 int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel);
 

Modified: team/dlee/amqp-cdr-cel/include/asterisk/bridge_internal.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/include/asterisk/bridge_internal.h?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/include/asterisk/bridge_internal.h (original)
+++ team/dlee/amqp-cdr-cel/include/asterisk/bridge_internal.h Mon Jan 26 09:13:08 2015
@@ -117,6 +117,9 @@
  * \param attempt_recovery TRUE if failure attempts to push channel back into original bridge.
  * \param optimized Indicates whether the move is part of an unreal channel optimization.
  *
+ * \note A ref is not held by bridge_channel->swap when calling because the
+ * move with swap happens immediately.
+ *
  * \note The dst_bridge and bridge_channel->bridge are assumed already locked.
  *
  * \retval 0 on success.

Modified: team/dlee/amqp-cdr-cel/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/include/asterisk/channel.h?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/include/asterisk/channel.h (original)
+++ team/dlee/amqp-cdr-cel/include/asterisk/channel.h Mon Jan 26 09:13:08 2015
@@ -4186,13 +4186,13 @@
 
 /*!
  * \since 11
- * \brief Retreive a comma-separated list of channels for which dialed cause information is available
+ * \brief Retrieve a comma-separated list of channels for which dialed cause information is available
  *
  * \details
  * This function makes use of datastore operations on the channel, so
  * it is important to lock the channel before calling this function.
  *
- * \param chan The channel from which to retreive information
+ * \param chan The channel from which to retrieve information
  * \retval NULL on allocation failure
  * \retval Pointer to an ast_str object containing the desired information which must be freed
  */
@@ -4200,7 +4200,7 @@
 
 /*!
  * \since 11
- * \brief Retreive a ref-counted cause code information structure
+ * \brief Retrieve a ref-counted cause code information structure
  *
  * \details
  * This function makes use of datastore operations on the channel, so
@@ -4209,8 +4209,8 @@
  * calling function must decrease the reference count when it is finished
  * with the object.
  *
- * \param chan The channel from which to retreive information
- * \param chan_name The name of the channel about which to retreive information
+ * \param chan The channel from which to retrieve information
+ * \param chan_name The name of the channel about which to retrieve information
  * \retval NULL on search failure
  * \retval Pointer to a ref-counted ast_control_pvt_cause_code object containing the desired information
  */

Modified: team/dlee/amqp-cdr-cel/include/asterisk/sem.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/include/asterisk/sem.h?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/include/asterisk/sem.h (original)
+++ team/dlee/amqp-cdr-cel/include/asterisk/sem.h Mon Jan 26 09:13:08 2015
@@ -57,6 +57,11 @@
 static force_inline int ast_sem_wait(struct ast_sem *sem)
 {
 	return sem_wait(&sem->real_sem);
+}
+
+static force_inline int ast_sem_timedwait(struct ast_sem *sem, const struct timespec *abs_timeout)
+{
+	return sem_timedwait(&sem->real_sem, abs_timeout);
 }
 
 static force_inline int ast_sem_getvalue(struct ast_sem *sem, int *sval)
@@ -137,6 +142,20 @@
 int ast_sem_wait(struct ast_sem *sem);
 
 /*!
+ * \brief Decrements the semaphore, waiting until abs_timeout.
+ *
+ * If the semaphore's current value is zero, this function blocks until another
+ * thread posts (ast_sem_post()) to the semaphore (or is interrupted by a signal
+ * handler, which sets errno to EINTR).
+ *
+ * \param sem Semaphore to decrement.
+ *
+ * \return 0 on success.
+ * \return -1 on error, errno set to indicate error.
+ */
+int ast_sem_timedwait(struct ast_sem *sem, const struct timespec *abs_timeout);
+
+/*!
  * \brief Gets the current value of the semaphore.
  *
  * If threads are blocked on this semaphore, POSIX allows the return value to be

Modified: team/dlee/amqp-cdr-cel/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/include/asterisk/stasis_app.h?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/include/asterisk/stasis_app.h (original)
+++ team/dlee/amqp-cdr-cel/include/asterisk/stasis_app.h Mon Jan 26 09:13:08 2015
@@ -245,8 +245,7 @@
  * \param event_name Name of the Userevent.
  * \param source_uris URIs for the source objects to attach to event.
  * \param sources_count Array size of source_uris.
- * \param userevent_data Custom parameters for the user event
- * \param userevents_count Array size of userevent_data
+ * \param json_variables event blob variables.
  *
  * \return \ref stasis_app_user_event_res return code.
  */

Modified: team/dlee/amqp-cdr-cel/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/main/app.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/main/app.c (original)
+++ team/dlee/amqp-cdr-cel/main/app.c Mon Jan 26 09:13:08 2015
@@ -2911,7 +2911,9 @@
 		ast_replace_sigchld();
 	}
 
-	sigfillset(&signal_set);
+	/* GCC 4.9 gives a bogus "right-hand operand of comma expression has
+	 * no effect" warning */
+	(void) sigfillset(&signal_set);
 	pthread_sigmask(SIG_BLOCK, &signal_set, &old_set);
 
 	pid = fork();

Modified: team/dlee/amqp-cdr-cel/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/main/asterisk.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/main/asterisk.c (original)
+++ team/dlee/amqp-cdr-cel/main/asterisk.c Mon Jan 26 09:13:08 2015
@@ -4366,12 +4366,14 @@
 	}
 
 	ast_makesocket();
-	sigemptyset(&sigs);
-	sigaddset(&sigs, SIGHUP);
-	sigaddset(&sigs, SIGTERM);
-	sigaddset(&sigs, SIGINT);
-	sigaddset(&sigs, SIGPIPE);
-	sigaddset(&sigs, SIGWINCH);
+	/* GCC 4.9 gives a bogus "right-hand operand of comma expression has
+	 * no effect" warning */
+	(void) sigemptyset(&sigs);
+	(void) sigaddset(&sigs, SIGHUP);
+	(void) sigaddset(&sigs, SIGTERM);
+	(void) sigaddset(&sigs, SIGINT);
+	(void) sigaddset(&sigs, SIGPIPE);
+	(void) sigaddset(&sigs, SIGWINCH);
 	pthread_sigmask(SIG_BLOCK, &sigs, NULL);
 	sigaction(SIGURG, &urg_handler, NULL);
 	signal(SIGINT, __quit_handler);

Modified: team/dlee/amqp-cdr-cel/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/main/bridge.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/main/bridge.c (original)
+++ team/dlee/amqp-cdr-cel/main/bridge.c Mon Jan 26 09:13:08 2015
@@ -1560,6 +1560,7 @@
 		ao2_ref(bridge, -1);
 	}
 	if (!bridge_channel) {
+		ao2_t_cleanup(swap, "Error exit: bridge_channel alloc failed");
 		res = -1;
 		goto join_exit;
 	}
@@ -1567,6 +1568,7 @@
 	ast_assert(features != NULL);
 	if (!features) {
 		ao2_ref(bridge_channel, -1);
+		ao2_t_cleanup(swap, "Error exit: features is NULL");
 		res = -1;
 		goto join_exit;
 	}
@@ -1596,6 +1598,8 @@
 	ast_channel_internal_bridge_channel_set(chan, NULL);
 	ast_channel_unlock(chan);
 	bridge_channel->chan = NULL;
+	/* If bridge_channel->swap is not NULL then the join failed. */
+	ao2_t_cleanup(bridge_channel->swap, "Bridge complete: join failed");
 	bridge_channel->swap = NULL;
 	bridge_channel->features = NULL;
 
@@ -1624,7 +1628,12 @@
 
 	bridge_channel_internal_join(bridge_channel);
 
-	/* cleanup */
+	/*
+	 * cleanup
+	 *
+	 * If bridge_channel->swap is not NULL then the join failed.
+	 */
+	ao2_t_cleanup(bridge_channel->swap, "Bridge complete: Departable impart join failed");
 	bridge_channel->swap = NULL;
 	ast_bridge_features_destroy(bridge_channel->features);
 	bridge_channel->features = NULL;
@@ -1653,6 +1662,8 @@
 	ast_channel_internal_bridge_channel_set(chan, NULL);
 	ast_channel_unlock(chan);
 	bridge_channel->chan = NULL;
+	/* If bridge_channel->swap is not NULL then the join failed. */
+	ao2_t_cleanup(bridge_channel->swap, "Bridge complete: Independent impart join failed");
 	bridge_channel->swap = NULL;
 	ast_bridge_features_destroy(bridge_channel->features);
 	bridge_channel->features = NULL;
@@ -1706,7 +1717,7 @@
 	}
 	ast_channel_unlock(chan);
 	bridge_channel->chan = chan;
-	bridge_channel->swap = swap;
+	bridge_channel->swap = ao2_t_bump(swap, "Setting up bridge impart");
 	bridge_channel->features = features;
 	bridge_channel->inhibit_colp = !!(flags & AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP);
 	bridge_channel->depart_wait =
@@ -1730,6 +1741,7 @@
 		ast_channel_internal_bridge_channel_set(chan, NULL);
 		ast_channel_unlock(chan);
 		bridge_channel->chan = NULL;
+		ao2_t_cleanup(bridge_channel->swap, "Bridge complete: Impart failed");
 		bridge_channel->swap = NULL;
 		ast_bridge_features_destroy(bridge_channel->features);
 		bridge_channel->features = NULL;
@@ -2171,7 +2183,11 @@
 		/*
 		 * The channel died as a result of being pulled.  Leave it
 		 * pointing to the original bridge.
+		 *
+		 * Clear out the swap channel pointer.  A ref is not held
+		 * by bridge_channel->swap at this point.
 		 */
+		bridge_channel->swap = NULL;
 		bridge_reconfigured(orig_bridge, 0);
 		return -1;
 	}

Modified: team/dlee/amqp-cdr-cel/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/amqp-cdr-cel/main/bridge_channel.c?view=diff&rev=431095&r1=431094&r2=431095
==============================================================================
--- team/dlee/amqp-cdr-cel/main/bridge_channel.c (original)
+++ team/dlee/amqp-cdr-cel/main/bridge_channel.c Mon Jan 26 09:13:08 2015
@@ -35,7 +35,6 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include <signal.h>
-#include <semaphore.h>
 
 #include "asterisk/heap.h"
 #include "asterisk/astobj2.h"
@@ -56,6 +55,7 @@
 #include "asterisk/parking.h"
 #include "asterisk/causes.h"
 #include "asterisk/test.h"
+#include "asterisk/sem.h"
 
 /*!
  * \brief Used to queue an action frame onto a bridge channel and write an action frame into a bridge.
@@ -101,7 +101,7 @@
 	/*! Unique ID of this synchronization object. Corresponds with ID in synchronous frame payload */
 	unsigned int id;
 	/*! Semaphore used for synchronization */
-	sem_t sem;
+	struct ast_sem sem;
 	/*! Pointer to next entry in the list */
 	AST_LIST_ENTRY(bridge_sync) list;
 };
@@ -124,7 +124,7 @@
 {
 	memset(sync_struct, 0, sizeof(*sync_struct));
 	sync_struct->id = id;
-	sem_init(&sync_struct->sem, 0, 0);
+	ast_sem_init(&sync_struct->sem, 0, 0);
 
 	AST_RWLIST_WRLOCK(&sync_structs);
 	AST_RWLIST_INSERT_TAIL(&sync_structs, sync_struct, list);
@@ -157,7 +157,7 @@
 	AST_LIST_TRAVERSE_SAFE_END;
 	AST_RWLIST_UNLOCK(&sync_structs);
 
-	sem_destroy(&sync_struct->sem);
+	ast_sem_destroy(&sync_struct->sem);
 }
 
 /*!
@@ -189,7 +189,7 @@
 		.tv_nsec = timeout_val.tv_usec * 1000,
 	};
 
-	sem_timedwait(&sync_struct->sem, &timeout_spec);
+	ast_sem_timedwait(&sync_struct->sem, &timeout_spec);
 }
 
 /*!
@@ -204,7 +204,7 @@
  */
 static void bridge_sync_signal(struct bridge_sync *sync_struct)
 {
-	sem_post(&sync_struct->sem);
+	ast_sem_post(&sync_struct->sem);
 }
 
 void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
@@ -2490,11 +2490,11 @@
 	ao2_iterator_destroy(&iter);
 }
 
-/*! \brief Join a channel to a bridge and handle anything the bridge may want us to do */
 int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel)
 {
 	int res = 0;
 	struct ast_bridge_features *channel_features;
+	struct ast_channel *swap;
 
 	ast_debug(1, "Bridge %s: %p(%s) is joining\n",
 		bridge_channel->bridge->uniqueid,
@@ -2538,6 +2538,9 @@
 		bridge_channel->bridge->callid = ast_read_threadstorage_callid();
 	}
 
+	/* Take the swap channel ref from the bridge_channel struct. */
+	swap = bridge_channel->swap;
+
 	if (bridge_channel_internal_push(bridge_channel)) {
 		int cause = bridge_channel->bridge->cause;
 
@@ -2563,6 +2566,11 @@
 		}
 
 		ast_bridge_unlock(bridge_channel->bridge);
+
+		/* Must release any swap ref after unlocking the bridge. */
+		ao2_t_cleanup(swap, "Bridge push with swap successful");
+		swap = NULL;
+

[... 569 lines stripped ...]



More information about the asterisk-commits mailing list