[asterisk-commits] dlee: branch dlee/playback-controls r388955 - in /team/dlee/playback-controls...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 17 09:23:31 CDT 2013


Author: dlee
Date: Fri May 17 09:23:28 2013
New Revision: 388955

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388955
Log:
Merged revisions 388793-388917 from http://svn.asterisk.org/svn/asterisk/team/dlee/playback-rebase

Added:
    team/dlee/playback-controls/res/res_stasis_json_asterisk.c
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_asterisk.c
    team/dlee/playback-controls/res/res_stasis_json_asterisk.exports.in
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_asterisk.exports.in
    team/dlee/playback-controls/res/res_stasis_json_bridges.c
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_bridges.c
    team/dlee/playback-controls/res/res_stasis_json_bridges.exports.in
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_bridges.exports.in
    team/dlee/playback-controls/res/res_stasis_json_channels.c
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_channels.c
    team/dlee/playback-controls/res/res_stasis_json_channels.exports.in
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_channels.exports.in
    team/dlee/playback-controls/res/res_stasis_json_endpoints.c
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_endpoints.c
    team/dlee/playback-controls/res/res_stasis_json_endpoints.exports.in
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_endpoints.exports.in
    team/dlee/playback-controls/res/res_stasis_json_events.c
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_events.c
    team/dlee/playback-controls/res/res_stasis_json_events.exports.in
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_events.exports.in
    team/dlee/playback-controls/res/res_stasis_json_playback.c
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_playback.c
    team/dlee/playback-controls/res/res_stasis_json_playback.exports.in
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_playback.exports.in
    team/dlee/playback-controls/res/res_stasis_json_recordings.c
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_recordings.c
    team/dlee/playback-controls/res/res_stasis_json_recordings.exports.in
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_recordings.exports.in
    team/dlee/playback-controls/res/res_stasis_json_sounds.c
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_sounds.c
    team/dlee/playback-controls/res/res_stasis_json_sounds.exports.in
      - copied unchanged from r388917, team/dlee/playback-rebase/res/res_stasis_json_sounds.exports.in
    team/dlee/playback-controls/res/stasis_json/
      - copied from r388917, team/dlee/playback-rebase/res/stasis_json/
    team/dlee/playback-controls/rest-api-templates/res_stasis_json_resource.c.mustache
      - copied unchanged from r388917, team/dlee/playback-rebase/rest-api-templates/res_stasis_json_resource.c.mustache
    team/dlee/playback-controls/rest-api-templates/res_stasis_json_resource.exports.mustache
      - copied unchanged from r388917, team/dlee/playback-rebase/rest-api-templates/res_stasis_json_resource.exports.mustache
    team/dlee/playback-controls/rest-api-templates/stasis_json_resource.h.mustache
      - copied unchanged from r388917, team/dlee/playback-rebase/rest-api-templates/stasis_json_resource.h.mustache
