Skip to content

Commit 2d91e26

Browse files
committed
kam: do not call rtpengine_manage when not necessary
rtpengine_manage will only be called: - Requests: BYE/CANCEL + INVITE/UPDATE/ACK with SDP - Responses: negative to INVITE/UPDATE + positive to INVITE/UPDATE with SDP Compared with prior logic, these calls will be skipped: - Requests: INVITE/UPDATE with no SDP. - Responses: BYE/CANCEL, INVITE/UPDATE positive with no SDP.
1 parent d1eb5d5 commit 2d91e26

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

kamailio/trunks/config/kamailio.cfg

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,8 +2098,13 @@ route[GENERIC_XMLRPC_COMMAND] {
20982098
}
20992099

21002100
route[RTPENGINE] {
2101-
if (!is_method("INVITE|UPDATE|ACK|BYE|CANCEL")) return;
2102-
if (is_method("ACK") && !has_body("application/sdp")) return;
2101+
# Requests - BYE/CANCEL + INVITE/UPDATE/ACK with SDP
2102+
if (is_request() && !is_method("INVITE|UPDATE|ACK|BYE|CANCEL")) return;
2103+
if (is_request() && is_method("INVITE|UPDATE|ACK") && !has_body("application/sdp")) return;
2104+
2105+
# Responses - negative responses to INVITE/UPDATE + positive responses to INVITE/UPDATE with SDP
2106+
if (!is_request() && !is_method("INVITE|UPDATE")) return;
2107+
if (!is_request() && is_method("INVITE|UPDATE") && t_check_status("[12][0-9]{2}") && !has_body("application/sdp")) return;
21032108

21042109
if ($(dlg_var(mediaRelaySetsId){s.len}) > 0 && $dlg_var(mediaRelaySetsId) != 0) {
21052110
set_rtpengine_set("$(dlg_var(mediaRelaySetsId){s.int})");

kamailio/users/config/kamailio.cfg

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,8 +2661,13 @@ route[GET_CODEC_INFO] {
26612661
}
26622662

26632663
route[RTPENGINE] {
2664-
if (!is_method("INVITE|UPDATE|ACK|BYE|CANCEL")) return;
2665-
if (is_method("ACK") && !has_body("application/sdp")) return;
2664+
# Requests - BYE/CANCEL + INVITE/UPDATE/ACK with SDP
2665+
if (is_request() && !is_method("INVITE|UPDATE|ACK|BYE|CANCEL")) return;
2666+
if (is_request() && is_method("INVITE|UPDATE|ACK") && !has_body("application/sdp")) return;
2667+
2668+
# Responses - negative responses to INVITE/UPDATE + positive responses to INVITE/UPDATE with SDP
2669+
if (!is_request() && !is_method("INVITE|UPDATE")) return;
2670+
if (!is_request() && is_method("INVITE|UPDATE") && t_check_status("[12][0-9]{2}") && !has_body("application/sdp")) return;
26662671

26672672
if ($(dlg_var(mediaRelaySetsId){s.len}) > 0 && $dlg_var(mediaRelaySetsId) != 0) {
26682673
xnotice("[$dlg_var(cidhash)] RTPENGINE: MediarelaysetId: $dlg_var(mediaRelaySetsId)\n");

0 commit comments

Comments
 (0)