ASTCC

ASTCC


Synopsis

Asterisk Calling Card Solution


Description

  • ASTCC is an AGI script and CGI script which greatly simplifies the task of creating a calling card application on Asterisk.
  • ASTCC is distributed under GNU GPL. ASTCC needs MySQL.

Requirements


ASTCC Idiots Guide(Detailed Setup Instructions)

  • Folowing setup info is provided by Iareanet. Use this info at your own risk

Download ASTCC

The source code can be downloaded from the SVN only, please check it out of Asterisk SVN as module astcc:

svn checkout http://svn.digium.com/svn/astcc/trunk astcc


Installing Perl on Unix

MySQL Perl support requires that you've installed MySQL client programming support (libraries and header files). Most installation methods install the necessary files. However, if you installed MySQL from RPM files on Linux, be sure that you've installed the developer RPM. The client programs are in the client RPM, but client programming support is in the developer RPM.

If you want to install Perl support, the files you will need can be obtained from the CPAN (Comprehensive Perl Archive Network) at http://search.cpan.org.


if (Debian) {
 Just tried this for Debian and it seems to work for me: "apt-get install libdbd-mysql".
 Then you don't need to do the cpan things... Helped me a lot.
} else if(Debian-Etch) {
  apt-get install libdbd-mysql-perl
}


The easiest way to install Perl modules on Unix is to use the CPAN module. For example:

perl -MCPAN -e shell
install DBI
install DBD::mysql


The DBD
mysql installation runs a number of tests. These tests require being able to connect to the local MySQL server as the anonymous user with no password. If you have removed anonymous accounts or assigned them passwords, the tests fail. You can use force install DBD
mysql to ignore the failed tests.

DBI requires the Data::Dumper module. It may already be installed; if not, you should install it before installing DBI.

It is also possible to download the module distributions in the form of compressed tar archives and build the modules manually. For example, to unpack and build a DBI distribution, use a procedure such as this:

Unpack the distribution into the current directory: shell> gunzip < DBI-VERSION.tar.gz | tar xvf -