Modified:
    team/dlee/playback-controls/   (props changed)
    team/dlee/playback-controls/apps/app_stasis.c
    team/dlee/playback-controls/apps/app_voicemail.c
    team/dlee/playback-controls/channels/chan_gulp.c
    team/dlee/playback-controls/channels/chan_sip.c
    team/dlee/playback-controls/channels/misdn/isdn_msg_parser.c
    team/dlee/playback-controls/configure
    team/dlee/playback-controls/configure.ac
    team/dlee/playback-controls/include/asterisk/app.h
    team/dlee/playback-controls/include/asterisk/astobj2.h
    team/dlee/playback-controls/include/asterisk/autoconfig.h.in
    team/dlee/playback-controls/include/asterisk/stasis.h
    team/dlee/playback-controls/include/asterisk/stasis_app.h
    team/dlee/playback-controls/main/app.c
    team/dlee/playback-controls/main/asterisk.c
    team/dlee/playback-controls/main/astobj2.c
    team/dlee/playback-controls/main/devicestate.c
    team/dlee/playback-controls/main/loader.c
    team/dlee/playback-controls/main/lock.c
    team/dlee/playback-controls/main/logger.c
    team/dlee/playback-controls/main/manager.c
    team/dlee/playback-controls/main/named_acl.c
    team/dlee/playback-controls/main/pbx.c
    team/dlee/playback-controls/main/presencestate.c
    team/dlee/playback-controls/main/stasis.c
    team/dlee/playback-controls/main/stasis_cache.c
    team/dlee/playback-controls/main/stasis_channels.c
    team/dlee/playback-controls/main/stasis_endpoints.c
    team/dlee/playback-controls/main/test.c
    team/dlee/playback-controls/pbx/pbx_dundi.c
    team/dlee/playback-controls/res/res_config_odbc.c
    team/dlee/playback-controls/res/res_srtp.c
    team/dlee/playback-controls/res/res_stasis.c
    team/dlee/playback-controls/res/res_stasis_http.c
    team/dlee/playback-controls/res/res_stasis_http_asterisk.c
    team/dlee/playback-controls/res/res_stasis_http_bridges.c
    team/dlee/playback-controls/res/res_stasis_http_channels.c
    team/dlee/playback-controls/res/res_stasis_http_endpoints.c
    team/dlee/playback-controls/res/res_stasis_http_events.c
    team/dlee/playback-controls/res/res_stasis_http_playback.c
    team/dlee/playback-controls/res/res_stasis_http_recordings.c
    team/dlee/playback-controls/res/res_stasis_http_sounds.c
    team/dlee/playback-controls/res/res_stasis_playback.c
    team/dlee/playback-controls/res/res_stasis_test.c
    team/dlee/playback-controls/res/res_stasis_websocket.c
    team/dlee/playback-controls/res/stasis/app.c
    team/dlee/playback-controls/res/stasis/app.h
    team/dlee/playback-controls/res/stasis/control.c
    team/dlee/playback-controls/res/stasis_http/resource_asterisk.h
    team/dlee/playback-controls/res/stasis_http/resource_bridges.h
    team/dlee/playback-controls/res/stasis_http/resource_channels.h
    team/dlee/playback-controls/res/stasis_http/resource_endpoints.h
    team/dlee/playback-controls/res/stasis_http/resource_events.h
    team/dlee/playback-controls/res/stasis_http/resource_playback.h
    team/dlee/playback-controls/res/stasis_http/resource_recordings.h
    team/dlee/playback-controls/res/stasis_http/resource_sounds.h
    team/dlee/playback-controls/rest-api-templates/make_stasis_http_stubs.py
    team/dlee/playback-controls/rest-api-templates/res_stasis_http_resource.c.mustache
    team/dlee/playback-controls/rest-api-templates/stasis_http_resource.h.mustache
    team/dlee/playback-controls/tests/test_res_stasis.c

Propchange: team/dlee/playback-controls/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/playback-controls/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 17 09:23:28 2013
@@ -1,1 +1,1 @@
-/team/dlee/playback-rebase:1-388527 /trunk:1-388320
+/team/dlee/playback-rebase:1-388954 /trunk:1-388896

Modified: team/dlee/playback-controls/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/apps/app_stasis.c?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/apps/app_stasis.c (original)
+++ team/dlee/playback-controls/apps/app_stasis.c Fri May 17 09:23:28 2013
@@ -93,6 +93,7 @@
 {
 	int r = 0;
 
+	stasis_app_ref();
 	r |= ast_register_application_xml(stasis, app_exec);
 	return r;
 }
@@ -100,12 +101,15 @@
 static int unload_module(void)
 {
 	int r = 0;
-
 	r |= ast_unregister_application(stasis);
+	stasis_app_unref();
 	return r;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS,
-		"Stasis dialplan application",
-		.load = load_module,
-		.unload = unload_module);
+AST_MODULE_INFO(ASTERISK_GPL_KEY,
+	AST_MODFLAG_DEFAULT,
+	"Stasis dialplan application",
+	.load = load_module,
+	.unload = unload_module,
+	.nonoptreq = "res_stasis",
+	);

