From 2e1be634c85d3ad064f3c985c5ee79a1ded1fe3a Mon Sep 17 00:00:00 2001 From: Andrew Pogrebennyk Date: Thu, 29 Dec 2022 10:14:05 +0100 Subject: [PATCH] MT#55831 don't create CF map if CF is denied by profile don't create CF map if CF is denied by profile (real ticket number: MT#13599) Change-Id: I76fa06d4c94a21937bdacb615a0a6e9762489520 --- apps/sw_vsc/SW_Vsc.cpp | 92 +++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/apps/sw_vsc/SW_Vsc.cpp b/apps/sw_vsc/SW_Vsc.cpp index 3bc7d0d6..b954c0b7 100644 --- a/apps/sw_vsc/SW_Vsc.cpp +++ b/apps/sw_vsc/SW_Vsc.cpp @@ -1214,36 +1214,36 @@ void SW_VscDialog::onInvite(const AmSipRequest &req) if ((ret = regexec(&m_patterns->cfuOnPattern, req.user.c_str(), 0, 0, 0)) == 0) { - if (!number2uri(req, my_handler, uuid, subId, domain, domId, 4, - uri, username)) + u_int64_t attId = getAttributeId(my_handler, "cfu"); + if (!attId) { filename = failAnnouncement; goto out; } - u_int64_t mapId = createCFMap(my_handler, subId, uri, - SW_VSC_DESTSET_CFU, "cfu"); - if (!mapId) + if(!checkSubscriberProfile(my_handler, profId, attId)) { filename = failAnnouncement; goto out; } - snprintf(map_str, sizeof(mapStr), "%llu", - (unsigned long long int)mapId); - mapStr = string(map_str); - u_int64_t attId = getAttributeId(my_handler, "cfu"); - if (!attId) + if (!number2uri(req, my_handler, uuid, subId, domain, domId, 4, + uri, username)) { filename = failAnnouncement; goto out; } - if(!checkSubscriberProfile(my_handler, profId, attId)) + u_int64_t mapId = createCFMap(my_handler, subId, uri, + SW_VSC_DESTSET_CFU, "cfu"); + if (!mapId) { filename = failAnnouncement; goto out; } + snprintf(map_str, sizeof(mapStr), "%llu", + (unsigned long long int)mapId); + mapStr = string(map_str); u_int64_t prefId = getPreference(my_handler, subId, attId, &foundPref, &prefStr); @@ -1331,36 +1331,36 @@ void SW_VscDialog::onInvite(const AmSipRequest &req) if ((ret = regexec(&m_patterns->cfbOnPattern, req.user.c_str(), 0, 0, 0)) == 0) { - if (!number2uri(req, my_handler, uuid, subId, domain, domId, 4, - uri, username)) + u_int64_t attId = getAttributeId(my_handler, "cfb"); + if (!attId) { filename = failAnnouncement; goto out; } - u_int64_t mapId = createCFMap(my_handler, subId, uri, - SW_VSC_DESTSET_CFB, "cfb"); - if (!mapId) + if(!checkSubscriberProfile(my_handler, profId, attId)) { filename = failAnnouncement; goto out; } - snprintf(map_str, sizeof(mapStr), "%llu", - (unsigned long long int)mapId); - mapStr = string(map_str); - u_int64_t attId = getAttributeId(my_handler, "cfb"); - if (!attId) + if (!number2uri(req, my_handler, uuid, subId, domain, domId, 4, + uri, username)) { filename = failAnnouncement; goto out; } - if(!checkSubscriberProfile(my_handler, profId, attId)) + u_int64_t mapId = createCFMap(my_handler, subId, uri, + SW_VSC_DESTSET_CFB, "cfb"); + if (!mapId) { filename = failAnnouncement; goto out; } + snprintf(map_str, sizeof(mapStr), "%llu", + (unsigned long long int)mapId); + mapStr = string(map_str); u_int64_t prefId = getPreference(my_handler, subId, attId, &foundPref, &prefStr); @@ -1448,6 +1448,19 @@ void SW_VscDialog::onInvite(const AmSipRequest &req) if ((ret = regexec(&m_patterns->cftOnPattern, req.user.c_str(), 0, 0, 0)) == 0) { + u_int64_t attId = getAttributeId(my_handler, "cft"); + if (!attId) + { + filename = failAnnouncement; + goto out; + } + + if(!checkSubscriberProfile(my_handler, profId, attId)) + { + filename = failAnnouncement; + goto out; + } + string::size_type timend = req.user.find('*', 4); string tim = req.user.substr(4, timend - 4); INFO("Extracted ringtimeout of '%s' from '%s' for uuid '%s'", @@ -1471,19 +1484,6 @@ void SW_VscDialog::onInvite(const AmSipRequest &req) (unsigned long long int)mapId); mapStr = string(map_str); - u_int64_t attId = getAttributeId(my_handler, "cft"); - if (!attId) - { - filename = failAnnouncement; - goto out; - } - - if(!checkSubscriberProfile(my_handler, profId, attId)) - { - filename = failAnnouncement; - goto out; - } - u_int64_t prefId = getPreference(my_handler, subId, attId, &foundPref, &prefStr); if (!prefId) @@ -1628,36 +1628,36 @@ void SW_VscDialog::onInvite(const AmSipRequest &req) if ((ret = regexec(&m_patterns->cfnaOnPattern, req.user.c_str(), 0, 0, 0)) == 0) { - if (!number2uri(req, my_handler, uuid, subId, domain, domId, 4, - uri, username)) + u_int64_t attId = getAttributeId(my_handler, "cfna"); + if (!attId) { filename = failAnnouncement; goto out; } - u_int64_t mapId = createCFMap(my_handler, subId, uri, - SW_VSC_DESTSET_CFNA, "cfna"); - if (!mapId) + if(!checkSubscriberProfile(my_handler, profId, attId)) { filename = failAnnouncement; goto out; } - snprintf(map_str, sizeof(mapStr), "%llu", - (unsigned long long int)mapId); - mapStr = string(map_str); - u_int64_t attId = getAttributeId(my_handler, "cfna"); - if (!attId) + if (!number2uri(req, my_handler, uuid, subId, domain, domId, 4, + uri, username)) { filename = failAnnouncement; goto out; } - if(!checkSubscriberProfile(my_handler, profId, attId)) + u_int64_t mapId = createCFMap(my_handler, subId, uri, + SW_VSC_DESTSET_CFNA, "cfna"); + if (!mapId) { filename = failAnnouncement; goto out; } + snprintf(map_str, sizeof(mapStr), "%llu", + (unsigned long long int)mapId); + mapStr = string(map_str); u_int64_t prefId = getPreference(my_handler, subId, attId, &foundPref, &prefStr);