diff --git a/kamailio/configs/kamailio.cfg b/kamailio/configs/kamailio.cfg index cebfe9f9..03b04c53 100644 --- a/kamailio/configs/kamailio.cfg +++ b/kamailio/configs/kamailio.cfg @@ -803,8 +803,6 @@ modparam("htable", "htable", "inbound_failfwd=>size=8;autoexpire=0;dmqreplicate= modparam("htable", "htable", "inbound_prefixmap=>size=8;autoexpire=0;dmqreplicate=DMQ_REPLICATE_ENABLED;dbtable=dsip_prefix_mapping;cols='prefix,ruleid,priority';") # to manage Pass Thru Auth for Registration. Used to send Authorization requests back to the same backend media server modparam("htable", "htable", "pass_thru_auth=>size=8;autoexpire=3600;dmqreplicate=DMQ_REPLICATE_ENABLED;") -# to manage callid to inbound endpoint map. Entries will expire in 24 hours (1440 seconds) -#modparam("htable", "htable", "callid_inbound_endpoint_map=>size=8;autoexpire=1440;dmqreplicate=DMQ_REPLICATE_ENABLED;") # enrichdnid_lnpmap is used to lookup dnid prefixes to match against #!ifdef WITH_DNID_LNP_ENRICHMENT modparam("htable", "htable", "enrichdnid_lnpmap=>size=8;autoexpire=0;dmqreplicate=DMQ_REPLICATE_ENABLED;dbtable=dsip_dnid_lnp_mapping;cols='dnid,prefix';") @@ -1236,7 +1234,7 @@ route[NEXTHOP] { exit; } else if (isbflagset(FLB_SRC_PBX) || isflagset(FLT_PBX_AUTH) || isbflagset(FLB_SRC_MSTEAMS)) { - xlog("L_INFO", "The call coming from $si is will be routed to carrier via drouting\n"); + xlog("L_INFO", "The call coming from $si will be routed to carrier groups via drouting\n"); # Route to Carrier append_hf("P-hint: outbound\r\n"); @@ -1279,7 +1277,6 @@ route[NEXTHOP] { } sht_iterator_end("iter"); - if ($avp(lcr_match_group) > 0) { $avp(carrier_groupid) = $avp(lcr_match_group); } @@ -1304,18 +1301,18 @@ route[NEXTHOP] { uac_replace_from("\"$fU\"", "sip:$avp(auser)@$rd"); uac_replace_to("sip:$tU@$rd"); - remove_hf("Contact"); - append_hf("Contact: \r\n"); + subst_hf("Contact", "/(.*)?<(sips?):([0-9]+)@([^:]+)(:[0-9]{1,5})?(;.*)?>(.*)?/<\2:\3@UAC_REG_ADDR:$Rp\6>\7/", "f"); remove_hf("P-Asserted-Identity"); append_hf("P-Asserted-Identity: \r\n"); } else { - remove_hf("Contact"); - append_hf("Contact: \r\n"); + subst_hf("Contact", "/(.*)?<(sips?):([0-9]+)@([^:]+)(:[0-9]{1,5})?(;.*)?>(.*)?/<\2:\3@EXTERNAL_IP_ADDR:$Rp\6>\7/", "f"); remove_hf("P-Asserted-Identity"); append_hf("P-Asserted-Identity: \r\n"); } $rU = $var(orig_rU); + msg_apply_changes(); + add_contact_alias(); route(ENRICH_CARRIER_OUTBOUND); @@ -1348,10 +1345,6 @@ route[SETUP_DIALOG] { xlog("L_DBG", "dialog vars stored: dlg_var(caller_dst)==$dlg_var(caller_dst), dlg_var(callee_dst)==$dlg_var(callee_dst)\n"); } -#route[SET_CALLID_INBOUND_ENDPOINT_MAP] { -# $sht(callid_inbound_endpoint_map=>$ci) = $rd; -#} - # MaintMode Check - recursive function for checking if a number is in maintmode route[MAINTMODE_CHECK] { xlog("L_DBG", "The request domain $rd before maintmode check\n"); @@ -1679,11 +1672,9 @@ route[WITHINDLG] { setbflag(FLB_SRC_MSTEAMS_ONHOLD); } - #route(CUSTOM_WITHINDLG); - # sequential request withing a dialog should # take the path determined by record-routing - if (loose_route()) { + if (loose_route_mode("1")) { route(DLGURI); if (is_method("BYE")) { @@ -1731,6 +1722,8 @@ route[WITHINDLG] { } if (is_method("ACK|UPDATE|INVITE|BYE")) { + route(DLGURI); + # Set Accounting flags for no loose-route transactions if (is_method("BYE")) { sql_xquery("kam", "select src_gwgroupid, dst_gwgroupid from acc where callid = '$ci' and method = 'INVITE' limit 1", "rb"); @@ -1745,11 +1738,6 @@ route[WITHINDLG] { setflag(FLT_ACCFAILED); } -#!ifdef WITH_NAT - if (is_method("BYE|INVITE")) { - handle_ruri_alias(); - } -#!endif if (t_check_trans()) { # no loose-route, but stateful ACK; # must be an ACK after a 487 @@ -1770,24 +1758,6 @@ route[WITHINDLG] { exit; } -# Custom logic for processing calls within dialog -route[CUSTOM_WITHINDLG] { - -# # Workaround: added to support Vitality -# if (isbflagset(FLB_SRC_CARRIER)) { -# $var(inbound_endpoint) = $sht(callid_inbound_endpoint_map=>$ci); -# if (!strempty($var(inbound_endpoint)) && $var(inbound_endpoint) != 0) { -# $rd = $var(inbound_endpoint); -# } -# } -# # for BYEs remove from Htable -# if (is_method("BYE")) { -# sht_rm_name("callid_inbound_endpoint_map","sw","$ci"); -# } - - return; -} - # Handle on hold route[MANAGE_ONHOLD] { if (!is_method("INVITE")) { @@ -2031,7 +2001,7 @@ failure_route[DISPATCHER_NEXT] { if (t_is_canceled()) { exit; } - if t_check_status("401|407") { + if (t_check_status("401|407")) { xlog("L_INFO", "DOMAINROUTING 401 or 407 and the du was $du)\n"); $sht(pass_thru_auth=>$ci) = $du; return; @@ -2780,19 +2750,19 @@ route[RTPENGINEOFFER] { # for serverside NAT we may need to use one of the internal IPs as the media address if (isflagset(FLT_DST_INTERNAL_IP)) { - if (isflagset(FLT_DST_IPV4)) { + if (isflagset(FLT_DST_IPV6)) { $var(reflags) = $var(reflags) + " media-address=INTERNAL_IP6_ADDR"; } - else if (isflagset(FLT_DST_IPV6)) { - $var(reflags)= $var(reflags) + " media-address=INTERNAL_IP6_ADDR"; + else { + $var(reflags)= $var(reflags) + " media-address=INTERNAL_IP_ADDR"; } } else { - if (isflagset(FLT_DST_IPV4)) { - $var(reflags) = $var(reflags) + " media-address=EXTERNAL_IP_ADDR"; + if (isflagset(FLT_DST_IPV6)) { + $var(reflags) = $var(reflags) + " media-address=EXTERNAL_IP6_ADDR"; } - else if (isflagset(FLT_DST_IPV6)) { - $var(reflags)= $var(reflags) + " media-address=EXTERNAL_IP6_ADDR"; + else { + $var(reflags)= $var(reflags) + " media-address=EXTERNAL_IP_ADDR"; } } @@ -2816,6 +2786,9 @@ route[RTPENGINEOFFER] { else if (isflagset(FLT_SRC_IPV6) && isflagset(FLT_DST_IPV6)) { $var(reflags)= $var(reflags) + " direction=ipv6 direction=ipv6"; } + else { + $var(reflags)= $var(reflags) + " direction=ipv4 direction=ipv4"; + } #!endif #!endif @@ -2887,6 +2860,18 @@ route[RTPENGINEANSWER] { return; } +route[RTPENGINEDELETE] { +#!ifdef WITH_RTPENGINE + if (!isflagset(FLT_USE_RTPE)) { + return; + } + + rtpengine_delete(); +#!endif + + return; +} + # RTPProxy control and signaling updates for NAT traversal route[NATMANAGE] { #!ifdef WITH_NAT diff --git a/rtpengine/configs/rtpengine.conf b/rtpengine/configs/rtpengine.conf index 36cb16db..27b78d80 100644 --- a/rtpengine/configs/rtpengine.conf +++ b/rtpengine/configs/rtpengine.conf @@ -6,8 +6,10 @@ listen-ng = 127.0.0.1:7722 port-min = 10000 port-max = 20000 #num-threads = 8 -#timeout = 60 -#silent-timeout = 3600 +timeout = 60 +silent-timeout = 3600 +offer-timeout = 300 +#final-timeout = 7200 #tos = 184 #control-tos = 184 #delete-delay = 30