[svn-commits] kmoore: branch kmoore/cel_backend_refactor r396830 - in /team/kmoore/cel_back...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 16 07:33:31 CDT 2013


Author: kmoore
Date: Fri Aug 16 07:33:29 2013
New Revision: 396830

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396830
Log:
Bring up to current

Removed:
    team/kmoore/cel_backend_refactor/res/res_stasis_bridge_add.c
    team/kmoore/cel_backend_refactor/res/res_stasis_bridge_add.exports.in
Modified:
    team/kmoore/cel_backend_refactor/   (props changed)
    team/kmoore/cel_backend_refactor/apps/app_bridgewait.c
    team/kmoore/cel_backend_refactor/apps/app_confbridge.c
    team/kmoore/cel_backend_refactor/apps/confbridge/conf_config_parser.c
    team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c
    team/kmoore/cel_backend_refactor/bridges/bridge_softmix.c
    team/kmoore/cel_backend_refactor/channels/chan_iax2.c
    team/kmoore/cel_backend_refactor/channels/chan_misdn.c
    team/kmoore/cel_backend_refactor/channels/chan_sip.c
    team/kmoore/cel_backend_refactor/channels/chan_vpb.cc
    team/kmoore/cel_backend_refactor/configs/features.conf.sample
    team/kmoore/cel_backend_refactor/include/asterisk/bridge.h
    team/kmoore/cel_backend_refactor/include/asterisk/bridge_channel.h
    team/kmoore/cel_backend_refactor/include/asterisk/bridge_channel_internal.h
    team/kmoore/cel_backend_refactor/include/asterisk/bridge_features.h
    team/kmoore/cel_backend_refactor/include/asterisk/bridge_internal.h
    team/kmoore/cel_backend_refactor/include/asterisk/channel.h
    team/kmoore/cel_backend_refactor/include/asterisk/core_unreal.h
    team/kmoore/cel_backend_refactor/include/asterisk/lock.h
    team/kmoore/cel_backend_refactor/include/asterisk/stasis_app.h
    team/kmoore/cel_backend_refactor/include/asterisk/stasis_app_impl.h
    team/kmoore/cel_backend_refactor/include/asterisk/utils.h
    team/kmoore/cel_backend_refactor/main/asterisk.c
    team/kmoore/cel_backend_refactor/main/autoservice.c
    team/kmoore/cel_backend_refactor/main/bridge.c
    team/kmoore/cel_backend_refactor/main/bridge_channel.c
    team/kmoore/cel_backend_refactor/main/channel.c
    team/kmoore/cel_backend_refactor/main/cli.c
    team/kmoore/cel_backend_refactor/main/config_options.c
    team/kmoore/cel_backend_refactor/main/core_unreal.c
    team/kmoore/cel_backend_refactor/main/features.c
    team/kmoore/cel_backend_refactor/main/manager.c
    team/kmoore/cel_backend_refactor/main/pbx.c
    team/kmoore/cel_backend_refactor/main/utils.c
    team/kmoore/cel_backend_refactor/res/ari/resource_bridges.c
    team/kmoore/cel_backend_refactor/res/parking/parking_bridge_features.c
    team/kmoore/cel_backend_refactor/res/parking/parking_tests.c
    team/kmoore/cel_backend_refactor/res/parking/res_parking.h
    team/kmoore/cel_backend_refactor/res/res_parking.c
    team/kmoore/cel_backend_refactor/res/res_pjsip_registrar.c
    team/kmoore/cel_backend_refactor/res/res_stasis.c
    team/kmoore/cel_backend_refactor/res/res_stasis_playback.c
    team/kmoore/cel_backend_refactor/res/res_stasis_recording.c
    team/kmoore/cel_backend_refactor/res/stasis/control.c
    team/kmoore/cel_backend_refactor/res/stasis/control.h
    team/kmoore/cel_backend_refactor/tests/test_hashtab_thrash.c

Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
--- cel_integrated (original)
+++ cel_integrated Fri Aug 16 07:33:29 2013
@@ -1,1 +1,1 @@
-/team/kmoore/event_system_strip:1-396486
+/team/kmoore/event_system_strip:1-396829

Modified: team/kmoore/cel_backend_refactor/apps/app_bridgewait.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_bridgewait.c?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_bridgewait.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_bridgewait.c Fri Aug 16 07:33:29 2013
@@ -349,10 +349,16 @@
 		return wrapper;
 	}
 
+	/*
+	 * Holding bridges can allow local channel move/swap
+	 * optimization to the bridge.  However, we cannot allow it for
+	 * this holding bridge because the call will lose the channel
+	 * roles and dialplan location as a result.
+	 */
 	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_TRANSFER_PROHIBITED
