From ca37cea6cf578acce537e2711c8bde17ac0e261d Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 2 Dec 2010 12:25:39 +1100 Subject: [PATCH] Removed modules not ported in the short term --- modules/radius/auth.inc.php | 7 - modules/radius/radius.inc.php | 418 ---- modules/radius/radius_construct.xml | 113 - modules/radius/radius_install.xml | 74 - modules/radius_service/radius_service.inc.php | 5 - .../radius_service_construct.xml | 33 - .../radius_service/radius_service_install.xml | 15 - modules/voip/auth.inc.php | 12 - modules/voip/base_voip_plugin.inc.php | 183 -- modules/voip/memory_report.inc.php | 134 - modules/voip/voip.inc.php | 2188 ----------------- modules/voip/voip_construct.xml | 55 - modules/voip/voip_install.xml | 19 - modules/voip_blacklist/auth.inc.php | 12 - modules/voip_blacklist/voip_blacklist.inc.php | 215 -- .../voip_blacklist_construct.xml | 43 - .../voip_blacklist/voip_blacklist_install.xml | 42 - modules/voip_cdr/auth.inc.php | 6 - modules/voip_cdr/voip_cdr.inc.php | 174 -- modules/voip_cdr/voip_cdr_construct.xml | 106 - modules/voip_cdr/voip_cdr_install.xml | 55 - modules/voip_did/voip_did.inc.php | 264 -- modules/voip_did/voip_did_construct.xml | 125 - modules/voip_did/voip_did_install.xml | 62 - .../voip_did_plugin/voip_did_plugin.inc.php | 284 --- .../voip_did_plugin_construct.xml | 47 - .../voip_did_plugin_install.xml | 42 - .../voip_did_plugin_install_data.xml | 34 - modules/voip_fax/auth.inc.php | 12 - modules/voip_fax/voip_fax.inc.php | 192 -- modules/voip_fax/voip_fax_construct.xml | 68 - modules/voip_fax/voip_fax_install.xml | 37 - modules/voip_fax_data/voip_fax_data.inc.php | 6 - .../voip_fax_data/voip_fax_data_construct.xml | 29 - .../voip_fax_data/voip_fax_data_install.xml | 15 - modules/voip_iax/voip_iax.inc.php | 5 - modules/voip_iax/voip_iax_construct.xml | 34 - modules/voip_iax/voip_iax_install.xml | 15 - .../voip_in_network/voip_in_network.inc.php | 6 - .../voip_in_network_construct.xml | 26 - .../voip_in_network_install.xml | 15 - .../voip_local_lookup.inc.php | 5 - .../voip_local_lookup_construct.xml | 32 - .../voip_local_lookup_install.xml | 15 - modules/voip_pool/voip_pool.inc.php | 268 -- modules/voip_pool/voip_pool_construct.xml | 68 - modules/voip_pool/voip_pool_install.xml | 54 - modules/voip_prepaid/auth.inc.php | 6 - modules/voip_prepaid/voip_prepaid.inc.php | 529 ---- .../voip_prepaid/voip_prepaid_construct.xml | 79 - modules/voip_prepaid/voip_prepaid_install.xml | 65 - modules/voip_rate/voip_rate.inc.php | 215 -- modules/voip_rate/voip_rate_construct.xml | 75 - modules/voip_rate/voip_rate_install.xml | 46 - modules/voip_rate_prod/voip_rate_prod.inc.php | 133 - .../voip_rate_prod_construct.xml | 42 - .../voip_rate_prod/voip_rate_prod_install.xml | 31 - modules/voip_sip/voip_sip.inc.php | 5 - modules/voip_sip/voip_sip_construct.xml | 34 - modules/voip_sip/voip_sip_install.xml | 15 - modules/voip_vm/auth.inc.php | 11 - modules/voip_vm/voip_vm.inc.php | 252 -- modules/voip_vm/voip_vm_construct.xml | 59 - modules/voip_vm/voip_vm_install.xml | 42 - 64 files changed, 7308 deletions(-) delete mode 100644 modules/radius/auth.inc.php delete mode 100644 modules/radius/radius.inc.php delete mode 100644 modules/radius/radius_construct.xml delete mode 100644 modules/radius/radius_install.xml delete mode 100644 modules/radius_service/radius_service.inc.php delete mode 100644 modules/radius_service/radius_service_construct.xml delete mode 100644 modules/radius_service/radius_service_install.xml delete mode 100644 modules/voip/auth.inc.php delete mode 100644 modules/voip/base_voip_plugin.inc.php delete mode 100644 modules/voip/memory_report.inc.php delete mode 100644 modules/voip/voip.inc.php delete mode 100644 modules/voip/voip_construct.xml delete mode 100644 modules/voip/voip_install.xml delete mode 100644 modules/voip_blacklist/auth.inc.php delete mode 100644 modules/voip_blacklist/voip_blacklist.inc.php delete mode 100644 modules/voip_blacklist/voip_blacklist_construct.xml delete mode 100644 modules/voip_blacklist/voip_blacklist_install.xml delete mode 100644 modules/voip_cdr/auth.inc.php delete mode 100644 modules/voip_cdr/voip_cdr.inc.php delete mode 100644 modules/voip_cdr/voip_cdr_construct.xml delete mode 100644 modules/voip_cdr/voip_cdr_install.xml delete mode 100644 modules/voip_did/voip_did.inc.php delete mode 100644 modules/voip_did/voip_did_construct.xml delete mode 100644 modules/voip_did/voip_did_install.xml delete mode 100644 modules/voip_did_plugin/voip_did_plugin.inc.php delete mode 100644 modules/voip_did_plugin/voip_did_plugin_construct.xml delete mode 100644 modules/voip_did_plugin/voip_did_plugin_install.xml delete mode 100644 modules/voip_did_plugin/voip_did_plugin_install_data.xml delete mode 100644 modules/voip_fax/auth.inc.php delete mode 100644 modules/voip_fax/voip_fax.inc.php delete mode 100644 modules/voip_fax/voip_fax_construct.xml delete mode 100644 modules/voip_fax/voip_fax_install.xml delete mode 100644 modules/voip_fax_data/voip_fax_data.inc.php delete mode 100644 modules/voip_fax_data/voip_fax_data_construct.xml delete mode 100644 modules/voip_fax_data/voip_fax_data_install.xml delete mode 100644 modules/voip_iax/voip_iax.inc.php delete mode 100644 modules/voip_iax/voip_iax_construct.xml delete mode 100644 modules/voip_iax/voip_iax_install.xml delete mode 100644 modules/voip_in_network/voip_in_network.inc.php delete mode 100644 modules/voip_in_network/voip_in_network_construct.xml delete mode 100644 modules/voip_in_network/voip_in_network_install.xml delete mode 100644 modules/voip_local_lookup/voip_local_lookup.inc.php delete mode 100644 modules/voip_local_lookup/voip_local_lookup_construct.xml delete mode 100644 modules/voip_local_lookup/voip_local_lookup_install.xml delete mode 100644 modules/voip_pool/voip_pool.inc.php delete mode 100644 modules/voip_pool/voip_pool_construct.xml delete mode 100644 modules/voip_pool/voip_pool_install.xml delete mode 100644 modules/voip_prepaid/auth.inc.php delete mode 100644 modules/voip_prepaid/voip_prepaid.inc.php delete mode 100644 modules/voip_prepaid/voip_prepaid_construct.xml delete mode 100644 modules/voip_prepaid/voip_prepaid_install.xml delete mode 100644 modules/voip_rate/voip_rate.inc.php delete mode 100644 modules/voip_rate/voip_rate_construct.xml delete mode 100644 modules/voip_rate/voip_rate_install.xml delete mode 100644 modules/voip_rate_prod/voip_rate_prod.inc.php delete mode 100644 modules/voip_rate_prod/voip_rate_prod_construct.xml delete mode 100644 modules/voip_rate_prod/voip_rate_prod_install.xml delete mode 100644 modules/voip_sip/voip_sip.inc.php delete mode 100644 modules/voip_sip/voip_sip_construct.xml delete mode 100644 modules/voip_sip/voip_sip_install.xml delete mode 100644 modules/voip_vm/auth.inc.php delete mode 100644 modules/voip_vm/voip_vm.inc.php delete mode 100644 modules/voip_vm/voip_vm_construct.xml delete mode 100644 modules/voip_vm/voip_vm_install.xml diff --git a/modules/radius/auth.inc.php b/modules/radius/auth.inc.php deleted file mode 100644 index 92be3cb1..00000000 --- a/modules/radius/auth.inc.php +++ /dev/null @@ -1,7 +0,0 @@ - 'radius', 'method' => 'do_update'), -Array ('module' => 'radius', 'method' => 'do_list') -); -?> \ No newline at end of file diff --git a/modules/radius/radius.inc.php b/modules/radius/radius.inc.php deleted file mode 100644 index 65b32ccc..00000000 --- a/modules/radius/radius.inc.php +++ /dev/null @@ -1,418 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -/** - * Radius Provisioning Class for AgileBill - */ -class radius -{ - var $user_regex='^([a-zA-Z0-9\-\_\.]{4,20})$'; - var $pass_regex='^([a-zA-Z0-9\-\_\.]{4,20})$'; - - /** - * Get the user's password list: - */ - function do_list($VAR) - { - global $smarty, $C_debug; - - # Validate logged in: - if(!SESS_LOGGED) { - $C_debug->alert("You must be logged in!"); - return; - } - - # Get all accounts defined for this user: - $db=&DB(); - $result = $db->Execute(sqlSelect($db,"radius","*","account_id=::".SESS_ACCOUNT."::","username DESC")); - if($result && $result->RecordCount()) { - while(!$result->EOF) { - - if($result->fields['auth'] == 'login') - $old_login[] = $result->fields; - - if($result->fields['auth'] == 'wireless') - $old_wireless[] = $result->fields; - - $result->MoveNext(); - } - } - $smarty->assign("old_login", $old_login); - $smarty->assign("old_wireless", $old_wireless); - - $rs = $db->Execute($sql=sqlSelect($db,"radius_service","*", - "account_id=::".SESS_ACCOUNT.":: AND (radius_id IS NULL OR radius_id=0 OR radius_id=::::)")); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - if($rs->fields['auth']=='login') { - $new_login[] = array('id'=>$rs->fields['id']); - } elseif($rs->fields['auth']=='wireless') { - $new_wireless[] = array('id'=>$rs->fields['id']); - } - $rs->MoveNext(); - } - } - - $smarty->assign("new_login", @$new_login); - $smarty->assign("new_wireless", @$new_wireless); - - } - - /** - * Get total accounts available for this user - */ - function available_accounts(&$avail_login, &$avail_wireless) { - $db=&DB(); - $rs = $db->Execute($sql=sqlSelect($db,"radius_service","*", - "account_id=::".SESS_ACCOUNT.":: AND (radius_id IS NULL OR radius_id=0 OR radius_id=::::)")); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - if($rs->fields['auth']=='login') { - $avail_login++; - } elseif($rs->fields['auth']=='wireless') { - $avail_wireless++; - } - $rs->MoveNext(); - } - } - } - - /** - * Add a radius entry - */ - function add_radius($service_id, $radius_service_id, $username, $password=false) { - - // determine type of auth - if(!$password) - $auth='wireless'; - else - $auth='login'; - - // get the associated service - $db=&DB(); - $rs = $db->Execute(sqlSelect($db,"service","*", "id=::$service_id::")); - if(!$rs || !$rs->RecordCount()) return false; - - $f['service_id']=$service_id; - $f['username']=$username; - $f['password']=$password; - $f['account_id']=$rs->fields['account_id']; - $f['sku']=$rs->fields['sku']; - $f['active']=1; - - // insert radius record - $arr=unserialize($rs->fields['prod_plugin_data']); - foreach($arr as $a=>$b) { - if($a != 'max') $f[$a]=$b; - } - $id = sqlGenID($db,"radius"); - $db->Execute($sql=sqlInsert($db,"radius",$f,$id)); - - // update radius_service table - $db->Execute(sqlUpdate($db, "radius_service", array('radius_id'=>$id), "id = $radius_service_id")); - - return true; - } - - /** - * validate mac id - */ - function validate_wireless($user) { - if(ereg("^([0-9A-Z]{2}) ([0-9A-Z]{2}) ([0-9A-Z]{2}) ([0-9A-Z]{2}) ([0-9A-Z]{2}) ([0-9A-Z]{2})$",$user)) return $user; - return false; - } - - /** - * validate username and password - */ - function validate_login($user,$pass) { - - if(!ereg("$this->user_regex", $pass)) return false; - if(!ereg("$this->pass_regex", $pass)) return false; - return true; - } - - /** - * Validate unique user/mac id - */ - function validate_unique($id,$username) { - - $s=''; - if($id) $s="id!=::$id:: AND "; - $db=&DB(); - $result = $db->Execute($sql=sqlSelect($db,"radius","id","$s username=::$username::")); - - if($result === false || $result->RecordCount() == 0) - return true; - else - return false; - } - - /** - * Update password list - */ - function do_update($VAR) - { - global $smarty, $C_debug, $C_translate; - $db=&DB(); - - $msg = false; - - # Validate logged in: - if(!SESS_LOGGED) { - $C_debug->alert("You must be logged in!"); - return; - } - - # Loop through the submitted passwords for update: - if(!empty($VAR['username']) && is_array($VAR['username'])) { - foreach($VAR['username'] as $id=>$val) { - $user = $VAR['username'][$id]; - @$pass = $VAR['password'][$id]; - - - $result = $db->Execute(sqlSelect($db,"radius","*", "id=::$id:: AND account_id=::".SESS_ACCOUNT."::")); - if($result && $result->RecordCount()) - { - if($result->fields['auth'] == 'login') { - if(!$this->validate_login($user,$pass) || !$this->validate_unique($id, $user)) { - $C_translate->value["radius"]["user"]=$user; - $C_translate->value["radius"]["pass"]=$pass; - $msg .= $C_translate->translate("err_login", "radius")."
"; - } else { - // update login record - $db->Execute(sqlUpdate($db,"radius",array('password'=>$pass, 'username'=>$user), "id=$id")); - #$used_login++; - } - } elseif ($result->fields['auth'] == 'wireless') { - // validate mac id - $user=strtoupper($user); - $user=str_replace("-", " ", $user); - if(!$this->validate_wireless($user) || !$this->validate_unique($id, $user)) { - $C_translate->value["radius"]["user"]=$user; - $msg .= $C_translate->translate("err_wireless", "radius")."
"; - } else { - $db->Execute(sqlUpdate($db,"radius",array('username'=>$user), "id=$id")); - } - } - } - } - } - - - # Loop through the submitted passwords for additions: - if(!empty($VAR['new_username']) && is_array($VAR['new_username'])) { - foreach($VAR['new_username'] as $id=>$val) { - if(!empty($VAR['new_username'][$id])) { - $user = $VAR['new_username'][$id]; - @$pass = $VAR['new_password'][$id]; - - // validation - $rsRS = $db->Execute(sqlSelect($db,"radius_service","*", "id=::$id:: AND account_id=::".SESS_ACCOUNT."::")); - $service_id = $rsRS->fields['service_id']; - $radius_service_id = $rsRS->fields['id']; - if($rsRS->fields['auth'] == 'login') { - if(!$this->validate_login($user,$pass) || !$this->validate_unique(false, $user)) { - $C_translate->value["radius"]["user"]=$user; - $C_translate->value["radius"]["pass"]=$pass; - $msg .= $C_translate->translate("err_login", "radius")."
"; - } else { - // add login record - $this->add_radius($service_id, $radius_service_id, $user, $pass); - } - } elseif ($rsRS->fields['auth'] == 'wireless' ) { - // validate mac id - $user=strtoupper($user); - $user=str_replace("-", " ", $user); - if(!$this->validate_wireless($user) || !$this->validate_unique(false, $user)) { - $C_translate->value["radius"]["user"]=$user; - $msg .= $C_translate->translate("err_wireless", "radius")."
"; - } else { - // add mac id record - $this->add_radius($service_id, $radius_service_id, $user); - } - } - } - } - } - - if(!empty($msg)) $C_debug->alert($msg); - } - - - # Open the constructor for this mod - function construct() - { - # name of this module: - $this->module = "radius"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $this->construct(); - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $this->construct(); - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $this->construct(); - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $this->construct(); - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - function search_show($VAR) - { - $this->construct(); - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - ############################## - ## SEARCH EXPORT ## - ############################## - function search_export($VAR) - { - $this->construct(); - # require the export class - require_once (PATH_CORE . "export.inc.php"); - - # Call the correct export function for inline browser display, download, email, or web save. - if($VAR["format"] == "excel") - { - $type = "export_excel"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_excel($VAR, $this, $type); - } - - else if ($VAR["format"] == "pdf") - { - $type = "export_pdf"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_pdf($VAR, $this, $type); - } - - else if ($VAR["format"] == "xml") - { - $type = "export_xml"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_xml($VAR, $this, $type); - } - - else if ($VAR["format"] == "csv") - { - $type = "export_csv"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_csv($VAR, $this, $type); - } - - else if ($VAR["format"] == "tab") - { - $type = "export_tab"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_tab($VAR, $this, $type); - } - } -} -?> \ No newline at end of file diff --git a/modules/radius/radius_construct.xml b/modules/radius/radius_construct.xml deleted file mode 100644 index a1aca703..00000000 --- a/modules/radius/radius_construct.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - radius - - - radius
- - - - - - 0 - - - id - - - 35 - - - - - I8 - 1 - - - I4 - - - I4 - any - - - I8 - service - id - - - L - - - C(32) - - - C(16) - - - C(128) - any - - - C(128) - - - C(128) - - - I4 - - - I4 - - - I4 - - - L - - - L - - - C(128) - - - C(128) - - - C(128) - - - I4 - - - C(128) - - - C(128) - - - I4 - - - - - - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - id,site_id,account_id,service_id,active,sku,auth,username,password,service_type,session_limit,idle_limit,port_limit,analog,digital,filter_id,netmask,framed_route,speed_limit,static_ip,profiles,time_bank - - - - 0 -
\ No newline at end of file diff --git a/modules/radius/radius_install.xml b/modules/radius/radius_install.xml deleted file mode 100644 index 392aabe7..00000000 --- a/modules/radius/radius_install.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - radius - - Controls radius provisioning - 1 - - radius_service - - - - - - - %%module_id%% - add - %%:add - 1 - - - %%module_id%% - search_export - - - %%module_id%% - update - - - %%module_id%% - export_excel - - - %%module_id%% - delete - - - %%module_id%% - export_xml - - - %%module_id%% - view - core:search&module=%%&_escape=1 - 1 - - - %%module_id%% - export_tab - - - %%module_id%% - search - %%:search_form - 1 - - - %%module_id%% - search_form - - - %%module_id%% - search_show - - - - %%module_id%% - export_csv > - - - - \ No newline at end of file diff --git a/modules/radius_service/radius_service.inc.php b/modules/radius_service/radius_service.inc.php deleted file mode 100644 index ef8510f4..00000000 --- a/modules/radius_service/radius_service.inc.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/modules/radius_service/radius_service_construct.xml b/modules/radius_service/radius_service_construct.xml deleted file mode 100644 index 082800e0..00000000 --- a/modules/radius_service/radius_service_construct.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - radius_service - radius_service
- radius - 0 - id - 35 - - - I8 - 1 - - - I4 - - - I8 - - - I8 - - - I8 - - - C(16) - - - - - 0 -
\ No newline at end of file diff --git a/modules/radius_service/radius_service_install.xml b/modules/radius_service/radius_service_install.xml deleted file mode 100644 index 5dab0ae2..00000000 --- a/modules/radius_service/radius_service_install.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - radius_service - radius - - - radius - - - - - - - \ No newline at end of file diff --git a/modules/voip/auth.inc.php b/modules/voip/auth.inc.php deleted file mode 100644 index 994ee1ae..00000000 --- a/modules/voip/auth.inc.php +++ /dev/null @@ -1,12 +0,0 @@ - 'voip', 'method' => 'menu_countries'), - Array ('module' => 'voip', 'method' => 'menu_location'), - Array ('module' => 'voip', 'method' => 'menu_station'), - Array ('module' => 'voip', 'method' => 'features'), - Array ('module' => 'voip', 'method' => 'update_features'), - Array ('module' => 'voip', 'method' => 'activity'), - Array ('module' => 'voip', 'method' => 'overview') - ); -?> \ No newline at end of file diff --git a/modules/voip/base_voip_plugin.inc.php b/modules/voip/base_voip_plugin.inc.php deleted file mode 100644 index 3a6f01e3..00000000 --- a/modules/voip/base_voip_plugin.inc.php +++ /dev/null @@ -1,183 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -require_once PATH_MODULES.'product/base_product_plugin.inc.php'; - -class base_voip_plugin extends base_product_plugin -{ - function delete_cart($VAR, $cart, $checkDID = false) - { - if(!isset($cart['product_attr'])) return; - - $db =& DB(); - $attr = unserialize($cart['product_attr']); - if(!empty($attr['station'])) - { - $did = $attr['station']; - - if($checkDID) { - // check if user owns did && is in did pool (if so we can assume it was a topup and return) - $didrs = $db->Execute(sqlSelect($db,"voip_did","id,did","did = ::{$did}:: AND account_id=".SESS_ACCOUNT)); - if($didrs && $didrs->RecordCount()>0) return; - } - - // get E164 so we can determine the country code and did npa/nxx/station and find the did and plugin - include_once(PATH_MODULES.'voip/voip.inc.php'); - $v = new voip; - $did_arr = $v->get_did_e164($did); - if(!$did_arr) return; - - $plugin_id = $did_arr['voip_did_plugin_id']; - - // Get the plugin detials - $rs = & $db->Execute(sqlSelect($db,"voip_did_plugin","plugin,avail_countries","id = $plugin_id")); - if($rs && $rs->RecordCount() > 0) { - $plugin = $rs->fields['plugin']; - } else { - return; - } - - // load the plugin and call release(); - $file = PATH_PLUGINS.'voip_did/'.$plugin.'.php'; - if(is_file($file)) { - include_once($file); - eval('$plg = new plgn_voip_did_'.$plugin.';'); - if(is_object($plg)) { - if(is_callable(array($plg, 'release'))) { - $plg->id = $did_arr['voip_did_plugin_id'];; - $plg->did = $did; - $plg->did_id = $did_arr['id']; - $plg->release(); - } - } - } - } - } - - function validate_cart($VAR, $product, $did, $ported) - { - // get E164 so we can determine the country code and did npa/nxx/station - $db =& DB(); - include_once(PATH_MODULES.'voip/voip.inc.php'); - $v = new voip; - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($v->e164($did, $e164, $cc, $npa, $nxx)) - { - if ($ported) return true; - - // verify this did is in voip_pool, and is not assigned to an account, and is not reserved - if ($cc == '1') { - $station = substr($e164, 8); - $sql = sqlSelect($db,"voip_pool","*", - "(date_reserved IS NULL OR date_reserved=0) AND (account_id IS NULL OR account_id=0) AND country_code=$cc AND npa=$npa AND nxx=$nxx AND station=$station"); - } elseif ($cc == '61') { - $station = substr($e164, 12); - $sql = sqlSelect($db,"voip_pool","*", - "(date_reserved IS NULL OR date_reserved=0) AND (account_id IS NULL OR account_id=0) AND country_code=$cc AND npa=$npa AND nxx=$nxx AND station=$station"); - } else { - $station = substr($e164, 4 + strlen($cc)); - $sql = sqlSelect($db,"voip_pool","*", - "(date_reserved IS NULL OR date_reserved=0) AND (account_id IS NULL OR account_id=0) AND country_code=$cc AND station=$station"); - } - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount() > 0) { - $did_id = $rs->fields['id']; - $plugin_id = $rs->fields['voip_did_plugin_id']; - } else { - return "Sorry, the selected number is not available or has been removed from our system, please go back and select another."; - } - } else { - return "The format for the provided number is incorrect."; - } - - // get the id of the current country calling code - $country_id = 0; - $country = $db->Execute($sql = sqlSelect($db,"voip_iso_country_code_map","iso_country_code","country_code = $cc")); - if($country && $country->RecordCount() == 1) { - $countryc = & $db->Execute($sql = sqlSelect($db,"voip_iso_country_code","id","code = ::{$country->fields['iso_country_code']}::")); - if($countryc && $countryc->RecordCount() == 1) { - $country_id = $countryc->fields['id']; - } else { - return "Sorry, the selected number is not available as the country is disallowed for the current product"; - } - } - - // validate that the country is available for the selected plugin - $country_auth = false; - $rs = $db->Execute(sqlSelect($db,"voip_did_plugin","plugin,avail_countries","id = $plugin_id")); - if($rs && $rs->RecordCount()) { - $plugin = $rs->fields['plugin']; - $carr = unserialize($rs->fields['avail_countries']); - foreach($carr as $cid) { - if($country_id == $cid) { $country_auth=true; break; } - } - } - if(!$country_auth) return "Sorry, the selected number is not available as the country is disallowed for the current product"; - - // Get the plugin details and load plugin as an object - $file = PATH_PLUGINS.'voip_did/'.$plugin.'.php'; - if(is_file($file)) { - include_once($file); - eval('$plg = new plgn_voip_did_'.$plugin.';'); - if(is_object($plg)) { - if(is_callable(array($plg, 'reserve'))) { - $plg->id = $plugin_id; - $plg->did = $did; - $plg->did_id = $did_id; - $plg->country = $cc; - $result = $plg->reserve(); - if($result === true) { - return true; - } else { - return $result; - } - } - } else { - return "VoIP DID object couldn't be created."; - } - } else { - return "VoIP DID plugin not found."; - } - // something failed... - return "An unknown error occurred while attempting to reserve your requested number, please try again later."; - } - - /** - * Retrieve the DID assigned to a service ID - */ - function get_parent_did($id) - { - $db = &DB(); - $sql = 'SELECT prod_attr_cart FROM '.AGILE_DB_PREFIX.'service WHERE - id = '.$db->qstr($id).' AND - site_id = '.$db->qstr(DEFAULT_SITE); - $rs = $db->Execute($sql); - @$a = unserialize($rs->fields['prod_attr_cart']); - $did = ""; - if (!empty($a['station'])) { - $did = str_replace("-", "", $a['station']); - } - if (!empty($a['ported'])) { - $did = $a['ported']; - } - return $did; - } -} -?> \ No newline at end of file diff --git a/modules/voip/memory_report.inc.php b/modules/voip/memory_report.inc.php deleted file mode 100644 index f8e74ae3..00000000 --- a/modules/voip/memory_report.inc.php +++ /dev/null @@ -1,134 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -header("Pragma: no-cache" ); -header("Cache-Control: no-cache, must-revalidate" ); - -if (!file_exists("/usr/bin/munge_monitor") || !file_exists("/var/log/asteriskmem")) { - echo '
Sorry, the required scripts for processing memory reports are not installed.
'; - exit; -} -if (GD == false) { - echo '
Sorry, this report requires GD support inside of PHP'; - exit; -} - -ob_start(); -require_once ('../../config.inc.php'); -require_once (PATH_INCLUDES."jpgraph/jpgraph.php"); -require_once (PATH_INCLUDES."jpgraph/jpgraph_line.php"); - - -$keys = array(); -function get_index($v) { - global $keys; - - if (in_array($v,$keys)) { - return array_search($v,$keys); - } - $keys[] = $v; - return array_search($v,$keys); -} - -function get_index_name($v) { - global $keys; - return $keys[$v]; -} - -$fp = popen("/usr/bin/munge_monitor 10) { - #echo "
"; print_r($col); echo "
"; - if ($prev != $col[0]) { - $prev = $col[0]; - $i++; - $j=0; - for($t=0;$t<40;$t++) - $datay[$i][$t] = 0; - } - $datay[get_index($col[3])][$i] = $col[2]; - $datax[$i] = date("H:j",$col[0]); - $j++; - } -} -#echo "
"; print_r($datay); echo "
"; exit; -$graph = new Graph(800,768,"auto"); -$graph->SetShadow(); -$graph->SetBackgroundGradient('#8e8e8e','#e1e1e1'); -// Use an integer X-scale -$graph->SetScale("textlin"); - -// Set title and subtitle -$graph->title->Set("Memory Leaks"); -$graph->subtitle->Set("Shows the number of unfreed blocks requested by each module"); - -// Use built in font -$graph->title->SetFont(FF_FONT1,FS_BOLD); - -// Make the margin around the plot a little bit bigger -// then default -$graph->img->SetMargin(40,140,40,80); - -// Slightly adjust the legend from it's default position in the -// top right corner to middle right side -$graph->legend->Pos(0.05,0.5,"right","center"); - -// Display every 10:th datalabel -$graph->xaxis->SetTextTickInterval(6); -$graph->xaxis->SetTextLabelInterval(6); -$graph->xaxis->SetTickLabels($datax); -$graph->xaxis->SetLabelAngle(90); - -$rgb = new RGB(); -$i = 0; -foreach($datay as $dy) { - // Create a red line plot - $p[$i] = new LinePlot($dy); - reset($rgb->rgb_table); - for($j=0;$j<=$i;$j += 1) { - for($k=0;$k<=10;$k++) { - next($rgb->rgb_table); - } - if( current($rgb->rgb_table) == "" ) { - reset($rgb->rgb_table); - } - } - $p[$i]->SetColor(current($rgb->rgb_table)); - $p[$i]->SetLegend(get_index_name($i)); - - // The order the plots are added determines who's ontop - $graph->Add($p[$i]); - // $graph->Add($b1); - #$i++; - #echo "
"; print_r($dy); echo "
"; - $i++; -} - -// Finally output the image -$graph->Stroke(); -ob_end_flush(); -exit; -?> \ No newline at end of file diff --git a/modules/voip/voip.inc.php b/modules/voip/voip.inc.php deleted file mode 100644 index 6714a533..00000000 --- a/modules/voip/voip.inc.php +++ /dev/null @@ -1,2188 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class didArea -{ - var $cc; - var $data; - - function didArea($cc = 1, $data = false) - { - $this->cc = $cc; - $this->data = $data; - } - - function determineArea($cc, $number) - { - $db =& DB(); - switch($cc) { - case 1: - /* usa - return the npa,nxx */ - return substr($number,0,6); - default: - $sql = "SELECT locName, npa FROM ".AGILE_DB_PREFIX."voip_npa_nxx - WHERE country_code=".$db->qstr($cc)." ORDER BY length(npa) desc"; - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - if(strncmp($rs->fields['npa'],$number,strlen($rs->fields['npa']))==0) { - return $rs->fields['npa']; - } - $rs->MoveNext(); - } - return false; - } else { - return false; - } - } - } - - function getName() - { - return $this->data['locName']; - } - - function getState() - { - return $this->data['locState']; - } - - function getAreacode() - { - return $this->data['areacode']; - } - - function getNpa() - { - return $this->data['npa']; - } - - function getNxx() - { - return $this->data['nxx']; - } - - function getStations($plugins) - { - // $data['areacode'] or $data['npa']+$data['nxx'] - $p = AGILE_DB_PREFIX; - $db =& DB(); - $pre = ""; - if($this->data['country_code'] == 1) { - $sql = "select distinct A.country_code,A.npa,A.nxx,A.station - FROM {$p}voip_pool AS A - left join {$p}voip_npa_nxx AS B - on (A.npa=B.npa and A.nxx=B.nxx AND B.country_code='1') - WHERE (A.account_id IS NULL OR A.account_id = 0) - AND (A.date_reserved IS NULL OR A.date_reserved = 0) - AND A.npa = " . $db->qstr($this->data['npa']) . " - AND A.nxx = " . $db->qstr($this->data['nxx']) . " - AND A.voip_did_plugin_id in (".join(",",$plugins).") - AND A.site_id=".DEFAULT_SITE." - LIMIT 0,50"; - } elseif($this->data['country_code'] == 61) { - $sql = "select distinct A.country_code,A.npa,A.nxx,A.station - FROM {$p}voip_pool AS A - left join {$p}voip_npa_nxx AS B - on (A.npa=B.npa and A.nxx=B.nxx AND B.country_code='1') - WHERE (A.account_id IS NULL OR A.account_id = 0) - AND (A.date_reserved IS NULL OR A.date_reserved = 0) - AND A.npa = " . $db->qstr($this->data['npa']) . " - AND A.nxx = " . $db->qstr($this->data['nxx']) . " - AND A.voip_did_plugin_id in (".join(",",$plugins).") - AND A.site_id=".DEFAULT_SITE." - LIMIT 0,50"; - } else { - $sql = "select distinct A.country_code,A.areacode as npa,A.nxx,A.station - FROM {$p}voip_pool AS A - left join {$p}voip_npa_nxx AS B - on (A.areacode=B.npa AND B.country_code=".$db->qstr($this->data['country_code']).") - WHERE (A.account_id IS NULL OR A.account_id = 0) - AND (A.date_reserved IS NULL OR A.date_reserved = 0) - AND A.areacode = " . $db->qstr($this->data['areacode']) . " - AND A.voip_did_plugin_id in (".join(",",$plugins).") - AND A.site_id=".DEFAULT_SITE." - LIMIT 0,50"; - $pre = "011"; - } - #echo "document.write('".str_replace("'","\\'",str_replace("\n","",$sql))."');"; return; - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount()) { - $i = 0; - while(!$rs->EOF) { - if ($rs->fields['country_code'] == '1') { - $dids[$i][0] = $pre.$rs->fields['country_code'].$rs->fields['npa'].$rs->fields['nxx'].$rs->fields['station']; - $dids[$i++][1] = $rs->fields['country_code']." ".$rs->fields['npa'].$rs->fields['nxx'].$rs->fields['station']; - } elseif($rs->fields['country_code'] == '61') { - $dids[$i][0] = $pre.$rs->fields['country_code'].$rs->fields['npa'].$rs->fields['nxx'].$rs->fields['station']; - $dids[$i++][1] = $rs->fields['country_code']." ".$rs->fields['npa'].$rs->fields['nxx'].$rs->fields['station']; - } else { - $dids[$i][0] = $pre.$rs->fields['country_code'].$rs->fields['station']; - $dids[$i++][1] = $rs->fields['country_code']." ".$rs->fields['station']; - } - $rs->MoveNext(); - } - return $dids; - } - syslog(LOG_INFO,$db->ErrorMsg()." -> ".$sql); - return false; - } -} - -class didAreas -{ - var $data, $cc; - - function didAreas($cc, $plugins = false) - { - $this->cc = $cc; - $p = AGILE_DB_PREFIX; - $db =& DB(); - if($cc==61) { - $sql = "select distinct A.npa,A.nxx,B.locName - from {$p}voip_pool AS A - inner join {$p}voip_npa_nxx AS B - on (A.npa=B.npa and A.country_code=".$db->qstr($cc)." AND - B.country_code=".$db->qstr($cc).") - WHERE (A.account_id IS NULL OR A.account_id = 0) AND - (A.date_reserved IS NULL OR A.date_reserved = 0) AND "; - if(is_array($plugins)) - $sql .= "A.voip_did_plugin_id in (".join(",",$plugins).") AND "; - $sql .= "A.site_id=".DEFAULT_SITE." ORDER BY B.locName"; - } - elseif($cc!=1) { - $sql = "select distinct A.areacode,B.locName - from {$p}voip_pool AS A - inner join {$p}voip_npa_nxx AS B - on (A.areacode=B.npa and A.country_code=".$db->qstr($cc)." AND - B.country_code=".$db->qstr($cc).") - WHERE (A.account_id IS NULL OR A.account_id = 0) AND - (A.date_reserved IS NULL OR A.date_reserved = 0) AND "; - if(is_array($plugins)) - $sql .= "A.voip_did_plugin_id in (".join(",",$plugins).") AND "; - $sql .= "A.site_id=".DEFAULT_SITE." ORDER BY B.locName"; - } else { - $sql = "select distinct A.npa,A.nxx,B.locName,B.locState from {$p}voip_pool AS A inner join {$p}voip_npa_nxx AS B on - (A.npa=B.npa and A.nxx=B.nxx and B.country_code='1') - WHERE (A.account_id IS NULL OR A.account_id = 0) AND - (A.date_reserved IS NULL OR A.date_reserved = 0) AND "; - if(is_array($plugins)) - $sql .= "A.voip_did_plugin_id in (".join(",",$plugins).") AND "; - $sql .= "A.site_id=".DEFAULT_SITE." ORDER BY B.locName"; - } - # echo "document.write('".str_replace("'","\\'",str_replace("\n","",$sql))."');"; - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - $this->data[] = $rs->fields; - $rs->MoveNext(); - } - } - } - - function getArea() - { - if(!is_array($this->data)) return false; - $row = each($this->data); - if($row === false) { reset($this->data); return false; } - return new didArea($this->cc, $row[1]); - } -} - -class didCountry -{ - var $data; - - function didCountry($row) - { - $this->data = $row; - } - - function getAreas($plugin = false) - { - return new didAreas($this->data['country_code'],$plugin); - } - - function getCode() - { - return $this->data['country_code']; - } - - function getName() - { - return $this->data['name']; - } -} - -class didCountries -{ - var $data; - var $did_plugin_ids; - - function didCountries($pluginArray) - { - $this->did_plugin_ids = $pluginArray; - $p = AGILE_DB_PREFIX; - $db =& DB(); - $sql = "select distinct a.country_code,c.id,c.code,c.name from {$p}voip_pool as b - left join {$p}voip_iso_country_code_map as a on (a.country_code=b.country_code) - left join {$p}voip_iso_country_code as c on (a.iso_country_code=c.code) - where (account_id IS NULL or account_id=0) - and (b.date_reserved IS NULL or b.date_reserved = 0 ) - and c.site_id=".DEFAULT_SITE." AND b.site_id=".DEFAULT_SITE." and a.site_id=".DEFAULT_SITE; - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - $this->data[] = $rs->fields; - $rs->MoveNext(); - } - } - #echo "
".print_r($this->data,true)."
"; - reset($this->data); - } - - function getCountry() - { - $row = each($this->data); - if($row === false) { reset($this->data); return false; } - return new didCountry($row[1]); - } -} - - -class DateFunc { - - function day_of_week( $m, $d, $y ) { - // Calculate the day of the week, with sat. starting it - $r = date('w',mktime(0,0,0,$m,$d,$y)); - // As r stands above, sun=0 sat=6 - $r = $r + 1; - if( $r > 6 ) - $r = 0; - // now sun=6 sat=0 - return $r; - } - - function dow( $m, $d, $y ) { - $a = $this->day_of_week( $m, $d, $y ); - - switch( $a ) { - case 0: - return "SA"; - case 1: - return "SU"; - case 2: - return "MO"; - case 3: - return "TU"; - case 4: - return "WE"; - case 5: - return "TH"; - case 6: - return "FR"; - } - } - - function week_of_year( $m, $d, $y ) { - // Calculate the week of the year, using Saturdays... - $day = date('z',mktime(0,0,0,$m,$d,$y) ) + 1; - $wday= $this->day_of_week($m,$d,$y) + 1; - $week = 0; - - while( $day > 0 ) { - $wday = $wday - 1; - $day = $day - 1; - if( $wday < 0 ) { - $wday = $wday + 7; - $week = $week + 1; - } - } - return $week; - } - - function get_range_begin( $m, $d, $y ) { - // First valid date in the week (always a Sat) - return mktime(0,0,0,$m,($d+(6-$this->day_of_week($m,$d,$y)))-6,$y); - } - - function get_range_end( $m, $d, $y ) { - // End valid date in a week (always a Fri) - return mktime(0,0,0,$m,($d+(6-$this->day_of_week($m,$d,$y))),$y); - } - - function getWeekArray() { - $cwn = $this->week_of_year(date('m'),date('d'),date('Y')); - $ts = mktime(0,0,0,date('m'),date('d'),date('Y')); - $n = 0; - for( $i=$cwn; $n<16; $i-- ) { - $j = $i; - if( $j > 52 ) - $j = abs(53 - $j) + 1; - else if( $j < 1 ) - $j = 53 + $j; - $ret[$n]['text'] = "Week #$j " . date(UNIX_DATE_FORMAT,$this->get_range_begin(date('m',$ts),date('d',$ts),date('Y',$ts))) . " through " . date(UNIX_DATE_FORMAT,$this->get_range_end(date('m',$ts),date('d',$ts),date('Y',$ts))); - $ret[$n]['begin'] = $this->get_range_begin(date('m',$ts),date('d',$ts),date('Y',$ts)); - $ret[$n]['end'] = $this->get_range_end(date('m',$ts),date('d',$ts),date('Y',$ts)); - $ret[$n]['week'] = $j; - - $n++; - $ts = $ts - (86400 * 7); - } - return $ret; - } - - function getNumberOfDays($date1, $date2) { - # Correct parameters if needed. - if($date2<$date1) { - $tmp = $date1; - $date1 = $date2; - $date2 = $tmp; - } - # Get the year, month, day values of the two dates - #$d1[0] = date('Y',$date1); #substr($date1,0,4); - #$d1[1] = date('m',$date1); #substr($date1,4,2); - #$d1[2] = date('d',$date1); #substr($date1,6,2); - #$d2[0] = date('Y',$date2); #substr($date2,0,4); - #$d2[1] = date('m',$date2); #substr($date2,4,2); - #$d2[2] = date('d',$date2); #substr($date2,6,2); - - # Construct UNIX timestamps based on the original dates - $date1 = mktime(0,0,0, date('m',$date1), date('d',$date1), date('Y',$date1)); - $date2 = mktime(0,0,0, date('m',$date2), date('d',$date2), date('Y',$date2)); - #print "date1=".date('Ymd',$date1)."
date2=".date('Ymd',$date2)."
"; exit; - $tmp = $date1; - $y = date('Y',$date1); - $m = date('m',$date1); - $d = date('d',$date1); - $days = 0; - - # Increments $tmp one day at a time until it matches $date2 - while ($tmp != $date2) { - $d++; - $tmp = mktime(0,0,0, date($m), date($d), date($y)); - $days++; - #echo "tmp=$tmp date2=$date2 m=$m d=$d y=$y
"; - #if($d>30) break; - } # while - - # Returns the number of increments for the dates to match - return $days; - } -} - - -class voip -{ - var $voip_intrastate; - var $voip_default_prefix; - var $perform_normalization; - var $normalization_min_len; - - /** - * Handle the click to call feature. This is complex as apache/php runs as wwwadmin, so this may need an additional layer - * to allow asterisk to receive the call file as owner root. - */ - function place_call($VAR) - { - global $C_debug; - - # gimmie temp file - $file = tempnam("/tmp","clicktocall-").".call"; - $C_debug->alert("Placing Call, please answer your phone when it rings and the call will then be completed."); - - $fp = fopen($file, "w"); - fwrite($fp,"Channel: ".$VAR['voip_from']."\n"); - fwrite($fp,"MaxRetries: 0\n"); - fwrite($fp,"RetryTime: 60\n"); - fwrite($fp,"WaitTime: 20\n"); - fwrite($fp,"Callerid: \"Click to Crash\" <".$VAR['voip_callerid'].">\n"); - fwrite($fp,"Context: international\n"); - fwrite($fp,"Extension: ".$VAR['voip_to']."\n"); - fwrite($fp,"Priority: 1\n"); - fclose($fp); - chmod($file,0777); - - system("mv -f ".escapeshellarg($file)." /var/spool/asterisk/outgoing/"); - } - - /** - * Given a country code and possible NPA/NXX, determine where in the world we're at. - */ - function where_is(&$db, $countrycode, $npa, $nxx) - { - if ($countrycode == 1) { - # We are in the USA, use npa/nxx lookup - if ($npa == "800" || $npa == "866" || $npa == "877" || $npa == "888") - return "Toll-free"; - $rs =& $db->Execute("SELECT locName, locState FROM ".AGILE_DB_PREFIX."voip_npa_nxx WHERE country_code='1' and npa=".$db->qstr($npa)." and nxx=".$db->qstr($nxx)); - if ($rs && $rs->RecordCount()) - return $rs->fields[0].", ".$rs->fields[1]; - else - return "Unknown"; - } else { - /* - mysql> describe ab_voip_iso_country_code_map; - +------------------+-------------+------+-----+---------+-------+ - | Field | Type | Null | Key | Default | Extra | - +------------------+-------------+------+-----+---------+-------+ - | id | int(11) | | PRI | 0 | | - | country_code | varchar(16) | | MUL | | | - | iso_country_code | char(3) | | | | | - | iso_sub_code | char(3) | | | | | - +------------------+-------------+------+-----+---------+-------+ - 4 rows in set (0.00 sec) - - mysql> describe ab_voip_iso_country_code; - +-------+-------------+------+-----+---------+-------+ - | Field | Type | Null | Key | Default | Extra | - +-------+-------------+------+-----+---------+-------+ - | id | int(11) | | PRI | 0 | | - | code | char(3) | | UNI | | | - | name | varchar(64) | | | | | - +-------+-------------+------+-----+---------+-------+ - 3 rows in set (0.00 sec) - */ - $sql = "SELECT b.name FROM ".AGILE_DB_PREFIX."voip_iso_country_code_map a left join ".AGILE_DB_PREFIX."voip_iso_country_code b - on (a.iso_country_code=b.code) - WHERE a.country_code like ".$db->qstr($countrycode."%"); - $rs =& $db->Execute($sql); - if ($rs && $rs->RecordCount()) - return $rs->fields[0]; - else return "Unknown"; - } - return "Unknown"; - } - - /** - * Given a DID, returns the e.164 representation and the country code with possible npa/nxx if USA. If successful, - * a true is returned, otherwise false is returned. - * - * @param $number Input telephone number - * @param $e164 Output cleaned number in E.164 format - * @param $countrycode Output country code designator - * @param $npa Output NPA code if USA country - * @param $nxx Output NXX code if USA country - */ - function e164($number, &$e164, &$countrycode, &$npa, &$nxx) - { - if(function_exists('agileco_e164')) { - if(($r = agileco_e164($number,$this->voip_default_prefix)) === false) - return false; - $e164 = $r['e164']; - $countrycode = $r['country_code']; - $npa = $r['npa']; - $nxx = $r['nxx']; - #echo "
".print_r($r, true)."
"; - return true; - } - $e164 = ""; $countrycode = ""; $npa = ""; $nxx = ""; - - if (preg_match("/[a-zA-Z]/",$number)) return false; - if (!strncmp($number, "+", 1)) { - # if the number has a leading plus, strip it. - $number = substr($number,1); - } - if (strlen($number) == 7) { - # USA local dialing, need to prefix the country code and local npa - $e164 = "+1".$this->voip_default_prefix.$number; - } - if (!strncmp($number, "0111", 4)) { - # Screwed up USA call, strip the international prefixing - $e164 = "+".substr($number, 3); - } - /* UK Specific hack */ - if (!strncmp($number, "44", 2)) { - $e164 = "+011".$number; - } - if (!strncmp($number, "0", 1) && strlen($number) == 11) { - $e164 = "+01144".$number; - } - /* End UK Specific hack */ - if (strlen($number) == 10 && strncmp($number,"011",3)) { - # USA Call without the country code selection - $e164 = "+1".$number; - } - /* Aus specific hack */ - if (!strncmp($number, "61", 2)) { - $e164 = "+011" . $number; - // print $e164; - $npa = substr($e164, 6, 2); - $nxx = substr($e164, 8, 4); - } - /* End Aus specific hack */ - if ($e164 == "") { - $e164 = "+".$number; - } - - # ok, cleaned the number. Now, what's the country code? - if (!strncmp($e164, "+011", 4)) { - # international - $countrycode = $this->parse_country_code($e164); - } else { - # USA - $countrycode = "1"; - $npa = substr($e164, 2, 3); - $nxx = substr($e164, 5, 3); - } - if (strlen($countrycode) && strlen($number)) - return true; - return false; - } - - - /** - * Parses the E.164 number for a correct country code. NOTE: Doesn't handle the USA right. Returns the country code. - * Example: +011xxxxxxx - */ - function parse_country_code($e164) - { - if(function_exists('agileco_parse_country_code')) { - #echo 'calling agileco_parse_country_code!
'; - return agileco_parse_country_code($e164); - } - $numdigs = 2; - $d1 = substr($e164, 4, 1); - $d2 = substr($e164, 5, 1); - switch ($d1) { - case '1': - case '7': - $numdigs = 1; - break; - case '2': - if ($d2 != '0' && $d2 != '7') { - $numdigs = 3; - } - break; - case '3': - if ($d2 == '5' || $d2 == '7' || $d2 == '8') { - $numdigs = 3; - } - break; - case '4': - if ($d2 == '2') { - $numdigs = 3; - } - break; - case '5': - if ($d2 == '0' || $d2 == '9') { - $numdigs = 3; - } - break; - case '6': - if ($d2 >= 7) { - $numdigs = 3; - } - break; - case '8': - if ($d2 == '0' || $d2 == '3' || $d2 == '5' || $d2 == '7') { - $numdigs = 3; - } - break; - case '9': - if ($d2 == '6' || $d2 == '7' || $d2 == '9') { - $numdigs = 3; - } - break; - default: - $numdigs = 0; - break; - } - - if ($d2<0 || $d2>9) { - $numdigs = 0; - } else { - if (strlen($e164) < $numdigs) { - $numdigs = 0; - } - } - if ($numdigs) { - return substr($e164, 4, $numdigs); - } - return ""; - } - - /** - * Get the activity for the week needed - */ - function activity($VAR) { - global $smarty; - - $fdids = $this->get_fax_dids(SESS_ACCOUNT); - $dt = new DateFunc; - if (empty($VAR['wnum'])) - $wnum = $dt->week_of_year(date('m'),date('d'),date('Y')); - else - $wnum = $VAR['wnum']; - - $smarty->assign('wnum',$wnum); - $weeks = $dt->getWeekArray(); - $wtext[] = "-- Please Select --"; - foreach ($weeks as $w) { - $wtext[$w['week']] = $w['text']; - if ($w['week'] == $wnum) { - $b = $w['begin']; - $e = $w['end']; $e+=86400; - } - } - - $smarty->assign('weeks', $wtext); - - $db=&DB(); - $p=AGILE_DB_PREFIX; - - // get dids - $sql_in=''; - $sql_out=''; - $dids = $this->get_all_dids(SESS_ACCOUNT); - $dids = $this->normalize_dids($dids); - - if(count($dids)>0) { - foreach($dids as $did) { - if($sql_in!='') { - $sql_in .= ' OR '; - $sql_out .= ' OR '; - } - $sql_in .= " dst = $did "; - $sql_out .= " src = $did "; - if(strncmp($did,"1",1) && strncmp($did,"0",1)) { - $sql_in .= " OR dst = ".$db->qstr("1".$did)." "; - $sql_out .= " OR src = ".$db->qstr("1".$did)." "; - } - } - } else { - $rs =& $db->Execute(sqlSelect($db,"account","username","id=".SESS_ACCOUNT)); - $sql_out = "accountcode=::".$rs->fields[0]."::"; - } - # gather prepaid account pins - $pins = array(); - $rs =& $db->Execute(sqlSelect($db,"voip_prepaid","pin","account_id=".SESS_ACCOUNT)); - while ($rs && !$rs->EOF) { - $pins[] = $rs->fields[0]; - $rs->MoveNext(); - } - foreach ($pins as $pin) { - if ($sql_out!='') { - $sql_out .= ' OR '; - } - if ($sql_in!='') { - $sql_in .= ' OR '; - } - $sql_out .= " accountcode=::cc:".$pin.":: "; - $sql_in .= " dst = ::".$pin.":: "; - } - - # Get currency - $rs =& $db->Execute($sql=sqlSelect($db,"currency","symbol","id=".DEFAULT_CURRENCY)); - $smarty->assign('currency', $rs->fields[0]); - - # Get last 25 incoming: - $rs =& $db->Execute(sqlSelect($db,"voip_cdr","date_orig, clid, src, dst, ceiling(duration/60) as duration, amount, lastapp"," ( $sql_in ) AND (lastapp='Dial' or lastapp='VoiceMail' or lastapp='MeetMe' or lastapp='Hangup') AND disposition='ANSWERED' AND account_id = ".SESS_ACCOUNT." AND date_orig>=$b AND date_orig<=$e","date_orig DESC")); - if($rs && $rs->RecordCount() > 0) { - $i = 0; - while(!$rs->EOF) { - $in[$i]=$rs->fields; - if (strcasecmp($rs->fields['lastapp'], 'VoiceMail') == 0) - $in[$i]['type'] = 'v'; - else if (in_array($rs->fields['dst'], $fdids)) - $in[$i]['type'] = 'f'; - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->e164($rs->fields['src'], $e164, $cc, $npa, $nxx)) { - $in[$i]['location'] = $this->where_is($db, $cc, $npa, $nxx); - } - $i++; - $rs->MoveNext(); - } - } - - # Get last 25 outgoing: - $rs =& $db->Execute($sql = sqlSelect($db,"voip_cdr","date_orig, clid, dst, ceiling(duration/60) as duration, amount, lastapp"," ( $sql_out ) AND (lastapp='Dial' or lastapp='VoiceMail' or lastapp='MeetMe' or lastapp='Hangup') AND disposition='ANSWERED' AND account_id = ".SESS_ACCOUNT." AND date_orig>=$b AND date_orig<=$e","date_orig DESC")); - if($rs && $rs->RecordCount() > 0) { - $i = 0; - while(!$rs->EOF) { - $out[$i]=$rs->fields; - if (strcasecmp($rs->fields['lastapp'], 'VoiceMail') == 0) - $out[$i]['type'] = 'v'; - foreach ($pins as $pin) { - if (strcmp($rs->fields['accountcode'], "cc:".$pin)==0) { - $out[$i]['type'] = 'c'; - } - } - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->e164($rs->fields['dst'], $e164, $cc, $npa, $nxx)) { - $out[$i]['location'] = $this->where_is($db, $cc, $npa, $nxx); - } - $i++; - $rs->MoveNext(); - } - } - - $smarty->assign('in', $in); - $smarty->assign('out', $out); - } - - function normalize_dids($dids) - { - foreach($dids as $did) { - $out[] = $did; - if(!strncmp($did,"011",3)) - $out[] = substr($did,3); - if(!strncmp($did,"1",1)) - $out[] = substr($did,1); - } - return $out; - } - - /** - * Get the last 25 placed and received calls for the user - * @todo Get some call statistics daily/weekly/monthly for the user - */ - function overview($VAR) { - global $smarty; - - // validate logged in - if(!SESS_LOGGED) return false; - - $fdids = $this->get_fax_dids(SESS_ACCOUNT); - // get dids - $sql_in=''; - $sql_out=''; - $dids = $this->get_all_dids(SESS_ACCOUNT); - $dids = $this->normalize_dids($dids); - - $db=&DB(); - $p=AGILE_DB_PREFIX; - if(count($dids)>0) { - foreach($dids as $did) { - if($sql_in!='') { - $sql_in .= ' OR '; - $sql_out .= ' OR '; - } - $sql_in .= " dst = ".$db->qstr($did)." "; - $sql_out .= " src = ".$db->qstr($did)." "; - if(strncmp($did,"1",1) && strncmp($did,"0",1)) { - $sql_in .= " OR dst = ".$db->qstr("1".$did)." "; - $sql_out .= " OR src = ".$db->qstr("1".$did)." "; - } - } - } else { - $rs =& $db->Execute(sqlSelect($db,"account","username","id=".SESS_ACCOUNT)); - $sql_out = "accountcode=::".$rs->fields[0]."::"; - } - # gather prepaid account pins - $pins = array(); - $rs =& $db->Execute(sqlSelect($db,"voip_prepaid","pin","account_id=".SESS_ACCOUNT)); - while ($rs && !$rs->EOF) { - $pins[] = $rs->fields[0]; - $rs->MoveNext(); - } - foreach ($pins as $pin) { - if ($sql_out!='') { - $sql_out .= ' OR '; - } - if ($sql_in!='') { - $sql_in .= ' OR '; - } - $sql_out .= " accountcode=::cc:".$pin.":: "; - $sql_in .= " dst = ::".$pin.":: "; - } - - # Get last 25 incoming: - $rs =& $db->Execute(sqlSelect($db,"voip_cdr","id, date_orig, clid, src, dst, ceiling(duration/60) as duration, lastapp"," ( $sql_in ) AND (lastapp='Dial' or lastapp='VoiceMail' or lastapp='MeetMe' or lastapp='Hangup') AND disposition='ANSWERED' AND account_id = ".SESS_ACCOUNT,"date_orig DESC LIMIT 25",25)); - if($rs && $rs->RecordCount() > 0) { - $i = 0; - while(!$rs->EOF) { - $in[$i]=$rs->fields; - if (strcasecmp($rs->fields['lastapp'], 'VoiceMail') == 0) - $in[$i]['type'] = 'v'; - else if (in_array($rs->fields['dst'], $fdids)) - $in[$i]['type'] = 'f'; - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->e164($rs->fields['src'], $e164, $cc, $npa, $nxx)) { - $in[$i]['location'] = $this->where_is($db, $cc, $npa, $nxx); - } - $i++; - $rs->MoveNext(); - } - } - #echo "\n\n\n\n"; - - # Get last 25 outgoing: - $rs =& $db->Execute(sqlSelect($db,"voip_cdr","id, accountcode, date_orig, clid, dst, ceiling(duration/60) as duration, lastapp"," ( $sql_out ) AND (lastapp='Dial' or lastapp='VoiceMail' or lastapp='MeetMe' or lastapp='Hangup') AND disposition='ANSWERED' AND account_id = ".SESS_ACCOUNT,"date_orig DESC LIMIT 25",25)); - if($rs && $rs->RecordCount() > 0) { - $i = 0; - while(!$rs->EOF) { - $out[$i]=$rs->fields; - if (strcasecmp($rs->fields['lastapp'], 'VoiceMail') == 0) - $out[$i]['type'] = 'v'; - foreach ($pins as $pin) { - if (strcmp($rs->fields['accountcode'], "cc:".$pin)==0) { - $out[$i]['type'] = 'c'; - } - } - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->e164($rs->fields['dst'], $e164, $cc, $npa, $nxx)) { - $out[$i]['location'] = $this->where_is($db, $cc, $npa, $nxx); - } - $i++; - $rs->MoveNext(); - } - } - - - echo $sql; - - $smarty->assign('in', $in); - $smarty->assign('out', $out); - } - - - /** - * Get user features for selected did - */ - function features($VAR) { - - // validate logged in - if(!SESS_LOGGED) return false; - - global $smarty; - - // get the selected did - if(!empty($VAR['voip_did_id']) && is_numeric($VAR['voip_did_id'])) - { - $smart=$this->get_auth_did($VAR['voip_did_id']); - $smarty->assign('record',$smart); - } - else - { - $dids = $this->get_all_dids(SESS_ACCOUNT); - if(is_array($dids)) $dids = $dids[0]; - if(!$dids) return false; - $smart=$this->get_auth_did($dids); - $smarty->assign('record',$smart); - } - } - - /** - * verify that a specific did is validated for the current account - */ - function get_auth_did($did) { - $db=&DB(); - if($did) $sql = "id = ::$did:: AND "; else $did =''; - $rs = & $db->Execute($sql=sqlSelect($db,"voip_did","*","$sql account_id = ".SESS_ACCOUNT)); - - if($rs && $rs->RecordCount()>0) { - // get the voicemail email setting - if(!empty($rs->fields['voicemailenabled'])) { - $vm = & $db->Execute($sql = sqlSelect($db,"voip_vm","email","mailbox = ::{$rs->fields['did']}:: AND account_id = ".SESS_ACCOUNT)); - $rs->fields['vm_email'] = $vm->fields['email']; - } - // is callwaiting enabled or disabled - $callwaiting = 1; - $cw =& $db->Execute($sql=sqlSelect($db,"voip_sip","data","keyword=::incominglimit:: and sip=::".$rs->fields['did']."::")); - if(!empty($cw->fields['data'])) { - if($cw->fields['data'] == 1) { - $callwaiting = 0; - } - } - $rs->fields['sip_callwaiting'] = $callwaiting; - return $rs->fields; - } else { - return false; - } - } - - /** - * Update user features for selected did - */ - function update_features($VAR) { - if(!SESS_LOGGED) return false; - - // get the selected did - if(!empty($VAR['voip_did_id']) && is_numeric($VAR['voip_did_id'])) - { - if($flds = $this->get_auth_did($VAR['voip_did_id'])) - { - $fields['voicemailafter'] = @$VAR['voip_voicemailafter']; - $fields['callforwardingenabled'] = @$VAR['voip_callforwardingenabled']; - $fields['cfringfor'] = @$VAR['voip_cfringfor']; - $fields['cfnumber'] = @$VAR['voip_cfnumber']; - $fields['busycallforwardingenabled']= @$VAR['voip_busycallforwardingenabled']; - $fields['bcfnumber'] = @$VAR['voip_bcfnumber']; - $fields['faxemail'] = @$VAR['voip_faxemail']; - $fields['failovernumber'] = @$VAR['voip_failovernumber']; - $fields['remotecallforwardnumber'] = @$VAR['voip_remotecallforwardnumber']; - $db=&DB(); - $rs = & $db->Execute($sql=sqlUpdate($db,"voip_did",$fields,"id = ::{$flds['id']}::")); - - if(!empty($VAR['voip_vm_email']) && !empty($flds['voicemailenabled'])) { - $fields2['email'] = $VAR['voip_vm_email']; - $rs = & $db->Execute($sql = sqlUpdate($db,"voip_vm",$fields2,"mailbox = ::{$flds['did']}:: AND account_id = ".SESS_ACCOUNT)); - } - - # update the call waiting setting - if(!empty($VAR['sip_callwaiting'])) { - # delete the incominglimit - $sql = "DELETE FROM ".AGILE_DB_PREFIX."voip_sip WHERE sip=".$flds['did']." and keyword='incominglimit' and site_id=".DEFAULT_SITE; - $db->Execute($sql); - } else { - $f['data'] = "1"; - $f['keyword'] = "incominglimit"; - $f['sip'] = $flds['did']; - $sql = sqlInsert($db, "voip_sip", $f); - $db->Execute($sql); - } - } - } - } - - // get available parent service ids - function menu_parent_service($VAR) { - - if(!empty($VAR['account_id'])) - $account_id = $VAR['account_id']; - else - $account_id = SESS_ACCOUNT; - - $db=&DB(); - $rs=&$db->Execute($sql=sqlSelect($db,array("voip_did","service"),"A.id,A.service_id,A.did","A.service_id = B.id AND (A.rxfax=0 or A.rxfax is null) AND (A.conf=0 or A.conf is null) AND (A.remotecallforward=0 or A.remotecallforward is null) AND B.active=1 AND B.account_id=".$account_id,false,false,"DISTINCT")); - if($rs && $rs->RecordCount() > 0) { - - $return = ''; - echo $return; - } else { - echo "No associated accounts found"; - } - } - - - // function - function get_did_plugin_countries($id, &$plugins) { - $countries = false; - $db=&DB(); - $rs = & $db->Execute($sql=sqlSelect($db,"product","prod_plugin_data","id = ::$id::")); - - if($rs && $rs->RecordCount() > 0) { - @$plugin = unserialize($rs->fields['prod_plugin_data']); - @$plugins = $plugin['voip_did_plugins']; - - if(is_array($plugins) && count($plugins > 0)) { - $sql = ''; - foreach($plugins as $key=>$plgid) { - if($sql!='') $sql .= " OR "; - $sql .= " id = $plgid "; - } - $rs = & $db->Execute(sqlSelect($db,"voip_did_plugin","avail_countries","( $sql )")); - if($rs && $rs->RecordCount() > 0) { - while(!$rs->EOF) { - $carr = unserialize($rs->fields['avail_countries']); - foreach($carr as $cid) $countries["$cid"] = $cid; - $rs->MoveNext(); - } - } - } else { - $plugins = array(); - } - } - return $countries; - } - - // get available countries - function menu_countries($VAR) { - header('Pragma: no-cache'); - header('Cache-Control: no-cache, must-revalidate'); - - if(!$did_plugins = $this->get_did_plugin_countries($VAR['id'],$plugins)) { - echo '-- No Countries --'; - return; - } - - $countries = new didCountries($plugins); - $js = ''; - echo $js; - } - - - // - function menu_states($VAR) - { - header('Pragma: no-cache'); - header('Cache-Control: no-cache, must-revalidate'); - $did_plugins = $this->get_did_plugin_countries($VAR['id'],$plugins); - - $areas = new didAreas(1,$plugins); - #echo "
".print_r($areas,true)."
"; - $areas_seen = array(); - $js = ''; - echo $js; - } - - // return location menu - function menu_location($VAR) - { - header('Pragma: no-cache'); - header('Cache-Control: no-cache, must-revalidate'); - $did_plugins = $this->get_did_plugin_countries($VAR['id'],$plugins); - - $cc = 1; - if(!empty($VAR['country'])) - $cc = $VAR['country']; - #echo "alert('$cc');"; exit; - $areas = new didAreas($cc,$plugins); - $js = 'menuClearOptions("voip_location");'; - $js .= "menuAppendOption('voip_location', '', '-- Select A Location --');"; - $count = 0; - while($area = $areas->getArea()) { - if($cc==61) { - $js .= "menuAppendOption('voip_location', '{$cc}:".$area->getNpa()."-".$area->getNxx()."', '".$area->getName()." (".$area->getNpa()."-".$area->getNxx().")');"; - } - elseif($cc!=1) { - $js .= "menuAppendOption('voip_location', '{$cc}:".$area->getAreacode()."', '".$area->getName()." (".$area->getAreacode().")');"; - } else if($area->data['locState']==$VAR['state']) { - $js .= "menuAppendOption('voip_location', '".$area->getNpa()."-".$area->getNxx()."', '".$area->getName()." (".$area->getNpa()."-".$area->getNxx().")');"; - } - $count++; - } - if($count) - echo $js; - else - echo 'document.write("Sorry, none available at this time. Please check again later.");'; - return; - } - - - // return location menu - function menu_station($VAR) - { - header('Pragma: no-cache'); - header('Cache-Control: no-cache, must-revalidate'); - $did_plugins = $this->get_did_plugin_countries($VAR['id'],$plugins); - #echo "alert(\"".str_replace("\n","\\\n",str_replace("\"","\\\"",print_r($VAR,true)))."\");";return; - - #if(empty($VAR['location']) && empty($VAR['country'])) return false; - $l = $VAR['location']; - if (strchr($l,':')) { - $cn = explode(':', $l); - $data['country_code'] = $cn[0]; - if($cn[0] == '61') { - $cn = explode('-', $cn[1]); - $data['npa'] = $cn[0]; - $data['nxx'] = $cn[1]; - } else { - $data['areacode'] = $cn[1]; - } - } else { - $cn = explode('-', $l); - $data['country_code'] = 1; - $data['npa'] = $cn[0]; - $data['nxx'] = $cn[1]; - } - $area = new didArea($data['country_code'], $data); - #echo "alert(\"".str_replace("\n","\\\n",str_replace("\"","\\\"",print_r($area,true)))."\");"; return; - - $js = 'menuClearOptions("voip_station"); '; - $js .= "menuAppendOption('voip_station', '', '-- Select A Station --'); "; - $dids = $area->getStations($plugins); - #echo "alert(\"".str_replace("\n","\\\n",str_replace("\"","\\\"",print_r($dids,true)))."\");"; return; - foreach($dids as $did) { - #if($data['country_code'] == 1) { - $js .= "menuAppendOption('voip_station', '".$did[0]."', '{$did[1]}'); "; - #} else { - # ; - #} - } - echo $js; - return; - - $db=&DB(); - $p = AGILE_DB_PREFIX; - if(!empty($VAR['location'])) - { - - $l = $VAR['location']; - if(eregi(':', $l)) // passed country_code:region - { - $cn = explode(':', $l); - $ccode = $cn[0]; - $npa = $cn[1]; - - $sql = "select distinct left(A.station,4) as npa,B.locName, station from {$p}voip_pool AS A - inner join {$p}voip_npa_nxx AS B on (left(A.station,4)=B.npa AND - A.country_code='{$ccode}' AND B.country_code='{$ccode}' AND B.npa='{$npa}') - WHERE (A.account_id IS NULL OR A.account_id = 0) AND - (A.date_reserved IS NULL OR A.date_reserved = 0) AND - A.voip_did_plugin_id in (".join(",",$plugins).") AND - A.site_id=".DEFAULT_SITE." ORDER BY B.locName LIMIT 0,50"; - // loop through results - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount() > 0) { - while(!$rs->EOF) { - if(!empty($rs->fields["station"])) - $js .= "menuAppendOption('voip_station', '011". $ccode . $rs->fields["station"]."', '{$ccode} {$rs->fields["station"]}'); "; - $rs->MoveNext(); - } - } else { - $js = 'document.write("Sorry, none available at this time. Please check again later.");'; - } - } else { - $np=explode('-',$l); // passed npa-nxx - $npa=$np[0]; - $nxx=$np[1]; - $sql = "select distinct A.country_code,A.npa,A.nxx,A.station - FROM {$p}voip_pool AS A - left join {$p}voip_npa_nxx AS B - on (A.npa=B.npa and A.nxx=B.nxx AND B.country_code='1') - WHERE (A.account_id IS NULL OR A.account_id = 0) - AND (A.date_reserved IS NULL OR A.date_reserved = 0) - AND A.npa = " . $db->qstr($npa) . " - AND A.nxx = " . $db->qstr($nxx) . " - AND A.voip_did_plugin_id in (".join(",",$plugins).") - AND A.site_id=".DEFAULT_SITE." - LIMIT 0,50"; - - // loop through results - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount() > 0) { - while(!$rs->EOF) { - if(!empty($rs->fields["station"])) - $js .= "menuAppendOption('voip_station', '". $rs->fields["country_code"].$rs->fields["npa"].$rs->fields["nxx"].$rs->fields['station'] ."', '{$rs->fields["npa"]}-{$rs->fields["nxx"]}-{$rs->fields["station"]}'); "; - $rs->MoveNext(); - } - } else { - $js = 'document.write("Sorry, none available at this time. Please check again later.");'; - } - } - } - else - { - $country = $VAR['country']; - $sql = "SELECT DISTINCT B.country_code, B.station from {$p}voip_pool AS B - LEFT JOIN {$p}voip_iso_country_code_map AS A ON (B.country_code=A.country_code) - WHERE ( account_id IS NULL or account_id = 0) - AND ( B.date_reserved IS NULL or B.date_reserved = 0 ) - AND A.iso_country_code=".$db->qstr($country)." - AND B.voip_did_plugin_id in (".join(",",$plugins).") - and A.site_id=".DEFAULT_SITE." AND B.site_id=".DEFAULT_SITE." - LIMIT 0,50"; - - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount() > 0) { - while(!$rs->EOF) { - if(!empty($rs->fields["station"])) - $js .= " menuAppendOption('voip_station', '011". $rs->fields["country_code"] . $rs->fields["station"] ."', '{$rs->fields["country_code"]}{$rs->fields["station"]}'); "; - $rs->MoveNext(); - } - } else { - $js = 'document.write("Sorry, none available at this time. Please check again later.");'; - } - } - - echo $js; - ob_end_flush(); - return true; - } - - /** Returns the fields from voip_pool for a given DID entry. - */ - function get_did_e164($did) - { - $db =& DB(); - - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($this->e164($did, $e164, $cc, $npa, $nxx)) { - if ($cc == '1') { - $station = substr($e164, 8); - $where = "country_code=1 and npa=::$npa:: and nxx=::$nxx:: and station=::$station::"; - } elseif ($cc == '61') { - $station = substr($e164, 12); - $where = "country_code=61 and npa=::$npa:: and nxx=::$nxx:: and station=::$station::"; - } else { - $station = substr($e164, 4 + strlen($cc)); - $where = "country_code=::$cc:: and station=::$station::"; - } - $rs = $db->Execute(sqlSelect($db, "voip_pool", "*", $where)); - if (!$rs) return false; - return $rs->fields; - } - return false; - } - - /** Save the configuration. - */ - function config($VAR) - { - global $C_debug; - $db = & DB(); - - # define the validation class - include_once(PATH_CORE . 'validate.inc.php'); - $validate = new CORE_validate; - $arr['min_len'] = 4; - $arr['max_len'] = 4; - - if(is_numeric($VAR['voip_vm_passwd']) && !empty($VAR['voip_intrastate'])) - { - $fields['voip_vm_passwd'] = $VAR['voip_vm_passwd']; - $fields['voip_intrastate'] = $VAR['voip_intrastate']; - $fields['voip_secret_gen'] = $VAR['voip_secret_gen']; - $fields['voip_default_prefix'] = $VAR['voip_default_prefix']; - $fields['prepaid_low_balance'] = $VAR['prepaid_low_balance']; - $fields['auth_domain'] = $VAR['auth_domain']; - $fields['perform_normalization'] = $VAR['perform_normalization']; - $fields['normalization_min_len'] = $VAR['normalization_min_len']; - $rs = $db->Execute( sqlSelect($db, "voip", "id", "site_id=::".DEFAULT_SITE."::") ); - if ($rs && !$rs->EOF) { - $db->Execute( sqlUpdate($db, "voip", $fields, "site_id=::".DEFAULT_SITE."::") ); - } else { - $db->Execute( sqlInsert($db, "voip", $fields) ); - } - $C_debug->alert("Saved!"); - } else { - $C_debug->alert("Problems while saving:".$db->ErrorMsg()); - } - } - - /** Load the configuration variables into smarty - */ - function config_get($VAR) - { - global $smarty; - $db = & DB(); - $sql = sqlSelect($db, "voip", "*", ""); - $rs = $db->Execute($sql); - $smarty->assign('config',$rs->fields); - } - - /** Return all available DIDs the customer owns. - * @param $account_id: The account to return dids for - */ - function get_all_dids($account_id) - { - return $this->get_all_dids_internal($account_id, 0); - } - - /** Return all DIDs with voice mail active. - * @param $account_id: The account to return dids for - */ - function get_voicemail_dids($account_id) - { - return $this->get_all_dids_internal($account_id, 1); - } - - /** Return all DIDs with fax active. - * @param $account_id: The account to return dids for - */ - function get_fax_dids($account_id) - { - return $this->get_all_dids_internal($account_id, 2); - } - - /** Internal function used to gather an accounts available DIDs. - * @param $VAR The AB passed array - * @param $filter A flag to specify the type of DIDs to return. 0=ALL, 1=VM, 2=FAX, 3=CONFERENCE - */ - function get_all_dids_internal($account_id, $filter) - { - $db = & DB(); - $rs = & $db->Execute($sql=sqlSelect($db,"voip_did","did,voicemailenabled,rxfax,conf","active=1 AND account_id = ::$account_id::")); - #echo $sql; - $dids = array(); - if ($rs && $rs->RecordCount() > 0) { - while (!$rs->EOF) { - $did = $rs->fields['did']; - switch ($filter) { - case 0: //ALL - array_push($dids, $did); - break; - case 1: - if ($rs->fields['voicemailenabled']) { //VM - array_push($dids, $did); - } - break; - case 2: - if ($rs->fields['rxfax']) { //FAX - array_push($dids, $did); - } - break; - case 3: - if ($rs->fields['conf']) { //CONF - array_push($dids, $did); - } - break; - default: - global $C_debug; - $C_debug->error('voip.inc.php','get_all_dids_internal','Invalid filter passed: '.$filter); - } - $rs->MoveNext(); - } - } - return $dids; - } - - function normalize(&$db) - { - $count = 0; - $sql = sqlSelect($db, "voip_cdr", "src, dst, id", "(rated is null or rated=0)"); - #echo $sql."
"; - $rs = $db->Execute($sql); - while (!$rs->EOF) { - $src = $rs->fields['src']; - $dst = $rs->fields['dst']; - - $e164 = ""; $cc = ""; $npa = ""; $nxx = ""; - if (strlen($src)>=$this->normalization_min_len && $this->e164($src, $e164, $cc, $npa, $nxx)) { - $src = substr($e164,1); - } - $e164 = ""; $cc = ""; $npa = ""; $nxx = ""; - if (strlen($dst)>=$this->normalization_min_len && $this->e164($dst, $e164, $cc, $npa, $nxx)) { - $dst = substr($e164,1); - } - #echo "src=".$rs->fields['src']." dst=".$rs->fields['dst']."
"; - #echo "esrc=".$src." edst=".$dst."

"; - #$f = array('src' => $src, 'dst' => $dst, 'rated' => '2'); - #$sql = sqlUpdate($db,"voip_cdr",$f,"id=::".$rs->fields['id']); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_cdr SET - src=".$db->qstr($src).", dst=".$db->qstr($dst).", rated=2 - WHERE id=".$db->qstr($rs->fields['id']); - #echo $sql."
"; - $db->Execute($sql); - $count++; - $rs->MoveNext(); - } - echo "Normalized $count records...\n"; - } - - // Call as task - voip:task - function task($VAR) - { - if(function_exists('agileco_parse_country_code')) { - $this->c_task($VAR); - return; - } - - global $rate; - $rate = array(); - $db = &DB(); - $rs = & $db->Execute( sqlSelect($db, "product", "id,prod_plugin_data", "prod_plugin_file=::VOIP:: and prod_plugin=1")); - while (!$rs->EOF) { - $pdata = unserialize($rs->fields['prod_plugin_data']); - $id = $rs->fields['id']; - if ($pdata['rate_cdr'] == 1) { - $products[] = $id; - } - $rs->MoveNext(); - } - - // no products to rate - if(empty($products)) return false; - - # Load configuration - $sql = sqlSelect($db, "voip", "voip_intrastate, voip_default_prefix, perform_normalization, normalization_min_len", ""); - $rs = $db->Execute($sql); - $this->voip_intrastate = explode(",",ereg_replace("[[:space:]]","",$rs->fields['voip_intrastate'])); - $this->voip_default_prefix = $rs->fields['voip_default_prefix']; - $this->normalization_min_len = $rs->fields['normalization_min_len']; - $this->perform_normalization = $rs->fields['perform_normalization']; - - ob_start(); - - # normalize the CDR records - echo "Begin normalization...\n"; - if($this->perform_normalization) { - $this->normalize($db); - } - echo "Finished normalization...\n"; - - # rate prepaid cards, non-SIP prepaid - $rs =& $db->Execute(sqlSelect($db,"voip_prepaid","pin, account_id, product_id, voip_did_id","(voip_did_id=0 or voip_did_id is null)")); - if ($rs && $rs->RecordCount() > 0) { - while (!$rs->EOF) { - $dp = 0; - unset($dids); - $dids[$dp]['start'] = 0; - $dids[$dp]['end'] = mktime(0,0,0,date('m')+1,1,date('Y')); - $dids[$dp]['accountcode'] = "cc:".$rs->fields['pin']; - echo "Rating calling card PIN: ".$rs->fields['pin']."\n"; - # Load rating table configuration - $rate = $this->load_rating_table($db, $rs->fields['product_id']); - $this->rate_calls($db, $db, $dids, $rs->fields, false); - - # Mark inbound calls - if ($rs->fields['voip_did_id'] > 0) { - $sql = "update ".AGILE_DB_PREFIX."voip_cdr SET amount=0, rated=1, account_id=".$db->qstr($rs->fields['account_id'])." where dst=".$db->qstr($rs->fields['pin'])." and rated=0 and site_id=".DEFAULT_SITE; - echo $sql."\n"; - $db->Execute($sql); - } - $rs->MoveNext(); - } - } - - echo "Begin SIP Prepaid rating...\n"; - $sql = "select account_id, username, prod_attr_cart, prod_plugin_data, date_last_invoice, date_next_invoice, b.product_id, b.id as service_id from ".AGILE_DB_PREFIX."account as a left join ".AGILE_DB_PREFIX."service as b on (a.id=b.account_id) where a.status=1 and prod_plugin_name='PREPAID' and b.active=1 and a.site_id=".DEFAULT_SITE." and b.site_id=".DEFAULT_SITE; - echo $sql."\n"; - $rs =& $db->Execute($sql); - if ($rs && $rs->RecordCount() > 0) { - while (!$rs->EOF) { - $dp = 0; - unset($dids); - $cart = @unserialize($rs->fields['prod_attr_cart']); - $plugin = unserialize($rs->fields['prod_plugin_data']); - if (isset($cart['station']) && isset($plugin['type']) && $plugin['type'] == 'did') { - $dids[$dp]['start'] = $rs->fields['date_last_invoice'] - (MAX_INV_GEN_PERIOD*86400); - $dids[$dp]['end'] = $rs->fields['date_next_invoice'] + 86399; - $dids[$dp]['did'] = $cart['station']; - # Load rating table configuration - $rate = $this->load_rating_table($db, $rs->fields['product_id']); - if (is_array($rate)) { - $this->rate_calls($db, $db, $dids, $rs->fields); - } - } - $rs->MoveNext(); - } - } - - echo "Begin postpaid rating...\n"; - # rate calls - $sql = "select account_id, username, prod_attr_cart, prod_plugin_data, date_last_invoice, date_next_invoice, b.product_id, b.id as service_id, b.sku from ".AGILE_DB_PREFIX."account as a left join ".AGILE_DB_PREFIX."service as b on (a.id=b.account_id) where a.status=1 and prod_plugin_name='VOIP' and b.active=1 and product_id IN (".join(",",$products).") and a.site_id=".DEFAULT_SITE." and b.site_id=".DEFAULT_SITE; - echo $sql."\n"; - $rs = $db->Execute($sql); - $dp = 0; - while (!$rs->EOF) { - $dp = 0; unset($dids); - $cart = @unserialize($rs->fields['prod_attr_cart']); - $plugin = unserialize($rs->fields['prod_plugin_data']); - - $dids[$dp]['start'] = $rs->fields['date_last_invoice'] - (MAX_INV_GEN_PERIOD*86400); - $dids[$dp]['end'] = $rs->fields['date_next_invoice']; - $dids[$dp]['did'] = @$cart['station']; - if (strlen(@$cart['ported'])) - $dids[0]['did'] = $cart['ported']; - $cc = ""; $e164 = ""; $npa = ""; $nxx = ""; - if ((!strlen($dids[0]['did']) && $plugin['rate_accountcode'] == 0)) { - echo "Skipping service_id = ".$rs->fields['service_id']." (sku: ".$rs->fields['sku'].")\n"; - } else { - if ($this->e164($dids[0]['did'],$e164,$cc,$npa,$nxx)) { - $dids[0]['did'] = substr($e164,1); - if ($cc == '1') { - $dp++; - $dids[$dp]['start'] = $rs->fields['date_last_invoice'] - (MAX_INV_GEN_PERIOD*86400); - $dids[$dp]['end'] = $rs->fields['date_next_invoice'] + 86399; - $dids[$dp]['did'] = substr($e164,2); - $dp++; - $dids[$dp]['start'] = $rs->fields['date_last_invoice'] - (MAX_INV_GEN_PERIOD*86400); - $dids[$dp]['end'] = $rs->fields['date_next_invoice'] + 86399; - $dids[$dp]['did'] = substr($e164,1); - } else { - $dp++; - $dids[$dp]['start'] = $rs->fields['date_last_invoice']; - $dids[$dp]['end'] = $rs->fields['date_next_invoice'] + 86399; - $dids[$dp]['did'] = substr($e164,4); - } - - } - - if (@$cart['parent_service_id'] > 0) { - # echo "This is a virtual number, skipping record..."; - ; - } else { - # load virtual numbers on this parent service - $sql = "select * from ".AGILE_DB_PREFIX."service where account_id=".$db->qstr($rs->fields['account_id'])." and active=1 and prod_plugin_name='VOIP' and site_id=".DEFAULT_SITE; - echo $sql."\n"; - $rs1 = $db->Execute($sql); $i = 1; - if ($rs1) { - while (!$rs1->EOF) { - $carttmp = @unserialize($rs1->fields['prod_attr_cart']); - if (@$carttmp['parent_service_id'] == $rs->fields['service_id']) { - # is this an actual virtual line? - $ppd = unserialize($rs1->fields['prod_plugin_data']); - if ($ppd['parent_enabled'] && $ppd['virtual_number']) { - $dp++; - $dids[$dp]['start'] = $rs1->fields['date_last_invoice'] - (MAX_INV_GEN_PERIOD*86400); - $dids[$dp]['end'] = $rs1->fields['date_next_invoice'] + 86399; - $dids[$dp]['did'] = @$carttmp['station']; - if (strlen($carttmp['ported'])) - $dids[$dp]['did'] = $carttmp['ported']; - $cc = ""; $e164 = ""; $npa = ""; $nxx = ""; - if ($this->e164($dids[$dp]['did'],$e164,$cc,$npa,$nxx)) { - $dids[$dp]['did'] = substr($e164,1); - if ($cc == '1') { - $dp++; - $dids[$dp]['start'] = $rs->fields['date_last_invoice'] - (MAX_INV_GEN_PERIOD*86400); - $dids[$dp]['end'] = $rs->fields['date_next_invoice'] + 86399; - $dids[$dp]['did'] = substr($e164,2); - $dp++; - $dids[$dp]['start'] = $rs->fields['date_last_invoice'] - (MAX_INV_GEN_PERIOD*86400); - $dids[$dp]['end'] = $rs->fields['date_next_invoice'] + 86399; - $dids[$dp]['did'] = substr($e164,1); - } - } - echo "Found virtual number: ".$dids[$dp]['did']."\n"; - } # end test to see if truely virtual - } - $rs1->MoveNext(); - } - } - - # Load rating table configuration - $rate = $this->load_rating_table($db, $rs->fields['product_id']); - if (is_array($rate)) { - if ($plugin['rate_accountcode']) { - # rate accountcode based - # echo "Rate by account code: ".$rs->fields['username']."\n"; - $dids[$dp]['accountcode'] = $rs->fields['username']; - $this->rate_calls($db, $db, $dids, $rs->fields); - } else { - # rate non-accountcode based - $this->rate_calls($db, $db, $dids, $rs->fields); - } - } - } - } # end did length check - $rs->MoveNext(); - } - $debug = ob_get_contents(); - echo $debug; - ob_end_clean(); - if (defined('RATING_DEBUG')) { - mail("joe@thrallingpenguin.com","Rating Debug For ".URL,$debug); - } - return true; - } - - /** Returns the call type of two DIDs. Returns: 1=INTRASTATE,2=INTERSTATE,3=TOLL-FREE - * @param $src Source telephone number - * @param $dst Destination telephone number - */ - function isIntrastateCall($src,$dst) - { - # This is OHIOs NPAs. We need to know the location of us and we can load these values from - # the beastly add-on table we have. - # - # Can we assume the business state is the location of this stuff? - # - $ohio = $this->voip_intrastate; - if (strncmp("1800",$dst,4)==0 || strncmp("1877",$dst,4)==0 || strncmp("1866",$dst,4)==0 || strncmp("1888",$dst,4)==0) - return 3; - $s = 0; $d = 0; - foreach ($ohio as $p) { - if (strncmp("1".$p,$src,4)==0) - $s = 1; - if (strncmp("1".$p,$dst,4)==0) - $d = 1; - } - if($s == 1 && $d == 1) return 1; - return 2; - } - - /** Loads the rate table associated with a product. - * @param $db A database connection handle - * @param $product_id The ID of the product to load. - */ - function load_rating_table(&$db, $product_id) - { - global $rate; - - $sql = "SELECT b.id, b.connect_fee, b.increment_seconds, b.amount, b.pattern, b.type, b.direction, b.min, b.max, b.combine, b.percall as perCall, b.seconds_included, b.name FROM ".AGILE_DB_PREFIX."voip_rate_prod a inner join ".AGILE_DB_PREFIX."voip_rate b on (a.voip_rate_id=b.id and a.site_id=".DEFAULT_SITE.") WHERE product_id=".$product_id." ORDER BY type, direction DESC, length(pattern) DESC"; - echo $sql."\n"; - $rs = $db->Execute($sql); - unset($rate); - $i = 0; - while (!$rs->EOF) { - $rate[$i] = $rs->fields; - $rate[$i]['pattern'] = str_replace("\r","",str_replace("\n","",ereg_replace("[^0-9;]","",$rs->fields['pattern']))); - $rate[$i]['perCall'] = intval($rs->fields['perCall']); - switch ($rs->fields['type']) { - case 0: - $rate[$i]['type'] = 'innetwork'; - break; - case 1: - $rate[$i]['type'] = 'local'; - break; - case 2: - $rate[$i]['type'] = 'regular'; - break; - case 3: - $rate[$i]['type'] = 'default'; - break; - default: - break; - } - switch ($rs->fields['direction']) { - case 0: - $rate[$i]['direction'] = 'inbound'; - break; - case 1: - $rate[$i]['direction'] = 'outbound'; - break; - case 2: - $rate[$i]['direction'] = 'both'; - break; - default: - break; - } - $i++; - $rs->MoveNext(); - } - if ($i == 0) { - #global $C_debug; - #$C_debug->error('voip.inc.php','load_rating_table','Rate table is empty for product_id = '.$product_id); - echo "Rating table is blank!\n\n"; - } - return (isset($rate) ? $rate : false); - } - - /** Returns boolean if the DID S is in the array of DIDs DIDS. - */ - function in_did_array($s, &$dids) - { - $ret = false; - foreach ($dids as $d) { - if (isset($d['did'])) { - if ($d['did'] == $s) { - $ret = true; - break; - } - } - } - return $ret; - } - - function price_call(&$dbast, $r, $dur, $callSQL, &$unit, &$quan) - { - $billedDur = (($dur - $r['seconds_included']) / $r['increment_seconds']); - if ($billedDur < 0) - $billedDur = 0; - $billedDur = ceil($billedDur); - $billedDur = ($billedDur * $r['increment_seconds'])/60; - $cost = 0; - $quan = $billedDur; - - # get count for min/max, honor the combine flag! - $count = 0; - if ($r['combine']) { - $sql = "select sum(adjbillinterval) from ".AGILE_DB_PREFIX."voip_cdr where voip_rate_id=".$r['id']." and $callSQL"; - #echo $sql."\n"; - $rst = $dbast->Execute($sql); - $count = intval($rst->fields[0]); - } - - echo "count=$count, rmin=".$r['min'].", rmax=".$r['max']."\n"; - if ($count >= $r['min'] && - ($count <= $r['max'] || $r['max'] == -1)) { - echo "perCall = ".$r['perCall']."\n"; - if ($r['perCall']) { - $cost = $r['amount']; - $quan = 1; - $unit = $r['amount']; - } else { - $cost = ($r['amount'] * $billedDur); - $quan = $billedDur; - $unit = $r['amount']; - echo "billedDur=".$billedDur."\n"; - } - } - print "cost=$cost, quan=$quan, unit=$unit\n"; - return $cost; - } - - /** Determines if DST is in SRC's local calling area. - */ - function is_local_calling_area(&$dbast, $src, $dst) - { - $cc1 = ""; $npa1 = ""; $nxx1 = ""; - $cc2 = ""; $npa2 = ""; $nxx2 = ""; - $e164 = ""; - if ($this->e164($src,$e164,$cc1,$npa1,$nxx1)) { - if ($this->e164($dst,$e164,$cc2,$npa2,$nxx2)) { - $sql = "select t1.grouping as id1, t2.grouping from ".AGILE_DB_PREFIX."voip_local_lookup as t1 join ".AGILE_DB_PREFIX."voip_local_lookup as t2 on (t1.npa='$npa1' and t1.nxx='$nxx1' and t2.npa='$npa2' and t2.nxx='$nxx2') where t1.grouping=t2.grouping"; - echo $sql."\n"; - $rs = $dbast->Execute($sql); - if ($rs->fields[0] > 0) { - return true; - } - } - } - return false; - } - - function rate_calls(&$db, &$dbast, $dids, $crow, $postCharges = true) - { - global $rate; - $quan = 0; - $bAccountcode = false; - - # probably should have the e.164 values here too. - $sql = "("; - foreach($dids as $d) { - if (strlen(@$d['accountcode'])) { - $sql .= "(accountcode=".$db->qstr($d['accountcode'])." and date_orig>='".$d['start']."' and date_orig<='".$d['end']."') OR "; - $bAccountcode = true; - } else { - $sql .= "((src='".$d['did']."' or dst='".$d['did']."') and date_orig>='".$d['start']."' and date_orig<='".$d['end']."') OR "; - } - } - $sql = substr($sql,0,strlen($sql)-3).")"; - $callSQL = $sql; - $sql = "select * from ".AGILE_DB_PREFIX."voip_cdr where $sql and - (lastapp='Dial' or lastapp='VoiceMail' or lastapp='MeetMe' or lastapp='Hangup') - AND disposition='ANSWERED' and (rated=2)"; - echo $sql."\n"; - $rs1 = $dbast->Execute($sql); - #print_r($rate); - while ($rs1 && !$rs1->EOF) { - - $calltype = 0; - if(is_array($this->voip_intrastate)) - $calltype = $this->isIntrastateCall($rs1->fields['src'], $rs1->fields['dst']); - $slotMatched = 0; $unit = 0; $quan = 0; $amount = 0; - $isInbound = $this->in_did_array($rs1->fields['dst'], $dids); - if ($isInbound) - $calltype = 4; - - $slotMatched = 0; $unit = 0; $quan = 0; - foreach ($rate as $r) { - if ($r['type'] == 'innetwork') { - #echo "Is the call In Network?\n"; - if ($r['direction'] == 'inbound') { - $search = $rs1->fields['src']; - } else if ($r['direction'] == 'outbound') { - $search = $rs1->fields['dst']; - } else { - $search = $rs1->fields['src']."','".$rs1->fields['dst']; - } - $sql = "select count(*) from ".AGILE_DB_PREFIX."voip_in_network where did in ('".$search."')"; - echo $sql."\n"; - $rs2 = $dbast->Execute($sql); - if ($rs2->fields[0] > 0) { - echo "Yes, call is in-network.\n"; - $amount = 0; - $slotMatched = $r['id']; - #break; - } - } else if ($r['type'] == 'local') { - echo "Local calling area\n"; - if ($this->is_local_calling_area($dbast, $rs1->fields['src'], $rs1->fields['dst'])) { - $amount = 0; - $slotMatched = $r['id']; - #break; - } - } else if ($r['type'] == 'regular' || $r['type'] == 'default') { - #echo "src=".$rs1->fields['src']."\n"; - #echo "dst=".$rs1->fields['dst']."\n"; - $pats = explode(";", $r['pattern']); - $search = $rs1->fields['dst']; - foreach ($pats as $pattern) { - #echo "Matching against: $pattern\n"; - #if (ereg("^".$pattern, $search) || $r['type'] == 'default') { - if ((strncmp($pattern, $search, strlen($pattern))==0 && strlen($pattern)) || $r['type'] == 'default') { - echo "src=".$rs1->fields['src']."\n"; - echo "dst=".$rs1->fields['dst']."\n"; - echo "pattern=".$pattern."\n"; - echo "Billsec=".$rs1->fields['billsec']."\n"; - $amount = $this->price_call($db, $r, $rs1->fields['billsec'], $callSQL, $unit, $quan); - $slotMatched = $r['id']; - echo "Matched slot ".$r['id']." (".$r['name'].") with quan=$quan and unit=$unit\n"; - break; - } - } - } - # if the slot matched, and the call direction matches, then exit the rating table matching - if ($slotMatched && ( - $r['direction'] == 'both' || # rate entry for both call directions - ($r['direction'] == 'inbound' && $isInbound) || # inbound rate and inbound call direction - ($r['direction'] == 'outbound' && !$isInbound) ) # outbound rate and outbound call direction - ) { - echo "Found match: ".$slotMatched."\n"; - break; - } else if ($slotMatched && $bAccountcode ) { - # matched via account codes - echo "Found match via accountcode: ".$slotMatched."\n"; - break; - } else if ($slotMatched) { - # reset the variables and continue trying to find a match - $slotMatched = 0; $unit = 0; $quan = 0; $amount = 0; - echo "Incorrect direction, continuing to match...\n"; - } - } - - $sql = "update ".AGILE_DB_PREFIX."voip_cdr set account_id=".$db->qstr($crow['account_id']).", amount='".$amount."', calltype='$calltype', voip_rate_id='$slotMatched', rated=1, adjbillinterval=".$db->qstr($quan)." WHERE id=".$rs1->fields['id']." AND site_id=".DEFAULT_SITE; - echo $sql."\n"; - if (!$db->Execute($sql)) { - echo $db->ErrorMsg()."\n"; - } - - if ($unit && $postCharges) { - $a = 'Source=='.$rs1->fields['src'].'\r\nDestination=='.$rs1->fields['dst']; - $a .= '\r\nvoip_cdr_id=='.$rs1->fields['id'].'\r\ndate_orig=='.$rs1->fields['date_orig']; - if ($r['connect_fee']) { - $b = $a.'\r\nConnection Charge'; - unset($fields); - $fields['date_orig'] = $rs1->fields['date_orig']; - $fields['status'] = 0; - $fields['service_id'] = $crow['service_id']; - $fields['amount'] = $r['connect_fee']; - $fields['sweep_type'] = 6; - $fields['taxable'] = 0; - $fields['quantity'] = 1; - $fields['product_id'] = $crow['product_id']; - $fields['attributes'] = $b; - $db->Execute( sqlInsert($db,"charge",$fields) ); - } - if ($quan > 0) { - unset($fields); - $fields['date_orig'] = $rs1->fields['date_orig']; - $fields['status'] = 0; - $fields['service_id'] = $crow['service_id']; - $fields['amount'] = $unit; - $fields['sweep_type'] = 6; - $fields['taxable'] = 0; - $fields['quantity'] = $quan; - $fields['product_id'] = $crow['product_id']; - $fields['attributes'] = $a; - $db->Execute( sqlInsert($db,"charge",$fields) ); - } - } - - $rs1->MoveNext(); - } - } - - function microtime_float() - { - list($usec, $sec) = explode(" ", microtime()); - return ((float)$usec + (float)$sec); - } - -/** - * TODO: Accountcode based rating, Prepaid based rating - */ - function c_task($VAR) - { - # set the PHP timeout and the don't abort flag - set_time_limit(60 * 15); - - # normalize the CDR records - if($this->perform_normalization) { - echo "Begin normalization...\n"; - $this->normalize($db); - echo "Finished normalization...\n"; - } - - # Add in the prepaid rating pieces - - # Begin the postpaid rating - $bDoCallType = false; - if(strlen($this->voip_intrastate)) - $bDoCallType = true; - - $db =& DB(); - $sql = "select * from ".AGILE_DB_PREFIX."voip_cdr where - (lastapp='Dial' or lastapp='VoiceMail' or lastapp='MeetMe' or lastapp='Hangup') - AND disposition='ANSWERED' and rated=2 limit 1000"; - $rs = $db->Execute($sql); $i = 0; $total = 0.0; - $st = $this->microtime_float(); - while(!$rs->EOF) { - unset($match); - # who does the number belong to? - $account_id = 0; $service_id = 0; $product_id = 0; $callSQL = ""; - find_owner($rs->fields['src'], $account_id, $service_id, $product_id, $callSQL); - $isInbound = 0; - $calltype = 0; - if($bDoCallType) - $calltype = $this->isIntrastateCall($rs->fields['src'], $rs->fields['dst']); - #echo "Account: {$account_id} on src\n"; - if($account_id === false) { - find_owner($rs->fields['dst'], $account_id, $service_id, $product_id, $callSQL); - $isInbound = 1; - $calltype=4; - #echo "AccountL {$account_id} on dst\n"; - } - - if($account_id !== false) { - # echo "Account=$account_id Product=$product_id Service=$service_id
"; - # Retrieve the correct rate table - $rt =& $this->c_load_rating_table($db, $product_id); - - if(is_resource($rt)) { - # Rate the call - $src = $isInbound ? $rs->fields['dst'] : $rs->fields['src']; - $dst = $isInbound ? $rs->fields['src'] : $rs->fields['dst']; - if($match=agileco_search_rate_table($rt, strval($dst), intval($rs->fields['billsec']), - intval($isInbound), strval($callSQL))) { - #echo "
";
-						#echo "SRC=".$src."\n";
-						#echo "DST=".strval($dst)."\n";
-						#echo "BILLSEC=".intval($rs->fields['billsec'])."\n";
-						#echo "In Bound?=".intval($isInbound)."\n";
-						#echo "Call Type=".$calltype."\n";
-						#echo "callSQL=".$callSQL."\n\n";
-						#echo print_r($match,true);
-						#echo "\n";
-						#echo "
"; - } else { - #echo "SRC=".$src."\n"; - #echo "DST=".strval($dst)."\n"; - #echo "BILLSEC=".intval($rs->fields['billsec'])."\n"; - #echo "In Bound?=".intval($isInbound)."\n"; - #echo "Call Type=".$calltype."\n"; - #echo 'Returned false.'."\n\n"; - $match['amount'] = 0; - $match['quantity'] = 0; - $match['unit'] = 0; - $match['voip_rate_id'] = 0; - } - $rated=1; - } else { - echo "Product $product_id does not have a rating table.\n"; - } - } else { - $isInbound = 0; $account_id = 0; $calltype=0; $rated = 3; - } - if(isset($match)) { - $total += $match['amount']; - $sql = "update ".AGILE_DB_PREFIX."voip_cdr SET - account_id=".$db->qstr($account_id).", - amount=".$db->qstr($match['amount']).", - calltype=".$db->qstr($calltype).", - voip_rate_id=".$db->qstr($match['voip_rate_id']).", - rated={$rated}, - adjbillinterval=".$db->qstr($match['quantity']).", - site_id=".DEFAULT_SITE." - WHERE id=".$rs->fields['id']; - #echo $sql."\n"; - if (!$db->Execute($sql)) { - echo $sql."\n"; - echo $db->ErrorMsg()."\n"; - } - $a = 'Source=='.$rs->fields['src'].'\r\nDestination=='.$rs->fields['dst']; - $a .= '\r\nvoip_cdr_id=='.$rs->fields['id'].'\r\ndate_orig=='.$rs->fields['date_orig']; - if (isset($match['connect_fee']) && $match['connect_fee']) { - $b = $a.'\r\nConnection Charge'; - $cid = sqlGenID($db, "charge"); - $sql = "INSERT INTO ".AGILE_DB_PREFIX."charge SET - id=".$db->qstr($cid).", - side_id=".DEFAULT_SITE.", - date_orig=.".$db->qstr($rs->fields['date_orig']).", - status=0, - sweep_type=6, - product_id=".$db->qstr($product_id).", - service_id=".$db->qstr($service_id).", - amount=".$db->qstr($match['connect_fee']).", - quantity=1, - taxable=0, - attributes=".$db->qstr($b); - if (!$db->Execute($sql)) { - echo $sql."\n"; - echo $db->ErrorMsg()."\n"; - } - } - if ($match['quantity'] > 0) { - $cid = sqlGenID($db, "charge"); - $sql = "INSERT INTO ".AGILE_DB_PREFIX."charge SET - id=".$db->qstr($cid).", - site_id=".DEFAULT_SITE.", - date_orig=".$db->qstr($rs->fields['date_orig']).", - status=0, - sweep_type=6, - product_id=".$db->qstr($product_id).", - service_id=".$db->qstr($service_id).", - amount=".$db->qstr($match['unit']).", - quantity=".$db->qstr($match['quantity']).", - taxable=0, - attributes=".$db->qstr($a); - if (!$db->Execute($sql)) { - echo $sql."\n"; - echo $db->ErrorMsg()."\n"; - } - } - } - $i++; - $rs->MoveNext(); - } - $et = $this->microtime_float(); - $tt = $et - $st; - echo "Rated {$i} entries in {$tt} seconds.

"; - echo "Cough up $".number_format($total,4)."!
"; - } - - /** Loads the rate table associated with a product. - * @param $db A database connection handle - * @param $product_id The ID of the product to load. - */ - function & c_load_rating_table(&$db, $product_id) - { - static $rate_cache; - - /* Is the rate already cached? */ - if(isset($rate_cache[$product_id])) { - return $rate_cache[$product_id]; - } - - /* Cache Miss. Generate the entry. */ - $db =& DB(); - $rate_cache[$product_id] = agileco_new_rate_table(); - $i = 0; $st = $this->microtime_float(); - $sql = "SELECT b.id, b.connect_fee, b.increment_seconds, b.amount, b.pattern, b.type, b.direction, b.min, b.max, b.combine, b.percall, b.seconds_included FROM ".AGILE_DB_PREFIX."voip_rate_prod a left join ".AGILE_DB_PREFIX."voip_rate b on (a.voip_rate_id=b.id and a.site_id=".DEFAULT_SITE.") WHERE product_id=".$product_id." ORDER BY type ASC"; - #echo $sql."\n"; - $rs = $db->Execute($sql); - while (!$rs->EOF) { - $pattern = preg_replace("/[^0-9;]/","",$rs->fields['pattern']); - $pattern = str_replace("\r","",str_replace("\n","",$pattern)); - $pats = explode(";",$pattern); - foreach($pats as $pat) { - agileco_rate_table_insert( - $rate_cache[$product_id], - $pat, - intval($rs->fields['id']), - floatval($rs->fields['connect_fee']), - intval($rs->fields['increment_seconds']), - intval($rs->fields['seconds_included']), - floatval($rs->fields['amount']), - intval($rs->fields['min']), - intval($rs->fields['max']), - intval($rs->fields['type']), - intval($rs->fields['direction']), - intval($rs->fields['combine']), - intval($rs->fields['percall']) - ); - ++$i; - } - $rs->MoveNext(); - } - $et = $this->microtime_float(); $tt = $et - $st; - echo "Loaded {$i} patterns for product {$product_id} in {$tt} seconds.
\n"; - return $rate_cache[$product_id]; - } - -} - -# -# C MODULE FUNCTIONS FOLLOW BELOW -# - -// NOTE: I didn't include this in the class because it is known to be faster to call -// a function, than a method of a class. -function find_owner($did, &$account_id, &$service_id, &$product_id, &$callSQL) { - static $owners; - - if(isset($owners[$did])) { - $account_id = $owners[$did]['account_id']; - $service_id = $owners[$did]['service_id']; - $product_id = $owners[$did]['product_id']; - $callSQL = $owners[$did]['callSQL']; - return true; - } - $db =& DB(); - #$sql = "SELECT id FROM ab_account WHERE username=".$db->qstr($did)." and site_id=".DEFAULT_SITE; - $sql = "select A.account_id, A.service_id, B.product_id, B.date_last_invoice, B.date_next_invoice - from ".AGILE_DB_PREFIX."voip_did A inner join ".AGILE_DB_PREFIX."service B on (B.id=A.service_id) - where did=".$db->qstr($did)." and A.site_id=".DEFAULT_SITE." and B.site_id=".DEFAULT_SITE; - #echo $sql."
"; - $row = $db->GetRow($sql); - if($row === false || !isset($row[0])) { - $account_id = false; - $service_id = false; - $product_id = false; - $callSQL = ""; - return false; - } - $account_id = $row[0]; - $service_id = $row[1]; - $product_id = $row[2]; - - $row[3] = $row[3] - (MAX_INV_GEN_PERIOD*86400); - $row[4] = $row[4] + 86399; - - $callSQL = "((src=".$db->qstr($did)." or dst=".$db->qstr($did).") and "; - $callSQL .= "date_orig>=".$db->qstr($row[3])." and date_orig<=".$db->qstr($row[4]).")"; - - $owners[$did]['account_id'] = $row[0]; - $owners[$did]['service_id'] = $row[1]; - $owners[$did]['product_id'] = $row[2]; - $owners[$did]['callSQL'] = $callSQL; - return true; -} - -function agileco_php_in_network($did) { - $db =& DB(); - $sql = "select count(*) from ".AGILE_DB_PREFIX."voip_in_network where did in ('".$did."')"; - #echo $sql."\n"; - $rs2 = $db->Execute($sql); - if ($rs2->fields[0] > 0) { - #echo "Yes, call is local.\n"; - return 1; - } - return 0; -} - -function agileco_php_local_call($dst) { - global $src; - - $voip = new voip; - $cc1 = ""; $npa1 = ""; $nxx1 = ""; - $cc2 = ""; $npa2 = ""; $nxx2 = ""; - $e164 = ""; - if ($voip->e164($src,$e164,$cc1,$npa1,$nxx1)) { - if ($voip->e164($dst,$e164,$cc2,$npa2,$nxx2)) { - $sql = "select t1.grouping as id1, t2.grouping from ".AGILE_DB_PREFIX."voip_local_lookup as t1 join ".AGILE_DB_PREFIX."voip_local_lookup as t2 on (t1.npa='$npa1' and t1.nxx='$nxx1' and t2.npa='$npa2' and t2.nxx='$nxx2') where t1.grouping=t2.grouping"; - echo $sql."\n"; - $rs = $db->Execute($sql); - if ($rs->fields[0] > 0) { - return 1; - } - } - } - return 0; -} - -function agileco_php_minutes_used($voip_did_id, $callSQL) { - $db =& DB(); - $sql = "select sum(adjbillinterval) from ".AGILE_DB_PREFIX."voip_cdr where voip_rate_id={$voip_did_id} and {$callSQL}"; - $rst = $db->Execute($sql); - $num = intval($rst->fields[0]); - echo 'Customer has '.$num.' minutes used.
'; - return $num; -} - -?> \ No newline at end of file diff --git a/modules/voip/voip_construct.xml b/modules/voip/voip_construct.xml deleted file mode 100644 index dea4a916..00000000 --- a/modules/voip/voip_construct.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - voip - voip
- - 0 - id - 35 - - id - - - - I4 - - - I4 - - - C(255) - - - L - any - - - C(4) - 4 - 4 - numeric - - - C(8) - any - - - F - any - - - C(32) - any - - - L - any - - - L - any - - - 0 - 0 -
\ No newline at end of file diff --git a/modules/voip/voip_install.xml b/modules/voip/voip_install.xml deleted file mode 100644 index 6f886a06..00000000 --- a/modules/voip/voip_install.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - voip - voip - - - voip_rate,voip_rate_prod,voip_did,voip_pool,voip_in_network,voip_sip,voip_fax,voip_fax_data,voip_vm,voip_blacklist,voip_cdr,voip_did_plugin,voip_prepaid - 1 - - - - - - 1 - - - - diff --git a/modules/voip_blacklist/auth.inc.php b/modules/voip_blacklist/auth.inc.php deleted file mode 100644 index 1bf7d622..00000000 --- a/modules/voip_blacklist/auth.inc.php +++ /dev/null @@ -1,12 +0,0 @@ - 'voip_blacklist', 'method' => 'user_search'), - Array ('module' => 'voip_blacklist', 'method' => 'user_search_show'), - Array ('module' => 'voip_blacklist', 'method' => 'user_delete'), - Array ('module' => 'voip_blacklist', 'method' => 'user_view'), - Array ('module' => 'voip_blacklist', 'method' => 'user_add'), - Array ('module' => 'voip_blacklist', 'method' => 'user_update'), - Array ('module' => 'voip_blacklist', 'method' => 'ajax_add') - ); -?> \ No newline at end of file diff --git a/modules/voip_blacklist/voip_blacklist.inc.php b/modules/voip_blacklist/voip_blacklist.inc.php deleted file mode 100644 index a9f94685..00000000 --- a/modules/voip_blacklist/voip_blacklist.inc.php +++ /dev/null @@ -1,215 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_blacklist -{ - - # Open the constructor for this mod - function voip_blacklist() - { - # name of this module: - $this->module = "voip_blacklist"; - - if(!defined('AJAX')) { - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - } - - function user_search($VAR) { - if(SESS_LOGGED) { - $VAR['voip_blacklist_account_id'] = SESS_ACCOUNT; - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } else { - define("FORCE_REDIRECT", "?_page=account:account"); - } - } - - function user_search_show($VAR) { - $this->search_show($VAR,$this); - } - - function user_view($VAR) { - if(SESS_LOGGED) { - $this->did = @$VAR['id']; - $db = &DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_blacklist","account_id","id = ::$this->did::")); - if($rs->fields['account_id'] == SESS_ACCOUNT) { - $this->view($VAR,$this); - } - return; - } - echo "Not logged in or authenticated!"; - } - - function user_delete($VAR) { - if(SESS_LOGGED) { - $this->did = @$VAR['delete_id']; - $db = &DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_blacklist","account_id","id = ::$this->did::")); - #echo $sql;exit; - if($rs->fields['account_id'] == SESS_ACCOUNT) { - $this->delete($VAR,$this); - } - return; - } - echo "Not logged in or authenticated!"; - } - - function user_update($VAR) { - if(SESS_LOGGED) { - $this->did = @$VAR['id']; - $db = &DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_blacklist","account_id","id = ::$this->did::")); - if($rs->fields['account_id'] == SESS_ACCOUNT) { - $this->update($VAR,$this); - } - return; - } - echo "Not logged in or authenticated!"; - } - - - function user_add($VAR) { - # verify logged in: - if(!SESS_LOGGED) { - define("FORCE_REDIRECT", "?_page=account:account"); - return false; - } - - # Verify did_id is owned by user - $did=@$VAR['voip_blacklist_voip_did_id']; - $db=&DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_did","account_id","id = ::$did::")); - if($rs && $rs->RecordCount() > 0 && $rs->fields['account_id'] == SESS_ACCOUNT) - { - // insert the record - // todo: validate the src no - $VAR['voip_blacklist_account_id'] = SESS_ACCOUNT; - $this->add($VAR,$this); - } - return true; - } - - function ajax_add($VAR) - { - $db =& DB(); - $rs = $db->Execute($sql=sqlSelect($db,"voip_cdr","src, dst","id=::".$VAR['voip_cdr_id'].":: and account_id=::".SESS_ACCOUNT."::")); - if ($rs && $rs->RecordCount()) { - if(strlen($rs->fields['src'])) { - $did = $rs->fields['dst']; - $rs1 = $db->Execute(sqlSelect($db,"voip_did","id, blacklist","account_id=::".SESS_ACCOUNT.":: and (did=::$did:: or did=::1$did::)")); - if ($rs1 && $rs1->RecordCount()) { - if ($rs1->fields['blacklist']) { - $rs2 = $db->Execute(sqlSelect($db,"voip_blacklist","id","account_id=::".SESS_ACCOUNT.":: and src=::".$rs->fields['src']."::")); - if ($rs2 && $rs2->RecordCount()) { - echo "alert('Sorry, this number is already in your blacklist.');\n"; - } else { - $f['account_id'] = SESS_ACCOUNT; - $f['voip_did_id'] = $rs1->fields['id']; - $f['src'] = $rs->fields['src']; - $f['dst'] = 'Playback tt-monkeys'; - $db->Execute(sqlInsert($db,"voip_blacklist",$f)); - echo "alert('Added entry to your blacklist.');\n"; - } - } else { - echo "alert('Your account does not have the blacklist feature.');\n"; - } - } else { - echo "alert('Sorry, can not find the DID associated with this CDR.');\n"; - } - } - } else { - echo "alert('Sorry, the CDR does not belong to your account.');\n"; - } - return true; - } - - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } -} -?> \ No newline at end of file diff --git a/modules/voip_blacklist/voip_blacklist_construct.xml b/modules/voip_blacklist/voip_blacklist_construct.xml deleted file mode 100644 index 0329d8c8..00000000 --- a/modules/voip_blacklist/voip_blacklist_construct.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - voip_blacklist - voip_blacklist
- voip - 0 - id - 35 - - voip_did_id,src - - - - I4 - 1 - - - I4 - - - I8 - voip_did - did - - - I4 - - - C(32) - - - C(64) - - - - id,site_id,voip_did_id,account_id,src,dst - id,site_id,voip_did_id,account_id,src,dst - id,site_id,voip_did_id,account_id,src,dst - id,site_id,voip_did_id,account_id,src,dst - id,site_id,voip_did_id,account_id,src,dst - - 0 -
\ No newline at end of file diff --git a/modules/voip_blacklist/voip_blacklist_install.xml b/modules/voip_blacklist/voip_blacklist_install.xml deleted file mode 100644 index 5a08996e..00000000 --- a/modules/voip_blacklist/voip_blacklist_install.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - voip_blacklist - voip - This module stores the VoIP blacklist records - 1 - voip - - - - - - add - %%:add - 1 - - - update - - - delete - - - view - core:search&module=%%&_escape=1 - 1 - - - search - %%:search_form - 1 - - - search_form - - - search_show - - - - \ No newline at end of file diff --git a/modules/voip_cdr/auth.inc.php b/modules/voip_cdr/auth.inc.php deleted file mode 100644 index b977b934..00000000 --- a/modules/voip_cdr/auth.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - 'voip_cdr', 'method' => 'search_export') - ); -?> \ No newline at end of file diff --git a/modules/voip_cdr/voip_cdr.inc.php b/modules/voip_cdr/voip_cdr.inc.php deleted file mode 100644 index 167f1462..00000000 --- a/modules/voip_cdr/voip_cdr.inc.php +++ /dev/null @@ -1,174 +0,0 @@ - - * @package AgileBill - * @version 1.4.93 - */ - -class voip_cdr -{ - # Open the constructor for this mod - function voip_cdr() - { - # name of this module: - $this->module = "voip_cdr"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - ############################## - ## SEARCH EXPORT ## - ############################## - function search_export($VAR) - { - # require the export class - require_once (PATH_CORE . "export.inc.php"); - - # Call the correct export function for inline browser display, download, email, or web save. - if($VAR["format"] == "excel") - { - $type = "export_excel"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_excel($VAR, $this, $type); - } - - else if ($VAR["format"] == "pdf") - { - $type = "export_pdf"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_pdf($VAR, $this, $type); - } - - else if ($VAR["format"] == "xml") - { - $type = "export_xml"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_xml($VAR, $this, $type); - } - - else if ($VAR["format"] == "csv") - { - $type = "export_csv"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_csv($VAR, $this, $type); - } - - else if ($VAR["format"] == "tab") - { - $type = "export_tab"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_tab($VAR, $this, $type); - } - } -} -?> \ No newline at end of file diff --git a/modules/voip_cdr/voip_cdr_construct.xml b/modules/voip_cdr/voip_cdr_construct.xml deleted file mode 100644 index 0a1c9b6f..00000000 --- a/modules/voip_cdr/voip_cdr_construct.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - voip_cdr - voip_cdr
- voip - 0 - id - 35 - - date_orig,account_id,voip_rate_id - account_id,voip_rate_id - dst,src,date_orig - dst,src - account_id,date_orig - accountcode - voip_rate_id - rated - rated,disposition,date_orig - - - - I4 - 1 - - - I4 - - - I8 - date - - - I4 - - - I4 - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - C(128) - - - C(16) - - - I4 - - - I4 - - - C(45) - - - I4 - - - C(128) - - - C(128) - - - F - - - L - - - L - - - N - - - - id,site_id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,site_id,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,site_id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,site_id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,site_id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - id,date_orig,account_id,voip_rate_id,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,amount,calltype,rated,adjbillinterval - - 0 -
diff --git a/modules/voip_cdr/voip_cdr_install.xml b/modules/voip_cdr/voip_cdr_install.xml deleted file mode 100644 index b7f0d475..00000000 --- a/modules/voip_cdr/voip_cdr_install.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - voip_cdr - voip - This module stores the VoIP call detail records (CDR) - 1 - voip - - - - - - add - - - search_export - - - update - - - export_excel - - - delete - - - export_xml - - - view - core:search&module=%%&_escape=1 - 1 - - - export_tab - - - search - %%:search_form - 1 - - - search_form - - - search_show - - - export_csv - - - - \ No newline at end of file diff --git a/modules/voip_did/voip_did.inc.php b/modules/voip_did/voip_did.inc.php deleted file mode 100644 index 3f339def..00000000 --- a/modules/voip_did/voip_did.inc.php +++ /dev/null @@ -1,264 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_did -{ - - # Open the constructor for this mod - function voip_did() - { - # name of this module: - $this->module = "voip_did"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - ########################################### - ### AJAX Auto-selector - ########################################### - - function autoselect($VAR) - { - $db = &DB(); - $p = AGILE_DB_PREFIX; - - if (empty($VAR['did_search'])) { - $where = "id > 0"; - $type = 1; - } else { - $where = "did LIKE ".$db->qstr($VAR['did_search'].'%'); - $type = 4; - } - - $q = "SELECT id,did FROM {$p}voip_did WHERE - ( $where ) - AND - site_id = " .DEFAULT_SITE." - ORDER BY did"; - $result = $db->SelectLimit($q, 10); - - # Create the alert for no records found - echo '
    '; - # Create the alert for no records found - if ($result->RecordCount() > 0) { - $i=0; - while(!$result->EOF) - { - echo '
  • ' . $result->fields['did'] . '
    '. - '
  • '."\r\n"; - $result->MoveNext(); - $i++; - } - } - echo "
"; - } - - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - global $smarty; - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $smart = $db->view($VAR, $this, $type); - - # echo "
".print_r($smart,true)."
"; - $db =& DB(); - $rs = $db->Execute(sqlSelect($db, "voip_sip", "*", "sip=::".$smart[0]['did']."::")); - while (!$rs->EOF) { - $smarty->assign('sip_'.$rs->fields['keyword'],$rs->fields['data']); - $rs->MoveNext(); - } - $sip_canreinvite_options['yes'] = 'Yes'; - $sip_canreinvite_options['no'] = 'No'; - $sip_canreinvite_options['update'] = 'Update'; - $smarty->assign('sip_canreinvite_options', $sip_canreinvite_options); - $sip_dtmfmode_options['info'] = 'Info'; - $sip_dtmfmode_options['rfc2833'] = 'RFC 2833'; - $sip_dtmfmode_options['inband'] = 'In-band Audio'; - $smarty->assign('sip_dtmfmode_options', $sip_dtmfmode_options); - $sip_nat_options['yes'] = 'Yes'; - $sip_nat_options['no'] = 'No'; - $sip_nat_options['always'] = 'Always'; - $smarty->assign('sip_nat_options', $sip_nat_options); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - - # update the voip_sip table fields - $db =& DB(); - $rs = $db->Execute(sqlSelect($db, "voip_did", "did", "id=::".$VAR['id']."::")); - - #echo "
".print_r($VAR,true)."
"; - $f[0]['username'] = $VAR['sip_username']; - $f[1]['secret'] = $VAR['sip_secret']; - $f[2]['qualify'] = $VAR['sip_qualify']; - $f[3]['mailbox'] = $VAR['sip_mailbox']; - $f[4]['incominglimit'] = $VAR['sip_incominglimit']; - $f[5]['dtmfmode'] = $VAR['sip_dtmfmode']; - $f[6]['canreinvite'] = $VAR['sip_canreinvite']; - $f[7]['callerid'] = $VAR['sip_callerid']; - $f[8]['nat'] = $VAR['sip_nat']; - for ($i = 0; $i < 9; $i++) { - #echo "
".print_r($f[$i],true)."
"; - $k = key($f[$i]); - $v = $f[$i][$k]; - if (empty($v)) { - $sql = "DELETE FROM ".AGILE_DB_PREFIX."voip_sip WHERE sip=".$db->qstr($rs->fields['did'])." and keyword=".$db->qstr($k)." and site_id=".DEFAULT_SITE; - } else { - $rs2 = $db->Execute(sqlSelect($db, "voip_sip", "id", "sip=::".$rs->fields['did'].":: AND keyword=::".$k."::")); - if ($rs2 && $rs2->fields[0] > 0) { - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_sip SET data=".$db->qstr($v)." WHERE sip=".$db->qstr($rs->fields['did'])." and keyword=".$db->qstr($k)." and site_id=".DEFAULT_SITE; - } else { - $flds['data'] = $v; - $flds['keyword'] = $k; - $flds['sip'] = $rs->fields['did']; - $sql = sqlInsert($db, "voip_sip", $flds); - # $sql = "INSERT INTO ".AGILE_DB_PREFIX."voip_sip SET data=".$db->qstr($v)." WHERE sip=".$db->qstr($rs->fields['did'])." and keyword=".$db->qstr($k)." and site_id=".DEFAULT_SITE; - } - } - if (!$db->Execute($sql)) { - echo $db->ErrorMsg(); - } - } - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - ############################## - ## SEARCH EXPORT ## - ############################## - function search_export($VAR) - { - # require the export class - require_once (PATH_CORE . "export.inc.php"); - - # Call the correct export function for inline browser display, download, email, or web save. - if($VAR["format"] == "excel") - { - $type = "export_excel"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_excel($VAR, $this, $type); - } - - else if ($VAR["format"] == "xml") - { - $type = "export_xml"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_xml($VAR, $this, $type); - } - - else if ($VAR["format"] == "csv") - { - $type = "export_csv"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_csv($VAR, $this, $type); - } - - else if ($VAR["format"] == "tab") - { - $type = "export_tab"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_tab($VAR, $this, $type); - } - } -} -?> \ No newline at end of file diff --git a/modules/voip_did/voip_did_construct.xml b/modules/voip_did/voip_did_construct.xml deleted file mode 100644 index 07415de3..00000000 --- a/modules/voip_did/voip_did_construct.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - voip_did - voip_did
- voip - 0 - id - 35 - - - I4 - 1 - - - I4 - - - I4 - account - username - any - - - I4 - - - I4 - - - C(16) - - - I4 - - - I4 - - - I4 - - - L - - - L - - - L - - - L - - - C(16) - - - C(128) - - - L - - - L - - - L - - - L - - - L - - - C(32) - - - C(32) - - - L - - - C(128) - - - L - - - L - - - I4 - - - L - - - C(128) - - - L - - - C(128) - - - - account_id - service_id - - - id,site_id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,site_id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,site_id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,site_id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - id,account_id,service_id,service_parent_id,did,callingrateid,calledrateid,planid,cnam,channel,channelarg,voicemailenabled,callforwardingenabled,busycallforwardingenabled,voicemailafter,cfringfor,cfnumber,bcfnumber,rxfax,faxemail,active,conf,conflimit,failover,failovernumber,remotecallforward,remotecallforwardnumber,blacklist,anirouting - - 0 -
diff --git a/modules/voip_did/voip_did_install.xml b/modules/voip_did/voip_did_install.xml deleted file mode 100644 index 5956794c..00000000 --- a/modules/voip_did/voip_did_install.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - voip_did - voip - This module stores the DID records - 1 - voip - - - - - - add - %%:add - 1 - - - - update - - - - delete - - - view - core:search&module=%%&_escape=1 - 1 - - - search - %%:search_form - 1 - - - search_form - - - search_show - - - export_csv - - - export_excel - - - search_export - - - export_xml - - - export_tab - - - autoselect - - - - \ No newline at end of file diff --git a/modules/voip_did_plugin/voip_did_plugin.inc.php b/modules/voip_did_plugin/voip_did_plugin.inc.php deleted file mode 100644 index f1783d8e..00000000 --- a/modules/voip_did_plugin/voip_did_plugin.inc.php +++ /dev/null @@ -1,284 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_did_plugin -{ - - # Open the constructor for this mod - function voip_did_plugin() - { - # name of this module: - $this->module = "voip_did_plugin"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - function task($VAR) - { - $db=&DB(); - $rs = $db->Execute(sqlSelect($db,"voip_did_plugin","*","")); - if($rs && $rs->RecordCount() > 0) - { - while(!$rs->EOF) - { - // load the plugin and call refresh(); - $plugin = $rs->fields['plugin']; - $file = PATH_PLUGINS.'voip_did/'.$plugin.'.php'; - if(is_file($file)) { - include_once($file); - eval('$plg = new plgn_voip_did_'.$plugin.';'); - if(is_object($plg)) { - if(is_callable(array($plg, 'release'))) { - $plg->id = $rs->fields['id'];; - $plg->refresh(); - } - } - } - $rs->MoveNext(); - } - } - } - - - - /** Reserve a DID - - mysql> describe ab_voip_pool; - +--------------------+--------------+------+-----+---------+-------+ - | Field | Type | Null | Key | Default | Extra | - +--------------------+--------------+------+-----+---------+-------+ - | id | mediumint(9) | | PRI | 0 | | - | site_id | mediumint(9) | YES | MUL | NULL | | - | account_id | mediumint(9) | YES | | NULL | | - | npa | varchar(16) | YES | MUL | NULL | | - | nxx | varchar(16) | YES | | NULL | | - | station | varchar(32) | YES | | NULL | | - | country_code | mediumint(9) | YES | | NULL | | - | date_reserved | bigint(20) | YES | | NULL | | - | voip_did_plugin_id | mediumint(9) | YES | | NULL | | - +--------------------+--------------+------+-----+---------+-------+ - 9 rows in set (0.00 sec) - */ - function reserve($voip_did_plugin_id, $did) { - # Include the voip class - include_once(PATH_MODULES.'voip/voip.inc.php'); - $v = new voip; - - $db =& DB(); - - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($v->e164($did, $e164, $cc, $npa, $nxx)) { - if ($cc == '1') { - $station = substr($e164, 8); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=".time().", account_id=".intval(SESS_ACCOUNT)." - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND (account_id IS NULL or account_id=0) AND - country_code=".$db->qstr($cc)." AND npa=".$db->qstr($npa)." AND nxx=".$db->qstr($nxx)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } elseif($cc == '61') { - $station = substr($e164, 12); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=".time().", account_id=".intval(SESS_ACCOUNT)." - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND (account_id IS NULL or account_id=0) AND - country_code=".$db->qstr($cc)." AND npa=".$db->qstr($npa)." AND nxx=".$db->qstr($nxx)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } else { - $station = substr($e164, 4 + strlen($cc)); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=".time().", account_id=".intval(SESS_ACCOUNT)." - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND (account_id IS NULL or account_id=0) AND - country_code=".$db->qstr($cc)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } - $db->Execute($sql); - syslog(LOG_INFO,$sql); - if ($db->Affected_Rows()) - return true; - } - return "Could not complete request, the number has already been reserved by another user.
- Please go back and refresh the order page and make a different selection."; - } - - /** Purchase a DID - */ - function purchase($voip_did_plugin_id, $did) { - # Include the voip class - include_once(PATH_MODULES.'voip/voip.inc.php'); - $v = new voip; - - $db =& DB(); - - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($v->e164($did, $e164, $cc, $npa, $nxx)) { - if ($cc == '1') { - $station = substr($e164, 8); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=NULL, account_id=".intval($this->account_id)." - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND - country_code=".$db->qstr($cc)." AND npa=".$db->qstr($npa)." AND nxx=".$db->qstr($nxx)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } elseif($cc == '61') { - $station = substr($e164, 12); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=NULL, account_id=".intval($this->account_id)." - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND - country_code=".$db->qstr($cc)." AND npa=".$db->qstr($npa)." AND nxx=".$db->qstr($nxx)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } else { - $station = substr($e164, 4 + strlen($cc)); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=NULL, account_id=".intval($this->account_id)." - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND - country_code=".$db->qstr($cc)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } - syslog(LOG_INFO,$sql); - $db->Execute($sql); - if ($db->Affected_Rows()) - return true; - } - return "Could not complete request, the number has already been reserved by another user.
- Please go back and refresh the order page and make a different selection."; - } - - /** Release the DID back to the pool of available numbers - */ - function release($voip_did_plugin_id, $did) { - # Include the voip class - include_once(PATH_MODULES.'voip/voip.inc.php'); - $v = new voip; - - $db =& DB(); - - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($v->e164($did, $e164, $cc, $npa, $nxx)) { - if ($cc == '1') { - $station = substr($e164, 8); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=NULL, account_id=NULL - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND - country_code=".$db->qstr($cc)." AND npa=".$db->qstr($npa)." AND nxx=".$db->qstr($nxx)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } elseif($cc == '61'){ - $station = substr($e164, 12); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=NULL, account_id=NULL - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND - country_code=".$db->qstr($cc)." AND npa=".$db->qstr($npa)." AND nxx=".$db->qstr($nxx)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } else { - $station = substr($e164, 4 + strlen($cc)); - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_pool SET - date_reserved=NULL, account_id=NULL - WHERE voip_did_plugin_id=".$voip_did_plugin_id." AND - country_code=".$db->qstr($cc)." AND station=".$db->qstr($station)." AND site_id=".DEFAULT_SITE; - } - $db->Execute($sql); - #echo $sql; - if ($db->Affected_Rows()) - return true; - } - return "Could not complete request, the number has already been reserved by another user.
- Please go back and refresh the order page and make a different selection."; - } - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } -} -?> \ No newline at end of file diff --git a/modules/voip_did_plugin/voip_did_plugin_construct.xml b/modules/voip_did_plugin/voip_did_plugin_construct.xml deleted file mode 100644 index e0de5c56..00000000 --- a/modules/voip_did_plugin/voip_did_plugin_construct.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - voip_did_plugin - voip_did_plugin
- voip - 0 - name - 35 - - - I4 - 1 - - - C(16) - - - C(32) - any - 1 - - - C(32) - any - - - X2 - any - array - - - I4 - - - X2 - array - - - - id,site_id,name,plugin,avail_countries,release_minutes,plugin_data - id,site_id,name,plugin,avail_countries,release_minutes,plugin_data - id,site_id,name,plugin,avail_countries,release_minutes,plugin_data - id,site_id,name,plugin,avail_countries,release_minutes,plugin_data - id,site_id,name,plugin,avail_countries,release_minutes,plugin_data - - 0 -
\ No newline at end of file diff --git a/modules/voip_did_plugin/voip_did_plugin_install.xml b/modules/voip_did_plugin/voip_did_plugin_install.xml deleted file mode 100644 index 615d93ad..00000000 --- a/modules/voip_did_plugin/voip_did_plugin_install.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - voip_did_plugin - voip - This module controls the various did plugins - 1 - voip - - - - - - - - add - %%:add - 1 - - - update - - - delete - - - view - core:search&module=%%&_escape=1 - 1 - - - search - - - search_show - - - - - \ No newline at end of file diff --git a/modules/voip_did_plugin/voip_did_plugin_install_data.xml b/modules/voip_did_plugin/voip_did_plugin_install_data.xml deleted file mode 100644 index bd39644e..00000000 --- a/modules/voip_did_plugin/voip_did_plugin_install_data.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - 1 - 1 - Default ( USA, UK, CANADA) - DEFAULT - - 360 - - - - 3 - 1 - DidX - DIDX - - 360 - - - - 4 - 1 - Magrathea-Telecom - MAGRATHEA - - 360 - - - - 4 - - \ No newline at end of file diff --git a/modules/voip_fax/auth.inc.php b/modules/voip_fax/auth.inc.php deleted file mode 100644 index 2f3f93a6..00000000 --- a/modules/voip_fax/auth.inc.php +++ /dev/null @@ -1,12 +0,0 @@ - 'voip_fax', 'method' => 'user_search_show'), - Array ('module' => 'voip_fax', 'method' => 'user_search'), - Array ('module' => 'voip_fax', 'method' => 'user_view'), - Array ('module' => 'voip_fax', 'method' => 'user_delete') - ); -?> \ No newline at end of file diff --git a/modules/voip_fax/voip_fax.inc.php b/modules/voip_fax/voip_fax.inc.php deleted file mode 100644 index 64838298..00000000 --- a/modules/voip_fax/voip_fax.inc.php +++ /dev/null @@ -1,192 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_fax -{ - var $did; - - # Open the constructor for this mod - function voip_fax() - { - # name of this module: - $this->module = "voip_fax"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - function user_view($VAR) { - if(SESS_LOGGED) { - $this->did = @$VAR['id']; - $db = &DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_fax","account_id","id = ::$this->did::")); - if($rs->fields['account_id'] == SESS_ACCOUNT) { - $this->view($VAR,$this); - } - } - echo "Not logged in or authenticated!"; - } - - function user_delete($VAR) { - if(SESS_LOGGED) { - $this->did = @$VAR['id']; - $db = &DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_fax","account_id","id = ::$this->did::")); - if($rs->fields['account_id'] == SESS_ACCOUNT) { - $this->delete($VAR,$this); - } - } - } - - function user_search_show($VAR) { - $this->search_show($VAR,$this); - } - - function user_search($VAR) { - if(SESS_LOGGED) { - include_once(PATH_MODULES."voip/voip.inc.php"); - $db =& DB(); - $v = new voip; - $fdids = $v->get_fax_dids(SESS_ACCOUNT); - #echo "
".print_r($fdids,true)."
"; - if (is_array($fdids)) { - foreach ($fdids as $did) { - $flds['account_id'] = SESS_ACCOUNT; - $flds['site_id'] = DEFAULT_SITE; - $sql = sqlUpdate($db, "voip_fax", $flds, "dst = ::".$did."::"); - $db->Execute($sql); - #echo $sql."
"; - } - } - unset($db); - $VAR['voip_fax_account_id'] = SESS_ACCOUNT; - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } else { - define("FORCE_REDIRECT", "?_page=account:account"); - } - } - - function view($VAR) { - global $_SERVER; - ob_clean(); - ob_start(); - $this->did = @$VAR['id']; - $db = &DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_fax","mime_type","id = ::$this->did::")); - if ($rs && $rs->RecordCount()==1) - { - $this->mime_type = $rs->fields['mime_type']; - $fax = & $db->Execute(sqlSelect($db,"voip_fax_data","faxdata","fax_id = ::$this->did::")); - if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) { - ini_set('zlib.output_compression','Off'); - } - header("Content-Type: ". $this->mime_type ); - header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Pragma: public"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Content-Disposition: attachment; filename=\"fax.pdf\""); - while(!$fax->EOF) { - echo $fax->fields['faxdata']; - $fax->MoveNext(); - } - } - ob_end_flush(); - exit(); - } - - function add($VAR) { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - function update($VAR) { - // delete assoc faxdata records - $this->associated_DELETE[] = Array( 'table' => 'voip_fax_data', 'field' => 'fax_id'); - - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - function delete($VAR) { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search_form($VAR) { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - function search($VAR) { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) { - if(SESS_LOGGED) { - include_once(PATH_MODULES."voip/voip.inc.php"); - $db =& DB(); - $v = new voip; - $fdids = $v->get_fax_dids(SESS_ACCOUNT); - #echo "
".print_r($fdids,true)."
"; - if (is_array($fdids)) { - foreach ($fdids as $did) { - $sql = "UPDATE ".AGILE_DB_PREFIX."voip_fax SET - account_id = ".$db->qstr(SESS_ACCOUNT).", - site_id = ".$db->qstr(DEFAULT_SITE)." - WHERE dst = ".$db->qstr($did); - $db->Execute($sql); - #echo "did=$did ".$sql."
"; - } - } - unset($db); - } - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } -} -?> \ No newline at end of file diff --git a/modules/voip_fax/voip_fax_construct.xml b/modules/voip_fax/voip_fax_construct.xml deleted file mode 100644 index 3e0984a4..00000000 --- a/modules/voip_fax/voip_fax_construct.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - voip_fax - voip_fax
- voip - 0 - date_orig - 50 - - dst - - - - I4 - 1 - - - I4 - - - I4 - account - username - - - C(16) - date-time - - - C(64) - - - C(64) - - - C(64) - - - I4 - - - C(16) - - - C(16) - - - I4 - - - I4 - - - I4 - - - C(32) - - - - id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type - id,site_id,account_id,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type - id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type - id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type - id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type - - 0 -
\ No newline at end of file diff --git a/modules/voip_fax/voip_fax_install.xml b/modules/voip_fax/voip_fax_install.xml deleted file mode 100644 index 01741325..00000000 --- a/modules/voip_fax/voip_fax_install.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - voip_fax - voip - This module stores the VoIP fax records - 1 - voip - - - - - - update - - - delete - - - view - core:search&module=%%&_escape=1 - 1 - - - search - %%:search_form - 1 - - - search_form - - - search_show - - - - \ No newline at end of file diff --git a/modules/voip_fax_data/voip_fax_data.inc.php b/modules/voip_fax_data/voip_fax_data.inc.php deleted file mode 100644 index e6d18a04..00000000 --- a/modules/voip_fax_data/voip_fax_data.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/modules/voip_fax_data/voip_fax_data_construct.xml b/modules/voip_fax_data/voip_fax_data_construct.xml deleted file mode 100644 index b275c21c..00000000 --- a/modules/voip_fax_data/voip_fax_data_construct.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - voip_fax_data - voip_fax_data
- voip - 0 - id - 35 - - fax_id - - - - I4 - 1 - - - I4 - - - I8 - - - B - - 0 - - 0 -
\ No newline at end of file diff --git a/modules/voip_fax_data/voip_fax_data_install.xml b/modules/voip_fax_data/voip_fax_data_install.xml deleted file mode 100644 index bb89abe8..00000000 --- a/modules/voip_fax_data/voip_fax_data_install.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - voip_fax_data - voip - This module stores the binary fax data in PDF format - - voip - - - - - - - \ No newline at end of file diff --git a/modules/voip_iax/voip_iax.inc.php b/modules/voip_iax/voip_iax.inc.php deleted file mode 100644 index 7f09883a..00000000 --- a/modules/voip_iax/voip_iax.inc.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/modules/voip_iax/voip_iax_construct.xml b/modules/voip_iax/voip_iax_construct.xml deleted file mode 100644 index 44403450..00000000 --- a/modules/voip_iax/voip_iax_construct.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - voip_iax - voip_iax
- voip - 0 - id - 35 - - keyword - - - - I4 - - - I4 - - - C(32) - - - C(32) - - - C(255) - - - L - - - 0 - 0 -
\ No newline at end of file diff --git a/modules/voip_iax/voip_iax_install.xml b/modules/voip_iax/voip_iax_install.xml deleted file mode 100644 index 775fb5ad..00000000 --- a/modules/voip_iax/voip_iax_install.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - voip_iax - voip - This module stores the IAX records - - voip - - - - - - - \ No newline at end of file diff --git a/modules/voip_in_network/voip_in_network.inc.php b/modules/voip_in_network/voip_in_network.inc.php deleted file mode 100644 index 10acea9f..00000000 --- a/modules/voip_in_network/voip_in_network.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/modules/voip_in_network/voip_in_network_construct.xml b/modules/voip_in_network/voip_in_network_construct.xml deleted file mode 100644 index 46f20fd9..00000000 --- a/modules/voip_in_network/voip_in_network_construct.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - voip_in_network - voip_in_network
- voip - 0 - id - 35 - - did - - - - I4 - - - I4 - - - C(16) - 1 - - - 0 - 0 -
\ No newline at end of file diff --git a/modules/voip_in_network/voip_in_network_install.xml b/modules/voip_in_network/voip_in_network_install.xml deleted file mode 100644 index 72f152fc..00000000 --- a/modules/voip_in_network/voip_in_network_install.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - voip_in_network - voip - This module stores the data for the in network checks - - voip - - - - - - - \ No newline at end of file diff --git a/modules/voip_local_lookup/voip_local_lookup.inc.php b/modules/voip_local_lookup/voip_local_lookup.inc.php deleted file mode 100644 index 7ec1ec0f..00000000 --- a/modules/voip_local_lookup/voip_local_lookup.inc.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/modules/voip_local_lookup/voip_local_lookup_construct.xml b/modules/voip_local_lookup/voip_local_lookup_construct.xml deleted file mode 100644 index 34b2e45c..00000000 --- a/modules/voip_local_lookup/voip_local_lookup_construct.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - voip_local_lookup - voip_local_lookup
- voip - 0 - id - 35 - - npa,nxx - - - - I4 - 1 - - - I4 - - - C(4) - - - C(4) - - - I4 - - - 0 - 0 -
\ No newline at end of file diff --git a/modules/voip_local_lookup/voip_local_lookup_install.xml b/modules/voip_local_lookup/voip_local_lookup_install.xml deleted file mode 100644 index 3847190e..00000000 --- a/modules/voip_local_lookup/voip_local_lookup_install.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - voip_local_lookup - voip - This module stores the VoIP local lookup records - - voip - - - - - - - \ No newline at end of file diff --git a/modules/voip_pool/voip_pool.inc.php b/modules/voip_pool/voip_pool.inc.php deleted file mode 100644 index 92f83a76..00000000 --- a/modules/voip_pool/voip_pool.inc.php +++ /dev/null @@ -1,268 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_pool -{ - # Open the constructor for this mod - function voip_pool() - { - # name of this module: - $this->module = "voip_pool"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - function task_area() - { - include_once(PATH_MODULES.'voip/voip.inc.php'); - $db =& DB(); - $didArea = new didArea; - $sql = sqlSelect($db,"voip_pool","*","areacode is null or areacode=0"); - $rs = $db->Execute($sql); - if($rs && $rs->RecordCount()) { - while(!$rs->EOF) { - $n = $rs->fields['npa'].$rs->fields['nxx'].$rs->fields['station']; - if( ($area = $didArea->determineArea($rs->fields['country_code'], $n)) !== false) { - #echo "DID=".$n." has an area of $area = ".$didArea->getName($rs->fields['country_code'],$area)."
"; - $f = array('areacode' => $db->qstr($area)); - $sql = sqlUpdate($db,"voip_pool",$f,"id=".$rs->fields['id']); - #echo "plugin_id=".$rs->fields['voip_did_plugin_id']."
"; - #echo $sql."
"; - $db->Execute($sql); - } - $rs->MoveNext(); - } - } - } - - /** Imports an uploaded text file into the voip_pool table. Each line must contain a single valid phone number. - - +--------------------+--------------+------+-----+---------+-------+ - | Field | Type | Null | Key | Default | Extra | - +--------------------+--------------+------+-----+---------+-------+ - | id | mediumint(9) | | PRI | 0 | | - | site_id | mediumint(9) | YES | MUL | NULL | | - | account_id | mediumint(9) | YES | | NULL | | - | npa | varchar(16) | YES | MUL | NULL | | - | nxx | varchar(16) | YES | | NULL | | - | station | varchar(32) | YES | | NULL | | - | country_code | mediumint(9) | YES | | NULL | | - | date_reserved | bigint(20) | YES | | NULL | | - | voip_did_plugin_id | mediumint(9) | YES | | NULL | | - +--------------------+--------------+------+-----+---------+-------+ - - */ - function import($VAR) - { - # Include the voip class - include_once(PATH_MODULES.'voip/voip.inc.php'); - $v = new voip; - - $db = & DB(); - if (is_uploaded_file($_FILES['datafile']['tmp_name'])) { - # Got a file to import - $fp = fopen($_FILES['datafile']['tmp_name'],"r"); - if ($fp) { - $counter = 0; $skipped = 0; - while (!feof($fp)) { - $line = fgets($fp,128); - $line = ereg_replace("[^0-9]", "", $line); - $cc = ""; $npa = ""; $nxx = ""; $e164 = ""; - if ($v->e164($line, $e164, $cc, $npa, $nxx)) { - $fields['voip_did_plugin_id'] = $VAR['voip_did_plugin_id']; /* DEFAULT plugin */ - $fields['country_code'] = $cc; - $fields['npa'] = $npa; - $fields['nxx'] = $nxx; - if ($cc == '1') { - $fields['station'] = substr($e164, 8); - } elseif($cc == "61") { - $fields['station'] = substr($e164, 12); - } else { - $fields['station'] = substr($e164, 4 + strlen($cc)); - } - $rs = $db->Execute( sqlSelect($db, "voip_pool", "id", "voip_did_plugin_id=::".$VAR['voip_did_plugin_id'].":: and country_code=::".$fields['country_code'].":: and npa=::".$fields['npa'].":: and nxx=::".$fields['nxx'].":: and station=::".$fields['station']."::") ); - if ($rs && !$rs->EOF) { - $skipped++; - } else { - $db->Execute( sqlInsert($db, "voip_pool", $fields) ); - $counter++; - } - } else { - $skipped++; - } - } - global $C_debug; - $C_debug->error('voip_pool.inc.php','import',"Imported $counter new DIDs and skipped $skipped DIDs!"); - $C_debug->alert("Imported $counter new DIDs and skipped $skipped DIDs!"); - } else { - # log error message - global $C_debug; - $C_debug->error('voip_pool.inc.php','import','Unable to process file: '.$_FILES['datafile']['tmp_name']); - $C_debug->alert('Unable to fopen the file sent.'); - } - } else { - # log error message - global $C_debug; - $C_debug->error('voip_pool.inc.php','import','Possible file upload attack'); - $C_debug->alert('Unable to process the uploaded file.'); - } - } - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - ############################## - ## SEARCH EXPORT ## - ############################## - function search_export($VAR) - { - # require the export class - require_once (PATH_CORE . "export.inc.php"); - - # Call the correct export function for inline browser display, download, email, or web save. - if($VAR["format"] == "excel") - { - $type = "export_excel"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_excel($VAR, $this, $type); - } - - else if ($VAR["format"] == "pdf") - { - $type = "export_pdf"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_pdf($VAR, $this, $type); - } - - else if ($VAR["format"] == "xml") - { - $type = "export_xml"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_xml($VAR, $this, $type); - } - - else if ($VAR["format"] == "csv") - { - $type = "export_csv"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_csv($VAR, $this, $type); - } - - else if ($VAR["format"] == "tab") - { - $type = "export_tab"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_tab($VAR, $this, $type); - } - } -} -?> \ No newline at end of file diff --git a/modules/voip_pool/voip_pool_construct.xml b/modules/voip_pool/voip_pool_construct.xml deleted file mode 100644 index 0b9d6a5b..00000000 --- a/modules/voip_pool/voip_pool_construct.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - voip_pool - voip_pool
- voip - 0 - npa - 35 - - npa,nxx,station,country_code,voip_did_plugin_id - voip_did_plugin_id,country_code,areacode - site_id,country_code,areacode - - - - I4 - 1 - - - I4 - - - I4 - - - C(16) - 3 - 3 - numeric - - - C(16) - 3 - 3 - numeric - - - C(32) - 2 - numeric - - - I4 - - - I8 - - - I4 - - - I4 - - - - id,site_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,site_id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,site_id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,site_id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,site_id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id - - 0 -
\ No newline at end of file diff --git a/modules/voip_pool/voip_pool_install.xml b/modules/voip_pool/voip_pool_install.xml deleted file mode 100644 index 7a1826bb..00000000 --- a/modules/voip_pool/voip_pool_install.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - voip_pool - voip - This module stores the VoIP Pool records - 1 - voip - - - - - add - - - search_export - - - update - - - export_excel - - - delete - - - export_xml - - - view - core:search&module=%%&_escape=1 - 1 - - - import - %%:import - 1 - - - export_tab - - - search - - - search_show - - - export_csv - - - - \ No newline at end of file diff --git a/modules/voip_prepaid/auth.inc.php b/modules/voip_prepaid/auth.inc.php deleted file mode 100644 index 1986020f..00000000 --- a/modules/voip_prepaid/auth.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - 'voip_prepaid', 'method' => 'menu_pins') -); -?> \ No newline at end of file diff --git a/modules/voip_prepaid/voip_prepaid.inc.php b/modules/voip_prepaid/voip_prepaid.inc.php deleted file mode 100644 index c8a57f69..00000000 --- a/modules/voip_prepaid/voip_prepaid.inc.php +++ /dev/null @@ -1,529 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_prepaid -{ - - # Open the constructor for this mod - function voip_prepaid() - { - $db =& DB(); - $rs = $db->Execute(sqlSelect($db,"voip","prepaid_low_balance","id=::".DEFAULT_SITE."::")); - - if ($rs && $rs->RecordCount() > 0) - { - # e-mail user's once when balance reaches this amount: - $this->lowBalance = $rs->fields[0]; - } - else - { - $this->lowBalance = false; - } - - $this->pinLenth = 10; // up to 10 - - # name of this module: - $this->module = "voip_prepaid"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - /** generate a new pin */ - function genPin() - { - for($trys=0; $trys<=10; $trys++) - { - $rand = rand(1000000000,9999999999); - $pin = substr($rand,0,$this->pinLenth); - - // check if unique - $db=&DB(); - $rs = $db->Execute(sqlSelect($db,"voip_prepaid","id","pin = ::$pin::")); - if($rs->RecordCount() > 0) { - $trys++; // pin is not unique - } else { - return $pin; // pin is unique - } - } - return false; - } - - /** balance notification task */ - function task($VAR) - { - include_once(PATH_MODULES.'email_template/email_template.inc.php'); - - // do not run task if lowBalance is not set - if ($this->lowBalance == false) - return; - - // delete expired pins? - // $delrs = & $db->Execute(sqlDelete($db,"voip_prepaid"," date_expire <> 0 and date_expire is not null and date_expire > ".time())); - - // get low balances and notify - $db=&DB(); - $rs = & $db->Execute($sql = sqlSelect($db,"voip_prepaid","*", "balance <= $this->lowBalance and (bulk is null or bulk=0) and (date_email is null or date_email = 0) ")); - if($rs && $rs->RecordCount() > 0) - { - while(!$rs->EOF) - { - # send the user the details - $email = new email_template; - $email->send('voip_balance_prepaid', $rs->fields['account_id'], $rs->fields['id'], '', number_format($rs->fields['balance'],4)); - - # update the record - $db->Execute( sqlUpdate($db, "voip_prepaid", array('date_email'=>time()),"id={$rs->fields['id']}")); - $rs->MoveNext(); - } - } - } - - - /** provision pin */ - function provision_pin_new(&$obj) - { - $db =&DB(); - - // default field values: - if(!empty($obj->product_attr['expire']) && !empty($obj->product_attr['expire_days'])) - $fields['expire_days'] = $obj->product_attr['expire_days']; - $fields['date_expire'] = 0; - - // check if user passed existing pin - if(!empty($obj->prod_attr_cart['pin'])) - { - // if existing pin, validate that it belongs to the user and we can add a balance to it - $pin = $obj->prod_attr_cart['pin']; - $pinrs = & $db->Execute(sqlSelect($db,"voip_prepaid","*","pin = ::$pin:: AND account_id = {$obj->account['id']} ")); - if($pinrs && $pinrs->RecordCount() == 1) - { - // update existing pin: - $fields['balance'] = $obj->service['price'] + $pinrs->fields['balance']; - $rs = $db->Execute(sqlUpdate($db,"voip_prepaid",$fields,"pin = ::$pin::")); - return true; - } - } - - // the balance from the invoice line item (not including setup fee) - $itemid = $obj->service['invoice_item_id']; - $invoiceItem = $db->Execute(sqlSelect($db,"invoice_item","price_base","id = $itemid")); - if($invoiceItem && $invoiceItem->RecordCount() > 0) { - $balance = $invoiceItem->fields['price_base']; - } else { - $balance = $obj->service['price']; - } - - // still here? generate a new pin - $pin = $this->genPin(); - if(!$pin) return false; // could not generate unique - $fields = Array('account_id' => $obj->account['id'], - 'product_id' => $obj->service['product_id'], - 'pin' => $pin, - 'balance' => $balance, - 'in_use' => 0); - if(!empty($obj->product_attr['expire']) && !empty($obj->product_attr['expire_days'])) $fields['expire_days'] = $obj->product_attr['expire_days']; - $pin_id = sqlGenID($db, "voip_prepaid"); - $sql=sqlInsert($db,"voip_prepaid",$fields, $pin_id); - $rs = $db->Execute($sql); - if ($rs) { - # send the user the details - include_once(PATH_MODULES.'email_template/email_template.inc.php'); - $email = new email_template; - $email->send('voip_new_prepaid_pin', $obj->account['id'], $pin_id, $pin, $obj->plugin_data['number']); - } else { - return false; - } - return true; - } - - /** provision ani */ - function provision_ani_new($obj) - { - $db=&DB(); - - // default field values: - if(!empty($obj->product_attr['expire']) && !empty($obj->product_attr['expire_days'])) - $fields['expire_days'] = $obj->product_attr['expire_days']; - $fields['date_expire'] = 0; - - // check if ani exists already in db - $pin = $obj->prod_attr_cart['ani_new']; - if(!empty($pin)) { - $pinexists = $db->Execute(sqlSelect($db,"voip_prepaid","*","pin = ::$pin:: AND ani=1")); - } - - if($pinexists && $pinexists->RecordCount()>0) - { - // update existing pin: - $fields['balance'] = $obj->service['price'] + $pinexists->fields['balance']; - $rs = $db->Execute(sqlUpdate($db,"voip_prepaid",$fields,"pin = ::$pin:: AND ani=1")); - return true; - } - elseif(!empty($obj->prod_attr_cart['ani_old'])) - { - // existing ani provided by user - $pin = $obj->prod_attr_cart['ani_old']; - $pinrs = $db->Execute(sqlSelect($db,"voip_prepaid","*","pin = ::$pin:: AND ani=1")); - if($pinrs && $pinrs->RecordCount() == 1) - { - // update existing pin: - $fields['balance'] = $obj->service['price'] + $pinexists->fields['balance']; - $rs = $db->Execute(sqlUpdate($db,"voip_new_prepaid_did",$fields,"pin = ::$pin:: AND ani=1")); - return true; - } - } - - // the balance from the invoice line item (not including setup fee) - $itemid = $obj->service['invoice_item_id']; - $invoiceItem = $db->Execute(sqlSelect($db,"invoice_item","price_base","id = $itemid")); - if($invoiceItem && $invoiceItem->RecordCount() > 0) { - $balance = $invoiceItem->fields['price_base']; - } else { - $balance = $obj->service['price']; - } - - // still here? generate a new ani prepaid record - $pin = $obj->prod_attr_cart['ani_new']; - $fields = Array('account_id' => $obj->account['id'], - 'product_id' => $obj->service['product_id'], - 'pin' => trim($pin), - 'balance' => $balance, - 'in_use' => 0, - 'ani' => 1); - if(!empty($obj->product_attr['expire']) && !empty($obj->product_attr['expire_days'])) - $fields['expire_days'] = $obj->product_attr['expire_days']; - - $pin_id = sqlGenID($db, "voip_prepaid"); - $sql=sqlInsert($db,"voip_prepaid", $fields, $pin_id); - $rs = $db->Execute($sql); - - if ($rs) { - # send the user the details - include_once(PATH_MODULES.'email_template/email_template.inc.php'); - $email = new email_template; - $email->send('voip_new_prepaid_ani', $obj->account['id'], $pin_id, $pin_id, $obj->plugin_data['number']); - } else { - return false; - } - return true; - } - - - /** provision did */ - function provision_did_new($obj) - { - @$a = unserialize($obj->service['prod_attr_cart']); - $did = $a['station']; - - // new or top-up? - $db=&DB(); - $didrs = $db->Execute($sql=sqlSelect($db,"voip_prepaid","id,pin,balance","pin = ::{$did}:: AND voip_did_id is not null AND voip_did_id <> 0 ")); - if($didrs && $didrs->RecordCount() > 0) { - $new = false; - } else { - $new = true; - } - - // the balance from the invoice line item (not including setup fee) - $itemid = $obj->service['invoice_item_id']; - $invoiceItem = $db->Execute(sqlSelect($db,"invoice_item","price_base","id = $itemid")); - if($invoiceItem && $invoiceItem->RecordCount() > 0) { - $balance = $invoiceItem->fields['price_base']; - } else { - $balance = $obj->service['price']; - } - /* - echo "

$sql

"; - - echo $new; - - echo "$".$balance; - - #print_r($obj->service); - */ - - - if ($new) - { - // include voip plugin and provision the did - include_once(PATH_PLUGINS.'product/VOIP.php'); - $voip = new plgn_prov_VOIP; - if(!$voip->p_one($obj->service_id)) return false; - - # create the prepaid record - $didrs = $db->Execute(sqlSelect($db,"voip_did","id,did","service_id = ::{$obj->service_id}::")); - if($didrs && $didrs->RecordCount() > 0) - { - $fields = Array('account_id' => $obj->account['id'], - 'product_id' => $obj->service['product_id'], - 'voip_did_id' => $didrs->fields['id'], - 'pin' => $didrs->fields['did'], - 'balance' => $balance, - 'in_use' => 0); - - $pin_id = sqlGenID($db, "voip_prepaid"); - $sql=sqlInsert($db,"voip_prepaid", $fields, $pin_id); - $rs = $db->Execute($sql); - return true; - } else { - return false; - } - } - else - { - # top-up the prepaid balance - $fields = Array( 'balance' => $balance + $didrs->fields['balance']); - $db->Execute($sql = sqlUpdate($db,"voip_prepaid", $fields, "id = {$didrs->fields['id']}")); - return true; - } - return true; - } - - - /** get users existing prepaid numbers */ - function menu_did($VAR) - { - global $smarty; - if(!SESS_LOGGED) { - $smarty->assign('ani', false); - return; - } - - if(!empty($VAR['account_id'])) - $account_id = $VAR['account_id']; - else - $account_id = SESS_ACCOUNT; - - $db=&DB(); - $rs = & $db->Execute($sql=sqlSelect($db,"voip_prepaid","*","voip_did_id is not null AND voip_did_id <> 0 AND (ani <> 1 or ani is null) AND account_id = ".$account_id)); - if($rs && $rs->RecordCount() > 0) { - $arr[0] = "-- New Number --"; - while(!$rs->EOF) { - $arr["{$rs->fields['pin']}"] = "Number: ". $rs->fields['pin'] . ' -- Balance: '. number_format($rs->fields['balance'],6); - $rs->MoveNext(); - } - } else { - $arr=false; - } - $smarty->assign('dids', $arr); - return; - } - - - /** get users existing ani numbers */ - function menu_ani($VAR) - { - global $smarty; - if(!SESS_LOGGED) { - $smarty->assign('ani', false); - return; - } - - if(!empty($VAR['account_id'])) - $account_id = $VAR['account_id']; - else - $account_id = SESS_ACCOUNT; - - $db=&DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_prepaid","*","ani=1 AND account_id = ".$account_id)); - if($rs && $rs->RecordCount() > 0) { - $arr[0] = "-- New Number --"; - while(!$rs->EOF) { - $arr["{$rs->fields['pin']}"] = "Number: ". $rs->fields['pin'] . ' -- Balance: '. number_format($rs->fields['balance'],6); - $rs->MoveNext(); - } - } else { - $arr=false; - } - $smarty->assign('ani', $arr); - return; - } - - - /** get users existing pin numbers */ - function menu_pins($VAR) - { - global $smarty; - if(!SESS_LOGGED) { - $smarty->assign('pins', false); - return; - } - - if(!empty($VAR['account_id'])) - $account_id = $VAR['account_id']; - else - $account_id = SESS_ACCOUNT; - - $db=&DB(); - $rs = & $db->Execute(sqlSelect($db,"voip_prepaid","*","(ani = 0 OR ani is null) AND account_id = ".$account_id)); - if($rs && $rs->RecordCount() > 0) { - $arr[0] = "-- Generate a new Pin # for this purchase --"; - while(!$rs->EOF) { - $arr["{$rs->fields['pin']}"] = "Pin # ". $rs->fields['pin'] . ' -- Balance: '. number_format($rs->fields['balance'],6); - $rs->MoveNext(); - } - } else { - $arr=false; - } - $smarty->assign('pins', $arr); - return; - } - - /** Add new pin(s) */ - function add($VAR) - { - if(!empty($VAR['bulk'])) - { - if(empty($VAR['voip_prepaid_account_id']) || empty($VAR['voip_prepaid_product_id']) || - empty($VAR['voip_prepaid_balance']) || empty($VAR['voip_prepaid_qty']) || empty($VAR['voip_prepaid_bulk'])) - { - print("Failed: Please check that you have provided an account, product, balance, and quantity, and bulk reference number"); - return; - } - else - { - $db=&DB(); - - for($i=0; $i<$VAR['voip_prepaid_qty']; $i++) - { - if($pin = $this->genPin()) - { - // insert the record - $fields["pin"]=$pin; - $fields["account_id"] = $VAR['voip_prepaid_account_id']; - $fields["product_id"] = $VAR['voip_prepaid_product_id']; - $fields["balance"] = $VAR['voip_prepaid_balance']; - $fields['date_expire'] = $VAR['voip_prepaid_date_expire']; - $fields["bulk"] = $VAR['voip_prepaid_bulk']; - $db->Execute(sqlInsert($db,"voip_prepaid",$fields)); - } - } - echo "Added Batch Successfully!"; - echo ""; - } - - } else { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - } - - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - - /** Export search results */ - function search_export($VAR) - { - # require the export class - require_once (PATH_CORE . "export.inc.php"); - - # Call the correct export function for inline browser display, download, email, or web save. - if($VAR["format"] == "excel") - { - $type = "export_excel"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_excel($VAR, $this, $type); - } - - else if ($VAR["format"] == "xml") - { - $type = "export_xml"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_xml($VAR, $this, $type); - } - - else if ($VAR["format"] == "csv") - { - $type = "export_csv"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_csv($VAR, $this, $type); - } - - else if ($VAR["format"] == "tab") - { - $type = "export_tab"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $export = new CORE_export; - $export->search_tab($VAR, $this, $type); - } - } -} -?> diff --git a/modules/voip_prepaid/voip_prepaid_construct.xml b/modules/voip_prepaid/voip_prepaid_construct.xml deleted file mode 100644 index d4cfdfb7..00000000 --- a/modules/voip_prepaid/voip_prepaid_construct.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - voip_prepaid - voip_prepaid
- voip - 0 - id - 35 - - pin - account_id - product_id - - - - I8 - 1 - - - C(16) - - - I8 - date - - - I8 - - - I4 - any - - - I4 - - - I4 - - - C(16) - any - product - sku - - - L - - - C(16) - 1 - numeric - - - F - - - L - - - C(16) - - - I4 - - - - id - id,site_id,account_id,product_id,pin,balance,in_use,expire_days,ani,voip_did_id - id,site_id,date_expire,account_id,product_id,pin,balance,in_use,expire_days,ani,voip_did_id - id,site_id,date_expire,bulk,date_email,account_id,product_id,pin,balance,in_use,expire_days,ani,voip_did_id - id,site_id,date_expire,bulk,date_email,account_id,product_id,pin,balance,in_use,expire_days,ani,voip_did_id - pin,balance,date_expire,account_id,product_id,bulk,expire_days,ani,voip_did_id - pin,balance,date_expire,bulk - pin,balance,date_expire,bulk - pin,balance,date_expire,bulk - pin,balance,date_expire,bulk - - 0 -
\ No newline at end of file diff --git a/modules/voip_prepaid/voip_prepaid_install.xml b/modules/voip_prepaid/voip_prepaid_install.xml deleted file mode 100644 index 4dd3bf5e..00000000 --- a/modules/voip_prepaid/voip_prepaid_install.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - voip_prepaid - voip - This module controls prepaid pin numbers - 1 - voip - - - - - - - add - %%:add - 1 - - - add_batch - %%:add_batch - 1 - - - update - - - delete - - - view - core:search&module=%%&_escape=1 - 1 - - - search - %%:search_form - 1 - - - search_form - - - search_show - - - export_csv - - - export_excel - - - search_export - - - export_xml - - - export_tab - - - - \ No newline at end of file diff --git a/modules/voip_rate/voip_rate.inc.php b/modules/voip_rate/voip_rate.inc.php deleted file mode 100644 index 8a09651d..00000000 --- a/modules/voip_rate/voip_rate.inc.php +++ /dev/null @@ -1,215 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_rate -{ - - # Open the constructor for this mod - function voip_rate() - { - # name of this module: - $this->module = "voip_rate"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - function import($VAR) - { - $db =& DB(); - $rs = $db->Execute(sqlSelect($db,"product", "id,sku", "prod_plugin_file=::VOIP:: and prod_plugin=1")); - $prods[0] = "-- NONE --"; - while (!$rs->EOF) { - $prods[$rs->fields['id']] = $rs->fields['sku']; - $rs->MoveNext(); - } - $ic[0]['name'] = 'product_id'; - $ic[0]['type'] = 'select'; - $ic[0]['value'] = $prods; - $this->import_custom = $ic; - - include_once(PATH_CORE.'import.inc.php'); - $import = new CORE_import; - - if(empty($VAR['confirm'])) { - $import->prepare_import($VAR, $this); - } else { - $import->do_new_import($VAR, $this); - } - } - - function import_line_process(&$db, &$VAR, &$fields, &$record) - { - if (!$VAR['import_select']['product_id']) - return; - $f['product_id'] = $VAR['import_select']['product_id']; - $f['voip_rate_id'] = $record['id']; - $db->Execute(sqlInsert($db, "voip_rate_prod", $f)); - } - - /** Output avial/assigned rate tables for configuration - */ - function product_rates($VAR) - { - @$product = $VAR['product']; - - $avail=false; - $assigned=false; - - $db=&DB(); - $as = $db->Execute($sql = sqlSelect($db,"voip_rate_prod","voip_rate_id","product_id = ::$product::")); - if($as && $as->RecordCount() > 0) { - while(!$as->EOF) { - $av["{$as->fields['voip_rate_id']}"] = true; - $as->MoveNext(); - } - } - - $rs = $db->Execute($sql = sqlSelect($db,"voip_rate","id,name,pattern,amount","")); - if($rs && $rs->RecordCount() > 0) - { - while(!$rs->EOF) - { - if(is_array($av) && array_key_exists($rs->fields['id'], $av)) { - $assigned[] = Array('id'=> $rs->fields['id'], 'name' => $rs->fields['name'].' - '. substr($rs->fields['pattern'],0,20).' - '.$rs->fields['amount']); - } else { - $avail[] = Array('id'=> $rs->fields['id'], 'name' => $rs->fields['name'].' - '.substr($rs->fields['pattern'],0,20).' - '.$rs->fields['amount']); - } - $rs->MoveNext(); - } - } - - global $smarty; - $smarty->assign('avail', $avail); - $smarty->assign('assigned', $assigned); - } - - /** Save updated rate tables for product - */ - function products($VAR) - { - $product = $VAR['product']; - $avail = $VAR['avail']; - $assigned = @$VAR['assigned']; - $db = &DB(); - - // clean out any selected ids from the 'assigned' array - if(is_array($assigned)) - foreach($assigned as $voip_rate_id) - $db->Execute(sqlDelete($db,"voip_rate_prod"," product_id = ::$product:: AND voip_rate_id = $voip_rate_id")); - - // add any selected ids from the 'avail' array - if(is_array($avail)) { - foreach($avail as $voip_rate_id) { - $fields=Array('product_id' => $product, 'voip_rate_id' => $voip_rate_id); - $id = $db->Execute(sqlInsert($db,"voip_rate_prod",$fields)); - } - } - } - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } -} -?> \ No newline at end of file diff --git a/modules/voip_rate/voip_rate_construct.xml b/modules/voip_rate/voip_rate_construct.xml deleted file mode 100644 index 1d75bc47..00000000 --- a/modules/voip_rate/voip_rate_construct.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - voip_rate - voip_rate
- - 0 - name - 25 - - id - - - - I4 - 1 - - - I4 - - - I8 - date-time - - - C(32) - 2 - 32 - any - - - B - - - F - - - I4 - any - - - I4 - - - F - any - - - N - - - N - - - I4 - - - I4 - - - L - - - L - - - - id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall - id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall - id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall - id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall - id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall - name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall - - 0 -
diff --git a/modules/voip_rate/voip_rate_install.xml b/modules/voip_rate/voip_rate_install.xml deleted file mode 100644 index 5523ad83..00000000 --- a/modules/voip_rate/voip_rate_install.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - voip_rate - voip - - 1 - voip - - - - - search - - - run - - - view - - 1 - - - import - - 1 - - - add - 1 - - - products - 1 - - - delete - - - update - - - search_show - - - - diff --git a/modules/voip_rate_prod/voip_rate_prod.inc.php b/modules/voip_rate_prod/voip_rate_prod.inc.php deleted file mode 100644 index bb40e831..00000000 --- a/modules/voip_rate_prod/voip_rate_prod.inc.php +++ /dev/null @@ -1,133 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_rate_prod -{ - - # Open the constructor for this mod - function voip_rate_prod() - { - # name of this module: - $this->module = "voip_rate_prod"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - ############################## - ## ADD ## - ############################## - function add($VAR) - { - // check this is not a duplicate for the selected product/voip_rate record combo - $product_id = $VAR['voip_rate_prod_product_id']; - $voip_rate_id = $VAR['voip_rate_prod_voip_rate_id']; - $db=&DB(); - $rs = $db->Execute( sqlSelect($db,'voip_rate_prod','id',"product_id = ::$product_id:: AND voip_rate_id = ::$voip_rate_id::" )); - if($rs && $rs->RecordCount() > 0) { - echo ""; - return false; - } - - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - ############################## - ## VIEW ## - ############################## - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - ############################## - ## UPDATE ## - ############################## - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - ############################## - ## DELETE ## - ############################## - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - ############################## - ## SEARCH FORM ## - ############################## - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - ############################## - ## SEARCH ## - ############################## - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - ############################## - ## SEARCH SHOW ## - ############################## - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } - -} -?> \ No newline at end of file diff --git a/modules/voip_rate_prod/voip_rate_prod_construct.xml b/modules/voip_rate_prod/voip_rate_prod_construct.xml deleted file mode 100644 index c54fded7..00000000 --- a/modules/voip_rate_prod/voip_rate_prod_construct.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - voip_rate_prod - voip_rate_prod
- voip - 0 - product_id - 25 - - product_id,voip_rate_id - - - - I4 - 1 - 1 - - - I4 - 1 - - - I4 - 1 - product - sku - - - I4 - voip_rate - name - - - - id,site_id,product_id,voip_rate_id - id,site_id,product_id,voip_rate_id - id,site_id,product_id,voip_rate_id - id,site_id,product_id,voip_rate_id - id,site_id,product_id,voip_rate_id - - 0 -
\ No newline at end of file diff --git a/modules/voip_rate_prod/voip_rate_prod_install.xml b/modules/voip_rate_prod/voip_rate_prod_install.xml deleted file mode 100644 index b3c54c13..00000000 --- a/modules/voip_rate_prod/voip_rate_prod_install.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - voip_rate_prod - voip - - 0 - voip - - - - - search - - - view - - - add - - - delete - - - update - - - search_show - - - - \ No newline at end of file diff --git a/modules/voip_sip/voip_sip.inc.php b/modules/voip_sip/voip_sip.inc.php deleted file mode 100644 index 7f09883a..00000000 --- a/modules/voip_sip/voip_sip.inc.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/modules/voip_sip/voip_sip_construct.xml b/modules/voip_sip/voip_sip_construct.xml deleted file mode 100644 index 1e41c199..00000000 --- a/modules/voip_sip/voip_sip_construct.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - voip_sip - voip_sip
- voip - 0 - id - 35 - - keyword - - - - I4 - - - I4 - - - C(32) - - - C(32) - - - C(255) - - - L - - - 0 - 0 -
\ No newline at end of file diff --git a/modules/voip_sip/voip_sip_install.xml b/modules/voip_sip/voip_sip_install.xml deleted file mode 100644 index 48030bc6..00000000 --- a/modules/voip_sip/voip_sip_install.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - voip_sip - voip - This module stores the SIP records - - voip - - - - - - - \ No newline at end of file diff --git a/modules/voip_vm/auth.inc.php b/modules/voip_vm/auth.inc.php deleted file mode 100644 index 9393f82b..00000000 --- a/modules/voip_vm/auth.inc.php +++ /dev/null @@ -1,11 +0,0 @@ - 'voip_vm', 'method' => 'vm_list'), - Array ('module' => 'voip_vm', 'method' => 'vm_listen'), - Array ('module' => 'voip_vm', 'method' => 'user_delete') - ); -?> \ No newline at end of file diff --git a/modules/voip_vm/voip_vm.inc.php b/modules/voip_vm/voip_vm.inc.php deleted file mode 100644 index 3f1280b7..00000000 --- a/modules/voip_vm/voip_vm.inc.php +++ /dev/null @@ -1,252 +0,0 @@ - and Thralling Penguin, LLC - * @package AgileBill - * @version 1.4.93 - */ - -class voip_vm -{ - var $vm=false; // path to VM dir - - # Open the constructor for this mod - function voip_vm() - { - # name of this module: - $this->module = "voip_vm"; - - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; - - # open the construct file for parsing - $C_xml = new CORE_xml; - $construct = $C_xml->xml_to_array($this->xml_construct); - - $this->method = $construct["construct"]["method"]; - $this->trigger = $construct["construct"]["trigger"]; - $this->field = $construct["construct"]["field"]; - $this->table = $construct["construct"]["table"]; - $this->module = $construct["construct"]["module"]; - $this->cache = $construct["construct"]["cache"]; - $this->order_by = $construct["construct"]["order_by"]; - $this->limit = $construct["construct"]["limit"]; - } - - /** - * Sets the voicemail path(s) - */ - function get_vm_path() { - if(!SESS_LOGGED) { - define("FORCE_REDIRECT", "?_page=account:account"); - return false; - } - require_once(PATH_MODULES.'voip/voip.inc.php'); - $voip = new voip; - $dids = $voip->get_voicemail_dids(SESS_ACCOUNT); - - if(!$dids || !is_array($dids) || count($dids) < 1) return false; - $db=&DB(); - foreach($dids as $did) - { - $rs = & $db->Execute($sql=sqlSelect($db,"voip_vm","context,mailbox","mailbox = ::$did:: AND account_id=".SESS_ACCOUNT)); - if($rs && $rs->RecordCount() > 0) - { - $path = "/var/spool/asterisk/voicemail/{$rs->fields["context"]}/{$rs->fields["mailbox"]}/INBOX/"; - $this->vm[] = $path; - if (!is_dir($path)) { - global $C_debug; - $C_debug->error('voip_vm','get_vm_path','The voicemail directory does not have the proper permissions assigned.'); - } - } - } - } - - /** - * List the voicemails for the current user - */ - function vm_list($VAR) { - if(!SESS_LOGGED) { - define("FORCE_REDIRECT", "?_page=account:account"); - } else { - $ret = false; - $this->get_vm_path(); - if(is_array($this->vm) && count($this->vm) > 0) - { - $ret=array(); - foreach($this->vm as $path) - { - $this->get_vm_by_path($path,$ret); - } - global $smarty; - $smarty->assign('voip_fax', $ret); - $smarty->assign('results', count($ret)); - } - } - } - - - /** - * Streams the VM to the user - */ - function vm_listen($VAR) - { - if(SESS_LOGGED && @$VAR['id']!= '' && is_numeric($VAR['id']) && !empty($VAR['did']) && is_numeric($VAR['did']) ) - { - // get path for selected did && make sure it belongs to current account - $db=&DB(); - $rs = & $db->Execute($sql=sqlSelect($db,"voip_vm","context,mailbox","mailbox = ::{$VAR['did']}:: AND account_id=".SESS_ACCOUNT)); - if($rs && $rs->RecordCount() > 0) - $path = "/var/spool/asterisk/voicemail/{$rs->fields["context"]}/{$rs->fields["mailbox"]}/INBOX/"; - else - return false; - - $f = $path.'msg'.$VAR['id'].'.wav'; - if(is_file($f) && is_readable($f)) { - ob_start(); - header("Content-Type: audio/wav"); - echo file_get_contents($f); - ob_end_flush(); - exit; - } - else { - echo "ERR1: Unable to retrieve specified Message"; - } - } else { - echo "ERR1: No voicemail message specified or no access"; - } - } - - - /** - * User voicemail delete function - */ - function user_delete($VAR) - { - if(SESS_LOGGED && @$VAR['id']!= '' && is_numeric($VAR['id']) && !empty($VAR['did']) && is_numeric($VAR['did']) ) - { - // get path for selected did && make sure it belongs to current account - $db=&DB(); - $rs = & $db->Execute($sql=sqlSelect($db,"voip_vm","context,mailbox","mailbox = ::{$VAR['did']}:: AND account_id=".SESS_ACCOUNT)); - if($rs && $rs->RecordCount() > 0) - $path = "/var/spool/asterisk/voicemail/{$rs->fields["context"]}/{$rs->fields["mailbox"]}/INBOX/"; - else - return false; - - $file = 'msg'.$VAR['id'].'.wav'; - - $wld = str_replace(".wav",".*",basename($file)); - if(strlen($wld) && strstr($wld,".*")) { - foreach (glob($path.$wld) as $filename) { - unlink($filename); - } - } - } - } - - - /** - * return all voicemails for a specific path - * @return Array - * @param $ret The array of voicemails to add any voicemails to - */ - function get_vm_by_path($path,&$ret) - { - if ($dh = @opendir($path)) { - while (($file = readdir($dh)) !== false) { - if(ereg("^msg.*\.txt",$file)) { - $msgs[] = $file; - } - } - closedir($dh); - } - if(is_array($msgs) && count($msgs)) { - if(!is_array($ret)) $cnt=0; - else $cnt = count($ret)+1; - foreach($msgs as $msg) { - $c = file_get_contents($path.$msg); - $lines = explode("\n",$c); - foreach($lines as $line) { - $parts = explode("=",$line); - $ret[$cnt][$parts[0]]=$parts[1]; - if($parts[0] == "origtime") { - $ret[$cnt]['date'] = date('M d, Y g:i:s a',$parts[1]); - } - } - $ret[$cnt]['id'] = ereg_replace("[a-zA-Z\.]","",$msg); - $ret[$cnt]['size'] = number_format(filesize($path.$ret[$cnt]['file'])/1024,0); - $cnt++; - } - } else { - return; - } - return $ret; - } - - function add($VAR) - { - $type = "add"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->add($VAR, $this, $type); - } - - function view($VAR) - { - $type = "view"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->view($VAR, $this, $type); - } - - function update($VAR) - { - $type = "update"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->update($VAR, $this, $type); - } - - function delete($VAR) - { - $db = new CORE_database; - $db->mass_delete($VAR, $this, ""); - } - - function search_form($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_form($VAR, $this, $type); - } - - function search($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search($VAR, $this, $type); - } - - function search_show($VAR) - { - $type = "search"; - $this->method["$type"] = explode(",", $this->method["$type"]); - $db = new CORE_database; - $db->search_show($VAR, $this, $type); - } -} -?> \ No newline at end of file diff --git a/modules/voip_vm/voip_vm_construct.xml b/modules/voip_vm/voip_vm_construct.xml deleted file mode 100644 index c3759e33..00000000 --- a/modules/voip_vm/voip_vm_construct.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - voip_vm - voip_vm
- voip - 0 - id - 35 - - context,mailbox - - - - I4 - 1 - - - I4 - - - I4 - account - username - any - - - C(128) - - - C(128) - any - - - C(128) - any - - - C(128) - any - - - C(128) - - - C(128) - - - C(128) - - - - id,site_id,account_id,context,mailbox,password,fullname,email,pager,options - id,site_id,account_id,context,mailbox,password,fullname,email,pager,options - id,site_id,account_id,context,mailbox,password,fullname,email,pager,options - id,site_id,account_id,context,mailbox,password,fullname,email,pager,options - id,site_id,account_id,context,mailbox,password,fullname,email,pager,options - - 0 -
\ No newline at end of file diff --git a/modules/voip_vm/voip_vm_install.xml b/modules/voip_vm/voip_vm_install.xml deleted file mode 100644 index 10b906c3..00000000 --- a/modules/voip_vm/voip_vm_install.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - voip_vm - voip - This module controls the VoIP voicemail interface - 1 - voip - - - - - - add - %%:add - 1 - - - update - - - delete - - - view - core:search&module=%%&_escape=1 - 1 - - - search - %%:search_form - 1 - - - search_form - - - search_show - - - - \ No newline at end of file