[asterisk-commits] file: branch file/rtp_engine-mark2 r185119 - in /team/file/rtp_engine-mark2: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 30 14:29:31 CDT 2009
Author: file
Date: Mon Mar 30 14:29:27 2009
New Revision: 185119
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=185119
Log:
Update based on comments from Russell.
Modified:
team/file/rtp_engine-mark2/UPGRADE.txt
team/file/rtp_engine-mark2/channels/chan_sip.c
team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h
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/UPGRADE.txt
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/UPGRADE.txt?view=diff&rev=185119&r1=185118&r2=185119
==============================================================================
--- team/file/rtp_engine-mark2/UPGRADE.txt (original)
+++ team/file/rtp_engine-mark2/UPGRADE.txt Mon Mar 30 14:29:27 2009
@@ -20,7 +20,11 @@
From 1.6.2 to 1.6.3:
-* Nothing, yet!
+* The usage of RTP inside of Asterisk has now become modularized. This means
+ the Asterisk RTP stack now exists as a loadable module, res_rtp_asterisk.
+ If you are not using autoload=yes in modules.conf you will need to ensure
+ it is set to load. If not then any module which uses RTP (such as chan_sip)
+ will not be able to send or receive calls.
From 1.6.1 to 1.6.2:
Modified: team/file/rtp_engine-mark2/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_sip.c?view=diff&rev=185119&r1=185118&r2=185119
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_sip.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_sip.c Mon Mar 30 14:29:27 2009
@@ -7771,7 +7771,7 @@
int codec_n;
for (codec_n = 0; codec_n < AST_RTP_MAX_PT; codec_n++) {
struct ast_rtp_payload_type format = ast_rtp_codecs_payload_lookup(&p->rtp->codecs, codec_n);
- if (!format.isAstFormat || !format.code) /* non-codec or not found */
+ if (!format.asterisk_format || !format.code) /* non-codec or not found */
continue;
if (option_debug)
ast_log(LOG_DEBUG, "Setting framing for %d to %ld\n", format.code, framing);
@@ -7806,7 +7806,7 @@
/* it wasn't found, try the video rtp */
payload = ast_rtp_codecs_payload_lookup(&newvideortp, codec);
}
- if (payload.code && payload.isAstFormat) {
+ if (payload.code && payload.asterisk_format) {
unsigned int bit_rate;
switch (payload.code) {
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=185119&r1=185118&r2=185119
==============================================================================
--- team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h (original)
+++ team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h Mon Mar 30 14:29:27 2009
@@ -1,8 +1,9 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2008, Digium, Inc.
- *
+ * Copyright (C) 1999 - 2009, Digium, Inc.
+ *
+ * Mark Spencer <markster at digium.com>
* Joshua Colp <jcolp at digium.com>
*
* See http://www.asterisk.org for more information about
@@ -210,7 +211,7 @@
/*! Structure that represents a payload */
struct ast_rtp_payload_type {
/*! Is this an Asterisk value */
- int isAstFormat;
+ int asterisk_format;
/*! Actual internal value of the payload */
int code;
};
@@ -394,18 +395,18 @@
const char *type;
/*! Module that the RTP glue came from */
struct ast_module *mod;
- /*!
- * \brief Callback for retrieving the RTP instance carrying audio
+ /*!
+ * \brief Callback for retrieving the RTP instance carrying audio
* \note This function increases the reference count on the returned RTP instance.
*/
enum ast_rtp_glue_result (*get_rtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
- /*!
- * \brief Callback for retrieving the RTP instance carrying video
+ /*!
+ * \brief Callback for retrieving the RTP instance carrying video
* \note This function increases the reference count on the returned RTP instance.
*/
enum ast_rtp_glue_result (*get_vrtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
- /*!
- * \brief Callback for retrieving the RTP instance carrying text
+ /*!
+ * \brief Callback for retrieving the RTP instance carrying text
* \note This function increases the reference count on the returned RTP instance.
*/
enum ast_rtp_glue_result (*get_trtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
@@ -419,7 +420,8 @@
#define ast_rtp_engine_register(engine) ast_rtp_engine_register2(engine, ast_module_info->self)
-/*! \brief Register an RTP engine
+/*!
+ * \brief Register an RTP engine
*
* \param engine Structure of the RTP engine to register
* \param module Module that the RTP engine is part of
@@ -441,7 +443,8 @@
*/
int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module);
-/*! \brief Unregister an RTP engine
+/*!
+ * \brief Unregister an RTP engine
*
* \param engine Structure of the RTP engine to unregister
*
@@ -461,7 +464,8 @@
#define ast_rtp_glue_register(glue) ast_rtp_glue_register2(glue, ast_module_info->self)
-/*! \brief Register RTP glue
+/*!
+ * \brief Register RTP glue
*
* \param glue The glue to register
* \param module Module that the RTP glue is part of
@@ -483,7 +487,8 @@
*/
int ast_rtp_glue_register2(struct ast_rtp_glue *glue, struct ast_module *module);
-/*! \brief Unregister RTP glue
+/*!
+ * \brief Unregister RTP glue
*
* \param glue The glue to unregister
*
@@ -501,7 +506,8 @@
*/
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue);
-/*! \brief Create a new RTP instance
+/*!
+ * \brief Create a new RTP instance
*
* \param engine_name Name of the engine to use for the RTP instance
* \param sched Scheduler context that the RTP engine may want to use
@@ -526,7 +532,8 @@
*/
struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name, struct sched_context *sched, struct sockaddr_in *sin, void *data);
-/*! \brief Destroy an RTP instance
+/*!
+ * \brief Destroy an RTP instance
*
* \param instance The RTP instance to destroy
*
@@ -544,7 +551,8 @@
*/
int ast_rtp_instance_destroy(struct ast_rtp_instance *instance);
-/*! \brief Send a frame out over RTP
+/*!
+ * \brief Send a frame out over RTP
*
* \param instance The RTP instance to send frame out on
*
@@ -562,7 +570,8 @@
*/
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
-/*! \brief Receive a frame over RTP
+/*!
+ * \brief Receive a frame over RTP
*
* \param instance The RTP instance to receive frame on
* \param rtcp Whether to read in RTCP or not
@@ -581,7 +590,8 @@
*/
struct ast_frame *ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp);
-/*! \brief Set the address of the remote endpoint that we are sending RTP to
+/*!
+ * \brief Set the address of the remote endpoint that we are sending RTP to
*
* \param instance The RTP instance to change the address on
* \param address Address to set it to
@@ -600,7 +610,8 @@
*/
int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
-/*! \brief Get the address of the remote endpoint that we are sending RTP to
+/*!
+ * \brief Get the address of the remote endpoint that we are sending RTP to
*
* \param instance The instance that we want to get the remote address for
* \param address A structure to put the address into
@@ -620,7 +631,8 @@
*/
int ast_rtp_instance_get_remote_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
-/*! \brief Set the value of an RTP instance extended property
+/*!
+ * \brief Set the value of an RTP instance extended property
*
* \param instance The RTP instance to set the extended property on
* \param property The extended property to set
@@ -629,7 +641,8 @@
*/
void ast_rtp_instance_set_extended_prop(struct ast_rtp_instance *instance, int property, void *value);
-/*! \brief Get the value of an RTP instance extended property
+/*!
+ * \brief Get the value of an RTP instance extended property
*
* \param instance The RTP instance to get the extended property on
* \param property The extended property to get
@@ -637,7 +650,8 @@
*/
void *ast_rtp_instance_get_extended_prop(struct ast_rtp_instance *instance, int property);
-/*! \brief Set the value of an RTP instance property
+/*!
+ * \brief Set the value of an RTP instance property
*
* \param instance The RTP instance to set the property on
* \param property The property to modify
@@ -653,7 +667,8 @@
*/
void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
-/*! \brief Clear payload information from an RTP instance
+/*!
+ * \brief Clear payload information from an RTP instance
*
* \param codecs The codecs structure that payloads will be cleared from
* \param instance Optionally the instance that the codecs structure belongs to
@@ -669,7 +684,8 @@
*/
void ast_rtp_codecs_payloads_clear(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance);
-/*! \brief Set payload information on an RTP instance to the default
+/*!
+ * \brief Set payload information on an RTP instance to the default
*
* \param codecs The codecs structure to set defaults on
* \param instance Optionally the instance that the codecs structure belongs to
@@ -685,7 +701,8 @@
*/
void ast_rtp_codecs_payloads_default(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance);
-/*! \brief Copy payload information from one RTP instance to another
+/*!
+ * \brief Copy payload information from one RTP instance to another
*
* \param src The source codecs structure
* \param dst The destination codecs structure that the values from src will be copied to
@@ -701,7 +718,8 @@
*/
void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance);
-/*! \brief Record payload information that was seen in an m= SDP line
+/*!
+ * \brief Record payload information that was seen in an m= SDP line
*
* \param codecs The codecs structure to muck with
* \param instance Optionally the instance that the codecs structure belongs to
@@ -717,7 +735,8 @@
*/
void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
-/*! \brief Record payload information that was seen in an a=rtpmap: SDP line
+/*!
+ * \brief Record payload information that was seen in an a=rtpmap: SDP line
*
* \param codecs The codecs structure to muck with
* \param instance Optionally the instance that the codecs structure belongs to
@@ -739,7 +758,8 @@
*/
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
+/*!
+ * \brief Set payload type to a known MIME media type for a codec with a specific sample rate
*
* \param rtp RTP structure to modify
* \param instance Optionally the instance that the codecs structure belongs to
@@ -761,7 +781,8 @@
enum ast_rtp_options options,
unsigned int sample_rate);
-/*! \brief Remove payload information
+/*!
+ * \brief Remove payload information
*
* \param codecs The codecs structure to muck with
* \param instance Optionally the instance that the codecs structure belongs to
@@ -777,7 +798,8 @@
*/
void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
-/*! \brief Retrieve payload information by payload
+/*!
+ * \brief Retrieve payload information by payload
*
* \param codecs Codecs structure to look in
* \param payload Numerical payload to look up
@@ -795,16 +817,18 @@
*/
struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs *codecs, int payload);
-/*! \brief Get the sample rate associated with known RTP payload types
- *
- * \param isAstFormat True if the value in the 'code' parameter is an AST_FORMAT value
+/*!
+ * \brief Get the sample rate associated with known RTP payload types
+ *
+ * \param asterisk_format True if the value in the 'code' parameter is an AST_FORMAT value
* \param code Format code, either from AST_FORMAT list or from AST_RTP list
*
* \return the sample rate if the format was found, zero if it was not found
*/
-unsigned int ast_rtp_lookup_sample_rate2(int isAstFormat, int code);
-
-/*! \brief Retrieve all formats that were found
+unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, int code);
+
+/*!
+ * \brief Retrieve all formats that were found
*
* \param codecs Codecs structure to look in
* \param AstFormats An integer to put the Asterisk formats in
@@ -822,10 +846,11 @@
*/
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *AstFormats, int *nonAstFormats);
-/*! \brief Retrieve a payload based on whether it is an Asterisk format and the code
+/*!
+ * \brief Retrieve a payload based on whether it is an Asterisk format and the code
*
* \param codecs Codecs structure to look in
- * \param isAstFormat Non-zero if the given code is an Asterisk format value
+ * \param asterisk_format Non-zero if the given code is an Asterisk format value
* \param code The format to look for
*
* \retval Numerical payload
@@ -838,11 +863,12 @@
*
* This looks for the numerical payload for ULAW in the codecs structure.
*/
-int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int isAstFormat, const int code);
-
-/*! \brief Retrieve mime subtype information on a payload
- *
- * \param isAstFormat Non-zero if the given code is an Asterisk format value
+int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const int code);
+
+/*!
+ * \brief Retrieve mime subtype information on a payload
+ *
+ * \param asterisk_format Non-zero if the given code is an Asterisk format value
* \param code Format to look up
* \param options Additional options that may change the result
*
@@ -857,14 +883,15 @@
*
* This looks up the mime subtype for the ULAW format.
*/
-const char *ast_rtp_lookup_mime_subtype2(const int isAstFormat, const int code, enum ast_rtp_options options);
-
-/*! \brief Convert formats into a string and put them into a buffer
+const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const int code, enum ast_rtp_options options);
+
+/*!
+ * \brief Convert formats into a string and put them into a buffer
*
* \param buf Buffer to put the mime output into
* \param size Size of the above buffer
* \param capability Formats that we are looking up
- * \param isAstFormat Non-zero if the given capability are Asterisk format capabilities
+ * \param asterisk_format Non-zero if the given capability are Asterisk format capabilities
* \param options Additional options that may change the result
*
* \retval non-NULL success
@@ -879,9 +906,10 @@
*
* This returns the mime values for ULAW and ALAW in the buffer pointed to by buf.
*/
-char *ast_rtp_lookup_mime_multiple2(char *buf, size_t size, const int capability, const int isAstFormat, enum ast_rtp_options options);
-
-/*! \brief Set codec packetization preferences
+char *ast_rtp_lookup_mime_multiple2(char *buf, size_t size, const int capability, const int asterisk_format, enum ast_rtp_options options);
+
+/*!
+ * \brief Set codec packetization preferences
*
* \param codecs Codecs structure to muck with
* \param instance Optionally the instance that the codecs structure belongs to
@@ -897,7 +925,8 @@
*/
void ast_rtp_codecs_packetization_set(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs);
-/*! \brief Begin sending a DTMF digit
+/*!
+ * \brief Begin sending a DTMF digit
*
* \param instance The RTP instance to send the DTMF on
* \param digit What DTMF digit to send
@@ -916,7 +945,8 @@
*/
int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit);
-/*! \brief Stop sending a DTMF digit
+/*!
+ * \brief Stop sending a DTMF digit
*
* \param instance The RTP instance to stop the DTMF on
* \param digit What DTMF digit to stop
@@ -934,7 +964,8 @@
*/
int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit);
-/*! \brief Set the DTMF mode that should be used
+/*!
+ * \brief Set the DTMF mode that should be used
*
* \param instance the RTP instance to set DTMF mode on
* \param dtmf_mode The DTMF mode that is in use
@@ -952,7 +983,8 @@
*/
int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
-/*! \brief Indicate a new source of audio has dropped in
+/*!
+ * \brief Indicate a new source of audio has dropped in
*
* \param instance Instance that the new media source is feeding into
*
@@ -967,7 +999,8 @@
*/
void ast_rtp_instance_new_source(struct ast_rtp_instance *instance);
-/*! \brief Set QoS parameters on an RTP session
+/*!
+ * \brief Set QoS parameters on an RTP session
*
* \param instance Instance to set the QoS parameters on
* \param tos Terms of service value
@@ -987,7 +1020,8 @@
*/
int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc);
-/*! \brief Stop an RTP instance
+/*!
+ * \brief Stop an RTP instance
*
* \param instance Instance that media is no longer going to at this time
*
@@ -1002,7 +1036,8 @@
*/
void ast_rtp_instance_stop(struct ast_rtp_instance *instance);
-/*! \brief Get the file descriptor for an RTP session (or RTCP)
+/*!
+ * \brief Get the file descriptor for an RTP session (or RTCP)
*
* \param instance Instance to get the file descriptor for
* \param rtcp Whether to retrieve the file descriptor for RTCP or not
@@ -1021,7 +1056,8 @@
*/
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp);
-/*! \brief Get the RTP glue that binds a channel to the RTP engine
+/*!
+ * \brief Get the RTP glue that binds a channel to the RTP engine
*
* \param type Name of the glue we want
*
@@ -1038,7 +1074,8 @@
*/
struct ast_rtp_glue *ast_rtp_instance_get_glue(const char *type);
-/*! \brief Bridge two channels that use RTP instances
+/*!
+ * \brief Bridge two channels that use RTP instances
*
* \param c0 First channel part of the bridge
* \param c1 Second channel part of the bridge
@@ -1053,7 +1090,8 @@
*/
enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
-/*! \brief Make two channels compatible for early bridging
+/*!
+ * \brief Make two channels compatible for early bridging
*
* \param c0 First channel part of the bridge
* \param c1 Second channel part of the bridge
@@ -1061,7 +1099,8 @@
*/
void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c0, struct ast_channel *c1);
-/*! \brief Early bridge two channels that use RTP instances
+/*!
+ * \brief Early bridge two channels that use RTP instances
*
* \param c0 First channel part of the bridge
* \param c1 Second channel part of the bridge
@@ -1073,7 +1112,8 @@
*/
int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1);
-/*! \brief Initialize RED support on an RTP instance
+/*!
+ * \brief Initialize RED support on an RTP instance
*
* \param instance The instance to initialize RED support on
* \param buffer_time How long to buffer before sending
@@ -1085,7 +1125,8 @@
*/
int ast_rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
-/*! \brief Buffer a frame in an RTP instance for RED
+/*!
+ * \brief Buffer a frame in an RTP instance for RED
*
* \param instance The instance to buffer the frame on
* \param frame Frame that we want to buffer
@@ -1095,7 +1136,8 @@
*/
int ast_rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame);
-/*! \brief Retrieve statistics about an RTP instance
+/*!
+ * \brief Retrieve statistics about an RTP instance
*
* \param instance Instance to get statistics on
* \param stats Structure to put results into
@@ -1116,7 +1158,8 @@
*/
int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
-/*! \brief Set standard statistics from an RTP instance on a channel
+/*!
+ * \brief Set standard statistics from an RTP instance on a channel
*
* \param chan Channel to set the statistics on
* \param instance The RTP instance that statistics will be retrieved from
@@ -1132,7 +1175,8 @@
*/
void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance);
-/*! \brief Retrieve quality statistics about an RTP instance
+/*!
+ * \brief Retrieve quality statistics about an RTP instance
*
* \param instance Instance to get statistics on
* \param field What quality statistic to retrieve
@@ -1153,7 +1197,8 @@
*/
char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_rtp_instance_stat_field field, char *buf, size_t size);
-/*! \brief Request that the underlying RTP engine provide audio frames in a specific format
+/*!
+ * \brief Request that the underlying RTP engine provide audio frames in a specific format
*
* \param instance The RTP instance to change read format on
* \param format Format that frames are wanted in
@@ -1171,7 +1216,8 @@
*/
int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, int format);
-/*! \brief Tell underlying RTP engine that audio frames will be provided in a specific format
+/*!
+ * \brief Tell underlying RTP engine that audio frames will be provided in a specific format
*
* \param instance The RTP instance to change write format on
* \param format Format that frames will be provided in
@@ -1189,7 +1235,8 @@
*/
int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, int format);
-/*! \brief Request that the underlying RTP engine make two RTP instances compatible with eachother
+/*!
+ * \brief Request that the underlying RTP engine make two RTP instances compatible with eachother
*
* \param chan Our own Asterisk channel
* \param instance The first RTP instance
@@ -1208,7 +1255,8 @@
*/
int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_channel *peer);
-/*! \brief Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance
+/*!
+ * \brief Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance
*
* \param instance The RTP instance
*
@@ -1225,7 +1273,8 @@
*/
int ast_rtp_instance_activate(struct ast_rtp_instance *instance);
-/*! \brief Request that the underlying RTP engine send a STUN BIND request
+/*!
+ * \brief Request that the underlying RTP engine send a STUN BIND request
*
* \param instance The RTP instance
* \param suggestion The suggested destination
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=185119&r1=185118&r2=185119
==============================================================================
--- team/file/rtp_engine-mark2/main/rtp_engine.c (original)
+++ team/file/rtp_engine-mark2/main/rtp_engine.c Mon Mar 30 14:29:27 2009
@@ -46,12 +46,12 @@
/* The following array defines the MIME Media type (and subtype) for each
of our codecs, or RTP-specific data type. */
-static const struct mimeType {
- struct ast_rtp_payload_type payloadType;
+static const struct ast_rtp_mime_type {
+ struct ast_rtp_payload_type payload_type;
char *type;
char *subtype;
unsigned int sample_rate;
-} mimeTypes[] = {
+} ast_rtp_mime_types[] = {
{{1, AST_FORMAT_G723_1}, "audio", "G723", 8000},
{{1, AST_FORMAT_GSM}, "audio", "GSM", 8000},
{{1, AST_FORMAT_ULAW}, "audio", "PCMU", 8000},
@@ -165,9 +165,7 @@
AST_RWLIST_UNLOCK(&engines);
- if (option_verbose > 1) {
- ast_verbose(VERBOSE_PREFIX_2 "Registered RTP engine '%s'\n", engine->name);
- }
+ ast_verb(2, "Registered RTP engine '%s'\n", engine->name);
return 0;
}
@@ -178,22 +176,11 @@
AST_RWLIST_WRLOCK(&engines);
- /* Ensure that this engine is already registered */
- AST_RWLIST_TRAVERSE(&engines, current_engine, entry) {
- if (current_engine == engine) {
- break;
- }
- }
-
- if (current_engine) {
- AST_RWLIST_REMOVE(&engines, engine, entry);
+ if ((current_engine = AST_RWLIST_REMOVE(&engines, engine, entry))) {
+ ast_verb(2, "Unregistered RTP engine '%s'\n", engine->name);
}
AST_RWLIST_UNLOCK(&engines);
-
- if (current_engine && option_verbose > 1) {
- ast_verbose(VERBOSE_PREFIX_2 "Unregistered RTP engine '%s'\n", engine->name);
- }
return current_engine ? 0 : -1;
}
@@ -222,9 +209,7 @@
AST_RWLIST_UNLOCK(&glues);
- if (option_verbose > 1) {
- ast_verbose(VERBOSE_PREFIX_2 "Registered RTP glue '%s'\n", glue->type);
- }
+ ast_verb(2, "Registered RTP glue '%s'\n", glue->type);
return 0;
}
@@ -235,21 +220,11 @@
AST_RWLIST_WRLOCK(&glues);
- AST_RWLIST_TRAVERSE(&glues, current_glue, entry) {
- if (current_glue == glue) {
- break;
- }
- }
-
- if (current_glue) {
- AST_LIST_REMOVE(&glues, current_glue, entry);
+ if ((current_glue = AST_RWLIST_REMOVE(&glues, glue, entry))) {
+ ast_verb(2, "Unregistered RTP glue '%s'\n", glue->type);
}
AST_RWLIST_UNLOCK(&glues);
-
- if (current_glue && option_verbose > 1) {
- ast_verbose(VERBOSE_PREFIX_2 "Unregistered RTP glue '%s'\n", glue->type);
- }
return current_glue ? 0 : -1;
}
@@ -297,6 +272,7 @@
/* If no engine was actually found bail out now */
if (!engine) {
+ ast_log(LOG_ERROR, "No RTP engine was found. Do you have one loaded?\n");
AST_RWLIST_UNLOCK(&engines);
return NULL;
}
@@ -389,8 +365,6 @@
if (instance->engine->prop_set) {
instance->engine->prop_set(instance, property, value);
}
-
- return;
}
void ast_rtp_codecs_payloads_clear(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance)
@@ -399,14 +373,12 @@
for (i = 0; i < AST_RTP_MAX_PT; i++) {
ast_debug(2, "Clearing payload %d on %p\n", i, codecs);
- codecs->payloads[i].isAstFormat = 0;
+ codecs->payloads[i].asterisk_format = 0;
codecs->payloads[i].code = 0;
if (instance && instance->engine && instance->engine->payload_set) {
instance->engine->payload_set(instance, i, 0, 0);
}
}
-
- return;
}
void ast_rtp_codecs_payloads_default(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance)
@@ -416,15 +388,13 @@
for (i = 0; i < AST_RTP_MAX_PT; i++) {
if (static_RTP_PT[i].code) {
ast_debug(2, "Set default payload %d on %p\n", i, codecs);
- codecs->payloads[i].isAstFormat = static_RTP_PT[i].isAstFormat;
+ codecs->payloads[i].asterisk_format = static_RTP_PT[i].asterisk_format;
codecs->payloads[i].code = static_RTP_PT[i].code;
if (instance && instance->engine && instance->engine->payload_set) {
- instance->engine->payload_set(instance, i, codecs->payloads[i].isAstFormat, codecs->payloads[i].code);
+ instance->engine->payload_set(instance, i, codecs->payloads[i].asterisk_format, codecs->payloads[i].code);
}
}
}
-
- return;
}
void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance)
@@ -434,15 +404,13 @@
for (i = 0; i < AST_RTP_MAX_PT; i++) {
if (src->payloads[i].code) {
ast_debug(2, "Copying payload %d from %p to %p\n", i, src, dest);
- dest->payloads[i].isAstFormat = src->payloads[i].isAstFormat;
+ dest->payloads[i].asterisk_format = src->payloads[i].asterisk_format;
dest->payloads[i].code = src->payloads[i].code;
if (instance && instance->engine && instance->engine->payload_set) {
- instance->engine->payload_set(instance, i, dest->payloads[i].isAstFormat, dest->payloads[i].code);
+ instance->engine->payload_set(instance, i, dest->payloads[i].asterisk_format, dest->payloads[i].code);
}
}
}
-
- return;
}
void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
@@ -451,16 +419,14 @@
return;
}
- codecs->payloads[payload].isAstFormat = static_RTP_PT[payload].isAstFormat;
+ codecs->payloads[payload].asterisk_format = static_RTP_PT[payload].asterisk_format;
codecs->payloads[payload].code = static_RTP_PT[payload].code;
ast_debug(1, "Setting payload %d based on m type on %p\n", payload, codecs);
if (instance && instance->engine && instance->engine->payload_set) {
- instance->engine->payload_set(instance, payload, codecs->payloads[payload].isAstFormat, codecs->payloads[payload].code);
- }
-
- return;
+ instance->engine->payload_set(instance, payload, codecs->payloads[payload].asterisk_format, codecs->payloads[payload].code);
+ }
}
int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt,
@@ -474,8 +440,8 @@
if (pt < 0 || pt > AST_RTP_MAX_PT)
return -1; /* bogus payload type */
- for (i = 0; i < ARRAY_LEN(mimeTypes); ++i) {
- const struct mimeType *t = &mimeTypes[i];
+ 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)) {
continue;
@@ -494,16 +460,16 @@
}
found = 1;
- codecs->payloads[pt] = t->payloadType;
-
- if ((t->payloadType.code == AST_FORMAT_G726) &&
- t->payloadType.isAstFormat &&
+ codecs->payloads[pt] = t->payload_type;
+
+ if ((t->payload_type.code == AST_FORMAT_G726) &&
+ t->payload_type.asterisk_format &&
(options & AST_RTP_OPT_G726_NONSTANDARD)) {
codecs->payloads[pt].code = AST_FORMAT_G726_AAL2;
}
if (instance && instance->engine && instance->engine->payload_set) {
- instance->engine->payload_set(instance, pt, codecs->payloads[i].isAstFormat, codecs->payloads[i].code);
+ instance->engine->payload_set(instance, pt, codecs->payloads[i].asterisk_format, codecs->payloads[i].code);
}
break;
@@ -525,25 +491,23 @@
ast_debug(2, "Unsetting payload %d on %p\n", payload, codecs);
- codecs->payloads[payload].isAstFormat = 0;
+ codecs->payloads[payload].asterisk_format = 0;
codecs->payloads[payload].code = 0;
if (instance && instance->engine && instance->engine->payload_set) {
instance->engine->payload_set(instance, payload, 0, 0);
}
-
- return;
}
struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs *codecs, int payload)
{
- struct ast_rtp_payload_type result = { .isAstFormat = 0, };
+ struct ast_rtp_payload_type result = { .asterisk_format = 0, };
if (payload < 0 || payload > AST_RTP_MAX_PT) {
return result;
}
- result.isAstFormat = codecs->payloads[payload].isAstFormat;
+ result.asterisk_format = codecs->payloads[payload].asterisk_format;
result.code = codecs->payloads[payload].code;
if (!result.code) {
@@ -563,29 +527,27 @@
if (codecs->payloads[i].code) {
ast_debug(1, "Incorporating payload %d on %p\n", i, codecs);
}
- if (codecs->payloads[i].isAstFormat) {
+ if (codecs->payloads[i].asterisk_format) {
*AstFormats |= codecs->payloads[i].code;
} else {
*nonAstFormats |= codecs->payloads[i].code;
}
}
-
- return;
-}
-
-int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int isAstFormat, const int code)
+}
+
+int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const int code)
{
int i;
for (i = 0; i < AST_RTP_MAX_PT; i++) {
- if (codecs->payloads[i].isAstFormat == isAstFormat && codecs->payloads[i].code == code) {
+ if (codecs->payloads[i].asterisk_format == asterisk_format && codecs->payloads[i].code == code) {
ast_debug(2, "Found code %d at payload %d on %p\n", code, i, codecs);
return i;
}
}
for (i = 0; i < AST_RTP_MAX_PT; i++) {
- if (static_RTP_PT[i].isAstFormat == isAstFormat && static_RTP_PT[i].code == code) {
+ if (static_RTP_PT[i].asterisk_format == asterisk_format && static_RTP_PT[i].code == code) {
return i;
}
}
@@ -593,16 +555,16 @@
return -1;
}
-const char *ast_rtp_lookup_mime_subtype2(const int isAstFormat, const int code, enum ast_rtp_options options)
+const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const int code, enum ast_rtp_options options)
{
int i;
- for (i = 0; i < sizeof(mimeTypes) / sizeof(mimeTypes[0]); i++) {
- if (mimeTypes[i].payloadType.code == code && mimeTypes[i].payloadType.isAstFormat == isAstFormat) {
- if (isAstFormat && (code == AST_FORMAT_G726_AAL2) && (options & AST_RTP_OPT_G726_NONSTANDARD)) {
+ for (i = 0; i < ARRAY_LEN(ast_rtp_mime_types); i++) {
+ if (ast_rtp_mime_types[i].payload_type.code == code && ast_rtp_mime_types[i].payload_type.asterisk_format == asterisk_format) {
+ if (asterisk_format && (code == AST_FORMAT_G726_AAL2) && (options & AST_RTP_OPT_G726_NONSTANDARD)) {
return "G726-32";
} else {
- return mimeTypes[i].subtype;
+ return ast_rtp_mime_types[i].subtype;
}
}
}
@@ -610,20 +572,20 @@
return "";
}
-unsigned int ast_rtp_lookup_sample_rate2(int isAstFormat, int code)
+unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, int code)
{
unsigned int i;
- for (i = 0; i < ARRAY_LEN(mimeTypes); ++i) {
- if ((mimeTypes[i].payloadType.code == code) && (mimeTypes[i].payloadType.isAstFormat == isAstFormat)) {
- return mimeTypes[i].sample_rate;
+ for (i = 0; i < ARRAY_LEN(ast_rtp_mime_types); ++i) {
+ if ((ast_rtp_mime_types[i].payload_type.code == code) && (ast_rtp_mime_types[i].payload_type.asterisk_format == asterisk_format)) {
+ return ast_rtp_mime_types[i].sample_rate;
}
}
return 0;
}
-char *ast_rtp_lookup_mime_multiple2(char *buf, size_t size, const int capability, const int isAstFormat, enum ast_rtp_options options)
+char *ast_rtp_lookup_mime_multiple2(char *buf, size_t size, const int capability, const int asterisk_format, enum ast_rtp_options options)
{
int format;
unsigned len;
@@ -642,7 +604,7 @@
for (format = 1; format < AST_RTP_MAX; format <<= 1) {
if (capability & format) {
- const char *name = ast_rtp_lookup_mime_subtype2(isAstFormat, format, options);
+ const char *name = ast_rtp_lookup_mime_subtype2(asterisk_format, format, options);
snprintf(end, size, "%s|", name);
len = strlen(end);
@@ -672,8 +634,6 @@
if (instance && instance->engine->packetization_set) {
instance->engine->packetization_set(instance, &instance->codecs.pref);
}
-
- return;
}
int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit)
@@ -702,8 +662,6 @@
if (instance->engine->new_source) {
instance->engine->new_source(instance);
}
-
- return;
}
int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc)
@@ -716,8 +674,6 @@
if (instance->engine->stop) {
instance->engine->stop(instance);
}
-
- return;
}
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
@@ -896,7 +852,10 @@
return res;
}
-static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1, struct ast_rtp_instance *vinstance0, struct ast_rtp_instance *vinstance1, struct ast_rtp_instance *tinstance0, struct ast_rtp_instance *tinstance1, struct ast_rtp_glue *glue0, struct ast_rtp_glue *glue1, int codec0, int codec1, int timeoutms, int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
+static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1,
+ struct ast_rtp_instance *vinstance0, struct ast_rtp_instance *vinstance1, struct ast_rtp_instance *tinstance0,
+ struct ast_rtp_instance *tinstance1, struct ast_rtp_glue *glue0, struct ast_rtp_glue *glue1, int codec0, int codec1, int timeoutms,
+ int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
{
enum ast_bridge_result res = AST_BRIDGE_FAILED;
struct ast_channel *who = NULL, *other = NULL, *cs[3] = { NULL, };
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=185119&r1=185118&r2=185119
==============================================================================
--- team/file/rtp_engine-mark2/main/stun.c (original)
+++ team/file/rtp_engine-mark2/main/stun.c Mon Mar 30 14:29:27 2009
@@ -16,13 +16,13 @@
* at the top of the source tree.
*/
-/*!
- * \file
+/*!
+ * \file
*
* \brief STUN Support
*
* \author Mark Spencer <markster at digium.com>
- *
+ *
* \note STUN is defined in RFC 3489.
*/
@@ -93,7 +93,7 @@
* a session key for subsequent requests.
* 'SEC' functionality is not supported here.
*/
-
+
#define STUN_BINDREQ 0x0001
#define STUN_BINDRESP 0x0101
#define STUN_BINDERR 0x0111
@@ -186,7 +186,7 @@
break;
default:
if (stundebug)
- ast_verbose("Ignoring STUN attribute %s (%04x), length %d\n",
+ ast_verbose("Ignoring STUN attribute %s (%04x), length %d\n",
stun_attr2str(ntohs(attr->attr)), ntohs(attr->attr), ntohs(attr->len));
}
return 0;
@@ -253,7 +253,7 @@
struct stun_header *hdr = (struct stun_header *)data;
struct stun_attr *attr;
struct stun_state st;
- int ret = AST_STUN_IGNORE;
+ int ret = AST_STUN_IGNORE;
int x;
/* On entry, 'len' is the length of the udp payload. After the
@@ -323,7 +323,7 @@
switch (ntohs(hdr->msgtype)) {
case STUN_BINDREQ:
if (stundebug)
- ast_verbose("STUN Bind Request, username: %s\n",
+ ast_verbose("STUN Bind Request, username: %s\n",
st.username ? st.username : "<none>");
if (st.username)
append_attr_string(&attr, STUN_USERNAME, st.username, &resplen, &respleft);
@@ -380,7 +380,7 @@
struct stun_attr *attr;
int res = 0;
int retry;
-
+
req = (struct stun_header *)reqdata;
stun_req_id(req);
reqlen = 0;
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=185119&r1=185118&r2=185119
==============================================================================
--- team/file/rtp_engine-mark2/res/res_rtp_asterisk.c (original)
+++ team/file/rtp_engine-mark2/res/res_rtp_asterisk.c Mon Mar 30 14:29:27 2009
@@ -1720,7 +1720,7 @@
payload_type = ast_rtp_codecs_payload_lookup(&instance->codecs, payload);
/* Otherwise adjust bridged payload to match */
- bridged_payload = ast_rtp_codecs_payload_code(&instance->bridged->codecs, payload_type.isAstFormat, payload_type.code);
+ bridged_payload = ast_rtp_codecs_payload_code(&instance->bridged->codecs, payload_type.asterisk_format, payload_type.code);
/* If the payload coming in is not one of the negotiated ones then send it to the core, this will cause formats to change and the bridge to break */
if (!instance->bridged->codecs.payloads[bridged_payload].code) {
@@ -1919,7 +1919,7 @@
payload = ast_rtp_codecs_payload_lookup(&instance->codecs, payloadtype);
/* If the payload is not actually an Asterisk one but a special one pass it off to the respective handler */
- if (!payload.isAstFormat) {
+ if (!payload.asterisk_format) {
struct ast_frame *f = NULL;
[... 29 lines stripped ...]
More information about the asterisk-commits
mailing list