PlugPBX Forums
May 19, 2012, 02:33:45 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3
  Print  
Author Topic: BUILD NOTES - PlugPBX 1.5  (Read 4442 times)
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« on: December 21, 2010, 08:21:05 PM »

As I build PlugPBX 2.0 I'm going to dump what Im doing here - I'll likely use this as a source of documentation. So for now its a brain dump...be warned Wink

Looks like the original FTDI drivers installed on my mac work just fine with the newer SheevaPlug. The driver instance names are slightly different, but not enough to throw a user off.

Installing Latest Debian Squeeze as per Martin Michlmayr's site:

http://www.cyrius.com/debian/kirkwood/sheevaplug/install.html

As always, Martin has done a wicked job of documenting things and providing local copies of the init images. In my case I got things rolling via a tftp share. Cheers to Martin's excellent site. For you DockStar guys, he has installer directions for it as well.

Partitioning as such:

Code:
 ¯       MMC/SD card #1 (mmcblk0) - 4.0 GB SD SDC                  ·       ¯
  ¯       >     #1  primary  226.5 MB  B  f  ext2          /boot    ·       ¯
  ¯       >     #2  primary    3.0 GB     f  ext3          /        ·       ¯
  ¯       >         pri/log  771.8 MB        FREE SPACE             ·       ¯
  ¯                                                              

Yep, there is no swap space. Don't need it. NO more swap. I also am putting in labels and will write /etc/fstab to use them instead of UUID's as they just become a pain in the ass. I also set 'noatime' on both partitions (no access time) so when files accessed inode information will not be updated when file was last accessed, just cutting down on writes to the SD media during bootup until flashybrid kicks in...

Also notice the system will be 3.226 gigs, should fit WELL inside the smallest "4 gig" SD card. Finally I can put that nightmare behind me too. Users can format and partition/use the free space as they wish after the fact.

ODD, the ftp.us.blah blah debian mirror puked, so I flipped over the the UofW mirror. Whatever.

Install going to take awhile, time to go to bed. Will get back into things soon enough again.

Anyone interested in me LEAVING compile tools and sources on the PlugPBX image this time? It'll make it much bigger to download though...

--- Next Steps ---

Start following / tweaking this build process here     http://forums.plugpbx.org/index.php/topic,80.0.html  

I think I'll try this first     http://forums.plugpbx.org/index.php/topic,80.msg573.html#msg573 (thanks xdm and Mattmc97!)


Code:
#!/bin/bash
#
# FreePBX installer for the SheevaPlug Dev Kit


#
# You may need to update the below version numbers from the Asterisk and FreePBX sites to make sure
# the version you prefer is being installed. You may also need to update the download URLs.
#

VER_ASTERISK="1.6.2.9";  #Latest Release with Static URL for script automation, if you change this, you will have to uncomment below.
VER_DAHDI_COMPLETE="2.2.1.2+2.2.1.1"; #Any release past this has a process,  ksoftirqd, which is taking 35-40% CPU time, unfixed bug as of 7/24/10
VER_ADDONS="1.6.2.1";
VER_FREEPBX="2.8.0";

URL_ASTERISK=http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-${VER_ASTERISK}.tar.gz
URL_DAHDI_COMPLETE=http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
URL_ADDONS=http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
URL_FREEPBX=http://mirror.freepbx.org/freepbx-${VER_FREEPBX}.tar.gz

clear
echo "+----------------------------------------------------------------+"
echo "|                                                                |"
echo "|             FreePBX Installer for SheevaPlug Dev Kit           |"
echo "|                                                                |"
echo "|                   originally based on a script by              |"
echo "|               Matt Chipman - matt@corenetworks.com.au          |"
echo "|                                                                |"
echo "+----------------------------------------------------------------+"
echo "          This script will install the following packages:        "
echo "                                                                  "
echo "                Asterisk..........${VER_ASTERISK}                 "
echo "                Dahdi-Complete....${VER_DAHDI_COMPLETE}           "
echo "                Asterisk Addons...${VER_ADDONS}                   "
echo "                FreePBX...........${VER_FREEPBX}                  "
echo "+----------------------------------------------------------------+"
echo "|                    Press <ENTER> to continue                   |"
echo "+----------------------------------------------------------------+"
read

clear
echo "+----------------------------------------------------------------+"
echo "| Setting up passwords...                                        |"
echo "+----------------------------------------------------------------+"

echo
read -p 'Create a MySQL root password: ' MYSQL_PASS
read -p 'Create an Asterisk Manager password: ' ASTMAN_PASS
read -p 'Create an ARI password: ' ARI_PASS


echo "+----------------------------------------------------------------+"
echo "| Running apt-get update and installing dependencies...          |"
echo "+----------------------------------------------------------------+"

echo mysql-server-5.1 mysql-server/root_password password ${MYSQL_PASS} | debconf-set-selections
echo mysql-server-5.1 mysql-server/root_password_again password ${MYSQL_PASS} | debconf-set-selections

apt-get update
apt-get -y install ssh kernel-package g++ libncurses5-dev linux-libc-dev sqlite libnewt-dev libusb-dev zlib1g-dev libmysqlclient-dev libsqlite0-dev php5 mysql-server-5.1 php-pear php5-mysql php-db php5-gd linux-headers-$(uname -r) bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev gcc make mc php5-cli sox


echo "+----------------------------------------------------------------+"
echo "| Downloading and decompressing sources...                       |"
echo "+----------------------------------------------------------------+"

mkdir /tmp/asterisk/
wget -c ${URL_ASTERISK} -O /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz
wget -c ${URL_DAHDI_COMPLETE} -O /tmp/asterisk/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
wget -c ${URL_ADDONS} -O /tmp/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
wget -c ${URL_FREEPBX} -O /tmp/asterisk/freepbx-${VER_FREEPBX}.tar.gz

cd /usr/src/
tar zxvf /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz
tar zxvf /tmp/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
tar zxvf /tmp/asterisk/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
tar zxvf /tmp/asterisk/freepbx-${VER_FREEPBX}.tar.gz


echo "+----------------------------------------------------------------+"
echo "| Compiling Dahdi-linux-complete...                              |"
echo "+----------------------------------------------------------------+"

cd /usr/src/dahdi-linux-complete-${VER_DAHDI_COMPLETE}
make all
make install
make config

mv /etc/dahdi/modules /etc/dahdi/modules.orig
touch /etc/dahdi/modules

service dahdi start


echo "+----------------------------------------------------------------+"
echo "| Compiling Asterisk...                                          |"
echo "+----------------------------------------------------------------+"

cd /usr/src/asterisk-${VER_ASTERISK}
./configure --disable-xmldoc
make
sed -i 's/PROC=armv5tel/PROC=arm/g' /usr/src/asterisk-${VER_ASTERISK}/makeopts
make
make install



echo "+----------------------------------------------------------------+"
echo "| Compiling Asterisk Addons                                      |"
echo "+----------------------------------------------------------------+"

cd /usr/src/asterisk-addons-${VER_ADDONS}
./configure
make
make install


echo "+----------------------------------------------------------------+"
echo "| Creating symlinks (Modules)                                    |"
echo "+----------------------------------------------------------------+"

ln -s /lib/modules/`uname -r`/ /lib/modules/`uname -r`/asterisk
depmod


echo "+----------------------------------------------------------------+"
echo "| Changing PHP Settings for FreePBX...                           |"
echo "+----------------------------------------------------------------+"

cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini-orig
sed -i 's/upload_max_filesize = .*/upload_max_filesize = 20M/g' /etc/php5/apache2/php.ini
sed -i 's/memory_limit = .*/memory_limit = 128M/' /etc/php5/apache2/php.ini
sed -i 's/;suhosin.memory_limit = 0/suhosin.memory_limit = 134217728/' /etc/php5/conf.d/suhosin.ini

echo "+----------------------------------------------------------------+"
echo "| Setting permissions for the asterisk user...                   |"
echo "+----------------------------------------------------------------+"

adduser asterisk --disabled-password --gecos "asterisk PBX" --home /var/lib/asterisk
chown asterisk:asterisk -R /var/www
chown asterisk:asterisk -R /etc/asterisk


echo "+----------------------------------------------------------------+"
echo "| Setting up MySQL for FreePBX...                                |"
echo "+----------------------------------------------------------------+"

echo "create database asteriskcdrdb;" | mysql -u root -p${MYSQL_PASS}
echo "create database asterisk;" | mysql -u root -p${MYSQL_PASS}
echo "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${ASTMAN_PASS}';" | mysql -u root -p${MYSQL_PASS}
echo "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${ASTMAN_PASS}';" | mysql -u root -p${MYSQL_PASS}

mysql -u asteriskuser -p${ASTMAN_PASS} asteriskcdrdb < /usr/src/freepbx-${VER_FREEPBX}/SQL/cdr_mysql_table.sql
mysql -u asteriskuser -p${ASTMAN_PASS} asterisk < /usr/src/freepbx-${VER_FREEPBX}/SQL/newinstall.sql


echo "+----------------------------------------------------------------+"
echo "| Starting asterisk...                                           |"
echo "+----------------------------------------------------------------+"

/usr/sbin/asterisk


echo "+----------------------------------------------------------------+"
echo "| Modifying FreeBBX configuration files...                       |"
echo "+----------------------------------------------------------------+"

cp /usr/src/freepbx-${VER_FREEPBX}/install_amp /usr/src/freepbx-${VER_FREEPBX}/install_amp-orig
sed -i "s/\(^\$webroot*\)\(.*\)/\1 = \"\/var\/www\";/" /usr/src/freepbx-${VER_FREEPBX}/install_amp

LOCAL_IP=`/sbin/ifconfig eth0`
LOCAL_IP=`echo ${LOCAL_IP} | sed -e "s/\ Bcast:\(.*\)//"`
LOCAL_IP=`echo ${LOCAL_IP} | sed -e "s/\(.*\)\ inet addr://"`
sed -i "s/xx.xx.xx.xx/${LOCAL_IP}/g" "/usr/src/freepbx-${VER_FREEPBX}/install_amp"

