[svn-commits] mmichelson: branch 1.6.2 r209135 - in /branches/1.6.2: ./ configs/ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 27 12:57:44 CDT 2009


Author: mmichelson
Date: Mon Jul 27 12:57:40 2009
New Revision: 209135

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=209135
Log:
Merged revisions 209132 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r209132 | mmichelson | 2009-07-27 12:50:04 -0500 (Mon, 27 Jul 2009) | 24 lines
  
  Merged revisions 209131 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r209131 | mmichelson | 2009-07-27 12:44:06 -0500 (Mon, 27 Jul 2009) | 18 lines
    
    Allow for UDPTL to use only even-numbered ports if desired.
    
    There are some VoIP providers out there that will not accept SDP
    offers with odd numbered UDPTL ports. While it is my personal opinion
    that these VoIP providers are misinterpreting RFC 2327, it really is
    not a big deal to play along with their silly little games. Of course,
    since restricting UDPTL ports to only even numbers reduces the range
    of available ports by half, so the option to use only even port numbers
    is off by default. A user can enable the behavior by setting
    use_even_ports=yes in udptl.conf.
    
    (closes issue #15182)
    Reported by: CGMChris
    Patches:
          15182.patch uploaded by mmichelson (license 60)
    Tested by: CGMChris
  ........
................

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/configs/udptl.conf.sample
    branches/1.6.2/main/udptl.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/configs/udptl.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/configs/udptl.conf.sample?view=diff&rev=209135&r1=209134&r2=209135
==============================================================================
--- branches/1.6.2/configs/udptl.conf.sample (original)
+++ branches/1.6.2/configs/udptl.conf.sample Mon Jul 27 12:57:40 2009
@@ -28,3 +28,8 @@
 ; The span over which parity is calculated for FEC in a UDPTL packet
 ;
 udptlfecspan = 3
+;
+; Some VoIP providers will only accept an offer with an even-numbered
+; UDPTL port. Set this option so that Asterisk will only attempt to use
+; even-numbered ports when negotiating T.38. Default is no.
+use_even_ports = no

Modified: branches/1.6.2/main/udptl.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/main/udptl.c?view=diff&rev=209135&r1=209134&r2=209135
==============================================================================
--- branches/1.6.2/main/udptl.c (original)
+++ branches/1.6.2/main/udptl.c Mon Jul 27 12:57:40 2009
@@ -85,6 +85,7 @@
 static int udptlfecentries;
 static int udptlfecspan;
 static int udptlmaxdatagram;
+static int use_even_ports;
 
 #define LOCAL_FAX_MAX_DATAGRAM      1400
 #define MAX_FEC_ENTRIES             5
@@ -889,6 +890,9 @@
 #endif
 	/* Find us a place */
 	x = (udptlstart == udptlend) ? udptlstart : (ast_random() % (udptlend - udptlstart)) + udptlstart;
+	if (use_even_ports && (x & 1)) {
+		++x;
+	}
 	startplace = x;
 	for (;;) {
 		udptl->us.sin_port = htons(x);
@@ -901,7 +905,12 @@
 			ast_free(udptl);
 			return NULL;
 		}
-		if (++x > udptlend)
+		if (use_even_ports) {
+			x += 2;
+		} else {
+			++x;
+		}
+		if (x > udptlend)
 			x = udptlstart;
 		if (x == startplace) {
 			ast_log(LOG_WARNING, "No UDPTL ports remaining\n");
@@ -1258,6 +1267,7 @@
 	udptlfecentries = 0;
 	udptlfecspan = 0;
 	udptlmaxdatagram = 0;
+	use_even_ports = 0;
 
 	if (cfg) {
 		if ((s = ast_variable_retrieve(cfg, "general", "udptlstart"))) {
@@ -1332,6 +1342,9 @@
 				udptlfecspan = MAX_FEC_SPAN;
 			}
 		}
+		if ((s = ast_variable_retrieve(cfg, "general", "use_even_ports"))) {
+			use_even_ports = ast_true(s);
+		}
 		ast_config_destroy(cfg);
 	}
 	if (udptlstart >= udptlend) {
@@ -1339,6 +1352,14 @@
 		udptlstart = 4500;
 		udptlend = 4999;
 	}
+	if (use_even_ports && (udptlstart & 1)) {
+		++udptlstart;
+		ast_log(LOG_NOTICE, "Odd numbered udptlstart specified but use_even_ports enabled. udptlstart is now %d\n", udptlstart);
+	}
+	if (use_even_ports && (udptlend & 1)) {
+		--udptlend;
+		ast_log(LOG_NOTICE, "Odd numbered udptlend specified but use_event_ports enabled. udptlend is now %d\n", udptlend);
+	}
 	ast_verb(2, "UDPTL allocating from port range %d -> %d\n", udptlstart, udptlend);
 }
 




More information about the svn-commits mailing list