[asterisk-commits] dlee: branch dlee/ASTERISK-21969 r397813 - in /team/dlee/ASTERISK-21969: ./ b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 27 13:56:17 CDT 2013


Author: dlee
Date: Tue Aug 27 13:56:12 2013
New Revision: 397813

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397813
Log:
Merged revisions 397514-397811 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/dlee/ASTERISK-21969/include/asterisk/bucket.h
      - copied unchanged from r397811, trunk/include/asterisk/bucket.h
    team/dlee/ASTERISK-21969/include/asterisk/opus.h
      - copied unchanged from r397811, trunk/include/asterisk/opus.h
    team/dlee/ASTERISK-21969/main/bucket.c
      - copied unchanged from r397811, trunk/main/bucket.c
    team/dlee/ASTERISK-21969/res/res_format_attr_opus.c
      - copied unchanged from r397811, trunk/res/res_format_attr_opus.c
    team/dlee/ASTERISK-21969/tests/test_bucket.c
      - copied unchanged from r397811, trunk/tests/test_bucket.c
Modified:
    team/dlee/ASTERISK-21969/   (props changed)
    team/dlee/ASTERISK-21969/CHANGES
    team/dlee/ASTERISK-21969/bridges/bridge_builtin_interval_features.c
    team/dlee/ASTERISK-21969/bridges/bridge_native_rtp.c
    team/dlee/ASTERISK-21969/build_tools/menuselect-deps.in
    team/dlee/ASTERISK-21969/channels/Makefile
    team/dlee/ASTERISK-21969/channels/chan_dahdi.c
    team/dlee/ASTERISK-21969/channels/chan_iax2.c
    team/dlee/ASTERISK-21969/channels/chan_motif.c
    team/dlee/ASTERISK-21969/channels/chan_pjsip.c
    team/dlee/ASTERISK-21969/channels/chan_sip.c
    team/dlee/ASTERISK-21969/channels/sig_analog.c
    team/dlee/ASTERISK-21969/channels/sig_pri.c
    team/dlee/ASTERISK-21969/channels/sig_ss7.c
    team/dlee/ASTERISK-21969/configs/cel.conf.sample
    team/dlee/ASTERISK-21969/configure
    team/dlee/ASTERISK-21969/configure.ac
    team/dlee/ASTERISK-21969/contrib/scripts/sip_to_res_sip/astconfigparser.py
    team/dlee/ASTERISK-21969/contrib/scripts/sip_to_res_sip/astdicts.py
    team/dlee/ASTERISK-21969/contrib/scripts/sip_to_res_sip/sip_to_res_sip.py
    team/dlee/ASTERISK-21969/include/asterisk/astmm.h
    team/dlee/ASTERISK-21969/include/asterisk/autoconfig.h.in
    team/dlee/ASTERISK-21969/include/asterisk/backtrace.h
    team/dlee/ASTERISK-21969/include/asterisk/bridge_channel.h
    team/dlee/ASTERISK-21969/include/asterisk/bridge_channel_internal.h
    team/dlee/ASTERISK-21969/include/asterisk/channel.h
    team/dlee/ASTERISK-21969/include/asterisk/config_options.h
    team/dlee/ASTERISK-21969/include/asterisk/format.h
    team/dlee/ASTERISK-21969/include/asterisk/lock.h
    team/dlee/ASTERISK-21969/include/asterisk/sorcery.h
    team/dlee/ASTERISK-21969/include/asterisk/stasis_app.h
    team/dlee/ASTERISK-21969/include/asterisk/stasis_app_impl.h
    team/dlee/ASTERISK-21969/include/asterisk/utils.h
    team/dlee/ASTERISK-21969/main/Makefile
    team/dlee/ASTERISK-21969/main/asterisk.c
    team/dlee/ASTERISK-21969/main/astmm.c
    team/dlee/ASTERISK-21969/main/astobj2.c
    team/dlee/ASTERISK-21969/main/backtrace.c
    team/dlee/ASTERISK-21969/main/bridge.c
    team/dlee/ASTERISK-21969/main/bridge_channel.c
    team/dlee/ASTERISK-21969/main/channel.c
    team/dlee/ASTERISK-21969/main/channel_internal_api.c
    team/dlee/ASTERISK-21969/main/config_options.c
    team/dlee/ASTERISK-21969/main/features_config.c
    team/dlee/ASTERISK-21969/main/format.c
    team/dlee/ASTERISK-21969/main/frame.c
    team/dlee/ASTERISK-21969/main/lock.c
    team/dlee/ASTERISK-21969/main/logger.c
    team/dlee/ASTERISK-21969/main/pbx.c
    team/dlee/ASTERISK-21969/main/rtp_engine.c
    team/dlee/ASTERISK-21969/main/sorcery.c
    team/dlee/ASTERISK-21969/main/stasis_channels.c
    team/dlee/ASTERISK-21969/main/utils.c
    team/dlee/ASTERISK-21969/makeopts.in
    team/dlee/ASTERISK-21969/res/ari/resource_bridges.c
    team/dlee/ASTERISK-21969/res/res_ari_bridges.c
    team/dlee/ASTERISK-21969/res/res_musiconhold.c
    team/dlee/ASTERISK-21969/res/res_pjsip.c
    team/dlee/ASTERISK-21969/res/res_pjsip/pjsip_configuration.c
    team/dlee/ASTERISK-21969/res/res_pjsip/pjsip_options.c
    team/dlee/ASTERISK-21969/res/res_pjsip_sdp_rtp.c
    team/dlee/ASTERISK-21969/res/res_rtp_asterisk.c
    team/dlee/ASTERISK-21969/res/stasis/control.c
    team/dlee/ASTERISK-21969/rest-api/api-docs/bridges.json
    team/dlee/ASTERISK-21969/tests/test_config.c
    team/dlee/ASTERISK-21969/tests/test_sorcery.c
    team/dlee/ASTERISK-21969/tests/test_sorcery_astdb.c
    team/dlee/ASTERISK-21969/tests/test_sorcery_realtime.c

