protocol: do not change LCO, when no LCO are present

In the current implementation the LCO parameters are reset. This means
that an MDCX without LCO will reset the LCO that have previously set
via CRCX. But according to RFC 3435 6.8 LocalConnectionOptions, the
LCO parameters should be preserved or left at their defaults if missing.

- Make sure LCO are retained if no LCO string is present.
- Also preserve the values of individual parameters if missing.

Change-Id: Ia0d73f61516618317dcd1d49384818fd8de27aa6
This commit is contained in:
Philipp Maier
2018-06-06 10:02:16 +02:00
parent b340f90c9e
commit 604410cd13

View File

@@ -405,10 +405,12 @@ static int set_local_cx_options(void *ctx, struct mgcp_lco *lco,
char *p_opt, *a_opt;
char codec[9];
if (!options)
return 0;
if (strlen(options) == 0)
return 0;
talloc_free(lco->string);
talloc_free(lco->codec);
lco->codec = NULL;
lco->pkt_period_min = lco->pkt_period_max = 0;
lco->string = talloc_strdup(ctx, options ? options : "");
p_opt = strstr(lco->string, "p:");
@@ -417,8 +419,10 @@ static int set_local_cx_options(void *ctx, struct mgcp_lco *lco,
lco->pkt_period_max = lco->pkt_period_min;
a_opt = strstr(lco->string, "a:");
if (a_opt && sscanf(a_opt, "a:%8[^,]", codec) == 1)
if (a_opt && sscanf(a_opt, "a:%8[^,]", codec) == 1) {
talloc_free(lco->codec);
lco->codec = talloc_strdup(ctx, codec);
}
LOGP(DLMGCP, LOGL_DEBUG,
"local CX options: lco->pkt_period_max: %i, lco->codec: %s\n",