Module: kamailio
Branch: 5.5
Commit: 01ab21c4ba28259be72fd704afd389132260e258
URL:
https://github.com/kamailio/kamailio/commit/01ab21c4ba28259be72fd704afd3891…
Author: Luis Azedo <luis.azedo(a)factorlusitano.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-08-19T21:32:55+02:00
core: parse session sendrecv_mode in sdp
- some user agents send a=sendonly as session attribute which apply to all media streams
(cherry picked from commit 8da4477fd6d9590b9946071b9ac2a778b1d55d01)
---
Modified: src/core/parser/sdp/sdp.c
Modified: src/core/parser/sdp/sdp.h
---
Diff:
https://github.com/kamailio/kamailio/commit/01ab21c4ba28259be72fd704afd3891…
Patch:
https://github.com/kamailio/kamailio/commit/01ab21c4ba28259be72fd704afd3891…
---
diff --git a/src/core/parser/sdp/sdp.c b/src/core/parser/sdp/sdp.c
index d5e4f0695b..14779e4d12 100644
--- a/src/core/parser/sdp/sdp.c
+++ b/src/core/parser/sdp/sdp.c
@@ -453,6 +453,18 @@ static int parse_sdp_session(str *sdp_body, int session_num, str
*cnt_disp, sdp_
extract_bwidth(&tmpstr1, &session->bw_type, &session->bw_width);
}
+ /* Find sendrecv_mode between session begin and first media.
+ * parse session attributes to check is_on_hold for a= for all medias. */
+ a1p = find_first_sdp_line(o1p, m1p, 'a', NULL);
+ while (a1p) {
+ tmpstr1.s = a1p;
+ tmpstr1.len = m1p - a1p;
+ if (extract_sendrecv_mode(&tmpstr1, &session->sendrecv_mode,
&session->is_on_hold) == 0) {
+ break;
+ }
+ a1p = find_next_sdp_line(a1p, m1p, 'a', NULL);
+ }
+
/* Have session. Iterate media descriptions in session */
m2p = m1p;
stream_num = 0;
diff --git a/src/core/parser/sdp/sdp.h b/src/core/parser/sdp/sdp.h
index 84ebcfc8a2..d8c1b15b66 100644
--- a/src/core/parser/sdp/sdp.h
+++ b/src/core/parser/sdp/sdp.h
@@ -111,6 +111,8 @@ typedef struct sdp_session_cell {
AS - application specific */
str bw_width; /**< The <bandwidth> is interpreted as kilobits per second by
default */
int streams_num; /**< number of streams inside a session */
+ str sendrecv_mode;
+ int is_on_hold; /**< flag indicating if this session is on hold */
struct sdp_stream_cell* streams;
} sdp_session_cell_t;