[asterisk-commits] file: branch file/rtp_engine-mark2 r185841 - in /team/file/rtp_engine-mark2: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 1 10:31:19 CDT 2009


Author: file
Date: Wed Apr  1 10:31:16 2009
New Revision: 185841

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=185841
Log:
Address some more comments from Russell.

Modified:
    team/file/rtp_engine-mark2/include/asterisk/_private.h
    team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h
    team/file/rtp_engine-mark2/include/asterisk/stun.h
    team/file/rtp_engine-mark2/main/asterisk.c
    team/file/rtp_engine-mark2/main/loader.c
    team/file/rtp_engine-mark2/main/rtp_engine.c
    team/file/rtp_engine-mark2/main/stun.c
    team/file/rtp_engine-mark2/res/res_rtp_asterisk.c

Modified: team/file/rtp_engine-mark2/include/asterisk/_private.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/include/asterisk/_private.h?view=diff&rev=185841&r1=185840&r2=185841
==============================================================================
--- team/file/rtp_engine-mark2/include/asterisk/_private.h (original)
+++ team/file/rtp_engine-mark2/include/asterisk/_private.h Wed Apr  1 10:31:16 2009
@@ -41,6 +41,7 @@
 int ast_timing_init(void);		/*!< Provided by timing.c */
 int ast_indications_init(void); /*!< Provided by indications.c */
 int ast_indications_reload(void);/*!< Provided by indications.c */
+void ast_stun_init(void);               /*!< Provided by stun.c */
 
 /*!
  * \brief Reload asterisk modules.

Modified: team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h?view=diff&rev=185841&r1=185840&r2=185841
==============================================================================
--- team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h (original)
+++ team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h Wed Apr  1 10:31:16 2009
@@ -363,9 +363,6 @@
 	struct ast_rtp_payload_type payloads[AST_RTP_MAX_PT];
 };
 
-/*! Structure that represents an RTP session (instance) */
-struct ast_rtp_instance;
-
 /*! Structure that represents the glue that binds an RTP instance to a channel */
 struct ast_rtp_glue {
 	/*! Name of the channel driver that this glue is responsible for */
@@ -867,8 +864,8 @@
  * \param codecs The codecs structure to muck with
  * \param instance Optionally the instance that the codecs structure belongs to
  * \param payload Numerical payload that was seen in the a=rtpmap: SDP line
- * \param mimeType The string mime type that was seen
- * \param mimeSubtype The strin mime sub type that was seen
+ * \param mimetype The string mime type that was seen
+ * \param mimesubtype The strin mime sub type that was seen
  * \param options Optional options that may change the behavior of this specific payload
  *
  * \retval 0 success
@@ -884,7 +881,7 @@
  *
  * \since 1.6.3
  */
-int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimeType, char *mimeSubtype, enum ast_rtp_options options);
+int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimetype, char *mimesubtype, enum ast_rtp_options options);
 
 /*!
  * \brief Set payload type to a known MIME media type for a codec with a specific sample rate
@@ -892,8 +889,8 @@
  * \param rtp RTP structure to modify
  * \param instance Optionally the instance that the codecs structure belongs to
  * \param pt Payload type entry to modify
- * \param mimeType top-level MIME type of media stream (typically "audio", "video", "text", etc.)
- * \param mimeSubtype MIME subtype of media stream (typically a codec name)
+ * \param mimetype top-level MIME type of media stream (typically "audio", "video", "text", etc.)
+ * \param mimesubtype MIME subtype of media stream (typically a codec name)
  * \param options Zero or more flags from the ast_rtp_options enum
  * \param sample_rate The sample rate of the media stream
  *
@@ -907,7 +904,7 @@
  * \since 1.6.3
  */
 int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt,
-				  char *mimeType, char *mimeSubtype,
+				  char *mimetype, char *mimesubtype,
 				  enum ast_rtp_options options,
 				  unsigned int sample_rate);
 

Modified: team/file/rtp_engine-mark2/include/asterisk/stun.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/include/asterisk/stun.h?view=diff&rev=185841&r1=185840&r2=185841
==============================================================================
--- team/file/rtp_engine-mark2/include/asterisk/stun.h (original)
+++ team/file/rtp_engine-mark2/include/asterisk/stun.h Wed Apr  1 10:31:16 2009
@@ -64,9 +64,6 @@
  */
 int ast_stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, size_t len, stun_cb_f *stun_cb, void *arg);
 