Propchange: team/dlee/ASTERISK-21969/
            ('branch-11-blocked' removed)

Propchange: team/dlee/ASTERISK-21969/
            ('branch-11-merged' removed)

Propchange: team/dlee/ASTERISK-21969/
------------------------------------------------------------------------------
    branch-12-merged = /branches/12:1-397673,397690,397713,397745,397759,397809

Propchange: team/dlee/ASTERISK-21969/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Aug 27 13:56:12 2013
@@ -1,1 +1,1 @@
-/trunk:1-397505
+/trunk:1-397812

Modified: team/dlee/ASTERISK-21969/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/CHANGES?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/CHANGES (original)
+++ team/dlee/ASTERISK-21969/CHANGES Tue Aug 27 13:56:12 2013
@@ -173,6 +173,15 @@
  * A channel variable ATTENDEDTRANSFER is now set which indicates which channel
    was responsible for an attended transfer in a similar fashion to
    BLINDTRANSFER.
+
+
+Codecs
+------------------
+ * Added pass through support for VP8 and Opus
+
+ * Added format attribute negotiation for the Opus codec. Format attribute
+   negotiation is provided by the res_format_attr_opus module.
+
 
 AMI (Asterisk Manager Interface)
 ------------------

Modified: team/dlee/ASTERISK-21969/bridges/bridge_builtin_interval_features.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/bridges/bridge_builtin_interval_features.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/bridges/bridge_builtin_interval_features.c (original)
+++ team/dlee/ASTERISK-21969/bridges/bridge_builtin_interval_features.c Tue Aug 27 13:56:12 2013
@@ -103,12 +103,14 @@
 	/*
 	 * It may be necessary to resume music on hold after we finish
 	 * playing the announcment.
-	 *
-	 * XXX We have no idea what MOH class was in use before playing
-	 * the file.
 	 */
 	if (ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_MOH)) {
-		ast_moh_start(bridge_channel->chan, NULL, NULL);
+		const char *latest_musicclass;
+
+		ast_channel_lock(bridge_channel->chan);
+		latest_musicclass = ast_strdupa(ast_channel_latest_musicclass(bridge_channel->chan));
+		ast_channel_unlock(bridge_channel->chan);
+		ast_moh_start(bridge_channel->chan, latest_musicclass, NULL);
 	}
 }
 

Modified: team/dlee/ASTERISK-21969/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/bridges/bridge_native_rtp.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/bridges/bridge_native_rtp.c (original)
+++ team/dlee/ASTERISK-21969/bridges/bridge_native_rtp.c Tue Aug 27 13:56:12 2013
@@ -112,8 +112,7 @@
 	return audio_glue0_res;
 }
 
-/*! \brief Start RTP native bridging */
-static int native_rtp_bridge_start(struct ast_bridge *bridge)
+static int native_rtp_bridge_start(struct ast_bridge *bridge, struct ast_channel *target)
 {
 	struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
 	struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
@@ -152,10 +151,26 @@
 		break;
 
 	case AST_RTP_GLUE_RESULT_REMOTE:
-		glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, cap1, 0);
-		glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, cap0, 0);
-		ast_debug(2, "Remotely bridged '%s' and '%s' - media will flow directly between them\n",
-			ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+
+		/* If we have a target, it's the channel that received the UNHOLD or UPDATE_RTP_PEER frame and was told to resume */
+		if (!target) {
+			glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, cap1, 0);
+			glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, cap0, 0);
+			ast_debug(2, "Remotely bridged '%s' and '%s' - media will flow directly between them\n",
+				ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+		} else {
+			/*
+			 * If a target was provided, it is the recipient of an unhold or an update and needs to have
+			 * its media redirected to fit the current remote bridging needs. The other channel is either
+			 * already set up to handle the new media path or will have its own set of updates independent
+			 * of this pass.
+			 */
+			if (c0->chan == target) {
+				glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, cap1, 0);
+			} else {
+				glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, cap0, 0);
+			}
+		}
 		break;
 	case AST_RTP_GLUE_RESULT_FORBID:
 		break;
@@ -164,8 +179,7 @@
 	return 0;
 }
 
-/*! \brief Stop RTP native bridging */
-static void native_rtp_bridge_stop(struct ast_bridge *bridge)
+static void native_rtp_bridge_stop(struct ast_bridge *bridge, struct ast_channel *target)
 {
 	struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
 	struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
@@ -193,9 +207,21 @@
 		}
 		break;
 	case AST_RTP_GLUE_RESULT_REMOTE:
