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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 13 16:09:12 CDT 2013


Author: jrose
Date: Mon May 13 16:09:09 2013
New Revision: 388603

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

Added:
    team/jrose/bridge_projects/bridges/bridge_native_rtp.c
      - copied unchanged from r388600, team/group/bridge_construction/bridges/bridge_native_rtp.c
    team/jrose/bridge_projects/include/asterisk/core_local.h
      - copied unchanged from r388600, team/group/bridge_construction/include/asterisk/core_local.h
    team/jrose/bridge_projects/include/asterisk/core_unreal.h
      - copied unchanged from r388600, team/group/bridge_construction/include/asterisk/core_unreal.h
    team/jrose/bridge_projects/main/core_local.c
      - copied unchanged from r388600, team/group/bridge_construction/main/core_local.c
    team/jrose/bridge_projects/main/core_unreal.c
      - copied unchanged from r388600, team/group/bridge_construction/main/core_unreal.c
    team/jrose/bridge_projects/rest-api-templates/event_function_decl.mustache
      - copied unchanged from r388600, team/group/bridge_construction/rest-api-templates/event_function_decl.mustache
Removed:
    team/jrose/bridge_projects/channels/chan_local.c
Modified:
    team/jrose/bridge_projects/   (props changed)
    team/jrose/bridge_projects/CHANGES
    team/jrose/bridge_projects/addons/chan_ooh323.c
    team/jrose/bridge_projects/apps/app_bridgewait.c
    team/jrose/bridge_projects/apps/app_chanspy.c
    team/jrose/bridge_projects/apps/app_confbridge.c
    team/jrose/bridge_projects/apps/app_dial.c
    team/jrose/bridge_projects/apps/app_followme.c
    team/jrose/bridge_projects/apps/app_mixmonitor.c
    team/jrose/bridge_projects/apps/app_queue.c
    team/jrose/bridge_projects/apps/app_stasis.c
    team/jrose/bridge_projects/apps/app_userevent.c
    team/jrose/bridge_projects/bridges/bridge_builtin_features.c
    team/jrose/bridge_projects/channels/chan_agent.c
    team/jrose/bridge_projects/channels/chan_gulp.c
    team/jrose/bridge_projects/channels/chan_h323.c
    team/jrose/bridge_projects/channels/chan_iax2.c
    team/jrose/bridge_projects/channels/chan_jingle.c
    team/jrose/bridge_projects/channels/chan_mgcp.c
    team/jrose/bridge_projects/channels/chan_motif.c
    team/jrose/bridge_projects/channels/chan_sip.c
    team/jrose/bridge_projects/channels/chan_skinny.c
    team/jrose/bridge_projects/channels/chan_unistim.c
    team/jrose/bridge_projects/channels/misdn/isdn_msg_parser.c
    team/jrose/bridge_projects/include/asterisk/_private.h
    team/jrose/bridge_projects/include/asterisk/bridging.h
    team/jrose/bridge_projects/include/asterisk/bridging_features.h
    team/jrose/bridge_projects/include/asterisk/ccss.h
    team/jrose/bridge_projects/include/asterisk/channel.h
    team/jrose/bridge_projects/include/asterisk/framehook.h
    team/jrose/bridge_projects/include/asterisk/rtp_engine.h
    team/jrose/bridge_projects/include/asterisk/stasis.h
    team/jrose/bridge_projects/include/asterisk/stasis_app.h
    team/jrose/bridge_projects/include/asterisk/stasis_bridging.h
    team/jrose/bridge_projects/include/asterisk/stasis_channels.h
    team/jrose/bridge_projects/main/asterisk.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/loader.c
    team/jrose/bridge_projects/main/manager.c
    team/jrose/bridge_projects/main/manager_channels.c
    team/jrose/bridge_projects/main/pbx.c
    team/jrose/bridge_projects/main/rtp_engine.c
    team/jrose/bridge_projects/main/stasis_bridging.c
    team/jrose/bridge_projects/main/stasis_channels.c
    team/jrose/bridge_projects/pbx/pbx_dundi.c
    team/jrose/bridge_projects/res/parking/   (props changed)
    team/jrose/bridge_projects/res/res_config_odbc.c
    team/jrose/bridge_projects/res/res_srtp.c
    team/jrose/bridge_projects/res/res_stasis.c
    team/jrose/bridge_projects/res/res_stasis_http.c
    team/jrose/bridge_projects/res/res_stasis_http_asterisk.c
    team/jrose/bridge_projects/res/res_stasis_http_bridges.c
    team/jrose/bridge_projects/res/res_stasis_http_channels.c
    team/jrose/bridge_projects/res/res_stasis_http_endpoints.c
    team/jrose/bridge_projects/res/res_stasis_http_events.c
    team/jrose/bridge_projects/res/res_stasis_http_playback.c
    team/jrose/bridge_projects/res/res_stasis_http_recordings.c
    team/jrose/bridge_projects/res/res_stasis_http_sounds.c
    team/jrose/bridge_projects/res/res_stasis_websocket.c
    team/jrose/bridge_projects/res/stasis_http/resource_endpoints.h
    team/jrose/bridge_projects/res/stasis_http/resource_events.h
    team/jrose/bridge_projects/res/stasis_http/resource_recordings.h
    team/jrose/bridge_projects/res/stasis_http/resource_sounds.h
    team/jrose/bridge_projects/rest-api-templates/asterisk_processor.py
    team/jrose/bridge_projects/rest-api-templates/res_stasis_http_resource.c.mustache
    team/jrose/bridge_projects/rest-api-templates/stasis_http_resource.h.mustache
    team/jrose/bridge_projects/rest-api-templates/swagger_model.py
    team/jrose/bridge_projects/rest-api/api-docs/events.json
    team/jrose/bridge_projects/tests/test_res_stasis.c

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 Mon May 13 16:09:09 2013
@@ -1,1 +1,1 @@
-/trunk:1-388176
+/trunk:1-388579

Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
--- bridge_projects-integrated (original)
+++ bridge_projects-integrated Mon May 13 16:09:09 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-388226
+/team/group/bridge_construction:1-388600

