Removed modules not ported in the short term

This commit is contained in:
Deon George 2010-12-02 12:25:39 +11:00
parent ec6a542bc3
commit ca37cea6cf
64 changed files with 0 additions and 7308 deletions

View File

@ -1,7 +0,0 @@
<?php
$auth_methods = Array
(
Array ('module' => 'radius', 'method' => 'do_update'),
Array ('module' => 'radius', 'method' => 'do_list')
);
?>

View File

@ -1,418 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @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")."<br>";
} 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")."<br>";
} 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")."<br>";
} 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")."<br>";
} 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);
}
}
}
?>

View File

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<!-- define the module name -->
<module>radius</module>
<!-- define the module table name -->
<table>radius</table>
<!-- define the module dependancy(s) -->
<dependancy></dependancy>
<!-- define the DB cache in seconds -->
<cache>0</cache>
<!-- define the default order_by field for SQL queries -->
<order_by>id</order_by>
<!-- define the methods -->
<limit>35</limit>
<!-- define the fields -->
<field>
<id>
<type>I8</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<account_id>
<type>I4</type>
<validate>any</validate>
</account_id>
<service_id>
<type>I8</type>
<asso_table>service</asso_table>
<asso_field>id</asso_field>
</service_id>
<active>
<type>L</type>
</active>
<sku>
<type>C(32)</type>
</sku>
<auth>
<type>C(16)</type>
</auth>
<username>
<type>C(128)</type>
<validate>any</validate>
</username>
<password>
<type>C(128)</type>
</password>
<service_type>
<type>C(128)</type>
</service_type>
<session_limit>
<type>I4</type>
</session_limit>
<idle_limit>
<type>I4</type>
</idle_limit>
<port_limit>
<type>I4</type>
</port_limit>
<analog>
<type>L</type>
</analog>
<digital>
<type>L</type>
</digital>
<filter_id>
<type>C(128)</type>
</filter_id>
<netmask>
<type>C(128)</type>
</netmask>
<framed_route>
<type>C(128)</type>
</framed_route>
<speed_limit>
<type>I4</type>
</speed_limit>
<static_ip>
<type>C(128)</type>
</static_ip>
<profiles>
<type>C(128)</type>
</profiles>
<time_bank>
<type>I4</type>
</time_bank>
</field>
<!-- define all the methods for this class, and the fields they have access to, if applicable. -->
<method>
<add>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</add>
<search_export>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</search_export>
<update>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</update>
<export_excel>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</export_excel>
<delete>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</delete>
<export_xml>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</export_xml>
<view>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</view>
<export_tab>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</export_tab>
<search>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</search>
<export_csv>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</export_csv>
</method>
<!-- define the method triggers -->
<trigger>0</trigger>
</construct>

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<!-- Define the main module properties -->
<module_properties>
<name>radius</name>
<parent></parent>
<notes>Controls radius provisioning</notes>
<menu_display>1</menu_display>
<dependancy></dependancy>
<sub_modules>radius_service</sub_modules>
</module_properties>
<!-- Define any SQL inserts for this module -->
<sql_inserts>
<module_method>
<add>
<module_id>%%module_id%%</module_id>
<name>add</name>
<page>%%:add</page>
<menu_display>1</menu_display>
</add>
<search_export>
<module_id>%%module_id%%</module_id>
<name>search_export</name>
</search_export>
<update>
<module_id>%%module_id%%</module_id>
<name>update</name>
</update>
<export_excel>
<module_id>%%module_id%%</module_id>
<name>export_excel</name>
</export_excel>
<delete>
<module_id>%%module_id%%</module_id>
<name>delete</name>
</delete>
<export_xml>
<module_id>%%module_id%%</module_id>
<name>export_xml</name>
</export_xml>
<view>
<module_id>%%module_id%%</module_id>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<export_tab>
<module_id>%%module_id%%</module_id>
<name>export_tab</name>
</export_tab>
<search>
<module_id>%%module_id%%</module_id>
<name>search</name>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<search_form>
<module_id>%%module_id%%</module_id>
<name>search_form</name>
</search_form>
<search_show>
<module_id>%%module_id%%</module_id>
<name>search_show</name>
</search_show>
<export_csv>
<module_id>%%module_id%%</module_id>
<name>export_csv</name> >
</export_csv>
</module_method>
</sql_inserts>
</install>

View File