chmod 755 /usr/src/freepbx-${VER_FREEPBX}/install_amp


echo "+----------------------------------------------------------------+"
echo "| Removing AGI scripts installed by Asterisk...                  |"
echo "+----------------------------------------------------------------+"

rm -f /var/lib/asterisk/agi-bin/*


echo "+----------------------------------------------------------------+"
echo "| Changing run user and group for Apache...                      |"
echo "+----------------------------------------------------------------+"

sed -i "s/APACHE_RUN_USER=www-data/APACHE_RUN_USER=asterisk/g" "/etc/apache2/envvars"
sed -i "s/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=asterisk/g" "/etc/apache2/envvars"


echo "+----------------------------------------------------------------+"
echo "| Running FreePBX install script...                              |"
echo "+----------------------------------------------------------------+"
echo "| Press <ENTER> at each question for the default option          |"
echo "+----------------------------------------------------------------+"
echo "| Press <ENTER> to continue                                      |"
echo "+----------------------------------------------------------------+"

read

cd /usr/src/freepbx-${VER_FREEPBX}/
./install_amp  --username=asteriskuser --password=${ASTMAN_PASS}
./install_amp  --username=asteriskuser --password=${ASTMAN_PASS}
sed -i "s/AMPDBPASS=amp109/AMPDBPASS=${ASTMAN_PASS}/g" "/etc/amportal.conf"
sed -i "s/AMPMGRPASS=amp111/AMPMGRPASS=${ASTMAN_PASS}/g" "/etc/amportal.conf"
sed -i "s/ARI_ADMIN_PASSWORD=ari_password/ARI_ADMIN_PASSWORD=${ARI_PASS}/g" "/etc/amportal.conf"
./apply_conf.sh

echo "+----------------------------------------------------------------+"
echo "| Stoping Asterisk...                                            |"
echo "+----------------------------------------------------------------+"

asterisk -rx "core stop now"
killall -9 safe_asterisk


echo "+----------------------------------------------------------------+"
echo "| Removing Apache2 Redirect...                                   |"
echo "+----------------------------------------------------------------+"

sed -i "s/\(RedirectMatch*\)\(.*\)//" /etc/apache2/sites-enabled/000-default


echo "+----------------------------------------------------------------+"
echo "| Changing permissions...                                        |"
echo "+----------------------------------------------------------------+"

chown -R asterisk:asterisk /etc/asterisk
chmod 770 /etc/asterisk/

chown -R asterisk:asterisk /var/lib/asterisk/
chmod 770 /var/lib/asterisk/

chown -R asterisk:asterisk /var/www/


echo "+----------------------------------------------------------------+"
echo "| Restarting Apache...                                           |"
echo "+----------------------------------------------------------------+"

/usr/sbin/apachectl stop
/usr/sbin/apachectl start


echo "+----------------------------------------------------------------+"
echo "| Copying missing images...                                      |"
echo "+----------------------------------------------------------------+"

cp /var/www/admin/modules/dashboard/images/notify_* /var/www/admin/images/


echo "+----------------------------------------------------------------+"
echo "| Startup script (Asterisk+FreePBX)                              |"
echo "| /etc/init.d/freepbx [start|stop|restart]                       |"
echo "+----------------------------------------------------------------+"

STARTUP_SCRIPT="/etc/init.d/freepbx";
echo "Creating file ${STARTUP_SCRIPT} ...";

echo '#!/bin/bash' > ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'AMPORTAL_BIN=/usr/local/sbin/amportal' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'if [ ! -x ${AMPORTAL_BIN} ]; then'  >> ${STARTUP_SCRIPT}
echo '        echo "error : amportal binary can not be found (${AMPORTAL_BIN})"' >> ${STARTUP_SCRIPT}
echo '        exit 0' >> ${STARTUP_SCRIPT}
echo 'fi' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'start() {' >> ${STARTUP_SCRIPT}
echo ' echo "Starting FreePBX ..."' >> ${STARTUP_SCRIPT}
echo ' ${AMPORTAL_BIN} start'  >> ${STARTUP_SCRIPT}
echo '}' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'stop() {' >> ${STARTUP_SCRIPT}
echo ' echo "Stopping FreePBX ..."' >> ${STARTUP_SCRIPT}
echo ' ${AMPORTAL_BIN} stop'  >> ${STARTUP_SCRIPT}
echo '}' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'case "$1" in' >> ${STARTUP_SCRIPT}
echo '  start)' >> ${STARTUP_SCRIPT}
echo '        start' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  stop)' >> ${STARTUP_SCRIPT}
echo '        stop' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  restart)' >> ${STARTUP_SCRIPT}
echo ' stop' >> ${STARTUP_SCRIPT}
echo '        start' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  *)' >> ${STARTUP_SCRIPT}
echo '        echo $"Usage: $0 {start|stop|restart}"' >> ${STARTUP_SCRIPT}
echo '        exit 1' >> ${STARTUP_SCRIPT}
echo 'esac' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'exit 0' >> ${STARTUP_SCRIPT}
chmod 755 ${STARTUP_SCRIPT}

echo "Update services loading at boot time..."
update-rc.d freepbx defaults

amportal start


echo "+----------------------------------------------------------------+"
echo "| FreePBX installation is finished...                            |"
echo "| For running asterisk+freepbx you must use this command :       |"
echo "| # /etc/init.d/freepbx start                                    |"
echo "+----------------------------------------------------------------+"
echo
echo
echo "OooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooO"
echo "| It is recommended that you reboot before using FreePBX!        |"
echo "OooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooO"
echo
echo "Your PBX is ready to configure, visit: http://${LOCAL_IP}/admin"
echo

I'll likely image my 'fresh' Debian SD card image, so If I really screw it up, I can flash back to the base image before trying again - its always a few attempts to get things perfect hahaha

DAMMIT the installer puked, can't find my platform kernel binary from the UofW mirror *facepalm* ...re-installing.... *sigh*

Ahh so UofW don't mirror arm binaries (bahh!) mirror.kernel.org did... looks like linux-image-2.6.32-5-kirkwood  is the latest in apt squeeze there..thats what's getting installed...

Install / Setup Webmin

Add to /etc/apt/sources.list
Code:
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Add apt key and install
Code:
cd /root
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
apt-get update
apt-get install webmin
« Last Edit: December 22, 2010, 07:20:45 PM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #1 on: December 22, 2010, 06:58:08 PM »

Setup DHCP hostname and persistence fix:

/etc/dhcp3/dhcpclient.conf

Alter line:
#send host-name "andare.fugue.com";
   to
send host-name "PlugPBX";

/etc/network/interfaces

Change this:
allow-hotplug eth0
  to
#allow-hotplug eth0
 
Then add:
auto eth0

This also can fix (written by xdm)
Code:
echo "+----------------------------------------------------------------+"
echo "| Fixing Hotplug issue in Debian...                       |"
echo "+----------------------------------------------------------------+"

sed -i 's/allow-hotplug eth0/#allow-hotplug eth0/' /etc/network/interfaces
sed -i '/#allow-hotplug eth0/aauto eth0' /etc/network/interfaces


This allows SD card to move from sheevaplug to sheevaplug and not be locked to a specific MAC address.

Add Avahai:

apt-get install avahi-daemon

in   /etc/avahi/avahi-daemon.conf

change

#host-name=foo
   to
host-name=PlugPBX

Add the following new files under /etc/avahi/services

apache.service
Code:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">PlugPBX Web Interface</name>
<service>
<type>_http._tcp</type>
<port>80</port>
</service>
</service-group>


ssh.service
Code:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">PlugPBX SSH Server</name>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
</service-group>



« Last Edit: December 22, 2010, 07:22:40 PM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #2 on: December 22, 2010, 07:38:31 PM »

Apache2 and PHP base install:

' Yah its cheating, but dependencies take care of most needed stuff and we like to use phpsysinfo for basic system stats anyways Wink

apt-get install phpsysinfo

... From this point I image the above, then run the mega script of matt/xdm's. Will image this base base setup, then run the mega install script and see what blows up Smiley

Bah, symbolic link never made by debian installer - here is the fix

ln -s /usr/share/phpsysinfo/ /var/www/phpsysinfo

... Decided to upgrade to uboot .27 on the sheevaplug.

I have a base system booting with the following. I've also now 'imaged' this system for safe keeping so I can roll back if i screw up the next stages, so I can speed up my development unlike last time har har.

Apache2/php5
Webmin
Ethernet auto fix
phpsysinfo
sshd
avahi

Here is its partitioning scheme. Nice and simple, no swap, just a boot partition and root partition and we're not using around 700 megs so it should comply with the 'various' sizes of 4 gig media in the market (undershooting)

/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *4.0 GB     disk1
   1:                      Linux                         226.5 MB   disk1s1
   2:                      Linux                         3.0 GB     disk1s2

Next up, install samba ( to broadcast netbios name)...unless I can find something smaller... Then its time to look into asterisk 1.8, freepbx 2.8 (or newer) and then try and run the mega script xdm/mattmc97 wrote (patch and tweak as needed). Woot.

Changed /etc/fstab to the following (removed UUID mounts) - easier for people to understand (will try labels later)

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/mmcblk0p2 during installation
/dev/mmcblk0p2   /               ext3    noatime,errors=remount-ro 0       1
# /boot was on /dev/mmcblk0p1 during installation
/dev/mmcblk0p1   /boot           ext2    noatime         0       2
root@plugpbx:~#

Setup the following SMB configuration

Code:
[global]
log file = /var/log/samba/log.%m
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
include = /etc/samba/dhcp.conf
obey pam restrictions = yes
encrypt passwords = true
passwd program = /usr/bin/passwd %u
passdb backend = tdbsam
dns proxy = no
server string = %h FreePBX Asterisk Server
unix password sync = yes
workgroup = WORKGROUP
os level = 20
syslog = 0
security = share
panic action = /usr/share/samba/panic-action %d
max log size = 1000
pam password change = yes

[Temp Files]
comment = Drop Area to copy files to/from PlugPBX Host  (/tmp in unix system)
writeable = yes
public = yes
path = /tmp

[Logs]
force user = root
guest account = root
comment = FreePBX / Asterisk / Linux Host Logs
public = yes
guest only = yes
path = /var/log/
force group = root

[Hold Music]
force user = asterisk
guest account = asterisk
writeable = yes
public = yes
path = /var/lib/asterisk/mohmp3/
force group = asterisk

[WWW]
guest account = asterisk
force user = asterisk
comment = Web Server Root Directory (Be Careful!)
writeable = yes
public = yes
path = /var/www/
force group = asterisk




« Last Edit: December 23, 2010, 07:42:52 PM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #3 on: December 23, 2010, 05:25:17 PM »

Reminder: Add add-on tools and curl support

Do the following

apt-get install curl
apt-get install libcurl3
apt-get install libcurl3-dev
apt-get install php5-curl
apt-get install php5-mcrypt

# 2

After it finish open php.ini file (mine is at /etc/php5/apache2/php.ini ) and add this command: extension=curl.so
« Last Edit: December 23, 2010, 07:54:31 PM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #4 on: December 23, 2010, 08:07:04 PM »

Attempting to install Asterisk 1.8.1.1 (removed add on scripting, as add-ons and core are in one single install tarball now)....along with FreePBX 2.8

So I'm running the first 'full automagic' installer script based on above with modifications....!  Crossing fingers....

Observations So Far Building from Script (running)

-Must Fix Webmin paths / apt installation. I already have a working script above, just have to modify main script to suit
-Beer really is an important tool
-Daft Punks Tron Legacy Soundtrack kicks total A$$
-So far its worked amazing, its building dahdi currently - I suspect might have to tweak build options for asterisk to ensure add-ons go?
/usr/src/dahdi-linux-complete-2.2.1.2+2.2.1.1/linux/drivers/dahdi/Kbuild:85: CPU Architecture 'arm' does not support VPMADT032 or HPEC. Skipping.
-This are not supported by Dahdi on Sheeva...
  Building modules, stage 2.
/usr/src/dahdi-linux-complete-2.2.1.2+2.2.1.1/linux/drivers/dahdi/Kbuild:85: CPU Architecture 'arm' does not support VPMADT032 or HPEC. Skipping.
  MODPOST 29 modules
- All other dhadi installed including firmware and modules! woot!
-Asterisk compiling...
-I want to have Debians Baby
-ODD   configure: Host CPU : armv5tel   i'd expect we'd just be 'arm' with the hack in the script? Hmmm guess we'll see if it borks
-So Far RAM use is fine with no swap building this stuff. I always loved the sheeva has tons of ram for lazy farts like me
-Wow there is a ton of plugins for Asterisk 1.8 - still building.... *yawn*


Crap

  [CC] src/add.c -> src/add.o
Assembler messages:
Error: unknown architecture `armv5tel'

Error: unrecognized option -march=armv5tel
src/add.c:1: error: bad value (armv5tel) for -march= switch
make[2]: *** [src/add.o] Error 1
make[1]: *** [gsm/lib/libgsm.a] Error 2

not good, blew up on these two,  will have to see what impact there is and look into that cpu flag more.

Its still building, so will keep watching...and see. I suspect might have to re-visit the 'arm' flag value instead of 'armv5tel' flag?

It appears its building every imaginable codec and add-on (minus G729)

I might have to see how mature SQL-Lite is now, it would suit PlugPBX better longer term I see much more hooks for it now and we can drop MySQL?

Crap I don't see cdr_mysql built, will have to look into.... mind you...now i'm really tempted to see where sqlite is at...anyone?

Asterisk completed build and is installing Wink  MUHAHAHAHAHAHAHAHAH

Its downloading the audio files now, generating man pages... etc

Next is FreePBX .... this is promising progress for a first stab.

AND it works Wink

Will have to test with some soft phones. I was able to update online packages in FreePBX 2.8. My intent is to integrate what I did into the script that hasn't been done, and re-test. Once the script can build a naked debian install on Sheeva, then its time for me to eat the dogfood and run this in place of my existing home phone system and see what blows up / happens.

Exciting times. Might have to see if someone can help me get a google voice account to test with (as I live in Canada)

Anyone curious on the build log, you can view the entire thing (saved as a zip, attached to this post)

Bye for now Wink














« Last Edit: December 23, 2010, 10:19:13 PM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #5 on: December 26, 2010, 09:25:31 AM »

Testing epic fail. I suspect the compile erorr about the gsm stuff is to blame. Can't get echo test, speaking clock etc to work with a sip account. Registration worked fine. Will have to examine build scripts for asterisk 1.8 more closely ;(
Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #6 on: December 26, 2010, 10:31:56 PM »

Here is the latest "set it ALL up" draft installer script.

Not fully tested yet, so beware. But sound logic and its all tested in peices, just not together yet.

NOTE: I suspect a cpu flag is not working as it did with pre 1.8 compiles, have to research and test more.

Code:
#!/bin/bash
#
# FreePBX/Asterisk/PlugPBX installer for the SheevaPlug Dev Kit
# Designed for Asterisk 1.8.x and Debian Squeeze/Lenny
#
# http://www.plugpbx.org
# http://forums.plugpbx.org
#
# You may need to update the below version numbers from the Asterisk and FreePBX sites to make sure
# the version you prefer is being installed. You may also need to update the download URLs, so you are best to check these
# first before running that the paths / names will work.


VER_ASTERISK="1.8.1.1";  #Latest Release with Static URL for script automation, if you change this, you will have to uncomment below.
VER_DAHDI_COMPLETE="2.2.1.2+2.2.1.1"; #Any release past this has a process,  ksoftirqd, which is taking 35-40% CPU time, unfixed bug as of 7/24/10
VER_FREEPBX="2.8.0";

URL_ASTERISK=http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-${VER_ASTERISK}.tar.gz
URL_DAHDI_COMPLETE=http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
URL_FREEPBX=http://mirror.freepbx.org/freepbx-${VER_FREEPBX}.tar.gz

#Name of Host / Project Name - Determines system Hostname and Branding
HOST_NAME=PlugPBX

clear
echo "+----------------------------------------------------------------+"
echo "|                                                                |"
echo "|             PlugPBX Installer for SheevaPlug Dev Kit           |"
echo "|                                                                |"
echo "|                   originally based on a script by              |"
echo "|               Matt Chipman - matt@corenetworks.com.au   |"
echo "| contributions from xdm, mattmc97   |"
echo "| Developed for PlugPBX by gregwjacobs@gmail.com   |"
echo "|                                                                |"
echo "+----------------------------------------------------------------+"
echo "  This script will install and configure the following packages:  "
echo "                                                                  "
echo "                Asterisk..........${VER_ASTERISK}                 "
echo "                Dahdi-Complete....${VER_DAHDI_COMPLETE}           "
echo "                FreePBX...........${VER_FREEPBX}                  "
echo "  PHP/Apache2 "
echo "  MySQL "
echo "  WebMin "
echo "  Avahi "
echo "  Samba "
echo "  ssh "
echo "+----------------------------------------------------------------+"
echo "|                    Press <ENTER> to continue                   |"
echo "+----------------------------------------------------------------+"
read

echo "This script will install all the tools and components for a working"
echo "PlugPBX implementation, including configuration changes required"
echo "to Debian Linux itself. Debian Lenny or Squeeze supported on SheevaPlug"
echo
echo "Press *ENTER* to continue..."
echo
echo -e '\a\a\a\a'    # Play Bell Alert
echo "NOTE: NEVER run this script TWICE, one time use only then delete"
echo
echo "Press *ENTER* to start"
read

clear
echo "+----------------------------------------------------------------+"
echo "| Setting up passwords...                                        |"
echo "+----------------------------------------------------------------+"

echo
read -p 'Create a MySQL root password: ' MYSQL_PASS
read -p 'Create an Asterisk Manager password: ' ASTMAN_PASS
read -p 'Create an ARI password: ' ARI_PASS
echo
echo "Write these down, don't forget them..."
echo


echo "+----------------------------------------------------------------+"
echo "| Fixing Hotplug eth0 issue in Debian...                         |"
echo "+----------------------------------------------------------------+"

sed -i 's/allow-hotplug eth0/#allow-hotplug eth0/' /etc/network/interfaces
sed -i '/#allow-hotplug eth0/aauto eth0' /etc/network/interfaces

echo "+----------------------------------------------------------------+"
echo "| Installing WebMin...                                           |"
echo "+----------------------------------------------------------------+"

echo '' >> /etc/apt/sources.list
echo '#Webmin Apt Source' >> /etc/apt/sources.list
echo 'deb http://download.webmin.com/download/repository sarge contrib' >> /etc/apt/sources.list
echo 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' >> /etc/apt/sources.list

cd /tmp
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
rm jcameron-key.asc
apt-get update
apt-get -y install webmin

echo "+----------------------------------------------------------------+"
echo "| Setting DHCP Client to register hostname  ${HOST_NAME}         |"
echo "+----------------------------------------------------------------+"

sed -i 's/#send host-name "andare.fugue.com"/send host-name "${HOST_NAME}"/' /etc/dhcp3/dhcpclient.conf

echo "+----------------------------------------------------------------+"
echo "| Setting up Avahi-Daemon (ZeroConf/Bonjour DNS Services)        |"
echo "+----------------------------------------------------------------+"

apt-get -y install avahi-daemon

echo -e  '<?xml version="1.0" standalone=\047no\047?><!--*-nxml-*-->'   >  /etc/avahi/services/apache.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >>  /etc/avahi/services/apache.service
echo '<service-group>' >>  /etc/avahi/services/apache.service
echo '<name replace-wildcards="yes">${HOST_NAME} Web Interface</name>'  >>  /etc/avahi/services/apache.service
echo '<service>' >>  /etc/avahi/services/apache.service
echo '<type>_http._tcp</type>' >>  /etc/avahi/services/apache.service
echo '<port>80</port>' >>  /etc/avahi/services/apache.service
echo '</service>' >>  /etc/avahi/services/apache.service
echo '</service-group>' >>  /etc/avahi/services/apache.service

echo -e  '<?xml version="1.0" standalone=\047no\047?><!--*-nxml-*-->'   >  /etc/avahi/services/webmin.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >>  /etc/avahi/services/webmin.service
echo '<service-group>' >>  /etc/avahi/services/webmin.service
echo '<name replace-wildcards="yes">${HOST_NAME} Webmin Interface</name>'  >>  /etc/avahi/services/webmin.service
echo '<service>' >>  /etc/avahi/services/webmin.service
echo '<type>_https._tcp</type>' >>  /etc/avahi/services/webmin.service
echo '<port>10000</port>' >>  /etc/avahi/services/webmin.service
echo '</service>' >>  /etc/avahi/services/webmin.service
echo '</service-group>' >>  /etc/avahi/services/webmin.service

echo -e  '<?xml version="1.0" standalone=\047no\047?><!--*-nxml-*-->' >   /etc/avahi/services/ssh.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >>  /etc/avahi/services/ssh.service
echo '<service-group>' >>  /etc/avahi/services/ssh.service
echo '<name replace-wildcards="yes">${HOST_NAME} SSH Server</name>' >>  /etc/avahi/services/ssh.service
echo '<service>' >>  /etc/avahi/services/ssh.service
echo '<type>_ssh._tcp</type>' >>  /etc/avahi/services/ssh.service
echo '<port>22</port>' >>  /etc/avahi/services/ssh.service
echo '</service>' >>  /etc/avahi/services/ssh.service
echo '</service-group>' >>  /etc/avahi/services/ssh.service

sed -i 's/#host-name=foo/host-name=${HOST_NAME}/' /etc/avahi/avahi-daemon.con

echo "+----------------------------------------------------------------+"
echo "| Setting up SAMBA / Windows File share / Netbios Name           |"
echo "+----------------------------------------------------------------+"

apt-get -y  install samba

#Backup the Original Samba Config before we replace with our own customized version
mv /etc/samba/smb.conf /etc/samba/smb.comf.orig


echo '[global]' >  /etc/samba/smb.conf
echo ' log file = /var/log/samba/log.%m' >>  /etc/samba/smb.conf
echo ' passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .' >>  /etc/samba/smb.conf
echo ' include = /etc/samba/dhcp.conf' >>  /etc/samba/smb.conf
echo ' obey pam restrictions = yes' >>  /etc/samba/smb.conf
echo ' encrypt passwords = true' >>  /etc/samba/smb.conf
echo ' passwd program = /usr/bin/passwd %u' >>  /etc/samba/smb.conf
echo ' passdb backend = tdbsam' >>  /etc/samba/smb.conf
echo ' dns proxy = no' >>  /etc/samba/smb.conf
echo ' server string = %h FreePBX Asterisk Server' >>  /etc/samba/smb.conf
echo ' unix password sync = yes' >>  /etc/samba/smb.conf
echo ' workgroup = WORKGROUP' >>  /etc/samba/smb.conf
echo ' os level = 20' >>  /etc/samba/smb.conf
echo ' syslog = 0' >>  /etc/samba/smb.conf
echo ' security = share' >>  /etc/samba/smb.conf
echo ' panic action = /usr/share/samba/panic-action %d' >>  /etc/samba/smb.conf
echo ' max log size = 1000' >>  /etc/samba/smb.conf
echo ' pam password change = yes' >>  /etc/samba/smb.conf
echo ''
echo '[Temp Files]'  >>  /etc/samba/smb.conf
echo ' comment = Drop Area to copy files to/from PlugPBX Host  (/tmp in unix system)'  >>  /etc/samba/smb.conf
echo ' writeable = yes'  >>  /etc/samba/smb.conf
echo ' public = yes'  >>  /etc/samba/smb.conf
echo ' path = /tmp'  >>  /etc/samba/smb.conf
echo ''  >>  /etc/samba/smb.conf
echo '[Logs]'  >>  /etc/samba/smb.conf
echo ' force user = root'  >>  /etc/samba/smb.conf
echo ' guest account = root'  >>  /etc/samba/smb.conf
echo ' comment = FreePBX / Asterisk / Linux Host Logs'  >>  /etc/samba/smb.conf
echo ' public = yes'  >>  /etc/samba/smb.conf
echo ' guest only = yes'  >>  /etc/samba/smb.conf
echo ' path = /var/log/'  >>  /etc/samba/smb.conf
echo ' force group = root'  >>  /etc/samba/smb.conf
echo '' >>  /etc/samba/smb.conf
echo '[Hold Music]'  >>  /etc/samba/smb.conf
echo ' force user = asterisk'  >>  /etc/samba/smb.conf
echo ' guest account = asterisk'  >>  /etc/samba/smb.conf
echo ' writeable = yes'  >>  /etc/samba/smb.conf
echo ' public = yes'  >>  /etc/samba/smb.conf
echo ' path = /var/lib/asterisk/mohmp3/'  >>  /etc/samba/smb.conf
echo ' force group = asterisk'  >>  /etc/samba/smb.conf
echo ''  >>  /etc/samba/smb.conf
echo '[www]'  >>  /etc/samba/smb.conf
echo ' guest account = asterisk'  >>  /etc/samba/smb.conf
echo ' force user = asterisk'  >>  /etc/samba/smb.conf
echo ' comment = Web Server Root Directory (Be Careful!)'  >>  /etc/samba/smb.conf
echo ' writeable = yes'  >>  /etc/samba/smb.conf
echo ' public = yes'  >>  /etc/samba/smb.conf
echo ' path = /var/www/'  >>  /etc/samba/smb.conf
echo ' force group = asterisk'  >>  /etc/samba/smb.conf
echo ''


echo "+----------------------------------------------------------------+"
echo "| Running apt-get update and installing dependencies...          |"
echo "+----------------------------------------------------------------+"

echo mysql-server-5.1 mysql-server/root_password password ${MYSQL_PASS} | debconf-set-selections
echo mysql-server-5.1 mysql-server/root_password_again password ${MYSQL_PASS} | debconf-set-selections
apt-get update
apt-get -y install ssh kernel-package g++ libncurses5-dev linux-libc-dev sqlite libnewt-dev libusb-dev zlib1g-dev libmysqlclient-dev libsqlite0-dev php5 mysql-server-5.1 php-pear php5-mysql php-db php5-gd linux-headers-$(uname -r) bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev gcc make mc php5-cli sox curl libcurl3 libcurl3-dev php5-curl php5-mcrypt


echo "+----------------------------------------------------------------+"
echo "| Downloading and decompressing sources...                       |"
echo "+----------------------------------------------------------------+"

mkdir /tmp/asterisk/
wget -c ${URL_ASTERISK} -O /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz
wget -c ${URL_DAHDI_COMPLETE} -O /tmp/asterisk/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
wget -c ${URL_FREEPBX} -O /tmp/asterisk/freepbx-${VER_FREEPBX}.tar.gz

cd /usr/src/
tar zxvf /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz
tar zxvf /tmp/asterisk/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
tar zxvf /tmp/asterisk/freepbx-${VER_FREEPBX}.tar.gz


echo "+----------------------------------------------------------------+"
echo "| Compiling Dahdi-linux-complete...                              |"
echo "+----------------------------------------------------------------+"

cd /usr/src/dahdi-linux-complete-${VER_DAHDI_COMPLETE}
make all
make install
make config

mv /etc/dahdi/modules /etc/dahdi/modules.orig
touch /etc/dahdi/modules

service dahdi start


echo "+----------------------------------------------------------------+"
echo "| Compiling Asterisk...                                          |"
echo "+----------------------------------------------------------------+"

cd /usr/src/asterisk-${VER_ASTERISK}
./configure --disable-xmldoc
make
sed -i 's/PROC=armv5tel/PROC=arm/g' /usr/src/asterisk-${VER_ASTERISK}/makeopts     #armv5tel seems to break building?
make
make install


echo "+----------------------------------------------------------------+"
echo "| Creating symlinks (Modules)                                    |"
echo "+----------------------------------------------------------------+"

ln -s /lib/modules/`uname -r`/ /lib/modules/`uname -r`/asterisk
depmod


echo "+----------------------------------------------------------------+"
echo "| Changing PHP Settings for FreePBX...                           |"
echo "+----------------------------------------------------------------+"

cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini-orig
sed -i 's/upload_max_filesize = .*/upload_max_filesize = 20M/g' /etc/php5/apache2/php.ini
sed -i 's/memory_limit = .*/memory_limit = 128M/' /etc/php5/apache2/php.ini
sed -i 's/;suhosin.memory_limit = 0/suhosin.memory_limit = 134217728/' /etc/php5/conf.d/suhosin.ini

