Initial Commit of AgileBill Open Source
This commit is contained in:
264
modules/voip_did/voip_did.inc.php
Normal file
264
modules/voip_did/voip_did.inc.php
Normal file
@@ -0,0 +1,264 @@
|
||||
<?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"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->add($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## VIEW ##
|
||||
##############################
|
||||
function view($VAR)
|
||||
{
|
||||
global $smarty;
|
||||
$type = "view";
|
||||
$this->method["$type"] = split(",", $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"] = split(",", $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"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search_form($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH ##
|
||||
##############################
|
||||
function search($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH SHOW ##
|
||||
##############################
|
||||
|
||||
function search_show($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $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"] = split(",", $this->method["$type"]);
|
||||
$export = new CORE_export;
|
||||
$export->search_excel($VAR, $this, $type);
|
||||
}
|
||||
|
||||
else if ($VAR["format"] == "xml")
|
||||
{
|
||||
$type = "export_xml";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$export = new CORE_export;
|
||||
$export->search_xml($VAR, $this, $type);
|
||||
}
|
||||
|
||||
else if ($VAR["format"] == "csv")
|
||||
{
|
||||
$type = "export_csv";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$export = new CORE_export;
|
||||
$export->search_csv($VAR, $this, $type);
|
||||
}
|
||||
|
||||
else if ($VAR["format"] == "tab")
|
||||
{
|
||||
$type = "export_tab";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$export = new CORE_export;
|
||||
$export->search_tab($VAR, $this, $type);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
125
modules/voip_did/voip_did_construct.xml
Normal file
125
modules/voip_did/voip_did_construct.xml
Normal file
@@ -0,0 +1,125 @@
|
||||
<?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>
|
62
modules/voip_did/voip_did_install.xml
Normal file
62
modules/voip_did/voip_did_install.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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&module=%%&_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>
|
Reference in New Issue
Block a user