Modified: team/jrose/bridge_projects/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/CHANGES?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/CHANGES (original)
+++ team/jrose/bridge_projects/CHANGES Mon May 13 16:09:09 2013
@@ -84,6 +84,8 @@
 ------------------
  * The /b option is removed.
 
+ * chan_local moved into the system core and is no longer a loadable module.
+
 chan_mobile
 ------------------
  * Added general support for busy detection.
@@ -217,6 +219,12 @@
  * All future modules which utilize Sorcery for object persistence must have a
    column named "id" within their schema when using the Sorcery realtime module.
    This column must be able to contain a string of up to 128 characters in length.
+
+app_userevent
+------------------
+ * UserEvent will now handle duplicate keys by overwriting the previous value
+   assigned to the key. UserEvent invocations will also be distributed to any
+   interested res_stasis applications.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 10 to Asterisk 11 --------------------

Modified: team/jrose/bridge_projects/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/addons/chan_ooh323.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/addons/chan_ooh323.c (original)
+++ team/jrose/bridge_projects/addons/chan_ooh323.c Mon May 13 16:09:09 2013
@@ -117,7 +117,6 @@
 	.fixup = ooh323_fixup,
 	.send_html = 0,
 	.queryoption = ooh323_queryoption,
-	.bridge = ast_rtp_instance_bridge,		/* XXX chan unlocked ? */
 	.early_bridge = ast_rtp_instance_early_bridge,
 	.func_channel_read = function_ooh323_read,
 	.func_channel_write = function_ooh323_write,

Modified: team/jrose/bridge_projects/apps/app_bridgewait.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_bridgewait.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_bridgewait.c (original)
+++ team/jrose/bridge_projects/apps/app_bridgewait.c Mon May 13 16:09:09 2013
@@ -28,6 +28,7 @@
  */
 
 /*** MODULEINFO
+	<depend>bridge_holding</depend>
 	<support_level>core</support_level>
  ***/
 
