[asterisk-commits] jrose: branch jrose/bridge_projects r388170 - in /team/jrose/bridge_projects:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 9 08:03:54 CDT 2013


Author: jrose
Date: Thu May  9 08:03:52 2013
New Revision: 388170

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388170
Log:
automerge

Added:
    team/jrose/bridge_projects/include/asterisk/endpoints.h
      - copied unchanged from r388115, team/group/bridge_construction/include/asterisk/endpoints.h
    team/jrose/bridge_projects/include/asterisk/stasis_endpoints.h
      - copied unchanged from r388115, team/group/bridge_construction/include/asterisk/stasis_endpoints.h
    team/jrose/bridge_projects/include/asterisk/stasis_test.h
      - copied unchanged from r388115, team/group/bridge_construction/include/asterisk/stasis_test.h
    team/jrose/bridge_projects/main/endpoints.c
      - copied unchanged from r388115, team/group/bridge_construction/main/endpoints.c
    team/jrose/bridge_projects/main/stasis_endpoints.c
      - copied unchanged from r388115, team/group/bridge_construction/main/stasis_endpoints.c
    team/jrose/bridge_projects/res/res_stasis_test.c
      - copied unchanged from r388115, team/group/bridge_construction/res/res_stasis_test.c
    team/jrose/bridge_projects/res/res_stasis_test.exports.in
      - copied unchanged from r388115, team/group/bridge_construction/res/res_stasis_test.exports.in
    team/jrose/bridge_projects/tests/test_endpoints.c
      - copied unchanged from r388115, team/group/bridge_construction/tests/test_endpoints.c
    team/jrose/bridge_projects/tests/test_stasis_endpoints.c
      - copied unchanged from r388115, team/group/bridge_construction/tests/test_stasis_endpoints.c
Modified:
    team/jrose/bridge_projects/   (props changed)
    team/jrose/bridge_projects/apps/app_directory.c
    team/jrose/bridge_projects/apps/app_meetme.c
    team/jrose/bridge_projects/apps/app_queue.c
    team/jrose/bridge_projects/apps/app_userevent.c
    team/jrose/bridge_projects/bridges/bridge_builtin_features.c
    team/jrose/bridge_projects/bridges/bridge_holding.c
    team/jrose/bridge_projects/bridges/bridge_simple.c
    team/jrose/bridge_projects/bridges/bridge_softmix.c
    team/jrose/bridge_projects/build_tools/cflags.xml
    team/jrose/bridge_projects/channels/chan_dahdi.c
    team/jrose/bridge_projects/channels/chan_iax2.c
    team/jrose/bridge_projects/channels/chan_sip.c
    team/jrose/bridge_projects/channels/sip/include/sip.h
    team/jrose/bridge_projects/funcs/func_global.c
    team/jrose/bridge_projects/include/asterisk.h
    team/jrose/bridge_projects/include/asterisk/astobj2.h
    team/jrose/bridge_projects/include/asterisk/bridging.h
    team/jrose/bridge_projects/include/asterisk/bridging_technology.h
    team/jrose/bridge_projects/include/asterisk/inline_api.h
    team/jrose/bridge_projects/include/asterisk/json.h
    team/jrose/bridge_projects/include/asterisk/lock.h
    team/jrose/bridge_projects/include/asterisk/sorcery.h
    team/jrose/bridge_projects/include/asterisk/stasis.h
    team/jrose/bridge_projects/include/asterisk/stasis_channels.h
    team/jrose/bridge_projects/main/asterisk.c
    team/jrose/bridge_projects/main/astobj2.c
    team/jrose/bridge_projects/main/bridging.c
    team/jrose/bridge_projects/main/bridging_basic.c
    team/jrose/bridge_projects/main/channel.c
    team/jrose/bridge_projects/main/channel_internal_api.c
    team/jrose/bridge_projects/main/enum.c
    team/jrose/bridge_projects/main/event.c
    team/jrose/bridge_projects/main/manager.c
    team/jrose/bridge_projects/main/manager_channels.c
    team/jrose/bridge_projects/main/sorcery.c
    team/jrose/bridge_projects/main/srv.c
    team/jrose/bridge_projects/main/stasis_cache.c
    team/jrose/bridge_projects/main/stasis_channels.c
    team/jrose/bridge_projects/res/res_config_pgsql.c
    team/jrose/bridge_projects/res/res_rtp_asterisk.c
    team/jrose/bridge_projects/res/res_sorcery_astdb.c
    team/jrose/bridge_projects/res/res_stasis.c
    team/jrose/bridge_projects/res/res_stasis_http_endpoints.c
    team/jrose/bridge_projects/res/res_stasis_websocket.c
    team/jrose/bridge_projects/res/res_stun_monitor.c
    team/jrose/bridge_projects/res/stasis_http/resource_endpoints.c
    team/jrose/bridge_projects/res/stasis_http/resource_endpoints.h
    team/jrose/bridge_projects/rest-api/api-docs/endpoints.json
    team/jrose/bridge_projects/tests/test_sorcery.c
    team/jrose/bridge_projects/tests/test_stasis_channels.c
    team/jrose/bridge_projects/utils/   (props changed)

Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
--- bridge_construction-integrated (original)
+++ bridge_construction-integrated Thu May  9 08:03:52 2013
@@ -1,1 +1,1 @@
-/trunk:1-387545
+/trunk:1-388114

Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
--- bridge_projects-integrated (original)
+++ bridge_projects-integrated Thu May  9 08:03:52 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-387587
+/team/group/bridge_construction:1-388165

