login | register
Tue 02 of Dec, 2008 [02:30 UTC]

voip-info.org

AreskiCC CallingCard Application The idiots guideV2

Created by: gsummey,Last modification on Thu 27 of Oct, 2005 [15:01 UTC] by areski


IMPORTANT : The new version of AreskiCC have changed his name -> "A2Billing"

Please for a followup of the project go to the appropriate pages :






The idiots guide to installing AreskiCC CallingCard Application V2
(Updated August 1st 2005)

Frist of all thanks to terchris for starting the first guide and to everyone who contributed to it.
A quote from the original idiot's guide:
"This guide is for those who have no knowledge of Areski, postgres and hardly any knowledge of Linux.
I wrote it because I had to figure out the hard way. If you want to test AreskiCC, but have no idea on how
to do so then this guide is for you."

I'm writing this for the same reasons, but I have it a lot easier as all I have to do is update some info.
I am assuming a little higher linux knowledge than the first guide, but I feel that if you use both the original
and this you sould be able to figure out any neccessary linux commands.

This guide is assuming a vanilla install of Asterisk@Home V1.3 and will install AreskiCC V2.2

A.Install components that will support AreskiCC
  1.)Install postgres sql server. 
      yum install rh-postgresql-server

  2.)Install php-pgsql. 
      yum install php-pgsql 

  3.) Make sure that php dynamically loads the pgsql.so module on execution. 
       The following directions have to be set in your php.ini:
       extension_dir = 'directory where pgsql.so is located'
       extension=pgsql.so
       You should really check this, because if areskicc2 fails to connect to Postgre due to missing php-pgsql      
       functionality you won't get a php error for some strange reason. So you better be sure that you have a working 
       php-pgsql setup.
/var/lib/pgsql/data/postgresql.conf
Make sure it has a line
  1. tcpip_socket=false make it like following tcpip_socket=true