@ -1,5 +0,0 @@
<?php
class radius_service
{
}
?>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>radius_service</module>
<table>radius_service</table>
<dependancy>radius</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<field>
<id>
<type>I8</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<account_id>
<type>I8</type>
</account_id>
<service_id>
<type>I8</type>
</service_id>
<radius_id>
<type>I8</type>
</radius_id>
<auth>
<type>C(16)</type>
</auth>
</field>
<method>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>radius_service</name>
<parent>radius</parent>
<notes></notes>
<menu_display></menu_display>
<dependancy>radius</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
</module_method>
</sql_inserts>
</install>

View File

@ -1,12 +0,0 @@
<?php
$auth_methods = Array
(
Array ('module' => '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')
);
?>

View File

@ -1,183 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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;
}
}
?>

View File

@ -1,134 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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 '<center>Sorry, the required scripts for processing memory reports are not installed.</center>';
exit;
}
if (GD == false) {
echo '<center>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 </var/log/asteriskmem","r");
$data = "";
while(!feof($fp))
$data .= fread($fp,65536);
fclose($fp);
$lines = explode("\n",$data); $prev = ""; $i=-1; $j=0;
foreach ($lines as $line) {
$col = explode("|",$line);
if($col[2]>10) {
#echo "<pre>"; print_r($col); echo "</pre>";
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 "<pre>"; print_r($datay); echo "</pre>"; 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 "<pre>"; print_r($dy); echo "</pre>";
$i++;
}
// Finally output the image
$graph->Stroke();
ob_end_flush();
exit;
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip</module>
<table>voip</table>
<dependancy></dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<id>id</id>
</index>
<field>
<id>
<type>I4</type>
</id>
<site_id>
<type>I4</type>
</site_id>
<voip_intrastate>
<type>C(255)</type>
</voip_intrastate>
<voip_secret_gen>
<type>L</type>
<validate>any</validate>
</voip_secret_gen>
<voip_vm_passwd>
<type>C(4)</type>
<min_len>4</min_len>
<max_len>4</max_len>
<validate>numeric</validate>
</voip_vm_passwd>
<voip_default_prefix>
<type>C(8)</type>
<validate>any</validate>
</voip_default_prefix>
<prepaid_low_balance>
<type>F</type>
<validate>any</validate>
</prepaid_low_balance>
<auth_domain>
<type>C(32)</type>
<validate>any</validate>
</auth_domain>
<perform_normalization>
<type>L</type>
<validate>any</validate>
</perform_normalization>
<normalization_min_len>
<type>L</type>
<validate>any</validate>
</normalization_min_len>
</field>
<method>0</method>
<trigger>0</trigger>
</construct>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip</name>
<parent>voip</parent>
<notes><![CDATA[AgileVoice modules for AgileBill Core]]></notes>
<dependancy></dependancy>
<sub_modules>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</sub_modules>
<menu_display>1</menu_display>
</module_properties>
<sql_inserts>
<module_method>
<config>
<page><![CDATA[%%:config]]></page>
<menu_display>1</menu_display>
</config>
</module_method>
</sql_inserts>
</install>

View File

@ -1,12 +0,0 @@
<?php
$auth_methods = Array
(
Array ('module' => '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')
);
?>

View File

@ -1,215 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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);
}
}
?>

View File

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_blacklist</module>
<table>voip_blacklist</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<didsrc>voip_did_id,src</didsrc>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<voip_did_id>
<type>I8</type>
<asso_table>voip_did</asso_table>
<asso_field>did</asso_field>
</voip_did_id>
<account_id>
<type>I4</type>
</account_id>
<src>
<type>C(32)</type>
</src>
<dst>
<type>C(64)</type>
</dst>
</field>
<method>
<add>id,site_id,voip_did_id,account_id,src,dst</add>
<update>id,site_id,voip_did_id,account_id,src,dst</update>
<delete>id,site_id,voip_did_id,account_id,src,dst</delete>
<view>id,site_id,voip_did_id,account_id,src,dst</view>
<search>id,site_id,voip_did_id,account_id,src,dst</search>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_blacklist</name>
<parent>voip</parent>
<notes>This module stores the VoIP blacklist records</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
<add>
<name>add</name>
<page>%%:add</page>
<menu_display>1</menu_display>
</add>
<update>
<name>update</name>
</update>
<delete>
<name>delete</name>
</delete>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<search>
<name>search</name>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
</search_show>
</module_method>
</sql_inserts>
</install>

View File

@ -1,6 +0,0 @@
<?php
$auth_methods = Array
(
Array ('module' => 'voip_cdr', 'method' => 'search_export')
);
?>

View File

@ -1,174 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @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);
}
}
}
?>

View File