@@ -197,7 +198,7 @@
 	if (!holding_bridge) {
 		holding_bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_HOLDING,
 			AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
-				| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM);
+				| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED);
 	}
 	ast_mutex_unlock(&bridgewait_lock);
 	if (!holding_bridge) {

Modified: team/jrose/bridge_projects/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_chanspy.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_chanspy.c (original)
+++ team/jrose/bridge_projects/apps/app_chanspy.c Mon May 13 16:09:09 2013
@@ -482,15 +482,18 @@
 static int start_spying(struct ast_autochan *autochan, const char *spychan_name, struct ast_audiohook *audiohook)
 {
 	int res = 0;
-	struct ast_channel *peer = NULL;
 
 	ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan_name, ast_channel_name(autochan->chan));
 
 	ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC | AST_AUDIOHOOK_SMALL_QUEUE);
 	res = ast_audiohook_attach(autochan->chan, audiohook);
 
-	if (!res && ast_test_flag(ast_channel_flags(autochan->chan), AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(autochan->chan))) {
-		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
+	if (!res) {
+		ast_channel_lock(autochan->chan);
+		if (ast_channel_is_bridged(autochan->chan)) {
+			ast_softhangup_nolock(autochan->chan, AST_SOFTHANGUP_UNBRIDGE);
+		}
+		ast_channel_unlock(autochan->chan);
 	}
 	return res;
 }

Modified: team/jrose/bridge_projects/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_confbridge.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_confbridge.c (original)
+++ team/jrose/bridge_projects/apps/app_confbridge.c Mon May 13 16:09:09 2013
@@ -1323,7 +1323,7 @@
 
 		/* Create an actual bridge that will do the audio mixing */
 		conference->bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_MULTIMIX,
-			AST_BRIDGE_FLAG_MASQUERADE_ONLY);
+			AST_BRIDGE_FLAG_MASQUERADE_ONLY | AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY);
 		if (!conference->bridge) {
 			ao2_ref(conference, -1);
 			conference = NULL;

Modified: team/jrose/bridge_projects/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_dial.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_dial.c (original)
+++ team/jrose/bridge_projects/apps/app_dial.c Mon May 13 16:09:09 2013
@@ -26,7 +26,6 @@
  */
 
 /*** MODULEINFO
-	<depend>chan_local</depend>
 	<support_level>core</support_level>
  ***/
 

Modified: team/jrose/bridge_projects/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_followme.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_followme.c (original)
+++ team/jrose/bridge_projects/apps/app_followme.c Mon May 13 16:09:09 2013
@@ -36,7 +36,6 @@
  */
 
 /*** MODULEINFO
-	<depend>chan_local</depend>
 	<support_level>core</support_level>
  ***/
 

Modified: team/jrose/bridge_projects/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_mixmonitor.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_mixmonitor.c (original)
+++ team/jrose/bridge_projects/apps/app_mixmonitor.c Mon May 13 16:09:09 2013
@@ -411,7 +411,6 @@
 
 static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook) 
 {
-	struct ast_channel *peer = NULL;
 	int res = 0;
 
 	if (!chan)
@@ -419,8 +418,13 @@
 
 	ast_audiohook_attach(chan, audiohook);
 
-	if (!res && ast_test_flag(ast_channel_flags(chan), AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
-		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);	
+	if (!res) {
+		ast_channel_lock(chan);
+		if (ast_channel_is_bridged(chan)) {
+			ast_softhangup_nolock(chan, AST_SOFTHANGUP_UNBRIDGE);
+		}
+		ast_channel_unlock(chan);
+	}
 
 	return res;
 }

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=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_queue.c (original)
+++ team/jrose/bridge_projects/apps/app_queue.c Mon May 13 16:09:09 2013
@@ -5275,7 +5275,7 @@
 	}
 
 	/* if the calling channel has AST_CAUSE_ANSWERED_ELSEWHERE set, make sure this is inherited.
-		(this is mainly to support chan_local)
+		(this is mainly to support unreal/local channels)
 	*/
 	if (ast_channel_hangupcause(qe->chan) == AST_CAUSE_ANSWERED_ELSEWHERE) {
 		qe->cancel_answered_elsewhere = 1;

Modified: team/jrose/bridge_projects/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_stasis.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_stasis.c (original)
+++ team/jrose/bridge_projects/apps/app_stasis.c Mon May 13 16:09:09 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/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=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/apps/app_userevent.c (original)
+++ team/jrose/bridge_projects/apps/app_userevent.c Mon May 13 16:09:09 2013
@@ -39,23 +39,28 @@
 /*** DOCUMENTATION
 	<application name="UserEvent" language="en_US">
 		<synopsis>
-			Send an arbitrary event to the manager interface.
+			Send an arbitrary user-defined event to parties interested in a channel (AMI users and relevant res_stasis applications).
 		</synopsis>
 		<syntax>
 			<parameter name="eventname" required="true" />
 			<parameter name="body" />
 		</syntax>
 		<description>
-			<para>Sends an arbitrary event to the manager interface, with an optional
+			<para>Sends an arbitrary event to interested parties, with an optional
 			<replaceable>body</replaceable> representing additional arguments. The
 			<replaceable>body</replaceable> may be specified as
-			a <literal>,</literal> delimited list of headers. Each additional
-			argument will be placed on a new line in the event. The format of the
-			event will be:</para>
+			a <literal>,</literal> delimited list of key:value pairs.</para>
+			<para>For AMI, each additional argument will be placed on a new line in
+			the event and the format of the event will be:</para>
 			<para>    Event: UserEvent</para>
 			<para>    UserEvent: &lt;specified event name&gt;</para>
 			<para>    [body]</para>
-			<para>If no <replaceable>body</replaceable> is specified, only Event and UserEvent headers will be present.</para>
+			<para>If no <replaceable>body</replaceable> is specified, only Event and
+			UserEvent headers will be present.</para>
+			<para>For res_stasis applications, the event will be provided as a JSON
+			blob with additional arguments appearing as keys in the object and the
+			<replaceable>eventname</replaceable> under the
+			<literal>eventname</literal> key.</para>
 		</description>
 	</application>
  ***/
@@ -70,7 +75,6 @@
 		AST_APP_ARG(eventname);
 		AST_APP_ARG(extra)[100];
 	);