echo "+----------------------------------------------------------------+"
echo "| Setting permissions for the asterisk user...                   |"
echo "+----------------------------------------------------------------+"

adduser asterisk --disabled-password --gecos "asterisk PBX" --home /var/lib/asterisk
chown asterisk:asterisk -R /var/www
chown asterisk:asterisk -R /etc/asterisk


echo "+----------------------------------------------------------------+"
echo "| Setting up MySQL for FreePBX...                                |"
echo "+----------------------------------------------------------------+"

echo "create database asteriskcdrdb;" | mysql -u root -p${MYSQL_PASS}
echo "create database asterisk;" | mysql -u root -p${MYSQL_PASS}
echo "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${ASTMAN_PASS}';" | mysql -u root -p${MYSQL_PASS}
echo "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${ASTMAN_PASS}';" | mysql -u root -p${MYSQL_PASS}

mysql -u asteriskuser -p${ASTMAN_PASS} asteriskcdrdb < /usr/src/freepbx-${VER_FREEPBX}/SQL/cdr_mysql_table.sql
mysql -u asteriskuser -p${ASTMAN_PASS} asterisk < /usr/src/freepbx-${VER_FREEPBX}/SQL/newinstall.sql


echo "+----------------------------------------------------------------+"
echo "| Starting asterisk...                                           |"
echo "+----------------------------------------------------------------+"