@ -1,106 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_cdr</module>
<table>voip_cdr</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<calldatecustomer>date_orig,account_id,voip_rate_id</calldatecustomer>
<custrateplan>account_id,voip_rate_id</custrateplan>
<dstsrcdate>dst,src,date_orig</dstsrcdate>
<dstsrc>dst,src</dstsrc>
<acctdate>account_id,date_orig</acctdate>
<acctcode>accountcode</acctcode>
<rate>voip_rate_id</rate>
<rated>rated</rated>
<rdd>rated,disposition,date_orig</rdd>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<date_orig>
<type>I8</type>
<convert>date</convert>
</date_orig>
<account_id>
<type>I4</type>
</account_id>
<voip_rate_id>
<type>I4</type>
</voip_rate_id>
<clid>
<type>C(128)</type>
</clid>
<src>
<type>C(128)</type>
</src>
<dst>
<type>C(128)</type>
</dst>
<dcontext>
<type>C(128)</type>
</dcontext>
<channel>
<type>C(128)</type>
</channel>
<dstchannel>
<type>C(128)</type>
</dstchannel>
<lastapp>
<type>C(128)</type>
</lastapp>
<lastdata>
<type>C(16)</type>
</lastdata>
<duration>
<type>I4</type>
</duration>
<billsec>
<type>I4</type>
</billsec>
<disposition>
<type>C(45)</type>
</disposition>
<amaflags>
<type>I4</type>
</amaflags>
<accountcode>
<type>C(128)</type>
</accountcode>
<uniqueid>
<type>C(128)</type>
</uniqueid>
<amount>
<type>F</type>
</amount>
<calltype>
<type>L</type>
</calltype>
<rated>
<type>L</type>
</rated>
<adjbillinterval>
<type>N</type>
</adjbillinterval>
</field>
<method>
<add>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</add>
<search_export>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</search_export>
<update>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</update>
<export_excel>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</export_excel>
<delete>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</delete>
<export_xml>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</export_xml>
<view>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</view>
<export_tab>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</export_tab>
<search>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</search>
<export_csv>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</export_csv>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_cdr</name>
<parent>voip</parent>
<notes>This module stores the VoIP call detail records (CDR)</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
<add>
<name>add</name>
</add>
<search_export>
<name>search_export</name>
</search_export>
<update>
<name>update</name>
</update>
<export_excel>
<name>export_excel</name>
</export_excel>
<delete>
<name>delete</name>
</delete>
<export_xml>
<name>export_xml</name>
</export_xml>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<export_tab>
<name>export_tab</name>
</export_tab>
<search>
<name>search</name>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
</search_show>
<export_csv>
<name>export_csv</name>
</export_csv>
</module_method>
</sql_inserts>
</install>

View File

@ -1,264 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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 '<ul>';
# Create the alert for no records found
if ($result->RecordCount() > 0) {
$i=0;
while(!$result->EOF)
{
echo '<li><div class="name"><b>' . $result->fields['did'] . '</b></div>'.
'<div class="index" style="display:none">'.$result->fields['id']. '</div></li>'."\r\n";
$result->MoveNext();
$i++;
}
}
echo "</ul>";
}
##############################
## 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 "<pre>".print_r($smart,true)."</pre>";
$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 "<pre>".print_r($VAR,true)."</pre>";
$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 "<pre>".print_r($f[$i],true)."</pre>";
$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);
}
}
}
?>

View File

