Show
Ignore:
Timestamp:
08/27/11 06:10:21 (2 years ago)
Author:
tm1000
Message:

Added Ability to add Google Apps Voice Accounts. Adding Trunk Prepends instead of just Route Prepends

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • contributed_modules/modules/googlevoice/functions.inc.php

    r12353 r12441  
    2323if(file_exists($amp_conf['AMPWEBROOT']."/admin/extensions.class.php")) { 
    2424  // Yes, then include these files 
     25  //I need to know if we really need these files. Questionable. 
    2526  require_once("functions.inc.php"); 
    2627  require_once("extensions.class.php"); 
     
    8182    foreach ($accounts as $account) { 
    8283      $phonenum = $account[0]; 
    83       $username = $account[1]; 
    84       $address  = $account[1].'@gmail.com'; 
     84                        $full_address = explode('@', $account[1]); 
     85                        if(array_key_exists(1, $full_address)) { 
     86                            $username = str_replace('.', '', $account[1]); 
     87                            $username = str_replace('@', '', $username); 
     88                            $address  = $full_address[0].'@'.$full_address[1]; 
     89                        } else { 
     90                            $username = $account[1]; 
     91                            $address  = $account[1].'@gmail.com'; 
     92                        }      
    8593      $password = $account[2]; 
    8694      $output .= "[".$username."]\ntype=client\nserverhost=talk.google.com\n"; 
     
    118126      $incontext = "googlein"; 
    119127      $phonenum = $account[0]; 
    120       $username = $account[1]; 
    121       $address  = $account[1].'@gmail.com'; 
     128                        $full_address = explode('@', $account[1]); 
     129                        if(array_key_exists(1, $full_address)) { 
     130                            $username = str_replace('.', '', $account[1]); 
     131                            $username = str_replace('@', '', $username); 
     132                            $address  = $full_address[0].'@'.$full_address[1]; 
     133                        } else { 
     134                            $username = $account[1]; 
     135                            $address  = $account[1].'@gmail.com'; 
     136                        } 
    122137      $outcontext = 'googlevoice-'.$username; 
    123138 
     
    188203    return false; 
    189204  } 
     205         
     206        $full_address = explode('@', $username); 
     207        if(array_key_exists(1, $full_address)) { 
     208            $username = str_replace('.', '', $username); 
     209            $username = str_replace('@', '', $username); 
     210        } else { 
     211            $username = $username; 
     212        } 
    190213 
    191214  $trunknum = false; 
     
    195218    dbug_write('Trunknum = '.$trunknum.' 
    196219',''); 
     220                $patterns[] = array( 
     221                        'prepend_digits'    => '1', 
     222                        'match_pattern_prefix'  => '', 
     223                        'match_pattern_pass'  => 'NXXNXXXXXX', 
     224                        'match_cid'       => '', 
     225                ); 
     226                core_trunks_update_dialrules($trunknum, $patterns); 
    197227    if ($add_routes) { 
    198228      /* OUTBOUND ROUTE */ 
     
    303333    googlevoice_del_routes($trunknum,$username); 
    304334    core_trunks_del($trunknum); 
     335                core_trunks_delete_dialrules($trunknum); 
    305336  } 
    306337  return true; 
     
    349380  return; 
    350381} 
    351 ?> 
  • contributed_modules/modules/googlevoice/module.xml

    r12354 r12441  
    22  <rawname>googlevoice</rawname> 
    33  <name>Google Voice</name> 
    4   <version>0.1.1</version> 
     4  <version>0.5.0</version> 
    55  <publisher>Marcus Brown</publisher> 
    66  <license>GPLv2+</license> 
     
    1111  </description> 
    1212  <changelog> 
     13                *0.5.0* Added Ability to add Google Apps Voice Accounts. Adding Trunk Prepends instead of just Route Prepends 
    1314    *0.1.1* really fix the FreePBX 2.9 issue 
    1415    *0.1.0* make the module work for FreePBX 2.9