-/*! \brief Initialize STUN */
-void ast_stun_init(void);
-
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/file/rtp_engine-mark2/main/asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/main/asterisk.c?view=diff&rev=185841&r1=185840&r2=185841
==============================================================================
--- team/file/rtp_engine-mark2/main/asterisk.c (original)
+++ team/file/rtp_engine-mark2/main/asterisk.c Wed Apr  1 10:31:16 2009
@@ -120,7 +120,6 @@
 #include "asterisk/cdr.h"
 #include "asterisk/pbx.h"
 #include "asterisk/enum.h"
-#include "asterisk/rtp.h"
 #include "asterisk/http.h"
 #include "asterisk/udptl.h"
 #include "asterisk/app.h"

Modified: team/file/rtp_engine-mark2/main/loader.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/main/loader.c?view=diff&rev=185841&r1=185840&r2=185841
==============================================================================
--- team/file/rtp_engine-mark2/main/loader.c (original)
+++ team/file/rtp_engine-mark2/main/loader.c Wed Apr  1 10:31:16 2009
@@ -43,7 +43,6 @@
 #include "asterisk/manager.h"
 #include "asterisk/cdr.h"
 #include "asterisk/enum.h"
-#include "asterisk/rtp.h"
 #include "asterisk/http.h"
 #include "asterisk/lock.h"
 #include "asterisk/features.h"

Modified: team/file/rtp_engine-mark2/main/rtp_engine.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/main/rtp_engine.c?view=diff&rev=185841&r1=185840&r2=185841
==============================================================================
--- team/file/rtp_engine-mark2/main/rtp_engine.c (original)
+++ team/file/rtp_engine-mark2/main/rtp_engine.c Wed Apr  1 10:31:16 2009
@@ -491,7 +491,7 @@
 }
 
 int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt,
-				 char *mimeType, char *mimeSubtype,
+				 char *mimetype, char *mimesubtype,
 				 enum ast_rtp_options options,
 				 unsigned int sample_rate)
 {
@@ -504,11 +504,11 @@
 	for (i = 0; i < ARRAY_LEN(ast_rtp_mime_types); ++i) {
 		const struct ast_rtp_mime_type *t = &ast_rtp_mime_types[i];
 
-		if (strcasecmp(mimeSubtype, t->subtype)) {
+		if (strcasecmp(mimesubtype, t->subtype)) {
 			continue;
 		}
 
-		if (strcasecmp(mimeType, t->type)) {
+		if (strcasecmp(mimetype, t->type)) {
 			continue;
 		}
 
@@ -539,9 +539,9 @@
 	return (found ? 0 : -2);
 }
 
-int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimeType, char *mimeSubtype, enum ast_rtp_options options)
-{
-	return ast_rtp_codecs_payloads_set_rtpmap_type_rate(codecs, instance, payload, mimeType, mimeSubtype, options, 0);
+int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimetype, char *mimesubtype, enum ast_rtp_options options)
+{
+	return ast_rtp_codecs_payloads_set_rtpmap_type_rate(codecs, instance, payload, mimetype, mimesubtype, options, 0);
 }
 
 void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)

Modified: team/file/rtp_engine-mark2/main/stun.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/main/stun.c?view=diff&rev=185841&r1=185840&r2=185841
==============================================================================
--- team/file/rtp_engine-mark2/main/stun.c (original)
+++ team/file/rtp_engine-mark2/main/stun.c Wed Apr  1 10:31:16 2009
@@ -30,9 +30,11 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 124370 $")
 
-#include "asterisk/rtp.h"
+#include "asterisk/_private.h"
 #include "asterisk/stun.h"
 #include "asterisk/cli.h"
+#include "asterisk/utils.h"
+#include "asterisk/channel.h"
 
 static int stundebug;			/*!< Are we debugging stun? */
 

Modified: team/file/rtp_engine-mark2/res/res_rtp_asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/res/res_rtp_asterisk.c?view=diff&rev=185841&r1=185840&r2=185841
==============================================================================
--- team/file/rtp_engine-mark2/res/res_rtp_asterisk.c (original)
+++ team/file/rtp_engine-mark2/res/res_rtp_asterisk.c Wed Apr  1 10:31:16 2009
@@ -57,6 +57,12 @@
 #define RTCP_MIN_INTERVALMS       500	/*!< Min milli-seconds between RTCP reports we send */
 #define RTCP_MAX_INTERVALMS       60000	/*!< Max milli-seconds between RTCP reports we send */
 
+#define DEFAULT_RTP_START 5000 /*!< Default port number to start allocating RTP ports from */
+#define DEFAULT_RTP_END 31000  /*!< Default maximum port number to end allocating RTP ports at */
+
+#define MINIMUM_RTP_PORT 1024 /*!< Minimum port number to accept */
+#define MAXIMUM_RTP_PORT 65535 /*!< Maximum port number to accept */
+
 #define RTCP_PT_FUR     192
 #define RTCP_PT_SR      200
 #define RTCP_PT_RR      201
@@ -72,8 +78,8 @@
 
 static int dtmftimeout = DEFAULT_DTMF_TIMEOUT;
 
-static int rtpstart = 5000;			/*!< First port for RTP sessions (set in rtp.conf) */
-static int rtpend = 31000;			/*!< Last port for RTP sessions (set in rtp.conf) */
+static int rtpstart = DEFAULT_RTP_START;			/*!< First port for RTP sessions (set in rtp.conf) */
+static int rtpend = DEFAULT_RTP_END;			/*!< Last port for RTP sessions (set in rtp.conf) */
 static int rtpdebug;			/*!< Are we debugging? */
 static int rtcpdebug;			/*!< Are we debugging RTCP? */
 static int rtcpstats;			/*!< Are we debugging RTCP? */
@@ -2478,24 +2484,24 @@
 		return 0;
 	}
 
