From 26ee0b563bc8a7b3fae32659db9d0915762cd55c Mon Sep 17 00:00:00 2001 From: Carlos Cruz Date: Thu, 19 Dec 2024 13:07:15 +0100 Subject: [PATCH] kamtrunks: match against dlg_var(ddiId) instead of against DDIE164 --- kamailio/trunks/config/kamailio.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kamailio/trunks/config/kamailio.cfg b/kamailio/trunks/config/kamailio.cfg index 311f5d37a3..39c45c3098 100644 --- a/kamailio/trunks/config/kamailio.cfg +++ b/kamailio/trunks/config/kamailio.cfg @@ -578,7 +578,7 @@ route[CHECK_BOUNCE] { #!endif $xavp(ra) = $null; - sql_xquery("cb", "SELECT type FROM DDIs WHERE DDIE164='$rU'", "ra"); + sql_xquery("cb", "SELECT type FROM DDIs WHERE id='$dlg_var(ddiId)'", "ra"); if ($xavp(ra=>type) != $null) { if ($xavp(ra=>type) == 'out') { xnotice("[$dlg_var(cidhash)] CHECK-BOUNCE: Call is to one of my outbound DDIs, do not bounce\n"); @@ -1476,7 +1476,7 @@ route[APPLY_TRANSFORMATION] { route[GET_INFO_FROM_MATCHED_DDI] { if ($dlg_var(type) == 'unassigned') return; - sql_xquery("cb", "SELECT c.companyMediaRelaySetId, c.maxCalls AS maxCallsCompany, b.maxCalls AS maxCallsBrand, d.recordCalls, c.distributeMethod, c.applicationServerSetId, d.routeType, d.residentialDeviceId, d.retailAccountId, d.faxId FROM DDIs d JOIN Companies c ON d.companyId=c.id JOIN Brands b ON c.brandId=b.id WHERE d.DDIE164='$rU'", "ra"); + sql_xquery("cb", "SELECT c.companyMediaRelaySetId, c.maxCalls AS maxCallsCompany, b.maxCalls AS maxCallsBrand, d.recordCalls, c.distributeMethod, c.applicationServerSetId, d.routeType, d.residentialDeviceId, d.retailAccountId, d.faxId FROM DDIs d JOIN Companies c ON d.companyId=c.id JOIN Brands b ON c.brandId=b.id WHERE d.id='$dlg_var(ddiId)'", "ra"); # Matched DDI $dlg_var(maxCallsCompany) = $xavp(ra=>maxCallsCompany); @@ -1635,7 +1635,7 @@ route[SETUP_KAMUSERS_CALL] { # Check DDI is routed to a retail account $xavp(ra) = $null; - sql_xquery("cb", "SELECT RA.name AS username, DS.domain AS domain FROM DDIs D INNER JOIN RetailAccounts RA ON D.retailAccountId=RA.id INNER JOIN Domains DS ON RA.domainId=DS.id WHERE DDIE164='$rU'", "ra"); + sql_xquery("cb", "SELECT RA.name AS username, DS.domain AS domain FROM DDIs D INNER JOIN RetailAccounts RA ON D.retailAccountId=RA.id INNER JOIN Domains DS ON RA.domainId=DS.id WHERE D.id='$dlg_var(ddiId)'", "ra"); if ($xavp(ra) == $null) { xwarn("[$dlg_var(cidhash)] SETUP-KAMUSERS-CALL: $rU retail DDI not assigned to any retail account, reject\n"); send_reply("404", "No destination [SKC]"); @@ -1744,7 +1744,7 @@ route[CLASSIFY] { set_dlg_profile("outboundCallsCompany", "$dlg_var(companyId)"); set_dlg_profile("outboundCallsBrand", "$dlg_var(brandId)"); } else { - sql_xquery("cb", "SELECT B.id AS brandId, C.id AS companyId, C.type FROM DDIs D JOIN Brands B ON B.id=D.brandId LEFT JOIN Companies C ON D.companyId=C.id WHERE DDIE164='$rU'", "rp"); + sql_xquery("cb", "SELECT B.id AS brandId, C.id AS companyId, C.type FROM DDIs D JOIN Brands B ON B.id=D.brandId LEFT JOIN Companies C ON D.companyId=C.id WHERE D.id='$dlg_var(ddiId)'", "rp"); $dlg_var(brandId) = $xavp(rp=>brandId); $dlg_var(companyId) = $xavp(rp=>companyId);