Modified: team/jrose/bridge_projects/apps/app_directory.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_directory.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/apps/app_directory.c (original)
+++ team/jrose/bridge_projects/apps/app_directory.c Thu May  9 08:03:52 2013
@@ -440,7 +440,7 @@
 static struct ast_config *realtime_directory(char *context)
 {
 	struct ast_config *cfg;
-	struct ast_config *rtdata;
+	struct ast_config *rtdata = NULL;
 	struct ast_category *cat;
 	struct ast_variable *var;
 	char *mailbox;
@@ -475,7 +475,7 @@
 			rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", "default", SENTINEL);
 			context = "default";
 		}
-	} else {
+	} else if (!ast_strlen_zero(context)) {
 		rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", context, SENTINEL);
 	}
 

Modified: team/jrose/bridge_projects/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_meetme.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/apps/app_meetme.c (original)
+++ team/jrose/bridge_projects/apps/app_meetme.c Thu May  9 08:03:52 2013
@@ -6447,8 +6447,8 @@
 	struct sla_station *station;
 	struct sla_trunk *trunk;
 
-	if (!AST_LIST_EMPTY(&sla.event_q) || !AST_LIST_EMPTY(&sla.ringing_trunks) 
-		|| !AST_LIST_EMPTY(&sla.ringing_stations)) {
+	if (!AST_LIST_EMPTY(&sla.event_q) || !AST_LIST_EMPTY(&sla.ringing_trunks)
+		|| !AST_LIST_EMPTY(&sla.ringing_stations) || !AST_LIST_EMPTY(&sla.failed_stations)) {
 		return;
 	}
 
@@ -6464,8 +6464,9 @@
 
 	AST_RWLIST_RDLOCK(&sla_trunks);
 	AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) {
-		if (trunk->ref_count)
+		if (trunk->ref_count || trunk->chan || trunk->active_stations || trunk->hold_stations) {
 			break;
+		}
 	}
 	AST_RWLIST_UNLOCK(&sla_trunks);
 	if (trunk) {
@@ -6718,7 +6719,7 @@
 		return 0;
 	}
 
-	AST_RWLIST_RDLOCK(&sla_stations);
+	AST_RWLIST_WRLOCK(&sla_stations);
 	station = sla_find_station(station_name);
 	if (station)
 		ast_atomic_fetchadd_int((int *) &station->ref_count, 1);
@@ -6930,7 +6931,7 @@
 		}
 	}
 
-	AST_RWLIST_RDLOCK(&sla_trunks);
+	AST_RWLIST_WRLOCK(&sla_trunks);
 	trunk = sla_find_trunk(args.trunk_name);
 	if (trunk)
 		ast_atomic_fetchadd_int((int *) &trunk->ref_count, 1);

Modified: team/jrose/bridge_projects/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_queue.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/apps/app_queue.c (original)
+++ team/jrose/bridge_projects/apps/app_queue.c Thu May  9 08:03:52 2013
@@ -9915,6 +9915,31 @@
 	if (reload_handler(0, &mask, NULL))
 		return AST_MODULE_LOAD_DECLINE;
 