@ -1,125 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_did</module>
<table>voip_did</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<account_id>
<type>I4</type>
<asso_table>account</asso_table>
<asso_field>username</asso_field>
<validate>any</validate>
</account_id>
<service_id>
<type>I4</type>
</service_id>
<service_parent_id>
<type>I4</type>
</service_parent_id>
<did>
<type>C(16)</type>
</did>
<callingrateid>
<type>I4</type>
</callingrateid>
<calledrateid>
<type>I4</type>
</calledrateid>
<planid>
<type>I4</type>
</planid>
<cnam>
<type>L</type>
</cnam>
<blacklist>
<type>L</type>
</blacklist>
<anirouting>
<type>L</type>
</anirouting>
<faxdetection>
<type>L</type>
</faxdetection>
<channel>
<type>C(16)</type>
</channel>
<channelarg>
<type>C(128)</type>
</channelarg>
<voicemailenabled>
<type>L</type>
</voicemailenabled>
<callforwardingenabled>
<type>L</type>
</callforwardingenabled>
<busycallforwardingenabled>
<type>L</type>
</busycallforwardingenabled>
<voicemailafter>
<type>L</type>
</voicemailafter>
<cfringfor>
<type>L</type>
</cfringfor>
<cfnumber>
<type>C(32)</type>
</cfnumber>
<bcfnumber>
<type>C(32)</type>
</bcfnumber>
<rxfax>
<type>L</type>
</rxfax>
<faxemail>
<type>C(128)</type>
</faxemail>
<active>
<type>L</type>
</active>
<conf>
<type>L</type>
</conf>
<conflimit>
<type>I4</type>
</conflimit>
<failover>
<type>L</type>
</failover>
<failovernumber>
<type>C(128)</type>
</failovernumber>
<remotecallforward>
<type>L</type>
</remotecallforward>
<remotecallforwardnumber>
<type>C(128)</type>
</remotecallforwardnumber>
</field>
<index>
<account_id>account_id</account_id>
<service_id>service_id</service_id>
</index>
<method>
<add>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</add>
<search_export>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</search_export>
<update>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</update>
<export_excel>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</export_excel>
<delete>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</delete>
<export_xml>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</export_xml>
<view>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</view>
<export_tab>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</export_tab>
<search>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</search>
<export_csv>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</export_csv>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_did</name>
<parent>voip</parent>
<notes>This module stores the DID records</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
<add>
<name>add</name>
<page>%%:add</page>
<menu_display>1</menu_display>
</add>
<update>
<name>update</name>
</update>
<delete>
<name>delete</name>
</delete>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<search>
<name>search</name>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
</search_show>
<export_csv>
<name>export_csv</name>
</export_csv>
<export_excel>
<name>export_excel</name>
</export_excel>
<search_export>
<name>search_export</name>
</search_export>
<export_xml>
<name>export_xml</name>
</export_xml>
<export_tab>
<name>export_tab</name>
</export_tab>
<autoselect>
<name>autoselect</name>
</autoselect>
</module_method>
</sql_inserts>
</install>

View File

@ -1,284 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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.<BR>
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.<BR>
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.<BR>
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);
}
}
?>

