Browse Source

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
pull/1809/head
Donat Zenichev 2 years ago
parent
commit
31641efe06
3 changed files with 24 additions and 0 deletions
  1. +16
    -0
      daemon/call_interfaces.c
  2. +7
    -0
      include/call.h
  3. +1
    -0
      include/call_interfaces.h

+ 16
- 0
daemon/call_interfaces.c View File

@ -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"): case CSH_LOOKUP("set-label"):
out->set_label = s; out->set_label = s;
break; 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"): case CSH_LOOKUP("start-pos"):
out->start_pos = bencode_get_integer_str(value, out->start_pos); out->start_pos = bencode_get_integer_str(value, out->start_pos);
break; break;


+ 7
- 0
include/call.h View File

@ -52,6 +52,13 @@ enum stream_address_format {
SAF_NG, SAF_NG,
SAF_ICE, SAF_ICE,
}; };
enum message_type {
SIP_OTHER = 0,
SIP_REQUEST,
SIP_REPLY,
};
enum call_opmode { enum call_opmode {
OP_OFFER = 0, OP_OFFER = 0,
OP_ANSWER = 1, OP_ANSWER = 1,


+ 1
- 0
include/call_interfaces.h View File

@ -16,6 +16,7 @@ struct sockaddr_in6;
struct sdp_ng_flags { struct sdp_ng_flags {
enum call_opmode opmode; enum call_opmode opmode;
enum message_type message_type;
str call_id; str call_id;
str from_tag; str from_tag;
str_q from_tags; str_q from_tags;


Loading…
Cancel
Save