Jump to: navigation, search

Raspberry PI

Village telco Server Project.

This project is based arround the raspberry PI mini computer. We use the model B with 512MB ram and Ethernet interface. As the software base we use the moebius minimal Raspbian wheezy distribution.

http://moebiuslinux.sourceforge.net/


Preparing your SD card for the Raspberry Pi

In order to use your Raspberry Pi, you will need to install an Operating System (OS) onto an SD card. An Operating System is the set of basic programs and utilities that allow your computer to run; examples include Windows on a PC or OSX on a Mac. These instructions will guide you through installing a recovery program on your SD card that will allow you to easily install different OS’s and to recover your card if you break it. 1. Insert an SD card that is 4GB or greater in size into your computer 2. Format the SD card so that the Pi can read it a. Windows i. Download the SD Association's Formatting Tool  from 1 https://www.sdcard.org/downloads/formatter_4/eula_windows/ ii. Install and run the Formatting Tool on your machine iii. Set "FORMAT SIZE ADJUSTMENT" option to "ON" in the "Options" menu iv. Check that the SD card you inserted matches the one selected by the Tool v. Click the “Format” button b. Mac i. Download the SD Association's Formatting Tool from https://www.sdcard.org/downloads/formatter_4/eula_mac/ ii. Install and run the Formatting Tool on your machine iii. Select “Overwrite Format” iv. Check that the SD card you inserted matches the one selected by the Tool v. Click the “Format” button c. Linux i. We recommend using gparted (or the command line version  parted) ii. Format the entire disk as FAT 3. install moebius a. windows use the discimmage tool b. mac see linux c. linux use the dd command to transfer the image to your SD card. dd if=file.img of=/dev/sdx bs=1MB where x is you cards device adress,

Note: The built­in Windows formatting tool will only format the first partition that Windows can read ­ not 1 the entire disk. For this reason we advise using the official SD Card Association Formatting Tool.


1) asterisk pbx. We are not going to reinvent the wheel so grab you copy from http://www.raspberry-asterisk.org/

2) Asterisk billing

A2Billing Install on Debian

A2Billing is a global switching, billing and Customer Relationship Management solution for small to medium VoIP providers. It allows a large set of VoIP services ranging from Calling Cards to Wholesale VoIP business. Go through this step by step tutorial to install A2Billing on debian (wheezy).

        • GENERAL SECTION ****
  1. apt-get update
  2. apt-get upgrade
  3. apt-get -y install asterisk
  4. apt-get -y install php5 php5-mysql php5-dev
  5. apt-get -y install apache2
  6. apt-get -y install mysql-server mysql-client phpmyadmin
        • DOWNLOAD A2BILLING ****
  1. cd /usr/src
  2. wget https://github.com/Star2Billing/a2billing/archive/master.tar.gz
  3. tar xvf master.tar.gz
  4. cd a2billing-master
        • AGI & GENERAL CONF SECTION ****
  1. cp a2billing.conf /etc
  2. cp /usr/src/a2billing-master/AGI/a2billing.php /usr/share/asterisk/agi-bin
  3. ln -s /usr/src/a2billing-master/common/lib /usr/share/asterisk/agi-bin/lib
  4. cp -r /usr/src/a2billing-master/admin /var/www
  5. cp -r /usr/src/a2billing-master/agent /var/www
  6. cp -r /usr/src/a2billing-master/customer /var/www
  7. cp -r /usr/src/a2billing-master/common /var/www
        • MYSQL DATABASE SECTION ****

Use phpmyadmin or mysql command line interface to create a2billing database, a2billing database user and a2billing db user password. You should update [database] section in a2billing.conf with these values.

  1. cd ./DataBase/mysql-5.x
  2. ./install-db.sh

you will be asked for a2billing databse name/user/passwd during the execution of the install-db script. You will end up with something like 97 tables in your a2billing database. You can check if this is the case with mysql commands: >use a2billing-database-name; >show tables;

        • ASTERISK CONFIGURATION SECTION ****
  1. cd /etc/asterisk
  2. touch additional_a2billing_sip.conf additional_a2billing_iax.conf