View File

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_did_plugin</module>
<table>voip_did_plugin</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>name</order_by>
<limit>35</limit>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>C(16)</type>
</site_id>
<name>
<type>C(32)</type>
<validate>any</validate>
<unique>1</unique>
</name>
<plugin>
<type>C(32)</type>
<validate>any</validate>
</plugin>
<avail_countries>
<type>X2</type>
<validate>any</validate>
<convert>array</convert>
</avail_countries>
<release_minutes>
<type>I4</type>
</release_minutes>
<plugin_data>
<type>X2</type>
<convert>array</convert>
</plugin_data>
</field>
<method>
<add>id,site_id,name,plugin,avail_countries,release_minutes,plugin_data</add>
<update>id,site_id,name,plugin,avail_countries,release_minutes,plugin_data</update>
<delete>id,site_id,name,plugin,avail_countries,release_minutes,plugin_data</delete>
<view>id,site_id,name,plugin,avail_countries,release_minutes,plugin_data</view>
<search>id,site_id,name,plugin,avail_countries,release_minutes,plugin_data</search>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<!-- Define the main module properties -->
<module_properties>
<name>voip_did_plugin</name>
<parent>voip</parent>
<notes>This module controls the various did plugins</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<!-- Define any SQL inserts for this module -->
<sql_inserts>
<module_method>
<add>
<name>add</name>
<page>%%:add</page>
<menu_display>1</menu_display>
</add>
<update>
<name>update</name>
</update>
<delete>
<name>delete</name>
</delete>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<search>
<name>search</name>
</search>
<search_show>
<name>search_show</name>
</search_show>
</module_method>
</sql_inserts>
</install>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<voip_did_plugin>
<id>1</id>
<site_id>1</site_id>
<name>Default ( USA, UK, CANADA)</name>
<plugin>DEFAULT</plugin>
<avail_countries><![CDATA[a:4:{i:0;s:2:"38";i:1;s:3:"173";i:2;s:3:"224";i:3;s:3:"225";}]]></avail_countries>
<release_minutes>360</release_minutes>
<plugin_data><![CDATA[a:1:{i:0;s:0:"";}]]></plugin_data>
</voip_did_plugin>
<voip_did_plugin>
<id>3</id>
<site_id>1</site_id>
<name>DidX</name>
<plugin>DIDX</plugin>
<avail_countries><![CDATA[a:2:{i:0;s:3:"224";i:1;s:3:"225";}]]></avail_countries>
<release_minutes>360</release_minutes>
<plugin_data><![CDATA[a:5:{s:4:"user";s:0:"";s:4:"pass";s:0:"";s:4:"host";s:14:"208.44.220.231";s:4:"type";s:3:"SIP";s:12:"country_area";s:53:"44:20,121,871,800,1223
1:800,419,440,330,216,937,614";}]]></plugin_data>
</voip_did_plugin>
<voip_did_plugin>
<id>4</id>
<site_id>1</site_id>
<name>Magrathea-Telecom</name>
<plugin>MAGRATHEA</plugin>
<avail_countries><![CDATA[a:1:{i:0;s:3:"224";}]]></avail_countries>
<release_minutes>360</release_minutes>
<plugin_data><![CDATA[a:6:{s:4:"user";s:0:"";s:4:"pass";s:0:"";s:6:"server";s:27:"www.magrathea-telecom.co.uk";s:9:"poolcount";s:1:"5";s:4:"host";s:14:"208.44.220.231";s:12:"country_area";s:10:"44:0871504";}]]></plugin_data>
</voip_did_plugin>
<voip_did_plugin_id>
<id>4</id>
</voip_did_plugin_id>
</install>

View File

@ -1,12 +0,0 @@
<?php
### public methods for this module:
$auth_methods = Array
(
Array ('module' => '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')
);
?>

View File

@ -1,192 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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 "<pre>".print_r($fdids,true)."</pre>";
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."<br>";
}
}
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 "<pre>".print_r($fdids,true)."</pre>";
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."<br>";
}
}
unset($db);
}
$type = "search";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->search_show($VAR, $this, $type);
}
}
?>

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_fax</module>
<table>voip_fax</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>date_orig</order_by>
<limit>50</limit>
<index>
<dst_idx>dst</dst_idx>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<account_id>
<type>I4</type>
<asso_table>account</asso_table>
<asso_field>username</asso_field>
</account_id>
<date_orig>
<type>C(16)</type>
<validate>date-time</validate>
</date_orig>
<clid>
<type>C(64)</type>
</clid>
<src>
<type>C(64)</type>
</src>
<dst>
<type>C(64)</type>
</dst>
<pages>
<type>I4</type>
</pages>
<image_size>
<type>C(16)</type>
</image_size>
<image_resolution>
<type>C(16)</type>
</image_resolution>
<transfer_rate>
<type>I4</type>
</transfer_rate>
<image_bytes>
<type>I4</type>
</image_bytes>
<bad_rows>
<type>I4</type>
</bad_rows>
<mime_type>
<type>C(32)</type>
</mime_type>
</field>
<method>
<add>id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</add>
<update>id,site_id,account_id,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</update>
<delete>id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</delete>
<view>id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</view>
<search>id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</search>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_fax</name>
<parent>voip</parent>
<notes>This module stores the VoIP fax records</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
<update>
<name>update</name>
</update>
<delete>
<name>delete</name>
</delete>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<search>
<name>search</name>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
</search_show>
</module_method>
</sql_inserts>
</install>

View File

@ -1,6 +0,0 @@
<?php
class voip_fax_data
{
}
?>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_fax_data</module>
<table>voip_fax_data</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<faxid>fax_id</faxid>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<fax_id>
<type>I8</type>
</fax_id>
<faxdata>
<type>B</type>
</faxdata>
</field>0<method>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_fax_data</name>
<parent>voip</parent>
<notes>This module stores the binary fax data in PDF format</notes>
<menu_display></menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
</module_method>
</sql_inserts>
</install>

View File

@ -1,5 +0,0 @@
<?php
class voip_sip
{
}
?>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_iax</module>
<table>voip_iax</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<keyword>keyword</keyword>
</index>
<field>
<id>
<type>I4</type>
</id>
<site_id>
<type>I4</type>
</site_id>
<iax>
<type>C(32)</type>
</iax>
<keyword>
<type>C(32)</type>
</keyword>
<data>
<type>C(255)</type>
</data>
<flags>
<type>L</type>
</flags>
</field>
<method>0</method>
<trigger>0</trigger>
</construct>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_iax</name>
<parent>voip</parent>
<notes>This module stores the IAX records</notes>
<menu_display></menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
</module_method>
</sql_inserts>
</install>

View File

@ -1,6 +0,0 @@
<?php
class voip_in_network
{
}
?>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_in_network</module>
<table>voip_in_network</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<did>did</did>
</index>
<field>
<id>
<type>I4</type>
</id>
<site_id>
<type>I4</type>
</site_id>
<did>
<type>C(16)</type>
<unique>1</unique>
</did>
</field>
<method>0</method>
<trigger>0</trigger>
</construct>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_in_network</name>
<parent>voip</parent>
<notes>This module stores the data for the in network checks</notes>
<menu_display></menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
</module_method>
</sql_inserts>
</install>