This command creates a directory named `DBI-VERSION'.
Change location into the top-level directory of the unpacked distribution: shell> cd DBI-VERSION

Build the distribution and compile everything: shell> perl Makefile.PL

make
make test
make install


The make test command is important because it verifies that the module is working. Note that when you run that command during the DBD::mysql installation to exercise the interface code, the MySQL server must be running or the test will fail.

It is a good idea to rebuild and reinstall the DBD::mysql distribution whenever you install a new release of MySQL, particularly if you notice symptoms such as that all your DBI scripts fail after you upgrade MySQL.

If you don't have access rights to install Perl modules in the system directory or if you want to install local Perl modules, the following reference may be useful: http://servers.digitaldaze.com/extensions/perl/modules.html#modules

Look under the heading ``Installing New Modules that Require Locally Installed Modules.''

ASTCC Setup Check List:

  • download ASTCC source file from CVS. Untarr the file.
  • verify that you have mysql installed and a user and its password to access databases
  • read the makefile and change path according to your installation
  • do Make install
  • Access the astcc-admin.cgi via your web browser
  • configure ASTCC on ASTCC admin page
  • fill in the parameters and press create then save.
  • be sure your apache user have rights to /var/lib/astcc/astcc-config.conf ; if not, nothing will work.
  • configure your calling cards beginning with brands,cards,trunk,routes
  • Secure the /var/www/cgi-bin/astcc-admin folder using .htaccess

Step by Step Install of ASTCC?:

  • Download ASTCC source file from CVS. Untar the file as above detailed.
  • from the untarred folder run 'make install' from that folder

make install

  • This will create required astcc directories and copies files into them.

  • copy astcc-admin.cgi to your cgi-bin/astcc-admin diretory
cp astcc-admin.cgi /var/www/cgi-bin/astcc-admin

  • copy astcc.agi to /var/lib/asterisk/agi-bin
cp astcc.agi /var/lib/asterisk/agi-bin

protect the directory where astcc-admin.cgi is with htaccess or something else

If there is any problem create them and copy files manually as under.

mkdir /var/lib/astcc  
mkdir /var/www/cgi-bin/astcc-admin  


  • copy astcc-admin.cgi to your cgi-bin/astcc-admin diretory
cp astcc-admin.cgi /var/www/cgi-bin/astcc-admin

  • copy astcc.agi to /var/lib/asterisk/agi-bin
cp astcc.agi /var/lib/asterisk/agi-bin


  • make it writable for the Webserver (e. g. nobody or www-data)
chmod 777 /var/lib/astcc

  • Edit /var/lib/astcc/astcc-config.conf file and add following entries:
vi /var/lib/astcc/astcc-config.conf

  • make manual entries in this file so that astcc works:

Note: This file can be automatically created by going to "Configure" via the ASTCC web interface.

maintcdr = NO
emailadd = you@yourdomain.com
cardlength = 5
dbname = astcc
email = NO
dbuser = cheap
startingdigit =
debug = NO
friendsdb = NO
pinlength = 4
maintverbose = YES
dbhost = localhost
maintname =
dbpass = calls
mailprog = sendmail
pinstatus = YES ;__This is CaSe sensative__


What do you need in astcc-exten.conf


; Use any of the permutations and combinations below to fit your needs.

; Card-number and number to dial derived from command-line.
; Call script with the card-number as first arg and the number ; to dial as the second arg.
;
exten => _00XXXXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN})
exten => _00XXXXXXXXX,2,Hangup

;
; Prompt the caller for the card-number and the number to dial.
;
exten => 1234,1,Answer
exten => 1234,2,DeadAGI(astcc.agi)
exten => 1234,3,Hangup

; If you call it with an extension of "BALANCE" and a calleridnumber, ; it will read your balance to you and then exit.

exten => _00XXXXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},BALANCE,1)
exten => _00XXXXXXXXX,2,Hangup

; You may use 77 as access number to enter the calling card system 
exten => 77,1,Answer 
exten => 77,2,DeadAGI(astcc.agi) 
exten => 77,3,Hangup 

; caller id authentication, dial dest no. directly without being asked the pin 
exten => _1NXXNXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN}) 
exten => _1NXXNXXXXXX,2,Hangup 

; caller id authentication, without balance information
exten => _1NXXNXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},,4) 
exten => _1NXXNXXXXXX,2,Hangup 


1)How do you remove the two digits 77? Using ${EXTEN:2} ? Is that it?

Ans: Yes, ${EXTEN} is the number send to Asterisk with ${EXTEN:n} you
remove the first n digits, (there are a lot of info on Google)

2)How do we setup the users CallerIds into the database? So that we
autehenticate based on caller id?

Ans: I have created Card Number equal the CallerID of the UA (using the
ASTCC web interface)

3) What does the two new databases IAX_friends and Sip_Freiends do?

Ans: Read the DOCs. Not supported yet.


  1. I have added a few different quiet levels to this program. They can
  2. be specified from the dial command.
  3. 1 - All warnings and messages play.
  4. 2 - All warnings and card balance
  5. 3 - All warnings
  6. 4 - Interrogation Only

Simple astcc-exten.conf

exten => _77.,1,Answer 
exten => _77.,2,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN:2},3)
exten => _77.,3,Hangup

Here when a UA dial 77 + his number, I call the ASTCC with cardid = UA
Caller ID and as destinatio number I trim the first two digits (77), using 'EXTEN:2'.

The last parameter specifie the ASTCC operational mode (here is a
piece of the astcc.agi)


# cat extensions.conf
.[general]
static=yes
writeprotect=no

.[globals]

FWDUSERID2=947623
FWD2USERNAME=sk123
FWDPREFIX=*

;macros

.[macro-fastbusy]
 exten => s,1,Answer
 exten => s,2,Wait,1
 exten => s,3,Playback(ss-noservice)
 exten => s,4,Wait(30)
 exten => s,5,Hangup

[OUTGOING]
 exten => 213,1,Answer
 exten => 213,2,DeadAGI(astcc.agi)
 exten => 213,3,Hangup

;caller id authentication, dial dest no. directly without being asked the pin

exten => XXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN})
exten => XXXXXX,2,Hangup
exten => XXXXXX,1,Dial(SIP/${EXTEN})

include => fwd1-out


;Include entries for Asterisk Calling Card
 include = /var/lib/astcc/astcc-exten.conf

You need put the astcc-admin.cgi into your cgi-bin directory, access this file from web browser for system provision to generate the pin, setup the routes etc.




Installing the database in MySQL : (original astcc installtion has errors)


  • Run the following commands to prepare the MySQL Database

groupadd mysql
useradd -g mysql mysql
cd /usr/local
gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf -
ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql
cd mysql
scripts/mysql_install_db --user=mysql
chown -R root  .
chown -R mysql data
chgrp -R mysql .
bin/mysqld_safe --user=mysql &

To create the complete database for ASTCC, run the sql below:


-- MySQL dump 8.23
--
-- Host: localhost    Database: astcc
---------------------------------------------------------
-- Server version	3.23.58

--
-- Table structure for table `bit_brands`
--

CREATE TABLE `bit_brands` (
  `name` varchar(40) NOT NULL default '',
  `language` varchar(10) default NULL,
  `inc` char(3) default '30',
  `publishednum` varchar(40) default NULL,
  `did` varchar(40) default NULL,
  `markup` int(11) default NULL,
  `days` char(3) default '0',
  `fee` int(11) default NULL,
  PRIMARY KEY  (`name`)
) TYPE=MyISAM;

--
-- Dumping data for table `bit_brands`
--


INSERT INTO `bit_brands` VALUES ('Eezee','en','6','12125023123','12123452134',10,'30',10);

--
-- Table structure for table `bit_cards`
--

CREATE TABLE `bit_cards` (
  `number` char(20) NOT NULL default '',
  `language` char(10) default NULL,
  `facevalue` int(11) default NULL,
  `used` int(11) NOT NULL default '0',
  `inc` int(11) NOT NULL default '0',
  `markup` int(11) NOT NULL default '0',
  `creation` timestamp(14) NOT NULL,
  `firstuse` timestamp(14) NOT NULL,
  `expiration` timestamp(14) NOT NULL,
  `inuse` int(11) default NULL,
  `brand` char(40) default NULL,
  `nextfee` int(11) default NULL,
  `pin` char(20) default NULL,
  PRIMARY KEY  (`number`)
) TYPE=MyISAM;

--
-- Dumping data for table `bit_cards`
--

INSERT INTO `bit_cards` VALUES ('12219983913459653156','en',10000,0,6,10,20050512154505,00000000000000,00000000000000,NULL,'Eezee',30,NULL);
INSERT INTO `bit_cards` VALUES ('11898276578725357619','en',10000,0,6,10,20050512154505,00000000000000,00000000000000,NULL,'Eezee',30,NULL);
--
-- Table structure for table `bit_cdrs`
--

CREATE TABLE `bit_cdrs` (
  `cardnum` char(40) NOT NULL default '',
  `callerid` char(80) default NULL,
  `callednum` char(80) default NULL,
  `trunk` char(40) default NULL,
  `disposition` char(20) default NULL,
  `billseconds` int(11) default NULL,
  `billcost` int(11) default NULL,
  `callstart` char(24) default NULL
) TYPE=MyISAM;

--
-- Table structure for table `bit_iaxfriends`
--

CREATE TABLE `bit_iaxfriends` (
  `name` char(40) NOT NULL default '',
  `secret` char(40) default NULL,
  `context` char(40) default NULL,
  `ipaddr` char(20) default NULL,
  `port` int(6) default NULL,
  `regseconds` int(11) NOT NULL default '0',
  PRIMARY KEY  (`name`)
) TYPE=MyISAM;

--
-- Table structure for table `bit_routes`
--

CREATE TABLE `bit_routes` (
  `pattern` char(40) NOT NULL default '',
  `comment` char(80) default NULL,
  `trunks` char(80) default NULL,
  `connectcost` int(11) NOT NULL default '0',
  `includedseconds` int(11) NOT NULL default '0',
  `cost` int(11) NOT NULL default '0',
  PRIMARY KEY  (`pattern`)
) TYPE=MyISAM;

--
-- Dumping data for table `bit_routes`
--

INSERT INTO `bit_routes` VALUES ('1*','USA','USA',1,30,2);

--
-- Table structure for table `bit_sipfriends`
--

CREATE TABLE `bit_sipfriends` (
  `name` char(40) NOT NULL default '',
  `username` char(40) default NULL,
  `secret` char(40) NOT NULL default '',
  `context` char(40) NOT NULL default '',
  `ipaddr` char(20) NOT NULL default '',
  `port` int(6) NOT NULL default '0',
  `regseconds` int(11) default '0',
  PRIMARY KEY  (`name`)
) TYPE=MyISAM;

--
-- Table structure for table `bit_trunks`
--

CREATE TABLE `bit_trunks` (
  `name` char(40) NOT NULL default '',
  `tech` char(10) default NULL,
  `path` char(40) NOT NULL default '',
  PRIMARY KEY  (`name`),
  KEY `pk_trunks` (`name`)
) TYPE=MyISAM;

--
-- Dumping data for table `bit_trunks`
--


INSERT INTO `bit_trunks` VALUES ('USA','SIP','nypbx.iareanet.net');






FAQ

Q: 1. What is Trunk in ASTCC and what are the meaning of the parameters such as Technology & Peer/Trunk ?
A : When a user punchers a number after authentication, astcc will look at the routes table for a number match. Then it will pickup the trunk and go to trunks table and look for a match. That will tell astcc to use SIP or Local or ZAP (technology) and the name of the peer to construct the dial string. Example, if technology is sip, then you should have a context in the sip.conf, with the name given in path filed (selected) of trunks table.

Q: In the routes if I use 0 connect fee that means the user won't be charged for 0 sec calls right ?
A: No matter what you put in here, user will be not charge for any call which is not successful. Connect charge applies for any successful call. Which is just an additional charge per call basis.

Q: What are Published Number,DID,Inc,Markup (in 1/100 of 1%) in Brands ?
A: Brands table is not used, within astcc application.

BUGS

Currently (2005-06-16) there's a bug when using free calls. You have to set maxmins manually when this happens.
I have set maxmins to 600, should be enough for nothing ;-).

if ($adjcost == 0) {
$maxmins = 600;
} else {
$maxmins = int(($credit - $adjconn) / $adjcost);
}


Debugging

The astcc.agi script prints lots of info to STDERR, if you wish to store this debugging info into a file just add:

my $logfile ="/var/log/astcc.txt";
open STDERR, ">>$logfile";


to the begining of the perl script.

See also



Features Request

  • If there are features that you would like to see added to ASTCC please visity the bouny page ASTCCBounty




ASTCC


Synopsis

Asterisk Calling Card Solution


Description

  • ASTCC is an AGI script and CGI script which greatly simplifies the task of creating a calling card application on Asterisk.
  • ASTCC is distributed under GNU GPL. ASTCC needs MySQL.

Requirements


ASTCC Idiots Guide(Detailed Setup Instructions)

  • Folowing setup info is provided by Iareanet. Use this info at your own risk

Download ASTCC

The source code can be downloaded from the SVN only, please check it out of Asterisk SVN as module astcc:

svn checkout http://svn.digium.com/svn/astcc/trunk astcc


Installing Perl on Unix

MySQL Perl support requires that you've installed MySQL client programming support (libraries and header files). Most installation methods install the necessary files. However, if you installed MySQL from RPM files on Linux, be sure that you've installed the developer RPM. The client programs are in the client RPM, but client programming support is in the developer RPM.

If you want to install Perl support, the files you will need can be obtained from the CPAN (Comprehensive Perl Archive Network) at http://search.cpan.org.


if (Debian) {
 Just tried this for Debian and it seems to work for me: "apt-get install libdbd-mysql".
 Then you don't need to do the cpan things... Helped me a lot.
} else if(Debian-Etch) {
  apt-get install libdbd-mysql-perl
}


The easiest way to install Perl modules on Unix is to use the CPAN module. For example:

perl -MCPAN -e shell
install DBI
install DBD::mysql


The DBD
mysql installation runs a number of tests. These tests require being able to connect to the local MySQL server as the anonymous user with no password. If you have removed anonymous accounts or assigned them passwords, the tests fail. You can use force install DBD
mysql to ignore the failed tests.

DBI requires the Data::Dumper module. It may already be installed; if not, you should install it before installing DBI.

It is also possible to download the module distributions in the form of compressed tar archives and build the modules manually. For example, to unpack and build a DBI distribution, use a procedure such as this:

Unpack the distribution into the current directory: shell> gunzip < DBI-VERSION.tar.gz | tar xvf -

This command creates a directory named `DBI-VERSION'.
Change location into the top-level directory of the unpacked distribution: shell> cd DBI-VERSION