/usr/sbin/asterisk


echo "+----------------------------------------------------------------+"
echo "| Modifying FreeBBX configuration files...                       |"
echo "+----------------------------------------------------------------+"

cp /usr/src/freepbx-${VER_FREEPBX}/install_amp /usr/src/freepbx-${VER_FREEPBX}/install_amp-orig
sed -i "s/\(^\$webroot*\)\(.*\)/\1 = \"\/var\/www\";/" /usr/src/freepbx-${VER_FREEPBX}/install_amp

LOCAL_IP=`/sbin/ifconfig eth0`
LOCAL_IP=`echo ${LOCAL_IP} | sed -e "s/\ Bcast:\(.*\)//"`
LOCAL_IP=`echo ${LOCAL_IP} | sed -e "s/\(.*\)\ inet addr://"`
sed -i "s/xx.xx.xx.xx/${HOST_NAME}/g" "/usr/src/freepbx-${VER_FREEPBX}/install_amp"

chmod 755 /usr/src/freepbx-${VER_FREEPBX}/install_amp


echo "+----------------------------------------------------------------+"
echo "| Removing AGI scripts installed by Asterisk...                  |"
echo "+----------------------------------------------------------------+"

rm -f /var/lib/asterisk/agi-bin/*


echo "+----------------------------------------------------------------+"
echo "| Changing run user and group for Apache...                      |"
echo "+----------------------------------------------------------------+"

sed -i "s/APACHE_RUN_USER=www-data/APACHE_RUN_USER=asterisk/g" "/etc/apache2/envvars"
sed -i "s/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=asterisk/g" "/etc/apache2/envvars"


echo "+----------------------------------------------------------------+"
echo "| Running FreePBX install script...                              |"
echo "+----------------------------------------------------------------+"
echo "| Press <ENTER> at each question for the default option          |"
echo "+----------------------------------------------------------------+"
echo "| Press <ENTER> to continue                                      |"
echo "+----------------------------------------------------------------+"

read

cd /usr/src/freepbx-${VER_FREEPBX}/
./install_amp  --username=asteriskuser --password=${ASTMAN_PASS}
./install_amp  --username=asteriskuser --password=${ASTMAN_PASS}
sed -i "s/AMPDBPASS=amp109/AMPDBPASS=${ASTMAN_PASS}/g" "/etc/amportal.conf"
sed -i "s/AMPMGRPASS=amp111/AMPMGRPASS=${ASTMAN_PASS}/g" "/etc/amportal.conf"
sed -i "s/ARI_ADMIN_PASSWORD=ari_password/ARI_ADMIN_PASSWORD=${ARI_PASS}/g" "/etc/amportal.conf"
./apply_conf.sh

echo "+----------------------------------------------------------------+"
echo "| Stoping Asterisk...                                            |"
echo "+----------------------------------------------------------------+"

asterisk -rx "core stop now"
killall -9 safe_asterisk


echo "+----------------------------------------------------------------+"
echo "| Removing Apache2 Redirect...                                   |"
echo "+----------------------------------------------------------------+"

sed -i "s/\(RedirectMatch*\)\(.*\)//" /etc/apache2/sites-enabled/000-default


echo "+----------------------------------------------------------------+"
echo "| Changing permissions...                                        |"
echo "+----------------------------------------------------------------+"

chown -R asterisk:asterisk /etc/asterisk
chmod 770 /etc/asterisk/

chown -R asterisk:asterisk /var/lib/asterisk/
chmod 770 /var/lib/asterisk/

chown -R asterisk:asterisk /var/www/


echo "+----------------------------------------------------------------+"
echo "| Restarting Apache...                                           |"
echo "+----------------------------------------------------------------+"

/usr/sbin/apachectl stop
/usr/sbin/apachectl start


echo "+----------------------------------------------------------------+"
echo "| Copying missing images...                                      |"
echo "+----------------------------------------------------------------+"

cp /var/www/admin/modules/dashboard/images/notify_* /var/www/admin/images/


echo "+----------------------------------------------------------------+"
echo "| Startup script (Asterisk+FreePBX)                              |"
echo "| /etc/init.d/freepbx [start|stop|restart]                       |"
echo "+----------------------------------------------------------------+"

STARTUP_SCRIPT="/etc/init.d/freepbx";
echo "Creating file ${STARTUP_SCRIPT} ...";

echo '#!/bin/bash' > ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'AMPORTAL_BIN=/usr/local/sbin/amportal' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'if [ ! -x ${AMPORTAL_BIN} ]; then'  >> ${STARTUP_SCRIPT}
echo '        echo "error : amportal binary can not be found (${AMPORTAL_BIN})"' >> ${STARTUP_SCRIPT}
echo '        exit 0' >> ${STARTUP_SCRIPT}
echo 'fi' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'start() {' >> ${STARTUP_SCRIPT}
echo ' echo "Starting FreePBX ..."' >> ${STARTUP_SCRIPT}
echo ' ${AMPORTAL_BIN} start'  >> ${STARTUP_SCRIPT}
echo '}' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'stop() {' >> ${STARTUP_SCRIPT}
echo ' echo "Stopping FreePBX ..."' >> ${STARTUP_SCRIPT}
echo ' ${AMPORTAL_BIN} stop'  >> ${STARTUP_SCRIPT}
echo '}' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'case "$1" in' >> ${STARTUP_SCRIPT}
echo '  start)' >> ${STARTUP_SCRIPT}
echo '        start' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  stop)' >> ${STARTUP_SCRIPT}
echo '        stop' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  restart)' >> ${STARTUP_SCRIPT}
echo ' stop' >> ${STARTUP_SCRIPT}
echo '        start' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  *)' >> ${STARTUP_SCRIPT}
echo '        echo $"Usage: $0 {start|stop|restart}"' >> ${STARTUP_SCRIPT}
echo '        exit 1' >> ${STARTUP_SCRIPT}
echo 'esac' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'exit 0' >> ${STARTUP_SCRIPT}
chmod 755 ${STARTUP_SCRIPT}

echo "Update services loading at boot time..."
update-rc.d freepbx defaults

amportal start


echo "+----------------------------------------------------------------+"
echo "| FreePBX installation is finished...                            |"
echo "| For running asterisk+freepbx you must use this command :       |"
echo "| # /etc/init.d/freepbx start                                    |"
echo "+----------------------------------------------------------------+"
echo
echo
echo "OooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooO"
echo "| It is recommended that you reboot before using this system!    |"
echo "OooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooO"
echo
echo -e '\a\a'    # Play Bell Alert - We're done
echo "Your PBX is ready to configure, visit: http://${LOCAL_IP}/admin"
echo



One this works, I'll add Flashybrid scripting next, so the system will install, configure and 'activate' flashybrid support.
« Last Edit: December 26, 2010, 10:40:11 PM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #7 on: December 28, 2010, 08:21:10 PM »

Ahh.. Hrmm...

Code:
#Experimental, force 'arm' compiling flags to get around issues?
sed -i 's/PROC=armv5tel/PROC=arm/g' /usr/src/asterisk-${VER_ASTERISK}/makeopts     #armv5tel seems to break building?
sed -i 's/HOST_CPU=armv5tel/HOST_CPU=arm/g' /usr/src/asterisk-${VER_ASTERISK}/makeopts     #armv5tel seems to break building?
sed -i 's/BUILD_CPU=armv5tel/BUILD_CPU=arm/g' /usr/src/asterisk-${VER_ASTERISK}/makeopts     #armv5tel seems to break building?

Lets try this trick Wink

Also I'm playing with make menuconfig, seeing what I need to add yet to build other goodies in native. Like Bluetooth channel drivers, so you can use your cell phone as an asterisk trunk Wink

Still playing, stay tuned Wink

PlugPBX 2.0 will earn its new version designation Smiley

hrmm

Code:
   -- Executing [*43@from-internal:3] Playback("SIP/200-00000006", "demo-echotest") in new stack
    -- <SIP/200-00000006> Playing '[font=Verdana][b]demo-echotest.slin'[/b][/font] (language 'en')
  == Spawn extension (from-internal, *43, 3) exited non-zero on 'SIP/200-00000006'


Looks like FreePBX is coded to use the .slin encoded audio, must ensure I install that...doh

Hmmm...

Code:
[Dec 28 23:42:29] ERROR[3029] rtp_engine.c: No RTP engine was found. Do you have one loaded?
[Dec 28 23:42:29] ERROR[3029] chan_sip.c
                                        : Got SDP but have no RTP session allocated.

Other uses reported this on the forums. Some people have this fixed (looking for details)

https://dev.openwrt.org/ticket/8132

Could It be as simple as loading the RTP module in modules.conf?  I know its modular since they support mulitcast RTP and sRTP now as optional components (hence loadable). Mmm.

Ugh.

http://forums.asterisk.org/viewtopic.php?f=1&t=75868&p=149994&hilit=rtp_engine.c%3A+No+RTP+engine+was+found.#p149994

Twinclouds has covered this already online. Anyone get this working??!!!
« Last Edit: December 28, 2010, 10:10:55 PM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #8 on: December 30, 2010, 10:03:52 AM »

Looks like Asterisk 1.8 has two key issues on ARM

-md5sum math/logic broken. This breaks SIP Authentication (can't use passwords)
-RTPEngine does not run correctly

There does not seem to be alot of traction on these issues yet that I can find, so I think PlugPBX 2 will be based on Asterisk 1.6 instead, I won't spend anymore time on 1.8 at this time ;(

If anyone has any details on this, be sure to post.
Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #9 on: January 03, 2011, 11:54:00 AM »

Rolling a PlugPBX v1.5 version, latest FreePBX 2.8, Asterisk 1.6 etc. Looking to add all the add-on goodies, including bluetooth support. Why?
 
My BlackBerry would become a voice trunk when im home. No need to run to answer the cell, its calls roll into the house network of phones like any other, or I can dial a feature code to place calls out via My cell. How cool is that? Smiley

Also fail over, voip line down? meh - cell can pickup the slack (gota setup auto failover forwarded with my voip provider to cover both directions) Slick stuff if it can work. Tinkering now.

I'll also add all the Flashhybrid goodies, and it'll be a single build script, or users can download and flash a disk image. Lots of work ahead, but im tinkering. Lost alot of time chasing asterisk 1.8 - it is a time vampire right now sadly. If someone gets it running on arm smoothly, ping me though!

One tip on building...

Instead of this mess (which works fine but is a mess), and became a multie line mess building asterisk 1.8....

Code:
sed -i 's/PROC=armv5tel/PROC=arm/g' /usr/src/asterisk-${VER_ASTERISK}/makeopts     #armv5tel seems to break building?

we simply do this instead Wink

Code:
./configure --disable-xmldoc --build=arm-gnu-linux

*slaps forehead*

It seems Debian linux returns a more detailed arm cpu detail then the asterisk build scripts care to deal with, well the gsm compile code anyways blows up on it. Meh.

Still playing, still tinkering. I'm also going to have the make menuconfig set in the scripts I provide, encourages people to remove/add what features they want. Going to also play with the 'low memory' compile option as well as the 'potentially' optimized g711 codec. Im also throwing in Speex and a few other codecs. Still seeing what I can tickle out of add-ons now.

Woho. Just got it build, my plug is able to see BT devices via an old DLINK DH-122 USB stick I had around. This guide seems the most accurate below and I've been able to make select the bluetooth add-on now. Looks like I can make all this part of the standard build script.....

http://www.voiptoday.org/index.php?option=com_content&view=article&id=109:installing-and-configuring-chanmobile-for-bluetooth-presence-support-in-asterisk-16

« Last Edit: January 03, 2011, 09:19:58 PM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #10 on: January 03, 2011, 09:24:26 PM »

Latest work in progress (not tested, backup purposes only here)

Code:

#!/bin/bash
#
# FreePBX/Asterisk/PlugPBX installer for the SheevaPlug Dev Kit
# Designed for Asterisk 1.6.x and Debian Squeeze/Lenny
# This Installs / Builds a PlugPBX v1.5 reference system
#
# http://www.plugpbx.org
# http://forums.plugpbx.org
#
# You may need to update the below version numbers from the Asterisk and FreePBX sites to make sure
# the version you prefer is being installed. You may also need to update the download URLs, so you are best to check these
# first before running that the paths / names will work.

VER_ASTERISK="1.6.2.15";  #Latest Release with Static URL for script automation, if you change this, you will have to uncomment below.
VER_DAHDI_COMPLETE="2.2.1.2+2.2.1.1"; #Any release past this has a process,  ksoftirqd, which is taking 35-40% CPU time, unfixed bug as of 7/24/10
VER_ADDONS="1.6.2.2";
VER_FREEPBX="2.8.0";

URL_ASTERISK=http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-${VER_ASTERISK}.tar.gz
URL_DAHDI_COMPLETE=http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
URL_ADDONS=http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
URL_FREEPBX=http://mirror.freepbx.org/freepbx-${VER_FREEPBX}.tar.gz

#Name of Host / Project Name - Determines system Hostname and Branding
HOST_NAME=PlugPBX

clear
echo "+----------------------------------------------------------------+"
echo "|                                                                |"
echo "|             PlugPBX Installer for SheevaPlug Dev Kit           |"
echo "|                                                                |"
echo "|                   originally based on a script by              |"
echo "|               Matt Chipman - matt@corenetworks.com.au   |"
echo "| contributions from xdm, mattmc97   |"
echo "| Developed for PlugPBX by gregwjacobs@gmail.com   |"
echo "|                                                                |"
echo "+----------------------------------------------------------------+"
echo "  This script will install and configure the following packages:  "
echo "                                                                  "
echo "                Asterisk..........${VER_ASTERISK}                 "
echo "                Asterisk Addons...${VER_ADDONS}                   "
echo "                Dahdi-Complete....${VER_DAHDI_COMPLETE}           "
echo "                FreePBX...........${VER_FREEPBX}                  "
echo "  PHP/Apache2 "
echo "  MySQL "
echo "  WebMin "
echo "  Avahi "
echo "  Samba "
echo "  ssh "
echo "  postifx "
echo "+----------------------------------------------------------------+"
echo "|                    Press <ENTER> to continue                   |"
echo "+----------------------------------------------------------------+"
read

echo "This script will install all the tools and components for a working"
echo "PlugPBX implementation, including configuration changes required"
echo "to Debian Linux itself. Debian Lenny or Squeeze supported on SheevaPlug"
echo
echo "Press *ENTER* to continue..."
echo
echo -e '\a\a\a\a'    # Play Bell Alert
echo "NOTE: NEVER run this script TWICE, one time use only then delete"
echo
echo "Press *ENTER* to start"
read

clear
echo "+----------------------------------------------------------------+"
echo "| Setting up passwords...                                        |"
echo "+----------------------------------------------------------------+"

echo
read -p 'Create a MySQL root password: ' MYSQL_PASS
read -p 'Create an Asterisk Manager password: ' ASTMAN_PASS
read -p 'Create an ARI password: ' ARI_PASS
echo
echo "Write these down, don't forget them..."
echo


echo "+----------------------------------------------------------------+"
echo "| Fixing Hotplug eth0 issue in Debian...                         |"
echo "+----------------------------------------------------------------+"

sed -i 's/allow-hotplug eth0/#allow-hotplug eth0/' /etc/network/interfaces
sed -i '/#allow-hotplug eth0/aauto eth0' /etc/network/interfaces

echo "+----------------------------------------------------------------+"
echo "| Installing WebMin...                                           |"
echo "+----------------------------------------------------------------+"

echo '' >> /etc/apt/sources.list
echo '#Webmin Apt Source' >> /etc/apt/sources.list
echo 'deb http://download.webmin.com/download/repository sarge contrib' >> /etc/apt/sources.list
echo 'deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib' >> /etc/apt/sources.list

cd /tmp
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
rm jcameron-key.asc
apt-get update
apt-get -y install webmin

echo "+----------------------------------------------------------------+"
echo "| Setting DHCP Client to register hostname  ${HOST_NAME}         |"
echo "+----------------------------------------------------------------+"

sed -i 's/#send host-name "andare.fugue.com"/send host-name "${HOST_NAME}"/' /etc/dhcp3/dhcpclient.conf

echo "+----------------------------------------------------------------+"
echo "| Setting up Avahi-Daemon (ZeroConf/Bonjour DNS Services)        |"
echo "+----------------------------------------------------------------+"

apt-get -y install avahi-daemon

echo -e  '<?xml version="1.0" standalone=\047no\047?><!--*-nxml-*-->'   >  /etc/avahi/services/apache.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >>  /etc/avahi/services/apache.service
echo '<service-group>' >>  /etc/avahi/services/apache.service
echo '<name replace-wildcards="yes">${HOST_NAME} Web Interface</name>'  >>  /etc/avahi/services/apache.service
echo '<service>' >>  /etc/avahi/services/apache.service
echo '<type>_http._tcp</type>' >>  /etc/avahi/services/apache.service
echo '<port>80</port>' >>  /etc/avahi/services/apache.service
echo '</service>' >>  /etc/avahi/services/apache.service
echo '</service-group>' >>  /etc/avahi/services/apache.service

echo -e  '<?xml version="1.0" standalone=\047no\047?><!--*-nxml-*-->'   >  /etc/avahi/services/webmin.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >>  /etc/avahi/services/webmin.service
echo '<service-group>' >>  /etc/avahi/services/webmin.service
echo '<name replace-wildcards="yes">${HOST_NAME} Webmin Interface</name>'  >>  /etc/avahi/services/webmin.service
echo '<service>' >>  /etc/avahi/services/webmin.service
echo '<type>_https._tcp</type>' >>  /etc/avahi/services/webmin.service
echo '<port>10000</port>' >>  /etc/avahi/services/webmin.service
echo '</service>' >>  /etc/avahi/services/webmin.service
echo '</service-group>' >>  /etc/avahi/services/webmin.service

echo -e  '<?xml version="1.0" standalone=\047no\047?><!--*-nxml-*-->' >   /etc/avahi/services/ssh.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >>  /etc/avahi/services/ssh.service
echo '<service-group>' >>  /etc/avahi/services/ssh.service
echo '<name replace-wildcards="yes">${HOST_NAME} SSH Server</name>' >>  /etc/avahi/services/ssh.service
echo '<service>' >>  /etc/avahi/services/ssh.service
echo '<type>_ssh._tcp</type>' >>  /etc/avahi/services/ssh.service
echo '<port>22</port>' >>  /etc/avahi/services/ssh.service
echo '</service>' >>  /etc/avahi/services/ssh.service
echo '</service-group>' >>  /etc/avahi/services/ssh.service

sed -i 's/#host-name=foo/host-name=${HOST_NAME}/' /etc/avahi/avahi-daemon.conf

echo "+----------------------------------------------------------------+"
echo "| Setting up SAMBA / Windows File share / Netbios Name           |"
echo "+----------------------------------------------------------------+"

apt-get -y  install samba

#Backup the Original Samba Config before we replace with our own customized version
mv /etc/samba/smb.conf /etc/samba/smb.comf.orig

echo '# Generated by PlugPBX Builder/Installer' >  /etc/samba/smb.conf
echo '[global]' >>  /etc/samba/smb.conf
echo ' log file = /var/log/samba/log.%m' >>  /etc/samba/smb.conf
echo ' passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .' >>  /etc/samba/smb.conf
echo ' include = /etc/samba/dhcp.conf' >>  /etc/samba/smb.conf
echo ' obey pam restrictions = yes' >>  /etc/samba/smb.conf
echo ' encrypt passwords = true' >>  /etc/samba/smb.conf
echo ' passwd program = /usr/bin/passwd %u' >>  /etc/samba/smb.conf
echo ' passdb backend = tdbsam' >>  /etc/samba/smb.conf
echo ' dns proxy = no' >>  /etc/samba/smb.conf
echo ' server string = %h FreePBX Asterisk Server' >>  /etc/samba/smb.conf
echo ' unix password sync = yes' >>  /etc/samba/smb.conf
echo ' workgroup = WORKGROUP' >>  /etc/samba/smb.conf
echo ' os level = 20' >>  /etc/samba/smb.conf
echo ' syslog = 0' >>  /etc/samba/smb.conf
echo ' security = share' >>  /etc/samba/smb.conf
echo ' panic action = /usr/share/samba/panic-action %d' >>  /etc/samba/smb.conf
echo ' max log size = 1000' >>  /etc/samba/smb.conf
echo ' pam password change = yes' >>  /etc/samba/smb.conf
echo ''
echo '[Temp Files]'  >>  /etc/samba/smb.conf
echo ' comment = Drop Area to copy files to/from ${HOST_NAME} Host  (/tmp in unix system)'  >>  /etc/samba/smb.conf
echo ' writeable = yes'  >>  /etc/samba/smb.conf
echo ' public = yes'  >>  /etc/samba/smb.conf
echo ' path = /tmp'  >>  /etc/samba/smb.conf
echo ''  >>  /etc/samba/smb.conf
echo '[Logs]'  >>  /etc/samba/smb.conf
echo ' force user = root'  >>  /etc/samba/smb.conf
echo ' guest account = root'  >>  /etc/samba/smb.conf
echo ' comment = FreePBX / Asterisk / Linux Host Logs'  >>  /etc/samba/smb.conf
echo ' public = yes'  >>  /etc/samba/smb.conf
echo ' guest only = yes'  >>  /etc/samba/smb.conf
echo ' path = /var/log/'  >>  /etc/samba/smb.conf
echo ' force group = root'  >>  /etc/samba/smb.conf
echo '' >>  /etc/samba/smb.conf
echo '[Hold Music]'  >>  /etc/samba/smb.conf
echo ' force user = asterisk'  >>  /etc/samba/smb.conf
echo ' guest account = asterisk'  >>  /etc/samba/smb.conf
echo ' writeable = yes'  >>  /etc/samba/smb.conf
echo ' public = yes'  >>  /etc/samba/smb.conf
echo ' path = /var/lib/asterisk/mohmp3/'  >>  /etc/samba/smb.conf
echo ' force group = asterisk'  >>  /etc/samba/smb.conf
echo ''  >>  /etc/samba/smb.conf
echo '[www]'  >>  /etc/samba/smb.conf
echo ' guest account = asterisk'  >>  /etc/samba/smb.conf
echo ' force user = asterisk'  >>  /etc/samba/smb.conf
echo ' comment = Web Server Root Directory (Be Careful!)'  >>  /etc/samba/smb.conf
echo ' writeable = yes'  >>  /etc/samba/smb.conf
echo ' public = yes'  >>  /etc/samba/smb.conf
echo ' path = /var/www/'  >>  /etc/samba/smb.conf
echo ' force group = asterisk'  >>  /etc/samba/smb.conf
echo ''


echo "+----------------------------------------------------------------+"
echo "| Running apt-get update and installing dependencies...          |"
echo "+----------------------------------------------------------------+"

echo mysql-server-5.1 mysql-server/root_password password ${MYSQL_PASS} | debconf-set-selections
echo mysql-server-5.1 mysql-server/root_password_again password ${MYSQL_PASS} | debconf-set-selections
apt-get update
apt-get -y install ssh postfix kernel-package g++ libncurses5-dev linux-libc-dev sqlite libnewt-dev libusb-dev zlib1g-dev libmysqlclient-dev libsqlite0-dev php5 mysql-server-5.1 php-pear php5-mysql php-db php5-gd linux-headers-$(uname -r) bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev gcc make mc php5-cli sox curl libcurl3 libcurl3-dev php5-curl php5-mcrypt


echo "+----------------------------------------------------------------+"
echo "| Downloading and decompressing sources...                       |"
echo "+----------------------------------------------------------------+"

mkdir /tmp/asterisk/
wget -c ${URL_ASTERISK} -O /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz
wget -c ${URL_DAHDI_COMPLETE} -O /tmp/asterisk/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
wget -c ${URL_ADDONS} -O /tmp/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
wget -c ${URL_FREEPBX} -O /tmp/asterisk/freepbx-${VER_FREEPBX}.tar.gz

cd /usr/src/
tar zxvf /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz
tar zxvf /tmp/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
tar zxvf /tmp/asterisk/dahdi-linux-complete-${VER_DAHDI_COMPLETE}.tar.gz
tar zxvf /tmp/asterisk/freepbx-${VER_FREEPBX}.tar.gz


echo "+----------------------------------------------------------------+"
echo "| Compiling Dahdi-linux-complete...                              |"
echo "+----------------------------------------------------------------+"

cd /usr/src/dahdi-linux-complete-${VER_DAHDI_COMPLETE}
make all
make install
make config

mv /etc/dahdi/modules /etc/dahdi/modules.orig
touch /etc/dahdi/modules

service dahdi start


echo "+----------------------------------------------------------------+"
echo "| Installing Asterisk feature dependant components / apps / libs |"
echo "+----------------------------------------------------------------+"


#Asterisk Feature Dependant additions...
apt-get -y install libspandsp.* #Add support for fax applications
apt-get -y install libiksemel* #Add Jabber GTALk/Jingle support in Asterisk
apt-get -y install .*resample.* #Add SLIN re-codec support
apt-get -y install speex libspeex.* #Install SpeeX codec support

#Asterisk Add-Ons - Add required software for Bluetooth Support (channel_bluetooth)
apt-get -y install bluez-utils bluez-hcidump btscanner



echo "+----------------------------------------------------------------+"
echo "| Compiling Asterisk...                                          |"
echo "+----------------------------------------------------------------+"
cd /usr/src/asterisk-${VER_ASTERISK}
./configure --disable-xmldoc --build=arm-gnu-linux     #Disable XML docs output, and set 'arm' as build type
  #as debian returns arm5tel which breaks some building
echo ''
echo -e '\a\a\a\a'    # Play Bell Alert
echo ''
echo "You will be now prompted for what Asterisk options to compile / build. Select as desired"
echo "and then select *Save and Exit* button to continue...
echo ''
echo '*** PRESS ENTER to BEGIN ****'
read
make menuselect
make
make install

echo "+----------------------------------------------------------------+"
echo "| Compiling Asterisk Addons                                      |"
echo "+----------------------------------------------------------------+"

cd /usr/src/asterisk-addons-${VER_ADDONS}
./configure --disable-xmldoc --build=arm-gnu-linux --with-bluetooth
echo -e '\a\a\a\a'    # Play Bell Alert
echo ''
echo "You will be now prompted for what Asterisk Addons to compile / build. Select as desired"
echo "and then select *Save and Exit* button to continue...
echo ''
echo '*** PRESS ENTER to BEGIN ****'
read
make menuselect
make
make install


echo "+----------------------------------------------------------------+"
echo "| Creating symlinks (Modules)                                    |"
echo "+----------------------------------------------------------------+"

ln -s /lib/modules/`uname -r`/ /lib/modules/`uname -r`/asterisk
depmod


echo "+----------------------------------------------------------------+"
echo "| Changing PHP Settings for FreePBX...                           |"
echo "+----------------------------------------------------------------+"

cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini-orig
sed -i 's/upload_max_filesize = .*/upload_max_filesize = 20M/g' /etc/php5/apache2/php.ini
sed -i 's/memory_limit = .*/memory_limit = 128M/' /etc/php5/apache2/php.ini
sed -i 's/;suhosin.memory_limit = 0/suhosin.memory_limit = 134217728/' /etc/php5/conf.d/suhosin.ini