-	rtpstart = 5000;
-	rtpend = 31000;
+	rtpstart = DEFAULT_RTP_START;
+	rtpend = DEFAULT_RTP_END;
 	dtmftimeout = DEFAULT_DTMF_TIMEOUT;
 	strictrtp = STRICT_RTP_OPEN;
 	if (cfg) {
 		if ((s = ast_variable_retrieve(cfg, "general", "rtpstart"))) {
 			rtpstart = atoi(s);
-			if (rtpstart < 1024)
-				rtpstart = 1024;
-			if (rtpstart > 65535)
-				rtpstart = 65535;
+			if (rtpstart < MINIMUM_RTP_PORT)
+				rtpstart = MINIMUM_RTP_PORT;
+			if (rtpstart > MAXIMUM_RTP_PORT)
+				rtpstart = MAXIMUM_RTP_PORT;
 		}
 		if ((s = ast_variable_retrieve(cfg, "general", "rtpend"))) {
 			rtpend = atoi(s);
-			if (rtpend < 1024)
-				rtpend = 1024;
-			if (rtpend > 65535)
-				rtpend = 65535;
+			if (rtpend < MINIMUM_RTP_PORT)
+				rtpend = MINIMUM_RTP_PORT;
+			if (rtpend > MAXIMUM_RTP_PORT)
+				rtpend = MAXIMUM_RTP_PORT;
 		}
 		if ((s = ast_variable_retrieve(cfg, "general", "rtcpinterval"))) {
 			rtcpinterval = atoi(s);
@@ -2508,10 +2514,7 @@
 		}
 		if ((s = ast_variable_retrieve(cfg, "general", "rtpchecksums"))) {
 #ifdef SO_NO_CHECK
-			if (ast_false(s))
-				nochecksums = 1;
-			else
-				nochecksums = 0;
+			nochecksums = ast_false(s) ? 1 : 0;
 #else
 			if (ast_false(s))
 				ast_log(LOG_WARNING, "Disabling RTP checksums is not supported on this operating system!\n");
@@ -2532,8 +2535,8 @@
 	}
 	if (rtpstart >= rtpend) {
 		ast_log(LOG_WARNING, "Unreasonable values for RTP start/end port in rtp.conf\n");
-		rtpstart = 5000;
-		rtpend = 31000;
+		rtpstart = DEFAULT_RTP_START;
+		rtpend = DEFAULT_RTP_END;
 	}
 	ast_verb(2, "RTP Allocating from port range %d -> %d\n", rtpstart, rtpend);
 	return 0;




More information about the asterisk-commits mailing list