B.Download AreskiCC source and data base schema.
  (Note: Check http://www.areski.net to see if V2.2 is the most current!!!)
  cd /usr/src
  mkdir areski
  cd areski
  wget http://www.areski.net/areskicc-doc-v2/Areski_AGI_v2.2.tar.gz
  wget http://www.areski.net/areskicc-doc-v2/AreskiCC_UI_v2.2.tar.gz
  wget http://www.areski.net/areskicc-doc-v2/areskicc-pgsql-schema-v2.2.sql

C.Unpack the source
  tar -xzvf ./Areski_AGI_v2.2.tar.gz
  tar -xzvf ./AreskiCC_UI_v2.2.tar.gz

D.*From this point I will change the numbering scheme to reflect the install notes from
  http://www.areski.net/areskicc-doc-v2/INSTALL_AGI.txt 
  I will add more info where needed, but use that document as the numbering guideline

1.Place the entire content directory into your agi-bin directory.
cd Areski_AGI
cp areskicc2.php /var/lib/asterisk/agi-bin/
cp -r libs_areskcc /var/lib/asterisk/agi-bin/

2.Make sure the script is runnable
chmod +x /var/lib/asterisk/agi-bin/areskicc2.php

3.This step is missing from the install document

4.Copy the sounds files
cp -r sounds/* /var/lib/asterisk/sounds/
*Note you will be asked if you want to overwrite, answer yes

5.Create a Database, add a user and import the areskicc-pgsql-schema.psql

5.1.Start postgres
/etc/init.d/rhdb start

5.2.Set postgres to start automatically
chkconfig rhdb on

5.3.Login as postgres and add database user
a)su - postgres
b)createuser -W
   You will be asked if the user can create databases, answer yes
   You will be asked if the user can create other users, answer no
   I used a username of asterisk, use whatever you want
   Use whatever password you want

5.4.Create areskicc2 database
a) createdb -O asterisk areskicc2  (that is an O for Owner)

5.5.Login to new database to check ownership
a) psql -d areskicc2
b) \du

              List of database users
 User name | User ID |         Attributes
 --------------------------------------------------
 asterisk  |     100 | create database
 postgres  |       1 | superuser, create database
(2 rows)

c) \q (to exit from database)

5.6.Import data schema into new database
a) psql -U asterisk -d areskicc2 -f /usr/src/areski/areskicc-pgsql-schema-v2.2.sql 

5.6.1 Comment from hoanguyen:
"for easy way you should do the step 5.8 and 5.9 here, then use the almost the same command line as the above, just add -U (for user) and -W (or password)"

psql -d areskicc2 -f /usr/src/areski/areskicc-pgsql-schema-v2.2.sql -U username -W

it will ask you for password then input the password you set before this step. This will create all the table with the 'username' as Owner.


5.7.Check if asterisk is owner of all the database tables by login into postgre
    psql -d areskicc2 and issue the command '\d'
    areskicc2=#\d
    If it looks ok you can skip this step and go directly to 5.8. otherwise:

a)Login to the database and change the ownership of all tables and sequences
   psql -d areskicc2
   areskicc2=#\d (to show all tables and indexes)

                 List of relations
Schema |         Name          |   Type   |  Owner
------------------------------------------------------
public | call                  | table    | asterisk
public | call_id_seq           | sequence | asterisk
public | callerid              | table    | asterisk
...
public | ui_authen_userid_seq  | sequence | asterisk
(26 rows)
   
b)If the owner is not asterisk (or your user), we will need to change it
   areskicc2=#ALTER TABLE call OWNER to asterisk;
   Notice the semicolon at the end of the command, this is neccessary
   You need to run this command for every table and sequence in the database (there are 26 of them)
   Replace the word "call" in the example above with the table or sequence name 
   (use the command ALTER TABLE to alter sequences also).
   *Note upon re-reading the example, I want to clarify it as it seems confusing.  In the example above
    you are running the commnad ALTER TABLE on a table named "call" you are changing the OWNER to
    asterisk.

You may cut and paste the following commands, if you are not up to typing each one individually:
ALTER TABLE call to asterisk
ALTER TABLE call_id_seq OWNER to asterisk
ALTER TABLE callerid OWNER to asterisk
ALTER TABLE callerid_id_seq OWNER to asterisk
ALTER TABLE cc_card OWNER to asterisk
ALTER TABLE cc_card_id_seq OWNER to asterisk
ALTER TABLE cc_iax_buddies OWNER to asterisk
ALTER TABLE cc_iax_buddies_id_seq OWNER to asterisk
ALTER TABLE cc_ratecard OWNER to asterisk
ALTER TABLE cc_ratecard_id_seq OWNER to asterisk
ALTER TABLE cc_sip_buddies OWNER to asterisk
ALTER TABLE cc_sip_buddies_id_seq OWNER to asterisk
ALTER TABLE cc_tariffgroup OWNER to asterisk
ALTER TABLE cc_tariffgroup_id_seq OWNER to asterisk
ALTER TABLE cc_tariffgroup_plan OWNER to asterisk
ALTER TABLE cc_tariffplan OWNER to asterisk
ALTER TABLE cc_tariffplan_id_seq OWNER to asterisk
ALTER TABLE logpayment OWNER to asterisk
ALTER TABLE logpayment_id_seq OWNER to asterisk
ALTER TABLE logrefill OWNER to asterisk
ALTER TABLE logrefill_id_seq OWNER to asterisk
ALTER TABLE templatemail OWNER to asterisk
ALTER TABLE trunk OWNER to asterisk
ALTER TABLE trunk_id_trunk_seq OWNER to asterisk
ALTER TABLE ui_authen OWNER to asterisk
ALTER TABLE ui_authen_userid_seq OWNER to asterisk

5.8.Now we must edit the pg_hba.conf file to allow connection to the database.
vi /var/lib/pgsql/data/pg_hba.conf
b)add this line above the existing line
   host     all     all     127.0.0.1     255.255.255.0     trust

   So the file should look like this when complete
   host     all     all     127.0.0.1     255.255.255.0     trust
   local    all     all                                     trust

5.9.Restart postgres for changes to take effect
/etc/init.d/rhdb restart


6.Setup your database into the application

6.1.Edit /var/lib/asterisk/agi-bin/libs_areskcc/db_php_lib/defines.php
a)Be sure to set the user and pass to the entries you used when creating the database in step 5.3.b above.
b)I changed NUMBER_TRY to 1 from the default of 3.  It seemed that if the number could not go through, 
   it would redial three times, repeating the error to me three times.
c)I changed LEN_CARDNUMBER to 4 because I am using AreskiCC as a authorization system, not as a calling 
  card system.  This way the users enter their 4 digit "PIN" number before being allowed to make a call.  You
  probably do not want to change this if you are using this for calling cards.
d)Experiment with the other options to find the best settings for your application.

7.Setup the callingcard application into Asterisk

7.1.Edit extension_custom.conf (/etc/asterisk/extension_custom.conf)
 a)Add the following under the from-internal-custom context.
   ; CallingCard application
   exten => _X.,1,Answer
   exten => _X.,2,Wait,2
   exten => _X.,3,DeadAGI,areskicc2.php
   exten => _X.,4,Wait,2
   exten => _X.,5,Hangup

8.Edit sip.conf
8.1.Insert  #include additional_areskicc_sip.conf at the end of the file
    a)*Note: I have not configured the IAX and SIP buddies.  I can only assume that the basic info that Areski 
       included in the help file will work correctly.

9.Edit iax.conf
9.1.#include additional_areskicc_iax.conf at the end of the file
    a)*Note: I have not configured the IAX and SIP buddies.  I can only assume that the basic info that Areski 
       included in the help file will work correctly.

10.Configure the asterisk manager

10.1.I didn't need to modify the asterisk manager. 

11.Restart asterisk
11.1.Run asterisk -r
 a)CLI>reload
 b)CLI>exit

12.Install the user interface
12.1.mkdir /var/www/html/areskicc
12.2.cp -r /usr/src/areski/AreskiCC_UI_v2/* /var/www/html/areskicc
12.3.we need to edit /var/www/html/areskicc/lib/defines.php
 a)change username and password to what was used in step 5.3.b above
 b)change EMAIL_ADMIN to whatever email address you wish to use
 c)again, change LEN_CARDNUMBER if you don't want to use the default card length
 d)once you know what you are doing you can change SHOW_HELP to no

13.From this point you should be able to login to the webpage
13.1.Username:root
13.2.Password:myroot
13.3.Comment from hoanguyen: you can change this password by edit areskicc-pgsql-schema-v2.2.sql
 - Looking for 2 lines in the file:
   INSERT INTO ui_authen VALUES (2, 'admin', 'mypassword', 0, 1023, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2005-02-26 21:14:05.391501-05');
INSERT INTO ui_authen VALUES (1, 'root', 'myroot', 0, 1023, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2005-02-26 20:33:27.691314-05');
  then change 'admin' with any user name you want, and 'mypassword' with any password you like.
  also do with 'root' and 'myroot'
you have to do this before step 5.6 (before import to the database).


14.Now you can setup AreskiCC
14.1.Create a trunk
14.2.Create a tarrifgroup
14.3.Create a ratecard
14.4.Create a user

15.Test
15.1.If you used the default addition to the extension_custom.conf as shown above in setp 7.1.a you should 
       be able to pick up your phone, dial 18005551212 and hear something like "Please enter your complete card number"
15.2.Enter the card number that was created for you when you setup your test user in step 14.4 above.
15.3.The call should route through the trunk you specified in step 14.1 and everything should be golden... 

16.Additional Info
16.1.In the previous guide it was noted that you should modify the php.ini to reflect "register_globals=On"  
       I did not have to do this with my installation, I checked the file and it was already set to On.
16.2.There is a BUG in areskicc2.php which makes that if you set NUMBER_TRY to something other than 1, the script
       will attempt to call the dnid extension and doesn't prompt for the number to dial after the first call has been 
       made. To fix it, replace <$use_dnid=0> at line 209 of areskicc2.php with <$use_dnid='NO'>.
16.3. Be aware that areskicc2.php strips of international dialing prefixes (011,00) when looking up the dialed 
        number in the rate card. normally this is the wanted way. but some iax providers give you improper cvs 
        ratecards (e.g. voipjet) where destination numbers are in the format 011+countryprefix. 
        For example : 01149  for Germany Proper. Best solution to this is to fix your rates csv file before importing it
        into areskicc and make sure they use pure country prefixes for destination codes..
16.4. Already wondered whether if Areskicc's LCR function is actually doing LCR ? Well it does - but only if you care
        to fix the BUG i found in Class.RateEngine.php:
        FIND THE RIGHT PLACE AND USE THIS CODE INSTEAD:


        if ($LCtype==0){
        //$result = $this -> array_csort($result,'6',SORT_ASC); GOTTYA!
        $result = $this -> array_csort($result,'9',SORT_ASC); //1
        }else{
        //$result = $this -> array_csort($result,'9',SORT_ASC); GOTTYA!
        $result = $this -> array_csort($result,'12',SORT_ASC); //1
        } 

Comments

Comments Filter
222

333Help Required!

by asterisk_learner, Friday 01 of June, 2007 [12:30:12 UTC]
Hello all,
First of all its a great help the IDIOTS GUIDE, really helps in fixing problems.

i know its a pretty old version of areski and it would be better to shift to newer one, but i installed asterisk 1.0.9 with zaptel 1.0.9 and used the areskicc2 php application with agi on two seperate Fedora Core Linux3 pc two years back. after that i have been out of touch of all these things, now i need to run that application again for a demonstration, i had the all the sources from me since the previous installation and therefore i did not had to download any thing again. one of my machines is a configuration from 2005 and one of them i re-configured again. the machine that i have reconfigured is giving me some problems that i am unable to solve. this is what i m trying to achieve.
both the servers have static IP and are connected to each other via LAN, they both can register each other correctly because i have my iax.conf in order. next a caller calls into server A areskicc authenticates asks for 10 digit card number which it authenticates, next when the caller wants to dial a number out server B (international calling) he has to dial 011429any number. the serverB then receives the call from serverA with 011429 prefix removed and dials the rest of the number out of its zap line (this is working fine and tested, the error i am having is asa follows): while working vise versa the caller calls at serverB authenticates himself by giving the card number and to make an international call to serverA he should give the prefix 011519his number, but serverB instead of removing the prefix tries to transfer the call to serverB like this 515192223344. i am sorry that i cannot provide you the exact console output that asterisk produces, but after this number is being forwarded to serverA server A rejects the call and the console of asterisk on serverB gives an error message saying "Socket_Read: Call Rejected by 192.168.0.21: No authority found." can you please provide me with some assistance why particularly one server is not stripping off the prefix. i have the same areskicc2.php and postgresql schema on both of them.
i know it is very painful to read such a detailed issue without any config files , but i guess the gurus of IDIOTS GUIDE are able to help in the problem without looking at them.
Kind Regards.
222

333psql: FATAL: IDENT authentication failed for user

by lan, Friday 21 of October, 2005 [03:18:12 UTC]
Dear Supporters!

Would you please help me with the error: psql: FATAL: IDENT authentication failed for user "username"
when I tries to run "psql -d areskicc2 -f /usr/src/areski/areskicc-pgsql-schema-v2.2.sql -U username -W" after I type in the password of the username that I created.
and I will have the error message: psql: FATAL: IDENT authentication failed for user "username" also if I tried the command "psql -U username -d areskicc2 -f /usr/src/areski/areskicc-pgsql-schema-v2.2.sql"
I try to use the same *@home 1.3 as the verison in this instruction.
Everything just run through smoothly until that point.

I would very appreciated for your help!

Lan.
222

333SOLVED

by stillman, Sunday 25 of September, 2005 [14:12:36 UTC]
ok, postgresql doesn't like special characters like "_" (:lol:) (:mad:)
222

333Re: pg_pconnect(): password authentication failed for user "areski"

by stillman, Sunday 25 of September, 2005 [13:54:43 UTC]
i can login with the same user without problems to phppgadmin btw.
222

333pg_pconnect(): password authentication failed for user "areski"

by stillman, Sunday 25 of September, 2005 [13:32:21 UTC]
hello!
i'm having a problem setting this up on my gentoo-machine. my user areski is the owner of the DB and the tables, still i only get a error message when trying to run it via www(apache is on the same machine). i can login via console without fuss with this user, dunno where the problem lies... (:confused:)
these are the errors i get:

Warning: pg_pconnect(): Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "areski" in /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php on line 67
Database error: Link-ID == false, pconnect failed
PostgreSQL Error: 0 ()


Warning: pg_pconnect(): Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "areski" in /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php on line 67
Database error: Link-ID == false, pconnect failed
PostgreSQL Error: 0 ()

Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link resource in /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php on line 100

Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php:67) in /var/www/localhost/htdocs/areskicc/lib/module.access.php on line 66

Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php:67) in /var/www/localhost/htdocs/areskicc/lib/module.access.php on line 67

p.s.:sorry for reposting, the tiki-software sucks imho... (:mad:)
222

333pg_pconnect(): password authentication failed for user "areski"

by stillman, Sunday 25 of September, 2005 [13:15:19 UTC]
hello!
i'm having a problem setting this up on my gentoo-machine. my user areski is the owner of the DB and the tables, still i only get a error message when trying to run it via www(apache is on the same machine). i can login via console without fuss with this user, dunno where the problem lies... (:confused:)
this are the errors i get:

Warning: pg_pconnect(): Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "areski" in /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php on line 67
Database error: Link-ID == false, pconnect failed
PostgreSQL Error: 0 ()


Warning: pg_pconnect(): Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "areski" in /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php on line 67
Database error: Link-ID == false, pconnect failed
PostgreSQL Error: 0 ()

Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link resource in /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php on line 100

Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php:67) in /var/www/localhost/htdocs/areskicc/lib/module.access.php on line 66

Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/areskicc/lib/DB-modules/phplib_postgres.php:67) in /var/www/localhost/htdocs/areskicc/lib/module.access.php on line 67

222

333Re: Help Areskicc (New Easy question)

by Caius, Tuesday 20 of September, 2005 [08:01:02 UTC]
Getting same problem...

followed the guide step by steps...but still when I dial out, nothing happens...
Did i do anything wrong ?
any help would great appreciated..

Caius
Total newbie
222

333Help Areskicc (New Easy question)

by charliechaklam, Friday 16 of September, 2005 [03:21:40 UTC]
The idots guides were very Replenishing

The web interface works ok, but i can not get to the prompt where it asks to enter the pin code, i dialed 18005551212 but no luck,

i fact when i add this line to the extension_custom.conf and reread configs prom the gui interface, i can not hear any thing through the phone (except the dtmf and dialtone), even if i dial ext 200 or even a 7 or 10 digit number on the phone.


7.1.Edit extension_custom.conf (/etc/asterisk/extension_custom.conf)
a)Add the following under the from-internal-custom context.
  ; CallingCard application
  exten => _X.,1,Answer
  exten => _X.,2,Wait,2
  exten => _X.,3,DeadAGI,areskicc2.php
  exten => _X.,4,Wait,2
  exten => _X.,5,Hangup

Thank you i will be very satisfied. (:neutral:)
222

333Re: Not to flame or anything, but did anyone ever get Areski's CC application to work?

by hoanguyen, Sunday 21 of August, 2005 [21:58:46 UTC]
This is working, we use that too.
222

333Re: Imported Rate Table without 011/11 and still " # is Invalid #

by gsummey, Tuesday 16 of August, 2005 [20:59:44 UTC]
I'll give you an option to try, but there is no guarantees as all of my configs are pretty heavily modified and I don't know if this will work on a stock install, but I think it will.

You are going to edit the Class.RateEngine.php file. It is located in /var/lib/asterisk/agi-bin/libs_areskcc/db_php_lib/

When you open the file find this line:
function rate_engine_performcall ($agi, $destination){

Directly below that line a global variable is called
global $agi;

You need to add another variable directly under that one
global $myprefix;

So it should look like:
global $agi;
global $myprefix;

Ok, next go down about 15 lines till you see this:
$dialstr = "$tech/$ipaddress/$prefix$destination".$dialparams;

Notice that $prefix variable in there? We're going to change it to the variable that you called above; $myprefix
So the line will look like this when you are done:
$dialstr = "$tech/$ipaddress/$myprefix$destination".$dialparams;

Save the file and that's it.

Now when you dial if you are watching the CLI you should see something like this:

 ...string(29) "DESTINATION ::> 0113456789012"n
 ...string(30) "NEW DESTINATION ::> 3456789012"n
 ... >> EXEC DIAL IAX2/voipjet/0113456789012|120|HWL(25738092000:61000:30000)
   — AGI Script Executing Application: (DIAL) Options: (IAX2/voipjet/0113456789012|120|HWL(25738092000:61000:30000))
   — Limit Data:
   — timelimit=2147483647
...

The DESTINATION is the original number dialed
NEW DESTINATION is what the system uses to lookup the cost

Then in the DIAL command you can see that the 011 was added back.

Hope this helps,

G