echo "+----------------------------------------------------------------+"
echo "| Setting permissions for the asterisk user...                   |"
echo "+----------------------------------------------------------------+"

adduser asterisk --disabled-password --gecos "asterisk PBX" --home /var/lib/asterisk
chown asterisk:asterisk -R /var/www
chown asterisk:asterisk -R /etc/asterisk


echo "+----------------------------------------------------------------+"
echo "| Setting up MySQL for FreePBX...                                |"
echo "+----------------------------------------------------------------+"

echo "create database asteriskcdrdb;" | mysql -u root -p${MYSQL_PASS}
echo "create database asterisk;" | mysql -u root -p${MYSQL_PASS}
echo "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${ASTMAN_PASS}';" | mysql -u root -p${MYSQL_PASS}
echo "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${ASTMAN_PASS}';" | mysql -u root -p${MYSQL_PASS}

mysql -u asteriskuser -p${ASTMAN_PASS} asteriskcdrdb < /usr/src/freepbx-${VER_FREEPBX}/SQL/cdr_mysql_table.sql
mysql -u asteriskuser -p${ASTMAN_PASS} asterisk < /usr/src/freepbx-${VER_FREEPBX}/SQL/newinstall.sql


echo "+----------------------------------------------------------------+"
echo "| Starting asterisk...                                           |"
echo "+----------------------------------------------------------------+"