Build the distribution and compile everything: shell> perl Makefile.PL

make
make test
make install


The make test command is important because it verifies that the module is working. Note that when you run that command during the DBD::mysql installation to exercise the interface code, the MySQL server must be running or the test will fail.

It is a good idea to rebuild and reinstall the DBD::mysql distribution whenever you install a new release of MySQL, particularly if you notice symptoms such as that all your DBI scripts fail after you upgrade MySQL.

If you don't have access rights to install Perl modules in the system directory or if you want to install local Perl modules, the following reference may be useful: http://servers.digitaldaze.com/extensions/perl/modules.html#modules

Look under the heading ``Installing New Modules that Require Locally Installed Modules.''

ASTCC Setup Check List:

  • download ASTCC source file from CVS. Untarr the file.
  • verify that you have mysql installed and a user and its password to access databases
  • read the makefile and change path according to your installation
  • do Make install
  • Access the astcc-admin.cgi via your web browser
  • configure ASTCC on ASTCC admin page
  • fill in the parameters and press create then save.
  • be sure your apache user have rights to /var/lib/astcc/astcc-config.conf ; if not, nothing will work.
  • configure your calling cards beginning with brands,cards,trunk,routes
  • Secure the /var/www/cgi-bin/astcc-admin folder using .htaccess