-		glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
-		if (glue1) {
-			glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
+		if (!target) {
+			glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
+			if (glue1) {
+				glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
+			}
+		} else {
+			/*
+			 * If a target was provided, it is being put on hold and should expect to
+			 * receive mediafrom sterisk instead of what it was previously connected to.
+			 */
+			if (c0->chan == target) {
+				glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
+			} else if (glue1) {
+				glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
+			}
 		}
 		break;
 	case AST_RTP_GLUE_RESULT_FORBID:
@@ -221,9 +247,9 @@
 
 	if (bridge) {
 		if (f->subclass.integer == AST_CONTROL_HOLD) {
-			native_rtp_bridge_stop(bridge);
+			native_rtp_bridge_stop(bridge, chan);
 		} else if ((f->subclass.integer == AST_CONTROL_UNHOLD) || (f->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
-			native_rtp_bridge_start(bridge);
+			native_rtp_bridge_start(bridge, chan);
 		}
 	}
 
@@ -375,7 +401,7 @@
 		return -1;
 	}
 
-	return native_rtp_bridge_start(bridge);
+	return native_rtp_bridge_start(bridge, NULL);
 }
 
 static void native_rtp_bridge_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
@@ -387,7 +413,7 @@
 {
 	native_rtp_bridge_framehook_detach(bridge_channel);
 
-	native_rtp_bridge_stop(bridge);
+	native_rtp_bridge_stop(bridge, NULL);
 }
 
 static int native_rtp_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)

Modified: team/dlee/ASTERISK-21969/build_tools/menuselect-deps.in
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/build_tools/menuselect-deps.in?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/build_tools/menuselect-deps.in (original)
+++ team/dlee/ASTERISK-21969/build_tools/menuselect-deps.in Tue Aug 27 13:56:12 2013
@@ -26,6 +26,7 @@
 IXJUSER=@PBX_IXJUSER@
 JACK=@PBX_JACK@
 JANSSON=@PBX_JANSSON@
+URIPARSER=@PBX_URIPARSER@
 KQUEUE=@PBX_KQUEUE@
 LDAP=@PBX_LDAP@
 LIBEDIT=@PBX_LIBEDIT@

Modified: team/dlee/ASTERISK-21969/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/Makefile?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/Makefile (original)
+++ team/dlee/ASTERISK-21969/channels/Makefile Tue Aug 27 13:56:12 2013
@@ -63,6 +63,7 @@
 
 clean::
 	$(MAKE) -C misdn clean
+	rm -f dahdi/*.o dahdi/*.i
 	rm -f sip/*.o sip/*.i
 	rm -f iax2/*.o iax2/*.i
 	rm -f h323/libchanh323.a h323/Makefile.ast h323/*.o h323/*.dep

Modified: team/dlee/ASTERISK-21969/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/chan_dahdi.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/chan_dahdi.c (original)
+++ team/dlee/ASTERISK-21969/channels/chan_dahdi.c Tue Aug 27 13:56:12 2013
@@ -3686,6 +3686,7 @@
 	snprintf(cause_str, sizeof(cause_str), "R2 DISCONNECT (%s)", openr2_proto_get_disconnect_string(cause));
 	datalen += strlen(cause_str);
 	cause_code = ast_alloca(datalen);
+	memset(cause_code, 0, datalen);
 	cause_code->ast_cause = dahdi_r2_cause_to_ast_cause(cause);
 	ast_copy_string(cause_code->chan_name, ast_channel_name(p->owner), AST_CHANNEL_NAME);
 	ast_copy_string(cause_code->code, cause_str, datalen + 1 - sizeof(*cause_code));

Modified: team/dlee/ASTERISK-21969/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/chan_iax2.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/chan_iax2.c (original)
+++ team/dlee/ASTERISK-21969/channels/chan_iax2.c Tue Aug 27 13:56:12 2013
@@ -9996,6 +9996,7 @@
 		data_size += strlen(subclass);
 
 		cause_code = ast_alloca(data_size);
+		memset(cause_code, 0, data_size);
 		ast_copy_string(cause_code->chan_name, ast_channel_name(iaxs[fr->callno]->owner), AST_CHANNEL_NAME);
 
 		cause_code->ast_cause = ies.causecode;

Modified: team/dlee/ASTERISK-21969/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/chan_motif.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/chan_motif.c (original)
+++ team/dlee/ASTERISK-21969/channels/chan_motif.c Tue Aug 27 13:56:12 2013
@@ -2532,7 +2532,8 @@
 
 		/* Size of the string making up the cause code is "Motif " + text */
 		data_size += 6 + strlen(iks_name(text));
