Thursday, June 5, 2014

Chroot Debian for DISA Asterisk 


Howto Debian environment.
Written by Robert Szabo.

Introduction

Very simple way to have Debian (and its thousands of packages). Ch-root is a shell (embedded system within a linux) where you have Debian libraries, packages and the whole deb environment within host.)
You only need to have an USB device attached. 
Use ext2 or ext3 file system to extract files below. (On FAT it will be extracted, but wont work!)

Some words about DisAsterisk

It is a special call back-ish projekt to call cheaper than cheap. 
Mobile call back based on Voip calls, but without Mobile internet.
All credits to InstantWater! 
See original site on github - asterisk-disa-callback 


This page goal to preinstall Debian and Asterisk preconfigured with Disa Call back.

Prerequisites: 

Arm Linux kernel 
have disk space (~300MB) For example USB Pen, or USB HDD attached.
Able to run chroot and mount loop commands on "host"


Why do you need chroot?

If your HW does not have upgrade, or no custom packages are available then Chroot Debian extends your possibilities.


Details


You need to have a Linux Terminal or download PuTTY to log in to your "host" in this case it is a NAS.

ssh root@nas
Mount your USB HDD.  
(see all volumes: fdisk -l)
mount /dev/hda1 /mnt/sda1
cd /mnt/sda1

Download Debian chroot image from Mega, or Google Drive and copy to NAS /mnt/sda1
Extract it.
tar -xjf  chr_debian_Disa140505.tar.bz2

Edit resolv.conf in the Chroot Debian: 
nano /debian/etc/resolv.conf  

mount -o bind /proc/ /debian/proc/
mount -o bind /dev/ /debian/dev/
chroot /debian/

Done. You are in Chroot Debian! :)

(This not your host!, it is inside Debian. (start for example: # mc ) )


Lets start DisAsterisk.

As of today (140606) You only need to edit  the 4 config files based on https://github.com/instantwater/asterisk-disa-callback
Simple isn't it?

cd /etc/asterisk
nano extensions_global.conf 
nano sip_providers.conf
nano sip_registers.conf
nano sip_clients.conf

Start Asterisk

/etc/init.d/asterisk start
asterisk -rvvvvv

Useful commands.
sip show registry
dialplan show
sip show peers


That's all. Done :)






Some more step

Permanent Chroot:

export CHROOTDIR=/usb/sda1/debian mount -t devpts devpts $CHROOTDIR/dev/pts mount -t proc proc $CHROOTDIR/proc mount -o bind /usb/sda1 $CHROOTDIR/mnt/sda2 chroot $CHROOTDIR /etc/init.d/ssh start
Make the file executable
chmod +x /etc/init.d/chroot-ssh-init.sh