Uploaded image for project: 'ASTPP Community'
  1. ASTPP Community
  2. ASTPPCOM-347

IP MAP with sip_profile binding

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Done
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: v4.0.2
    • Labels:
      None

      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

        Attachments

          Activity

            People

            Assignee:
            samir.doshi Samir Doshi
            Reporter:
            legionnet legionnet
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: