[asterisk-commits] oej: branch oej/roibos-cng-support-1.8 r373163 - in /team/oej/roibos-cng-supp...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 19 09:42:03 CDT 2012


Author: oej
Date: Wed Sep 19 09:41:54 2012
New Revision: 373163

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373163
Log:
- Adding some general information to readme
- Adding support for CN as a codec in sip.conf
- starting with negotiation support, not completed


Modified:
    team/oej/roibos-cng-support-1.8/README.roibos-cng.txt
    team/oej/roibos-cng-support-1.8/channels/chan_sip.c
    team/oej/roibos-cng-support-1.8/include/asterisk/frame.h
    team/oej/roibos-cng-support-1.8/main/frame.c
    team/oej/roibos-cng-support-1.8/main/rtp_engine.c
    team/oej/roibos-cng-support-1.8/res/res_rtp_asterisk.c

Modified: team/oej/roibos-cng-support-1.8/README.roibos-cng.txt
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/README.roibos-cng.txt?view=diff&rev=373163&r1=373162&r2=373163
==============================================================================
--- team/oej/roibos-cng-support-1.8/README.roibos-cng.txt (original)
+++ team/oej/roibos-cng-support-1.8/README.roibos-cng.txt Wed Sep 19 09:41:54 2012
@@ -10,6 +10,17 @@
 
 Comfort Noise support in Asterisk 1.8
 =====================================
+
+Comfort Noise in SIP/RTP is 
+- negotiated in the SDP as a codec
+- starts activated by a silence in the media stream
+- the sender stops sending media, sends a single CNG RTP packet that indicates
+  a noise level
+- the receiver activated a Comfort Noise Generator in the call until media 
+  reappears from the sender
+
+A requirement for using this is that it is included as a codec with payload
+13 (or dynamic) in the SDP
 
 Current state:
 

Modified: team/oej/roibos-cng-support-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/channels/chan_sip.c?view=diff&rev=373163&r1=373162&r2=373163
==============================================================================
--- team/oej/roibos-cng-support-1.8/channels/chan_sip.c (original)
+++ team/oej/roibos-cng-support-1.8/channels/chan_sip.c Wed Sep 19 09:41:54 2012
@@ -11093,6 +11093,7 @@
 		fmt = ast_codec_pref_getsize(pref, codec);
 	} 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,
 		       ast_rtp_lookup_mime_subtype2(1, codec,

Modified: team/oej/roibos-cng-support-1.8/include/asterisk/frame.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/include/asterisk/frame.h?view=diff&rev=373163&r1=373162&r2=373163
==============================================================================
--- team/oej/roibos-cng-support-1.8/include/asterisk/frame.h (original)
+++ team/oej/roibos-cng-support-1.8/include/asterisk/frame.h Wed Sep 19 09:41:54 2012
@@ -301,6 +301,8 @@
 #define AST_FORMAT_SPEEX16    (1ULL << 33)
 /*! Raw mu-law data (G.711) */
 #define AST_FORMAT_TESTLAW    (1ULL << 47)
+/*! Comfort noise. Not a frame type per se, but needs to be added as a codec */
+#define AST_FORMAT_CN    (1ULL << 48)
 /*! Reserved bit - do not use */
 #define AST_FORMAT_RESERVED   (1ULL << 63)
 

Modified: team/oej/roibos-cng-support-1.8/main/frame.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/main/frame.c?view=diff&rev=373163&r1=373162&r2=373163
==============================================================================
--- team/oej/roibos-cng-support-1.8/main/frame.c (original)
+++ team/oej/roibos-cng-support-1.8/main/frame.c Wed Sep 19 09:41:54 2012
@@ -126,6 +126,7 @@
 	{ AST_FORMAT_SIREN14, "siren14", 32000, "ITU G.722.1 Annex C, (Siren14, licensed from Polycom)", 120, 20, 80, 20, 20 },	/*!< Binary commercial distribution */
 	{ AST_FORMAT_TESTLAW, "testlaw", 8000, "G.711 test-law", 80, 10, 150, 10, 20 },                        /*!< codec_ulaw.c */
 	{ AST_FORMAT_G719, "g719", 48000, "ITU G.719", 160, 20, 80, 20, 20 },
+	{ AST_FORMAT_CN, "cn", 8000, "Comfort Noise"},
 };
 
 struct ast_frame ast_null_frame = { AST_FRAME_NULL, };

