[ASTPPCOM-347] IP MAP with sip_profile binding Created: 20/Mar/18  Updated: 01/Apr/21  Resolved: 01/Apr/21

Status: Done
Project: ASTPP Community
Component/s: None
Affects Version/s: None
Fix Version/s: v4.0.2

Type: New Feature
Reporter: legionnet Assignee: Samir Doshi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

You can binding sip_profile to IP MAP

update DB:
ALTER TABLE }}ip_map{{ ADD }}sip_profile_id{{ INT(4) NOT NULL DEFAULT '0' AFTER }}id{{;

change astpp.dialplan.lua in line 117 to
`
variable_sofia_profile_name = ""
variable_sofia_profile_name = params:getHeader('variable_sofia_profile_name')

authinfo = doauthentication(destination_number,from_ip,variable_sofia_profile_name)
`

update astpp.functions.lua in functions
doauthentication:
– Do Authentication
function doauthentication (destination_number,from_ip, sofia_profile_name)
return ipauthentication (destination_number,from_ip, sofia_profile_name)
end

ipauthentication:
function ipauthentication(destination_number,from_ip, sofia_profile_name)
local query = "SELECT "..TBL_IP_MAP..".*, (SELECT number FROM "..TBL_USERS.." where id="..TBL_IP_MAP..".accountid AND status=0 AND deleted=0) AS account_code FROM "..TBL_IP_MAP..", "..TBL_SIP_PROFIL
ES.." WHERE "..TBL_IP_MAP..".sip_profile_id="..TBL_SIP_PROFILES..".id AND "..TBL_SIP_PROFILES..".name='"..sofia_profile_name.."' AND INET_ATON(\"" ..from_ip.. "\") BETWEEN(INET_ATON(SUBSTRING_INDEX(ip
, '/', 1)) & 0xffffffff ^((0x1 <<(32 - SUBSTRING_INDEX(ip, '/', -1))) -1 )) AND(INET_ATON(SUBSTRING_INDEX(ip, '/', 1)) |((0x100000000 >> SUBSTRING_INDEX(ip,'/', -1)) -1)) AND \"" .. destination_
number .. "\" LIKE CONCAT(prefix,'%') ORDER BY LENGTH(prefix) DESC LIMIT 1"

add to constant.lua:
TBL_SIP_PROFILES = "sip_profiles"

And do web interface changes



 Comments   
Comment by legionnet [ 20/Mar/18 ]

I think sip registration is needed to binding sip_profiles too

Comment by Samir Doshi [ 20/Mar/18 ]

Hi [~legionnet]

What will be the use case to bind sip profile with ip map?

Comment by legionnet [ 20/Mar/18 ]

It`s more secure. Bind ip auth to sip profile (ip+port).
May use 1 client IP for different rate groups.
First rate group for first sip profile and second rate group for second sip profile.

Comment by legionnet [ 21/Mar/18 ]

And update please freeswitch/fs/lib/astpp.xml.php on line 183
change $query to
$query = "SELECT username,dir_params,dir_vars,number as accountcode,sip_devices.accountid FROM sip_devices,accounts,sip_profiles WHERE sip_profiles.id=sip_devices.sip_profile_id AND sip_devices.
status=0 AND accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND username='" . $_REQUEST ['user'] . "' AND sip_profiles.name='" . $_REQUEST ['sip_profile'] . "' limit 1";

Comment by Samir Doshi [ 28/Mar/18 ]

Alright. I will review that in LAB and confirm.

Comment by Samir Doshi [ 09/Apr/18 ]

We are still unsure about this improvements. Changing milestone to 4.0.

Comment by Samir Doshi [ 08/Sep/18 ]

This will not useful as rate group is linked to main account.

Generated at Sat Feb 10 07:16:19 CET 2024 using Jira 8.13.3#813003-sha1:22ebedbb75c99b147c66f14e031dd8a2d214753a.