[asterisk-commits] file: branch file/p2prtpbridging r40814 - /team/file/p2prtpbridging/main/rtp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Aug 21 18:24:49 MST 2006


Author: file
Date: Mon Aug 21 20:24:49 2006
New Revision: 40814

URL: http://svn.digium.com/view/asterisk?rev=40814&view=rev
Log:
Minor optimization, even if we need to listen for DTMF on a channel - we can still send the audio packets directly, we just have to send DTMF through the core.

Modified:
    team/file/p2prtpbridging/main/rtp.c

Modified: team/file/p2prtpbridging/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/file/p2prtpbridging/main/rtp.c?rev=40814&r1=40813&r2=40814&view=diff
==============================================================================
--- team/file/p2prtpbridging/main/rtp.c (original)
+++ team/file/p2prtpbridging/main/rtp.c Mon Aug 21 20:24:49 2006
@@ -171,6 +171,7 @@
 #define FLAG_NAT_INACTIVE_NOWARN	(1 << 1)
 #define FLAG_HAS_DTMF			(1 << 3)
 #define FLAG_P2P_SENT_MARK              (1 << 4)
+#define FLAG_P2P_NEED_DTMF              (1 << 5)
 
 /*!
  * \brief Structure defining an RTCP session.
@@ -947,6 +948,12 @@
 
 	/* Check what the payload value should be */
 	rtpPT = ast_rtp_lookup_pt(rtp, payload);
+
+	/* If the payload is DTMF, and we are listening for DTMF - then feed it into the core */
+	if (!rtpPT.isAstFormat && rtpPT.code == AST_RTP_DTMF)
+		return -1;
+
+	/* Otherwise adjust bridged payload to match */
 	bridged_payload = ast_rtp_lookup_code(bridged, rtpPT.isAstFormat, rtpPT.code);
 
 	/* If the mark bit has not been sent yet... do it now */
@@ -2842,11 +2849,15 @@
 	}
 
 	/* If we need to feed DTMF frames into the core then only do a partial native bridge */
-	if (ast_test_flag(p0, FLAG_HAS_DTMF) && (flags & AST_BRIDGE_DTMF_CHANNEL_0))
+	if (ast_test_flag(p0, FLAG_HAS_DTMF) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) {
+		ast_set_flag(p0, FLAG_P2P_NEED_DTMF);
 		audio_p0_res = AST_RTP_TRY_PARTIAL;
-
-	if (ast_test_flag(p1, FLAG_HAS_DTMF) && (flags & AST_BRIDGE_DTMF_CHANNEL_1))
+	}
+
+	if (ast_test_flag(p1, FLAG_HAS_DTMF) && (flags & AST_BRIDGE_DTMF_CHANNEL_1)) {
+		ast_set_flag(p1, FLAG_P2P_NEED_DTMF);
 		audio_p1_res = AST_RTP_TRY_PARTIAL;
+	}
 
 	/* Get codecs from both sides */
 	codec0 = pr0->get_codec ? pr0->get_codec(c0) : 0;



More information about the asterisk-commits mailing list