Step by Step Install of ASTCC?:

  • Download ASTCC source file from CVS. Untar the file as above detailed.
  • from the untarred folder run 'make install' from that folder

make install

  • This will create required astcc directories and copies files into them.

  • copy astcc-admin.cgi to your cgi-bin/astcc-admin diretory
cp astcc-admin.cgi /var/www/cgi-bin/astcc-admin

  • copy astcc.agi to /var/lib/asterisk/agi-bin
cp astcc.agi /var/lib/asterisk/agi-bin

protect the directory where astcc-admin.cgi is with htaccess or something else

If there is any problem create them and copy files manually as under.

mkdir /var/lib/astcc  
mkdir /var/www/cgi-bin/astcc-admin  


  • copy astcc-admin.cgi to your cgi-bin/astcc-admin diretory
cp astcc-admin.cgi /var/www/cgi-bin/astcc-admin

  • copy astcc.agi to /var/lib/asterisk/agi-bin
cp astcc.agi /var/lib/asterisk/agi-bin


  • make it writable for the Webserver (e. g. nobody or www-data)
chmod 777 /var/lib/astcc

  • Edit /var/lib/astcc/astcc-config.conf file and add following entries:
vi /var/lib/astcc/astcc-config.conf

  • make manual entries in this file so that astcc works:

