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

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 howto 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 originaland 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

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.soYou should really check this, because if areskicc2 fails to connect to Postgre due to missing php-pgsqlfunctionality you won't get a php error for some strange reason. So you better be sure that you have a workingphp-pgsql setup./var/lib/pgsql/data/postgresql.confMake sure it has a line

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/srcmkdir areskicd areskiwget http://www.areski.net/areskicc-doc-v2/Areski_AGI_v2.2.tar.gzwget http://www.areski.net/areskicc-doc-v2/AreskiCC_UI_v2.2.tar.gzwget http://www.areski.net/areskicc-doc-v2/areskicc-pgsql-schema-v2.2.sql

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

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 automaticallychkconfig rhdb on

5.3.Login as postgres and add database usera)su - postgresb)createuser -WYou will be asked if the user can create databases, answer yesYou will be asked if the user can create other users, answer noI used a username of asterisk, use whatever you wantUse whatever password you want

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 postgrepsql -d areskicc2 and issue the command '\d'areskicc2=#\dIf 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 sequencespsql -d areskicc2areskicc2=#\d (to show all tables and indexes)

b)If the owner is not asterisk (or your user), we will need to change itareskicc2=#ALTER TABLE call OWNER to asterisk;Notice the semicolon at the end of the command, this is neccessaryYou 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 toasterisk.

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

So the file should look like this when completehost all all 127.0.0.1 255.255.255.0 trustlocal 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.phpa)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 callingcard system. This way the users enter their 4 digit "PIN" number before being allowed to make a call. Youprobably 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.

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

9.Edit iax.conf9.1.#include additional_areskicc_iax.conf at the end of the filea)*Note: I have not configured the IAX and SIP buddies. I can only assume that the basic info that Areskiincluded 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 asterisk11.1.Run asterisk -ra)CLI>reloadb)CLI>exit

12.Install the user interface12.1.mkdir /var/www/html/areskicc12.2.cp -r /usr/src/areski/AreskiCC_UI_v2/* /var/www/html/areskicc12.3.we need to edit /var/www/html/areskicc/lib/defines.phpa)change username and password to what was used in step 5.3.b aboveb)change EMAIL_ADMIN to whatever email address you wish to usec)again, change LEN_CARDNUMBER if you don't want to use the default card lengthd)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 webpage13.1.Username:root13.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 AreskiCC14.1.Create a trunk14.2.Create a tarrifgroup14.3.Create a ratecard14.4.Create a user

15.Test15.1.If you used the default addition to the extension_custom.conf as shown above in setp 7.1.a you shouldbe 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 Info16.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 scriptwill attempt to call the dnid extension and doesn't prompt for the number to dial after the first call has beenmade. 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 dialednumber in the rate card. normally this is the wanted way. but some iax providers give you improper cvsratecards (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 itinto 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 careto fix the BUG i found in Class.RateEngine.php:FIND THE RIGHT PLACE AND USE THIS CODE INSTEAD:

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

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 howto 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 originaland 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

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.soYou should really check this, because if areskicc2 fails to connect to Postgre due to missing php-pgsqlfunctionality you won't get a php error for some strange reason. So you better be sure that you have a workingphp-pgsql setup./var/lib/pgsql/data/postgresql.confMake sure it has a line

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/srcmkdir areskicd areskiwget http://www.areski.net/areskicc-doc-v2/Areski_AGI_v2.2.tar.gzwget http://www.areski.net/areskicc-doc-v2/AreskiCC_UI_v2.2.tar.gzwget http://www.areski.net/areskicc-doc-v2/areskicc-pgsql-schema-v2.2.sql

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

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 automaticallychkconfig rhdb on

5.3.Login as postgres and add database usera)su - postgresb)createuser -WYou will be asked if the user can create databases, answer yesYou will be asked if the user can create other users, answer noI used a username of asterisk, use whatever you wantUse whatever password you want

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 postgrepsql -d areskicc2 and issue the command '\d'areskicc2=#\dIf 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 sequencespsql -d areskicc2areskicc2=#\d (to show all tables and indexes)

b)If the owner is not asterisk (or your user), we will need to change itareskicc2=#ALTER TABLE call OWNER to asterisk;Notice the semicolon at the end of the command, this is neccessaryYou 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 toasterisk.

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

So the file should look like this when completehost all all 127.0.0.1 255.255.255.0 trustlocal 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.phpa)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 callingcard system. This way the users enter their 4 digit "PIN" number before being allowed to make a call. Youprobably 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.

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

9.Edit iax.conf9.1.#include additional_areskicc_iax.conf at the end of the filea)*Note: I have not configured the IAX and SIP buddies. I can only assume that the basic info that Areskiincluded 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 asterisk11.1.Run asterisk -ra)CLI>reloadb)CLI>exit

12.Install the user interface12.1.mkdir /var/www/html/areskicc12.2.cp -r /usr/src/areski/AreskiCC_UI_v2/* /var/www/html/areskicc12.3.we need to edit /var/www/html/areskicc/lib/defines.phpa)change username and password to what was used in step 5.3.b aboveb)change EMAIL_ADMIN to whatever email address you wish to usec)again, change LEN_CARDNUMBER if you don't want to use the default card lengthd)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 webpage13.1.Username:root13.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 AreskiCC14.1.Create a trunk14.2.Create a tarrifgroup14.3.Create a ratecard14.4.Create a user

15.Test15.1.If you used the default addition to the extension_custom.conf as shown above in setp 7.1.a you shouldbe 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 Info16.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 scriptwill attempt to call the dnid extension and doesn't prompt for the number to dial after the first call has beenmade. 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 dialednumber in the rate card. normally this is the wanted way. but some iax providers give you improper cvsratecards (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 itinto 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 careto fix the BUG i found in Class.RateEngine.php:FIND THE RIGHT PLACE AND USE THIS CODE INSTEAD: