Compare commits

...

2 Commits

Author SHA1 Message Date
Neels Hofmeyr
0e501c5adb mgcp_client: guard against duplicate CI requests
Change-Id: I78da85e7ad19288c610f3d147e5af7021043a589
2023-03-30 03:49:56 +02:00
Neels Hofmeyr
95b39b5b04 log pt mismatch
Change-Id: I60c27b9c040c00bf5709d7c1b44008a9cbe46eab
2023-03-30 03:49:53 +02:00
3 changed files with 33 additions and 3 deletions

View File

@@ -626,6 +626,11 @@ void osmo_mgcpc_ep_ci_request(struct osmo_mgcpc_ep_ci *ci,
LOGP(DLMGCP, LOGL_ERROR, "Invalid MGW endpoint request: no ci\n");
goto dispatch_error;
}
if (ci->pending) {
LOG_CI(ci, LOGL_ERROR, "verb %s is already pending, wait for notify event before requesting %s\n",
osmo_mgcp_verb_name(ci->verb), osmo_mgcp_verb_name(verb));
goto dispatch_error;
}
if (!verb_info && verb != MGCP_VERB_DLCX) {
LOG_CI(ci, LOGL_ERROR, "Invalid MGW endpoint request: missing verb details for %s\n",
osmo_mgcp_verb_name(verb));

View File

@@ -459,7 +459,6 @@ struct mgcp_rtp_codec *mgcp_codec_find_convertible(struct mgcp_conn_rtp *conn, s
}
}
}
return codec_convertible;
}

View File

@@ -508,14 +508,40 @@ static int mgcp_patch_pt(struct mgcp_conn_rtp *conn_src, struct mgcp_conn_rtp *c
/* Find the codec information that is used on the source side */
codec_src = mgcp_codec_from_pt(conn_src, rtp_hdr->payload_type);
if (!codec_src)
if (!codec_src) {
LOG_CONN_RTP(conn_src, LOGL_ERROR,
"Cannot translate payload type nr %d: src has no such payload type defined\n",
rtp_hdr->payload_type);
if (log_check_level(DLMGCP, LOGL_DEBUG)) {
int i;
for (i = 0; i < conn_src->end.codecs_assigned; i++) {
struct mgcp_rtp_codec *src_codec_i = &conn_src->end.codecs[i];
LOGP(DLMGCP, LOGL_DEBUG, "Cannot translate PT %d: mismatches %d %s\n",
rtp_hdr->payload_type, src_codec_i->payload_type, src_codec_i->audio_name);
}
}
return -EINVAL;
}
/* Lookup a suitable codec in the destination connection. (The codec must be of the same type or at least
* convertible) */
codec_dst = mgcp_codec_find_convertible(conn_dst, codec_src);
if (!codec_dst)
if (!codec_dst) {
LOG_CONN_RTP(conn_src, LOGL_ERROR,
"Cannot translate payload type number %d = %s: dst has no such codec\n",
rtp_hdr->payload_type, codec_src->audio_name);
if (log_check_level(DLMGCP, LOGL_DEBUG)) {
int i;
for (i = 0; i < conn_dst->end.codecs_assigned; i++) {
struct mgcp_rtp_codec *dst_codec_i = &conn_dst->end.codecs[i];
LOGP(DLMGCP, LOGL_DEBUG,
"Cannot translate payload type nr %d = %s: mismatches %d = %s\n",
rtp_hdr->payload_type, codec_src->audio_name,
dst_codec_i->payload_type, dst_codec_i->audio_name);
}
}
return -EINVAL;
}
rtp_hdr->payload_type = (uint8_t) codec_dst->payload_type;
return 0;