Show
Ignore:
Timestamp:
05/29/09 14:01:54 (3 years ago)
Author:
seanmh
Message:

1.0.0 Added backward compatibility support for 2.0 rev 1104.

Fixed bug in which a flawed context would prevent orphaned parked calls from ringing back to the parking extension if parked via the panel.
Made debug menu always visible.
Added server debug menu.
Debug logs now show on main module page.
Multiple debug options can now be set at once.
Added database column checks in installation script to handle module upgrades.
Added default FreePBX page context to configuration.
Added admin username and password fields to the main module page.
Added originate timeout field to main module page.
Added auto reload and enable page status checkboxes to main module page.
Added global Jabber connection configuration fields on main module page.
Added email and cell phone fields to extension page.
Added Jabber connection configuration override fields to extension page.
Added Jabber username and password fields to extension page.
Added auto answer checkbox to extension page.
Modified database debug tables to account for new tables and columns.

Files:

Legend:

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

    r6771 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : June 27, 2008 
    6  *Last Updated : September 17, 2008 
    7  *History      : 0.7 
     6 *Last Updated : May 27, 2009 
     7 *History      : 1.1 
    88 *Purpose      : FreePBX module that automatically updates the iSymphony configuration from the FreePBX configuration. 
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
     
    3737} 
    3838 
     39//Control 
     40class ext_isymphony_controlplayback { 
     41  var $fileName; 
     42  var $skipMinutes; 
     43  var $ff; 
     44  var $rew; 
     45  var $stop; 
     46  var $pause; 
     47  var $restart; 
     48     
     49  function ext_isymphony_controlplayback($fileName, $skipMinutes, $ff, $rew, $stop, $pause, $restart) { 
     50    $this->fileName = $fileName; 
     51    $this->skipMinutes = $skipMinutes; 
     52    $this->ff = $ff; 
     53    $this->rew = $rew; 
     54    $this->stop = $stop; 
     55    $this->pause = $pause; 
     56    $this->restart = $restart; 
     57  } 
     58   
     59  function output() { 
     60    return "ControlPlayback(" . $this->fileName . "," . $this->skipMinutes . "," . $this->ff . "," . $this->rew . "," . $this->stop . "," . $this->pause . "," . $this->restart . ")"; 
     61  } 
     62} 
     63 
    3964//If check box GUI element does not exist add it 
    4065if(!class_exists("gui_checkbox")) { 
     
    5378  } 
    5479} 
    55  
    5680 
    5781//Main contributing module function------------------------------------------------------------------------------------------------------------------ 
     
    94118      } 
    95119     
    96       //Add custom iSymphony contexts 
    97       $id = "musiconhold"; 
    98         $c = '1000'; 
    99         $ext->add($id, $c, '', new ext_answer("")); 
    100         $ext->add($id, $c, '', new ext_setvar("isHoldContext", "\${DB(iSymphonyChannelHoldContexts/\${CHANNEL})}")); 
    101         $ext->add($id, $c, '', new ext_musiconhold("\${isHoldContext}")); 
    102         $ext->add($id, $c, '', new ext_dbdel("iSymphonyChannelHoldContexts/\${CHANNEL}")); 
    103          
    104         $id = "xfer-2-vm"; 
    105         $c = "_."; 
    106         $ext->add($id, $c, '', new ext_goto("1", "\${VM_PREFIX}\${EXTEN}", "from-internal")); 
    107         $ext->add($id, $c, '', new ext_hangup()); 
    108  
    109         $id = "ibarge"; 
    110       $ext->add($id, "_1X.", '', new ext_meetme("\${EXTEN:1}", "qd", "271721")); 
    111         $ext->add($id, "_1X.", '', new ext_hangup()); 
    112         $ext->add($id, "_2X.", '', new ext_meetme("\${EXTEN:1}", "aq", "271721")); 
    113         $ext->add($id, "_2X.", '', new ext_hangup()); 
    114  
    115       $id = "imeetme"; 
    116       $c = "_."; 
    117       $ext->add($id, "h", '', new ext_hangup()); 
    118       $ext->add($id, $c, '', new ext_setvar("roomOptions", "\${DB(iSymphonyMeetMeOptions/\${EXTEN})}")); 
    119       $ext->add($id, $c, '', new ext_meetme("\${EXTEN}", "\${roomOptions}", "271721")); 
    120       $ext->add($id, $c, '', new ext_hangup()); 
    121  
    122       $id = "ipark"; 
    123       $c = "_."; 
    124       $ext->add($id, "h", '', new ext_hangup()); 
    125       $ext->add($id, $c, '', new ext_setvar("parkContext", "\${DB(iSymphonyParkContexts/\${EXTEN})}")); 
    126       $ext->add($id, $c, '', new ext_answer("")); 
    127       $ext->add($id, $c, '', new ext_wait("1")); 
    128       $ext->add($id, $c, '', new ext_isymphony_parkandannounce("", "", "", "\${parkContext},\${EXTEN},1")); 
    129       $ext->add($id, $c, '', new ext_dbdel("iSymphonyParkContexts/\${EXTEN}")); 
     120      //Grab server version and revision 
     121      $serverVersion = "2.0"; 
     122      $serverRevision = "1104"; 
     123      if(iSymphonyConnect()) { 
     124        if((($serverVersionCheck = getiSymphonyServerVersion()) !== false)) { 
     125          $serverVersion = $serverVersionCheck; 
     126        } else { 
     127          isymphony_write_to_file($errorLogFile, "Could not get server version. $ISERROR \n"); 
     128        } 
     129         
     130        if((($serverRevisonCheck = getiSymphonyServerRevision()) !== false)) { 
     131          $serverRevision = $serverRevisonCheck; 
     132        } else { 
     133          isymphony_write_to_file($errorLogFile, "Could not get server revision. $ISERROR \n"); 
     134        } 
     135         
     136        iSymphonyDisconnect(); 
     137      } else { 
     138        isymphony_write_to_file($errorLogFile, "Could not get server version/revision. $ISERROR \n"); 
     139      } 
     140     
     141      isymphony_write_to_file($debugLogFile, "Server Version:" . $serverVersion . " Server Revision:" . $serverRevision . "\n"); 
     142     
     143      //Check if server version is 2.0 or 2.1 and add appropriate contexts 
     144      if(strstr($serverVersion, "2.1") !== false) { 
     145        isymphony_write_to_file($debugLogFile, "Using 2.1 contexts\n"); 
     146         
     147        $id = "isymphony-hold"; 
     148          $c = '432111'; 
     149          $ext->add($id, $c, '', new ext_musiconhold("\${iSymphonyMusicOnHoldClass}")); 
     150          $ext->add($id, $c, '', new ext_hangup()); 
     151       
     152        $id = "isymphony-voice-mail"; 
     153          $c = '432112'; 
     154          $ext->add($id, $c, '', new ext_vm("u\${iSymphonyVoiceMailBox}@\${iSymphonyVoiceMailBoxContext}")); 
     155          $ext->add($id, $c, '', new ext_hangup()); 
     156           
     157          $id = "isymphony-meetme"; 
     158          $c = '432113'; 
     159          $ext->add($id, $c, '', new ext_meetme("\${iSymphonyMeetMeRoomNumber}", "\${iSymphonyMeetMeRoomOptions}", "")); 
     160          $ext->add($id, $c, '', new ext_hangup()); 
     161           
     162          $id = "isymphony-park"; 
     163          $c = '432114'; 
     164          $ext->add($id, $c, '', new ext_isymphony_parkandannounce("", "", "", "\${iSymphonyParkContext},\${iSymphonyParkExtension},1")); 
     165          $ext->add($id, $c, '', new ext_hangup()); 
     166           
     167          $id = "isymphony-listen-to-voice-mail"; 
     168          $c = '432115'; 
     169          $ext->add($id, $c, '', new ext_isymphony_controlplayback("\${iSymphonyVoiceMailPath}", "1000", "*", "#", "7", "8" , "9")); 
     170          $ext->add($id, $c, '', new ext_hangup()); 
     171 
     172      } else { 
     173        isymphony_write_to_file($debugLogFile, "Using 2.0 contexts\n"); 
     174         
     175        $id = "musiconhold"; 
     176          $c = '1000'; 
     177          $ext->add($id, $c, '', new ext_answer("")); 
     178          $ext->add($id, $c, '', new ext_setvar("isHoldContext", "\${DB(iSymphonyChannelHoldContexts/\${CHANNEL})}")); 
     179          $ext->add($id, $c, '', new ext_musiconhold("\${isHoldContext}")); 
     180          $ext->add($id, $c, '', new ext_dbdel("iSymphonyChannelHoldContexts/\${CHANNEL}")); 
     181           
     182          $id = "xfer-2-vm"; 
     183          $c = "_."; 
     184          $ext->add($id, $c, '', new ext_goto("1", "\${VM_PREFIX}\${EXTEN}", "from-internal")); 
     185          $ext->add($id, $c, '', new ext_hangup()); 
     186   
     187          $id = "ibarge"; 
     188        $ext->add($id, "_1X.", '', new ext_meetme("\${EXTEN:1}", "qd", "271721")); 
     189          $ext->add($id, "_1X.", '', new ext_hangup()); 
     190          $ext->add($id, "_2X.", '', new ext_meetme("\${EXTEN:1}", "aq", "271721")); 
     191          $ext->add($id, "_2X.", '', new ext_hangup()); 
     192   
     193        $id = "imeetme"; 
     194        $c = "_."; 
     195        $ext->add($id, "h", '', new ext_hangup()); 
     196        $ext->add($id, $c, '', new ext_setvar("roomOptions", "\${DB(iSymphonyMeetMeOptions/\${EXTEN})}")); 
     197        $ext->add($id, $c, '', new ext_meetme("\${EXTEN}", "\${roomOptions}", "271721")); 
     198        $ext->add($id, $c, '', new ext_hangup()); 
     199   
     200        $id = "ipark"; 
     201        $c = "_."; 
     202        $ext->add($id, "h", '', new ext_hangup()); 
     203        $ext->add($id, $c, '', new ext_setvar("parkContext", "\${DB(iSymphonyParkContexts/\${EXTEN})}")); 
     204        $ext->add($id, $c, '', new ext_answer("")); 
     205        $ext->add($id, $c, '', new ext_wait("1")); 
     206        $ext->add($id, $c, '', new ext_isymphony_parkandannounce("", "", "", "\${parkContext},\${EXTEN},1")); 
     207        $ext->add($id, $c, '', new ext_dbdel("iSymphonyParkContexts/\${EXTEN}")); 
     208      } 
    130209 
    131210      //Connect to iSymphony server to query and submit information 
    132211      if(iSymphonyConnect()) { 
    133212       
    134         //Check for device user mode 
    135         $deviceUserMode = ($amp_conf["AMPEXTENSIONS"] == "deviceanduser") ? "true" : "false"; 
    136          
    137         //Check if default location exists if not create it else update manager connection values to stay consistent 
    138         if(($iSymphonyLocations = getISymphonyLocationList()) !== false) { 
    139           if(!in_array("default", $iSymphonyLocations)) { 
    140             $object = new ISymphonyLocation; 
    141             $object->name = "default"; 
    142             $object->admin_password = "secret"; 
    143             $object->asterisk_host = "localhost"; 
    144             $object->asterisk_port = "5038"; 
    145             $object->asterisk_login = "isymphony"; 
    146             $object->asterisk_password = "ismanager*con"; 
    147             $object->originate_timeout = "30000"; 
    148             $object->jabber_host = ""; 
    149             $object->jabber_port = "5222"; 
    150             $object->device_user_mode = $deviceUserMode; 
    151             if($object->add()) { 
    152               isymphony_write_to_file($debugLogFile, "Added location default\n"); 
     213        //Grab location Information 
     214        if(($locationInformation = isymphony_location_get()) !== null) { 
     215           
     216          //Check if server properties need to be updated. 
     217          if(($object = getISymphonyServer()) !== false) { 
     218             
     219            if(($object->username != $locationInformation["admin_user_name"]) || (($object->password != $locationInformation["admin_password"]))) { 
     220              $object->username = $locationInformation["admin_user_name"]; 
     221              $object->password = $locationInformation["admin_password"]; 
     222               
     223              if($object->update()) { 
     224                isymphony_write_to_file($debugLogFile, "Updated server\n"); 
     225              } else { 
     226                isymphony_write_to_file($debugLogFile, "(Update server) . $ISERROR . \n"); 
     227              } 
     228            } 
     229             
     230          } else { 
     231            isymphony_write_to_file($errorLogFile, "(Query server)" . $ISERROR. "\n"); 
     232          } 
     233           
     234          //Check if default location exists if not create it else update manager connection values to stay consistent 
     235          if(($iSymphonyLocations = getISymphonyLocationList()) !== false) { 
     236             
     237            $maskedAutoReloadFlag = ($locationInformation["auto_reload"] == 1) ? "true" : "false";   
     238             
     239            if(!in_array("default", $iSymphonyLocations)) { 
     240              $object = new ISymphonyLocation; 
     241              $object->name = "default"; 
     242              $object->admin_password = "secret"; 
     243              $object->asterisk_host = "localhost"; 
     244              $object->asterisk_port = "5038"; 
     245              $object->asterisk_login = "isymphony"; 
     246              $object->asterisk_password = "ismanager*con"; 
     247              $object->originate_timeout = $locationInformation["originate_timeout"]; 
     248              $object->reload_on_dial_plan_reload = $maskedAutoReloadFlag; 
     249              $object->jabber_host = $locationInformation["jabber_host"]; 
     250              $object->jabber_domain = $locationInformation["jabber_domain"]; 
     251              $object->jabber_resource = $locationInformation["jabber_resource"]; 
     252              $object->jabber_port = $locationInformation["jabber_port"]; 
     253              $object->device_user_mode = "true"; 
     254              if($object->add()) { 
     255                isymphony_write_to_file($debugLogFile, "Added location default\n"); 
     256              } else { 
     257                isymphony_write_to_file($errorLogFile, "(Add location)" . $ISERROR . "\n"); 
     258              } 
    153259            } else { 
    154               isymphony_write_to_file($errorLogFile, "(Add location)" . $ISERROR. "\n"); 
     260              if(($object = getISymphonyLocation("default")) !== false) { 
     261                 
     262                //Check if update needs to occur     
     263                if(isymphony_location_update_check($serverRevision, $locationInformation, $maskedAutoReloadFlag, $object)) {   
     264                  $object->asterisk_host = "localhost"; 
     265                  $object->asterisk_port = "5038"; 
     266                  $object->asterisk_login = "isymphony"; 
     267                  $object->asterisk_password = "ismanager*con"; 
     268                  $object->originate_timeout = $locationInformation["originate_timeout"]; 
     269                  $object->reload_on_dial_plan_reload = $maskedAutoReloadFlag; 
     270                  $object->jabber_host = $locationInformation["jabber_host"]; 
     271                  $object->jabber_domain = $locationInformation["jabber_domain"]; 
     272                  $object->jabber_resource = $locationInformation["jabber_resource"]; 
     273                  $object->jabber_port = $locationInformation["jabber_port"]; 
     274                  $object->device_user_mode = "true"; 
     275                   
     276                  if($object->update()) { 
     277                    isymphony_write_to_file($debugLogFile, "Updated location default\n"); 
     278                  } else { 
     279                    isymphony_write_to_file($errorLogFile, "(Update location)" . $ISERROR. "\n");  
     280                  } 
     281                }  
     282              } else { 
     283                isymphony_write_to_file($errorLogFile, "(Query location)" . $ISERROR. "\n"); 
     284              } 
    155285            } 
    156286          } else { 
    157             if(($object = getISymphonyLocation("default")) !== false) { 
    158                
    159               //Check if update needs to occur 
    160               if(($object->asterisk_host != "localhost") || ($object->asterisk_port != "5038") || ($object->asterisk_login != "isymphony") || ($object->asterisk_password != "ismanager*con") || ($object->device_user_mode != $deviceUserMode)) {     
     287            isymphony_write_to_file($errorLogFile, "(List locations)" . $ISERROR. "\n"); 
     288          } 
     289     
     290          //Check if default tenant exists if not create it else update context values to stay consistent 
     291          if(($iSymphonyTenants = getISymphonyTenantList("default")) !== false) { 
     292             
     293            //Mask auto answer flag 
     294            $maskedPagedStatusEnabledFlag = ($locationInformation["page_status_enabled"] == 1) ? "true" : "false";   
     295             
     296            if(!in_array("default", $iSymphonyTenants)) { 
     297              $object = new ISymphonyTenant; 
     298              $object->name = "default"; 
     299              $object->admin_password = "secret"; 
     300              $object->originating_context = "from-internal"; 
     301              $object->redirecting_context = "from-internal"; 
     302              $object->music_on_hold_class = "default"; 
     303              $object->page_status_enabled = $maskedPagedStatusEnabledFlag; 
     304              $object->page_context = "ext-paging"; 
     305              $object->outside_line_number = ""; 
     306              $object->record_file_name = "%EXT%-%NAME%-%CID_NAME%-%CID_NUMBER%-%DATE%-%TIME%"; 
     307              $object->record_file_extension = "wav"; 
     308              $object->mix_mode = "true"; 
     309              if($object->add("default")) { 
     310                isymphony_write_to_file($debugLogFile, "Added tenant default\n"); 
     311              } else { 
     312                isymphony_write_to_file($errorLogFile, "(Add tenant)" . $ISERROR. "\n"); 
     313              } 
     314            } else { 
     315              if(($object = getISymphonyTenant("default", "default")) !== false) { 
     316                 
     317                //Check if update needs to occur 
     318                if(isymphony_tenant_update_check($serverRevision, $locationInformation, $maskedPagedStatusEnabledFlag, $object)) { 
    161319                   
    162                 $object->asterisk_host = "localhost"; 
    163                 $object->asterisk_port = "5038"; 
    164                 $object->asterisk_login = "isymphony"
    165                 $object->asterisk_password = "ismanager*con"; 
    166                 $object->device_user_mode = $deviceUserMode; 
    167                  
    168                 if($object->update()) { 
    169                   isymphony_write_to_file($debugLogFile, "Updated location default\n"); 
    170                 } else { 
    171                   isymphony_write_to_file($errorLogFile, "(Update location)" . $ISERROR. "\n");  
     320                $object->originating_context = "from-internal"; 
     321                $object->redirecting_context = "from-internal"; 
     322                $object->page_status_enabled = $maskedPagedStatusEnabledFlag
     323                $object->page_context = "ext-paging"; 
     324                 
     325                if($object->update()) { 
     326                   isymphony_write_to_file($debugLogFile, "Updated tenant default\n"); 
     327                  } else { 
     328                   isymphony_write_to_file($errorLogFile, "(Update tenant)" . $ISERROR. "\n");  
     329                  }  
    172330                } 
    173               }  
    174             } else { 
    175               isymphony_write_to_file($errorLogFile, "(Query location)" . $ISERROR. "\n"); 
    176             } 
    177           } 
    178         } else { 
    179           isymphony_write_to_file($errorLogFile, "(List locations)" . $ISERROR. "\n"); 
    180         } 
    181    
    182         //Check if default tenant exists if not create it else update context values to stay consistent 
    183         if(($iSymphonyTenants = getISymphonyTenantList("default")) !== false) { 
    184           if(!in_array("default", $iSymphonyTenants)) { 
    185             $object = new ISymphonyTenant; 
    186             $object->name = "default"; 
    187             $object->admin_password = "secret"; 
    188             $object->originating_context = "from-internal"; 
    189             $object->redirecting_context = "from-internal"; 
    190             $object->music_on_hold_class = "default"; 
    191             $object->outside_line_number = ""; 
    192             $object->record_file_name = "%EXT%-%NAME%-%CID_NAME%-%CID_NUMBER%-%DATE%-%TIME%"; 
    193             $object->record_file_extension = "wav"; 
    194             $object->mix_mode = "true"; 
    195             if($object->add("default")) { 
    196               isymphony_write_to_file($debugLogFile, "Added tenant default\n"); 
    197             } else { 
    198               isymphony_write_to_file($errorLogFile, "(Add tenant)" . $ISERROR. "\n"); 
     331              } else { 
     332                isymphony_write_to_file($errorLogFile, "(Query tenant)" . $ISERROR. "\n"); 
     333              } 
    199334            } 
    200335          } else { 
    201             if(($object = getISymphonyTenant("default", "default")) !== false) { 
    202                
    203               //Check if update needs to occur 
    204               if(($object->originating_context != "from-internal") || ($object->redirecting_context != "from-internal")) { 
    205                  
    206                 $object->originating_context = "from-internal"; 
    207                 $object->redirecting_context = "from-internal"; 
    208                  
    209                 if($object->update()) { 
    210                   isymphony_write_to_file($debugLogFile, "Updated tenant default\n"); 
    211                 } else { 
    212                   isymphony_write_to_file($errorLogFile, "(Update tenant)" . $ISERROR. "\n");  
    213                 }  
    214               } 
    215             } else { 
    216               isymphony_write_to_file($errorLogFile, "(Query tenant)" . $ISERROR. "\n"); 
    217             } 
     336            isymphony_write_to_file($errorLogFile, "(List tenants)" . $ISERROR. "\n"); 
    218337          } 
    219338        } else { 
    220           isymphony_write_to_file($errorLogFile, "(List tenants)" . $ISERROR. "\n"); 
     339          isymphony_write_to_file($errorLogFile, "Failed to grab location information". "\n"); 
    221340        } 
    222341   
     
    262381          //Add and update extensions 
    263382          foreach($freePBXUsers as $freePBXUser) { 
     383 
     384            //Mask auto answer flag 
     385            $maskedAutoAnswerFlag = ($freePBXUser["auto_answer"] == 1) ? "true" : "false"; 
    264386             
    265387            //If extension does not exist add it else update it 
     
    273395              $object->alt_origination_method = ""; 
    274396              $object->voice_mail = $freePBXUser["user_id"]; 
     397              $object->cell_phone = $freePBXUser["cell_phone"]; 
     398              $object->email = $freePBXUser["email"]; 
     399              $object->auto_answer = $maskedAutoAnswerFlag; 
    275400               
    276401              if($object->add("default","default")) { 
     
    285410                           
    286411                //Check if update needs to occur 
    287                 if(($object->name != $freePBXUser["display_name"]) || ($object->voice_mail != $freePBXUser["user_id"]) || ($object->peer != $freePBXUser["peer"])) {     
     412                if(isymphony_extension_update_check($serverRevision, $freePBXUser, $maskedAutoAnswerFlag, $object)) {    
    288413                       
    289414                  $object->name = $freePBXUser["display_name"]; 
    290415                  $object->voice_mail = $freePBXUser["user_id"]; 
    291416                  $object->peer = $freePBXUser["peer"]; 
     417                  $object->cell_phone = $freePBXUser["cell_phone"]; 
     418                  $object->email = $freePBXUser["email"]; 
     419                  $object->auto_answer = $maskedAutoAnswerFlag; 
    292420                   
    293421                  if($object->update()) { 
     
    322450          //Add and update profiles 
    323451          foreach($freePBXProfiles as $freePBXProfile) { 
    324        
     452            
    325453            //If profile does not exist add it else update it 
    326454            if(!in_array($freePBXProfile["user_id"], $iSymphonyProfiles)) { 
     
    331459              $object->password = $freePBXProfile["password"]; 
    332460              $object->can_view_everyone_directory = "true"; 
     461              $object->jabber_host = $freePBXProfile["jabber_host"]; 
     462              $object->jabber_domain = $freePBXProfile["jabber_domain"];      
     463              $object->jabber_resource = $freePBXProfile["jabber_resource"];         
     464              $object->jabber_port = $freePBXProfile["jabber_port"];  
     465              $object->jabber_user_name = $freePBXProfile["jabber_user_name"]; 
     466              $object->jabber_password = $freePBXProfile["jabber_password"];   
    333467               
    334468              if($object->add("default","default")) { 
     
    348482              //Query profile configuration and update values 
    349483              if(($object = getISymphonyProfile("default", "default", $freePBXProfile["user_id"])) !== false) {    
    350                            
    351                 //Check if update needs to occur 
    352                 if($object->password != $freePBXProfile["password"]) {     
    353                        
     484                                     
     485                //If jabber port is set to blank in the db rewrite with a -1 to prevent this profile from always being updated. Since the server will store a -1 as the port value if none is set.           
     486                            $maskedJabberPort = ($object->jabber_port == -1) ? "" : $object->jabber_port;  
     487                                            
     488                                //Check if update needs to occur 
     489                                if(isymphony_profile_update_check($serverRevision, $freePBXProfile, $maskedJabberPort, $object)) {                   
     490                     
    354491                  $object->password = $freePBXProfile["password"]; 
     492                  $object->jabber_host = $freePBXProfile["jabber_host"]; 
     493                  $object->jabber_domain = $freePBXProfile["jabber_domain"];      
     494                  $object->jabber_resource = $freePBXProfile["jabber_resource"];         
     495                  $object->jabber_port = $freePBXProfile["jabber_port"];  
     496                  $object->jabber_user_name = $freePBXProfile["jabber_user_name"]; 
     497                  $object->jabber_password = $freePBXProfile["jabber_password"];   
    355498                   
    356499                  if($object->update()) { 
     
    360503                  }  
    361504                } 
     505                 
     506                //Attempt to add relative extension to profile 
     507                if(addISymphonyProfileManagedExtension("default","default",$freePBXProfile["user_id"],$freePBXProfile["user_id"])) { 
     508                  isymphony_write_to_file($debugLogFile, "Added profile managed extension {$freePBXProfile['user_id']}\n"); 
     509                } 
     510 
    362511              } else { 
    363512                isymphony_write_to_file($errorLogFile, "(Query profile)" . $ISERROR. "\n");  
     
    555704} 
    556705 
     706 
     707 
     708//iSymphony module API location functions------------------------------------------------------------------------------------------------------------ 
     709function isymphony_location_update($adminUserName, $adminPassword, $originateTimeout, $autoReload, $pageStatusEnabled, $jabberHost, $jabberDomain, $jabberResource, $jabberPort) { 
     710  global $db;  
     711  $autoReload = $autoReload ? "1" : "0"; 
     712  $pageStatusEnabled = $pageStatusEnabled ? "1" : "0"; 
     713  $prepStatement = $db->prepare("UPDATE isymphony_location SET admin_user_name = ?, admin_password = ?, originate_timeout = ?, auto_reload = ?, page_status_enabled = ?, jabber_host = ?, jabber_domain = ?, jabber_resource = ?, jabber_port = ?"); 
     714  $values = array($adminUserName, $adminPassword, $originateTimeout, $autoReload, $pageStatusEnabled, $jabberHost, $jabberDomain, $jabberResource, $jabberPort); 
     715  $db->execute($prepStatement, $values); 
     716} 
     717 
     718function isymphony_location_get() { 
     719  global $db;  
     720  $query = "SELECT * FROM isymphony_location"; 
     721  $results = sql($query, "getRow", DB_FETCHMODE_ASSOC); 
     722  if((DB::IsError($results)) || (empty($results))) { 
     723    return null; 
     724  } else { 
     725    return $results; 
     726  } 
     727} 
     728 
    557729//iSymphony module API user functions---------------------------------------------------------------------------------------------------------------- 
    558 function isymphony_user_add($userId, $addExtension, $addProfile, $password, $displayName, $peer) { 
     730function isymphony_user_add($userId, $addExtension, $addProfile, $password, $displayName, $peer, $cell_phone, $email, $autoAnswer, $jabberHost, $jabberDomain, $jabberResource, $jabberPort, $jabberUserName, $jabberPassword) { 
    559731  global $db;  
    560732  $addProfile = $addProfile ? "1" : "0"; 
    561733  $addExtension = $addExtension ? "1" : "0"; 
    562   $prepStatement = $db->prepare("INSERT INTO isymphony_users (user_id, add_extension, add_profile, password, display_name, peer) VALUES (?, ?, ?, ?, ?, ?)"); 
    563   $values = array($userId, $addExtension, $addProfile, $password, $displayName, $peer); 
     734  $autoAnswer = $autoAnswer ? "1" : "0"; 
     735  $prepStatement = $db->prepare("INSERT INTO isymphony_users (user_id, add_extension, add_profile, password, display_name, peer, cell_phone, email, auto_answer, jabber_host, jabber_domain, jabber_resource, jabber_port, jabber_user_name, jabber_password) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?, ?, ?)"); 
     736  $values = array($userId, $addExtension, $addProfile, $password, $displayName, $peer, $cell_phone, $email, $autoAnswer, $jabberHost, $jabberDomain, $jabberResource, $jabberPort, $jabberUserName, $jabberPassword); 
    564737  $db->execute($prepStatement, $values); 
    565738} 
    566739 
    567 function isymphony_user_update($userId, $addExtension, $addProfile, $password, $displayName, $peer) { 
     740function isymphony_user_update($userId, $addExtension, $addProfile, $password, $displayName, $peer, $cell_phone, $email, $autoAnswer, $jabberHost, $jabberDomain, $jabberResource, $jabberPort, $jabberUserName, $jabberPassword) { 
    568741  global $db;  
    569742  $addProfile = $addProfile ? "1" : "0"; 
    570743  $addExtension = $addExtension ? "1" : "0"; 
    571   $prepStatement = $db->prepare("UPDATE isymphony_users SET add_extension = ?, add_profile = ?, password = ?, display_name = ?, peer = ? WHERE user_id = $userId"); 
    572   $values = array($addExtension, $addProfile, $password, $displayName, $peer); 
     744  $autoAnswer = $autoAnswer ? "1" : "0"; 
     745  $prepStatement = $db->prepare("UPDATE isymphony_users SET add_extension = ?, add_profile = ?, password = ?, display_name = ?, peer = ?, cell_phone = ?, email = ?, auto_answer = ?, jabber_host = ?, jabber_domain = ?, jabber_resource = ?, jabber_port = ?, jabber_user_name = ?, jabber_password = ? WHERE user_id = $userId"); 
     746  $values = array($addExtension, $addProfile, $password, $displayName, $peer, $cell_phone, $email, $autoAnswer, $jabberHost, $jabberDomain, $jabberResource, $jabberPort, $jabberUserName, $jabberPassword); 
    573747  $db->execute($prepStatement, $values); 
    574748} 
     
    734908    $userProfile = ($iSymphonyUser["add_profile"] == "1"); 
    735909    $password = $iSymphonyUser["password"]; 
     910    $email  = $iSymphonyUser["email"]; 
     911    $cell_phone = $iSymphonyUser["cell_phone"]; 
     912    $autoAnswer = $iSymphonyUser["auto_answer"]; 
     913    $jabberHost = $iSymphonyUser["jabber_host"]; 
     914    $jabberDomain = $iSymphonyUser["jabber_domain"]; 
     915    $jabberResource = $iSymphonyUser["jabber_resource"]; 
     916    $jabberPort = $iSymphonyUser["jabber_port"]; 
     917    $jabberUserName = $iSymphonyUser["jabber_user_name"]; 
     918    $jabberPassword = $iSymphonyUser["jabber_password"]; 
    736919   
    737920  } else { 
    738921    $added = true; 
    739922    $userProfile = true; 
    740     $password = "secret";  
     923    $password = "secret"; 
     924    $email = ""; 
     925    $cell_phone = ""; 
     926    $autoAnswer = false;   
     927    $jabberHost = ""; 
     928    $jabberDomain = ""; 
     929    $jabberResource = "iSymphony"; 
     930    $jabberPort = "5222"; 
     931    $jabberUserName = ""; 
     932    $jabberPassword = ""; 
    741933  } 
    742934   
    743935  //Create GIU elements if not on delete page 
    744936  if ($action != "del") { 
    745     $section = _("iSymphony"); 
    746     $currentcomponent->addguielem($section, new gui_checkbox("isymphony_add_extension", $added, "Add to iSymphony", "Makes this Extension/User available in iSymphony.", "on", "", "", false)); 
     937    $section = _("iSymphony Profile Settings"); 
    747938    $currentcomponent->addguielem($section, new gui_checkbox("isymphony_add_profile", $userProfile, "Create Profile", "Creates an iSymphony login profile which is associated with this extension.", "on", "", "", false)); 
    748939    $currentcomponent->addguielem($section, new gui_textbox("isymphony_profile_password", $password, "Profile Password", "Specifies the password to be used for this profile.", "", "", true, "100", false));  
     940     
     941    $section = _("iSymphony Extension Settings"); 
     942    $currentcomponent->addguielem($section, new gui_checkbox("isymphony_add_extension", $added, "Add to iSymphony", "Makes this Extension/User available in iSymphony.", "on", "", "", false)); 
     943    $currentcomponent->addguielem($section, new gui_checkbox("isymphony_auto_answer", $autoAnswer, "Auto Answer", "Makes this extension automatically answer the initial call received from the system when performing an origination within the panel. Only works with Aastra, Grandstream, Linksys, Polycom, and Snom phones.", "on", "", "", false)); 
     944    $currentcomponent->addguielem($section, new gui_textbox("isymphony_add_email", $email, "Email Address", "The email address entered here will be used whenever someone clicks the email icon for this extension.", "", "", true, "100")); 
     945    $currentcomponent->addguielem($section, new gui_textbox("isymphony_add_cell_phone", $cell_phone, "Cell Phone", "The number entered here will be used whenever someone clicks the cell phone icon for this extension.", "", "", true, "100")); 
     946 
     947    $section = _("iSymphony Jabber Settings"); 
     948    $currentcomponent->addguielem($section, new gui_textbox("isymphony_jabber_host", $jabberHost, "Host", "Host or IP of jabber server this extension will connect to.", "", "", true, "100")); 
     949    $currentcomponent->addguielem($section, new gui_textbox("isymphony_jabber_domain", $jabberDomain, "Domain", "Domain this extension will connect to the jabber server with.", "", "", true, "100")); 
     950    $currentcomponent->addguielem($section, new gui_textbox("isymphony_jabber_resource", $jabberResource, "Resource", "Resource this extension will connect to the jabber server with.", "", "", true, "100")); 
     951    $currentcomponent->addguielem($section, new gui_textbox("isymphony_jabber_port", $jabberPort, "Port", "Port this extension will connect to the jabber server with.", "", "", true, "100")); 
     952    $currentcomponent->addguielem($section, new gui_textbox("isymphony_jabber_user_name", $jabberUserName, "UserName", "UserName this extension will connect to the jabber server with.", "", "", true, "100")); 
     953    $currentcomponent->addguielem($section, new gui_textbox("isymphony_jabber_password", $jabberPassword, "Password", "Password this extension will connect to the jabber server with.", "", "", true, "100")); 
    749954  } 
    750955} 
     
    771976  $addExtension = isset($_REQUEST["isymphony_add_extension"]); 
    772977  $addProfile = isset($_REQUEST["isymphony_add_profile"]); 
     978  $autoAnswer = isset($_REQUEST["isymphony_auto_answer"]); 
    773979  $password = isset($_REQUEST["isymphony_profile_password"]) ? $_REQUEST["isymphony_profile_password"]: null; 
    774980  $password = (($password === null) || (trim($password) == "")) ? "secret" : trim($password); 
    775      
     981 
     982  // Cell Phone 
     983  $cell_phone = isset($_REQUEST["isymphony_add_cell_phone"]) ? $_REQUEST["isymphony_add_cell_phone"] : null;     
     984   
     985  // Email  
     986  $email = isset($_REQUEST["isymphony_add_email"]) ? $_REQUEST["isymphony_add_email"] : null;  
     987   
     988  //Jabber info 
     989  $jabberHost = isset($_REQUEST["isymphony_jabber_host"]) ? $_REQUEST["isymphony_jabber_host"] : null;   
     990  $jabberDomain = isset($_REQUEST["isymphony_jabber_domain"]) ? $_REQUEST["isymphony_jabber_domain"] : null;   
     991  $jabberResource = isset($_REQUEST["isymphony_jabber_resource"]) ? $_REQUEST["isymphony_jabber_resource"] : "iSymphony";  
     992  $jabberPort = (isset($_REQUEST["isymphony_jabber_port"]) && is_numeric($_REQUEST["isymphony_jabber_port"])) ? $_REQUEST["isymphony_jabber_port"] : "5222";   
     993  $jabberUserName = isset($_REQUEST["isymphony_jabber_user_name"]) ? $_REQUEST["isymphony_jabber_user_name"] : null;   
     994  $jabberPassword = isset($_REQUEST["isymphony_jabber_password"]) ? $_REQUEST["isymphony_jabber_password"] : null;   
     995 
    776996  //Modify DB 
    777997  if(($extension !== null) && ($extension != "") && ($action !== null)) { 
     
    7821002    } else if(($action == "add") || ($action == "edit") && ($name !== null)) { 
    7831003      if(isymphony_user_get($extension) === null) { 
    784         isymphony_user_add($extension, $addExtension, $addProfile, $password, $name, $peer); 
     1004        isymphony_user_add($extension, $addExtension, $addProfile, $password, $name, $peer, $cell_phone, $email, $autoAnswer, $jabberHost, $jabberDomain, $jabberResource, $jabberPort, $jabberUserName, $jabberPassword); 
    7851005      } else { 
    786         isymphony_user_update($extension, $addExtension, $addProfile, $password, $name, $peer); 
     1006        isymphony_user_update($extension, $addExtension, $addProfile, $password, $name, $peer, $cell_phone, $email, $autoAnswer, $jabberHost, $jabberDomain, $jabberResource, $jabberPort, $jabberUserName, $jabberPassword); 
    7871007      } 
    7881008    } 
     
    9021122} 
    9031123 
     1124//Update checks-------------------------------------------------------------------------------------------------------------------------------------- 
     1125function isymphony_location_update_check($serverRevision, $databaseValues, $maskedAutoReloadFlag, $object) { 
     1126   
     1127  //Checks for revision 1489 and up 
     1128  if($serverRevision >= 1489) { 
     1129    return (($object->asterisk_host != "localhost") ||  
     1130        ($object->asterisk_port != "5038") ||  
     1131        ($object->asterisk_login != "isymphony") ||  
     1132        ($object->asterisk_password != "ismanager*con") ||  
     1133        ($object->originate_timeout != $databaseValues["originate_timeout"]) || 
     1134        ($object->reload_on_dial_plan_reload != $maskedAutoReloadFlag) || 
     1135        ($object->jabber_host != $databaseValues["jabber_host"]) || 
     1136        ($object->jabber_domain != $databaseValues["jabber_domain"]) || 
     1137        ($object->jabber_resource != $databaseValues["jabber_resource"]) || 
     1138        ($object->jabber_port != $databaseValues["jabber_port"]) || 
     1139        ($object->device_user_mode != "true")); 
     1140         
     1141  //Checks for 1105-1488       
     1142  } else if($serverRevision > 1104) { 
     1143    return (($object->asterisk_host != "localhost") ||  
     1144        ($object->asterisk_port != "5038") ||  
     1145        ($object->asterisk_login != "isymphony") ||  
     1146        ($object->asterisk_password != "ismanager*con") ||  
     1147        ($object->originate_timeout != $databaseValues["originate_timeout"]) || 
     1148        ($object->jabber_host != $databaseValues["jabber_host"]) || 
     1149        ($object->jabber_port != $databaseValues["jabber_port"]) || 
     1150        ($object->device_user_mode != "true")); 
     1151   
     1152  //Checks for rev 1104 and below 
     1153  } else { 
     1154     
     1155    return  (($object->asterisk_host != "localhost") ||  
     1156        ($object->asterisk_port != "5038") ||  
     1157        ($object->asterisk_login != "isymphony") ||  
     1158        ($object->asterisk_password != "ismanager*con") ||  
     1159        ($object->originate_timeout != $databaseValues["originate_timeout"]) || 
     1160        ($object->jabber_host != $databaseValues["jabber_host"]) || 
     1161        ($object->jabber_port != $databaseValues["jabber_port"])); 
     1162  }  
     1163} 
     1164 
     1165function isymphony_tenant_update_check($serverRevision, $databaseValues, $maskedPagedStatusEnabledFlag, $object) { 
     1166   
     1167  //Checks for 1105 and above 
     1168  if($serverRevision > 1104) { 
     1169    return (($object->originating_context != "from-internal") ||  
     1170        ($object->redirecting_context != "from-internal") || 
     1171        ($object->page_status_enabled != $maskedPagedStatusEnabledFlag) || 
     1172        ($object->page_context != "ext-paging")); 
     1173     
     1174  //Checks for 1104 and below  
     1175  } else { 
     1176    return ($object->originating_context != "from-internal") || ($object->redirecting_context != "from-internal"); 
     1177  }                            
     1178} 
     1179 
     1180function isymphony_extension_update_check($serverRevision, $databaseValues, $maskedAutoAnswerFlag, $object) { 
     1181   
     1182  //Checks for 1493 and above 
     1183  if($serverRevision >= 1493) { 
     1184    return (($object->cell_phone != $databaseValues["cell_phone"]) ||  
     1185        ($object->email != $databaseValues["email"]) ||  
     1186        ($object->name != $databaseValues["display_name"]) ||  
     1187        ($object->voice_mail != $databaseValues["user_id"]) ||  
     1188        ($object->peer != $databaseValues["peer"]) || 
     1189        ($object->auto_answer != $maskedAutoAnswerFlag)); 
     1190         
     1191  //Checks for 1492 and below  
     1192  } else { 
     1193    return (($object->cell_phone != $databaseValues["cell_phone"]) ||  
     1194        ($object->email != $databaseValues["email"]) ||  
     1195        ($object->name != $databaseValues["display_name"]) ||  
     1196        ($object->voice_mail != $databaseValues["user_id"]) ||  
     1197        ($object->peer != $databaseValues["peer"])); 
     1198  } 
     1199} 
     1200 
     1201function isymphony_profile_update_check($serverRevision, $databaseValues, $maskedJabberPort, $object) { 
     1202   
     1203  //Checks for revision 1489 and up 
     1204  if($serverRevision >= 1489) { 
     1205    return (($object->password != $databaseValues["password"]) ||          
     1206          ($object->jabber_host != $databaseValues["jabber_host"]) ||  
     1207        ($object->jabber_domain != $databaseValues["jabber_domain"]) ||      
     1208        ($object->jabber_resource != $databaseValues["jabber_resource"]) ||   
     1209        ($maskedJabberPort != $databaseValues["jabber_port"]) ||  
     1210        ($object->jabber_user_name != $databaseValues["jabber_user_name"]) ||  
     1211        ($object->jabber_password != $databaseValues["jabber_password"])); 
     1212         
     1213  //Checks for revision 1488 and below   
     1214  } else { 
     1215    return (($object->password != $databaseValues["password"]) ||          
     1216        ($object->jabber_user_name != $databaseValues["jabber_user_name"]) ||  
     1217        ($object->jabber_password != $databaseValues["jabber_password"]));     
     1218  } 
     1219} 
     1220 
    9041221//Helper functions----------------------------------------------------------------------------------------------------------------------------------- 
    9051222function isymphony_write_to_file($file, $content) { 
  • contributed_modules/modules/isymphony/install.php

    r6771 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : August 15, 2008 
    6  *Last Updated : September 17, 2008 
    7  *History      : 0.2 
     6 *Last Updated : May 26, 2009 
     7 *History      : 0.3 
    88 *Purpose      : Create and populate isymphony tables 
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
     
    1111 
    1212global $db; 
     13 
     14//Create location table 
     15$query = "  CREATE TABLE IF NOT EXISTS  
     16      isymphony_location( admin_user_name VARCHAR(100), 
     17                admin_password VARCHAR(100), 
     18                originate_timeout INTEGER(10), 
     19                auto_reload INTEGER(1), 
     20                page_status_enabled INTEGER(1), 
     21                jabber_host VARCHAR(100), 
     22                jabber_domain VARCHAR(100), 
     23                jabber_resource VARCHAR(100), 
     24                jabber_port INTEGER(10))";  
     25                 
     26echo "Creating \"isymphony_location\" Table....<br>";                
     27$results = $db->query($query); 
     28if(DB::IsError($results) && ($results->getCode() != DB_ERROR_ALREADY_EXISTS)) { 
     29  echo "ERROR: could not create table.<br>"; 
     30} else { 
     31   
     32  //Check to see if table already contains location information if not insert row of default values 
     33  $result = $db->query("SELECT * FROM isymphony_location"); 
     34  if($result->numRows() == 0) { 
     35     
     36    //Populate with default values 
     37    echo "Populating table.....<br>"; 
     38    $prepStatement = $db->prepare("INSERT INTO isymphony_location (admin_user_name, admin_password, originate_timeout, auto_reload, page_status_enabled, jabber_port, jabber_resource) VALUES (?, ?, ?, ?, ?, ?, ?)"); 
     39    $values = array("admin", "secret", "30000", 1, 1, 5222, "iSymphony"); 
     40    $db->execute($prepStatement, $values); 
     41  } 
     42}                
     43echo "Done<br>";                 
    1344 
    1445//Create users table 
     
    2051              password VARCHAR(100),  
    2152              display_name VARCHAR(100),  
    22               peer VARCHAR(100))"; 
     53              peer VARCHAR(100), 
     54              email VARCHAR(100), 
     55              cell_phone VARCHAR(100), 
     56              auto_answer INTEGER(1), 
     57              jabber_host VARCHAR(100), 
     58              jabber_domain VARCHAR(100), 
     59              jabber_resource VARCHAR(100), 
     60              jabber_port INTEGER(10), 
     61              jabber_user_name VARCHAR(100), 
     62              jabber_password VARCHAR(100))"; 
    2363 
    2464echo "Creating \"isymphony_users\" Table....<br>"; 
     
    2767  echo "ERROR: could not create table.<br>"; 
    2868} else { 
     69 
     70 
     71  //If updating check if proper column entries exist. If not create them. Used for module upgrade purposes. 
     72  $iSymphonyUserTableStringColumns = array("email", "cell_phone", "jabber_host", "jabber_domain", "jabber_resource", "jabber_user_name", "jabber_password"); 
     73  $iSymphonyUserTableIntegerColumns = array("jabber_port"); 
     74  $iSymphonyUserTableBooleanColumns= array("auto_answer"); 
     75 
     76  foreach($iSymphonyUserTableStringColumns as $stringColumn) { 
     77    $sql = "SELECT $stringColumn FROM isymphony_users"; 
     78    $check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     79    if(DB::IsError($check)) { 
     80        $sql = "ALTER TABLE isymphony_users ADD $stringColumn VARCHAR(200);"; 
     81        $result = $db->query($sql); 
     82        if(DB::IsError($result)) { die_freepbx($result->getDebugInfo()); } 
     83    } 
     84  } 
     85   
     86  foreach($iSymphonyUserTableIntegerColumns as $integerColumn) { 
     87    $sql = "SELECT $integerColumn FROM isymphony_users"; 
     88    $check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     89    if(DB::IsError($check)) { 
     90        $sql = "ALTER TABLE isymphony_users ADD $integerColumn INTEGER(10);"; 
     91        $result = $db->query($sql); 
     92        if(DB::IsError($result)) { die_freepbx($result->getDebugInfo()); } 
     93    } 
     94  } 
     95   
     96  foreach($iSymphonyUserTableBooleanColumns as $booleanColumn) { 
     97    $sql = "SELECT $booleanColumn FROM isymphony_users"; 
     98    $check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     99    if(DB::IsError($check)) { 
     100        $sql = "ALTER TABLE isymphony_users ADD $booleanColumn INTEGER(1);"; 
     101        $result = $db->query($sql); 
     102        if(DB::IsError($result)) { die_freepbx($result->getDebugInfo()); } 
     103    } 
     104  } 
    29105 
    30106  //Add users to table 
     
    39115        $extensionPeer = ($freePBXDeviceInfo['dial'] != "") ? $freePBXDeviceInfo['dial'] : "SIP/$userId"; 
    40116         
    41         $prepStatement = $db->prepare("INSERT INTO isymphony_users (user_id, add_extension, add_profile, password, display_name, peer) VALUES (?, ?, ?, ?, ?, ?)"); 
    42         $values = array($userId, 1, 1, "secret", $extensionDisplayName, $extensionPeer); 
     117        $prepStatement = $db->prepare("INSERT INTO isymphony_users (user_id, add_extension, add_profile, password, display_name, peer, auto_answer, jabber_resource) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); 
     118        $values = array($userId, 1, 1, "secret", $extensionDisplayName, $extensionPeer, 0, "iSymphony"); 
    43119        $db->execute($prepStatement, $values); 
    44120      } 
  • contributed_modules/modules/isymphony/isymphony-php-library/isymphony.php

    r6438 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : June 15, 2008 
    6  *Last Updated : August 22, 2008 
    7  *History      : 0.2  
     6 *Last Updated : May 27, 2009 
     7 *History      : 0.4  
    88 *Purpose      : Contains all functions used to interact with the iSymphony configuration. 
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
     
    2828$ISERROR = ""; 
    2929 
     30//Tracker variables for improved running time 
     31$IN_LOCATION = false; 
     32$IN_TENNAT = false; 
     33 
    3034//Connection methods------------------------------------------------------------------------------- 
    3135/*############################################### 
     
    4347  if(($SOCKET = socket_create(AF_INET, SOCK_STREAM, 0)) && (socket_connect($SOCKET, $HOST, $PORT))) {    
    4448     
    45     //Check version to modify property arrays if necessary 
    46     //Modify for 2.1     
    47     if((($versionResult = getiSymphonyServerVersion()) !== false) && (strstr($versionResult, "2.1") !== false)) { 
    48       isymphony_modify_property_arrays_2_1(); 
     49    //Check version and revision number to modify property arrays if necessary 
     50    if((($versionResult = getiSymphonyServerVersion()) !== false) && (($revisionResult = getiSymphonyServerRevision()) !== false)) { 
     51       
     52      //Modify for 2.1 
     53      if((strstr($versionResult, "2.1") !== false)) { 
     54         
     55        //Modify for rev 1493 and above 
     56        if($revisionResult >= 1493) { 
     57          isymphony_modify_property_arrays_2_1_1493(); 
     58         
     59        //Modify for rev 1489 through 1493 
     60        } else if($revisionResult >= 1489) { 
     61          isymphony_modify_property_arrays_2_1_1489(); 
     62           
     63        //Modify for post rev 1489   
     64        } else { 
     65          isymphony_modify_property_arrays_2_1(); 
     66        } 
     67      } 
    4968    } 
    50  
    5169    return true; 
    5270  } else { 
     
    6381function iSymphonyDisconnect() { 
    6482   
    65   global $SOCKET; 
     83  global $SOCKET, $IN_LOCATION, $IN_TENNAT; 
     84   
     85  $IN_LOCATION = false; 
     86  $IN_TENNAT = false; 
    6687   
    6788  if(($SOCKET !== null) && ($SOCKET)) { 
     
    19341955 
    19351956/*############################################### 
     1957 * Gets the server revision 
     1958 * Takes: nothing 
     1959 * Returns: server revision if successful or false if error occurred   
     1960 */  
     1961function getiSymphonyServerRevision() { 
     1962   
     1963  if(($serverVersion = getiSymphonyServerVersion()) === false) { 
     1964    return false; 
     1965  } 
     1966   
     1967  //Parse our server revision number from server version 
     1968  $serverRevison = ereg_replace("[^0-9]+", '', substr($serverVersion, strpos($serverVersion, "rev"))); 
     1969   
     1970  //If revision number is not numeric something went wrong in the parsing. If so return false. 
     1971  if(!is_numeric($serverRevison)) { 
     1972    $ISERROR = "Error: Parsed server version was non numeric."; 
     1973    return false; 
     1974  } 
     1975   
     1976  return $serverRevison; 
     1977} 
     1978 
     1979/*############################################### 
    19361980 * Shutdown the iSymphony server 
    19371981 * Takes: nothing 
  • contributed_modules/modules/isymphony/isymphony-php-library/library/classes.php

    r6438 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : June 15, 2008 
    6  *Last Updated : August 22, 2008 
    7  *History      : 0.4 
     6 *Last Updated : May 27, 2009 
     7 *History      : 0.5 
    88 *Purpose      : Contains declarations of all property classes.  
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
     
    6363 *    asterisk_password: Asterisk manager password(STRING) 
    6464 *    originate_timeout: Amount of time an originator will be rung on an origination event in milliseconds(INTEGER) 
     65 *    reload_on_dial_plan_reload: Flag used to reload this location when the dial plan reloads(BOOLEAN[true or false]) 
    6566 *    jabber_host: Jabber host name(STRING) 
     67 *    jabber_domain: Jabber domain name(STRING) 
     68 *    jabber_resource: Jabber resource name(STRING) 
    6669 *    jabber_port: Jabber port(INTEGER) 
    6770 *    device_user_mode: (BOOLEAN[true or false]) 
     
    8790  var $asterisk_login = ""; 
    8891  var $asterisk_password = ""; 
    89   var $originate_timeout = ""; 
     92  var $reload_on_dial_plan_reload = ""; 
    9093  var $jabber_host = ""; 
     94  var $jabber_domain = ""; 
     95  var $jabber_resource = ""; 
    9196  var $jabber_port = ""; 
    9297  var $device_user_mode = ""; 
     
    167172 *    record_file_extension: File extensions used for recorded calls(STRING) 
    168173 *    mix_mode: Flag used to mix incoming and outgoing recorded call channels(BOOLEAN[true or false]) 
     174 *    page_status_enabled: Flag used to enable page status(BOOLEAN[true or false]) 
     175 *    page_context: Page context used to suppress paging status(STRING) 
    169176 * 
    170177 * Methods: 
     
    192199  var $record_file_extension = ""; 
    193200  var $mix_mode = ""; 
     201  var $page_status_enabled = ""; 
     202  var $page_context = ""; 
    194203   
    195204  //Methods 
     
    268277  *   voice_mail: Voice mail box number of this extension(STRING) 
    269278  *   agent: Agent number associated with this extension(STRING) 
     279  *   auto_answer: Flag used to indicate if origination call back should be auto answered. 
    270280  * 
    271281  * Methods: 
     
    293303  var $voice_mail = ""; 
    294304  var $agent = ""; 
     305  var $auto_answer = ""; 
    295306   
    296307  //Methods 
     
    326337     
    327338    global $extensionPropertyArray; 
    328      
     339          
    329340    //Move to tenant mode 
    330341    if(!moveToTenant($location, $tenant)) { 
     
    364375  *   name: Username for profile(STRING) 
    365376  *   password: Password for profile(STRING) 
     377  *   jabber_host: Jabber host name(STRING) 
     378  *   jabber_domain: Jabber domain name(STRING) 
     379  *   jabber_resource: Jabber resource name(STRING) 
     380  *   jabber_port: Jabber port(INTEGER) 
    366381  *   jabber_user_name: Jabber username(STRING) 
    367382  *   jabber_password: Jabber password(STRING) 
     
    386401  var $name = ""; 
    387402  var $password = ""; 
     403  var $jabber_host = ""; 
     404  var $jabber_domain = ""; 
     405  var $jabber_resource = ""; 
     406  var $jabber_port = "";   
    388407  var $jabber_user_name = ""; 
    389408  var $jabber_password = ""; 
  • contributed_modules/modules/isymphony/isymphony-php-library/library/helper.php

    r5878 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : June 15, 2008 
    6  *Last Updated : June 18, 2008 
    7  *History      : 0.1 Beta   
     6 *Last Updated : January 27, 2009 
     7 *History      : 0.2 Beta   
    88 *Purpose      : Contains utility functions used by the library.  
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
     
    154154} 
    155155 
     156/*############################################### 
     157 * Removes an element from an array by value 
     158 * Takes: an array and the element to be removed 
     159 * Returns: and new re-orderd array without the removed element 
     160 */ 
     161function remove_element($arr, $val){ 
     162  foreach ($arr as $key => $value){ 
     163    if ($arr[$key] == $val){ 
     164      unset($arr[$key]); 
     165    } 
     166  } 
     167  return $arr = array_values($arr); 
     168} 
    156169 
    157170?> 
  • contributed_modules/modules/isymphony/isymphony-php-library/library/navigation.php

    r5878 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : June 15, 2008 
    6  *Last Updated : June 18, 2008 
    7  *History      : 0.1 Beta   
     6 *Last Updated : May 7, 2009 
     7 *History      : 0.2 Beta   
    88 *Purpose      : Contains functions used to navigate through different modes of the CLI.  
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
    1010 */ 
     11 
    1112 
    1213/*############################################### 
     
    2728 */ 
    2829function moveToLocation($location) { 
    29    
    30   //Move to server 
    31   if(!moveToServer()) { 
    32     return false; 
    33   }  
     30  global $IN_LOCATION;   
    3431     
    3532  //Move to location 
    36   return checkAndSetErrorNone("location $location"); 
     33  $moved = checkAndSetErrorNone("location $location"); 
     34  $IN_LOCATION = $moved; 
     35  return $moved; 
    3736} 
    3837 
     
    4342 */ 
    4443function moveToTenant($location, $tenant) { 
     44  global $IN_LOCATION, $IN_TENANT; 
    4545   
    4646  //Move to location 
    47   if(!moveToLocation($location)) { 
    48     return false; 
    49   } 
    50    
    51   //Move to tenant 
    52   return checkAndSetErrorNone("tenant $tenant"); 
     47  if(!$IN_LOCATION) { 
     48    if(!moveToLocation($location)) { 
     49      return false; 
     50    } 
     51  } 
     52   
     53  //Move to tenant 
     54  $moved = checkAndSetErrorNone("tenant $tenant"); 
     55  $IN_TENANT = $moved; 
     56  return $moved; 
    5357} 
    5458 
     
    5963 */ 
    6064function moveToExtension($location, $tenant, $extension) { 
    61    
    62   //Move to tenant 
    63   if(!moveToTenant($location, $tenant)) { 
    64     return false; 
     65  global $IN_TENANT; 
     66   
     67  //Move to tenant 
     68  if(!$IN_TENANT) { 
     69    if(!moveToTenant($location, $tenant)) { 
     70      return false; 
     71    } 
    6572  } 
    6673   
     
    7582 */ 
    7683function moveToProfile($location, $tenant, $profile) { 
    77    
    78   //Move to tenant 
    79   if(!moveToTenant($location, $tenant)) { 
    80     return false; 
     84  global $IN_TENANT; 
     85   
     86  //Move to tenant 
     87  if(!$IN_TENANT) { 
     88    if(!moveToTenant($location, $tenant)) { 
     89      return false; 
     90    } 
    8191  } 
    8292   
     
    91101 */ 
    92102function moveToQueue($location, $tenant, $queue) { 
    93    
    94   //Move to tenant 
    95   if(!moveToTenant($location, $tenant)) { 
    96     return false; 
     103  global $IN_TENANT; 
     104   
     105  //Move to tenant 
     106  if(!$IN_TENANT) { 
     107    if(!moveToTenant($location, $tenant)) { 
     108      return false; 
     109    } 
    97110  } 
    98111   
     
    107120 */ 
    108121function moveToConferenceRoom($location, $tenant, $room) { 
    109    
    110   //Move to tenant 
    111   if(!moveToTenant($location, $tenant)) { 
    112     return false; 
     122  global $IN_TENANT; 
     123   
     124  //Move to tenant 
     125  if(!$IN_TENANT) { 
     126    if(!moveToTenant($location, $tenant)) { 
     127      return false; 
     128    } 
    113129  } 
    114130   
  • contributed_modules/modules/isymphony/isymphony-php-library/library/property_arrays.php

    r6438 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : June 15, 2008 
    6  *Last Updated : August 22, 2008 
    7  *History      : 0.3  
     6 *Last Updated : May 27, 2009 
     7 *History      : 0.5 
    88 *Purpose      : Contains arrays witch describe all configuration object property names along with functions to modify 
    99 *         the arrays for specific versions of the server.  
     
    2626$conferenceRoomPermissionPropertyArray = array("steal_call","transfer_to","originate_to","mute_users","kick_users"); 
    2727 
     28//Property array modification functions-------------------------------------------------------------------------------------------------------------- 
     29function isymphony_modify_property_arrays_2_1() { 
     30  global $locationPropertyArray, $extensionPropertyArray, $tenantPropertyArray; 
     31   
     32  //New modifications 
     33  array_push($locationPropertyArray, "device_user_mode"); 
     34   
     35  array_push($tenantPropertyArray, "page_status_enabled"); 
     36  array_push($tenantPropertyArray, "page_context"); 
     37   
     38  $extensionPropertyArray = remove_element($extensionPropertyArray, "agent"); 
     39} 
    2840 
    29 function isymphony_modify_property_arrays_2_1() { 
    30   global $locationPropertyArray; 
    31   array_push($locationPropertyArray, "device_user_mode"); 
     41function isymphony_modify_property_arrays_2_1_1489() { 
     42  global $locationPropertyArray, $extensionPropertyArray, $tenantPropertyArray, $profilePropertyArray; 
     43   
     44  //Apply 2.1 modifications 
     45  isymphony_modify_property_arrays_2_1(); 
     46   
     47  //New modifications 
     48  array_push($locationPropertyArray, "reload_on_dial_plan_reload"); 
     49  array_push($locationPropertyArray, "jabber_domain"); 
     50  array_push($locationPropertyArray, "jabber_resource"); 
     51   
     52  array_push($profilePropertyArray, "jabber_host"); 
     53  array_push($profilePropertyArray, "jabber_domain"); 
     54  array_push($profilePropertyArray, "jabber_resource"); 
     55  array_push($profilePropertyArray, "jabber_port"); 
     56
     57 
     58function isymphony_modify_property_arrays_2_1_1493() { 
     59  global $locationPropertyArray, $extensionPropertyArray, $tenantPropertyArray, $profilePropertyArray; 
     60   
     61  //Apply 2.1 1489 modifications 
     62  isymphony_modify_property_arrays_2_1_1489(); 
     63   
     64  //New modifications 
     65  array_push($extensionPropertyArray, "auto_answer"); 
    3266} 
    3367?> 
  • contributed_modules/modules/isymphony/module.xml

    r7500 r7772  
    22  <rawname>isymphony</rawname> 
    33  <name>iSymphony</name> 
    4   <version>0.8</version> 
     4  <version>1.0.0</version> 
    55  <type>setup</type> 
    6   <category>Third Party Addon</category> 
     6  <category>Modules</category> 
    77  <description> 
    88    This module automatically configures iSymphony to reflect the FreePBX configuration.  
     
    1414    <version>>=2.3.0</version> 
    1515  </depends> 
    16   <location>contributed_modules/release/isymphony-0.8.tgz</location> 
    17   <md5sum>d72fee48b01c0912dae805aad1bd2215</md5sum> 
     16  <location>junk</location> 
     17  <md5sum>junk</md5sum> 
    1818  <changelog> 
    19     0.8 Fixed bug in which some FreePBX versions would display a blank page during an action process due to a early modified header caused by blank lines in the core function file. 
    20     0.7 Added back end database to handle state for extensions/users, profiles queues and conference rooms. 
    21       Added checkboxes to relevant pages to specify which extensions/users, profiles, queues, and conference rooms should be displayed in iSymphony. 
    22       Added password field on the extension/user page to specify profile passwords. 
    23       Added iSymphony sever process state and version display on the FreePBX iSymphony page. 
    24       Added the ability to reload the iSymphony server from the FreePBX iSymphony page. 
    25       Added license information display on the FreePBX iSymphony page. 
    26       Added the ability to activate a license via the FreePBX iSymphony page. 
    27       Added module debug options to the FreePBX iSymphony page. 
    28       Added support for Device User Mode configuration while using iSymphony 2.1. 
    29       Modified description and setup instructions on the FreePBX iSymphony page.   
    30     0.6 Added support for PHP4 in library. 
    31     0.5 Modified core module code to be more efficient. 
    32       Removed disconnect call from post reload script. 
    33     0.4 Added bash script wrapper for post reload script(See new config instructions under the iSymphony menu item). 
    34     0.3 Added checks for dependent module API functions(manager, queue, conferences) 
    35     0.2 Added reload script to reload iSymphony config after dial plan reload. 
    36         Added menu item and info page. 
    37     0.1 First Release 
     19        1.0.0 Added backward compatibility support for 2.0 rev 1104. 
     20              Fixed bug in which a flawed context would prevent orphaned parked calls from ringing back to the parking extension if parked via the panel. 
     21              Made debug menu always visible. 
     22              Added server debug menu. 
     23              Debug logs now show on main module page. 
     24              Multiple debug options can now be set at once. 
     25              Added database column checks in installation script to handle module upgrades. 
     26              Added default FreePBX page context to configuration. 
     27              Added admin username and password fields to the main module page. 
     28              Added originate timeout field to main module page. 
     29              Added auto reload and enable page status checkboxes to main module page. 
     30              Added global Jabber connection configuration fields on main module page. 
     31              Added email and cell phone fields to extension page. 
     32              Added Jabber connection configuration override fields to extension page. 
     33              Added Jabber username and password fields to extension page. 
     34              Added auto answer checkbox to extension page. 
     35              Modified database debug tables to account for new tables and columns. 
     36        0.9.2 Added running time improvements. 
     37              Module now always puts server in FreePBX Device User Mode for dynamic queue login consistency. 
     38        0.9.1 Fixed bug where if an extension was removed from a profile then it would not be added back on reload of configuration. 
     39        0.9 Added modifications to support the new 2.1 custom contexts. 
     40            Added check for agent extension property as it no longer exists in 2.1. 
     41        0.8 Fixed bug in which some FreePBX versions would display a blank page during an action process due to a early modified header caused by blank lines in the core function file. 
     42        0.7 Added back end database to handle state for extensions/users, profiles queues and conference rooms. 
     43            Added checkboxes to relevant pages to specify which extensions/users, profiles, queues, and conference rooms should be displayed in iSymphony. 
     44            Added password field on the extension/user page to specify profile passwords. 
     45            Added iSymphony sever process state and version display on the FreePBX iSymphony page. 
     46            Added the ability to reload the iSymphony server from the FreePBX iSymphony page. 
     47            Added license information display on the FreePBX iSymphony page. 
     48            Added the ability to activate a license via the FreePBX iSymphony page. 
     49            Added module debug options to the FreePBX iSymphony page. 
     50            Added support for Device User Mode configuration while using iSymphony 2.1. 
     51            Modified description and setup instructions on the FreePBX iSymphony page.   
     52        0.6 Added support for PHP4 in library. 
     53        0.5 Modified core module code to be more efficient. 
     54            Removed disconnect call from post reload script. 
     55        0.4 Added bash script wrapper for post reload script(See new config instructions under the iSymphony menu item). 
     56        0.3 Added checks for dependent module API functions(manager, queue, conferences) 
     57        0.2 Added reload script to reload iSymphony config after dial plan reload. 
     58            Added menu item and info page. 
     59        0.1 First Release 
    3860  </changelog> 
    3961  <info>http://www.i9technologies.com/isymphony</info> 
  • contributed_modules/modules/isymphony/page.isymphony.php

    r6438 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : July 2, 2008 
    6  *Last Updated : August 22, 2008 
    7  *History      : 0.5  
     6 *Last Updated : May 27, 2009 
     7 *History      : 0.6  
    88 *Purpose      : Information page for iSymphony module 
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
    1010 */ 
    1111 
    12  
    13 //Turn on debugging if it is requested 
    14 $debugUrlAddition = ""; 
    15 $debugMenuAddition = ""; 
    16 if(($debug = isset($_REQUEST["debug"])) === true) { 
    17 $debugUrlAddition = "&debug=yes"; 
    18 $debugMenuAddition = "  <tr><td colspan=\"2\"><h5>Module Debug<hr></h5></td></tr> 
    19             <tr><td><a href=\"/admin/modules/isymphony/debug.txt\" target=\"_blank\">View Debug Log</a></td></tr> 
    20             <tr><td><a href=\"/admin/modules/isymphony/error.txt\" target=\"_blank\">View Error Log</a></td></tr> 
    21             <tr><td><a href=\"config.php?type=setup&display=isymphony&showdb=yes$debugUrlAddition\">View Database</a></td></tr>";  
    22 } 
    2312   
    2413//Check to see if the server is running 
     
    6049} 
    6150 
     51//Check for a location settings update action 
     52if(isset($_REQUEST["isymphony_update_location_settings"])) { 
     53 
     54  //Update data base 
     55  isymphony_location_update(  trim($_REQUEST["isymphony_admin_user_name"]),  
     56                trim($_REQUEST["isymphony_admin_password"]),  
     57                trim($_REQUEST["isymphony_originate_timeout"]),  
     58                isset($_REQUEST["isymphony_auto_reload"]) ? "1" : "0",  
     59                isset($_REQUEST["isymphony_page_status_enabled"]) ? "1" : "0",   
     60                trim($_REQUEST["isymphony_jabber_host"]),  
     61                trim($_REQUEST["isymphony_jabber_domain"]), 
     62                trim($_REQUEST["isymphony_jabber_resource"]),  
     63                trim($_REQUEST["isymphony_jabber_port"])); 
     64  //Flag FreePBX for reload              
     65  needreload();              
     66} 
     67 
     68//Grab location information 
     69$locationInformation = isymphony_location_get(); 
     70 
     71//Debug url additions 
     72$debugUrlAdditions = ""; 
     73 
    6274//Check if a request to show the database was made 
    6375$databaseDisplay = ""; 
    64 if($debug && isset($_REQUEST["showdb"])) { 
     76if(isset($_REQUEST["showmoduledb"])) { 
     77   
     78  $debugUrlAdditions .= "&showmoduledb=yes"; 
     79   
     80  //Build location information table 
     81  $databaseDisplay .= " <table> 
     82                <tr> 
     83                  <tr><td colspan = \"9\"><h5>Location</h5></td></tr> 
     84                </tr> 
     85                <tr> 
     86                  <td>Admin User Name&nbsp&nbsp&nbsp</td> 
     87                  <td>Admin Password&nbsp&nbsp&nbsp</td> 
     88                  <td>Originate Timeout&nbsp&nbsp&nbsp</td> 
     89                  <td>Auto Reload&nbsp&nbsp&nbsp</td> 
     90                  <td>Page Status Enabled&nbsp&nbsp&nbsp</td> 
     91                  <td>Jabber Host&nbsp&nbsp&nbsp</td> 
     92                  <td>Jabber Domain&nbsp&nbsp&nbsp</td> 
     93                  <td>Jabber Resource&nbsp&nbsp&nbsp</td> 
     94                  <td>Jabber Port&nbsp&nbsp&nbsp</td> 
     95                </tr> 
     96                <tr> 
     97                  <td colspan = \"9\"><hr></td> 
     98                </tr> 
     99                <tr> 
     100                  <td>{$locationInformation['admin_user_name']}</td> 
     101                  <td>{$locationInformation['admin_password']}</td> 
     102                  <td>{$locationInformation['originate_timeout']}</td> 
     103                  <td>{$locationInformation['auto_reload']}</td> 
     104                  <td>{$locationInformation['page_status_enabled']}</td> 
     105                  <td>{$locationInformation['jabber_host']}</td> 
     106                  <td>{$locationInformation['jabber_domain']}</td> 
     107                  <td>{$locationInformation['jabber_resource']}</td> 
     108                  <td>{$locationInformation['jabber_port']}</td> 
     109                </tr> 
     110              </table>"; 
    65111   
    66112  //Build extensions table 
    67113  $databaseDisplay .= " <table> 
    68114                <tr> 
    69                   <tr><td colspan = \"6\"><h5>Extensions</h5></td></tr> 
     115                  <tr><td colspan = \"15\"><h5>Extensions</h5></td></tr> 
    70116                </tr> 
    71117                <tr> 
     
    76122                  <td>Display Name&nbsp&nbsp&nbsp</td> 
    77123                  <td>Peer&nbsp&nbsp&nbsp</td> 
    78                 <tr> 
    79                 </tr> 
    80                   <td colspan = \"6\"><hr></td> 
     124                  <td>Email&nbsp&nbsp&nbsp</td> 
     125                  <td>Cell Phone&nbsp&nbsp&nbsp</td> 
     126                  <td>Auto Answer&nbsp&nbsp&nbsp</td> 
     127                  <td>Jabber Host&nbsp&nbsp&nbsp</td> 
     128                  <td>Jabber Domain&nbsp&nbsp&nbsp</td> 
     129                  <td>Jabber Resource&nbsp&nbsp&nbsp</td> 
     130                  <td>Jabber Port&nbsp&nbsp&nbsp</td> 
     131                  <td>Jabber User Name&nbsp&nbsp&nbsp</td> 
     132                  <td>Jabber Password&nbsp&nbsp&nbsp</td> 
     133                <tr> 
     134                </tr> 
     135                  <td colspan = \"15\"><hr></td> 
    81136                </tr>"; 
    82137 
     
    89144                  <td>{$user['display_name']}</td> 
    90145                  <td>{$user['peer']}</td> 
     146                  <td>{$user['email']}</td> 
     147                  <td>{$user['cell_phone']}</td> 
     148                  <td>{$user['auto_answer']}</td> 
     149                  <td>{$user['jabber_host']}</td> 
     150                  <td>{$user['jabber_domain']}</td> 
     151                  <td>{$user['jabber_resource']}</td> 
     152                  <td>{$user['jabber_port']}</td> 
     153                  <td>{$user['jabber_user_name']}</td> 
     154                  <td>{$user['jabber_password']}</td> 
    91155                </tr>"; 
    92156  } 
     
    143207} 
    144208 
     209//Check if a request to show module debug log was made 
     210$debugLogDisplay = ""; 
     211if(isset($_REQUEST["showmoduledebuglog"])) { 
     212   
     213  $debugUrlAdditions .= "&showmoduledebuglog=yes"; 
     214   
     215  $debugLogDisplay .= " <tr><td colspan=\"2\"><h5>Module Debug Log<hr></h5></td></tr> 
     216              <tr><td colspan=\"2\"><p>"; 
     217   
     218  //Open debug log 
     219  if(($debugLogFile = fopen("/var/www/html/admin/modules/isymphony/debug.txt", 'r')) !== false) { 
     220    while (!feof($debugLogFile)) { 
     221          $line = fgets($debugLogFile, 4096); 
     222          $debugLogDisplay .= htmlspecialchars($line) . "<br>"; 
     223      } 
     224      fclose($debugLogFile); 
     225  } 
     226 
     227  $debugLogDisplay .= "</p></td></tr>"; 
     228} 
     229 
     230//Check if a request to show module error log was made 
     231if(isset($_REQUEST["showmoduleerrorlog"])) { 
     232   
     233  $debugUrlAdditions .= "&showmoduleerrorlog=yes"; 
     234   
     235  $debugLogDisplay .= " <tr><td colspan=\"2\"><h5>Module Error Log<hr></h5></td></tr> 
     236              <tr><td colspan=\"2\"><p>"; 
     237 
     238  //Open error log 
     239  if(($errorLogFile = fopen("/var/www/html/admin/modules/isymphony/error.txt", 'r')) !== false) { 
     240    while (!feof($errorLogFile)) { 
     241          $line = fgets($errorLogFile, 4096); 
     242          $debugLogDisplay .= htmlspecialchars($line) . "<br>"; 
     243      } 
     244      fclose($errorLogFile); 
     245  } 
     246   
     247  $debugLogDisplay .= "</p></td></tr>"; 
     248} 
     249 
     250//Check if a request to show server error log was made 
     251if(isset($_REQUEST["showservererrorlog"])) { 
     252   
     253  $debugUrlAdditions .= "&showservererrorlog=yes"; 
     254   
     255  $debugLogDisplay .= " <tr><td colspan=\"2\"><h5>Server Error Log<hr></h5></td></tr> 
     256              <tr><td colspan=\"2\"><p>"; 
     257 
     258  //Open error log 
     259  if(($errorLogFile = fopen("/opt/isymphony/server/logs/error.txt", 'r')) !== false) { 
     260    while (!feof($errorLogFile)) { 
     261          $line = fgets($errorLogFile, 4096); 
     262          $debugLogDisplay .= htmlspecialchars($line) . "<br>"; 
     263      } 
     264      fclose($errorLogFile); 
     265  } 
     266   
     267  $debugLogDisplay .= "</p></td></tr>"; 
     268} 
     269 
     270//Check if a request to show server core log was made 
     271if(isset($_REQUEST["showservercorelog"])) { 
     272   
     273  $debugUrlAdditions .= "&showservercorelog=yes"; 
     274   
     275  $debugLogDisplay .= " <tr><td colspan=\"2\"><h5>Server Core Log<hr></h5></td></tr> 
     276              <tr><td colspan=\"2\"><p>"; 
     277 
     278  //Open error log 
     279  if(($errorLogFile = fopen("/opt/isymphony/server/logs/core-events.txt", 'r')) !== false) { 
     280    while (!feof($errorLogFile)) { 
     281          $line = fgets($errorLogFile, 4096); 
     282          $debugLogDisplay .= htmlspecialchars($line) . "<br>"; 
     283      } 
     284      fclose($errorLogFile); 
     285  } 
     286   
     287  $debugLogDisplay .= "</p></td></tr>"; 
     288} 
     289 
     290//Check if a request to show server communication log was made 
     291if(isset($_REQUEST["showservercommunicationlog"])) { 
     292   
     293  $debugUrlAdditions .= "&showservercommunicationlog=yes"; 
     294   
     295  $debugLogDisplay .= " <tr><td colspan=\"2\"><h5>Server Communication Log<hr></h5></td></tr> 
     296              <tr><td colspan=\"2\"><p>"; 
     297 
     298  //Open error log 
     299  if(($errorLogFile = fopen("/opt/isymphony/server/logs/communication.txt", 'r')) !== false) { 
     300    while (!feof($errorLogFile)) { 
     301          $line = fgets($errorLogFile, 4096); 
     302          $debugLogDisplay .= htmlspecialchars($line) . "<br>"; 
     303      } 
     304      fclose($errorLogFile); 
     305  } 
     306   
     307  $debugLogDisplay .= "</p></td></tr>"; 
     308} 
     309 
     310//Check if a request to show server aj external log was made 
     311if(isset($_REQUEST["showserverajexternallog"])) { 
     312   
     313  $debugUrlAdditions .= "&showserverajexternallog=yes"; 
     314   
     315  $debugLogDisplay .= " <tr><td colspan=\"2\"><h5>Server AJ External Log<hr></h5></td></tr> 
     316              <tr><td colspan=\"2\"><p>"; 
     317 
     318  //Open error log 
     319  if(($errorLogFile = fopen("/opt/isymphony/server/logs/asterisk-java-external.txt", 'r')) !== false) { 
     320    while (!feof($errorLogFile)) { 
     321          $line = fgets($errorLogFile, 4096); 
     322          $debugLogDisplay .= htmlspecialchars($line) . "<br>"; 
     323      } 
     324      fclose($errorLogFile); 
     325  } 
     326   
     327  $debugLogDisplay .= "</p></td></tr>"; 
     328} 
     329 
     330//Check if a request to show server aj internal log was made 
     331if(isset($_REQUEST["showserverajinternallog"])) { 
     332   
     333  $debugUrlAdditions .= "&showserverajinternallog=yes"; 
     334   
     335  $debugLogDisplay .= " <tr><td colspan=\"2\"><h5>Server AJ Internal Log<hr></h5></td></tr> 
     336              <tr><td colspan=\"2\"><p>"; 
     337 
     338  //Open error log 
     339  if(($errorLogFile = fopen("/opt/isymphony/server/logs/asterisk-java-internal.txt", 'r')) !== false) { 
     340    while (!feof($errorLogFile)) { 
     341          $line = fgets($errorLogFile, 4096); 
     342          $debugLogDisplay .= htmlspecialchars($line) . "<br>"; 
     343      } 
     344      fclose($errorLogFile); 
     345  } 
     346   
     347  $debugLogDisplay .= "</p></td></tr>"; 
     348} 
     349 
    145350//Connect to iSymphony server to query information 
    146351if($serverRunning && iSymphonyConnect()) { 
     
    172377 
    173378  //Build action buttons 
    174   $reloadServerButton = " <form name=\"isymphony_reload_form\" action=\"config.php?type=setup&display=isymphony$debugUrlAddition\" method=\"post\"> 
     379  $reloadServerButton = " <form name=\"isymphony_reload_form\" action=\"config.php?type=setup&display=isymphony$debugUrlAdditions\" method=\"post\"> 
    175380                <input type=\"Submit\" name=\"isymphony_reload\" value=\"Reload\"> 
    176381              </form>"; 
    177   $activateLicenseButton = "  <form name=\"isymphony_activate_license_form\" action=\"config.php?type=setup&display=isymphony$debugUrlAddition\" method=\"post\"> 
     382  $activateLicenseButton = "  <form name=\"isymphony_activate_license_form\" action=\"config.php?type=setup&display=isymphony$debugUrlAdditions\" method=\"post\"> 
    178383                  <input type=\"text\" name=\"isymphony_license_key\"> 
    179384                  <input type=\"Submit\" name=\"isymphony_activate_license\" value=\"Activate\"> 
     
    201406} 
    202407 
    203 $display = "<div class=\"content\"> 
     408$display = "<script language=\"javascript\"> 
     409      <!-- 
     410         
     411        function checkForm() { 
     412           
     413          var settingsForm = document.getElementById('isymphony_settings_form');         
     414 
     415          if(settingsForm.elements['isymphony_admin_user_name'].value.length == 0) { 
     416            alert('Admin User Name cannot be blank.'); 
     417            return false; 
     418          } 
     419 
     420          if(settingsForm.elements['isymphony_admin_password'].value.length == 0) { 
     421            alert('Admin Password cannot be blank.'); 
     422            return false; 
     423          } 
     424 
     425          if(settingsForm.elements['isymphony_originate_timeout'].value.length == 0) { 
     426            alert('Originate Timeout cannot be blank.'); 
     427            return false; 
     428          } 
     429 
     430          if(settingsForm.elements['isymphony_originate_timeout'].value != parseInt(settingsForm.elements['isymphony_originate_timeout'].value)) { 
     431            alert('Originate Timeout must be numeric.'); 
     432            return false; 
     433          } 
     434 
     435          if(settingsForm.elements['isymphony_jabber_port'].value.length == 0) { 
     436            alert('Jabber Port cannot be blank.'); 
     437            return false; 
     438          } 
     439 
     440          if(settingsForm.elements['isymphony_jabber_port'].value != parseInt(settingsForm.elements['isymphony_jabber_port'].value)) { 
     441            alert('Jabber Port must be numeric.'); 
     442            return false; 
     443          } 
     444 
     445          return true; 
     446        } 
     447      //--> 
     448      </script> 
     449       
     450      <div class=\"content\"> 
    204451        $licenseActivationError 
    205         <h2>iSymphony</h2> 
    206452        <table> 
     453          <tr><td colspan=\"2\"><h2 id=\"title\">iSymphony</h2></td></tr> 
    207454          <tr><td colspan=\"2\"><h5>Server<hr></h5></td></tr> 
    208455          <tr> 
     
    240487            <td>$activateLicenseButton</td>            
    241488          </tr> 
    242           $debugMenuAddition 
     489 
     490          <form name=\"isymphony_settings_form\" id=\"isymphony_settings_form\" action=\"config.php?type=setup&display=isymphony$debugUrlAdditions\" method=\"post\" onsubmit=\"return checkForm();\"> 
     491          <tr><td colspan=\"2\"><h5>Server Settings<hr></h5></td></tr> 
     492          <tr> 
     493            <td><a href=\"#\" class=\"info\">Admin User Name:<span>User name used to login to the administration section in the panel.</span></a></td> 
     494            <td><input size=\"20\" type=\"text\" name=\"isymphony_admin_user_name\" value=\"" . htmlspecialchars($locationInformation['admin_user_name']) . "\"></td> 
     495          </tr> 
     496          <tr> 
     497            <td><a href=\"#\" class=\"info\">Admin Password:<span>Password used to login to the administration section in the panel.</span></a></td> 
     498            <td><input size=\"20\" type=\"text\" name=\"isymphony_admin_password\" value=\"" . htmlspecialchars($locationInformation['admin_password']) . "\"></td> 
     499          </tr> 
     500          <tr> 
     501            <td><a href=\"#\" class=\"info\">Originate Timeout:<span>Number of milliseconds that the originating extension will be rung when placing a call via the panel before timing out.</span></a></td> 
     502            <td><input size=\"20\" type=\"text\" name=\"isymphony_originate_timeout\" value=\"" . htmlspecialchars($locationInformation['originate_timeout']) . "\"></td> 
     503          </tr> 
     504          <tr> 
     505            <td><a href=\"#\" class=\"info\">Auto Reload:<span>Tells the server to automatically reload the location when the dial plan is reloaded.</span></a></td> 
     506            <td><input type=\"checkbox\" name=\"isymphony_auto_reload\"" . (($locationInformation['auto_reload'] == "1") ? " checked" : "") . "></td> 
     507          </tr> 
     508          <tr> 
     509            <td><a href=\"#\" class=\"info\">Enable Page Status:<span>If checked allows you to see paging status on extensions in the panel.</span></a></td> 
     510            <td><input type=\"checkbox\" name=\"isymphony_page_status_enabled\"" . (($locationInformation['page_status_enabled'] == "1") ? " checked" : "") . "></td> 
     511          </tr> 
     512 
     513          <tr><td colspan=\"2\"><h5>Global Jabber Settings<hr></h5></td></tr> 
     514          <tr> 
     515            <td><a href=\"#\" class=\"info\">Host:<span>Jabber host to be used unless otherwise overridden by the extension settings.</span></a></td> 
     516            <td><input size=\"20\" type=\"text\" name=\"isymphony_jabber_host\" value=\"" . htmlspecialchars($locationInformation['jabber_host']) . "\"></td> 
     517          </tr> 
     518          <tr> 
     519            <td><a href=\"#\" class=\"info\">Domain:<span>Jabber domain to be used unless otherwise overridden by the extension settings.</span></a></td> 
     520            <td><input size=\"20\" type=\"text\" name=\"isymphony_jabber_domain\" value=\"" . htmlspecialchars($locationInformation['jabber_domain']) . "\"></td> 
     521          </tr> 
     522          <tr> 
     523            <td><a href=\"#\" class=\"info\">Resource:<span>Jabber resource to be used unless otherwise overridden by the extension settings.</span></a></td> 
     524            <td><input size=\"20\" type=\"text\" name=\"isymphony_jabber_resource\" value=\"" . htmlspecialchars($locationInformation['jabber_resource']) . "\"></td> 
     525          </tr> 
     526          <tr> 
     527            <td><a href=\"#\" class=\"info\">Port:<span>Jabber port to be used unless otherwise overridden by the extension settings.</span></a></td> 
     528            <td><input size=\"20\" type=\"text\" name=\"isymphony_jabber_port\" value=\"" . htmlspecialchars($locationInformation['jabber_port']) . "\"></td> 
     529          </tr> 
     530          <tr> 
     531            <td colspan=\"2\"><input type=\"Submit\" name=\"isymphony_update_location_settings\" value=\"Submit Changes\"></td> 
     532          </tr> 
     533          </form> 
     534          <tr><td colspan=\"2\"><h5>Module Debug<hr></h5></td></tr> 
     535          <tr><td><a href=\"config.php?type=setup&display=isymphony&showmoduledebuglog=yes$debugUrlAdditions\">View Debug Log</a></td></tr> 
     536          <tr><td><a href=\"config.php?type=setup&display=isymphony&showmoduleerrorlog=yes$debugUrlAdditions\">View Error Log</a></td></tr> 
     537          <tr><td><a href=\"config.php?type=setup&display=isymphony&showmoduledb=yes$debugUrlAdditions\">View Database</a></td></tr> 
     538          <tr><td colspan=\"2\"><h5>Server Debug<hr></h5></td></tr> 
     539          <tr><td><a href=\"config.php?type=setup&display=isymphony&showservererrorlog=yes$debugUrlAdditions\">View Error Log</a></td></tr> 
     540          <tr><td><a href=\"config.php?type=setup&display=isymphony&showservercorelog=yes$debugUrlAdditions\">View Core Log</a></td></tr> 
     541          <tr><td><a href=\"config.php?type=setup&display=isymphony&showservercommunicationlog=yes$debugUrlAdditions\">View Communication Log</a></td></tr> 
     542          <tr><td><a href=\"config.php?type=setup&display=isymphony&showserverajexternallog=yes$debugUrlAdditions\">View AMI External Log</a></td></tr> 
     543          <tr><td><a href=\"config.php?type=setup&display=isymphony&showserverajinternallog=yes$debugUrlAdditions\">View AMI Internal Log</a></td></tr> 
     544          $debugLogDisplay 
    243545        </table> 
    244546        $databaseDisplay 
  • contributed_modules/modules/isymphony/uninstall.php

    r6771 r7772  
    44 *Author       : Michael Yara 
    55 *Created      : August 15, 2008 
    6  *Last Updated : September 17, 2008 
    7  *History      : 0.2 
     6 *Last Updated : May 26, 2009 
     7 *History      : 0.3 
    88 *Purpose      : Remove iSymphony tables and manager include 
    99 *Copyright    : 2008 HEHE Enterprises, LLC 
     
    1111  
    1212global $db; 
     13  
     14//Drop location table 
     15$query = "DROP TABLE IF EXISTS isymphony_location"; 
     16echo "Removing \"isymphony_location\" Table....<br>"; 
     17$results = $db->query($query); 
     18if(DB::IsError($results)) { 
     19  echo "ERROR: could not remove table.<br>"; 
     20}  
    1321  
    1422//Drop users table