Modified: team/oej/roibos-cng-support-1.8/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/main/rtp_engine.c?view=diff&rev=373163&r1=373162&r2=373163
==============================================================================
--- team/oej/roibos-cng-support-1.8/main/rtp_engine.c (original)
+++ team/oej/roibos-cng-support-1.8/main/rtp_engine.c Wed Sep 19 09:41:54 2012
@@ -119,7 +119,7 @@
 	{{1, AST_FORMAT_G726_AAL2}, "audio", "AAL2-G726-32", 8000},
 	{{0, AST_RTP_DTMF}, "audio", "telephone-event", 8000},
 	{{0, AST_RTP_CISCO_DTMF}, "audio", "cisco-telephone-event", 8000},
-	{{0, AST_RTP_CN}, "audio", "CN", 8000},
+	{{1, AST_FORMAT_CN}, "audio", "CN", 8000},
 	{{1, AST_FORMAT_JPEG}, "video", "JPEG", 90000},
 	{{1, AST_FORMAT_PNG}, "video", "PNG", 90000},
 	{{1, AST_FORMAT_H261}, "video", "H261", 90000},
@@ -158,11 +158,11 @@
 	[9] = {1, AST_FORMAT_G722},
 	[10] = {1, AST_FORMAT_SLINEAR}, /* 2 channels */
 	[11] = {1, AST_FORMAT_SLINEAR}, /* 1 channel */
-	[13] = {0, AST_RTP_CN},
+	[13] = {1, AST_FORMAT_CN},
 	[16] = {1, AST_FORMAT_ADPCM}, /* 11.025 kHz */
 	[17] = {1, AST_FORMAT_ADPCM}, /* 22.050 kHz */
 	[18] = {1, AST_FORMAT_G729A},
-	[19] = {0, AST_RTP_CN},         /* Also used for CN */
+	[19] = {1, AST_FORMAT_CN},         /* Also used for CN */
 	[26] = {1, AST_FORMAT_JPEG},
 	[31] = {1, AST_FORMAT_H261},
 	[34] = {1, AST_FORMAT_H263},

Modified: team/oej/roibos-cng-support-1.8/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/res/res_rtp_asterisk.c?view=diff&rev=373163&r1=373162&r2=373163
==============================================================================
--- team/oej/roibos-cng-support-1.8/res/res_rtp_asterisk.c (original)
+++ team/oej/roibos-cng-support-1.8/res/res_rtp_asterisk.c Wed Sep 19 09:41:54 2012
@@ -2350,7 +2350,7 @@
 			process_dtmf_rfc2833(instance, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp, &addr, payloadtype, mark, &frames);
 		} else if (payload.code == AST_RTP_CISCO_DTMF) {
 			f = process_dtmf_cisco(instance, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp, &addr, payloadtype, mark);
-		} else if (payload.code == AST_RTP_CN) {
+		} else if (payload.code == AST_FORMAT_CN) {
 			f = process_cn_rfc3389(instance, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp, &addr, payloadtype, mark);
 		} else {
 			ast_log(LOG_NOTICE, "Unknown RTP codec %d received from '%s'\n",
@@ -2801,7 +2801,7 @@
 		return -1;
 	}
 
-	payload = ast_rtp_codecs_payload_lookup(ast_rtp_instance_get_codecs(instance), AST_RTP_CN);
+	payload = ast_rtp_codecs_payload_lookup(ast_rtp_instance_get_codecs(instance), AST_FORMAT_CN);
 
 	level = 127 - (level & 0x7f);
 	
@@ -2821,7 +2821,7 @@
 	} else if (rtp_debug_test_addr(&remote_address)) {
 		ast_verbose("Sent Comfort Noise RTP packet to %s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
 				ast_sockaddr_stringify(&remote_address),
-				AST_RTP_CN, rtp->seqno, rtp->lastdigitts, res - hdrlen);
+				AST_FORMAT_CN, rtp->seqno, rtp->lastdigitts, res - hdrlen);
 	}
 
 	return res;




More information about the asterisk-commits mailing list