From 151be4db883c726ab7e0bb7d95793e72c5436ec9 Mon Sep 17 00:00:00 2001 From: herlesupreeth Date: Wed, 9 Jun 2021 18:06:13 +0200 Subject: [PATCH] RTP fixes for In-dialog requests --- pcscf/kamailio_pcscf.cfg | 12 ++++--- pcscf/route/rtp.cfg | 76 +++++++++++++++++++++++----------------- 2 files changed, 51 insertions(+), 37 deletions(-) diff --git a/pcscf/kamailio_pcscf.cfg b/pcscf/kamailio_pcscf.cfg index f1ea1b6..5389152 100644 --- a/pcscf/kamailio_pcscf.cfg +++ b/pcscf/kamailio_pcscf.cfg @@ -330,6 +330,7 @@ modparam("rr", "append_fromtag", 1) modparam("rr", "add_username", 1) # Take User from a custom AVP modparam("rr", "custom_user_avp", "$avp(RR_CUSTOM_USER_AVP)") +modparam("rr", "force_send_socket", 1) #!ifdef WITH_XMLRPC # ----- xmlrpc params ----- @@ -443,6 +444,7 @@ modparam("ims_dialog", "dlg_flag", FLT_DIALOG) modparam("ims_dialog", "timeout_avp", "$avp(DLG_TIMEOUT_AVP)") modparam("ims_dialog", "detect_spirals", 0) modparam("ims_dialog", "profiles_no_value", "orig ; term") +modparam("ims_dialog", "profiles_with_value", "caller ; callee") #!ifdef DB_URL #!ifdef DB_URL2 modparam("ims_dialog", "db_url", "cluster://cluster1") @@ -759,11 +761,11 @@ route[REQINIT] { send_reply("503", "Server shutting down"); exit; } -#!ifdef WITH_IPSEC - if (!is_method("REGISTER")) { - ipsec_forward("location"); - } -#!endif +# #!ifdef WITH_IPSEC +# if (!is_method("REGISTER")) { +# ipsec_forward("location"); +# } +# #!endif # Ignore Re-Transmits: if (t_lookup_request()) { exit; diff --git a/pcscf/route/rtp.cfg b/pcscf/route/rtp.cfg index 59a0be4..d2566ec 100644 --- a/pcscf/route/rtp.cfg +++ b/pcscf/route/rtp.cfg @@ -1,50 +1,50 @@ # RTPProxy control route[ENC_SRTP] { add_rr_param(";rm=1"); - $avp(rtpproxy_offer_flags) = "loop protect replace-origin replace-session-connection ICE=force SRTP AVP"; - $avp(rtpproxy_answer_flags) = "loop protect replace-origin replace-session-connection ICE=remove RTP AVP"; + $avp(rtpproxy_offer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=force SRTP AVP"; + $avp(rtpproxy_answer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=remove RTP AVP"; } route[DEC_SRTP] { add_rr_param(";rm=2"); - $avp(rtpproxy_offer_flags) = "loop protect replace-origin replace-session-connection ICE=remove RTP AVP"; - $avp(rtpproxy_answer_flags) = "loop protect replace-origin replace-session-connection ICE=force SRTP AVP"; + $avp(rtpproxy_offer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=remove RTP AVP"; + $avp(rtpproxy_answer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=force SRTP AVP"; } route[ENC_WS_RTP] { add_rr_param(";rm=3"); - $avp(rtpproxy_offer_flags) = "loop protect replace-origin replace-session-connection ICE=force RTP AVPF"; - $avp(rtpproxy_answer_flags) = "loop protect replace-origin replace-session-connection ICE=remove RTP AVP"; + $avp(rtpproxy_offer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=force RTP AVPF"; + $avp(rtpproxy_answer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=remove RTP AVP"; } route[DEC_WS_RTP] { add_rr_param(";rm=4"); - $avp(rtpproxy_offer_flags) = "loop protect replace-origin replace-session-connection ICE=remove RTP AVP"; - $avp(rtpproxy_answer_flags) = "loop protect replace-origin replace-session-connection ICE=force RTP AVPF"; + $avp(rtpproxy_offer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=remove RTP AVP"; + $avp(rtpproxy_answer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=force RTP AVPF"; } route[ENC_WSS_RTP] { add_rr_param(";rm=5"); - $avp(rtpproxy_offer_flags) = "loop protect replace-origin replace-session-connection ICE=force SRTP AVPF DTLS=passive"; - $avp(rtpproxy_answer_flags) = "loop protect replace-origin replace-session-connection ICE=remove RTP AVP"; + $avp(rtpproxy_offer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=force SRTP AVPF DTLS=passive"; + $avp(rtpproxy_answer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=remove RTP AVP"; } route[DEC_WSS_RTP] { add_rr_param(";rm=6"); - $avp(rtpproxy_offer_flags) = "loop protect replace-origin replace-session-connection ICE=remove RTP AVP"; - $avp(rtpproxy_answer_flags) = "loop protect replace-origin replace-session-connection ICE=force SRTP AVPF DTLS=passive"; + $avp(rtpproxy_offer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=remove RTP AVP"; + $avp(rtpproxy_answer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=force SRTP AVPF DTLS=passive"; } route[ENC_RTP] { add_rr_param(";rm=7"); - $avp(rtpproxy_offer_flags) = "loop protect replace-origin replace-session-connection ICE=force RTP AVP"; - $avp(rtpproxy_answer_flags) = "loop protect replace-origin replace-session-connection ICE=remove RTP AVP"; + $avp(rtpproxy_offer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=force RTP AVP"; + $avp(rtpproxy_answer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=remove RTP AVP"; } route[DEC_RTP] { add_rr_param(";rm=8"); - $avp(rtpproxy_offer_flags) = "loop protect replace-origin replace-session-connection ICE=remove RTP AVP"; - $avp(rtpproxy_answer_flags) = "loop protect replace-origin replace-session-connection ICE=force RTP AVP"; + $avp(rtpproxy_offer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=remove RTP AVP"; + $avp(rtpproxy_answer_flags) = "flags=loop-protect replace-origin replace-session-connection ICE=force RTP AVP"; } # RTPProxy control @@ -75,20 +75,20 @@ route[NATMANAGE] { xlog("L_DBG", "No RM Param\n"); return; } - if (is_request()) { - if (isflagset(FLT_MOBILE_ORIG) && is_direction("downstream")) { - xlog("L_DBG", "1) add_contact_alias();"); + if (($fU != $null && is_in_profile("caller", "$fU")) || + ($tU != $null && is_in_profile("callee", "$tU"))) { + # In-Dialog Request from MO side + if (is_request() && isflagset(FLT_MOBILE_ORIG)) { add_contact_alias(); - } else if (!isflagset(FLT_MOBILE_ORIG) && is_direction("upstream")) { - xlog("L_DBG", "2) add_contact_alias();"); + } else if (is_reply() && !isflagset(FLT_MOBILE_ORIG)) { add_contact_alias(); } - } else { - if (!isflagset(FLT_MOBILE_ORIG) && is_direction("downstream")) { - xlog("L_DBG", "1) ADD_contact_alias();"); + } else if (($fU != $null && is_in_profile("callee", "$fU")) || + ($tU != $null && is_in_profile("caller", "$tU"))) { + # In-Dialog Request from MT side + if (is_request() && !isflagset(FLT_MOBILE_ORIG)) { add_contact_alias(); - } else if (isflagset(FLT_MOBILE_ORIG) && is_direction("downstream")) { - xlog("L_DBG", "2) ADD_contact_alias();"); + } else if (is_reply() && isflagset(FLT_MOBILE_ORIG)) { add_contact_alias(); } } @@ -131,12 +131,22 @@ route[NATMANAGE] { #!endif if ((is_reply() && ($T_req($tt) != $null)) || (is_request() && has_totag())) { - # In-Dialog requests - # Requests originating from MO or MT - if (is_request() && isflagset(FLT_MOBILE_ORIG)) { - rtpengine_manage(); - } else if (is_reply() && !isflagset(FLT_MOBILE_ORIG)) { - rtpengine_manage(); + if (($fU != $null && is_in_profile("caller", "$fU")) || + ($tU != $null && is_in_profile("callee", "$tU"))) { + # In-Dialog Request from MO side + if (is_request() && isflagset(FLT_MOBILE_ORIG)) { + rtpengine_manage(); + } else if (is_reply() && !isflagset(FLT_MOBILE_ORIG)) { + rtpengine_manage(); + } + } else if (($fU != $null && is_in_profile("callee", "$fU")) || + ($tU != $null && is_in_profile("caller", "$tU"))) { + # In-Dialog Request from MT side + if (is_request() && !isflagset(FLT_MOBILE_ORIG)) { + rtpengine_manage(); + } else if (is_reply() && isflagset(FLT_MOBILE_ORIG)) { + rtpengine_manage(); + } } } else { # Initial Requests @@ -146,8 +156,10 @@ route[NATMANAGE] { return; if (is_request() && isflagset(FLT_MOBILE_ORIG)) { + set_dlg_profile("caller", "$fU"); rtpengine_manage($avp(rtpproxy_offer_flags)); } else if (is_reply() && !isflagset(FLT_MOBILE_ORIG)) { + set_dlg_profile("callee", "$tU"); rtpengine_manage($avp(rtpproxy_answer_flags)); } }