Modified: team/dlee/playback-controls/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/apps/app_voicemail.c?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/apps/app_voicemail.c (original)
+++ team/dlee/playback-controls/apps/app_voicemail.c Fri May 17 09:23:28 2013
@@ -15118,24 +15118,20 @@
 	mailbox_snapshot->folders = ARRAY_LEN(mailbox_folders);
 
 	for (i = 0; i < mailbox_snapshot->folders; i++) {
-		int combining_old = 0;
-		/* Assume we are combining folders if:
-		 *  - The current index is the old folder index OR
-		 *  - The current index is urgent and we were looking for INBOX or all folders OR
-		 *  - The current index is INBOX and we were looking for Urgent or all folders
+		int msg_folder_index = i;
+
+		/* We want this message in the snapshot if any of the following:
+		 *   No folder was specified.
+		 *   The specified folder matches the current folder.
+		 *   The specified folder is INBOX AND we were asked to combine messages AND the current folder is either Old or Urgent.
 		 */
-		if ((i == old_index ||
-			(i == urgent_index && (this_index_only == inbox_index || this_index_only == -1)) ||
-			(i == inbox_index && (this_index_only == urgent_index || this_index_only == -1))) && (combine_INBOX_and_OLD)) {
-			combining_old = 1;
-		}
-
-		/* This if statement is confusing looking.  Here is what it means in english.
-		 * - If a folder is given to the function and that folder's index is not the one we are iterating over, skip it...
-		 * - Unless the folder provided is the INBOX folder and the current index is the OLD folder and we are combining OLD and INBOX msgs.
-		 */
-		if ((this_index_only != -1) && (this_index_only != i) && !(combining_old && i == old_index && this_index_only == inbox_index)) {
+		if (!(this_index_only == -1 || this_index_only == i || (this_index_only == inbox_index && combine_INBOX_and_OLD && (i == old_index || i == urgent_index)))) {
 			continue;
+		}
+
+		/* Make sure that Old or Urgent messages are marked as being in INBOX. */
+		if (combine_INBOX_and_OLD && (i == old_index || i == urgent_index)) {
+			msg_folder_index = inbox_index;
 		}
 
 		memset(&vms, 0, sizeof(vms));
@@ -15152,7 +15148,7 @@
 
 		/* Iterate through each msg, storing off info */
 		if (vms.lastmsg != -1) {
-			if ((vm_msg_snapshot_create(vmu, &vms, mailbox_snapshot, combining_old ? inbox_index : i, i, descending, sort_val))) {
+			if ((vm_msg_snapshot_create(vmu, &vms, mailbox_snapshot, msg_folder_index, i, descending, sort_val))) {
 				ast_log(LOG_WARNING, "Failed to create msg snapshots for %s@%s\n", mailbox, context);
 				goto snapshot_cleanup;
 			}

Modified: team/dlee/playback-controls/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/channels/chan_gulp.c?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/channels/chan_gulp.c (original)
+++ team/dlee/playback-controls/channels/chan_gulp.c Fri May 17 09:23:28 2013
@@ -103,8 +103,10 @@
 {
 	struct gulp_pvt *pvt = obj;
 	int i;
+
 	ao2_cleanup(pvt->session);
 	pvt->session = NULL;
+
 	for (i = 0; i < SIP_MEDIA_SIZE; ++i) {
 		ao2_cleanup(pvt->media[i]);
 		pvt->media[i] = NULL;
@@ -172,15 +174,16 @@
 /*! \brief Dialplan function for constructing a dial string for calling all contacts */
 static int gulp_dial_contacts(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
+	RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_str *, dial, NULL, ast_free_ptr);
+	const char *aor_name;
+	char *rest;
+
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(endpoint_name);
 		AST_APP_ARG(aor_name);
 		AST_APP_ARG(request_user);
 	);
-	RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
-	const char *aor_name;
-	char *rest;
-	RAII_VAR(struct ast_str *, dial, NULL, ast_free_ptr);
 
 	AST_STANDARD_APP_ARGS(args, data);
 
@@ -289,12 +292,14 @@
 static void gulp_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
 {
 	struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
+
 	ast_format_cap_copy(result, pvt->session->endpoint->codecs);
 }
 
 static int send_direct_media_request(void *data)
 {
 	RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
+
 	return ast_sip_session_refresh(session, NULL, NULL, session->endpoint->direct_media_method, 1);
 }
 
@@ -470,6 +475,7 @@
 	}
 
 	ao2_ref(session, -1);
+
 	return (status == PJ_SUCCESS) ? 0 : -1;
 }
 
@@ -491,6 +497,7 @@
 		ao2_cleanup(session);
 		return -1;
 	}
+
 	return 0;
 }
 
@@ -542,8 +549,8 @@
 static int gulp_write(struct ast_channel *ast, struct ast_frame *frame)
 {
 	struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
+	struct ast_sip_session_media *media;
 	int res = 0;
-	struct ast_sip_session_media *media;
 
 	switch (frame->frametype) {
 	case AST_FRAME_VOICE:
@@ -588,7 +595,9 @@
 static int fixup(void *data)
 {
 	struct fixup_data *fix_data = data;
+
 	fix_data->session->channel = fix_data->chan;
+
 	return 0;
 }
 
@@ -598,6 +607,7 @@
 	struct gulp_pvt *pvt = ast_channel_tech_pvt(newchan);
 	struct ast_sip_session *session = pvt->session;
 	struct fixup_data fix_data;
+
 	fix_data.session = session;
 	fix_data.chan = newchan;
 
@@ -624,6 +634,7 @@
 static void indicate_data_destroy(void *obj)
 {
 	struct indicate_data *ind_data = obj;
+
 	ast_free(ind_data->frame_data);
 	ao2_ref(ind_data->session, -1);
 }
@@ -632,35 +643,40 @@
 		int condition, int response_code, const void *frame_data, size_t datalen)
 {
 	struct indicate_data *ind_data = ao2_alloc(sizeof(*ind_data), indicate_data_destroy);
+
 	if (!ind_data) {
 		return NULL;
 	}
+
 	ind_data->frame_data = ast_malloc(datalen);
 	if (!ind_data->frame_data) {
 		ao2_ref(ind_data, -1);
 		return NULL;
 	}
+
 	memcpy(ind_data->frame_data, frame_data, datalen);
 	ind_data->datalen = datalen;
 	ind_data->condition = condition;
 	ind_data->response_code = response_code;
 	ao2_ref(session, +1);
 	ind_data->session = session;
+
 	return ind_data;
 }
 
 static int indicate(void *data)
 {
+	pjsip_tx_data *packet = NULL;
 	struct indicate_data *ind_data = data;
 	struct ast_sip_session *session = ind_data->session;
 	int response_code = ind_data->response_code;
-	pjsip_tx_data *packet = NULL;
 
 	if (pjsip_inv_answer(session->inv_session, response_code, NULL, NULL, &packet) == PJ_SUCCESS) {
 		ast_sip_session_send_response(session, packet);
 	}
 
 	ao2_ref(ind_data, -1);
+
 	return 0;
 }
 
@@ -702,11 +718,11 @@
 /*! \brief Function called by core to ask the channel to indicate some sort of condition */
 static int gulp_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen)
 {
-	int res = 0;
 	struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
 	struct ast_sip_session *session = pvt->session;
 	struct ast_sip_session_media *media;
 	int response_code = 0;
+	int res = 0;
 
 	switch (condition) {
 	case AST_CONTROL_RINGING:
@@ -802,8 +818,8 @@
 {
 	struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
 	struct ast_sip_session *session = pvt->session;
+	struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
 	int res = 0;
-	struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
 
 	switch (session->endpoint->dtmf) {
 	case AST_SIP_DTMF_RFC_4733:
@@ -890,8 +906,8 @@
 {
 	struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
 	struct ast_sip_session *session = pvt->session;
+	struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
 	int res = 0;
-	struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
 
 	switch (session->endpoint->dtmf) {
 	case AST_SIP_DTMF_INFO:
@@ -927,8 +943,8 @@
 
 static int call(void *data)
 {
+	pjsip_tx_data *packet;
 	struct ast_sip_session *session = data;
-	pjsip_tx_data *packet;
 
 	if (pjsip_inv_invite(session->inv_session, &packet) != PJ_SUCCESS) {
 		ast_queue_hangup(session->channel);
@@ -937,6 +953,7 @@
 	}
 
 	ao2_ref(session, -1);
+
 	return 0;
 }
 
@@ -952,6 +969,7 @@
 		ao2_cleanup(session);
 		return -1;
 	}
+
 	return 0;
 }
 
@@ -1011,17 +1029,21 @@
 static void hangup_data_destroy(void *obj)
 {
 	struct hangup_data *h_data = obj;
+
 	h_data->chan = ast_channel_unref(h_data->chan);
 }
 
 static struct hangup_data *hangup_data_alloc(int cause, struct ast_channel *chan)
 {
 	struct hangup_data *h_data = ao2_alloc(sizeof(*h_data), hangup_data_destroy);
+
 	if (!h_data) {
 		return NULL;
 	}
+
 	h_data->cause = cause;
 	h_data->chan = ast_channel_ref(chan);
+
 	return h_data;
 }
 
@@ -1048,6 +1070,7 @@
 
 	ao2_cleanup(pvt);
 	ao2_cleanup(h_data);
+
 	return 0;
 }
 
@@ -1058,6 +1081,7 @@
 	struct ast_sip_session *session = pvt->session;
 	int cause = hangup_cause2sip(ast_channel_hangupcause(session->channel));
 	struct hangup_data *h_data = hangup_data_alloc(cause, ast);
+
 	if (!h_data) {
 		goto failure;
 	}
@@ -1066,6 +1090,7 @@
 		ast_log(LOG_WARNING, "Unable to push hangup task to the threadpool. Expect bad things\n");
 		goto failure;
 	}
+
 	return 0;
 
 failure:
@@ -1077,6 +1102,7 @@
 	ast_channel_tech_pvt_set(ast, NULL);
 
 	ao2_cleanup(pvt);
+
 	return -1;
 }
 
@@ -1090,9 +1116,10 @@
 static int request(void *obj)
 {
 	struct request_data *req_data = obj;
+	struct ast_sip_session *session = NULL;
 	char *tmp = ast_strdupa(req_data->dest), *endpoint_name = NULL, *request_user = NULL;
 	RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
-	struct ast_sip_session *session = NULL;
+
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(endpoint);
 		AST_APP_ARG(aor);

Modified: team/dlee/playback-controls/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/channels/chan_sip.c?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/channels/chan_sip.c (original)
+++ team/dlee/playback-controls/channels/chan_sip.c Fri May 17 09:23:28 2013
@@ -30108,18 +30108,25 @@
 		ast_string_field_set(p, peername, ext);
 	/* Recalculate our side, and recalculate Call ID */
 	ast_sip_ouraddrfor(&p->sa, &p->ourip, p);
-	/* When chan_sip is first loaded, we may have a peer entry but it hasn't re-registered yet.
-	   If the peer hasn't re-registered, we have not checked for NAT yet.  With the new
-	   auto_* settings, we need to check for NAT so we do not have one-way audio. */
-	check_for_nat(&p->ourip, p);
-	set_peer_nat(p, p->relatedpeer);
-
-	if (p->natdetected && ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_RPORT)) {
-		ast_copy_flags(&p->flags[0], &p->relatedpeer->flags[0], SIP_NAT_FORCE_RPORT);
-	}
-
-	if (p->natdetected && ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_COMEDIA)) {
-		ast_copy_flags(&p->flags[1], &p->relatedpeer->flags[1], SIP_PAGE2_SYMMETRICRTP);
+	/* When chan_sip is first loaded or reloaded, we need to check for NAT and set the appropiate flags
+	   now that we have the auto_* settings. */
+	check_for_nat(&p->sa, p);
+	/* If there is a peer related to this outgoing call and it hasn't re-registered after
+	   a reload, we need to set the peer's NAT flags accordingly. */
+	if (p->relatedpeer) {
+
+		if (!ast_strlen_zero(p->relatedpeer->fullcontact) && !p->natdetected &&
+			(ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_RPORT) && !ast_test_flag(&p->flags[0], SIP_NAT_FORCE_RPORT))) {
+			/* We need to make an attempt to determine if a peer is behind NAT
+			   if the peer has the auto_force_rport flag set. */
+			struct ast_sockaddr tmpaddr;
+
+			__set_address_from_contact(p->relatedpeer->fullcontact, &tmpaddr, 0);
+
+			check_for_nat(&tmpaddr, p);
+		}
+
+		set_peer_nat(p, p->relatedpeer);
 	}
 
 	do_setnat(p);
@@ -31340,7 +31347,8 @@
 		 * specified, use that address instead. */
 		/* XXX May need to revisit the final argument; does the realtime DB store whether
 		 * the original contact was over TLS or not? XXX */
-		if (!ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) || ast_sockaddr_isnull(&peer->addr)) {
+		if ((!ast_test_flag(&peer->flags[2],  SIP_PAGE3_NAT_AUTO_RPORT) && !ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT))
+		    || ast_sockaddr_isnull(&peer->addr)) {
 			__set_address_from_contact(ast_str_buffer(fullcontact), &peer->addr, 0);
 		}
 	}

