aboutsummaryrefslogtreecommitdiffstats
path: root/main/rtp_engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/rtp_engine.c')
-rw-r--r--main/rtp_engine.c334
1 files changed, 240 insertions, 94 deletions
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 738b58fae..b2543893a 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -39,6 +39,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h"
#include "asterisk/translate.h"
#include "asterisk/netsock2.h"
+#include "asterisk/_private.h"
struct ast_srtp_res *res_srtp = NULL;
struct ast_srtp_policy_res *res_srtp_policy = NULL;
@@ -83,50 +84,14 @@ static AST_RWLIST_HEAD_STATIC(glues, ast_rtp_glue);
/*! The following array defines the MIME Media type (and subtype) for each
of our codecs, or RTP-specific data type. */
-static const struct ast_rtp_mime_type {
+static struct ast_rtp_mime_type {
struct ast_rtp_payload_type payload_type;
char *type;
char *subtype;
unsigned int sample_rate;
-} ast_rtp_mime_types[] = {
- {{1, {.id = AST_FORMAT_G723_1}, 0}, "audio", "G723", 8000},
- {{1, {.id = AST_FORMAT_GSM}, 0}, "audio", "GSM", 8000},
- {{1, {.id = AST_FORMAT_ULAW}, 0}, "audio", "PCMU", 8000},
- {{1, {.id = AST_FORMAT_ULAW}, 0}, "audio", "G711U", 8000},
- {{1, {.id = AST_FORMAT_ALAW}, 0}, "audio", "PCMA", 8000},
- {{1, {.id = AST_FORMAT_ALAW}, 0}, "audio", "G711A", 8000},
- {{1, {.id = AST_FORMAT_G726}, 0}, "audio", "G726-32", 8000},
- {{1, {.id = AST_FORMAT_ADPCM}, 0}, "audio", "DVI4", 8000},
- {{1, {.id = AST_FORMAT_SLINEAR}, 0}, "audio", "L16", 8000},
- {{1, {.id = AST_FORMAT_SLINEAR16}, 0}, "audio", "L16", 16000},
- {{1, {.id = AST_FORMAT_LPC10}, 0}, "audio", "LPC", 8000},
- {{1, {.id = AST_FORMAT_G729A}, 0}, "audio", "G729", 8000},
- {{1, {.id = AST_FORMAT_G729A}, 0}, "audio", "G729A", 8000},
- {{1, {.id = AST_FORMAT_G729A}, 0}, "audio", "G.729", 8000},
- {{1, {.id = AST_FORMAT_SPEEX}, 0}, "audio", "speex", 8000},
- {{1, {.id = AST_FORMAT_SPEEX16}, 0}, "audio", "speex", 16000},
- {{1, {.id = AST_FORMAT_ILBC}, 0}, "audio", "iLBC", 8000},
- /* this is the sample rate listed in the RTP profile for the G.722
- codec, *NOT* the actual sample rate of the media stream
- */
- {{1, {.id = AST_FORMAT_G722}, 0}, "audio", "G722", 8000},
- {{1, {.id = AST_FORMAT_G726_AAL2}, 0}, "audio", "AAL2-G726-32", 8000},
- {{0, {.id = 0}, AST_RTP_DTMF}, "audio", "telephone-event", 8000},
- {{0, {.id = 0}, AST_RTP_CISCO_DTMF}, "audio", "cisco-telephone-event", 8000},
- {{0, {.id = 0}, AST_RTP_CN}, "audio", "CN", 8000},
- {{1, {.id = AST_FORMAT_JPEG}, 0}, "video", "JPEG", 90000},
- {{1, {.id = AST_FORMAT_PNG}, 0}, "video", "PNG", 90000},
- {{1, {.id = AST_FORMAT_H261}, 0}, "video", "H261", 90000},
- {{1, {.id = AST_FORMAT_H263}, 0}, "video", "H263", 90000},
- {{1, {.id = AST_FORMAT_H263_PLUS}, 0}, "video", "h263-1998", 90000},
- {{1, {.id = AST_FORMAT_H264}, 0}, "video", "H264", 90000},
- {{1, {.id = AST_FORMAT_MP4_VIDEO}, 0}, "video", "MP4V-ES", 90000},
- {{1, {.id = AST_FORMAT_T140RED}, 0}, "text", "RED", 1000},
- {{1, {.id = AST_FORMAT_T140}, 0}, "text", "T140", 1000},
- {{1, {.id = AST_FORMAT_SIREN7}, 0}, "audio", "G7221", 16000},
- {{1, {.id = AST_FORMAT_SIREN14}, 0}, "audio", "G7221", 32000},
- {{1, {.id = AST_FORMAT_G719}, 0}, "audio", "G719", 48000},
-};
+} ast_rtp_mime_types[128]; /* This will Likely not need to grow any time soon. */
+static ast_rwlock_t mime_types_lock;
+static int mime_types_len = 0;
/*!
* \brief Mapping between Asterisk codecs and rtp payload types
@@ -138,46 +103,8 @@ static const struct ast_rtp_mime_type {
* See http://www.iana.org/assignments/rtp-parameters for a list of
* assigned values
*/
-static const struct ast_rtp_payload_type static_RTP_PT[AST_RTP_MAX_PT] = {
- [0] = {1, {.id = AST_FORMAT_ULAW}, 0},
- #ifdef USE_DEPRECATED_G726
- [2] = {1, {.id = AST_FORMAT_G726}, 0},/* Technically this is G.721, but if Cisco can do it, so can we... */
- #endif
- [3] = {1, {.id = AST_FORMAT_GSM}, 0},
- [4] = {1, {.id = AST_FORMAT_G723_1}, 0},
- [5] = {1, {.id = AST_FORMAT_ADPCM}, 0},/* 8 kHz */
- [6] = {1, {.id = AST_FORMAT_ADPCM}, 0}, /* 16 kHz */
- [7] = {1, {.id = AST_FORMAT_LPC10}, 0},
- [8] = {1, {.id = AST_FORMAT_ALAW}, 0},
- [9] = {1, {.id = AST_FORMAT_G722}, 0},
- [10] = {1, {.id = AST_FORMAT_SLINEAR}, 0}, /* 2 channels */
- [11] = {1, {.id = AST_FORMAT_SLINEAR}, 0}, /* 1 channel */
- [13] = {0, {.id = 0}, AST_RTP_CN},
- [16] = {1, {.id = AST_FORMAT_ADPCM}, 0}, /* 11.025 kHz */
- [17] = {1, {.id = AST_FORMAT_ADPCM}, 0}, /* 22.050 kHz */
- [18] = {1, {.id = AST_FORMAT_G729A}, 0},
- [19] = {0, {.id = 0}, AST_RTP_CN}, /* Also used for CN */
- [26] = {1, {.id = AST_FORMAT_JPEG}, 0},
- [31] = {1, {.id = AST_FORMAT_H261}, 0},
- [34] = {1, {.id = AST_FORMAT_H263}, 0},
- [97] = {1, {.id = AST_FORMAT_ILBC}, 0},
- [98] = {1, {.id = AST_FORMAT_H263_PLUS}, 0},
- [99] = {1, {.id = AST_FORMAT_H264}, 0},
- [101] = {0, {.id = 0}, AST_RTP_DTMF},
- [102] = {1, {.id = AST_FORMAT_SIREN7}, 0},
- [103] = {1, {.id = AST_FORMAT_H263_PLUS}, 0},
- [104] = {1, {.id = AST_FORMAT_MP4_VIDEO}, 0},
- [105] = {1, {.id = AST_FORMAT_T140RED}, 0}, /* Real time text chat (with redundancy encoding) */
- [106] = {1, {.id = AST_FORMAT_T140}, 0}, /* Real time text chat */
- [110] = {1, {.id = AST_FORMAT_SPEEX}, 0},
- [111] = {1, {.id = AST_FORMAT_G726}, 0},
- [112] = {1, {.id = AST_FORMAT_G726_AAL2}, 0},
- [115] = {1, {.id = AST_FORMAT_SIREN14}, 0},
- [116] = {1, {.id = AST_FORMAT_G719}, 0},
- [117] = {1, {.id = AST_FORMAT_SPEEX16}, 0},
- [118] = {1, {.id = AST_FORMAT_SLINEAR16}, 0}, /* 16 Khz signed linear */
- [121] = {0, {.id = 0}, AST_RTP_CISCO_DTMF}, /* Must be type 121 */
-};
+static struct ast_rtp_payload_type static_RTP_PT[AST_RTP_MAX_PT];
+static ast_rwlock_t static_RTP_PT_lock;
int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module)
{
@@ -497,6 +424,7 @@ void ast_rtp_codecs_payloads_default(struct ast_rtp_codecs *codecs, struct ast_r
{
int i;
+ ast_rwlock_rdlock(&static_RTP_PT_lock);
for (i = 0; i < AST_RTP_MAX_PT; i++) {
if (static_RTP_PT[i].rtp_code || static_RTP_PT[i].asterisk_format) {
@@ -508,6 +436,7 @@ void ast_rtp_codecs_payloads_default(struct ast_rtp_codecs *codecs, struct ast_r
}
}
}
+ ast_rwlock_unlock(&static_RTP_PT_lock);
}
void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance)
@@ -529,7 +458,10 @@ void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_cod
void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
{
+
+ ast_rwlock_rdlock(&static_RTP_PT_lock);
if (payload < 0 || payload >= AST_RTP_MAX_PT || (!static_RTP_PT[payload].rtp_code && !static_RTP_PT[payload].asterisk_format)) {
+ ast_rwlock_unlock(&static_RTP_PT_lock);
return;
}
@@ -542,6 +474,7 @@ void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct as
if (instance && instance->engine && instance->engine->payload_set) {
instance->engine->payload_set(instance, payload, codecs->payloads[payload].asterisk_format, &codecs->payloads[payload].format, codecs->payloads[payload].rtp_code);
}
+ ast_rwlock_unlock(&static_RTP_PT_lock);
}
int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt,
@@ -555,7 +488,8 @@ int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs,
if (pt < 0 || pt >= AST_RTP_MAX_PT)
return -1; /* bogus payload type */
- for (i = 0; i < ARRAY_LEN(ast_rtp_mime_types); ++i) {
+ ast_rwlock_rdlock(&mime_types_lock);
+ for (i = 0; i < mime_types_len; ++i) {
const struct ast_rtp_mime_type *t = &ast_rtp_mime_types[i];
if (strcasecmp(mimesubtype, t->subtype)) {
@@ -587,6 +521,7 @@ int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs,
break;
}
+ ast_rwlock_unlock(&mime_types_lock);
return (found ? 0 : -2);
}
@@ -626,12 +561,26 @@ struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs
ast_format_copy(&result.format, &codecs->payloads[payload].format);
if (!result.rtp_code && !result.asterisk_format) {
+ ast_rwlock_rdlock(&static_RTP_PT_lock);
result = static_RTP_PT[payload];
+ ast_rwlock_unlock(&static_RTP_PT_lock);
}
return result;
}
+
+struct ast_format *ast_rtp_codecs_get_payload_format(struct ast_rtp_codecs *codecs, int payload)
+{
+ if (payload < 0 || payload >= AST_RTP_MAX_PT) {
+ return NULL;
+ }
+ if (!codecs->payloads[payload].asterisk_format) {
+ return NULL;
+ }
+ return &codecs->payloads[payload].format;
+}
+
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, struct ast_format_cap *astformats, int *nonastformats)
{
int i;
@@ -654,7 +603,7 @@ void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, struct ast_fo
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, int asterisk_format, const struct ast_format *format, int code)
{
int i;
-
+ int res = -1;
for (i = 0; i < AST_RTP_MAX_PT; i++) {
if (codecs->payloads[i].asterisk_format && asterisk_format && format &&
(ast_format_cmp(format, &codecs->payloads[i].format) != AST_FORMAT_CMP_NOT_EQUAL)) {
@@ -665,56 +614,71 @@ int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, int asterisk_form
}
}
+ ast_rwlock_rdlock(&static_RTP_PT_lock);
for (i = 0; i < AST_RTP_MAX_PT; i++) {
if (static_RTP_PT[i].asterisk_format && asterisk_format && format &&
(ast_format_cmp(format, &static_RTP_PT[i].format) != AST_FORMAT_CMP_NOT_EQUAL)) {
- return i;
+ res = i;
+ break;
} else if (!static_RTP_PT[i].asterisk_format && !asterisk_format &&
(static_RTP_PT[i].rtp_code == code)) {
- return i;
+ res = i;
+ break;
}
}
+ ast_rwlock_unlock(&static_RTP_PT_lock);
- return -1;
+ return res;
}
const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, struct ast_format *format, int code, enum ast_rtp_options options)
{
int i;
+ const char *res = "";
- for (i = 0; i < ARRAY_LEN(ast_rtp_mime_types); i++) {
+ ast_rwlock_rdlock(&mime_types_lock);
+ for (i = 0; i < mime_types_len; i++) {
if (ast_rtp_mime_types[i].payload_type.asterisk_format && asterisk_format && format &&
(ast_format_cmp(format, &ast_rtp_mime_types[i].payload_type.format) != AST_FORMAT_CMP_NOT_EQUAL)) {
if ((format->id == AST_FORMAT_G726_AAL2) && (options & AST_RTP_OPT_G726_NONSTANDARD)) {
- return "G726-32";
+ res = "G726-32";
+ break;
} else {
- return ast_rtp_mime_types[i].subtype;
+ res = ast_rtp_mime_types[i].subtype;
+ break;
}
} else if (!ast_rtp_mime_types[i].payload_type.asterisk_format && !asterisk_format &&
ast_rtp_mime_types[i].payload_type.rtp_code == code) {
- return ast_rtp_mime_types[i].subtype;
+ res = ast_rtp_mime_types[i].subtype;
+ break;
}
}
+ ast_rwlock_unlock(&mime_types_lock);
- return "";
+ return res;
}
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, struct ast_format *format, int code)
{
unsigned int i;
+ unsigned int res = 0;
- for (i = 0; i < ARRAY_LEN(ast_rtp_mime_types); ++i) {
+ ast_rwlock_rdlock(&mime_types_lock);
+ for (i = 0; i < mime_types_len; ++i) {
if (ast_rtp_mime_types[i].payload_type.asterisk_format && asterisk_format && format &&
(ast_format_cmp(format, &ast_rtp_mime_types[i].payload_type.format) != AST_FORMAT_CMP_NOT_EQUAL)) {
- return ast_rtp_mime_types[i].sample_rate;
+ res = ast_rtp_mime_types[i].sample_rate;
+ break;
} else if (!ast_rtp_mime_types[i].payload_type.asterisk_format && !asterisk_format &&
ast_rtp_mime_types[i].payload_type.rtp_code == code) {
- return ast_rtp_mime_types[i].sample_rate;
+ res = ast_rtp_mime_types[i].sample_rate;
+ break;
}
}
+ ast_rwlock_unlock(&mime_types_lock);
- return 0;
+ return res;
}
char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, struct ast_format_cap *ast_format_capability, int rtp_capability, const int asterisk_format, enum ast_rtp_options options)
@@ -1879,3 +1843,185 @@ struct ast_srtp *ast_rtp_instance_get_srtp(struct ast_rtp_instance *instance)
{
return instance->srtp;
}
+
+static void set_next_mime_type(const struct ast_format *format, int rtp_code, char *type, char *subtype, unsigned int sample_rate)
+{
+ int x = mime_types_len;
+ if (ARRAY_LEN(ast_rtp_mime_types) == mime_types_len) {
+ return;
+ }
+
+ ast_rwlock_wrlock(&mime_types_lock);
+ if (format) {
+ ast_rtp_mime_types[x].payload_type.asterisk_format = 1;
+ ast_format_copy(&ast_rtp_mime_types[x].payload_type.format, format);
+ } else {
+ ast_rtp_mime_types[x].payload_type.rtp_code = rtp_code;
+ }
+ ast_rtp_mime_types[x].type = type;
+ ast_rtp_mime_types[x].subtype = subtype;
+ ast_rtp_mime_types[x].sample_rate = sample_rate;
+ mime_types_len++;
+ ast_rwlock_unlock(&mime_types_lock);
+}
+
+static void add_static_payload(int map, const struct ast_format *format, int rtp_code)
+{
+ int x;
+ ast_rwlock_wrlock(&static_RTP_PT_lock);
+ if (map < 0) {
+ /* find next available dynamic payload slot */
+ for (x = 96; x < 127; x++) {
+ if (!static_RTP_PT[x].asterisk_format && !static_RTP_PT[x].rtp_code) {
+ map = x;
+ break;
+ }
+ }
+ }
+
+ if (map < 0) {
+ ast_log(LOG_WARNING, "No Dynamic RTP mapping avaliable for format %s\n" ,ast_getformatname(format));
+ ast_rwlock_unlock(&static_RTP_PT_lock);
+ return;
+ }
+
+ if (format) {
+ static_RTP_PT[map].asterisk_format = 1;
+ ast_format_copy(&static_RTP_PT[map].format, format);
+ } else {
+ static_RTP_PT[map].rtp_code = rtp_code;
+ }
+ ast_rwlock_unlock(&static_RTP_PT_lock);
+}
+
+int ast_rtp_engine_load_format(const struct ast_format *format)
+{
+ switch (format->id) {
+ case AST_FORMAT_SILK:
+ set_next_mime_type(format, 0, "audio", "SILK", ast_format_rate(format));
+ add_static_payload(-1, format, 0);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+int ast_rtp_engine_unload_format(const struct ast_format *format)
+{
+ int x;
+ int y = 0;
+
+ ast_rwlock_wrlock(&static_RTP_PT_lock);
+ /* remove everything pertaining to this format id from the lists */
+ for (x = 0; x < AST_RTP_MAX_PT; x++) {
+ if (ast_format_cmp(&static_RTP_PT[x].format, format) == AST_FORMAT_CMP_EQUAL) {
+ memset(&static_RTP_PT[x], 0, sizeof(struct ast_rtp_payload_type));
+ }
+ }
+ ast_rwlock_unlock(&static_RTP_PT_lock);
+
+
+ ast_rwlock_wrlock(&mime_types_lock);
+ /* rebuild the list skipping the items matching this id */
+ for (x = 0; x < mime_types_len; x++) {
+ if (ast_format_cmp(&ast_rtp_mime_types[x].payload_type.format, format) == AST_FORMAT_CMP_EQUAL) {
+ continue;
+ }
+ ast_rtp_mime_types[y] = ast_rtp_mime_types[x];
+ y++;
+ }
+ mime_types_len = y;
+ ast_rwlock_unlock(&mime_types_lock);
+ return 0;
+}
+
+int ast_rtp_engine_init()
+{
+ struct ast_format tmpfmt;
+
+ ast_rwlock_init(&mime_types_lock);
+ ast_rwlock_init(&static_RTP_PT_lock);
+
+ /* Define all the RTP mime types available */
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G723_1, 0), 0, "audio", "G723", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_GSM, 0), 0, "audio", "GSM", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0, "audio", "PCMU", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0, "audio", "G711U", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0, "audio", "PCMA", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0, "audio", "G711A", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0, "audio", "G726-32", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0, "audio", "DVI4", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0, "audio", "L16", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0, "audio", "L16", 16000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_LPC10, 0), 0, "audio", "LPC", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G729", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G729A", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G.729", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX, 0), 0, "audio", "speex", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX16, 0), 0, "audio", "speex", 16000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), 0, "audio", "speex", 32000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ILBC, 0), 0, "audio", "iLBC", 8000);
+ /* this is the sample rate listed in the RTP profile for the G.722 codec, *NOT* the actual sample rate of the media stream */
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G722, 0), 0, "audio", "G722", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G726_AAL2, 0), 0, "audio", "AAL2-G726-32", 8000);
+ set_next_mime_type(NULL, AST_RTP_DTMF, "audio", "telephone-event", 8000);
+ set_next_mime_type(NULL, AST_RTP_CISCO_DTMF, "audio", "cisco-telephone-event", 8000);
+ set_next_mime_type(NULL, AST_RTP_CN, "audio", "CN", 8000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_JPEG, 0), 0, "video", "JPEG", 90000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_PNG, 0), 0, "video", "PNG", 90000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H261, 0), 0, "video", "H261", 90000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H263, 0), 0, "video", "H263", 90000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0, "video", "h263-1998", 90000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H264, 0), 0, "video", "H264", 90000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_MP4_VIDEO, 0), 0, "video", "MP4V-ES", 90000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_T140RED, 0), 0, "text", "RED", 1000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_T140, 0), 0, "text", "T140", 1000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SIREN7, 0), 0, "audio", "G7221", 16000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SIREN14, 0), 0, "audio", "G7221", 32000);
+ set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G719, 0), 0, "audio", "G719", 48000);
+
+ /* Define the static rtp payload mappings */
+ add_static_payload(0, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0);
+ #ifdef USE_DEPRECATED_G726
+ add_static_payload(2, ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0);/* Technically this is G.721, but if Cisco can do it, so can we... */
+ #endif
+ add_static_payload(3, ast_format_set(&tmpfmt, AST_FORMAT_GSM, 0), 0);
+ add_static_payload(4, ast_format_set(&tmpfmt, AST_FORMAT_G723_1, 0), 0);
+ add_static_payload(5, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0);/* 8 kHz */
+ add_static_payload(6, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 16 kHz */
+ add_static_payload(7, ast_format_set(&tmpfmt, AST_FORMAT_LPC10, 0), 0);
+ add_static_payload(8, ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0);
+ add_static_payload(9, ast_format_set(&tmpfmt, AST_FORMAT_G722, 0), 0);
+ add_static_payload(10, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0); /* 2 channels */
+ add_static_payload(11, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0); /* 1 channel */
+ add_static_payload(13, NULL, AST_RTP_CN);
+ add_static_payload(16, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 11.025 kHz */
+ add_static_payload(17, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 22.050 kHz */
+ add_static_payload(18, ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0);
+ add_static_payload(19, NULL, AST_RTP_CN); /* Also used for CN */
+ add_static_payload(26, ast_format_set(&tmpfmt, AST_FORMAT_JPEG, 0), 0);
+ add_static_payload(31, ast_format_set(&tmpfmt, AST_FORMAT_H261, 0), 0);
+ add_static_payload(34, ast_format_set(&tmpfmt, AST_FORMAT_H263, 0), 0);
+ add_static_payload(97, ast_format_set(&tmpfmt, AST_FORMAT_ILBC, 0), 0);
+ add_static_payload(98, ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0);
+ add_static_payload(99, ast_format_set(&tmpfmt, AST_FORMAT_H264, 0), 0);
+ add_static_payload(101, NULL, AST_RTP_DTMF);
+ add_static_payload(102, ast_format_set(&tmpfmt, AST_FORMAT_SIREN7, 0), 0);
+ add_static_payload(103, ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0);
+ add_static_payload(104, ast_format_set(&tmpfmt, AST_FORMAT_MP4_VIDEO, 0), 0);
+ add_static_payload(105, ast_format_set(&tmpfmt, AST_FORMAT_T140RED, 0), 0); /* Real time text chat (with redundancy encoding) */
+ add_static_payload(106, ast_format_set(&tmpfmt, AST_FORMAT_T140, 0), 0); /* Real time text chat */
+ add_static_payload(110, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX, 0), 0);
+ add_static_payload(111, ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0);
+ add_static_payload(112, ast_format_set(&tmpfmt, AST_FORMAT_G726_AAL2, 0), 0);
+ add_static_payload(115, ast_format_set(&tmpfmt, AST_FORMAT_SIREN14, 0), 0);
+ add_static_payload(116, ast_format_set(&tmpfmt, AST_FORMAT_G719, 0), 0);
+ add_static_payload(117, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX16, 0), 0);
+ add_static_payload(118, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0); /* 16 Khz signed linear */
+ add_static_payload(119, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), 0);
+ add_static_payload(121, NULL, AST_RTP_CISCO_DTMF); /* Must be type 121 */
+
+ return 0;
+}