Add:

  1. include additional_a2billing_sip.conf at the end of sip.conf
  2. include additional_a2billing_iax.conf at the end of iax.conf

Add following settings to /etc/asterisk/manager.conf:
[myasterisk]
secret=mycode
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read=system,call,log,verbose,command,agent,user
write=system,call,log,verbose,command,agent,user

A2billing should have its proper context in extensions.conf as shown bellow:

[a2billing] exten => _X., 1, NoOp exten => _X., n, Progress() exten => _X., n, AGI(a2billing.php) exten => _X., n, Hangup

        • A2BILLING CRONJOBS SECTION ****

Create a2billing running directory: #mkdir /var/run/a2billing

  1. crontab -e

Copy the following cronjobs:

  1. update the currency table

0 6 * * * php /usr/src/a2billing-master/Cronjobs/currencies_update_yahoo.php

  1. manage the monthly services subscription

0 6 1 * * php /usr/src/a2billing-master/Cronjobs/a2billing_subscription_fee.php

  1. To check account of each Users and send an email if the balance is less than the user have choice.

0 * * * * php /usr/src/a2billing-master/Cronjobs/a2billing_notify_account.php

  1. this script will browse all the DID that are reserve and check if the customer need to pay for it.
  2. bill them or warn them per email to know if they want to pay in order to keep their DIDs.

0 2 * * * php /usr/src/a2billing-master/Cronjobs/a2billing_bill_diduse.php

  1. This script will take care of the recurring service.

0 12 * * * php /usr/src/a2billing-master/Cronjobs/a2billing_batch_process.php

  1. To generate invoices and for each user.

0 6 * * * php /usr/src/a2billing-master/Cronjobs/a2billing_batch_billing.php

  1. to proceed the autodialer
  • /5 * * * * php /usr/src/a2billing-master/Cronjobs/a2billing_batch_autodialer.php
  1. manage alarms

0 * * * * php /usr/src/a2billing-master/Cronjobs/a2billing_alarm.php

  1. manage archive

0 12 * * * php /usr/src/a2billing-master/Cronjobs/a2billing_archive_data_cront.php

  1. autorefill

0 10 21 * * php /usr/src/a2billing-master/Cronjobs/a2billing_autorefill.php 15 * * * * php /usr/src/a2billing-master/Cronjobs/a2billing_batch_cache.php

        • A2BILLING LOG FILES SECTION ****
  1. mkdir -p /var/log/a2billing

touch /var/log/a2billing/cront_a2b_alarm.log
touch /var/log/a2billing/cront_a2b_autorefill.log
touch /var/log/a2billing/cront_a2b_batch_process.log
touch /var/log/a2billing/cront_a2b_archive_data.log
touch /var/log/a2billing/cront_a2b_bill_diduse.log
touch /var/log/a2billing/cront_a2b_subscription_fee.log
touch /var/log/a2billing/cront_a2b_currency_update.log
touch /var/log/a2billing/cront_a2b_invoice.log
touch /var/log/a2billing/cront_a2b_check_account.log
touch /var/log/a2billing/a2billing_paypal.log
touch /var/log/a2billing/a2billing_epayment.log
touch /var/log/a2billing/a2billing_api_ecommerce_request.log
touch /var/log/a2billing/a2billing_api_callback_request.log
touch /var/log/a2billing/a2billing_api_card.log
touch /var/log/a2billing/a2billing_agi.log

        • A2Billing Sounds Installation *****
  1. cd /usr/src/a2billing-master/addons/sound
  2. ./install_a2b_sounds.sh
        • Root Vs Asterisk user ****

By default all files and directories created during this installation process belong to root user. However It should be noted that for A2Billing to work proprely, some of theses files/direcroties have to belong to asterisk user. In particular the following ones: a2billing.conf (/usr/share/asterisk/agi-bin additional_a2billing_sip.conf (chmod 777) additional_a2billing_iax.conf (chmod 777) all web folders (admin, agent, customer, common) log forlder The permissions/ownership setting is one of the most significant issues that arise when dealing with a2billing installation.


3) Freeswitch + Vbilling


wget --no-check-certificate http://goo.gl/ap7KV -O install.sh
chmod +x install.sh
./install.sh