From 31641efe0677984d362c161ab2706319889036d4 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Wed, 13 Mar 2024 18:28:58 +0100 Subject: [PATCH] MT#58535 Be able to detect message type (request/reply) For the sake of proper processing for From/To tags, we need to know which message type originated interaction with the rtpengine (from behalf of kamailo module). This can be of two types: - request - reply This can also be re-used later, if there is a need to detect whether that was a request or reply. P.S.: opmode and message type shouldn't be confused, it's not the same, since SDP offer can come in the request as well as in the reply message (late offer/answer). So the opmode reflects what exactly is being done in terms of rtpengine operations, meanwhile the message type shows, which message type originated this processing. Change-Id: I8336175d3cfcf521418ac18b71cb4a6d5730705d --- daemon/call_interfaces.c | 16 ++++++++++++++++ include/call.h | 7 +++++++ include/call_interfaces.h | 1 + 3 files changed, 24 insertions(+) diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 20440f5d8..b46f87200 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1852,6 +1852,22 @@ static void call_ng_main_flags(sdp_ng_flags *out, str *key, bencode_item_t *valu case CSH_LOOKUP("set-label"): out->set_label = s; break; + case CSH_LOOKUP("sip-message-type"): + case CSH_LOOKUP("sip_message_type"): + switch (__csh_lookup(&s)) { + case CSH_LOOKUP("sip-request"): + case CSH_LOOKUP("sip_request"): + out->message_type = SIP_REQUEST; + break; + case CSH_LOOKUP("sip-reply"): + case CSH_LOOKUP("sip_reply"): + out->message_type = SIP_REPLY; + break; + default: + ilog(LOG_WARN, "Unknown 'sip-message-type' flag encountered: '" STR_FORMAT "'", + STR_FMT(&s)); + } + break; case CSH_LOOKUP("start-pos"): out->start_pos = bencode_get_integer_str(value, out->start_pos); break; diff --git a/include/call.h b/include/call.h index 6d9faa0b3..ea5e459cc 100644 --- a/include/call.h +++ b/include/call.h @@ -52,6 +52,13 @@ enum stream_address_format { SAF_NG, SAF_ICE, }; + +enum message_type { + SIP_OTHER = 0, + SIP_REQUEST, + SIP_REPLY, +}; + enum call_opmode { OP_OFFER = 0, OP_ANSWER = 1, diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 7042ef8e6..a343bab67 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -16,6 +16,7 @@ struct sockaddr_in6; struct sdp_ng_flags { enum call_opmode opmode; + enum message_type message_type; str call_id; str from_tag; str_q from_tags;