Modified: team/dlee/playback-controls/channels/misdn/isdn_msg_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/channels/misdn/isdn_msg_parser.c?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/channels/misdn/isdn_msg_parser.c (original)
+++ team/dlee/playback-controls/channels/misdn/isdn_msg_parser.c Fri May 17 09:23:28 2013
@@ -282,6 +282,8 @@
 	msg_t *msg =(msg_t*)create_l3msg(CC_PROGRESS | REQUEST, MT_PROGRESS,  bc?bc->l3_id:-1, sizeof(PROGRESS_t) ,nt);
 
 	progress=(PROGRESS_t*)((msg->data+HEADER_LEN));
+
+	enc_ie_progress(&progress->PROGRESS, msg, 0, nt ? 1 : 5, 8, nt, bc);
 
 	if (bc->fac_out.Function != Fac_None) {
 		enc_ie_facility(&progress->FACILITY, msg, &bc->fac_out, nt);

Modified: team/dlee/playback-controls/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/configure.ac?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/configure.ac (original)
+++ team/dlee/playback-controls/configure.ac Fri May 17 09:23:28 2013
@@ -469,6 +469,7 @@
 AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
 AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
 AST_EXT_LIB_SETUP([SRTP], [Secure RTP], [srtp])
+AST_EXT_LIB_SETUP_OPTIONAL([SRTP_SHUTDOWN], [SRTP Library Shutdown Function], [SRTP], [srtp])
 AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
 AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
 AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
@@ -2179,6 +2180,7 @@
     CFLAGS="${saved_cflags}"
 fi
 
+AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp], [srtp_shutdown], [srtp/srtp.h])
 
 for ver in 2.0 2.2 2.4 2.6; do
 	AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver)