View File

@ -1,5 +0,0 @@
<?php
class voip_local_lookup
{
}
?>

View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_local_lookup</module>
<table>voip_local_lookup</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<npa>npa,nxx</npa>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<npa>
<type>C(4)</type>
</npa>
<nxx>
<type>C(4)</type>
</nxx>
<grouping>
<type>I4</type>
</grouping>
</field>
<method>0</method>
<trigger>0</trigger>
</construct>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_local_lookup</name>
<parent>voip</parent>
<notes>This module stores the VoIP local lookup records</notes>
<menu_display></menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
</module_method>
</sql_inserts>
</install>

View File

@ -1,268 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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)."<br>";
$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']."<br>";
#echo $sql."<br>";
$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);
}
}
}
?>

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_pool</module>
<table>voip_pool</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>npa</order_by>
<limit>35</limit>
<index>
<full>npa,nxx,station,country_code,voip_did_plugin_id</full>
<pluginccarea>voip_did_plugin_id,country_code,areacode</pluginccarea>
<nums>site_id,country_code,areacode</nums>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<account_id>
<type>I4</type>
</account_id>
<npa>
<type>C(16)</type>
<min_len>3</min_len>
<max_len>3</max_len>
<validate>numeric</validate>
</npa>
<nxx>
<type>C(16)</type>
<min_len>3</min_len>
<max_len>3</max_len>
<validate>numeric</validate>
</nxx>
<station>
<type>C(32)</type>
<min_len>2</min_len>
<validate>numeric</validate>
</station>
<country_code>
<type>I4</type>
</country_code>
<date_reserved>
<type>I8</type>
</date_reserved>
<voip_did_plugin_id>
<type>I4</type>
</voip_did_plugin_id>
<areacode>
<type>I4</type>
</areacode>
</field>
<method>
<add>id,site_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</add>
<view>id,site_id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</view>
<update>id,site_id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</update>
<delete>id,site_id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</delete>
<search>id,site_id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</search>
<search_export>id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</search_export>
<export_excel>id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</export_excel>
<export_xml>id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</export_xml>
<export_tab>id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</export_tab>
<export_csv>id,account_id,npa,nxx,station,country_code,date_reserved,voip_did_plugin_id</export_csv>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_pool</name>
<parent>voip</parent>
<notes>This module stores the VoIP Pool records</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
</module_properties>
<sql_inserts>
<module_method>
<add>
<name>add</name>
</add>
<search_export>
<name>search_export</name>
</search_export>
<update>
<name>update</name>
</update>
<export_excel>
<name>export_excel</name>
</export_excel>
<delete>
<name>delete</name>
</delete>
<export_xml>
<name>export_xml</name>
</export_xml>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<import>
<name>import</name>
<page>%%:import</page>
<menu_display>1</menu_display>
</import>
<export_tab>
<name>export_tab</name>
</export_tab>
<search>
<name>search</name>
</search>
<search_show>
<name>search_show</name>
</search_show>
<export_csv>
<name>export_csv</name>
</export_csv>
</module_method>
</sql_inserts>
</install>

View File

@ -1,6 +0,0 @@
<?php
$auth_methods = Array
(
Array ('module' => 'voip_prepaid', 'method' => 'menu_pins')
);
?>

View File

@ -1,529 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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 "<BR><BR>$sql<BR><BR>";
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 "<script>document.location='?_page=core:search&module=voip_prepaid&voip_prepaid_bulk={$VAR['voip_prepaid_bulk']}';</script>";
}
} 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);
}
}
}
?>

