Here I'll try to put my efforts on installing Asterisk+Dahdi+Freepbx and other confs. A Recipe and Tips for the Configuration of Asterisk + FreePBX on Ubuntu 10.04



Since 10.04 Version we'll be using Ubuntu packages of the Asterisk stack.

Problems found so far:

  • Voicemail isn't downlodable nor comes on attached email: change vm umask on voicemail.conf
  • Call Monitor doesnt get populated, as the asterisk-mysql is not fine tuned with asterisk, and it refuses to load do avoid instability: checkout this bugs:

first, update and upgrade

apt-get update
apt-get upgrade

then install the core:

apt-get install asterisk sox asterisk-mysql asterisk-mp3 

Steps to take after script to configure ASTERISK

After running the above script/recipe, 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.

  • load the driver (wcfxo for X100P): modprobe wcfxo
  • 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!! ):

  • 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!

Install FreePBX Asterisk Manager

This part is obscure right I (DudaNogueira) was able to install, but after heavy hacks (permissions, and other wierd stuff). Still in progress

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: [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
tar -xzvf Disc-OS-Sounds-1.0-pt_BR.tar.gz
cp -rf sounds/* /usr/share/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:

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"

  • Notice: Changing the language of the FreePBX using the language dialog (top right) will not work. The problem is that FreePBX looks for the locale pt_BR, rather then the default (on Ubuntu) pt_BR.UTF-8 for example. To workaround this, edit /etc/locale.alias, and add a alias to the correct locale (ex, on the end of the file: "pt_BR pt_BR.UTF-8")

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:, 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 suggest to change the default password of things. Smart advice, right? Let's do it!

FreePBX Admin 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!

Locking FreePBX on Apache

Check out here some adivices: []

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]


  • 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!


AsteriskOnUbuntu/Current (last edited 2010-07-31 21:44:44 by 187)