Modified: team/dlee/playback-controls/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/include/asterisk/app.h?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/include/asterisk/app.h (original)
+++ team/dlee/playback-controls/include/asterisk/app.h Fri May 17 09:23:28 2013
@@ -636,14 +636,19 @@
 
 /*!
  * \brief Stream a file with fast forward, pause, reverse, restart.
- * \param chan
- * \param file filename
- * \param fwd, rev, stop, pause, restart, skipms, offsetms
+ * \param chan Channel
+ * \param file File to play.
+ * \param fwd, rev, stop, pause, restart DTMF keys for media control
+ * \param skipms Number of milliseconds to skip for fwd/rev.
+ * \param offsetms Number of milliseconds to skip when starting the media.
  *
  * Before calling this function, set this to be the number
  * of ms to start from the beginning of the file.  When the function
  * returns, it will be the number of ms from the beginning where the
  * playback stopped.  Pass NULL if you don't care.
+ *
+ * \retval 0 on success
+ * \retval Non-zero on failure
  */
 int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *pause, const char *restart, int skipms, long *offsetms);
 

Modified: team/dlee/playback-controls/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/include/asterisk/astobj2.h?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/include/asterisk/astobj2.h (original)
+++ team/dlee/playback-controls/include/asterisk/astobj2.h Fri May 17 09:23:28 2013
@@ -635,11 +635,20 @@
  *
  * \return Nothing
  */