Note: This file can be automatically created by going to "Configure" via the ASTCC web interface.

maintcdr = NO
emailadd = you@yourdomain.com
cardlength = 5
dbname = astcc
email = NO
dbuser = cheap
startingdigit =
debug = NO
friendsdb = NO
pinlength = 4
maintverbose = YES
dbhost = localhost
maintname =
dbpass = calls
mailprog = sendmail
pinstatus = YES ;__This is CaSe sensative__


What do you need in astcc-exten.conf


; Use any of the permutations and combinations below to fit your needs.

; Card-number and number to dial derived from command-line.
; Call script with the card-number as first arg and the number ; to dial as the second arg.
;
exten => _00XXXXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN})
exten => _00XXXXXXXXX,2,Hangup

;
; Prompt the caller for the card-number and the number to dial.
;
exten => 1234,1,Answer
exten => 1234,2,DeadAGI(astcc.agi)
exten => 1234,3,Hangup

; If you call it with an extension of "BALANCE" and a calleridnumber, ; it will read your balance to you and then exit.

exten => _00XXXXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},BALANCE,1)
exten => _00XXXXXXXXX,2,Hangup

; You may use 77 as access number to enter the calling card system 
exten => 77,1,Answer 
exten => 77,2,DeadAGI(astcc.agi) 
exten => 77,3,Hangup 

; caller id authentication, dial dest no. directly without being asked the pin 
exten => _1NXXNXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN}) 
exten => _1NXXNXXXXXX,2,Hangup 

; caller id authentication, without balance information
exten => _1NXXNXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},,4) 
exten => _1NXXNXXXXXX,2,Hangup 


1)How do you remove the two digits 77? Using ${EXTEN:2} ? Is that it?

