In this post we present an open source project that is to setup IP-PBX, a VOIP server on pcDuino. On this IP-PBX we can implement customized ring tones, call transfer function, and call number display.
The solution we adopted is, 3G+Asterisk+Freepb. A 3G dongle is the physical front-end, freepbx is the GUI control interface, and Asterisk is the VOIP server. The steps to install the server are as following:
I. Download and Install Asterisk:
1. Download the source files of Asterisk from here.
2. Installation environment:
$sudo apt-get install sqlite3 libsqlite3-dev libxml2-dev g++ ncurses-dev $tar xvfz asterisk-11-current.tar.gz $cd asterisk-* $./configure $contrib/scripts/get_mp3_source.sh $make menuselect $make $make install $make config
When the installation is done execute “$asterisk -vr” to start asterisk command mode. If it prompts that something cannot be opened then we need to start the server by “$asterisk start”.
After the installation is done it will display the following command mode:
root@ubuntu:/home/ubuntu# asterisk -vr Asterisk 11.3.0, Copyright (C) 1999 – 2012 Digium, Inc. and others. Created by Mark Spencer <markster@digium.com> Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type ‘core show license’ for details. ========================================================================= Connected to Asterisk 11.3.0 currently running on ubuntu (pid = 847) ubuntu*CLI>
3. Install the 3G dongle driver used on asterisk:
Next we need to make sure that the 3G dongle can access the 3G network. The detailed steps can be found here. There are many different models of 3G dongles out there. Some can only work in data mode. We need one that can do voice communication. In this article we chose is the Huawei E1752.
Now we are going to explain how to install the asterisk driver for 3G dongle. The steps are as follows:
$wget http://кушеев.рф/wp-content/uploads/asterisk-chan-dongle-asterisk11.zip $unzip asterisk-chan-dongle-asterisk11.zip $cd asterisk-chan-dongle-asterisk11 $aclocal $autoconf $automake -a $./configure $make $make install $cp etc/dongle.conf /etc/asterisk
After the installation is done we can do the following test:
1. Detect the physical device:
>dongle show devices
2. Make voice call using the 3G USB dongle:
3. Send SMS using the 3G USB dongle:
The receiving phone will get the sent message. Now the 3G USB dongle and asterisk installation are down.
II. Install freepbx: the voip GUI management
1. Install the dependency files:
$sudo apt-get install -y build-essential linux-headers-`uname -r` openssh-server apache2 mysql-server mysql-client bison flex php5 php5-curl php5-cli php5-mysql php-pear php-db php5-gd curl sox libncurses5-dev libssl-dev libmysqlclient15-dev mpg123 libxml2-dev libnewt-dev sqlite3 libsqlite3-dev pkg-config automake libtool autoconf git subversion
It will warn that the command “linux-headers-`uname -r`” cannot be found. Don’t worry because we are going to solve this issue.
2. Install PearDB:
$sudo pear install db
Here it will display a warning message, “WARNING: “pear/DB” is deprecated in favor of “pear/MDB2″. We can ignore this warning message. After the installation is done, we need reboot.
3. Install iksemel.
$wget https://iksemel.googlecode.com/files/iksemel-1.4.tar.gz $tar xf iksemel-1.4.tar.gz $cd iksemel-1.4 $./configure $make $make install 4. Install DAHDI:
$wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz $tar xvfz dahdi-linux-complete-current.tar.gz $cd dahdi-linux-complete-2.6.1+2.6.1 $make all $make install $make config
During the “make install”, it will say that we did not install the kernel source files. We are going to explain how to solve this issue. The main reason is that the source files of kernel we provided at github do not provide a install package. We just need to place the source files of kernel in the specified location to address this issue. However, the kernel source files is as large as 600MB, and it’s too large to put on the NAND flash (we didn’t use SD card in this case). If you are using images released on 20130531, we can directly copy the source files over.
In order to address the storage area, we can install an NFC server on the host X86 PC, and mount the kernel source files to pcDuino. The detailed steps to install NFC will not be introduced here.
We need to install NFC file mount support on pcDuino by:
sudo apt-get intall nfs-common Then we can mount NFC by using the following commands:
$root@ubuntu:/home/ubuntu# mount -t nfs -o nolock 192.168.3.115:/usr/src/linuxsunxi $/lib/modules/3.4.29+/build/ <img src="http://www.pcduino.com/wp-content/uploads/2013/06/4.png" alt="4.png (712×183)" />
After mounting the file systems, we can begin the build the kernel, which will take around 3 hours. As we need to build uImage, we need to run “$mkimage”. We cannot copy the version of X86 over so we need to build the ARM version on pcDuino and copy it over to the /usr/bin directory.
We need to replace the kernels and corresponding drivers. To replace the drivers we execute “$make modules_install install”, after “$make uImage”. We need to reboot pcDuino after replacing kernels and drivers.
5. Install libpri:
$wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz $tar xvfz libpri-1.4-current.tar.gz $cd libpri-1.4.14 $make $make install 6. Install Asterisk-Extra-Sounds
$cd /var/lib/asterisk/sounds $wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz $tar xfz asterisk-extra-sounds-en-gsm-current.tar.gz $rm asterisk-extra-sounds-en-gsm-current.tar.gz 7. Install freepbx
$export VER_FREEPBX=2.11 $cd /usr/src $svn co http://www.freepbx.org/v2/svn/freepbx/branches/${VER_FREEPBX} freepbx $cd freepbx $adduser asterisk --disabled-password --no-create-home --gecos "Asterisk User" $chown asterisk. /var/run/asterisk $chown -R asterisk. /etc/asterisk $chown -R asterisk. /var/{lib,log,spool}/asterisk $chown -R asterisk. /usr/lib/asterisk $mkdir /var/www/html $chown -R asterisk. /var/www/ $sed -i 's/(^upload_max_filesize = ).*/120M/' /etc/php5/apache2/php.ini $cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig $sed -i 's/^(User|Group).*/1 asterisk/' /etc/apache2/apache2.conf $service apache2 restart Configure the database:
export ASTERISK_DB_PW=amp109 mysqladmin -u root create asterisk mysqladmin -u root create asteriskcdrdb mysql -u root asterisk < SQL/newinstall.sql mysql -u root asteriskcdrdb < SQL/cdr_mysql_table.sql
mysql -u root -e "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';" mysql -u root -e "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';" mysql -u root -e "flush privileges;" Now we begin to install freepbx:
$./start_asterisk start $./install_amp --webroot /var/www/freepbx $amportal a ma installall $amportal a reload $./install_amp --username=asteriskuser --password=$ASTERISK_DB_PW --webroot $/var/www/freepbx $ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3 $amportal start $cd /etc/asterisk $rm ccss.conf confbridge.conf features.conf sip.conf iax.conf logger.conf extensions.conf sip_notify.conf
Now we can open the website on another pc: http://192.168.3.114/admin/config.php, where 192.168.3.114 is the IP address of the pcDuino.
If errors, please check:
A. This is a web page hosted at pcDuino. We can check the status:
$/etc/init.d/apache2 status
B: We can make sure that the root directory is “/var/www/freepbx/”.
The following shows the management interface:
Here the username and password you set may be invalid. We can use username=“admin”, password=“admin” to access:
If you are familiar with freepbx, we should be able to configure all the functions you want.
Leave a Reply
You must be logged in to post a comment.