-		cause_code = ast_malloc(data_size);
+		cause_code = ast_alloca(data_size);
+		memset(cause_code, 0, data_size);
 
 		/* Get the appropriate cause code mapping for this reason */
 		for (i = 0; i < ARRAY_LEN(jingle_reason_mappings); i++) {
@@ -2546,15 +2547,14 @@
 		snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "Motif %s", iks_name(text));
 	} else {
 		/* No technology specific information is available */
-		cause_code = ast_malloc(data_size);
+		cause_code = ast_alloca(data_size);
+		memset(cause_code, 0, data_size);
 	}
 
 	ast_copy_string(cause_code->chan_name, ast_channel_name(chan), AST_CHANNEL_NAME);
 	cause_code->ast_cause = cause;
 	ast_queue_control_data(chan, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
 	ast_channel_hangupcause_hash_set(chan, cause_code, data_size);
-
-	ast_free(cause_code);
 
 	ast_debug(3, "Hanging up channel '%s' due to session terminate message with cause '%d'\n", ast_channel_name(chan), cause);
 	ast_queue_hangup_with_cause(chan, cause);

Modified: team/dlee/ASTERISK-21969/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/chan_pjsip.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/chan_pjsip.c (original)
+++ team/dlee/ASTERISK-21969/channels/chan_pjsip.c Tue Aug 27 13:56:12 2013
@@ -637,11 +637,17 @@
 
 static int answer(void *data)
 {
-	pj_status_t status;
+	pj_status_t status = PJ_SUCCESS;
 	pjsip_tx_data *packet;
 	struct ast_sip_session *session = data;
 
-	if ((status = pjsip_inv_answer(session->inv_session, 200, NULL, NULL, &packet)) == PJ_SUCCESS) {
+	pjsip_dlg_inc_lock(session->inv_session->dlg);
+	if (session->inv_session->invite_tsx) {
+		status = pjsip_inv_answer(session->inv_session, 200, NULL, NULL, &packet);
+	}
+	pjsip_dlg_dec_lock(session->inv_session->dlg);
+
+	if (status == PJ_SUCCESS && packet) {
 		ast_sip_session_send_response(session, packet);
 	}
 
@@ -1162,10 +1168,25 @@
 	case AST_CONTROL_VIDUPDATE:
 		media = pvt->media[SIP_MEDIA_VIDEO];
 		if (media && media->rtp) {
-			ao2_ref(channel->session, +1);
-
-			if (ast_sip_push_task(channel->session->serializer, transmit_info_with_vidupdate, channel->session)) {
-				ao2_cleanup(channel->session);
+			/* FIXME: Only use this for VP8. Additional work would have to be done to
+			 * fully support other video codecs */
+			struct ast_format_cap *fcap = ast_channel_nativeformats(ast);
+			struct ast_format vp8;
+			ast_format_set(&vp8, AST_FORMAT_VP8, 0);
+			if (ast_format_cap_iscompatible(fcap, &vp8)) {
+				/* FIXME Fake RTP write, this will be sent as an RTCP packet. Ideally the
+				 * RTP engine would provide a way to externally write/schedule RTCP
+				 * packets */
+				struct ast_frame fr;
+				fr.frametype = AST_FRAME_CONTROL;
+				fr.subclass.integer = AST_CONTROL_VIDUPDATE;
+				res = ast_rtp_instance_write(media->rtp, &fr);
+			} else {
+				ao2_ref(channel->session, +1);
+
+				if (ast_sip_push_task(channel->session->serializer, transmit_info_with_vidupdate, channel->session)) {
+					ao2_cleanup(channel->session);
+				}
 			}
 		} else {
 			res = -1;

Modified: team/dlee/ASTERISK-21969/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/chan_sip.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/chan_sip.c (original)
+++ team/dlee/ASTERISK-21969/channels/chan_sip.c Tue Aug 27 13:56:12 2013
@@ -1269,7 +1269,7 @@
 static void start_ice(struct ast_rtp_instance *instance);
 static void add_codec_to_sdp(const struct sip_pvt *p, struct ast_format *codec,
 			     struct ast_str **m_buf, struct ast_str **a_buf,
-			     int debug, int *min_packet_size);
+			     int debug, int *min_packet_size, int *max_packet_size);
 static void add_noncodec_to_sdp(const struct sip_pvt *p, int format,
 				struct ast_str **m_buf, struct ast_str **a_buf,
 				int debug);
@@ -7945,10 +7945,25 @@
 		break;
 	case AST_CONTROL_VIDUPDATE:	/* Request a video frame update */
 		if (p->vrtp && !p->novideo) {
-			transmit_info_with_vidupdate(p);
-			/* ast_rtcp_send_h261fur(p->vrtp); */
-		} else
+			/* FIXME: Only use this for VP8. Additional work would have to be done to
+			 * fully support other video codecs */
+			struct ast_format_cap *fcap = ast_channel_nativeformats(ast);
+			struct ast_format vp8;
+			ast_format_set(&vp8, AST_FORMAT_VP8, 0);
+			if (ast_format_cap_iscompatible(fcap, &vp8)) {
+				/* FIXME Fake RTP write, this will be sent as an RTCP packet. Ideally the
+				 * RTP engine would provide a way to externally write/schedule RTCP
+				 * packets */
+				struct ast_frame fr;
+				fr.frametype = AST_FRAME_CONTROL;
+				fr.subclass.integer = AST_CONTROL_VIDUPDATE;
+				res = ast_rtp_instance_write(p->vrtp, &fr);
+			} else {
+				transmit_info_with_vidupdate(p);
+			}
+		} else {
 			res = -1;
+		}
 		break;
 	case AST_CONTROL_T38_PARAMETERS:
 		res = -1;
@@ -10673,7 +10688,7 @@
 
 	/* Setup audio address and port */
 	if (p->rtp) {
-		if (portno > 0) {
+		if (sa && portno > 0) {
 			start_ice(p->rtp);
 			ast_sockaddr_set_port(sa, portno);
 			ast_rtp_instance_set_remote_address(p->rtp, sa);
@@ -10721,7 +10736,7 @@
 
 	/* Setup video address and port */
 	if (p->vrtp) {
-		if (vportno > 0) {
+		if (vsa && vportno > 0) {
 			start_ice(p->vrtp);
 			ast_sockaddr_set_port(vsa, vportno);
 			ast_rtp_instance_set_remote_address(p->vrtp, vsa);
@@ -10739,7 +10754,7 @@
 
 	/* Setup text address and port */
 	if (p->trtp) {
-		if (tportno > 0) {
+		if (tsa && tportno > 0) {
 			start_ice(p->trtp);
 			ast_sockaddr_set_port(tsa, tportno);
 			ast_rtp_instance_set_remote_address(p->trtp, tsa);
@@ -10763,7 +10778,7 @@
 
 	/* Setup image address and port */
 	if (p->udptl) {
-		if (udptlportno > 0) {
+		if (isa && udptlportno > 0) {
 			if (ast_test_flag(&p->flags[1], SIP_PAGE2_SYMMETRICRTP) && ast_test_flag(&p->flags[1], SIP_PAGE2_UDPTL_DESTINATION)) {
 				ast_rtp_instance_get_remote_address(p->rtp, isa);
 				if (!ast_sockaddr_isnull(isa) && debug) {
@@ -11167,7 +11182,7 @@
 			if (debug)
 				ast_verbose("Discarded description format %s for ID %d\n", mimeSubtype, codec);
 		}
-	} else if (sscanf(a, "fmtp: %30u %255s", &codec, fmtp_string) == 2) {
+	} else if (sscanf(a, "fmtp: %30u %255[^\t\n]", &codec, fmtp_string) == 2) {
 		struct ast_format *format;
 
 		if ((format = ast_rtp_codecs_get_payload_format(newaudiortp, codec))) {
@@ -11230,7 +11245,8 @@
 		/* We have a rtpmap to handle */
 		if (*last_rtpmap_codec < SDP_MAX_RTPMAP_CODECS) {
 			/* Note: should really look at the '#chans' params too */
-			if (!strncasecmp(mimeSubtype, "H26", 3) || !strncasecmp(mimeSubtype, "MP4", 3)) {
+			if (!strncasecmp(mimeSubtype, "H26", 3) || !strncasecmp(mimeSubtype, "MP4", 3)
+					|| !strncasecmp(mimeSubtype, "VP8", 3)) {
 				if (!(ast_rtp_codecs_payloads_set_rtpmap_type_rate(newvideortp, NULL, codec, "video", mimeSubtype, 0, sample_rate))) {
 					if (debug)
 						ast_verbose("Found video description format %s for ID %d\n", mimeSubtype, codec);
@@ -12799,7 +12815,8 @@
 	struct ast_str **m_buf,
 	struct ast_str **a_buf,
 	int debug,
-	int *min_packet_size)
+	int *min_packet_size,
+	int *max_packet_size)
 {
 	int rtp_code;
 	struct ast_format_list fmt;
@@ -12821,7 +12838,12 @@
 	} else /* I don't see how you couldn't have p->rtp, but good to check for and error out if not there like earlier code */
 		return;
 	ast_str_append(m_buf, 0, " %d", rtp_code);
-	ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code, mime, rate);
+	/* Opus mandates 2 channels in rtpmap */
+	if ((int)format->id == AST_FORMAT_OPUS) {
+		ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d/2\r\n", rtp_code, mime, rate);
+	} else {
+		ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code, mime, rate);
+	}
 
 	ast_format_sdp_generate(format, rtp_code, a_buf);
 
@@ -12852,12 +12874,22 @@
 		break;
 	}
 
-	if (fmt.cur_ms && (fmt.cur_ms < *min_packet_size))
+	if (max_packet_size && fmt.max_ms && (fmt.max_ms < *max_packet_size)) {
+		*max_packet_size = fmt.max_ms;
+	}
+
+	if (fmt.cur_ms && (fmt.cur_ms < *min_packet_size)) {
 		*min_packet_size = fmt.cur_ms;
+	}
 
 	/* Our first codec packetization processed cannot be zero */
-	if ((*min_packet_size)==0 && fmt.cur_ms)
+	if ((*min_packet_size) == 0 && fmt.cur_ms) {
 		*min_packet_size = fmt.cur_ms;
+	}
+
+	if ((*max_packet_size) == 0 && fmt.max_ms) {
+		*max_packet_size = fmt.max_ms;
+	}
 }
 
 /*! \brief Add video codec offer to SDP offer/answer body in INVITE or 200 OK */
@@ -12884,6 +12916,10 @@
 
 	ast_str_append(m_buf, 0, " %d", rtp_code);
 	ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code, subtype, rate);
+	/* VP8: add RTCP FIR support */
+	if ((int)format->id == AST_FORMAT_VP8) {
+		ast_str_append(a_buf, 0, "a=rtcp-fb:* ccm fir\r\n");
+	}
 
 	ast_format_sdp_generate(format, rtp_code, a_buf);
 }
@@ -13128,6 +13164,7 @@
 	int needtext = FALSE;
 	int debug = sip_debug_test_pvt(p);
 	int min_audio_packet_size = 0;
+	int max_audio_packet_size = 0;
 	int min_video_packet_size = 0;
 	int min_text_packet_size = 0;
 
@@ -13309,7 +13346,7 @@
 				if (AST_FORMAT_GET_TYPE(tmp_fmt.id) != AST_FORMAT_TYPE_AUDIO) {
 					continue;
 				}
-				add_codec_to_sdp(p, &tmp_fmt, &m_audio, &a_audio, debug, &min_audio_packet_size);
+				add_codec_to_sdp(p, &tmp_fmt, &m_audio, &a_audio, debug, &min_audio_packet_size, &max_audio_packet_size);
 				ast_format_cap_add(alreadysent, &tmp_fmt);
 			}
 			ast_format_cap_iter_end(p->prefcaps);
@@ -13329,7 +13366,7 @@
 				continue;
 
 			if (AST_FORMAT_GET_TYPE(tmp_fmt.id) == AST_FORMAT_TYPE_AUDIO) {
-				add_codec_to_sdp(p, &tmp_fmt, &m_audio, &a_audio, debug, &min_audio_packet_size);
+				add_codec_to_sdp(p, &tmp_fmt, &m_audio, &a_audio, debug, &min_audio_packet_size, &max_audio_packet_size);
 			} else if (needvideo && (AST_FORMAT_GET_TYPE(tmp_fmt.id) == AST_FORMAT_TYPE_VIDEO)) {
 				add_vcodec_to_sdp(p, &tmp_fmt, &m_video, &a_video, debug, &min_video_packet_size);
 			} else if (needtext && (AST_FORMAT_GET_TYPE(tmp_fmt.id) == AST_FORMAT_TYPE_TEXT)) {
@@ -13346,7 +13383,7 @@
 				continue;
 
 			if (AST_FORMAT_GET_TYPE(tmp_fmt.id) == AST_FORMAT_TYPE_AUDIO) {
-				add_codec_to_sdp(p, &tmp_fmt, &m_audio, &a_audio, debug, &min_audio_packet_size);
+				add_codec_to_sdp(p, &tmp_fmt, &m_audio, &a_audio, debug, &min_audio_packet_size, &max_audio_packet_size);
 			} else if (needvideo && (AST_FORMAT_GET_TYPE(tmp_fmt.id) == AST_FORMAT_TYPE_VIDEO)) {
 				add_vcodec_to_sdp(p, &tmp_fmt, &m_video, &a_video, debug, &min_video_packet_size);
 			} else if (needtext && (AST_FORMAT_GET_TYPE(tmp_fmt.id) == AST_FORMAT_TYPE_TEXT)) {
@@ -13365,19 +13402,27 @@
 
 		ast_debug(3, "-- Done with adding codecs to SDP\n");
 
-		if (!p->owner || !ast_internal_timing_enabled(p->owner))
+		if (!p->owner || !ast_internal_timing_enabled(p->owner)) {
 			ast_str_append(&a_audio, 0, "a=silenceSupp:off - - - -\r\n");
-
-		if (min_audio_packet_size)
+		}
+
+		if (min_audio_packet_size) {
 			ast_str_append(&a_audio, 0, "a=ptime:%d\r\n", min_audio_packet_size);
+		}
 
 		/* XXX don't think you can have ptime for video */
-		if (min_video_packet_size)
+		if (min_video_packet_size) {
 			ast_str_append(&a_video, 0, "a=ptime:%d\r\n", min_video_packet_size);
+		}
 
 		/* XXX don't think you can have ptime for text */
-		if (min_text_packet_size)
+		if (min_text_packet_size) {
 			ast_str_append(&a_text, 0, "a=ptime:%d\r\n", min_text_packet_size);
+		}
+
+		if (max_audio_packet_size) {
+			ast_str_append(&a_text, 0, "a=maxptime:%d\r\n", max_audio_packet_size);
+		}
 
 		if (!doing_directmedia) {
 			if (ast_test_flag(&p->flags[2], SIP_PAGE3_ICE_SUPPORT)) {
@@ -27942,6 +27987,7 @@
 				/* size of the string making up the cause code is "SIP " + cause length */
 				data_size += 4 + strlen(REQ_OFFSET_TO_STR(req, rlpart2));
 				cause_code = ast_alloca(data_size);
+				memset(cause_code, 0, data_size);
 
 				ast_copy_string(cause_code->chan_name, ast_channel_name(p->owner), AST_CHANNEL_NAME);
 
@@ -28121,7 +28167,7 @@
 			p->invitestate = INV_TERMINATED;
 			p->pendinginvite = 0;
 			acked = __sip_ack(p, seqno, 1 /* response */, 0);
-			if (find_sdp(req)) {
+			if (p->owner && find_sdp(req)) {
 				if (process_sdp(p, req, SDP_T38_NONE)) {
 					return -1;
 				}

Modified: team/dlee/ASTERISK-21969/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/sig_analog.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/sig_analog.c (original)
+++ team/dlee/ASTERISK-21969/channels/sig_analog.c Tue Aug 27 13:56:12 2013
@@ -2715,6 +2715,7 @@
 		subclass = analog_event2str(res);
 		data_size += strlen(subclass);
 		cause_code = ast_alloca(data_size);
+		memset(cause_code, 0, data_size);
 		cause_code->ast_cause = AST_CAUSE_NORMAL_CLEARING;
 		ast_copy_string(cause_code->chan_name, ast_channel_name(ast), AST_CHANNEL_NAME);
 		snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "ANALOG %s", subclass);

Modified: team/dlee/ASTERISK-21969/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/sig_pri.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/sig_pri.c (original)
+++ team/dlee/ASTERISK-21969/channels/sig_pri.c Tue Aug 27 13:56:12 2013
@@ -1404,6 +1404,7 @@
 	if (chan) {
 		int datalen = sizeof(*cause_code) + strlen(cause);
 		cause_code = ast_alloca(datalen);
+		memset(cause_code, 0, datalen);
 		cause_code->ast_cause = ast_cause;
 		ast_copy_string(cause_code->chan_name, ast_channel_name(chan), AST_CHANNEL_NAME);
 		ast_copy_string(cause_code->code, cause, datalen + 1 - sizeof(*cause_code));
@@ -9430,7 +9431,7 @@
 			info_str = pri_dump_info_str(pri->pri);
 			if (info_str) {
 				ast_cli(fd, "%s", info_str);
-				free(info_str);
+				ast_std_free(info_str);
 			}
 #else
 			pri_dump_info(pri->pri);

Modified: team/dlee/ASTERISK-21969/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/channels/sig_ss7.c?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/channels/sig_ss7.c (original)
+++ team/dlee/ASTERISK-21969/channels/sig_ss7.c Tue Aug 27 13:56:12 2013
@@ -411,6 +411,7 @@
 	int datalen = sizeof(*cause_code) + strlen(cause);
 
 	cause_code = ast_alloca(datalen);
+	memset(cause_code, 0, datalen);
 	cause_code->ast_cause = ast_cause;
 	ast_copy_string(cause_code->chan_name, ast_channel_name(owner), AST_CHANNEL_NAME);
 	ast_copy_string(cause_code->code, cause, datalen + 1 - sizeof(*cause_code));

Modified: team/dlee/ASTERISK-21969/configs/cel.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/configs/cel.conf.sample?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/configs/cel.conf.sample (original)
+++ team/dlee/ASTERISK-21969/configs/cel.conf.sample Tue Aug 27 13:56:12 2013
@@ -45,35 +45,25 @@
 ;  CHAN_END         -- The time a channel was terminated
 ;  ANSWER           -- The time a channel was answered (ie, phone taken off-hook)
 ;  HANGUP           -- The time at which a hangup occurred
-;  CONF_ENTER       -- The time a channel was connected into a conference room
-;  CONF_EXIT        -- The time a channel was removed from a conference room
-;  CONF_START       -- The time the first person enters a conference room
-;  CONF_END         -- The time the last person left a conference room (and
-;                      turned out the lights?)
+;  BRIDGE_ENTER       -- The time a channel was connected into a conference room
+;  BRIDGE_EXIT        -- The time a channel was removed from a conference room
 ;  APP_START        -- The time a tracked application was started
 ;  APP_END          -- the time a tracked application ended
 ;  PARK_START       -- The time a call was parked
 ;  PARK_END         -- Unpark event
-;  BRIDGE_START     -- The time a bridge is started
-;  BRIDGE_END       -- The time a bridge is ended
-;  BRIDGE_UPDATE    -- This is a replacement channel (Masquerade)
-;  3WAY_START       -- When a 3-way conference starts (usually via attended transfer)
-;  3WAY_END         -- When one or all exit a 3-way conference
 ;  BLINDTRANSFER    -- When a blind transfer is initiated
 ;  ATTENDEDTRANSFER -- When an attended transfer is initiated
-;  TRANSFER         -- Generic transfer initiated; not used yet...?
-;  PICKUP           -- This channel picked up the peer channel
+;  PICKUP           -- This channel picked up the specified channel
 ;  FORWARD          -- This channel is being forwarded somewhere else
-;  HOOKFLASH        -- So far, when a hookflash event occurs on a DAHDI
-;                      interface
 ;  LINKEDID_END     -- The last channel with the given linkedid is retired
 ;  USER_DEFINED     -- Triggered from the dialplan, and has a name given by the
 ;                      user
+;  LOCAL_OPTIMIZE   -- A local channel pair is optimizing away.
 ;
 ; Default value: none
 ;                (Track no events)
 
-events=APP_START,CHAN_START,CHAN_END,ANSWER,HANGUP,BRIDGE_START,BRIDGE_END
+events=APP_START,CHAN_START,CHAN_END,ANSWER,HANGUP,BRIDGE_ENTER,BRIDGE_EXIT
 
 ; Date Format
 ;

Modified: team/dlee/ASTERISK-21969/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/configure.ac?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/configure.ac (original)
+++ team/dlee/ASTERISK-21969/configure.ac Tue Aug 27 13:56:12 2013
@@ -408,6 +408,7 @@
 AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux], [isdnnet])
 AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
 AST_EXT_LIB_SETUP([JANSSON], [Jansson JSON library], [jansson])
+AST_EXT_LIB_SETUP([URIPARSER], [uriparser library], [uriparser])
 AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue])
 AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
 AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
@@ -543,6 +544,8 @@
 if test "x$JANSSON_LIB" == "x"; then
   AC_MSG_ERROR([*** JSON support not found (this typically means the libjansson development package is missing)])
 fi
+
+AST_EXT_LIB_CHECK([URIPARSER], [uriparser], [uriParseUriA], [uriparser/Uri.h])
 
 # Another mandatory item (unless it's explicitly disabled)
 AC_ARG_ENABLE([xmldoc],

Modified: team/dlee/ASTERISK-21969/contrib/scripts/sip_to_res_sip/astconfigparser.py
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-21969/contrib/scripts/sip_to_res_sip/astconfigparser.py?view=diff&rev=397813&r1=397812&r2=397813
==============================================================================
--- team/dlee/ASTERISK-21969/contrib/scripts/sip_to_res_sip/astconfigparser.py (original)
+++ team/dlee/ASTERISK-21969/contrib/scripts/sip_to_res_sip/astconfigparser.py Tue Aug 27 13:56:12 2013
@@ -1,3 +1,6 @@
+import re
+
+from astdicts import OrderedDict
 from astdicts import MultiOrderedDict
 
 def merge_values(left, right, key):
@@ -21,93 +24,197 @@
        added default sections. If not found at that point then a 'KeyError'
        exception is raised.
     """
-    def __init__(self, defaults = []):
+    count = 0
+
+    def __init__(self, defaults=None, templates=None):
         MultiOrderedDict.__init__(self)
-        self._defaults = defaults
+        # track an ordered id of sections
+        Section.count += 1
+        self.id = Section.count
+        self._defaults = [] if defaults is None else defaults
+        self._templates = [] if templates is None else templates
+
+    def __cmp__(self, other):
+        return cmp(self.id, other.id)
+
+    def get(self, key, from_self=True, from_templates=True, from_defaults=True):
+        if from_self and key in self:
+            return MultiOrderedDict.__getitem__(self, key)
+
+        if from_templates:
+            if self in self._templates:
+                return []
+            for t in self._templates:
+                try:
+                    # fail if not found on the search - doing it this way
+                    # allows template's templates to be searched.
+                    return t.get(key, True, from_templates, from_defaults)
+                except KeyError:
+                    pass
+
+        if from_defaults:
+            for d in self._defaults:
+                try:
+                    return d.get(key, True, from_templates, from_defaults)
+                except KeyError:
+                    pass
+
+        raise KeyError(key)
 
     def __getitem__(self, key):
         """Get the value for the given key. If it is not found in the 'self'
-           then check inside the defaults before declaring unable to locate."""
-        if key in self:
-            return MultiOrderedDict.__getitem__(self, key)
-
-        for default in self._defaults:
-            if key in default:
-                return default[key]
-
-        raise KeyError(key)
-
-    def keys(self):
+           then check inside templates and defaults before declaring raising
+           a KeyError exception.
+        """
+        return self.get(key)
+
+    def keys(self, self_only=False):
         res = MultiOrderedDict.keys(self)
+        if self_only:
+            return res
+
+        for d in self._templates:
+            for key in d.keys():
+                if key not in res:
+                    res.append(key)
+
         for d in self._defaults:
             for key in d.keys():
                 if key not in res:
                     res.append(key)
         return res
 
-    def add_default(self, default):
-        self._defaults.append(default)
+    def add_defaults(self, defaults):
+        defaults.sort()
+        for i in defaults:
+            self._defaults.insert(0, i)
+
+    def add_templates(self, templates):
+        templates.sort(reverse=True);
+        self._templates.extend(templates)
 
     def get_merged(self, key):
         """Return a list of values for a given key merged from default(s)"""
         # first merge key/values from defaults together
         merged = []
-        for i in self._defaults:
+        for i in reversed(self._defaults):
             if not merged:
                 merged = i
                 continue
             merged = merge_values(merged, i, key)
+
+        for i in reversed(self._templates):
+            if not merged:
+                merged = i
+                continue
+            merged = merge_values(merged, i, key)
+
         # then merge self in
         return merge_values(merged, self, key)
 
 ###############################################################################
 
-def remove_comment(line):
-    """Remove any commented elements from the given line"""
-    line = line.partition(COMMENT)[0]
-    return line.rstrip()
+COMMENT = ';'
+COMMENT_START = ';--'
+COMMENT_END = '--;'
+
+DEFAULTSECT = 'general'
+
+def remove_comment(line, is_comment):
+    """Remove any commented elements from the line."""
+    if not line: return line, is_comment
+
+    if is_comment:
+        part = line.partition(COMMENT_END)
+        if part[1]:
+            # found multi-line comment end check string after it
+            return remove_comment(part[2], False)
+        return "", True
+
+    part = line.partition(COMMENT_START)
+    if part[1]:
+        # found multi-line comment start check string before
+        # it to make sure there wasn't an eol comment in it
+        has_comment = part[0].partition(COMMENT)
+        if has_comment[1]:
+            # eol comment found return anything before it
+            return has_comment[0], False
+
+        # check string after it to see if the comment ends
+        line, is_comment = remove_comment(part[2], True)
+        if is_comment:
+            # return possible string data before comment
+            return part[0].strip(), True
+
+        # otherwise it was an embedded comment so combine
+        return ''.join([part[0].strip(), ' ', line]).rstrip(), False
+
+    # check for eol comment
+    return line.partition(COMMENT)[0].strip(), False
+
+def try_include(line):
+    """Checks to see if the given line is an include.  If so return the
+       included filename, otherwise None.
+    """
+    if not line.startswith('#'):
+        return None
+
+    # it is an include - get file name
+    try:
+        return line[line.index('"') + 1:line.rindex('"')]
+    except ValueError:
+        print "Invalid include - could not parse filename."
+        return None
 
 def try_section(line):
     """Checks to see if the given line is a section. If so return the section
        name, otherwise return 'None'.
     """
+    # leading spaces were stripped when checking for comments
     if not line.startswith('['):
-        return None
-
-    first, second, third = line.partition(']')
-    # TODO - third may contain template, parse to see if it is a template
-    #        or is a list of templates...return?
-    return first[1:]
+        return None, False, []
+

[... 3665 lines stripped ...]



More information about the asterisk-commits mailing list