Jaunty

TRANSLATIONS: there is an ongoing translation to pt-br here: [http://wiki.ubuntu-br.org/VoipNoUbuntu/Servidor]

Here I'll try to put my efforts on installing Asterisk+Dahdi+Freepbx and other confs. A Tutorial and also a script for easy installation.

That already have some improvements i found on the available script here, I am right now working on adapting this script to Karmic.

Script

IMPORTANT! THIS IS THE FIRST VERSION OF THE KARMIC SCRIPT CHECK OUT THE CURRENT SCRIPT (for 10.04) THANKS!

LATEST INSTALLATION SCRIPT FOR KARMIC(Asterisk 1.6.2.2, FreePBX 2.6.0 and Dahdi 2.2.1): http://dudanogueira.com.br/ubuntu/AsteriskOnUbuntuLatest.sh

Here you can get a updated script for Ubuntu 9.10 and german voiceprompts: http://www.power-on.at/VOIP/AsteriskOnUbuntuCurrent_mod_1.5.sh

You can find a modified version of this script for Ubuntu 10.04 and spanish voiceprompts: http://masterline-logistics.com/~alex/AsteriskOnUbuntu.sh

  • you should edit this file and change some variables, such as server IP, mysqlroot pwd, and others
  • After the installation : Go to /etc/asterisk/asterisk.conf and change line astrundir=/var/run/asterisk to astrundir=/var/run.

Steps to take after script

After running the above script, you can setup channels and fine tune your install with the steps below. Be Aware that the steps above may change. Feel free to report issues on the bottom of this page.

Configure Dahdi (Using here a X100P)

I assume that your card has been successfully dected on lspci output, and you will run this commands with root privileges.

  • run: dahdi_genconf -vvvv

  • this will generate a specific /etc/dahdi/system.conf file

  • edit this file, changing loadzone and defaultzone to your country code, like:

  • loadzone = br
  • defaultzone = br
  • run: dahdi_cfg -vvv

  • this should reproduce something like X channels to configure., as X as the number of available channels

  • If this happened, we are good to go!
  • If not, you have some tools, like dahdi_scan, dahdi_hardware, dahdi_test... also, be aware that some cards are "IRQ Sensitive" and may not work well, or even work on some PCI slots!
  • Let's edit /etc/asterisk/chan_dahdi.conf, and assign a specific context to our channel(s)

  • On my case, I only have 1 channel, so the file goes like (NOTE: The configuration above is likely to be different for cards other then the used on this tutorial. Please contribute with other working cases!! ):

[channels]
language=pt_BR
context=from-trunk
signalling=fxs_ks
faxdetect=incoming
usecallerid=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=800
group=0
channel=1
  • restart everything running, as root: /etc/init.d/asterisk restart

  • if everything went fine, you can now run the asterisk CLI, as regular user: sudo asterisk -vvvvvvvvvvvvvvr

  • Ok, you don't need to count the number of v's, but more v means more verbosity Smile :)

The asterisk CLI mode, shows you what happens when your digital PBX place or receives a call. Now is the time you call the line number attached to the line that should be connected to the card. You should see something like:

-- Starting simple switch on 'DAHDI/1-1'
  == Starting DAHDI/1-1 at from-pstn,s,1 failed so falling back to exten 's'
  == Starting DAHDI/1-1 at from-pstn,s,1 still failed so falling back to context 'default'
    -- Hungup 'DAHDI/1-1'
  • NOTE: inside asterisk -vvvvvvvvvvr you can check the status of your channels using: dahdi show status, dahdi show channels and dahdi show channel X, beign X the number of the channel you want to inspect

  • NOTE 2 if you cannot find the dahdi command inside asterisk CLI, it means that asterisk can't reach the dahdi channels. Check your chan_dahdi.conf

Good! Now let's set up the PBX, keep following this amazing tutorial!

Update FreePBX modules

You should have everything almost ready to go! Now let's fine tune FreePBX and add some some local sounds!

  • point your browser to http://server.ip/admin

  • You should see the FreePBX main page, with the green services on the System Status column (hope so!)
  • click on Module Admin

  • click on Check for updates online

  • click on upgrade all

  • click on proccess on the same screen

  • on the next screen, click confirm. The upgrade will begin

  • Then click on return then Apply Configuration Changes finally on Continue with reload

Teach asterisk/freepbx your language

This steps are pt_BR specific (Thanks to Disc-os Team! released under CC!!), but you can find other language sounds on Internet and some asterisk official sounds here: http://downloads.asterisk.org/pub/telephony/sounds/ [en, es, fr only] * NOTE: If you are going to use Disc-os sounds, be aware that you need to set the structure of asterisk directory to the old layout. To do that, change languageprefix = no on /etc/asterisk/asterisk.conf as root, run:

