[asterisk-commits] trunk r37564 - in /trunk: ./ channels/ configs/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jul 13 13:35:42 MST 2006


Author: kpfleming
Date: Thu Jul 13 15:35:41 2006
New Revision: 37564

URL: http://svn.digium.com/view/asterisk?rev=37564&view=rev
Log:
actually make the non-standard G726-32 behavior available for SIP clients

Modified:
    trunk/UPGRADE.txt
    trunk/channels/chan_sip.c
    trunk/configs/sip.conf.sample

Modified: trunk/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/trunk/UPGRADE.txt?rev=37564&r1=37563&r2=37564&view=diff
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Thu Jul 13 15:35:41 2006
@@ -285,6 +285,19 @@
 * Support for MFC/R2 has been removed, as it has not been functional for some
   time and it has no maintainer.
 
+The G726-32 codec:
+
+* It has been determined that previous versions of Asterisk used the wrong codeword
+  packing order for G726-32 data. This version supports both available packing orders,
+  and can transcode between them. It also now selects the proper order when
+  negotiating with a SIP peer based on the codec name supplied in the SDP. However,
+  there are existing devices that improperly request one order and then use another;
+  Sipura and Grandstream ATAs are known to do this, and there may be others. To
+  be able to continue to use these devices with this version of Asterisk and the
+  G726-32 codec, a configuration parameter called 'g726nonstandard' has been added
+  to sip.conf, so that Asterisk can use the packing order expected by the device (even
+  though it requested a different order).
+
 Installation:
 
 * On BSD systems, the installation directories have changed to more "FreeBSDish"

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=37564&r1=37563&r2=37564&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jul 13 15:35:41 2006
@@ -705,10 +705,11 @@
 #define SIP_CALL_LIMIT		(1 << 28)	/*!< Call limit enforced for this call */
 #define SIP_SENDRPID		(1 << 29)	/*!< Remote Party-ID Support */
 #define SIP_INC_COUNT		(1 << 30)	/*!< Did this connection increment the counter of in-use calls? */
+#define SIP_G726_NONSTANDARD	(1 << 31)	/*!< Use non-standard packing for G726-32 data */
 
 #define SIP_FLAGS_TO_COPY \
 	(SIP_PROMISCREDIR | SIP_TRUSTRPID | SIP_SENDRPID | SIP_DTMF | SIP_REINVITE | \
-	 SIP_PROG_INBAND | SIP_USECLIENTCODE | SIP_NAT | \
+	 SIP_PROG_INBAND | SIP_USECLIENTCODE | SIP_NAT | SIP_G726_NONSTANDARD | \
 	 SIP_USEREQPHONE | SIP_INSECURE_PORT | SIP_INSECURE_INVITE)
 
 /* a new page of flags */
@@ -778,7 +779,7 @@
 #define sipdebug_config		ast_test_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONFIG)
 #define sipdebug_console	ast_test_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONSOLE)
 
-/*! \brief T38 Sates for a call */
+/*! \brief T38 States for a call */
 enum t38state {
 	T38_DISABLED = 0,		/*! Not enabled */
 	T38_LOCAL_DIRECT,		/*! Offered from local */
@@ -4719,7 +4720,8 @@
 			ast_verbose("Found description format %s for ID %d\n", mimeSubtype, codec);
 
 		/* Note: should really look at the 'freq' and '#chans' params too */
-		ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype, 0);
+		ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype,
+					ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0);
 		if (p->vrtp)
 			ast_rtp_set_rtpmap_type(newvideortp, codec, "video", mimeSubtype, 0);
 	}
@@ -5571,7 +5573,8 @@
 
 	ast_build_string(m_buf, m_size, " %d", rtp_code);
 	ast_build_string(a_buf, a_size, "a=rtpmap:%d %s/%d\r\n", rtp_code,
-			 ast_rtp_lookup_mime_subtype(1, codec, 0),
+			 ast_rtp_lookup_mime_subtype(1, codec,
+						     ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0),
 			 sample_rate);
 	if (codec == AST_FORMAT_G729A) {
 		/* Indicate that we don't support VAD (G.729 annex B) */
@@ -5583,7 +5586,7 @@
 	}
 }
 
-/*! \brief Get Max T.38 Transmision rate from T38 capabilities */
+/*! \brief Get Max T.38 Transmission rate from T38 capabilities */
 static int t38_get_rate(int t38cap)
 {
 	int maxrate = (t38cap & (T38FAX_RATE_14400 | T38FAX_RATE_12000 | T38FAX_RATE_9600 | T38FAX_RATE_7200 | T38FAX_RATE_4800 | T38FAX_RATE_2400));
@@ -14715,6 +14718,10 @@
 	} else if (!strcasecmp(v->name, "sendrpid")) {
 		ast_set_flag(&mask[0], SIP_SENDRPID);
 		ast_set2_flag(&flags[0], ast_true(v->value), SIP_SENDRPID);
+		res = 1;
+	} else if (!strcasecmp(v->name, "g726nonstandard")) {
+		ast_set_flag(&mask[0], SIP_G726_NONSTANDARD);
+		ast_set2_flag(&flags[0], ast_true(v->value), SIP_G726_NONSTANDARD);
 		res = 1;
 	} else if (!strcasecmp(v->name, "useclientcode")) {
 		ast_set_flag(&mask[0], SIP_USECLIENTCODE);

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?rev=37564&r1=37563&r2=37564&view=diff
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Thu Jul 13 15:35:41 2006
@@ -111,6 +111,13 @@
  		    		; for any reason, always reject with '401 Unauthorized'
  				; instead of letting the requester know whether there was
  				; a matching user or peer for their request
+
+;g726nonstandard = yes		; If the peer negotiates G726-32 audio, use AAL2 packing
+				; order instead of RFC3551 packing order (this is required
+				; for Sipura and Grandstream ATAs, among others). This is
+				; contrary to the RFC3551 specification, the peer _should_
+				; be negotiating AAL2-G726-32 instead :-(
+
 ;
 ; If regcontext is specified, Asterisk will dynamically create and destroy a
 ; NoOp priority 1 extension for a given peer who registers or unregisters with



More information about the asterisk-commits mailing list