-		| AST_BRIDGE_FLAG_DISSOLVE_EMPTY);
+		| AST_BRIDGE_FLAG_SWAP_INHIBIT_TO | AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM
+		| AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_DISSOLVE_EMPTY);
 
 	if (!bridge) {
 		return NULL;

Modified: team/kmoore/cel_backend_refactor/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_confbridge.c?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_confbridge.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_confbridge.c Fri Aug 16 07:33:29 2013
@@ -1587,6 +1587,8 @@
 	/* Set if DTMF should pass through for this user or not */
 	if (ast_test_flag(&user.u_profile, USER_OPT_DTMF_PASS)) {
 		user.features.dtmf_passthrough = 1;
+	} else {
+		user.features.dtmf_passthrough = 0;
 	}
 
 	/* Set dsp threshold values if present */

Modified: team/kmoore/cel_backend_refactor/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/confbridge/conf_config_parser.c?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/confbridge/conf_config_parser.c (original)
+++ team/kmoore/cel_backend_refactor/apps/confbridge/conf_config_parser.c Fri Aug 16 07:33:29 2013
@@ -123,8 +123,8 @@
 					<synopsis>Apply a denoise filter to the audio before mixing</synopsis>
 					<description><para>Sets whether or not a denoise filter should be applied
 					to the audio before mixing or not.  Off by default. Requires
-					codec_speex to be built and installed.  Do not confuse this option
-					with drop_silence.  Denoise is useful if there is a lot of background
+					<literal>codec_speex</literal> to be built and installed.  Do not confuse this option
+					with <replaceable>drop_silence</replaceable>.  Denoise is useful if there is a lot of background
 					noise for a user as it attempts to remove the noise while preserving
 					the speech.  This option does NOT remove silence from being mixed into
 					the conference and does come at the cost of a slight performance hit.
@@ -158,7 +158,7 @@
 						during mid sentence.
 					</para>
 					<para>
-						2. The drop_silence option depends on this value to
+						2. The <replaceable>drop_silence</replaceable> option depends on this value to
 						determine when the user's audio should begin to be
 						dropped from the conference bridge after the user
 						stops talking.  If this value is set too low the user's
@@ -200,7 +200,7 @@
 						room noise.
 						</para>
 						<para>
-						3. The drop_silence option depends on this value to determine
+						3. The <replaceable>drop_silence</replaceable> option depends on this value to determine
 						when the user's audio should be mixed into the bridge
 						after periods of silence.  If this value is too loose
 						the beginning of a user's speech will get cut off as they
@@ -274,15 +274,15 @@
 						Records the conference call starting when the first user
 						enters the room, and ending when the last user exits the room.
 						The default recorded filename is
-						<filename>'confbridge-${name of conference bridge}-${start time}.wav</filename>
+						<filename>'confbridge-${name of conference bridge}-${start time}.wav'</filename>
 						and the default format is 8khz slinear.  This file will be
-						located in the configured monitoring directory in asterisk.conf.
+						located in the configured monitoring directory in <filename>asterisk.conf</filename>.
 					</para></description>
 				</configOption>
 				<configOption name="record_file" default="confbridge-${name of conference bridge}-${start time}.wav">
 					<synopsis>The filename of the conference recording</synopsis>
 					<description><para>
-						When record_conference is set to yes, the specific name of the
+						When <replaceable>record_conference</replaceable> is set to yes, the specific name of the
 						record file can be set using this option.  Note that since multiple
 						conferences may use the same bridge profile, this may cause issues
 						depending on the configuration.  It is recommended to only use this
@@ -295,9 +295,9 @@
 				<configOption name="record_file_append" default="yes">
 					<synopsis>Append record file when starting/stopping on same conference recording</synopsis>
 					<description><para>
-						When record_file_append is set to yes, stopping and starting recording on a
+						When <replaceable>record_file_append</replaceable> is set to yes, stopping and starting recording on a
 						conference adds the new portion to end of current record_file. When this is
-						set to no, a new record_file is generated every time you start then stop recording
+						set to no, a new <replaceable>record_file</replaceable> is generated every time you start then stop recording
 						on a conference.
 					</para></description>
 				</configOption>
@@ -306,7 +306,7 @@
 					<description><para>
 						Sets how confbridge handles video distribution to the conference participants.
 						Note that participants wanting to view and be the source of a video feed
-						_MUST_ be sharing the same video codec.  Also, using video in conjunction with
+						<emphasis>MUST</emphasis> be sharing the same video codec.  Also, using video in conjunction with
 						with the jitterbuffer currently results in the audio being slightly out of sync
 						with the video.  This is a result of the jitterbuffer only working on the audio
 						stream.  It is recommended to disable the jitterbuffer when video is used.</para>
@@ -395,7 +395,7 @@
 			<configObject name="menu">
 				<synopsis>A conference user menu</synopsis>
 				<description>
-					<para>Conference users, as defined by a <literal>conf_user</literal>,
+					<para>Conference users, as defined by a <replaceable>conf_user</replaceable>,
 					can have a DTMF menu assigned to their profile when they enter the
 					<literal>ConfBridge</literal> application.</para>
 				</description>
@@ -412,7 +412,7 @@
 				</configOption>
 				<configOption name="^[0-9A-D*#]+$">
 					<synopsis>DTMF sequences to assign various confbridge actions to</synopsis>
-					<description><para>--- ConfBridge Menu Options ---</para>
+					<description>
 					<para>The ConfBridge application also has the ability to apply custom DTMF menus to
 					each channel using the application.  Like the User and Bridge profiles a menu
 					is passed in to ConfBridge as an argument in the dialplan.</para>
@@ -1922,7 +1922,7 @@
 	/* This option should only be used with the CONFBRIDGE dialplan function */
 	aco_option_register_custom(&cfg_info, "template", ACO_EXACT, user_types, NULL, user_template_handler, 0);
 
-/* BUGBUG need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
+/* XXX ASTERISK-21271 need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
 	/* Bridge options */
 	aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
 	aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);