View File

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_prepaid</module>
<table>voip_prepaid</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<pin>pin</pin>
<account>account_id</account>
<product>product_id</product>
</index>
<field>
<id>
<type>I8</type>
<unique>1</unique>
</id>
<site_id>
<type>C(16)</type>
</site_id>
<date_expire>
<type>I8</type>
<convert>date</convert>
</date_expire>
<date_email>
<type>I8</type>
</date_email>
<account_id>
<type>I4</type>
<validate>any</validate>
</account_id>
<parent_id>
<type>I4</type>
</parent_id>
<voip_did_id>
<type>I4</type>
</voip_did_id>
<product_id>
<type>C(16)</type>
<validate>any</validate>
<asso_table>product</asso_table>
<asso_field>sku</asso_field>
</product_id>
<ani>
<type>L</type>
</ani>
<pin>
<type>C(16)</type>
<unique>1</unique>
<validate>numeric</validate>
</pin>
<balance>
<type>F</type>
</balance>
<in_use>
<type>L</type>
</in_use>
<bulk>
<type>C(16)</type>
</bulk>
<expire_days>
<type>I4</type>
</expire_days>
</field>
<method>
<delete>id</delete>
<add>id,site_id,account_id,product_id,pin,balance,in_use,expire_days,ani,voip_did_id</add>
<update>id,site_id,date_expire,account_id,product_id,pin,balance,in_use,expire_days,ani,voip_did_id</update>
<view>id,site_id,date_expire,bulk,date_email,account_id,product_id,pin,balance,in_use,expire_days,ani,voip_did_id</view>
<search>id,site_id,date_expire,bulk,date_email,account_id,product_id,pin,balance,in_use,expire_days,ani,voip_did_id</search>
<search_export>pin,balance,date_expire,account_id,product_id,bulk,expire_days,ani,voip_did_id</search_export>
<export_excel>pin,balance,date_expire,bulk</export_excel>
<export_xml>pin,balance,date_expire,bulk</export_xml>
<export_tab>pin,balance,date_expire,bulk</export_tab>
<export_csv>pin,balance,date_expire,bulk</export_csv>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<!-- Define the main module properties -->
<module_properties>
<name>voip_prepaid</name>
<parent>voip</parent>
<notes>This module controls prepaid pin numbers</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
<add>
<name>add</name>
<page>%%:add</page>
<menu_display>1</menu_display>
</add>
<add_batch>
<name>add_batch</name>
<page>%%:add_batch</page>
<menu_display>1</menu_display>
</add_batch>
<update>
<name>update</name>
</update>
<delete>
<name>delete</name>
</delete>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<search>
<name>search</name>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
</search_show>
<export_csv>
<name>export_csv</name>
</export_csv>
<export_excel>
<name>export_excel</name>
</export_excel>
<search_export>
<name>search_export</name>
</search_export>
<export_xml>
<name>export_xml</name>
</export_xml>
<export_tab>
<name>export_tab</name>
</export_tab>
</module_method>
</sql_inserts>
</install>

View File

@ -1,215 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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);
}
}
?>

View File

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_rate</module>
<table>voip_rate</table>
<dependancy/>
<cache>0</cache>
<order_by>name</order_by>
<limit>25</limit>
<index>
<id>id</id>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<date_added>
<type>I8</type>
<convert>date-time</convert>
</date_added>
<name>
<type>C(32)</type>
<min_len>2</min_len>
<max_len>32</max_len>
<validate>any</validate>
</name>
<pattern>
<type>B</type>
</pattern>
<connect_fee>
<type>F</type>
</connect_fee>
<increment_seconds>
<type>I4</type>
<validate>any</validate>
</increment_seconds>
<seconds_included>
<type>I4</type>
</seconds_included>
<amount>
<type>F</type>
<validate>any</validate>
</amount>
<type>
<type>N</type>
</type>
<direction>
<type>N</type>
</direction>
<min>
<type>I4</type>
</min>
<max>
<type>I4</type>
</max>
<combine>
<type>L</type>
</combine>
<percall>
<type>L</type>
</percall>
</field>
<method>
<add>id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall</add>
<update>id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall</update>
<delete>id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall</delete>
<view>id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall</view>
<search>id,site_id,date_added,name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall</search>
<import>name,pattern,connect_fee,increment_seconds,seconds_included,amount,type,direction,min,max,combine,percall</import>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,46 +0,0 @@
<install>
<module_properties>
<name>voip_rate</name>
<parent>voip</parent>
<notes><![CDATA[This module allows you to rate and bill CDRs]]></notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
</module_properties>
<sql_inserts>
<module_method>
<search>
<name>search</name>
</search>
<run>
<name>run</name>
</run>
<view>
<name>view</name>
<page><![CDATA[core:search&module=%%&_escape=1&_next_page_one=view]]></page>
<menu_display>1</menu_display>
</view>
<import>
<name>import</name>
<page><![CDATA[core:import_new&module=%%]]></page>
<menu_display>1</menu_display>
</import>
<add>
<name>add</name>
<menu_display>1</menu_display>
</add>
<products>
<name>products</name>
<menu_display>1</menu_display>
</products>
<delete>
<name>delete</name>
</delete>
<update>
<name>update</name>
</update>
<search_show>
<name>search_show</name>
</search_show>
</module_method>
</sql_inserts>
</install>