+	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
+
+	/*
+	 * This section is used to determine which name for 'ringinuse' to use in realtime members
+	 * Necessary for supporting older setups.
+	 */
+	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name LIKE", "%", SENTINEL);
+	if (!member_config) {
+		realtime_ringinuse_field = "ringinuse";
+	} else {
+		const char *config_val;
+		if ((config_val = ast_variable_retrieve(member_config, NULL, "ringinuse"))) {
+			ast_log(LOG_NOTICE, "ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
+			realtime_ringinuse_field = "ringinuse";
+		} else if ((config_val = ast_variable_retrieve(member_config, NULL, "ignorebusy"))) {
+			ast_log(LOG_NOTICE, "ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
+			realtime_ringinuse_field = "ignorebusy";
+		} else {
+			ast_log(LOG_NOTICE, "No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
+			realtime_ringinuse_field = "ringinuse";
+		}
+	}
+
+	ast_config_destroy(member_config);
+
 	if (queue_persistent_members)
 		reload_queue_members();
 
@@ -9954,31 +9979,6 @@
 
 	ast_extension_state_add(NULL, NULL, extension_state_cb, NULL);
 
-	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
-
-	/*
-	 * This section is used to determine which name for 'ringinuse' to use in realtime members
-	 * Necessary for supporting older setups.
-	 */
-	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name LIKE", "%", SENTINEL);
-	if (!member_config) {
-		realtime_ringinuse_field = "ringinuse";
-	} else {
-		const char *config_val;
-		if ((config_val = ast_variable_retrieve(member_config, NULL, "ringinuse"))) {
-			ast_log(LOG_NOTICE, "ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
-			realtime_ringinuse_field = "ringinuse";
-		} else if ((config_val = ast_variable_retrieve(member_config, NULL, "ignorebusy"))) {
-			ast_log(LOG_NOTICE, "ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
-			realtime_ringinuse_field = "ignorebusy";
-		} else {
-			ast_log(LOG_NOTICE, "No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
-			realtime_ringinuse_field = "ringinuse";
-		}
-	}
-
-	ast_config_destroy(member_config);
-
 	return res ? AST_MODULE_LOAD_DECLINE : 0;
 }
 

Modified: team/jrose/bridge_projects/apps/app_userevent.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_userevent.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/apps/app_userevent.c (original)
+++ team/jrose/bridge_projects/apps/app_userevent.c Thu May  9 08:03:52 2013
@@ -93,7 +93,6 @@
 	}
 
 	blob = ast_json_pack("{s: s, s: s, s: s}",
-			     "type", "userevent",
 			     "eventname", args.eventname,
 			     "body", ast_str_buffer(body));
 	if (!blob) {
@@ -101,7 +100,8 @@
 		return -1;
 	}
 
-	msg = ast_channel_blob_create(chan, blob);
+	msg = ast_channel_blob_create(
+		chan, ast_channel_user_event_type(), blob);
 	if (!msg) {
 		return -1;
 	}

Modified: team/jrose/bridge_projects/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/bridges/bridge_builtin_features.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_builtin_features.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_builtin_features.c Thu May  9 08:03:52 2013
@@ -320,8 +320,7 @@
 	}
 
 	/* Create a bridge to use to talk to the person we are calling */
-	attended_bridge = ast_bridge_base_new(
-		AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_1TO1MIX,
+	attended_bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX,
 		AST_BRIDGE_FLAG_DISSOLVE_HANGUP);
 	if (!attended_bridge) {
 		ast_bridge_features_cleanup(&caller_features);

Modified: team/jrose/bridge_projects/bridges/bridge_holding.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/bridges/bridge_holding.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_holding.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_holding.c Thu May  9 08:03:52 2013
@@ -283,7 +283,7 @@
 static struct ast_bridge_technology holding_bridge = {
 	.name = "holding_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_HOLDING,
-	.preference = AST_BRIDGE_PREFERENCE_MEDIUM,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_HOLDING,
 	.write = holding_bridge_write,
 	.join = holding_bridge_join,
 	.leave = holding_bridge_leave,

Modified: team/jrose/bridge_projects/bridges/bridge_simple.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/bridges/bridge_simple.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_simple.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_simple.c Thu May  9 08:03:52 2013
@@ -85,7 +85,7 @@
 static struct ast_bridge_technology simple_bridge = {
 	.name = "simple_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX,
-	.preference = AST_BRIDGE_PREFERENCE_MEDIUM,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_1TO1MIX,
 	.join = simple_bridge_join,
 	.write = simple_bridge_write,
 };

Modified: team/jrose/bridge_projects/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/bridges/bridge_softmix.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_softmix.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_softmix.c Thu May  9 08:03:52 2013
@@ -1091,7 +1091,7 @@
 static struct ast_bridge_technology softmix_bridge = {
 	.name = "softmix",
 	.capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX,
-	.preference = AST_BRIDGE_PREFERENCE_LOW,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_MULTIMIX,
 	.create = softmix_bridge_create,
 	.destroy = softmix_bridge_destroy,
 	.join = softmix_bridge_join,

Modified: team/jrose/bridge_projects/build_tools/cflags.xml
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/build_tools/cflags.xml?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/build_tools/cflags.xml (original)
+++ team/jrose/bridge_projects/build_tools/cflags.xml Thu May  9 08:03:52 2013
@@ -22,6 +22,12 @@
 			<support_level>extended</support_level>
 		</member>
 		<member name="LOW_MEMORY" displayname="Optimize for Low Memory Usage">
+			<support_level>extended</support_level>
+		</member>
+		<member name="DISABLE_INLINE" displayname="Disable the inline API">
+			<!-- Added to work around GCC bug
+			     See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47816
+			  -->
 			<support_level>extended</support_level>
 		</member>
 		<member name="BETTER_BACKTRACES" displayname="Use libbfd (GPL) to generate better inline backtraces">

Modified: team/jrose/bridge_projects/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_dahdi.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/channels/chan_dahdi.c (original)
+++ team/jrose/bridge_projects/channels/chan_dahdi.c Thu May  9 08:03:52 2013
@@ -3271,7 +3271,7 @@
 		}
 		/* Fall through */
 	default:
-		ast_log(LOG_NOTICE, "PRI got event: %s (%d) on D-channel of span %d\n",
+		ast_log(LOG_NOTICE, "Got DAHDI event: %s (%d) on D-channel of span %d\n",
 			event2str(x), x, pri->span);
 		break;
 	}

Modified: team/jrose/bridge_projects/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_iax2.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/channels/chan_iax2.c (original)
+++ team/jrose/bridge_projects/channels/chan_iax2.c Thu May  9 08:03:52 2013
@@ -283,9 +283,9 @@
 static char language[MAX_LANGUAGE] = "";
 static char regcontext[AST_MAX_CONTEXT] = "";
 
-static struct ast_event_sub *network_change_event_subscription; /*!< subscription id for network change events */
+static struct stasis_subscription *network_change_sub; /*!< subscription id for network change events */
 static struct stasis_subscription *acl_change_sub; /*!< subscription id for ACL change events */
-static int network_change_event_sched_id = -1;
+static int network_change_sched_id = -1;
 
 static int maxauthreq = 3;
 static int max_retries = 4;
@@ -1254,7 +1254,7 @@
 static int get_unused_callno(enum callno_type type, int validated, callno_entry *entry);
 static int replace_callno(const void *obj);
 static void sched_delay_remove(struct sockaddr_in *sin, callno_entry entry);
-static void network_change_event_cb(const struct ast_event *, void *);
+static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message);
 static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message);
 
 static struct ast_channel_tech iax2_tech = {
@@ -1323,18 +1323,18 @@
 	 * is time to send MWI, since it is only sent with a REGACK. */
 }
 
-static void network_change_event_subscribe(void)
-{
-	if (!network_change_event_subscription) {
-		network_change_event_subscription = ast_event_subscribe(AST_EVENT_NETWORK_CHANGE,
-			network_change_event_cb, "IAX2 Network Change", NULL, AST_EVENT_IE_END);
-	}
-}
-
-static void network_change_event_unsubscribe(void)
-{
-	if (network_change_event_subscription) {
-		network_change_event_subscription = ast_event_unsubscribe(network_change_event_subscription);
+static void network_change_stasis_subscribe(void)
+{
+	if (!network_change_sub) {
+		network_change_sub = stasis_subscribe(ast_system_topic(),
+			network_change_stasis_cb, NULL);
+	}
+}
+
+static void network_change_stasis_unsubscribe(void)
+{
+	if (network_change_sub) {
+		network_change_sub = stasis_unsubscribe(network_change_sub);
 	}
 }
 
@@ -1353,10 +1353,10 @@
 	}
 }
 
-static int network_change_event_sched_cb(const void *data)
+static int network_change_sched_cb(const void *data)
 {
 	struct iax2_registry *reg;
-	network_change_event_sched_id = -1;
+	network_change_sched_id = -1;
 	AST_LIST_LOCK(&registrations);
 	AST_LIST_TRAVERSE(&registrations, reg, entry) {
 		iax2_do_register(reg);
@@ -1366,13 +1366,18 @@
 	return 0;
 }
 
-static void network_change_event_cb(const struct ast_event *event, void *userdata)
-{
-	ast_debug(1, "IAX, got a network change event, renewing all IAX registrations.\n");
-	if (network_change_event_sched_id == -1) {
-		network_change_event_sched_id = iax2_sched_add(sched, 1000, network_change_event_sched_cb, NULL);
-	}
-
+static void network_change_stasis_cb(void *data, struct stasis_subscription *sub,
+	struct stasis_topic *topic, struct stasis_message *message)
+{
+	/* This callback is only concerned with network change messages from the system topic. */
+	if (stasis_message_type(message) != ast_network_change_type()) {
+		return;
+	}
+
+	ast_verb(1, "IAX, got a network change message, renewing all IAX registrations.\n");
+	if (network_change_sched_id == -1) {
+		network_change_sched_id = iax2_sched_add(sched, 1000, network_change_sched_cb, NULL);
+	}
 }
 
 static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub,
@@ -13442,9 +13447,9 @@
 	}
 
 	if (subscribe_network_change) {
-		network_change_event_subscribe();
+		network_change_stasis_subscribe();
 	} else {
-		network_change_event_unsubscribe();
+		network_change_stasis_unsubscribe();
 	}
 
 	if (defaultsockfd < 0) {
@@ -14287,7 +14292,7 @@
 	struct ast_context *con;
 	int x;
 
-	network_change_event_unsubscribe();
+	network_change_stasis_unsubscribe();
 	acl_change_stasis_unsubscribe();
 
 	ast_manager_unregister("IAXpeers");
@@ -14789,7 +14794,7 @@
 
 	ast_realtime_require_field("iaxpeers", "name", RQ_CHAR, 10, "ipaddr", RQ_CHAR, 15, "port", RQ_UINTEGER2, 5, "regseconds", RQ_UINTEGER2, 6, SENTINEL);
 
-	network_change_event_subscribe();
+	network_change_stasis_subscribe();
 
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: team/jrose/bridge_projects/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_sip.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/channels/chan_sip.c (original)
+++ team/jrose/bridge_projects/channels/chan_sip.c Thu May  9 08:03:52 2013
@@ -295,6 +295,7 @@
 #include "sip/include/security_events.h"
 #include "asterisk/sip_api.h"
 #include "asterisk/app.h"
+#include "asterisk/stasis_endpoints.h"
 
 /*** DOCUMENTATION
 	<application name="SIPDtmfMode" language="en_US">
@@ -843,9 +844,9 @@
 static struct ast_flags global_flags[3] = {{0}};  /*!< global SIP_ flags */
 static int global_t38_maxdatagram;                /*!< global T.38 FaxMaxDatagram override */
 
-static struct ast_event_sub *network_change_event_subscription; /*!< subscription id for network change events */
+static struct stasis_subscription *network_change_sub; /*!< subscription id for network change events */
 static struct stasis_subscription *acl_change_sub; /*!< subscription id for named ACL system change events */
-static int network_change_event_sched_id = -1;
+static int network_change_sched_id = -1;
 
 static char used_context[AST_MAX_CONTEXT];        /*!< name of automatically created context for unloading */
 
@@ -1286,7 +1287,7 @@
 static void sip_poke_all_peers(void);
 static void sip_peer_hold(struct sip_pvt *p, int hold);
 static void mwi_event_cb(void *, struct stasis_subscription *, struct stasis_topic *, struct stasis_message *);
-static void network_change_event_cb(const struct ast_event *, void *);
+static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message);
 static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message);
 static void sip_keepalive_all_peers(void);
 
@@ -5326,6 +5327,9 @@
 	peer->caps = ast_format_cap_destroy(peer->caps);
 
 	ast_rtp_dtls_cfg_free(&peer->dtls_cfg);
+
+	ast_endpoint_shutdown(peer->endpoint);
+	peer->endpoint = NULL;
 }
 
 /*! \brief Update peer data in database (if used) */
@@ -8012,6 +8016,14 @@
 		return NULL;
 	}
 
+	if (i->relatedpeer) {
+		if (ast_endpoint_add_channel(i->relatedpeer->endpoint, tmp)) {
+			ast_channel_unref(tmp);
+			sip_pvt_lock(i);
+			return NULL;
+		}
+	}
+
 	/* If we sent in a callid, bind it to the channel. */
 	if (callid) {
 		ast_channel_callid_set(tmp, callid);
@@ -14805,7 +14817,20 @@
 
 	p->pendinginvite = p->ocseq;	/* Remember that we have a pending NOTIFY in order not to confuse the NOTIFY subsystem */
 
-	return send_request(p, &req, XMIT_RELIABLE, p->ocseq);
+	/* Send as XMIT_CRITICAL as we may never receive a 200 OK Response which clears p->pendinginvite.
+	 *
+	 * extensionstate_update() uses p->pendinginvite for queuing control.
+	 * Updates stall if pendinginvite <> 0.
+	 *
+	 * The most appropriate solution is to remove the subscription when the NOTIFY transaction fails.
+	 * The client will re-subscribe after restarting or maxexpiry timeout.
+	 */
+
+	/* RFC6665 4.2.2.  Sending State Information to Subscribers
+	 * If the NOTIFY request fails due to expiration of SIP Timer F (transaction timeout),
+	 * the notifier SHOULD remove the subscription.
+	 */
+	return send_request(p, &req, XMIT_CRITICAL, p->ocseq);
 }
 
 /*! \brief Notify user of messages waiting in voicemail (RFC3842)
@@ -16707,18 +16732,18 @@
 	}
 }
 
-static void network_change_event_subscribe(void)
-{
-	if (!network_change_event_subscription) {
-		network_change_event_subscription = ast_event_subscribe(AST_EVENT_NETWORK_CHANGE,
-			network_change_event_cb, "SIP Network Change", NULL, AST_EVENT_IE_END);
-	}
-}
-
-static void network_change_event_unsubscribe(void)
-{
-	if (network_change_event_subscription) {
-		network_change_event_subscription = ast_event_unsubscribe(network_change_event_subscription);
+static void network_change_stasis_subscribe(void)
+{
+	if (!network_change_sub) {
+		network_change_sub = stasis_subscribe(ast_system_topic(),
+			network_change_stasis_cb, NULL);
+	}
+}
+
+static void network_change_stasis_unsubscribe(void)
+{
+	if (network_change_sub) {
+		network_change_sub = stasis_unsubscribe(network_change_sub);
 	}
 }
 
@@ -16731,26 +16756,31 @@
 
 }
 
-static void acl_change_event_unsubscribe(void)
+static void acl_change_event_stasis_unsubscribe(void)
 {
 	if (acl_change_sub) {
 		acl_change_sub = stasis_unsubscribe(acl_change_sub);
 	}
 }
 
-static int network_change_event_sched_cb(const void *data)
-{
-	network_change_event_sched_id = -1;
+static int network_change_sched_cb(const void *data)
+{
+	network_change_sched_id = -1;
 	sip_send_all_registers();
 	sip_send_all_mwi_subscriptions();
 	return 0;
 }
 
-static void network_change_event_cb(const struct ast_event *event, void *userdata)
-{
-	ast_debug(1, "SIP, got a network change event, renewing all SIP registrations.\n");
-	if (network_change_event_sched_id == -1) {
-		network_change_event_sched_id = ast_sched_add(sched, 1000, network_change_event_sched_cb, NULL);
+static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message)
+{
+	/* This callback is only concerned with network change messages from the system topic. */
+	if (stasis_message_type(message) != ast_network_change_type()) {
+		return;
+	}
+
+	ast_verb(1, "SIP, got a network change message, renewing all SIP registrations.\n");
+	if (network_change_sched_id == -1) {
+		network_change_sched_id = ast_sched_add(sched, 1000, network_change_sched_cb, NULL);
 	}
 }
 
