Hello,
I think there is a logic error on outbound call flow. If I using Localization, option destination number translation, when I make a call the system search the number patterns on packages before realize the localization, so if I call using a prefix, 09 for example, the system search patterns from package_patterns table match 09+number and never find a pattern.
I think the logic should be apply localization before searching patterns on packages_patterns table.
Regards
Hello @social,
Hope you have refer complete flow of Localization in ASTPP. Sharing here video tutorial for reference
ASTPP 4 Tutorial: Localizations - YouTube so please confirm that you did correct steps. Later if you think it’s bug then please fill free to report it on our https://jira.astppbilling.org/ portal with details
This is the call flow:
2021-02-11 17:08:23.653576 [DEBUG] switch_cpp.cpp:1365 [ASTPP] [GET_PACKAGE_INFO] Query :SELECT ,P.id as package_id,P.product_id as product_id FROM packages_view as P inner join package_patterns as PKGPTR on P.product_id = PKGPTR.product_id WHERE (patterns = '^0914013434.’ OR patterns = ‘^091401343.’ OR patterns = '^09140134.’ OR patterns = ‘^0914013.’ OR patterns = '^091401.’ OR patterns = ‘^09140.’ OR patterns = '^0914.’ OR patterns = ‘^091.’ OR patterns = '^09.’ OR patterns = ‘^0.*’ OR patterns =’–’) AND accountid = 28 ORDER BY LENGTH(PKGPTR.patterns) DESC
2021-02-11 17:08:23.653576 [INFO] switch_cpp.cpp:1365 [ASTPP] =============== Account Information ===================
2021-02-11 17:08:23.653576 [INFO] switch_cpp.cpp:1365 [ASTPP] User id : 28
2021-02-11 17:08:23.653576 [INFO] switch_cpp.cpp:1365 [ASTPP] Account code : 579364750199
2021-02-11 17:08:23.653576 [INFO] switch_cpp.cpp:1365 [ASTPP] Balance : 14.9785
2021-02-11 17:08:23.653576 [INFO] switch_cpp.cpp:1365 [ASTPP] Type : 0 [0:prepaid,1:postpaid]
2021-02-11 17:08:23.653576 [INFO] switch_cpp.cpp:1365 [ASTPP] Ratecard id : 7
2021-02-11 17:08:23.653576 [INFO] switch_cpp.cpp:1365 [ASTPP] ========================================================
2021-02-11 17:08:23.653576 [DEBUG] switch_cpp.cpp:1365 [ASTPP] [GET_LOCALIZATION] Query :SELECT id,in_caller_id_originate,out_caller_id_originate,number_originate FROM localization WHERE id = 1 AND status=0 limit 1
2021-02-11 17:08:23.653576 [NOTICE] switch_cpp.cpp:1365 [ASTPP] [DONUMBERTRANSLATION] Before Localization CLI/DST : 0914013434
2021-02-11 17:08:23.653576 [NOTICE] switch_cpp.cpp:1365 [ASTPP] [DONUMBERTRANSLATION] After Localization CLI/DST : 5714013434
First search a package for number 091401343 but is not a real number so don’t find anything, then process the Localization. I think would be: Localization then packages.
Regards
Any hint, new?
It would be good to know if it is a mistake or not … in that case, stop looking for a solution
Developers have to know.
Thanks
Greetings
Hello hedimp.badani, I have the same issue. The package logic uses the “dialed” number as is and I think it should use the translated number (normalized to e.164 int this case).
Hi social, I managed to do localization prior to package selection. Here is how:
I managed to achieve this by adding this portion of code in function function package_calculation located at /usr/share/freeswitch/scripts/astpp/lib/astpp.functions.lua file:
original:
function package_calculation (destination_number,userinfo,call_direction)
local package_act_id = userinfo[‘id’]
if(call_direction == ‘inbound’)then
Logger.debug("[GET_PACKAGE_INFO] call_direction :" … call_direction)
if(didinfo and didinfo[‘accountid’] ~= ‘’)then
Logger.debug("[GET_PACKAGE_INFO] DID_ACCOUNTID :" … didinfo[‘accountid’])
package_act_id = didinfo[‘accountid’]
end
end
local tmp = {}
local remaining_sec
local package_maxlength
custom_destination = number_loop(destination_number,“patterns”)
local package_info_arr = {}
local i = 1 fd …( function continues…)…
introduced portion of code:
function package_calculation (destination_number,userinfo,call_direction)
local package_act_id = userinfo[‘id’]
if(call_direction == ‘inbound’)then
Logger.debug("[GET_PACKAGE_INFO] call_direction :" … call_direction)
if(didinfo and didinfo[‘accountid’] ~= ‘’)then
Logger.debug("[GET_PACKAGE_INFO] DID_ACCOUNTID :" … didinfo[‘accountid’])
package_act_id = didinfo[‘accountid’]
end
end
local tmp = {}
local remaining_sec
local package_maxlength
####### start add on #########
if (tonumber(userinfo['localization_id']) > 0) then
ar_localization = get_localization(userinfo['localization_id'],'O')
end
if (call_direction == 'outbound' and tonumber(userinfo['localization_id']) > 0 and ar_localization and ar_localization['number_originate'] ~= nil) then
ar_localization['number_originate'] = ar_localization['number_originate']:gsub(" ", "")
destination_number = do_number_translation(ar_localization['number_originate'],destination_number)
end
####### end add on #######
custom_destination = number_loop(destination_number,"patterns")
local package_info_arr = {}
local i = 1 fd .....( function continues...)......
.................
Whit that add-on, you can do localization prior to package search.
Regards,
Fernando