-	RAII_VAR(struct ast_str *, body, ast_str_create(16), ast_free);
 	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 
@@ -79,25 +83,37 @@
 		return -1;
 	}
 
-	if (!body) {
-		ast_log(LOG_WARNING, "Unable to allocate buffer\n");
-		return -1;
-	}
-
 	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
-	for (x = 0; x < args.argc - 1; x++) {
-		ast_str_append(&body, 0, "%s\r\n", args.extra[x]);
+	blob = ast_json_pack("{s: s, s: s}",
+			     "type", "userevent",
+			     "eventname", args.eventname);
+	if (!blob) {
+		return -1;
 	}
 
-	blob = ast_json_pack("{s: s, s: s}",
-			     "eventname", args.eventname,
-			     "body", ast_str_buffer(body));
-	if (!blob) {
-		ast_log(LOG_WARNING, "Unable to create message buffer\n");
-		return -1;
+	for (x = 0; x < args.argc - 1; x++) {
+		char *key, *value = args.extra[x];
+		struct ast_json *json_value;
+
+		key = strsep(&value, ":");
+		if (!value) {
+			/* no ':' in string? */
+			continue;
+		}
+
+		value = ast_strip(value);
+		json_value = ast_json_string_create(value);
+		if (!json_value) {
+			return -1;
+		}
+
+		/* ref stolen by ast_json_object_set */
+		if (ast_json_object_set(blob, key, json_value)) {
+			return -1;
+		}
 	}
 
 	msg = ast_channel_blob_create(

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=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_builtin_features.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_builtin_features.c Mon May 13 16:09:09 2013
@@ -105,7 +105,7 @@
 	/* Fill the variable with the extension and context we want to call */
 	snprintf(destination, sizeof(destination), "%s@%s", exten, context);
 
-	/* Now we request that chan_local prepare to call the destination */
+	/* Now we request a local channel to prepare to call the destination */
 	chan = ast_request("Local", ast_channel_nativeformats(caller), caller, destination,
 		&cause);
 	if (!chan) {

Modified: team/jrose/bridge_projects/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_agent.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/channels/chan_agent.c (original)
+++ team/jrose/bridge_projects/channels/chan_agent.c Mon May 13 16:09:09 2013
@@ -31,7 +31,6 @@
  * \ingroup channel_drivers
  */
 /*** MODULEINFO
-        <depend>chan_local</depend>
         <depend>res_monitor</depend>
 	<support_level>core</support_level>
  ***/
@@ -2589,5 +2588,5 @@
 		.unload = unload_module,
 		.reload = reload,
 		.load_pri = AST_MODPRI_CHANNEL_DRIVER,
-		.nonoptreq = "res_monitor,chan_local",
+		.nonoptreq = "res_monitor",
 	       );

Modified: team/jrose/bridge_projects/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_gulp.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/channels/chan_gulp.c (original)
+++ team/jrose/bridge_projects/channels/chan_gulp.c Mon May 13 16:09:09 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;
@@ -132,7 +134,6 @@
 	.send_text = gulp_sendtext,
 	.send_digit_begin = gulp_digit_begin,
 	.send_digit_end = gulp_digit_end,
-	.bridge = ast_rtp_instance_bridge,
 	.call = gulp_call,
 	.hangup = gulp_hangup,
 	.answer = gulp_answer,
@@ -172,15 +173,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 +291,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 +474,7 @@
 	}
 
 	ao2_ref(session, -1);
+
 	return (status == PJ_SUCCESS) ? 0 : -1;
 }
 
@@ -491,6 +496,7 @@
 		ao2_cleanup(session);
 		return -1;
 	}
