[asterisk-commits] dlee: branch dlee/performance r399637 - in /team/dlee/performance: ./ apps/ c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 23 08:52:42 CDT 2013


Author: dlee
Date: Mon Sep 23 08:52:40 2013
New Revision: 399637

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399637
Log:
Merged revisions 399531-399624 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    team/dlee/performance/   (props changed)
    team/dlee/performance/apps/app_queue.c
    team/dlee/performance/channels/chan_pjsip.c
    team/dlee/performance/main/config_options.c
    team/dlee/performance/main/dial.c
    team/dlee/performance/main/features_config.c
    team/dlee/performance/main/json.c
    team/dlee/performance/main/media_index.c
    team/dlee/performance/res/res_pjsip.c
    team/dlee/performance/res/res_pjsip_session.c
    team/dlee/performance/res/res_rtp_asterisk.c

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

Propchange: team/dlee/performance/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Sep 23 08:52:40 2013
@@ -1,1 +1,1 @@
-/branches/12:1-399528
+/branches/12:1-399636

Modified: team/dlee/performance/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/apps/app_queue.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/apps/app_queue.c (original)
+++ team/dlee/performance/apps/app_queue.c Mon Sep 23 08:52:40 2013
@@ -1952,12 +1952,29 @@
 			agent_snapshot, type, blob);
 }
 