@@ -30750,6 +30780,9 @@
 			firstpass = 0;
 	} else {
 		if (!(peer = ao2_t_alloc(sizeof(*peer), sip_destroy_peer_fn, "allocate a peer struct"))) {
+			return NULL;
+		}
+		if (!(peer->endpoint = ast_endpoint_create("SIP", name))) {
 			return NULL;
 		}
 		if (!(peer->caps = ast_format_cap_alloc_nolock())) {
@@ -32329,9 +32362,9 @@
 	}
 
 	if (subscribe_network_change) {
-		network_change_event_subscribe();
+		network_change_stasis_subscribe();
 	} else {
-		network_change_event_unsubscribe();
+		network_change_stasis_unsubscribe();
 	}
 
 	if (global_t1 < global_t1min) {
@@ -34819,7 +34852,7 @@
 
 
 	sip_register_tests();
-	network_change_event_subscribe();
+	network_change_stasis_subscribe();
 
 	ast_websocket_add_protocol("sip", sip_websocket_callback);
 
@@ -34839,8 +34872,8 @@
 
 	ast_websocket_remove_protocol("sip", sip_websocket_callback);
 
-	network_change_event_unsubscribe();
-	acl_change_event_unsubscribe();
+	network_change_stasis_unsubscribe();
+	acl_change_event_stasis_unsubscribe();
 
 	ast_sched_dump(sched);
 

Modified: team/jrose/bridge_projects/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/sip/include/sip.h?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/channels/sip/include/sip.h (original)
+++ team/jrose/bridge_projects/channels/sip/include/sip.h Thu May  9 08:03:52 2013
@@ -1377,6 +1377,8 @@
 	unsigned int disallowed_methods;
 	struct ast_cc_config_params *cc_params;
 
+	struct ast_endpoint *endpoint;
+
 	struct ast_rtp_dtls_cfg dtls_cfg;
 };
 

Modified: team/jrose/bridge_projects/funcs/func_global.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/funcs/func_global.c?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/funcs/func_global.c (original)
+++ team/jrose/bridge_projects/funcs/func_global.c Thu May  9 08:03:52 2013
@@ -39,7 +39,7 @@
 #include "asterisk/pbx.h"
 #include "asterisk/channel.h"
 #include "asterisk/app.h"
-#include "asterisk/manager.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<function name="GLOBAL" language="en_US">
@@ -83,7 +83,25 @@
 			using it in a set of calculations (or you might be surprised by the result).</para>
 		</description>
 	</function>
-
+	<managerEvent language="en_US" name="VarSet">
+		<managerEventInstance class="EVENT_FLAG_DIALPLAN">
+			<synopsis>Raised when a variable is shared between channels.</synopsis>
+			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
+				<parameter name="Variable">
+					<para>The SHARED variable being set.</para>
+					<note><para>The variable name will always be enclosed with
+					<literal>SHARED()</literal></para></note>
+				</parameter>
+				<parameter name="Value">
+					<para>The new value of the variable.</para>
+				</parameter>
+			</syntax>
+			<see-also>
+				<ref type="function">SHARED</ref>
+			</see-also>
+		</managerEventInstance>
+	</managerEvent>
  ***/
 
 static void shared_variable_free(void *data);
@@ -197,6 +215,8 @@
 		AST_APP_ARG(chan);
 	);
 	struct ast_channel *c_ref = NULL;