View File

@ -1,133 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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 "<script>alert('Specified product/voip_rate combo already exists, cannot create record'); history.back();</script>";
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);
}
}
?>

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_rate_prod</module>
<table>voip_rate_prod</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>product_id</order_by>
<limit>25</limit>
<index>
<idx>product_id,voip_rate_id</idx>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
<index>1</index>
</id>
<site_id>
<type>I4</type>
<index>1</index>
</site_id>
<product_id>
<type>I4</type>
<index>1</index>
<asso_table>product</asso_table>
<asso_field>sku</asso_field>
</product_id>
<voip_rate_id>
<type>I4</type>
<asso_table>voip_rate</asso_table>
<asso_field>name</asso_field>
</voip_rate_id>
</field>
<method>
<add>id,site_id,product_id,voip_rate_id</add>
<update>id,site_id,product_id,voip_rate_id</update>
<delete>id,site_id,product_id,voip_rate_id</delete>
<view>id,site_id,product_id,voip_rate_id</view>
<search>id,site_id,product_id,voip_rate_id</search>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,31 +0,0 @@
<install>
<module_properties>
<name>voip_rate_prod</name>
<parent>voip</parent>
<notes><![CDATA[This module allows you to associate call rates to products]]></notes>
<menu_display>0</menu_display>
<dependancy>voip</dependancy>
</module_properties>
<sql_inserts>
<module_method>
<search>
<name>search</name>
</search>
<view>
<name>view</name>
</view>
<add>
<name>add</name>
</add>
<delete>
<name>delete</name>
</delete>
<update>
<name>update</name>
</update>
<search_show>
<name>search_show</name>
</search_show>
</module_method>
</sql_inserts>
</install>

View File

@ -1,5 +0,0 @@
<?php
class voip_sip
{
}
?>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_sip</module>
<table>voip_sip</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<keyword>keyword</keyword>
</index>
<field>
<id>
<type>I4</type>
</id>
<site_id>
<type>I4</type>
</site_id>
<sip>
<type>C(32)</type>
</sip>
<keyword>
<type>C(32)</type>
</keyword>
<data>
<type>C(255)</type>
</data>
<flags>
<type>L</type>
</flags>
</field>
<method>0</method>
<trigger>0</trigger>
</construct>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_sip</name>
<parent>voip</parent>
<notes>This module stores the SIP records</notes>
<menu_display></menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
</module_method>
</sql_inserts>
</install>

View File

@ -1,11 +0,0 @@
<?php
### public methods for this module:
$auth_methods = Array
(
Array ('module' => 'voip_vm', 'method' => 'vm_list'),
Array ('module' => 'voip_vm', 'method' => 'vm_listen'),
Array ('module' => 'voip_vm', 'method' => 'user_delete')
);
?>

View File

@ -1,252 +0,0 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @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);
}
}
?>

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_vm</module>
<table>voip_vm</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>id</order_by>
<limit>35</limit>
<index>
<context>context,mailbox</context>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<account_id>
<type>I4</type>
<asso_table>account</asso_table>
<asso_field>username</asso_field>
<validate>any</validate>
</account_id>
<context>
<type>C(128)</type>
</context>
<mailbox>
<type>C(128)</type>
<validate>any</validate>
</mailbox>
<password>
<type>C(128)</type>
<validate>any</validate>
</password>
<fullname>
<type>C(128)</type>
<validate>any</validate>
</fullname>
<email>
<type>C(128)</type>
</email>
<pager>
<type>C(128)</type>
</pager>
<options>
<type>C(128)</type>
</options>
</field>
<method>
<add>id,site_id,account_id,context,mailbox,password,fullname,email,pager,options</add>
<update>id,site_id,account_id,context,mailbox,password,fullname,email,pager,options</update>
<delete>id,site_id,account_id,context,mailbox,password,fullname,email,pager,options</delete>
<view>id,site_id,account_id,context,mailbox,password,fullname,email,pager,options</view>
<search>id,site_id,account_id,context,mailbox,password,fullname,email,pager,options</search>
</method>
<trigger>0</trigger>
</construct>

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_vm</name>
<parent>voip</parent>
<notes>This module controls the VoIP voicemail interface</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
<add>
<name>add</name>
<page>%%:add</page>
<menu_display>1</menu_display>
</add>
<update>
<name>update</name>
</update>
<delete>
<name>delete</name>
</delete>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<search>
<name>search</name>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
</search_show>
</module_method>
</sql_inserts>
</install>