+/*!
+ * \internal
+ * \brief Publish the member blob.
+ * \since 12.0.0
+ *
+ * \param type Stasis message type to publish.
+ * \param blob The information being published.
+ *
+ * \note The json blob reference is passed to this function.
+ *
+ * \return Nothing
+ */
 static void queue_publish_member_blob(struct stasis_message_type *type, struct ast_json *blob)
 {
 	RAII_VAR(struct ast_json_payload *, payload, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 
+	if (!blob) {
+		return;
+	}
+
 	payload = ast_json_payload_create(blob);
+	ast_json_unref(blob);
 	if (!payload) {
 		return;
 	}
@@ -6729,7 +6746,8 @@
 	return res;
 }
 
-static int publish_queue_member_pause(struct call_queue *q, struct member *member, const char *reason) {
+static int publish_queue_member_pause(struct call_queue *q, struct member *member, const char *reason)
+{
 	struct ast_json *json_blob = queue_member_blob_create(q, member);
 
 	if (!json_blob) {

Modified: team/dlee/performance/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/channels/chan_pjsip.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/channels/chan_pjsip.c (original)
+++ team/dlee/performance/channels/chan_pjsip.c Mon Sep 23 08:52:40 2013
@@ -2122,6 +2122,7 @@
 
 	ast_sip_session_unregister_supplement(&chan_pjsip_supplement);
 	ast_sip_session_unregister_supplement(&pbx_start_supplement);
+	ast_sip_session_unregister_supplement(&chan_pjsip_ack_supplement);
 
 	ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
 	ast_channel_unregister(&chan_pjsip_tech);

Modified: team/dlee/performance/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/config_options.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/main/config_options.c (original)
+++ team/dlee/performance/main/config_options.c Mon Sep 23 08:52:40 2013
@@ -478,10 +478,6 @@
 	}
 
 	if (type->type == ACO_GLOBAL && *field) {
-		if (aco_set_defaults(type, cat, *field)) {
-			ast_log(LOG_ERROR, "In %s: Setting defaults for %s failed\n", file->filename, cat);
-			return -1;
-		}
 		if (aco_process_category_options(type, cfg, cat, *field)) {
 			ast_log(LOG_ERROR, "In %s: Processing options for %s failed\n", file->filename, cat);
 			return -1;
@@ -618,6 +614,28 @@
  */
 	while (res != ACO_PROCESS_ERROR && (file = info->files[x++])) {
 		const char *filename = file->filename;
+		struct aco_type *match;
+		int i;
+
+		/* set defaults for global objects */
+		for (i = 0, match = file->types[i]; match; match = file->types[++i]) {
+			void **field = info->internal->pending + match->item_offset;
+
+			if (match->type != ACO_GLOBAL || !*field) {
+				continue;
+			}
+
+			if (aco_set_defaults(match, match->category, *field)) {
+				ast_log(LOG_ERROR, "In %s: Setting defaults for %s failed\n", file->filename, match->category);
+				res = ACO_PROCESS_ERROR;
+				break;
+			}
+		}
+
+		if (res == ACO_PROCESS_ERROR) {
+			break;
+		}
+
 try_alias:
 		if (!(cfg = ast_config_load(filename, cfg_flags))) {
 			if (file->alias && strcmp(file->alias, filename)) {

Modified: team/dlee/performance/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/dial.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/main/dial.c (original)
+++ team/dlee/performance/main/dial.c Mon Sep 23 08:52:40 2013
@@ -398,6 +398,15 @@
 		*stuff++ = '\0';
 		tech = tmp;
 		device = stuff;
+	} else {
+		const char *forward_context;
+		char destination[AST_MAX_CONTEXT + AST_MAX_EXTENSION + 1];
+
+		ast_channel_lock(original);
+		forward_context = pbx_builtin_getvar_helper(original, "FORWARD_CONTEXT");
+		snprintf(destination, sizeof(destination), "%s@%s", tmp, S_OR(forward_context, ast_channel_context(original)));
+		ast_channel_unlock(original);
+		device = ast_strdupa(destination);
 	}
 
 	/* Drop old destination information */
@@ -409,11 +418,13 @@
 	channel->device = ast_strdup(device);
 	AST_LIST_UNLOCK(&dial->channels);
 
+
+	/* Drop the original channel */
+	ast_hangup(original);
+	channel->owner = NULL;
+
 	/* Finally give it a go... send it out into the world */
 	begin_dial_channel(channel, chan, chan ? 0 : 1);
-
-	/* Drop the original channel */
-	ast_hangup(original);
 
 	return 0;
 }

Modified: team/dlee/performance/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/features_config.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/main/features_config.c (original)
+++ team/dlee/performance/main/features_config.c Mon Sep 23 08:52:40 2013
@@ -622,6 +622,7 @@
 
 	ao2_cleanup(cfg->global);
 	ao2_cleanup(cfg->featuremap);
+	ao2_cleanup(cfg->parkinglots);
 	ao2_cleanup(cfg->applicationmap);
 	ao2_cleanup(cfg->featuregroups);
 }
@@ -720,7 +721,7 @@
 		return NULL;
 	}
 
-	cfg->global = global_config_alloc();;
+	cfg->global = global_config_alloc();
 	if (!cfg->global) {
 		return NULL;
 	}

Modified: team/dlee/performance/main/json.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/json.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/main/json.c (original)
+++ team/dlee/performance/main/json.c Mon Sep 23 08:52:40 2013
@@ -213,13 +213,15 @@
 	struct json_mem_list *free_list;
 	struct json_mem *mem;
 
+	if (!json) {
+		return;
+	}
+
 	/* Jansson refcounting is non-atomic; lock it. */
 	{
 		SCOPED_JSON_LOCK(json);
-		if (!json) {
-			return;
-		}
-		json_decref((json_t *)json);
+
+		json_decref((json_t *) json);
 	}
 
 	/* Now free any objects that were ast_json_free()'s while the lock was

Modified: team/dlee/performance/main/media_index.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/media_index.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/main/media_index.c (original)
+++ team/dlee/performance/main/media_index.c Mon Sep 23 08:52:40 2013
@@ -439,6 +439,7 @@
 			/* if there's text in cumulative_description, archive it and start anew */
 			if (file_id_persist && !ast_strlen_zero(ast_str_buffer(cumulative_description))) {
 				RAII_VAR(struct media_variant *, variant, NULL, ao2_cleanup);
+
 				variant = find_variant(index, file_id_persist, variant_str);
 				if (!variant) {
 					variant = alloc_variant(index, file_id_persist, variant_str);
@@ -451,11 +452,10 @@
 				ast_string_field_set(variant, description, ast_str_buffer(cumulative_description));
 
 				ast_str_reset(cumulative_description);
-				ast_free(file_id_persist);
-				file_id_persist = NULL;
-			}
-
-			file_id_persist = strdup(file_identifier);
+			}
+
+			ast_free(file_id_persist);
+			file_id_persist = ast_strdup(file_identifier);
 			description = ast_skip_blanks(description);
 			ast_str_set(&cumulative_description, 0, "%s", description);
 		}
@@ -464,6 +464,7 @@
 	/* handle the last one */
 	if (file_id_persist && !ast_strlen_zero(ast_str_buffer(cumulative_description))) {
 		RAII_VAR(struct media_variant *, variant, NULL, ao2_cleanup);
+
 		variant = find_variant(index, file_id_persist, variant_str);
 		if (!variant) {
 			variant = alloc_variant(index, file_id_persist, variant_str);
@@ -471,12 +472,12 @@
 
 		if (variant) {
 			ast_string_field_set(variant, description, ast_str_buffer(cumulative_description));
-			ast_free(file_id_persist);
 		} else {
 			res = -1;
 		}
 	}
 
+	ast_free(file_id_persist);
 	fclose(f);
 	return res;
 }

Modified: team/dlee/performance/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/res/res_pjsip.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/res/res_pjsip.c (original)
+++ team/dlee/performance/res/res_pjsip.c Mon Sep 23 08:52:40 2013
@@ -1853,7 +1853,8 @@
 	pj_caching_pool_init(&caching_pool, NULL, 1024 * 1024);
 	if (pjsip_endpt_create(&caching_pool.factory, "SIP", &ast_pjsip_endpoint) != PJ_SUCCESS) {
 		ast_log(LOG_ERROR, "Failed to create PJSIP endpoint structure. Aborting load\n");
-		goto error;
+		pj_caching_pool_destroy(&caching_pool);
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	/* PJSIP will automatically try to add a Max-Forwards header. Since we want to control that,
@@ -1864,12 +1865,20 @@
 	memory_pool = pj_pool_create(&caching_pool.factory, "SIP", 1024, 1024, NULL);
 	if (!memory_pool) {
 		ast_log(LOG_ERROR, "Failed to create memory pool for SIP. Aborting load\n");
-		goto error;
+		pjsip_endpt_destroy(ast_pjsip_endpoint);
+		ast_pjsip_endpoint = NULL;
+		pj_caching_pool_destroy(&caching_pool);
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	if (ast_sip_initialize_system()) {
 		ast_log(LOG_ERROR, "Failed to initialize SIP system configuration. Aborting load\n");
-		goto error;
+		pj_pool_release(memory_pool);
+		memory_pool = NULL;
+		pjsip_endpt_destroy(ast_pjsip_endpoint);
+		ast_pjsip_endpoint = NULL;
+		pj_caching_pool_destroy(&caching_pool);
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	sip_get_threadpool_options(&options);
@@ -1877,7 +1886,12 @@
 	sip_threadpool = ast_threadpool_create("SIP", NULL, &options);
 	if (!sip_threadpool) {
 		ast_log(LOG_ERROR, "Failed to create SIP threadpool. Aborting load\n");
-		goto error;
+		pj_pool_release(memory_pool);
+		memory_pool = NULL;
+		pjsip_endpt_destroy(ast_pjsip_endpoint);
+		ast_pjsip_endpoint = NULL;
+		pj_caching_pool_destroy(&caching_pool);
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	pjsip_tsx_layer_init_module(ast_pjsip_endpoint);
@@ -1888,49 +1902,62 @@
 			NULL, PJ_THREAD_DEFAULT_STACK_SIZE * 2, 0, &monitor_thread);
 	if (status != PJ_SUCCESS) {
 		ast_log(LOG_ERROR, "Failed to start SIP monitor thread. Aborting load\n");
-		goto error;
+		pj_pool_release(memory_pool);
+		memory_pool = NULL;
+		pjsip_endpt_destroy(ast_pjsip_endpoint);
+		ast_pjsip_endpoint = NULL;
+		pj_caching_pool_destroy(&caching_pool);
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	ast_sip_initialize_global_headers();
 
 	if (ast_res_pjsip_initialize_configuration()) {
 		ast_log(LOG_ERROR, "Failed to initialize SIP configuration. Aborting load\n");
-		goto error;
+		ast_sip_destroy_global_headers();
+		stop_monitor_thread();
+		pj_pool_release(memory_pool);
+		memory_pool = NULL;
+		pjsip_endpt_destroy(ast_pjsip_endpoint);
+		ast_pjsip_endpoint = NULL;
+		pj_caching_pool_destroy(&caching_pool);
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	if (ast_sip_initialize_distributor()) {
 		ast_log(LOG_ERROR, "Failed to register distributor module. Aborting load\n");
-		goto error;
+		ast_res_pjsip_destroy_configuration();
+		ast_sip_destroy_global_headers();
+		stop_monitor_thread();
+		pj_pool_release(memory_pool);
+		memory_pool = NULL;
+		pjsip_endpt_destroy(ast_pjsip_endpoint);
+		ast_pjsip_endpoint = NULL;
+		pj_caching_pool_destroy(&caching_pool);
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	if (ast_sip_initialize_outbound_authentication()) {
 		ast_log(LOG_ERROR, "Failed to initialize outbound authentication. Aborting load\n");
-		goto error;
-	}
-
-	ast_res_pjsip_init_options_handling(0);
-
-	ast_res_pjsip_init_contact_transports();
-
-return AST_MODULE_LOAD_SUCCESS;
-
-error:
-	ast_sip_destroy_distributor();
-	ast_res_pjsip_destroy_configuration();
-	ast_sip_destroy_global_headers();
-	if (monitor_thread) {
+		ast_sip_destroy_distributor();
+		ast_res_pjsip_destroy_configuration();
+		ast_sip_destroy_global_headers();
 		stop_monitor_thread();
-	}
-	if (memory_pool) {
 		pj_pool_release(memory_pool);
 		memory_pool = NULL;
-	}
-	if (ast_pjsip_endpoint) {
 		pjsip_endpt_destroy(ast_pjsip_endpoint);
 		ast_pjsip_endpoint = NULL;
-	}
-	pj_caching_pool_destroy(&caching_pool);
-	return AST_MODULE_LOAD_DECLINE;
+		pj_caching_pool_destroy(&caching_pool);
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	ast_res_pjsip_init_options_handling(0);
+
+	ast_res_pjsip_init_contact_transports();
+
+	ast_module_ref(ast_module_info->self);
+
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int reload_module(void)
@@ -1942,36 +1969,9 @@
 	return 0;
 }
 
-static int unload_pjsip(void *data)
-{
-	if (memory_pool) {
-		pj_pool_release(memory_pool);
-		memory_pool = NULL;
-	}
-	if (ast_pjsip_endpoint) {
-		pjsip_endpt_destroy(ast_pjsip_endpoint);
-		ast_pjsip_endpoint = NULL;
-	}
-	pj_caching_pool_destroy(&caching_pool);
-	return 0;
-}
-
 static int unload_module(void)
 {
-	ast_res_pjsip_cleanup_options_handling();
-	ast_sip_destroy_distributor();
-	ast_res_pjsip_destroy_configuration();
-	ast_sip_destroy_global_headers();
-	if (monitor_thread) {
-		stop_monitor_thread();
-	}
-	/* The thread this is called from cannot call PJSIP/PJLIB functions,
-	 * so we have to push the work to the threadpool to handle
-	 */
-	ast_sip_push_task_synchronous(NULL, unload_pjsip, NULL);
-
-	ast_threadpool_shutdown(sip_threadpool);
-
+	/* This will never get called as this module can't be unloaded */
 	return 0;
 }
 

Modified: team/dlee/performance/res/res_pjsip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/res/res_pjsip_session.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/res/res_pjsip_session.c (original)
+++ team/dlee/performance/res/res_pjsip_session.c Mon Sep 23 08:52:40 2013
@@ -2134,17 +2134,15 @@
 		return AST_MODULE_LOAD_DECLINE;
 	}
 	ast_sip_register_service(&session_reinvite_module);
+
+	ast_module_ref(ast_module_info->self);
+
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	ast_sip_unregister_service(&session_module);
-	ast_sip_unregister_service(&session_reinvite_module);
-	if (nat_hook) {
-		ast_sorcery_delete(ast_sip_get_sorcery(), nat_hook);
-		nat_hook = NULL;
-	}
+	/* This will never get called as this module can't be unloaded */
 	return 0;
 }
 

Modified: team/dlee/performance/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/res/res_rtp_asterisk.c?view=diff&rev=399637&r1=399636&r2=399637
==============================================================================
--- team/dlee/performance/res/res_rtp_asterisk.c (original)
+++ team/dlee/performance/res/res_rtp_asterisk.c Mon Sep 23 08:52:40 2013
@@ -3210,10 +3210,6 @@
 	int res, packetwords, position = 0;
 	int report_counter = 0;
 	struct ast_rtp_rtcp_report_block *report_block;
-	RAII_VAR(struct ast_rtp_rtcp_report *, rtcp_report,
-			NULL,
-			ao2_cleanup);
-	RAII_VAR(struct ast_json *, message_blob, NULL, ast_json_unref);
 	struct ast_frame *f = &ast_null_frame;
 
 	/* Read in RTCP data from the socket */
@@ -3274,6 +3270,8 @@
 	while (position < packetwords) {
 		int i, pt, rc;
 		unsigned int length;
+		struct ast_json *message_blob;
+		RAII_VAR(struct ast_rtp_rtcp_report *, rtcp_report, NULL, ao2_cleanup);
 
 		i = position;
 		length = ntohl(rtcpheader[i]);
@@ -3397,6 +3395,7 @@
 			ast_rtp_publish_rtcp_message(instance, ast_rtp_rtcp_received_type(),
 					rtcp_report,
 					message_blob);
+			ast_json_unref(message_blob);
 			break;
 		case RTCP_PT_FUR:
 		/* Handle RTCP FIR as FUR */




More information about the asterisk-commits mailing list