+#ifdef REF_DEBUG
 #define ao2_t_global_obj_release(holder, tag)	\
 	__ao2_global_obj_release(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 #define ao2_global_obj_release(holder)	\
 	__ao2_global_obj_release(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 
+#else
+
+#define ao2_t_global_obj_release(holder, tag)	\
+	__ao2_global_obj_release(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#define ao2_global_obj_release(holder)	\
+	__ao2_global_obj_release(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#endif
+
 void __ao2_global_obj_release(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name);
 
 /*!
@@ -657,11 +666,20 @@
  * \retval Reference to previous global ao2 object stored.
  * \retval NULL if no object available.
  */
+#ifdef REF_DEBUG
 #define ao2_t_global_obj_replace(holder, obj, tag)	\
 	__ao2_global_obj_replace(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 #define ao2_global_obj_replace(holder, obj)	\
 	__ao2_global_obj_replace(&holder, (obj), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 
+#else
+
+#define ao2_t_global_obj_replace(holder, obj, tag)	\
+	__ao2_global_obj_replace(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#define ao2_global_obj_replace(holder, obj)	\
+	__ao2_global_obj_replace(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#endif
+
 void *__ao2_global_obj_replace(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name);
 
 /*!
@@ -680,10 +698,20 @@
  * \retval 0 The global object was previously empty
  * \retval 1 The global object was not previously empty
  */
+#ifdef REF_DEBUG
 #define ao2_t_global_obj_replace_unref(holder, obj, tag)	\
 	__ao2_global_obj_replace_unref(&holder, (obj), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 #define ao2_global_obj_replace_unref(holder, obj)	\
 	__ao2_global_obj_replace_unref(&holder, (obj), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+
+#else
+
+#define ao2_t_global_obj_replace_unref(holder, obj, tag)	\
+	__ao2_global_obj_replace_unref(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#define ao2_global_obj_replace_unref(holder, obj)	\
+	__ao2_global_obj_replace_unref(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#endif
+
 int __ao2_global_obj_replace_unref(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name);
 
 /*!
@@ -696,10 +724,19 @@
  * \retval Reference to current ao2 object stored in the holder.
  * \retval NULL if no object available.
  */
+#ifdef REF_DEBUG
 #define ao2_t_global_obj_ref(holder, tag)	\
 	__ao2_global_obj_ref(&holder, (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 #define ao2_global_obj_ref(holder)	\
 	__ao2_global_obj_ref(&holder, "", __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+
+#else
+
+#define ao2_t_global_obj_ref(holder, tag)	\
+	__ao2_global_obj_ref(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#define ao2_global_obj_ref(holder)	\
+	__ao2_global_obj_ref(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
+#endif
 
 void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name);
 

Modified: team/dlee/playback-controls/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/include/asterisk/autoconfig.h.in?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/include/asterisk/autoconfig.h.in (original)
+++ team/dlee/playback-controls/include/asterisk/autoconfig.h.in Fri May 17 09:23:28 2013
@@ -294,7 +294,7 @@
 /* Define if your system has the GLOB_NOMAGIC headers. */
 #undef HAVE_GLOB_NOMAGIC
 
-/* Define to 1 if you have the GMime library. */
+/* Define if your system has the GMIME libraries. */
 #undef HAVE_GMIME
 
 /* Define to indicate the GSM library */
@@ -306,7 +306,7 @@
 /* Define to indicate that gsm.h has no prefix for its location */
 #undef HAVE_GSM_HEADER
 
-/* Define to 1 if you have the gtk2 library. */
+/* Define if your system has the GTK2 libraries. */
 #undef HAVE_GTK2
 
 /* Define to 1 if you have the Hoard Memory Allocator library. */
@@ -324,7 +324,7 @@
 /* Define to 1 if you have the Iksemel Jabber library. */
 #undef HAVE_IKSEMEL
 
-/* Define to 1 if you have the System iLBC library. */
+/* Define if your system has the ILBC libraries. */
 #undef HAVE_ILBC
 
 /* Define if your system has the UW IMAP Toolkit c-client library. */
@@ -376,7 +376,7 @@
 /* Define to 1 if you have the OpenLDAP library. */
 #undef HAVE_LDAP
 
-/* Define to 1 if you have the NetBSD Editline library library. */
+/* Define if your system has the LIBEDIT libraries. */
 #undef HAVE_LIBEDIT
 
 /* Define to 1 if you have the <libintl.h> header file. */
@@ -551,7 +551,7 @@
 /* Define to indicate presence of the pg_encoding_to_char API. */
 #undef HAVE_PGSQL_pg_encoding_to_char
 
-/* Define to 1 if you have the PJPROJECT library. */
+/* Define if your system has the PJPROJECT libraries. */
 #undef HAVE_PJPROJECT
 
 /* Define to 1 if your system defines IP_PKTINFO. */
@@ -765,6 +765,9 @@
 /* Define to 1 if you have the Secure RTP library. */
 #undef HAVE_SRTP
 
+/* Define to 1 if SRTP has the SRTP Library Shutdown Function feature. */
+#undef HAVE_SRTP_SHUTDOWN
+
 /* Define to 1 if you have the ISDN SS7 library. */
 #undef HAVE_SS7
 
@@ -854,19 +857,19 @@
 /* Define to 1 if you have the `strtoq' function. */
 #undef HAVE_STRTOQ
 
-/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
+/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
 
-/* Define to 1 if `uid' is member of `struct sockpeercred'. */
+/* Define to 1 if `uid' is a member of `struct sockpeercred'. */
 #undef HAVE_STRUCT_SOCKPEERCRED_UID
 
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
-/* Define to 1 if `cr_uid' is member of `struct ucred'. */
+/* Define to 1 if `cr_uid' is a member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_CR_UID
 
-/* Define to 1 if `uid' is member of `struct ucred'. */
+/* Define to 1 if `uid' is a member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_UID
 
 /* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -1144,11 +1147,11 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
-
-/* Define to 1 if the C compiler supports function prototypes. */
-#undef PROTOTYPES
 
 /* Define to necessary symbol if this constant uses a non-standard name on
    your system. */
@@ -1168,11 +1171,6 @@
 
 /* Define to the type of arg 5 for `select'. */
 #undef SELECT_TYPE_ARG5
-
-/* Define to 1 if the `setvbuf' function takes the buffering type as its
-   second argument and the buffer pointer as the third, as on System V before
-   release 3. */
-#undef SETVBUF_REVERSED
 
 /* The size of `char *', as computed by sizeof. */
 #undef SIZEOF_CHAR_P
@@ -1209,23 +1207,38 @@
 /* Define to a type of the same size as fd_set.fds_bits[[0]] */
 #undef TYPEOF_FD_SET_FDS_BITS
 
-/* Define to 1 if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
+/* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
-
-/* Define to 1 if running on Darwin. */
-#undef _DARWIN_UNLIMITED_SELECT
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Define to 1 if running on Darwin. */
+#undef _DARWIN_UNLIMITED_SELECT
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
 
 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
 #undef _LARGEFILE_SOURCE
@@ -1242,20 +1255,6 @@
 
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
-
-/* Enable extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-
-/* Define like PROTOTYPES; this can be used by system headers. */
-#undef __PROTOTYPES
 
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const

Modified: team/dlee/playback-controls/include/asterisk/stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/include/asterisk/stasis.h?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/include/asterisk/stasis.h (original)
+++ team/dlee/playback-controls/include/asterisk/stasis.h Fri May 17 09:23:28 2013
@@ -565,10 +565,17 @@
  */
 #define STASIS_MESSAGE_TYPE_INIT(name)					\
 	({								\
+		ast_assert(_priv_ ## name == NULL);			\
 		_priv_ ## name = stasis_message_type_create(#name);	\
 			_priv_ ## name ? 0 : -1;			\
 	})
 
+/*!
+ * \brief Boiler-plate removing macro for cleaning up message types.
+ *
+ * \param name Name of message type.
+ * \since 12
+ */
 #define STASIS_MESSAGE_TYPE_CLEANUP(name)	\
 	({					\
 		ao2_cleanup(_priv_ ## name);	\

Modified: team/dlee/playback-controls/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/include/asterisk/stasis_app.h?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/include/asterisk/stasis_app.h (original)
+++ team/dlee/playback-controls/include/asterisk/stasis_app.h Fri May 17 09:23:28 2013
@@ -44,6 +44,10 @@
  * Finally, Stasis apps control channels through the use of the \ref
  * stasis_app_control object, and the family of \c stasis_app_control_*
  * functions.
+ *
+ * Since module unload order is based on reference counting, any module that
+ * uses the API defined in this file must call stasis_app_ref() when loaded,
+ * and stasis_app_unref() when unloaded.
  */
 
 #include "asterisk/channel.h"
@@ -182,6 +186,20 @@
 int stasis_app_control_queue_control(struct stasis_app_control *control,
 	enum ast_control_frame_type frame_type);
 
+/*!
+ * \brief Increment the res_stasis reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void stasis_app_ref(void);
+
+/*!
+ * \brief Decrement the res_stasis reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void stasis_app_unref(void);
+
 /*! @} */
 
 #endif /* _ASTERISK_STASIS_APP_H */

Modified: team/dlee/playback-controls/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/main/app.c?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/main/app.c (original)
+++ team/dlee/playback-controls/main/app.c Fri May 17 09:23:28 2013
@@ -84,8 +84,9 @@
 
 static struct stasis_topic *mwi_topic_all;
 static struct stasis_caching_topic *mwi_topic_cached;
-static struct stasis_message_type *mwi_state_type;
 static struct stasis_topic_pool *mwi_topic_pool;
+
+STASIS_MESSAGE_TYPE_DEFN(stasis_mwi_state_type);
 
 static void *shaun_of_the_dead(void *data)
 {
@@ -2659,11 +2660,6 @@
 	return mwi_topic_cached;
 }
 
-struct stasis_message_type *stasis_mwi_state_type(void)
-{
-	return mwi_state_type;
-}
-
 struct stasis_topic *stasis_mwi_topic(const char *uniqueid)
 {
 	return stasis_topic_pool_get_topic(mwi_topic_pool, uniqueid);
@@ -2732,8 +2728,7 @@
 	ao2_cleanup(mwi_topic_all);
 	mwi_topic_all = NULL;
 	mwi_topic_cached = stasis_caching_unsubscribe(mwi_topic_cached);
-	ao2_cleanup(mwi_state_type);
-	mwi_state_type = NULL;
+	STASIS_MESSAGE_TYPE_CLEANUP(stasis_mwi_state_type);
 	ao2_cleanup(mwi_topic_pool);
 	mwi_topic_pool = NULL;
 }
@@ -2748,8 +2743,7 @@
 	if (!mwi_topic_cached) {
 		return -1;
 	}
-	mwi_state_type = stasis_message_type_create("stasis_mwi_state");
-	if (!mwi_state_type) {
+	if (STASIS_MESSAGE_TYPE_INIT(stasis_mwi_state_type) != 0) {
 		return -1;
 	}
 	mwi_topic_pool = stasis_topic_pool_create(mwi_topic_all);

Modified: team/dlee/playback-controls/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/main/asterisk.c?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/main/asterisk.c (original)
+++ team/dlee/playback-controls/main/asterisk.c Fri May 17 09:23:28 2013
@@ -415,7 +415,7 @@
 static struct stasis_topic *system_topic;
 
 /*!\ brief The \ref stasis_message_type for network changes */
-static struct stasis_message_type *network_change_type;
+STASIS_MESSAGE_TYPE_DEFN(ast_network_change_type);
 
 #if !defined(LOW_MEMORY)
 struct file_version {
@@ -1063,18 +1063,12 @@
 	return system_topic;
 }
 
-struct stasis_message_type *ast_network_change_type(void)
-{
-	return network_change_type;
-}
-
 /*! \brief Cleanup the \ref stasis system level items */
 static void stasis_system_topic_cleanup(void)
 {
 	ao2_ref(system_topic, -1);
 	system_topic = NULL;
-	ao2_ref(network_change_type, -1);
-	network_change_type = NULL;
+	STASIS_MESSAGE_TYPE_CLEANUP(ast_network_change_type);
 }
 
 /*! \brief Initialize the system level items for \ref stasis */
@@ -1087,8 +1081,7 @@
 		return 1;
 	}
 
-	network_change_type = stasis_message_type_create("network_change");
-	if (!network_change_type) {
+	if (STASIS_MESSAGE_TYPE_INIT(ast_network_change_type) != 0) {
 		return -1;
 	}
 	return 0;

Modified: team/dlee/playback-controls/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/main/astobj2.c?view=diff&rev=388955&r1=388954&r2=388955
==============================================================================
--- team/dlee/playback-controls/main/astobj2.c (original)
+++ team/dlee/playback-controls/main/astobj2.c Fri May 17 09:23:28 2013
@@ -684,7 +684,11 @@
 
 	/* Release the held ao2 object. */
 	if (holder->obj) {
-		__ao2_ref_debug(holder->obj, -1, tag, file, line, func);
+		if (tag) {

[... 2553 lines stripped ...]



More information about the asterisk-commits mailing list