+
 	return 0;
 }
 
@@ -542,8 +548,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 +594,9 @@
 static int fixup(void *data)
 {
 	struct fixup_data *fix_data = data;
+
 	fix_data->session->channel = fix_data->chan;
+
 	return 0;
 }
 
@@ -598,6 +606,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 +633,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 +642,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 +717,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 +817,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 +905,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 +942,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 +952,7 @@
 	}
 
 	ao2_ref(session, -1);
+
 	return 0;
 }
 
@@ -952,6 +968,7 @@
 		ao2_cleanup(session);
 		return -1;
 	}
+
 	return 0;
 }
 
@@ -1011,17 +1028,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 +1069,7 @@
 
 	ao2_cleanup(pvt);
 	ao2_cleanup(h_data);
+
 	return 0;
 }
 
@@ -1058,6 +1080,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 +1089,7 @@
 		ast_log(LOG_WARNING, "Unable to push hangup task to the threadpool. Expect bad things\n");
 		goto failure;
 	}
+
 	return 0;
 
 failure:
@@ -1077,6 +1101,7 @@
 	ast_channel_tech_pvt_set(ast, NULL);
 
 	ao2_cleanup(pvt);
+
 	return -1;
 }
 
@@ -1090,9 +1115,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/jrose/bridge_projects/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_h323.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/channels/chan_h323.c (original)
+++ team/jrose/bridge_projects/channels/chan_h323.c Mon May 13 16:09:09 2013
@@ -275,7 +275,6 @@
 	.write = oh323_write,
 	.indicate = oh323_indicate,
 	.fixup = oh323_fixup,
-	.bridge = ast_rtp_instance_bridge,
 };
 
 static const char* redirectingreason2str(int redirectingreason)

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=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/channels/chan_iax2.c (original)
+++ team/jrose/bridge_projects/channels/chan_iax2.c Mon May 13 16:09:09 2013
@@ -101,6 +101,7 @@
 #include "asterisk/test.h"
 #include "asterisk/data.h"
 #include "asterisk/netsock2.h"
+#include "asterisk/bridging.h"
 
 #include "iax2/include/iax2.h"
 #include "iax2/include/firmware.h"
@@ -9216,130 +9217,6 @@
 	}
 }
 
