mgw: Support receiving lowercase LCO codec
MGCP RFC3435 (https://tools.ietf.org/html/rfc3435) states almost all text has to be handled in a case-insensitive way, except SDP parts. Related: OS#4001 Change-Id: I51dc1cdcbe2a5587769335fbecb5039ef22cae5d
This commit is contained in:
parent
17058484d1
commit
83fd8a5692
|
@ -99,7 +99,7 @@ void mgcp_codec_reset_all(struct mgcp_conn_rtp *conn)
|
|||
conn->end.codec = NULL;
|
||||
}
|
||||
|
||||
/* Set members of struct mgcp_rtp_codec, extrapolate in missing information */
|
||||
/* Set members of struct mgcp_rtp_codec, extrapolate in missing information. Param audio_name is expected in uppercase. */
|
||||
static int codec_set(void *ctx, struct mgcp_rtp_codec *codec, int payload_type, const char *audio_name,
|
||||
unsigned int pt_offset, struct mgcp_codec_param *param)
|
||||
{
|
||||
|
@ -239,7 +239,7 @@ error:
|
|||
* \param[out] codec configuration (caller provided memory).
|
||||
* \param[out] conn related rtp-connection.
|
||||
* \param[in] payload_type codec type id (e.g. 3 for GSM, -1 when undefined).
|
||||
* \param[in] audio_name audio codec name (e.g. "GSM/8000/1").
|
||||
* \param[in] audio_name audio codec name, in uppercase (e.g. "GSM/8000/1").
|
||||
* \param[in] param optional codec parameters (set to NULL when unused).
|
||||
* \returns 0 on success, -EINVAL on failure. */
|
||||
int mgcp_codec_add(struct mgcp_conn_rtp *conn, int payload_type, const char *audio_name, struct mgcp_codec_param *param)
|
||||
|
|
|
@ -592,6 +592,7 @@ static int set_local_cx_options(void *ctx, struct mgcp_lco *lco,
|
|||
{
|
||||
char *lco_id;
|
||||
char codec[17];
|
||||
int len;
|
||||
|
||||
if (!options)
|
||||
return 0;
|
||||
|
@ -622,7 +623,11 @@ static int set_local_cx_options(void *ctx, struct mgcp_lco *lco,
|
|||
* codec only. */
|
||||
if (sscanf(lco_id + 1, ":%16[^,]", codec) == 1) {
|
||||
talloc_free(lco->codec);
|
||||
lco->codec = talloc_strdup(ctx, codec);
|
||||
/* MGCP header is case insensive, and we'll need
|
||||
codec in uppercase when using it later: */
|
||||
len = strlen(codec);
|
||||
lco->codec = talloc_size(ctx, len + 1);
|
||||
osmo_str_toupper_buf(lco->codec, len + 1, codec);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -214,7 +214,7 @@ static void test_strline(void)
|
|||
"m: sendrecv\r" \
|
||||
"c: 2\r\n" \
|
||||
"i: %s\r\n" \
|
||||
"l: A:AMR, NT:IN\r\n" \
|
||||
"l: A:amr, NT:IN\r\n" \
|
||||
"\n" \
|
||||
"v=0\r\n" \
|
||||
"o=- %s 23 IN IP4 0.0.0.0\r\n" \
|
||||
|
|
|
@ -199,7 +199,7 @@ creating message from statically defined input:
|
|||
MDCX 18983220 1@mgw MGCP 1.0
|
||||
m: sendrecv
c: 2
|
||||
i: %s
|
||||
l: A:AMR, NT:IN
|
||||
l: A:amr, NT:IN
|
||||
|
||||
v=0
|
||||
o=- %s 23 IN IP4 0.0.0.0
|
||||
|
|
Loading…
Reference in New Issue