Changeset 8252

Show
Ignore:
Timestamp:
08/30/09 09:58:22 (2 years ago)
Author:
p_lindheimer
Message:

fixes #3844 enum stopped working, reverted previous update re #3423 but left authors new licensing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.6/core/agi-bin/enumlookup.agi

    r7721 r8252  
    4141$lookup = get_var( $AGI, "DIAL_NUMBER" ); 
    4242 
    43 $enums = get_enum_providers(); 
     43$enums = Array( 
     44  'e164.org',  
     45  //'e164.arpa',  
     46  //'e164.info', 
     47); 
     48 
     49// Go through the ENUM providers and look for the number. 
    4450 
    4551$dialstr = ""; 
    4652 
    47 foreach ($enums as $enum) {  // Go through the ENUM providers and look for the number. 
     53foreach ($enums as $enum) { 
    4854  // Are we using php5 and can use get_dns_record? 
    4955    if (function_exists("dns_get_record")) { 
     
    7379      if (eregi('SIP|IAX', $row['tech'])) { 
    7480        $URI = $row['URI']; 
    75         // string delimiter defined in [macro-dialout-enum] 
    76         $dialstr .= $nextURI[$URI]."%"; 
     81        $dialstr .= $nextURI[$URI]."|"; 
    7782      } 
    7883    } 
     
    8691  global $AGI; 
    8792 
    88   $AGI->verbose("Looking up $lookup on $enum via shell command DIG",3); 
     93  $AGI->verbose("Looking up $lookup on $enum via shell command DIG",3);; 
    8994  $arpa = ""; 
    9095  for ($i = 0; $i < strlen($lookup); $i++) { 
     
    159164} 
    160165 
    161 function get_enum_providers() { 
    162   // parse enum.conf config file  
    163   $localprefix_file = get_var($AGI, "ASTETCDIR")."/enum.conf";  
    164   if (file_exists($localprefix_file)) {  
    165     $section="general";  
    166     parse_conf($localprefix_file, $conf, $section);  
    167     if (count($conf) == 0) {  
    168       $AGI->verbose("Could not parse config file $localprefix_file - using default e164.org", 0);  
    169       return Array("e164.org"); 
    170     }  
    171   } else {  
    172     $AGI->verbose("Could not open config file $localprefix_file - using default e164.org", 0);  
    173     return Array("e164.org"); 
    174   }  
    175  
    176   $enums = Array();  
    177   // pickup search org from the conf array  
    178   if (isset($conf["general"])) {  
    179     foreach ($conf["general"] as $key=>$options) {  
    180       if (isset($options["search"])) {  
    181         foreach($options as $enumorgs) {  
    182           $enums[]=$enumorgs;  
    183         } // store each enumorg in array          
    184       } // else, diff option   
    185     } // else, this isn't the section we want  
    186   } // else, no config for this section  
    187 } 
    188  
    189 function parse_conf($filename, &$conf, &$section) {  
    190   global $AGI;  
    191   $AGI->verbose("Parsing config file $filename",3);  
    192  
    193   if (is_null($conf)) { $conf = array(); }  
    194  
    195   if (is_null($section)) { $section = "general"; }  
    196  
    197   if (file_exists($filename)) {  
    198     $fd = fopen($filename, "r");  
    199     while ($line = fgets($fd, 1024)) {  
    200       if (preg_match("/^\s*([a-zA-Z0-9-_]+)\s*=>\s*(.*?)\s*([;#].*)?$/",$line,$matches)) {  
    201         // name => => value  
    202         // keep [] to allow for duplicate options like search  
    203         // could extend options to include for example:  
    204         // skipgateway => slow-sip-gateway.com  
    205         // earlyexit => yes (to return only 1 enum from dns lookup)   
    206         $conf[$section][][$matches[1]] = $matches[2];  
    207       } else if (preg_match("/^\s*\[(.+)\]/",$line,$matches)) {  
    208         // section name  
    209         $section = strtolower($matches[1]);  
    210       } else if (preg_match("/^\s*#include\s+(.*)\s*([;#].*)?/",$line,$matches)) {  
    211         // include another file  
    212         if ($matches[1][0] == "/") {  
    213           // absolute path  
    214           $filename = $matches[1];  
    215         } else {  
    216           // relative path  
    217           $filename =  dirname($filename)."/".$matches[1];  
    218         }  
    219         parse_conf($filename, $conf, $section);  
    220       }  
    221     } 
    222   } 
    223 } 
    224  
    225166?> 
  • modules/branches/2.6/core/module.xml

    r8229 r8252  
    44  <category>Basic</category> 
    55  <name>Core</name> 
    6   <version>2.6.0beta2.0</version> 
     6  <version>2.6.0beta2.1</version> 
    77  <publisher>FreePBX</publisher> 
    88  <license>GPLv2+</license> 
     
    1010  <canuninstall>no</canuninstall> 
    1111  <changelog> 
     12    *2.6.0beta2.1* #3844 (revert #3423) 
    1213    *2.6.0beta2.0* #3075, #3501, #3636, #3581, #3266, #3701, #3545, #3430, #3798, #3609, #3836 
    1314    *2.6.0beta1.3* trunk tab improvements