-struct iax_dual {
-	struct ast_channel *chan1;
-	struct ast_channel *chan2;
-	char *park_exten;
-	char *park_context;
-};
-
-static void *iax_park_thread(void *stuff)
-{
-	struct iax_dual *d;
-	int res;
-	int ext = 0;
-
-	d = stuff;
-
-	ast_debug(4, "IAX Park: Transferer channel %s, Transferee %s\n",
-		ast_channel_name(d->chan2), ast_channel_name(d->chan1));
-
-	res = ast_park_call_exten(d->chan1, d->chan2, d->park_exten, d->park_context, 0, &ext);
-	if (res) {
-		/* Parking failed. */
-		ast_hangup(d->chan1);
-	} else {
-		ast_log(LOG_NOTICE, "Parked on extension '%d'\n", ext);
-	}
-	ast_hangup(d->chan2);
-
-	ast_free(d->park_exten);
-	ast_free(d->park_context);
-	ast_free(d);
-	return NULL;
-}
-
-/*! DO NOT hold any locks while calling iax_park */
-static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2, const char *park_exten, const char *park_context)
-{
-	struct iax_dual *d;
-	struct ast_channel *chan1m, *chan2m;/* Chan2m: The transferer, chan1m: The transferee */
-	pthread_t th;
-
-	chan1m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan2), ast_channel_exten(chan1), ast_channel_context(chan1), ast_channel_linkedid(chan1), ast_channel_amaflags(chan1), "Parking/%s", ast_channel_name(chan1));
-	chan2m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan2), ast_channel_exten(chan2), ast_channel_context(chan2), ast_channel_linkedid(chan2), ast_channel_amaflags(chan2), "IAXPeer/%s", ast_channel_name(chan2));
-	d = ast_calloc(1, sizeof(*d));
-	if (!chan1m || !chan2m || !d) {
-		if (chan1m) {
-			ast_hangup(chan1m);
-		}
-		if (chan2m) {
-			ast_hangup(chan2m);
-		}
-		ast_free(d);
-		return -1;
-	}
-	d->park_exten = ast_strdup(park_exten);
-	d->park_context = ast_strdup(park_context);
-	if (!d->park_exten || !d->park_context) {
-		ast_hangup(chan1m);
-		ast_hangup(chan2m);
-		ast_free(d->park_exten);
-		ast_free(d->park_context);
-		ast_free(d);
-		return -1;
-	}
-
-	/* Make formats okay */
-	ast_format_copy(ast_channel_readformat(chan1m), ast_channel_readformat(chan1));
-	ast_format_copy(ast_channel_writeformat(chan1m), ast_channel_writeformat(chan1));
-
-	/* Prepare for taking over the channel */
-	if (ast_channel_masquerade(chan1m, chan1)) {
-		ast_hangup(chan1m);
-		ast_hangup(chan2m);
-		ast_free(d->park_exten);
-		ast_free(d->park_context);
-		ast_free(d);
-		return -1;
-	}
-
-	/* Setup the extensions and such */
-	ast_channel_context_set(chan1m, ast_channel_context(chan1));
-	ast_channel_exten_set(chan1m, ast_channel_exten(chan1));
-	ast_channel_priority_set(chan1m, ast_channel_priority(chan1));
-
-	ast_do_masquerade(chan1m);
-
-	/* We make a clone of the peer channel too, so we can play
-	   back the announcement */
-
-	/* Make formats okay */
-	ast_format_copy(ast_channel_readformat(chan2m), ast_channel_readformat(chan2));
-	ast_format_copy(ast_channel_writeformat(chan2m), ast_channel_writeformat(chan2));
-	ast_channel_parkinglot_set(chan2m, ast_channel_parkinglot(chan2));
-
-	/* Prepare for taking over the channel */
-	if (ast_channel_masquerade(chan2m, chan2)) {
-		ast_hangup(chan1m);
-		ast_hangup(chan2m);
-		ast_free(d->park_exten);
-		ast_free(d->park_context);
-		ast_free(d);
-		return -1;
-	}
-
-	/* Setup the extensions and such */
-	ast_channel_context_set(chan2m, ast_channel_context(chan2));
-	ast_channel_exten_set(chan2m, ast_channel_exten(chan2));
-	ast_channel_priority_set(chan2m, ast_channel_priority(chan2));
-
-	ast_do_masquerade(chan2m);
-
-	d->chan1 = chan1m;	/* Transferee */
-	d->chan2 = chan2m;	/* Transferer */
-	if (ast_pthread_create_detached_background(&th, NULL, iax_park_thread, d) < 0) {
-		/* Could not start thread */
-		ast_hangup(chan1m);
-		ast_hangup(chan2m);
-		ast_free(d->park_exten);
-		ast_free(d->park_context);
-		ast_free(d);
-		return -1;
-	}
-	return 0;
-}
-
 static int check_provisioning(struct sockaddr_in *sin, int sockfd, char *si, unsigned int ver)
 {
 	unsigned int ourver;
@@ -10769,56 +10646,28 @@
 				break;
 			case IAX_COMMAND_TRANSFER:
 			{
-				struct ast_channel *bridged_chan;
-				struct ast_channel *owner;
-
 				iax2_lock_owner(fr->callno);
 				if (!iaxs[fr->callno]) {
 					/* Initiating call went away before we could transfer. */
 					break;
 				}
-				owner = iaxs[fr->callno]->owner;
-				bridged_chan = owner ? ast_bridged_channel(owner) : NULL;
-				if (bridged_chan && ies.called_number) {
-					const char *context;
-
-					context = ast_strdupa(iaxs[fr->callno]->context);
+				if (iaxs[fr->callno]->owner) {
+					struct ast_channel *owner = iaxs[fr->callno]->owner;
+					char *context = ast_strdupa(iaxs[fr->callno]->context);
 
 					ast_channel_ref(owner);
-					ast_channel_ref(bridged_chan);
 					ast_channel_unlock(owner);
 					ast_mutex_unlock(&iaxsl[fr->callno]);
 
-					/* Set BLINDTRANSFER channel variables */
-					pbx_builtin_setvar_helper(owner, "BLINDTRANSFER", ast_channel_name(bridged_chan));
-					pbx_builtin_setvar_helper(bridged_chan, "BLINDTRANSFER", ast_channel_name(owner));
-
-					/* DO NOT hold any locks while calling ast_parking_ext_valid() */
-					if (ast_parking_ext_valid(ies.called_number, owner, context)) {
-						ast_debug(1, "Parking call '%s'\n", ast_channel_name(bridged_chan));
-						if (iax_park(bridged_chan, owner, ies.called_number, context)) {
-							ast_log(LOG_WARNING, "Failed to park call '%s'\n",
-								ast_channel_name(bridged_chan));
-						}
-					} else {
-						if (ast_async_goto(bridged_chan, context, ies.called_number, 1)) {
-							ast_log(LOG_WARNING,
-								"Async goto of '%s' to '%s@%s' failed\n",
-								ast_channel_name(bridged_chan), ies.called_number, context);
-						} else {
-							ast_debug(1, "Async goto of '%s' to '%s@%s' started\n",
-								ast_channel_name(bridged_chan), ies.called_number, context);
-						}
+					if (ast_bridge_transfer_blind(owner, ies.called_number,
+								context, NULL, NULL) != AST_BRIDGE_TRANSFER_SUCCESS) {
+						ast_log(LOG_WARNING, "Blind transfer of '%s' to '%s@%s' failed\n",
+							ast_channel_name(owner), ies.called_number,
+							context);
 					}
+
 					ast_channel_unref(owner);
-					ast_channel_unref(bridged_chan);
-
 					ast_mutex_lock(&iaxsl[fr->callno]);
-				} else {
-					ast_debug(1, "Async goto not applicable on call %d\n", fr->callno);
-					if (owner) {
-						ast_channel_unlock(owner);
-					}
 				}
 
 				break;

Modified: team/jrose/bridge_projects/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_jingle.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/channels/chan_jingle.c (original)
+++ team/jrose/bridge_projects/channels/chan_jingle.c Mon May 13 16:09:09 2013
@@ -205,7 +205,6 @@
 	.send_text = jingle_sendtext,
 	.send_digit_begin = jingle_digit_begin,
 	.send_digit_end = jingle_digit_end,
-	.bridge = ast_rtp_instance_bridge,
 	.call = jingle_call,
 	.hangup = jingle_hangup,
 	.answer = jingle_answer,

Modified: team/jrose/bridge_projects/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_mgcp.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/channels/chan_mgcp.c (original)
+++ team/jrose/bridge_projects/channels/chan_mgcp.c Mon May 13 16:09:09 2013
@@ -480,7 +480,6 @@
 	.fixup = mgcp_fixup,
 	.send_digit_begin = mgcp_senddigit_begin,
 	.send_digit_end = mgcp_senddigit_end,
-	.bridge = ast_rtp_instance_bridge,
 	.func_channel_read = acf_channel_read,
 };
 

Modified: team/jrose/bridge_projects/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_motif.c?view=diff&rev=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/channels/chan_motif.c (original)
+++ team/jrose/bridge_projects/channels/chan_motif.c Mon May 13 16:09:09 2013
@@ -360,7 +360,6 @@
 	.send_text = jingle_sendtext,
 	.send_digit_begin = jingle_digit_begin,
 	.send_digit_end = jingle_digit_end,
-	.bridge = ast_rtp_instance_bridge,
 	.call = jingle_call,
 	.hangup = jingle_hangup,
 	.answer = jingle_answer,

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=388603&r1=388602&r2=388603
==============================================================================
--- team/jrose/bridge_projects/channels/chan_sip.c (original)
+++ team/jrose/bridge_projects/channels/chan_sip.c Mon May 13 16:09:09 2013
@@ -176,7 +176,6 @@
 /*** MODULEINFO
 	<use type="module">res_crypto</use>
 	<use type="module">res_http_websocket</use>
-	<depend>chan_local</depend>
 	<support_level>core</support_level>
  ***/
 
@@ -295,6 +294,7 @@
 #include "sip/include/security_events.h"
 #include "asterisk/sip_api.h"
 #include "asterisk/app.h"
+#include "asterisk/bridging.h"
 #include "asterisk/stasis_endpoints.h"
 
 /*** DOCUMENTATION
@@ -1202,8 +1202,6 @@
 					      struct sip_request *req, const char *uri);
 static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *totag, const char *fromtag);
 static void check_pendings(struct sip_pvt *p);
-static void *sip_park_thread(void *stuff);
-static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct sip_request *req, uint32_t seqno, const char *park_exten, const char *park_context);
 
 static void *sip_pickup_thread(void *stuff);
 static int sip_pickup(struct ast_channel *chan);
@@ -1544,7 +1542,6 @@
 	.fixup = sip_fixup,			/* called with chan locked */
 	.send_digit_begin = sip_senddigit_begin,	/* called with chan unlocked */
 	.send_digit_end = sip_senddigit_end,
-	.bridge = ast_rtp_instance_bridge,			/* XXX chan unlocked ? */
 	.early_bridge = ast_rtp_instance_early_bridge,
 	.send_text = sip_sendtext,		/* called with chan locked */
 	.func_channel_read = sip_acf_channel_read,
@@ -21729,7 +21726,7 @@
 					feat = ast_find_call_feature(p->relatedpeer->record_on_feature);
 				}
 			} else if (!strcasecmp(c, "off")) {
-				if (ast_strlen_zero(p->relatedpeer->record_on_feature)) {
+				if (ast_strlen_zero(p->relatedpeer->record_off_feature)) {
 					suppress_warning = 1;
 				} else {
 					feat = ast_find_call_feature(p->relatedpeer->record_off_feature);
@@ -24430,160 +24427,6 @@
 	}
 }
 
-
-/*! \brief Park SIP call support function
-	Starts in a new thread, then parks the call
-	XXX Should we add a wait period after streaming audio and before hangup?? Sometimes the
-		audio can't be heard before hangup
-*/
-static void *sip_park_thread(void *stuff)
-{
-	struct ast_channel *transferee, *transferer;	/* Chan1: The transferee, Chan2: The transferer */
-	struct sip_dual *d;
-	int ext;
-	int res;
-
-	d = stuff;
-	transferee = d->chan1;
-	transferer = d->chan2;
-
-	ast_debug(4, "SIP Park: Transferer channel %s, Transferee %s\n", ast_channel_name(transferer), ast_channel_name(transferee));
-
-	res = ast_park_call_exten(transferee, transferer, d->park_exten, d->park_context, 0, &ext);
-
-	sip_pvt_lock(ast_channel_tech_pvt(transferer));
-#ifdef WHEN_WE_KNOW_THAT_THE_CLIENT_SUPPORTS_MESSAGE
-	if (res) {
-		destroy_msg_headers(ast_channel_tech_pvt(transferer));
-		ast_string_field_set(ast_channel_tech_pvt(transferer), msg_body, "Unable to park call.");
-		transmit_message(ast_channel_tech_pvt(transferer), 0, 0);
-	} else {
-		/* Then tell the transferer what happened */
-		destroy_msg_headers(ast_channel_tech_pvt(transferer));

[... 5592 lines stripped ...]



More information about the asterisk-commits mailing list