Modified: team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c (original)
+++ team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c Fri Aug 16 07:33:29 2013
@@ -57,21 +57,21 @@
 	struct ast_rtp_glue **glue1, struct ast_rtp_instance **instance0, struct ast_rtp_instance **instance1,
 	struct ast_rtp_instance **vinstance0, struct ast_rtp_instance **vinstance1)
 {
-	enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
-	enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
+	enum ast_rtp_glue_result audio_glue0_res;
+	enum ast_rtp_glue_result video_glue0_res;
+	enum ast_rtp_glue_result audio_glue1_res;
+	enum ast_rtp_glue_result video_glue1_res;
 
 	if (!(*glue0 = ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) ||
-		(c1 && !(*glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type)))) {
+		!(*glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type))) {
 		return AST_RTP_GLUE_RESULT_FORBID;
 	}
 
 	audio_glue0_res = (*glue0)->get_rtp_info(c0, instance0);
 	video_glue0_res = (*glue0)->get_vrtp_info ? (*glue0)->get_vrtp_info(c0, vinstance0) : AST_RTP_GLUE_RESULT_FORBID;
 
-	if (c1) {
-		audio_glue1_res = (*glue1)->get_rtp_info(c1, instance1);
-		video_glue1_res = (*glue1)->get_vrtp_info ? (*glue1)->get_vrtp_info(c1, vinstance1) : AST_RTP_GLUE_RESULT_FORBID;
-	}
+	audio_glue1_res = (*glue1)->get_rtp_info(c1, instance1);
+	video_glue1_res = (*glue1)->get_vrtp_info ? (*glue1)->get_vrtp_info(c1, vinstance1) : AST_RTP_GLUE_RESULT_FORBID;
 
 	/* Apply any limitations on direct media bridging that may be present */
 	if (audio_glue0_res == audio_glue1_res && audio_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) {
@@ -82,7 +82,7 @@
 			audio_glue0_res = audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
 		}
 	}