/usr/sbin/asterisk


echo "+----------------------------------------------------------------+"
echo "| Modifying FreeBBX configuration files...                       |"
echo "+----------------------------------------------------------------+"

cp /usr/src/freepbx-${VER_FREEPBX}/install_amp /usr/src/freepbx-${VER_FREEPBX}/install_amp-orig
sed -i "s/\(^\$webroot*\)\(.*\)/\1 = \"\/var\/www\";/" /usr/src/freepbx-${VER_FREEPBX}/install_amp

LOCAL_IP=`/sbin/ifconfig eth0`
LOCAL_IP=`echo ${LOCAL_IP} | sed -e "s/\ Bcast:\(.*\)//"`
LOCAL_IP=`echo ${LOCAL_IP} | sed -e "s/\(.*\)\ inet addr://"`
sed -i "s/xx.xx.xx.xx/${HOST_NAME}/g" "/usr/src/freepbx-${VER_FREEPBX}/install_amp"

chmod 755 /usr/src/freepbx-${VER_FREEPBX}/install_amp


echo "+----------------------------------------------------------------+"
echo "| Removing AGI scripts installed by Asterisk...                  |"
echo "+----------------------------------------------------------------+"

rm -f /var/lib/asterisk/agi-bin/*


echo "+----------------------------------------------------------------+"
echo "| Changing run user and group for Apache...                      |"
echo "+----------------------------------------------------------------+"

sed -i "s/APACHE_RUN_USER=www-data/APACHE_RUN_USER=asterisk/g" "/etc/apache2/envvars"
sed -i "s/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=asterisk/g" "/etc/apache2/envvars"


echo "+----------------------------------------------------------------+"
echo "| Running FreePBX install script...                              |"
echo "+----------------------------------------------------------------+"
echo "| Press <ENTER> at each question for the default option          |"
echo "+----------------------------------------------------------------+"
echo "| Press <ENTER> to continue                                      |"
echo "+----------------------------------------------------------------+"

read

cd /usr/src/freepbx-${VER_FREEPBX}/
./install_amp  --username=asteriskuser --password=${ASTMAN_PASS}
./install_amp  --username=asteriskuser --password=${ASTMAN_PASS}
sed -i "s/AMPDBPASS=amp109/AMPDBPASS=${ASTMAN_PASS}/g" "/etc/amportal.conf"
sed -i "s/AMPMGRPASS=amp111/AMPMGRPASS=${ASTMAN_PASS}/g" "/etc/amportal.conf"
sed -i "s/ARI_ADMIN_PASSWORD=ari_password/ARI_ADMIN_PASSWORD=${ARI_PASS}/g" "/etc/amportal.conf"
./apply_conf.sh

echo "+----------------------------------------------------------------+"
echo "| Stoping Asterisk...                                            |"
echo "+----------------------------------------------------------------+"

asterisk -rx "core stop now"
killall -9 safe_asterisk


echo "+----------------------------------------------------------------+"
echo "| Removing Apache2 Redirect...                                   |"
echo "+----------------------------------------------------------------+"

sed -i "s/\(RedirectMatch*\)\(.*\)//" /etc/apache2/sites-enabled/000-default


echo "+----------------------------------------------------------------+"
echo "| Changing permissions...                                        |"
echo "+----------------------------------------------------------------+"

chown -R asterisk:asterisk /etc/asterisk
chmod 770 /etc/asterisk/

chown -R asterisk:asterisk /var/lib/asterisk/
chmod 770 /var/lib/asterisk/

chown -R asterisk:asterisk /var/www/


echo "+----------------------------------------------------------------+"
echo "| Restarting Apache...                                           |"
echo "+----------------------------------------------------------------+"

/usr/sbin/apachectl stop
/usr/sbin/apachectl start


echo "+----------------------------------------------------------------+"
echo "| Copying missing images...                                      |"
echo "+----------------------------------------------------------------+"

cp /var/www/admin/modules/dashboard/images/notify_* /var/www/admin/images/


echo "+----------------------------------------------------------------+"
echo "| Startup script (Asterisk+FreePBX)                              |"
echo "| /etc/init.d/freepbx [start|stop|restart]                       |"
echo "+----------------------------------------------------------------+"

STARTUP_SCRIPT="/etc/init.d/freepbx";
echo "Creating file ${STARTUP_SCRIPT} ...";

echo '#!/bin/bash' > ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'AMPORTAL_BIN=/usr/local/sbin/amportal' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'if [ ! -x ${AMPORTAL_BIN} ]; then'  >> ${STARTUP_SCRIPT}
echo '        echo "error : amportal binary can not be found (${AMPORTAL_BIN})"' >> ${STARTUP_SCRIPT}
echo '        exit 0' >> ${STARTUP_SCRIPT}
echo 'fi' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'start() {' >> ${STARTUP_SCRIPT}
echo ' echo "Starting FreePBX ..."' >> ${STARTUP_SCRIPT}
echo ' ${AMPORTAL_BIN} start'  >> ${STARTUP_SCRIPT}
echo '}' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'stop() {' >> ${STARTUP_SCRIPT}
echo ' echo "Stopping FreePBX ..."' >> ${STARTUP_SCRIPT}
echo ' ${AMPORTAL_BIN} stop'  >> ${STARTUP_SCRIPT}
echo '}' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'case "$1" in' >> ${STARTUP_SCRIPT}
echo '  start)' >> ${STARTUP_SCRIPT}
echo '        start' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  stop)' >> ${STARTUP_SCRIPT}
echo '        stop' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  restart)' >> ${STARTUP_SCRIPT}
echo ' stop' >> ${STARTUP_SCRIPT}
echo '        start' >> ${STARTUP_SCRIPT}
echo '        ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '  *)' >> ${STARTUP_SCRIPT}
echo '        echo $"Usage: $0 {start|stop|restart}"' >> ${STARTUP_SCRIPT}
echo '        exit 1' >> ${STARTUP_SCRIPT}
echo 'esac' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'exit 0' >> ${STARTUP_SCRIPT}
chmod 755 ${STARTUP_SCRIPT}

echo "Update services loading at boot time..."
update-rc.d freepbx defaults

amportal start


echo "+----------------------------------------------------------------+"
echo "| FreePBX installation is finished...                            |"
echo "| For running asterisk+freepbx you must use this command :       |"
echo "| # /etc/init.d/freepbx start                                    |"
echo "+----------------------------------------------------------------+"
echo
echo
echo "OooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooO"
echo "| It is recommended that you reboot before using this system!    |"
echo "OooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooO"
echo
echo -e '\a\a'    # Play Bell Alert - We're done
echo "Your PBX is ready to configure, visit: http://${LOCAL_IP}/admin"
echo

*grins*

This guy up here?

Quote
Starting FreePBX ...

[   22.303600] dahdi_dummy: High Resolution Timer started, good to go
[   22.599305] dahdi: Registered tone zone 0 (United States / North America)
[   23.927107] Bluetooth: L2CAP ver 2.14
[   23.930818] Bluetooth: L2CAP socket layer initialized
[   24.025215] Bluetooth: RFCOMM TTY layer initialized
[   24.040344] Bluetooth: RFCOMM socket layer initialized
[   24.045543] Bluetooth: RFCOMM ver 1.11
[   24.326222] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   24.331619] Bluetooth: BNEP filters: protocol multicast
[   24.386922] Bridge firewalling registered
[   24.609946] Bluetooth: SCO (Voice Link) ver 0.6
[   24.614526] Bluetooth: SCO socket layer initialized

That's right. It looks like I'm a few configure files away from Testing a scratch PlugPBX1.5 test box with bluetooth channel integration.  It lives, answers internal network calls and all that jazz. Looks like we have a winner so far. It means this scripting is working!!!!!  A clean, well documented installation process. It also means dropping in an 'automatic' script as a subset of this that will update a users version of asterisk, dhadi, and add-ons is also easily doable now. PlugPBX moving forward will always include whats required for it to build itself and update itself!

Bah trying to see how bluez has changed since last year, cant get it to be discoverable by my BlackBerry - but once kinks out...wooot Wink

Something new and interesting to try out!
« Last Edit: January 05, 2011, 05:23:53 AM by PlugPBX Admin » Logged

-Greg
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #11 on: January 05, 2011, 07:47:43 PM »

More Bluetooth Debian Kung-Fu Reading..

http://wiki.debian.org/Bluetooth

http://wiki.debian.org/BluetoothUser

woot...
Code:
hciconfig iscan
bluetooth-agent 1234     #accept pin code connection


$*@ This is POORLY documented online. I am so close but asterisk won't see the device as 'connected' but will actively detect it with a scan. I managed to get the BlackBerry paired.

 Something in how bluez is configured remains. hcid.conf is some legacy file but not used anymore, replaced by rfcomm.conf under /etc/bluetooth/ but its poor explained online  ARGHHHHH

Stepping back for awhile, limited time again. For sure this could all be wrapped up into a one-time run shell script, to make the process a little easier for users, thats for damn sure.


« Last Edit: January 05, 2011, 08:55:21 PM by PlugPBX Admin » Logged

-Greg
mattmc97
Administrator
Full Member
*****
Posts: 144


« Reply #12 on: January 06, 2011, 02:55:24 PM »

Greg,

Is your latest script in the post above, a current working beta?

I am finally ready to begin testing with a few more phones.


thanks.

mattmc
Logged
PlugPBX Admin
Administrator
Sr. Member
*****
Posts: 426



« Reply #13 on: January 07, 2011, 05:15:55 AM »

Test it sure, it should work. Its designed to configure a naked system just after installation, and include support for channel_mobile along with every other build feature selectable.

I have yet to add the flashybrid stuff. Thanks.
Logged

-Greg
mattmc97
Administrator
Full Member
*****
Posts: 144


« Reply #14 on: January 10, 2011, 08:13:41 AM »

Got it up and running this weekend.

Two things that are not working.

1. Flash Op Panel  -  

Firefox message "The page isn't redirecting properly  Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

Google Chrome Message:  "This webpage has a redirect loop.  Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects."

2. Hostname does not show up on the network.

It gave an error while the script was running, but I failed to write it down.

FIXED:

Original version in the script above...

sed -i 's/#send host-name "andare.fugue.com"/send host-name "${HOST_NAME}"/' /etc/dhcp3/dhcpclient.conf


Here is the corrected version...

sed -i 's/#send host-name "andare.fugue.com"/send host-name "${HOST_NAME}"/' /etc/dhcp/dhclient.conf


« Last Edit: January 10, 2011, 09:55:38 AM by mattmc97 » Logged
Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Install SimpleMachinesForum web hosting Valid XHTML 1.0! Valid CSS!