Ans: Yes, ${EXTEN} is the number send to Asterisk with ${EXTEN:n} you
remove the first n digits, (there are a lot of info on Google)

2)How do we setup the users CallerIds into the database? So that we
autehenticate based on caller id?

Ans: I have created Card Number equal the CallerID of the UA (using the
ASTCC web interface)

3) What does the two new databases IAX_friends and Sip_Freiends do?

Ans: Read the DOCs. Not supported yet.


  1. I have added a few different quiet levels to this program. They can
  2. be specified from the dial command.
  3. 1 - All warnings and messages play.
  4. 2 - All warnings and card balance
  5. 3 - All warnings
  6. 4 - Interrogation Only

Simple astcc-exten.conf

exten => _77.,1,Answer 
exten => _77.,2,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN:2},3)
exten => _77.,3,Hangup

Here when a UA dial 77 + his number, I call the ASTCC with cardid = UA
Caller ID and as destinatio number I trim the first two digits (77), using 'EXTEN:2'.

The last parameter specifie the ASTCC operational mode (here is a
piece of the astcc.agi)


# cat extensions.conf
.[general]
static=yes
writeprotect=no

.[globals]

FWDUSERID2=947623
FWD2USERNAME=sk123
FWDPREFIX=*

;macros

.[macro-fastbusy]
 exten => s,1,Answer
 exten => s,2,Wait,1
 exten => s,3,Playback(ss-noservice)
 exten => s,4,Wait(30)
 exten => s,5,Hangup

[OUTGOING]
 exten => 213,1,Answer
 exten => 213,2,DeadAGI(astcc.agi)
 exten => 213,3,Hangup

;caller id authentication, dial dest no. directly without being asked the pin

exten => XXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN})
exten => XXXXXX,2,Hangup
exten => XXXXXX,1,Dial(SIP/${EXTEN})

include => fwd1-out


;Include entries for Asterisk Calling Card
 include = /var/lib/astcc/astcc-exten.conf

You need put the astcc-admin.cgi into your cgi-bin directory, access this file from web browser for system provision to generate the pin, setup the routes etc.




Installing the database in MySQL : (original astcc installtion has errors)


  • Run the following commands to prepare the MySQL Database

groupadd mysql
useradd -g mysql mysql
cd /usr/local
gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf -
ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql
cd mysql
scripts/mysql_install_db --user=mysql
chown -R root  .
chown -R mysql data
chgrp -R mysql .
bin/mysqld_safe --user=mysql &

To create the complete database for ASTCC, run the sql below:


-- MySQL dump 8.23
--
-- Host: localhost    Database: astcc
---------------------------------------------------------
-- Server version	3.23.58

--
-- Table structure for table `bit_brands`
--

CREATE TABLE `bit_brands` (
  `name` varchar(40) NOT NULL default '',
  `language` varchar(10) default NULL,
  `inc` char(3) default '30',
  `publishednum` varchar(40) default NULL,
  `did` varchar(40) default NULL,
  `markup` int(11) default NULL,
  `days` char(3) default '0',
  `fee` int(11) default NULL,
  PRIMARY KEY  (`name`)
) TYPE=MyISAM;

--
-- Dumping data for table `bit_brands`
--


INSERT INTO `bit_brands` VALUES ('Eezee','en','6','12125023123','12123452134',10,'30',10);

--
-- Table structure for table `bit_cards`
--

CREATE TABLE `bit_cards` (
  `number` char(20) NOT NULL default '',
  `language` char(10) default NULL,
  `facevalue` int(11) default NULL,
  `used` int(11) NOT NULL default '0',
  `inc` int(11) NOT NULL default '0',
  `markup` int(11) NOT NULL default '0',
  `creation` timestamp(14) NOT NULL,
  `firstuse` timestamp(14) NOT NULL,
  `expiration` timestamp(14) NOT NULL,
  `inuse` int(11) default NULL,
  `brand` char(40) default NULL,
  `nextfee` int(11) default NULL,
  `pin` char(20) default NULL,
  PRIMARY KEY  (`number`)
) TYPE=MyISAM;

--
-- Dumping data for table `bit_cards`
--