+	int len;
+	RAII_VAR(char *, shared_buffer, NULL, ast_free);
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "SHARED() requires an argument: SHARED(<var>[,<chan>])\n");
@@ -213,6 +233,15 @@
 			return -1;
 		}
 		chan = c_ref;
+	}
+
+	len = 9 + strlen(args.var); /* SHARED() + var */
+	shared_buffer = ast_malloc(len);
+	if (!shared_buffer) {
+		if (c_ref) {
+			ast_channel_unref(c_ref);
+		}
+		return -1;
 	}
 
 	ast_channel_lock(chan);
@@ -255,13 +284,9 @@
 
 	var = ast_var_assign(args.var, S_OR(value, ""));
 	AST_LIST_INSERT_HEAD(varshead, var, entries);
-	manager_event(EVENT_FLAG_DIALPLAN, "VarSet", 
-		"Channel: %s\r\n"
-		"Variable: SHARED(%s)\r\n"
-		"Value: %s\r\n"
-		"Uniqueid: %s\r\n", 
-		chan ? ast_channel_name(chan) : "none", args.var, value, 
-		chan ? ast_channel_uniqueid(chan) : "none");
+
+	sprintf(shared_buffer, "SHARED(%s)", args.var);
+	ast_channel_publish_varset(chan, shared_buffer, value);
 
 	ast_channel_unlock(chan);
 