-	if (c1 && video_glue0_res == video_glue1_res && video_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) {
+	if (video_glue0_res == video_glue1_res && video_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) {
 		if ((*glue0)->allow_vrtp_remote && !((*glue0)->allow_vrtp_remote(c0, *instance1))) {
 			/* if the allow_vrtp_remote indicates that remote isn't allowed, revert to local bridge */
 			video_glue0_res = video_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
@@ -92,15 +92,20 @@
 	}
 
 	/* If we are carrying video, and both sides are not going to remotely bridge... fail the native bridge */
-	if (video_glue0_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue0_res != AST_RTP_GLUE_RESULT_REMOTE)) {
+	if (video_glue0_res != AST_RTP_GLUE_RESULT_FORBID
+		&& (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE
+			|| video_glue0_res != AST_RTP_GLUE_RESULT_REMOTE)) {
 		audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
 	}
-	if (c1 && video_glue1_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue1_res != AST_RTP_GLUE_RESULT_REMOTE)) {
+	if (video_glue1_res != AST_RTP_GLUE_RESULT_FORBID
+		&& (audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE
+			|| video_glue1_res != AST_RTP_GLUE_RESULT_REMOTE)) {
 		audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
 	}
 
 	/* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */
-	if (audio_glue0_res == AST_RTP_GLUE_RESULT_FORBID || (c1 && audio_glue1_res == AST_RTP_GLUE_RESULT_FORBID)) {
+	if (audio_glue0_res == AST_RTP_GLUE_RESULT_FORBID
+		|| audio_glue1_res == AST_RTP_GLUE_RESULT_FORBID) {
 		return AST_RTP_GLUE_RESULT_FORBID;
 	}
 
@@ -172,7 +177,7 @@
 		return;
 	}
 
-	native_type = native_rtp_bridge_get(c0->chan, c1 ? c1->chan : NULL, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
+	native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
 
 	switch (native_type) {
 	case AST_RTP_GLUE_RESULT_LOCAL:

Modified: team/kmoore/cel_backend_refactor/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/bridges/bridge_softmix.c?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/bridges/bridge_softmix.c (original)
+++ team/kmoore/cel_backend_refactor/bridges/bridge_softmix.c Fri Aug 16 07:33:29 2013
@@ -594,8 +594,10 @@
  */
 static int softmix_bridge_write_control(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
-/* BUGBUG need to look at channel roles to determine what to do with control frame. */
-	/*! \todo BUGBUG softmix_bridge_write_control() not written */
+	/*
+	 * XXX Softmix needs to use channel roles to determine what to
+	 * do with control frames.
+	 */
 	return 0;
 }
 
@@ -622,6 +624,11 @@
 		return 0;
 	}
 
+	/*
+	 * XXX Softmix needs to use channel roles to determine who gets
+	 * what frame.  Possible roles: announcer, recorder, agent,
+	 * supervisor.
+	 */
 	switch (frame->frametype) {
 	case AST_FRAME_NULL:
 		/* "Accept" the frame and discard it. */
@@ -820,6 +827,10 @@
 		goto softmix_cleanup;
 	}
 
+	/*
+	 * XXX Softmix needs to use channel roles to determine who gets
+	 * what audio mixed.
+	 */
 	while (!softmix_data->stop && bridge->num_active) {
 		struct ast_bridge_channel *bridge_channel;
 		int timeout = -1;

Modified: team/kmoore/cel_backend_refactor/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/channels/chan_iax2.c?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/channels/chan_iax2.c (original)
+++ team/kmoore/cel_backend_refactor/channels/chan_iax2.c Fri Aug 16 07:33:29 2013
@@ -37,6 +37,18 @@
 
 /*! \page iax.conf iax.conf
  * \verbinclude iax.conf.sample
+ */
+
+/*!
+ * \todo XXX The IAX2 channel driver needs its native bridge
+ * code converted to the new bridge technology scheme.
+ *
+ * \note The chan_dahdi native bridge code can be used as an
+ * example.  It also appears that chan_iax2 also has a native
+ * transfer check like chan_dahdi to eliminate tromboned calls.
+ *
+ * \note The existing native bridge code is marked with the
+ * IAX2_NATIVE_BRIDGING conditional.
  */
 
 /*** MODULEINFO
@@ -1212,7 +1224,6 @@
 	ast_verbose("%s", buf);
 }
 
-static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
 static int expire_registry(const void *data);
 static int iax2_answer(struct ast_channel *c);
 static int iax2_call(struct ast_channel *c, const char *dest, int timeout);
@@ -1262,7 +1273,6 @@
 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);
 
-/* BUGBUG The IAX2 channel driver needs its own native bridge technology. */
 static struct ast_channel_tech iax2_tech = {
 	.type = "IAX2",
 	.description = tdesc,
@@ -1283,7 +1293,6 @@
 	.indicate = iax2_indicate,
 	.setoption = iax2_setoption,
 	.queryoption = iax2_queryoption,
-	.bridge = iax2_bridge,
 	.transfer = iax2_transfer,
 	.fixup = iax2_fixup,
 	.func_channel_read = acf_channel_read,
@@ -5325,6 +5334,7 @@
 	return res;
 }
 
+#if defined(IAX2_NATIVE_BRIDGING)
 static int iax2_start_transfer(unsigned short callno0, unsigned short callno1, int mediaonly)
 {
 	int res;
@@ -5359,7 +5369,9 @@
 	iaxs[callno1]->transferring = mediaonly ? TRANSFER_MBEGIN : TRANSFER_BEGIN;
 	return 0;
 }
-
+#endif	/* defined(IAX2_NATIVE_BRIDGING) */
+
+#if defined(IAX2_NATIVE_BRIDGING)
 static void lock_both(unsigned short callno0, unsigned short callno1)
 {
 	ast_mutex_lock(&iaxsl[callno0]);
@@ -5367,13 +5379,17 @@
 		DEADLOCK_AVOIDANCE(&iaxsl[callno0]);
 	}
 }
-
+#endif	/* defined(IAX2_NATIVE_BRIDGING) */
+
+#if defined(IAX2_NATIVE_BRIDGING)
 static void unlock_both(unsigned short callno0, unsigned short callno1)
 {
 	ast_mutex_unlock(&iaxsl[callno1]);
 	ast_mutex_unlock(&iaxsl[callno0]);
 }
-
+#endif	/* defined(IAX2_NATIVE_BRIDGING) */
+
+#if defined(IAX2_NATIVE_BRIDGING)
 static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
 {
 	struct ast_channel *cs[3];
@@ -5496,8 +5512,7 @@
 		if ((f->frametype == AST_FRAME_CONTROL)) {
 			if (f->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
 				ast_channel_hangupcause_hash_set(other, f->data.ptr, f->datalen);
-			} else if (!(flags & AST_BRIDGE_IGNORE_SIGS)
-				&& (f->subclass.integer != AST_CONTROL_SRCUPDATE)) {
+			} else if (f->subclass.integer != AST_CONTROL_SRCUPDATE) {
 				*fo = f;
 				*rc = who;
 				res =  AST_BRIDGE_COMPLETE;
@@ -5538,6 +5553,7 @@
 	unlock_both(callno0, callno1);
 	return res;
 }
+#endif	/* defined(IAX2_NATIVE_BRIDGING) */
 
 static int iax2_answer(struct ast_channel *c)
 {

Modified: team/kmoore/cel_backend_refactor/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/channels/chan_misdn.c?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/channels/chan_misdn.c (original)
+++ team/kmoore/cel_backend_refactor/channels/chan_misdn.c Fri Aug 16 07:33:29 2013
@@ -56,6 +56,21 @@
 
 /* Define to enable cli commands to generate canned CCBS messages. */
 // #define CCBS_TEST_MESSAGES	1
+
+/*
+ * XXX The mISDN channel driver needs its native bridge code
+ * converted to the new bridge technology scheme.  The
+ * chan_dahdi native bridge code can be used as an example.  It
+ * is unlikely that this will ever get done.  Support for this
+ * channel driver is dwindling because the supported version of
+ * mISDN does not support newer kernels.
+ *
+ * Without native bridge support, the following config file
+ * parameters have no effect: bridging.
+ *
+ * The existing native bridge code is marked with the
+ * mISDN_NATIVE_BRIDGING conditional.
+ */
 
 /*** MODULEINFO
 	<depend>isdnnet</depend>
@@ -750,6 +765,7 @@
 	return 0;
 }
 
+#if defined(mISDN_NATIVE_BRIDGING)
 /*! Returns a reference to the found chan_list. */
 static struct chan_list *get_chan_by_ast(struct ast_channel *ast)
 {
@@ -767,6 +783,7 @@
 
 	return NULL;
 }
+#endif	/* defined(mISDN_NATIVE_BRIDGING) */
 
 /*! Returns a reference to the found chan_list. */
 static struct chan_list *get_chan_by_ast_name(const char *name)
@@ -7557,6 +7574,7 @@
 	return 0;
 }
 
+#if defined(mISDN_NATIVE_BRIDGING)
 static enum ast_bridge_result misdn_bridge(struct ast_channel *c0,
 	struct ast_channel *c1, int flags,
 	struct ast_frame **fo,
@@ -7570,14 +7588,20 @@
 	int p1_b, p2_b;
 	int bridging;
 
+	misdn_cfg_get(0, MISDN_GEN_BRIDGING, &bridging, sizeof(bridging));
+	if (!bridging) {
+		/* Native mISDN bridging globally disabled. */
+		return AST_BRIDGE_FAILED_NOWARN;
+	}
+
 	ch1 = get_chan_by_ast(c0);
 	if (!ch1) {
-		return -1;
+		return AST_BRIDGE_FAILED;
 	}
 	ch2 = get_chan_by_ast(c1);
 	if (!ch2) {
 		chan_list_unref(ch1, "Failed to find ch2");
-		return -1;
+		return AST_BRIDGE_FAILED;
 	}
 
 	carr[0] = c0;
@@ -7585,20 +7609,16 @@
 
 	misdn_cfg_get(ch1->bc->port, MISDN_CFG_BRIDGING, &p1_b, sizeof(p1_b));
 	misdn_cfg_get(ch2->bc->port, MISDN_CFG_BRIDGING, &p2_b, sizeof(p2_b));
-
-	if (! p1_b || ! p2_b) {
+	if (!p1_b || !p2_b) {
 		ast_log(LOG_NOTICE, "Falling back to Asterisk bridging\n");
 		chan_list_unref(ch1, "Bridge fallback ch1");
 		chan_list_unref(ch2, "Bridge fallback ch2");
-		return AST_BRIDGE_FAILED;
-	}
-
-	misdn_cfg_get(0, MISDN_GEN_BRIDGING, &bridging, sizeof(bridging));
-	if (bridging) {
-		/* trying to make a mISDN_dsp conference */
-		chan_misdn_log(1, ch1->bc->port, "I SEND: Making conference with Number:%d\n", ch1->bc->pid + 1);
-		misdn_lib_bridge(ch1->bc, ch2->bc);
-	}
+		return AST_BRIDGE_FAILED_NOWARN;
+	}
+
+	/* make a mISDN_dsp conference */
+	chan_misdn_log(1, ch1->bc->port, "I SEND: Making conference with Number:%d\n", ch1->bc->pid + 1);
+	misdn_lib_bridge(ch1->bc, ch2->bc);
 
 	ast_verb(3, "Native bridging %s and %s\n", ast_channel_name(c0), ast_channel_name(c1));
 
@@ -7671,6 +7691,7 @@
 	chan_list_unref(ch2, "Bridge complete ch2");
 	return AST_BRIDGE_COMPLETE;
 }
+#endif	/* defined(mISDN_NATIVE_BRIDGING) */
 
 /** AST INDICATIONS END **/
 
@@ -8097,26 +8118,7 @@
 	return 0;
 }
 
-/* BUGBUG The mISDN channel driver needs its own native bridge technology. (More like just never give it one.) */
 static struct ast_channel_tech misdn_tech = {
-	.type = misdn_type,
-	.description = "Channel driver for mISDN Support (Bri/Pri)",
-	.requester = misdn_request,
-	.send_digit_begin = misdn_digit_begin,
-	.send_digit_end = misdn_digit_end,
-	.call = misdn_call,
-	.bridge = misdn_bridge,
-	.hangup = misdn_hangup,
-	.answer = misdn_answer,
-	.read = misdn_read,
-	.write = misdn_write,
-	.indicate = misdn_indication,
-	.fixup = misdn_fixup,
-	.send_text = misdn_send_text,
-	.properties = 0,
-};
-
-static struct ast_channel_tech misdn_tech_wo_bridge = {
 	.type = misdn_type,
 	.description = "Channel driver for mISDN Support (Bri/Pri)",
 	.requester = misdn_request,
@@ -8167,7 +8169,6 @@
 	char *cid_num = NULL;
 	int chan_offset = 0;
 	int tmp_port = misdn_cfg_get_next_port(0);
-	int bridging;
 	struct ast_format tmpfmt;
 
 	for (; tmp_port > 0; tmp_port = misdn_cfg_get_next_port(tmp_port)) {
@@ -8200,8 +8201,7 @@
 		MISDN_ASTERISK_TECH_PVT_SET(tmp, chlist);
 		chlist->ast = tmp;
 
-		misdn_cfg_get(0, MISDN_GEN_BRIDGING, &bridging, sizeof(bridging));
-		ast_channel_tech_set(tmp, bridging ? &misdn_tech : &misdn_tech_wo_bridge);
+		ast_channel_tech_set(tmp, &misdn_tech);
 
 		ast_channel_priority_set(tmp, 1);
 
@@ -11270,7 +11270,6 @@
 	misdn_cc_destroy();
 #endif	/* defined(AST_MISDN_ENHANCEMENTS) */
 	misdn_tech.capabilities = ast_format_cap_destroy(misdn_tech.capabilities);
-	misdn_tech_wo_bridge.capabilities = ast_format_cap_destroy(misdn_tech_wo_bridge.capabilities);
 
 	return 0;
 }
@@ -11302,12 +11301,8 @@
 	if (!(misdn_tech.capabilities = ast_format_cap_alloc())) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	if (!(misdn_tech_wo_bridge.capabilities = ast_format_cap_alloc())) {
-		return AST_MODULE_LOAD_DECLINE;
-	}
 	ast_format_set(&prefformat, AST_FORMAT_ALAW, 0);
 	ast_format_cap_add(misdn_tech.capabilities, &prefformat);
-	ast_format_cap_add(misdn_tech_wo_bridge.capabilities, &prefformat);
 
 	max_ports = misdn_lib_maxports_get();
 

Modified: team/kmoore/cel_backend_refactor/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/channels/chan_sip.c?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/channels/chan_sip.c (original)
+++ team/kmoore/cel_backend_refactor/channels/chan_sip.c Fri Aug 16 07:33:29 2013
@@ -16147,7 +16147,7 @@
 	if (ast_apply_acl(sip_cfg.contact_acl, &peer->addr, "SIP contact ACL: ") != AST_SENSE_ALLOW ||
 			ast_apply_acl(peer->contactacl, &peer->addr, "SIP contact ACL: ") != AST_SENSE_ALLOW) {
 		ast_log(LOG_WARNING, "Domain '%s' disallowed by contact ACL (violating IP %s)\n", hostport,
-			ast_sockaddr_stringify_addr(&testsa));
+				ast_sockaddr_stringify_addr(&peer->addr));
 		ast_string_field_set(peer, fullcontact, "");
 		ast_string_field_set(pvt, our_contact, "");
 		return PARSE_REGISTER_DENIED;
@@ -17344,7 +17344,7 @@
 			break;
 		}
 
-		if (peer->endpoint) {
+		if (peer && peer->endpoint) {
 			ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
 		}
 	}
@@ -18007,22 +18007,29 @@
 
 	/* Give useful transfer information to the dialplan */
 	if (transferer->owner) {
-		RAII_VAR(struct ast_channel *, peer, ast_channel_bridge_peer(transferer->owner), ast_channel_cleanup);
-
-		/*! pbx_builtin_setvar_helper will attempt to lock the channel. We need
-		 * to be sure it's already locked here so we don't deadlock.
-		 */
-		while (peer && ast_channel_trylock(peer)) {
-			sip_pvt_unlock(transferer);
-			do {
-				CHANNEL_DEADLOCK_AVOIDANCE(transferer->owner);
-			} while (sip_pvt_trylock(transferer));
-		}
-
+		RAII_VAR(struct ast_channel *, peer, NULL, ast_channel_cleanup);
+		RAII_VAR(struct ast_channel *, owner_relock, NULL, ast_channel_cleanup);
+		RAII_VAR(struct ast_channel *, owner_ref, NULL, ast_channel_cleanup);
+
+		/* Grab a reference to transferer->owner to prevent it from going away */
+		owner_ref = ast_channel_ref(transferer->owner);
+
+		/* Established locking order here is bridge, channel, pvt
+		 * and the bridge will be locked during ast_channel_bridge_peer */
+		ast_channel_unlock(owner_ref);
+		sip_pvt_unlock(transferer);
+
+		peer = ast_channel_bridge_peer(owner_ref);
 		if (peer) {
 			pbx_builtin_setvar_helper(peer, "SIPREFERRINGCONTEXT", transferer->context);
 			pbx_builtin_setvar_helper(peer, "SIPREFERREDBYHDR", p_referred_by);
 			ast_channel_unlock(peer);
+		}
+
+		owner_relock = sip_pvt_lock_full(transferer);
+		if (!owner_relock) {
+			ast_debug(3, "Unable to reacquire owner channel lock, channel is gone\n");
+			return -5;
 		}
 	}
 
@@ -23402,8 +23409,8 @@
 					wait = ast_random() % 2000;
 				}
 				p->waitid = ast_sched_add(sched, wait, sip_reinvite_retry, dialog_ref(p, "passing dialog ptr into sched structure based on waitid for sip_reinvite_retry."));
-				ast_log(LOG_WARNING, "just did sched_add waitid(%d) for sip_reinvite_retry for dialog %s in handle_response_invite\n", p->waitid, p->callid);
-				ast_debug(2, "Reinvite race. Waiting %d secs before retry\n", wait);
+				ast_debug(2, "Reinvite race. Scheduled sip_reinvite_retry in %d secs in handle_response_invite (waitid %d, dialog '%s')\n",
+						wait, p->waitid, p->callid);
 			}
 		}
 		break;
@@ -26090,7 +26097,7 @@
 	int res = 0;
 	struct blind_transfer_cb_data cb_data;
 	enum ast_transfer_result transfer_res;
-	RAII_VAR(struct ast_channel *, transferer, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_channel *, transferer, NULL, ast_channel_cleanup);
 	RAII_VAR(struct ast_str *, replaces_str, NULL, ast_free_ptr);
 
 	if (req->debug) {
@@ -26367,6 +26374,8 @@
 	struct ast_channel *c=NULL;
 	int res;
 	const char *required;
+	RAII_VAR(struct ast_channel *, peer_channel, NULL, ast_channel_cleanup);
+	char quality_buf[AST_MAX_USER_FIELD], *quality;
 
 	/* If we have an INCOMING invite that we haven't answered, terminate that transaction */
 	if (p->pendinginvite && !ast_test_flag(&p->flags[0], SIP_OUTGOING) && !req->ignore) {
@@ -26383,70 +26392,88 @@
 	check_via(p, req);
 	sip_alreadygone(p);
 
+	if (p->owner) {
+		RAII_VAR(struct ast_channel *, owner_relock, NULL, ast_channel_cleanup);
+		RAII_VAR(struct ast_channel *, owner_ref, NULL, ast_channel_cleanup);
+
+		/* Grab a reference to p->owner to prevent it from going away */
+		owner_ref = ast_channel_ref(p->owner);
+
+		/* Established locking order here is bridge, channel, pvt
+		 * and the bridge will be locked during ast_channel_bridge_peer */
+		ast_channel_unlock(owner_ref);
+		sip_pvt_unlock(p);
+
+		peer_channel = ast_channel_bridge_peer(owner_ref);
+
+		owner_relock = sip_pvt_lock_full(p);
+		if (!owner_relock) {
+			ast_debug(3, "Unable to reacquire owner channel lock, channel is gone\n");
+			return 0;
+		}
+	}
+
 	/* Get RTCP quality before end of call */
-	if (p->do_history || p->owner) {
-		char quality_buf[AST_MAX_USER_FIELD], *quality;
-		RAII_VAR(struct ast_channel *, bridge, p->owner ? ast_channel_bridge_peer(p->owner) : NULL, ast_channel_cleanup);
-
-		/* We need to get the lock on bridge because ast_rtp_instance_set_stats_vars will attempt
-		 * to lock the bridge. This may get hairy...
-		 */
-		while (bridge && ast_channel_trylock(bridge)) {
-			ast_channel_unlock(p->owner);
-			do {
-				/* Can't use DEADLOCK_AVOIDANCE since p is an ao2 object */
-				sip_pvt_unlock(p);
-				usleep(1);
-				sip_pvt_lock(p);
-			} while (p->owner && ast_channel_trylock(p->owner));
-		}
-
-
-		if (p->rtp && (quality = ast_rtp_instance_get_quality(p->rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
-			if (p->do_history) {
+	if (p->rtp) {
+		if (p->do_history) {
+			if ((quality = ast_rtp_instance_get_quality(p->rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
 				append_history(p, "RTCPaudio", "Quality:%s", quality);
-
-				if ((quality = ast_rtp_instance_get_quality(p->rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, quality_buf, sizeof(quality_buf)))) {
-					append_history(p, "RTCPaudioJitter", "Quality:%s", quality);
+			}
+			if ((quality = ast_rtp_instance_get_quality(p->rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, quality_buf, sizeof(quality_buf)))) {
+				append_history(p, "RTCPaudioJitter", "Quality:%s", quality);
+			}
+			if ((quality = ast_rtp_instance_get_quality(p->rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, quality_buf, sizeof(quality_buf)))) {
+				append_history(p, "RTCPaudioLoss", "Quality:%s", quality);
+			}
+			if ((quality = ast_rtp_instance_get_quality(p->rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, quality_buf, sizeof(quality_buf)))) {
+				append_history(p, "RTCPaudioRTT", "Quality:%s", quality);
+			}
+		}
+
+		if (p->owner) {
+			RAII_VAR(struct ast_channel *, owner_relock, NULL, ast_channel_cleanup);
+			RAII_VAR(struct ast_channel *, owner_ref, NULL, ast_channel_cleanup);
+
+			/* Grab a reference to p->owner to prevent it from going away */
+			owner_ref = ast_channel_ref(p->owner);
+
+			/* Established locking order here is bridge, channel, pvt
+			 * and the bridge and channel will be locked during
+			 * ast_rtp_instance_set_stats_vars */
+			ast_channel_unlock(owner_ref);
+			sip_pvt_unlock(p);
+
+			ast_rtp_instance_set_stats_vars(owner_ref, p->rtp);
+			if (peer_channel && IS_SIP_TECH(ast_channel_tech(peer_channel))) {
+				struct sip_pvt *q = ast_channel_tech_pvt(peer_channel);
+				if (q && q->rtp) {
+					ast_rtp_instance_set_stats_vars(peer_channel, q->rtp);
 				}
-				if ((quality = ast_rtp_instance_get_quality(p->rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, quality_buf, sizeof(quality_buf)))) {
-					append_history(p, "RTCPaudioLoss", "Quality:%s", quality);
-				}
-				if ((quality = ast_rtp_instance_get_quality(p->rtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, quality_buf, sizeof(quality_buf)))) {
-					append_history(p, "RTCPaudioRTT", "Quality:%s", quality);
-				}
-			}
-
-			if (p->owner) {
-				ast_rtp_instance_set_stats_vars(p->owner, p->rtp);
-			}
-
-		}
-
-		if (bridge) {
-			struct sip_pvt *q = ast_channel_tech_pvt(bridge);
-
-			if (IS_SIP_TECH(ast_channel_tech(bridge)) && q && q->rtp) {
-				ast_rtp_instance_set_stats_vars(bridge, q->rtp);
-			}
-			ast_channel_unlock(bridge);
-		}
-
-		if (p->vrtp && (quality = ast_rtp_instance_get_quality(p->vrtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
-			if (p->do_history) {
-				append_history(p, "RTCPvideo", "Quality:%s", quality);
-			}
-			if (p->owner) {
-				pbx_builtin_setvar_helper(p->owner, "RTPVIDEOQOS", quality);
-			}
-		}
-		if (p->trtp && (quality = ast_rtp_instance_get_quality(p->trtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
-			if (p->do_history) {
-				append_history(p, "RTCPtext", "Quality:%s", quality);
-			}
-			if (p->owner) {
-				pbx_builtin_setvar_helper(p->owner, "RTPTEXTQOS", quality);
-			}
+			}
+
+			owner_relock = sip_pvt_lock_full(p);
+			if (!owner_relock) {
+				ast_debug(3, "Unable to reacquire owner channel lock, channel is gone\n");
+				return 0;
+			}
+		}
+	}
+
+	if (p->vrtp && (quality = ast_rtp_instance_get_quality(p->vrtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
+		if (p->do_history) {
+			append_history(p, "RTCPvideo", "Quality:%s", quality);
+		}
+		if (p->owner) {
+			pbx_builtin_setvar_helper(p->owner, "RTPVIDEOQOS", quality);
+		}
+	}
+
+	if (p->trtp && (quality = ast_rtp_instance_get_quality(p->trtp, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
+		if (p->do_history) {
+			append_history(p, "RTCPtext", "Quality:%s", quality);
+		}
+		if (p->owner) {
+			pbx_builtin_setvar_helper(p->owner, "RTPTEXTQOS", quality);
 		}
 	}
 
@@ -26462,15 +26489,30 @@
 		if (!res) {
 			c = p->owner;
 			if (c) {
-				RAII_VAR(struct ast_channel *, bridged_to, ast_channel_bridge_peer(c), ast_channel_cleanup);
-				if (bridged_to) {
+				if (peer_channel) {
+					RAII_VAR(struct ast_channel *, owner_relock, NULL, ast_channel_cleanup);
+					char *local_context = ast_strdupa(p->context);
+					char *local_refer_to = ast_strdupa(p->refer->refer_to);
+
+					/* Grab a reference to p->owner to prevent it from going away */
+					ast_channel_ref(c);
+
 					/* Don't actually hangup here... */
 					ast_queue_unhold(c);
 					ast_channel_unlock(c);  /* async_goto can do a masquerade, no locks can be held during a masq */
-					ast_async_goto(bridged_to, p->context, p->refer->refer_to, 1);
-					ast_channel_lock(c);
-				} else
+					sip_pvt_unlock(p);
+
+					ast_async_goto(peer_channel, local_context, local_refer_to, 1);
+
+					owner_relock = sip_pvt_lock_full(p);
+					ast_channel_cleanup(c);
+					if (!owner_relock) {
+						ast_debug(3, "Unable to reacquire owner channel lock, channel is gone\n");
+						return 0;
+					}
+				} else {
 					ast_queue_hangup(p->owner);
+				}
 			}
 		} else {
 			ast_log(LOG_WARNING, "Invalid transfer information from '%s'\n", ast_sockaddr_stringify(&p->recv));

Modified: team/kmoore/cel_backend_refactor/channels/chan_vpb.cc
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/channels/chan_vpb.cc?view=diff&rev=396830&r1=396829&r2=396830
==============================================================================
--- team/kmoore/cel_backend_refactor/channels/chan_vpb.cc (original)
+++ team/kmoore/cel_backend_refactor/channels/chan_vpb.cc Fri Aug 16 07:33:29 2013
@@ -37,6 +37,16 @@
  * \verbinclude vpb.conf.sample
  */
 
+/*
+ * XXX chan_vpb needs its native bridge code converted to the
+ * new bridge technology scheme.  The chan_dahdi native bridge
+ * code can be used as an example.  It is unlikely that this
+ * will ever get done.
+ *
+ * The existing native bridge code is marked with the
+ * VPB_NATIVE_BRIDGING conditional.
+ */
+
 /*** MODULEINFO
 	<depend>vpb</depend>
 	<defaultenabled>no</defaultenabled>
@@ -347,7 +357,6 @@
 static int vpb_answer(struct ast_channel *ast);
 static struct ast_frame *vpb_read(struct ast_channel *ast);
 static int vpb_write(struct ast_channel *ast, struct ast_frame *frame);
-static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
 static int vpb_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen);
 static int vpb_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 
@@ -369,7 +378,6 @@
 	send_image: NULL,
 	send_html: NULL,
 	exception: NULL,
-	bridge: ast_vpb_bridge,
 	early_bridge: NULL,
 	indicate: vpb_indicate,
 	fixup: vpb_fixup,
@@ -378,11 +386,8 @@
 	transfer: NULL,
 	write_video: NULL,
 	write_text: NULL,
-	bridged_channel: NULL,
 	func_channel_read: NULL,
 	func_channel_write: NULL,
-	get_base_channel: NULL,
-	set_base_channel: NULL
 };
 
 static struct ast_channel_tech vpb_tech_indicate = {
@@ -403,7 +408,6 @@
 	send_image: NULL,
 	send_html: NULL,
 	exception: NULL,
-	bridge: ast_vpb_bridge,
 	early_bridge: NULL,
 	indicate: NULL,

[... 2504 lines stripped ...]



More information about the svn-commits mailing list