#include "asterisk.h"
+#include <ctype.h> /* for tolower */
+
#include "asterisk/module.h"
#include "asterisk/format.h"
+#include "asterisk/astobj2.h" /* for ao2_ref */
+#include "asterisk/logger.h" /* for ast_log, LOG_WARNING */
+#include "asterisk/strings.h" /* for ast_str_append */
+#include "asterisk/utils.h" /* for MIN */
/*!
* \brief CELT attribute structure.
static struct ast_format *celt_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
{
+ char *attribs = ast_strdupa(attributes), *attrib;
struct ast_format *cloned;
struct celt_attr *attr;
unsigned int val;
}
attr = ast_format_get_attribute_data(cloned);
- if (sscanf(attributes, "framesize=%30u", &val) == 1) {
+ /* lower-case everything, so we are case-insensitive */
+ for (attrib = attribs; *attrib; ++attrib) {
+ *attrib = tolower(*attrib);
+ } /* based on channels/chan_sip.c:process_a_sdp_image() */
+
+ if (sscanf(attribs, "framesize=%30u", &val) == 1) {
attr->framesize = val;
}
#include "asterisk.h"
+#include <ctype.h> /* for toupper */
+
#include "asterisk/module.h"
#include "asterisk/format.h"
+#include "asterisk/strings.h" /* for ast_str_append */
+#include "asterisk/utils.h" /* for ast_strip */
/*! \brief Value that indicates an attribute is actually unset */
#define H263_ATTR_KEY_UNSET UINT8_MAX
}
attr = ast_format_get_attribute_data(cloned);
+ /* upper-case everything, so we are case-insensitive */
+ for (attrib = attribs; *attrib; ++attrib) {
+ *attrib = toupper(*attrib);
+ } /* based on channels/chan_sip.c:process_a_sdp_image() */
+
attr->BPP = H263_ATTR_KEY_UNSET;
attr->MaxBR = H263_ATTR_KEY_UNSET;
attr->PAR_WIDTH = H263_ATTR_KEY_UNSET;
#include "asterisk.h"
+#include <ctype.h> /* for tolower */
+
#include "asterisk/module.h"
#include "asterisk/format.h"
#include "asterisk/strings.h" /* for ast_str_append */
-#include "asterisk/utils.h" /* for ast_calloc, ast_free */
+#include "asterisk/utils.h" /* for ast_free */
#include "asterisk/ilbc.h"
static struct ast_format *ilbc_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
{
+ char *attribs = ast_strdupa(attributes), *attrib;
struct ast_format *cloned;
struct ilbc_attr *attr;
const char *kvp;
}
attr = ast_format_get_attribute_data(cloned);
- if ((kvp = strstr(attributes, "mode")) && sscanf(kvp, "mode=%30u", &val) == 1) {
+ /* lower-case everything, so we are case-insensitive */
+ for (attrib = attribs; *attrib; ++attrib) {
+ *attrib = tolower(*attrib);
+ } /* based on channels/chan_sip.c:process_a_sdp_image() */
+
+ if ((kvp = strstr(attribs, "mode")) && sscanf(kvp, "mode=%30u", &val) == 1) {
attr->mode = val;
} else {
attr->mode = 30; /* optional attribute; 30 is default value */
#include "asterisk.h"
+#include <ctype.h>
+
#include "asterisk/module.h"
#include "asterisk/format.h"
+#include "asterisk/astobj2.h"
#include "asterisk/logger.h"
#include "asterisk/strings.h"
#include "asterisk/utils.h"
static struct ast_format *opus_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
{
+ char *attribs = ast_strdupa(attributes), *attrib;
struct ast_format *cloned;
struct opus_attr *attr;
attr = ast_format_get_attribute_data(cloned);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_PLAYBACK_RATE, &attr->maxplayrate);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_CODED_AUDIO_BANDWIDTH,
+ /* lower-case everything, so we are case-insensitive */
+ for (attrib = attribs; *attrib; ++attrib) {
+ *attrib = tolower(*attrib);
+ } /* based on channels/chan_sip.c:process_a_sdp_image() */
+
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_MAX_PLAYBACK_RATE, &attr->maxplayrate);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_MAX_CODED_AUDIO_BANDWIDTH,
&attr->maxplayrate);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_SPROP_MAX_CAPTURE_RATE,
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_SPROP_MAX_CAPTURE_RATE,
&attr->spropmaxcapturerate);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_PTIME, &attr->maxptime);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_PTIME, &attr->ptime);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_AVERAGE_BITRATE, &attr->maxbitrate);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_STEREO, &attr->stereo);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_MAX_PTIME, &attr->maxptime);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_PTIME, &attr->ptime);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_MAX_AVERAGE_BITRATE, &attr->maxbitrate);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_STEREO, &attr->stereo);
if (attr->stereo) {
ast_format_set_channel_count(cloned, 2);
}
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_SPROP_STEREO, &attr->spropstereo);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_CBR, &attr->cbr);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_FEC, &attr->fec);
- sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_DTX, &attr->dtx);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_SPROP_STEREO, &attr->spropstereo);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_CBR, &attr->cbr);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_FEC, &attr->fec);
+ sdp_fmtp_get(attribs, CODEC_OPUS_ATTR_DTX, &attr->dtx);
return cloned;
}
#include "asterisk.h"
+#include <ctype.h> /* for tolower */
+
#include "asterisk/module.h"
#include "asterisk/format.h"
+#include "asterisk/logger.h" /* for ast_log, LOG_WARNING */
+#include "asterisk/strings.h" /* for ast_str_append */
+#include "asterisk/utils.h" /* for MAX, MIN */
/*!
* \brief SILK attribute structure.
static struct ast_format *silk_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
{
+ char *attribs = ast_strdupa(attributes), *attrib;
struct ast_format *cloned;
struct silk_attr *attr;
unsigned int val;
}
attr = ast_format_get_attribute_data(cloned);
- if (sscanf(attributes, "maxaveragebitrate=%30u", &val) == 1) {
+ /* lower-case everything, so we are case-insensitive */
+ for (attrib = attribs; *attrib; ++attrib) {
+ *attrib = tolower(*attrib);
+ } /* based on channels/chan_sip.c:process_a_sdp_image() */
+
+ if (sscanf(attribs, "maxaveragebitrate=%30u", &val) == 1) {
attr->maxbitrate = val;
}
- if (sscanf(attributes, "usedtx=%30u", &val) == 1) {
+ if (sscanf(attribs, "usedtx=%30u", &val) == 1) {
attr->dtx = val;
}
- if (sscanf(attributes, "useinbandfec=%30u", &val) == 1) {
+ if (sscanf(attribs, "useinbandfec=%30u", &val) == 1) {
attr->fec = val;
}
#include "asterisk.h"
+#include <ctype.h> /* for tolower */
+
#include "asterisk/module.h"
#include "asterisk/format.h"
+#include "asterisk/astobj2.h" /* for ao2_bump */
+#include "asterisk/logger.h" /* for ast_log, LOG_WARNING */
+#include "asterisk/strings.h" /* for ast_str_append */
/* Destroy is a required callback and must exist */
static void siren14_destroy(struct ast_format *format)
static struct ast_format *siren14_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
{
+ char *attribs = ast_strdupa(attributes), *attrib;
unsigned int val;
- if (sscanf(attributes, "bitrate=%30u", &val) == 1) {
+ /* lower-case everything, so we are case-insensitive */
+ for (attrib = attribs; *attrib; ++attrib) {
+ *attrib = tolower(*attrib);
+ } /* based on channels/chan_sip.c:process_a_sdp_image() */
+
+ if (sscanf(attribs, "bitrate=%30u", &val) == 1) {
if (val != 48000) {
ast_log(LOG_WARNING, "Got siren14 offer at %u bps, but only 48000 bps supported; ignoring.\n", val);
return NULL;
#include "asterisk.h"
+#include <ctype.h> /* for tolower */
+
#include "asterisk/module.h"
#include "asterisk/format.h"
+#include "asterisk/astobj2.h" /* for ao2_bump */
+#include "asterisk/logger.h" /* for ast_log, LOG_WARNING */
+#include "asterisk/strings.h" /* for ast_str_append */
/* Destroy is a required callback and must exist */
static void siren7_destroy(struct ast_format *format)
static struct ast_format *siren7_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
{
+ char *attribs = ast_strdupa(attributes), *attrib;
unsigned int val;
- if (sscanf(attributes, "bitrate=%30u", &val) == 1) {
+ /* lower-case everything, so we are case-insensitive */
+ for (attrib = attribs; *attrib; ++attrib) {
+ *attrib = tolower(*attrib);
+ } /* based on channels/chan_sip.c:process_a_sdp_image() */
+
+ if (sscanf(attribs, "bitrate=%30u", &val) == 1) {
if (val != 32000) {
ast_log(LOG_WARNING, "Got Siren7 offer at %u bps, but only 32000 bps supported; ignoring.\n", val);
return NULL;
#include "asterisk.h"
+#include <ctype.h> /* for tolower */
+
#include "asterisk/module.h"
#include "asterisk/format.h"
#include "asterisk/logger.h" /* for ast_log, LOG_WARNING */
static struct ast_format *vp8_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
{
+ char *attribs = ast_strdupa(attributes), *attrib;
struct ast_format *cloned;
struct vp8_attr *attr;
const char *kvp;
}
attr = ast_format_get_attribute_data(cloned);
- if ((kvp = strstr(attributes, "max-fr")) && sscanf(kvp, "max-fr=%30u", &val) == 1) {
+ /* lower-case everything, so we are case-insensitive */
+ for (attrib = attribs; *attrib; ++attrib) {
+ *attrib = tolower(*attrib);
+ } /* based on channels/chan_sip.c:process_a_sdp_image() */
+
+ if ((kvp = strstr(attribs, "max-fr")) && sscanf(kvp, "max-fr=%30u", &val) == 1) {
attr->maximum_frame_rate = val;
} else {
attr->maximum_frame_rate = UINT_MAX;
}
- if ((kvp = strstr(attributes, "max-fs")) && sscanf(kvp, "max-fs=%30u", &val) == 1) {
+ if ((kvp = strstr(attribs, "max-fs")) && sscanf(kvp, "max-fs=%30u", &val) == 1) {
attr->maximum_frame_size = val;
} else {
attr->maximum_frame_size = UINT_MAX;