From Bulky Crane, 7 Years ago, written in Plain Text.
- view diff
Embed
  1.  
  2.  
  3. --set default variables
  4.         max_digits = 15;
  5.         digit_timeout = 5000;
  6.         debug["sql"] = true;
  7.  
  8. --connect to the database
  9.         require "resources.functions.database_handle";
  10.         dbh = database_handle('system');
  11.  
  12. --set the api
  13.         api = freeswitch.API();
  14.  
  15. --get the argv values
  16.         action = argv[2];
  17.  
  18. --get the session variables
  19.         if (session:ready()) then
  20.                 session:answer();
  21.         end
  22.  
  23. --get the session variables
  24.         if (session:ready()) then
  25.                 --general variables
  26.                         dnfrom = session:getVariable("dnfrom");
  27.                         uuid = session:get_uuid();
  28.                         rnoroute = session:getVariable("rnoroute");
  29.  
  30.         end
  31.  
  32.  
  33. --get the routing code
  34.         sql = "SELECT rnoroute FROM ported_number ";
  35.         sql = sql .. "WHERE dnfrom = '" .. dnfrom .."' ";
  36.                 --set the variables
  37.                         dnfrom = row.dnfrom;
  38.                         rnoroute = row.rnoroute;
  39.  
  40. --show the results
  41.         if (dnfrom) then
  42.                 freeswitch.consoleLog("notice", "routing code " .. dnfrom .. " dnfrom: " .. dnfrom .. "\n");
  43.         end
  44.  
  45.