mkdir /usr/src/disc-os
cd /usr/src/disc-os
wget -c http://downloads.sourceforge.net/project/disc-os/Disc-OS%20Sounds/1.0-RELEASE/Disc-OS-Sounds-1.0-pt_BR.tar.gz
tar -xzvf Disc-OS-Sounds-1.0-pt_BR.tar.gz
cp -rf sounds/* /var/lib/asterisk/sounds/
echo "language=pt_BR" >> /etc/asterisk/sip_general_custom.conf
  • Note: It may not have all voices, but... you can also record you own messages!
  • Now let's change the message that freepbx send to you with your voice mail:
  • vim /etc/asterisk/voicemail.conf

  • on the end of the file, put something like:

# NOT WORKING!!! RESEARCH SOLUTION
emailsubject=[PBX] ${VM_MAILBOX} MSG ${VM_MSGNUM}
emailbody=${VM_NAME}\n\n Nova mensagem! ${VM_DUR} DE: ${VM_CALLERID} na sua caixa de mensagens  ${VM_DATE} \n\n
  • Now go again on FreePBX, Module Admin, Check for updates online, then search for: FreePBX Localization Updates, expand this module, cick on download and install, then proccess, the confirm. After upgrade complete, click on return and Apply the confs.

  • You may note that it will not work! It's because you need to set the default charset, on php config. edit: /etc/php5/apache2/php.ini

  • search for default_charset parameter, and change it to: default_charset = "utf8"

Enable mail delivering of voicemail

  • NOTE: You can use msmtp with any smtp server you have access!
  • NOTE2: Asterisk will deliver the messages to the email associated with the extension
  • sudo apt-get install msmtp

  • Create the file configuration:
  • vim /etc/msmtprc

defaults
account asterisk
host smtp.gmail.com
from youruser@gmail.com
tls on
tls_certcheck off
port 587
auth login
user youruser
password yourpasswd
logfile ~/.msmtp.log
account default : asterisk
  • test if msmtp is working, run:

  • echo foo | msmtp youremail@gmail.com

  • Check your mail box!

  • set up asterisk to use msmtp:

  • vim /etc/asterisk/voicemail.conf
  • change mailcmd to:

  • mailcmd=/usr/bin/msmtp -t

Test your environment

On the admin page (http://server.ip/admin), let's create two extensions, 1000 and 1001

  • Go on Extensions > Select "Generic SIP Device" > Submit

  • Add Extension > User Extension: 1000

  • Device Options > secret: 1234

  • Voicemail & Directory > Enabled, VoiceMail Password: 1234, Email Address: youremail@gmail.com, Email Attachment: yes

  • Submit. Repeat the process, but now use 1001 instead of 1000
  • Click on Apply Configuration Changes, then continue with reload

Now, you can register over you sip server using a software like Ekiga or Twinkle (just to name a few, any sip software should work. You can also create IAX extensions), and make calls between the extensions!

Point the channel to a specific extension

  • On FreePBX Admin (http://your.ip/admin), click on Inbound Routes

  • Put a description, anything...
  • On Set Destination, define what to do: Terminate call, Redirect to an extension or directly to voicemail.

SECURITY! locking up your pbx

  • When you get to the FreePBX you will see some alert messages. They say to change the default password of things. Smart advice, right? Let's do it!

FreePBX Password

  • First, let's put Freepbx to handle their AUTH System using the database. You can edit /etc/amportal.conf

  • Search for directive AUTHTYPE and change it to database, like AUTHTYPE=database

  • Enter the FreePbx admin (http://your.server.ip/admin) Go to Administration and change the admin password.

  • Now logoff and login again. Voilá!
  • Note that you can create other administrative users with different permissions set!

Mysql Database Password

  • If you not even changed the password for the asterisk user on the database (directive ASTERISK_DB_PW on the script), it will probably complain.

  • It's just a matter of changing the password for asteriskuser on MYSQL, then changing the directive accordingly in /etc/amportal/conf, on directive AMPDBPASS

  • Note that the user asteriskuser is also defined by the directive AMPDBUSER

Changing Asterisk Manager Password

  • It will also appear as a warning, as you will probably be using the default password [5].
  • Still on the /etc/amportal.conf file, change the directive AMPMGRPASS to the desired password.

  • Now edit /etc/asterisk/manager.conf and change the directive secret under the group [admin]

  • from the Asterisk CLI console (asterisk -r) reload the manager module reload manager to make the changes effective

Setting up a Backup strategy

You can use the Backup/Restore module to backup all files (VoiceMail, System Confs, System Records, CDR, etc) It's as easy as install the module on the admin, the go on Tools, then backup and restore. Once you setup a backup routine, it will be available under /var/lib/asterisk/backups [6]

KNOWN ISSUES / NEED FEATURE

  • on a X100P card, asterisk doesn't detect the hang up, and record all messages, even if the person hang up before the beep. Hints: See [4] for possible solution. It may depend on the line carrier provider.
  • As I am setting up on a regular house, the voicemail should let the call ring more times when no extension are available
  • If your server lives behind a FIREWALL, using dyndns, you'll need some workarounds[3] to be able to access and register on your server a regular internet connection
  • Be aware that the iax2 protocol handles nat problems better then sip protocol! Prefer IAX extensions when using from outside your freepx lan. Remember to edit /etc/asterisk/iax_general_custom.conf and put language=pt_BR if you want to override the extension specific language configuration!

REFERENCES

AsteriskOnUbuntu/Jaunty (last edited 2010-07-24 23:31:37 by 187)