INSERT INTO `bit_cards` VALUES ('12219983913459653156','en',10000,0,6,10,20050512154505,00000000000000,00000000000000,NULL,'Eezee',30,NULL);
INSERT INTO `bit_cards` VALUES ('11898276578725357619','en',10000,0,6,10,20050512154505,00000000000000,00000000000000,NULL,'Eezee',30,NULL);
--
-- Table structure for table `bit_cdrs`
--

CREATE TABLE `bit_cdrs` (
  `cardnum` char(40) NOT NULL default '',
  `callerid` char(80) default NULL,
  `callednum` char(80) default NULL,
  `trunk` char(40) default NULL,
  `disposition` char(20) default NULL,
  `billseconds` int(11) default NULL,
  `billcost` int(11) default NULL,
  `callstart` char(24) default NULL
) TYPE=MyISAM;

--
-- Table structure for table `bit_iaxfriends`
--

CREATE TABLE `bit_iaxfriends` (
  `name` char(40) NOT NULL default '',
  `secret` char(40) default NULL,
  `context` char(40) default NULL,
  `ipaddr` char(20) default NULL,
  `port` int(6) default NULL,
  `regseconds` int(11) NOT NULL default '0',
  PRIMARY KEY  (`name`)
) TYPE=MyISAM;

--
-- Table structure for table `bit_routes`
--

CREATE TABLE `bit_routes` (
  `pattern` char(40) NOT NULL default '',
  `comment` char(80) default NULL,
  `trunks` char(80) default NULL,
  `connectcost` int(11) NOT NULL default '0',
  `includedseconds` int(11) NOT NULL default '0',
  `cost` int(11) NOT NULL default '0',
  PRIMARY KEY  (`pattern`)
) TYPE=MyISAM;

--
-- Dumping data for table `bit_routes`
--

INSERT INTO `bit_routes` VALUES ('1*','USA','USA',1,30,2);

--
-- Table structure for table `bit_sipfriends`
--

CREATE TABLE `bit_sipfriends` (
  `name` char(40) NOT NULL default '',
  `username` char(40) default NULL,
  `secret` char(40) NOT NULL default '',
  `context` char(40) NOT NULL default '',
  `ipaddr` char(20) NOT NULL default '',
  `port` int(6) NOT NULL default '0',
  `regseconds` int(11) default '0',
  PRIMARY KEY  (`name`)
) TYPE=MyISAM;

--
-- Table structure for table `bit_trunks`
--

CREATE TABLE `bit_trunks` (
  `name` char(40) NOT NULL default '',
  `tech` char(10) default NULL,
  `path` char(40) NOT NULL default '',
  PRIMARY KEY  (`name`),
  KEY `pk_trunks` (`name`)
) TYPE=MyISAM;

--
-- Dumping data for table `bit_trunks`
--


INSERT INTO `bit_trunks` VALUES ('USA','SIP','nypbx.iareanet.net');






FAQ

Q: 1. What is Trunk in ASTCC and what are the meaning of the parameters such as Technology & Peer/Trunk ?
A : When a user punchers a number after authentication, astcc will look at the routes table for a number match. Then it will pickup the trunk and go to trunks table and look for a match. That will tell astcc to use SIP or Local or ZAP (technology) and the name of the peer to construct the dial string. Example, if technology is sip, then you should have a context in the sip.conf, with the name given in path filed (selected) of trunks table.

Q: In the routes if I use 0 connect fee that means the user won't be charged for 0 sec calls right ?
A: No matter what you put in here, user will be not charge for any call which is not successful. Connect charge applies for any successful call. Which is just an additional charge per call basis.

Q: What are Published Number,DID,Inc,Markup (in 1/100 of 1%) in Brands ?
A: Brands table is not used, within astcc application.

BUGS

Currently (2005-06-16) there's a bug when using free calls. You have to set maxmins manually when this happens.
I have set maxmins to 600, should be enough for nothing ;-).

if ($adjcost == 0) {
$maxmins = 600;
} else {
$maxmins = int(($credit - $adjconn) / $adjcost);
}


Debugging

The astcc.agi script prints lots of info to STDERR, if you wish to store this debugging info into a file just add:

my $logfile ="/var/log/astcc.txt";
open STDERR, ">>$logfile";


to the begining of the perl script.

See also



Features Request

  • If there are features that you would like to see added to ASTCC please visity the bouny page ASTCCBounty




Created by: ksc, Last modification: Tue 12 of Jun, 2012 (02:40 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+