Modified: team/jrose/bridge_projects/include/asterisk.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk.h?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/include/asterisk.h (original)
+++ team/jrose/bridge_projects/include/asterisk.h Thu May  9 08:03:52 2013
@@ -200,6 +200,27 @@
 #define ast_mark(a, b) do { } while (0)
 #endif /* LOW_MEMORY */
 
+/*!
+ * \since 12
+ * \brief A \ref stasis topic which publishes messages regarding system changes
+ *
+ * \retval \ref stasis_topic for system level changes
+ * \retval NULL on error
+ */
+struct stasis_topic *ast_system_topic(void);
+
+/*!
+ * \since 12
+ * \brief A \ref stasis_message_type for network changes
+ *
+ * \retval NULL on error
+ * \retval \ref stasis_message_type for network changes
+ *
+ * \note Messages of this type should always be issued on and expected from
+ *       the \ref ast_system_topic \ref stasis topic
+ */
+struct stasis_message_type *ast_network_change_type(void);
+
 /*! \brief
  * Definition of various structures that many asterisk files need,
  * but only because they need to know that the type exists.

Modified: team/jrose/bridge_projects/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/astobj2.h?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/astobj2.h (original)
+++ team/jrose/bridge_projects/include/asterisk/astobj2.h Thu May  9 08:03:52 2013
@@ -383,12 +383,19 @@
 
 
 
-/*! \brief
- * Typedef for an object destructor. This is called just before freeing
- * the memory for the object. It is passed a pointer to the user-defined
- * data of the object.
- */
-typedef void (*ao2_destructor_fn)(void *);
+/*!
+ * \brief Typedef for an object destructor.
+ *
+ * \param vdoomed Object to destroy.
+ *
+ * \details
+ * This is called just before freeing the memory for the object.
+ * It is passed a pointer to the user-defined data of the
+ * object.
+ *
+ * \return Nothing
+ */
+typedef void (*ao2_destructor_fn)(void *vdoomed);
 
 /*! \brief Options available when allocating an ao2 object. */
 enum ao2_alloc_opts {
@@ -1899,7 +1906,19 @@
  * \retval AO2 container for strings
  * \retval NULL if allocation failed
  */
-struct ao2_container *ast_str_container_alloc(int buckets);
+#define ast_str_container_alloc(buckets) ast_str_container_alloc_options(AO2_ALLOC_OPT_LOCK_MUTEX, buckets)
+
+/*!
+ * \since 12
+ * \brief Allocates a hash container for bare strings
+ *
+ * \param opts Options to be provided to the container
+ * \param buckets The number of buckets to use for the hash container
+ *
+ * \retval AO2 container for strings
+ * \retval NULL if allocation failed
+ */
+struct ao2_container *ast_str_container_alloc_options(enum ao2_container_opts opts, int buckets);
 
 /*!
  * \since 12
@@ -1913,7 +1932,13 @@
  */
 int ast_str_container_add(struct ao2_container *str_container, const char *add);
 
-
-
+/*!
+ * \since 12
+ * \brief Removes a string from a string container allocated by ast_str_container_alloc
+ *
+ * \param str_container The container from which to remove a string
+ * \param remove The string to remove from the container
+ */
+void ast_str_container_remove(struct ao2_container *str_container, const char *remove);
 
 #endif /* _ASTERISK_ASTOBJ2_H */

Modified: team/jrose/bridge_projects/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/bridging.h?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/bridging.h (original)
+++ team/jrose/bridge_projects/include/asterisk/bridging.h Thu May  9 08:03:52 2013
@@ -76,15 +76,15 @@
 
 /*! \brief Capabilities for a bridge technology */
 enum ast_bridge_capability {
-	/*! Bridge technology can service calls on hold */
+	/*! Bridge technology can service calls on hold. */
 	AST_BRIDGE_CAPABILITY_HOLDING = (1 << 0),
-	/*! Bridge waits for channel to answer.  Passes early media. */
+	/*! Bridge waits for channel to answer.  Passes early media. (XXX Not supported yet) */
 	AST_BRIDGE_CAPABILITY_EARLY = (1 << 1),
-	/*! Bridge should natively bridge two channels if possible */
+	/*! Bridge is capable of natively bridging two channels. (Smart bridge only) */
 	AST_BRIDGE_CAPABILITY_NATIVE = (1 << 2),
-	/*! Bridge is only capable of mixing 2 channels */
+	/*! Bridge is capable of mixing at most two channels. (Smart bridgeable) */
 	AST_BRIDGE_CAPABILITY_1TO1MIX = (1 << 3),
-	/*! Bridge is capable of mixing 2 or more channels */
+	/*! Bridge is capable of mixing an arbitrary number of channels. (Smart bridgeable) */
 	AST_BRIDGE_CAPABILITY_MULTIMIX = (1 << 4),
 };
 
@@ -406,6 +406,8 @@
 	struct ast_bridge_video_mode video_mode;
 	/*! Bridge flags to tweak behavior */
 	struct ast_flags feature_flags;
+	/*! Allowed bridge technology capabilities when AST_BRIDGE_FLAG_SMART enabled. */
+	uint32_t allowed_capabilities;
 	/*! Number of channels participating in the bridge */
 	unsigned int num_channels;
 	/*! Number of active channels in the bridge. */
@@ -574,25 +576,6 @@
 	} while (0)
 
 /*!
- * \brief See if it is possible to create a bridge
- *
- * \param capabilities The capabilities that the bridge will use
- *
- * \retval 1 if possible
- * \retval 0 if not possible
- *
- * Example usage:
- *
- * \code
- * int possible = ast_bridge_check(AST_BRIDGE_CAPABILITY_1TO1MIX);
- * \endcode
- *
- * This sees if it is possible to create a bridge capable of bridging two channels
- * together.
- */
-int ast_bridge_check(uint32_t capabilities);
-
-/*!
  * \brief Destroy a bridge
  *
  * \param bridge Bridge to destroy

Modified: team/jrose/bridge_projects/include/asterisk/bridging_technology.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/bridging_technology.h?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/bridging_technology.h (original)
+++ team/jrose/bridge_projects/include/asterisk/bridging_technology.h Thu May  9 08:03:52 2013
@@ -28,14 +28,17 @@
 extern "C" {
 #endif
 
-/*! \brief Preference for choosing the bridge technology */
+/*!
+ * \brief Base preference values for choosing a bridge technology.
+ *
+ * \note Higher is more preference.
+ */
 enum ast_bridge_preference {
-	/*! Bridge technology should have high precedence over other bridge technologies */
-	AST_BRIDGE_PREFERENCE_HIGH = 0,
-	/*! Bridge technology is decent, not the best but should still be considered over low */
-	AST_BRIDGE_PREFERENCE_MEDIUM,
-	/*! Bridge technology is low, it should not be considered unless it is absolutely needed */
-	AST_BRIDGE_PREFERENCE_LOW,
+	AST_BRIDGE_PREFERENCE_BASE_HOLDING  = 50,
+	AST_BRIDGE_PREFERENCE_BASE_EARLY    = 100,
+	AST_BRIDGE_PREFERENCE_BASE_NATIVE   = 90,
+	AST_BRIDGE_PREFERENCE_BASE_1TO1MIX  = 50,
+	AST_BRIDGE_PREFERENCE_BASE_MULTIMIX = 10,
 };
 
 /*!

Modified: team/jrose/bridge_projects/include/asterisk/inline_api.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/inline_api.h?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/inline_api.h (original)
+++ team/jrose/bridge_projects/include/asterisk/inline_api.h Thu May  9 08:03:52 2013
@@ -43,7 +43,7 @@
   including the header file
  */
 
-#if !defined(LOW_MEMORY)
+#if !defined(LOW_MEMORY) && !defined(DISABLE_INLINE)
 
 #if !defined(AST_API_MODULE)
 #define AST_INLINE_API(hdr, body) hdr; extern inline hdr body

Modified: team/jrose/bridge_projects/include/asterisk/json.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/json.h?view=diff&rev=388170&r1=388169&r2=388170
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/json.h (original)
+++ team/jrose/bridge_projects/include/asterisk/json.h Thu May  9 08:03:52 2013
@@ -24,9 +24,54 @@
  * \brief Asterisk JSON abstraction layer.
  * \since 12.0.0
  *
- * This is a very thin wrapper around the Jansson API. For more details on it, see its
- * docs at http://www.digip.org/jansson/doc/2.4/apiref.html.
-
+ * This is a very thin wrapper around the Jansson API. For more details on it,
+ * see its docs at http://www.digip.org/jansson/doc/2.4/apiref.html.
+ *
+ * Rather than provide the multiple ways of doing things that the Jansson API
+ * does, the Asterisk wrapper is always reference-stealing, and always NULL
+ * safe.
+ *

[... 3103 lines stripped ...]



More information about the asterisk-commits mailing list