Compare commits

...

1 Commits

Author SHA1 Message Date
Pau Espin 5438628f48 WIP RFC: disable handling SDP RTP if Osmux is announced in MGCP body
"X-Osmux: (*|<cid>)" is an Osmocom extension to MGCP which allows
to signal request and acceptance of use of Osmux framing instead of RTP.
It usually comes together with a regular SDP section which defines the
AMR data to be transported (in Osmux frames rather than RTP packets).
Hence, if Osmux is signalled, we want to avoid telling the RTP subsystem
to decode the recorded packets as RTP, which would then override the
default Osmux dissector.

TODO: find way to mark a packet_info as being "osmux" in packet-mgcp.c,
and use that information in packet-sdp.c to avoid adding the stream to
the RTP dissector.
2022-11-02 10:47:00 +01:00
2 changed files with 32 additions and 3 deletions

View File

@ -157,6 +157,7 @@ static int hf_mgcp_req_dup = -1;
static int hf_mgcp_req_dup_frame = -1;
static int hf_mgcp_rsp_dup = -1;
static int hf_mgcp_rsp_dup_frame = -1;
static int hf_mgcp_param_x_osmux = -1;
static int hf_mgcp_unknown_parameter = -1;
static int hf_mgcp_malformed_parameter = -1;
@ -882,25 +883,34 @@ static gint tvb_parse_param(tvbuff_t* tvb, gint offset, gint len, int** hf, mgcp
tvb_current_offset++;
/* Keep going, through possible vendor param name */
char ext_buf[256];
ext_buf[0] = '\0';
for (counter = 1;
((len > (counter + tvb_current_offset-offset)) &&
(g_ascii_isalpha(tempchar = tvb_get_guint8(tvb, tvb_current_offset+counter)) ||
g_ascii_isdigit(tempchar))) ;
counter++);
counter++) ext_buf[counter - 1] = g_ascii_toupper(tempchar);
if (tempchar == ':')
{
/* Looks like a valid vendor param name */
tvb_current_offset += counter;
ext_buf[counter - 1] = '\0';
fprintf(stderr, "MGCP Extension: %s\n", ext_buf);
switch (plus_minus)
{
case '+':
*hf = &hf_mgcp_param_extension_critical;
break;
case '-':
*hf = &hf_mgcp_param_extension;
if (strcmp(ext_buf, "OSMUX") == 0) {
fprintf(stderr, "MGCP Extension: is Osmux!!\n");
*hf = &hf_mgcp_param_x_osmux;
} else {
*hf = &hf_mgcp_param_extension;
}
break;
}
tvb_current_offset += counter;
}
}
break;
@ -1554,6 +1564,18 @@ static void dissect_mgcp_params(tvbuff_t *tvb, proto_tree *tree, mgcp_info_t* mi
dissect_mgcp_remotevoicemetrics(mgcp_param_tree, tvb, tvb_linebegin,
tvb_tokenbegin - tvb_linebegin, tokenlen);
}
/*
else
if (*my_param == hf_mgcp_param_x_osmux)
{
tokenlen = tvb_find_line_end(tvb, tvb_tokenbegin, -1, &tvb_lineend, FALSE);
proto_tree_add_string(mgcp_param_tree, *my_param, tvb,
tvb_linebegin, linelen,
tvb_format_text(wmem_packet_scope(), tvb, tvb_tokenbegin, tokenlen));
TODO: mark somewhere that Osmux is used, so that packet-sdp.c doesn't call srtp_add_address().
}
*/
else
{
tokenlen = tvb_find_line_end(tvb, tvb_tokenbegin, -1, &tvb_lineend, FALSE);
@ -2664,6 +2686,9 @@ void proto_register_mgcp(void)
{ &hf_mgcp_rsp_dup_frame,
{ "Original Response Frame", "mgcp.rsp.dup.frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
"Frame containing original response", HFILL }},
{ &hf_mgcp_param_x_osmux,
{ "Osmux", "mgcp.param.x_osmux", FT_STRING, BASE_NONE, NULL, 0x0,
"Osmux CID", HFILL }},
{ &hf_mgcp_unknown_parameter,
{ "Unknown parameter", "mgcp.unknown_parameter", FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }},

View File

@ -2348,9 +2348,11 @@ apply_sdp_transport(packet_info *pinfo, transport_info_t *transport_info, int re
DPRINT(("calling rtp_add_address, channel=%d, media_port=%d",
i, media_desc->media_port));
DINDENT();
/* TODO: Here only call this if !osmux:
srtp_add_address(pinfo, PT_UDP, &media_desc->conn_addr, media_desc->media_port, 0, "SDP", establish_frame,
media_desc->media_types,
media_desc->media.rtp_dyn_payload, NULL, setup_info);
*/
DENDENT();
}
/* SPRT might use the same port... */
@ -2367,7 +2369,9 @@ apply_sdp_transport(packet_info *pinfo, transport_info_t *transport_info, int re
DPRINT(("calling rtcp_add_address, channel=%d, control_port=%d",
i, media_desc->control_port));
DINDENT();
/* TODO: Here only call this if !osmux:
rtcp_add_address(pinfo, &media_desc->conn_addr, media_desc->control_port, 0, "SDP", establish_frame);
*/
DENDENT();
}
}