Setting up Asterisk @ Home

Print Friendly, PDF & Email

Reminders for setting up an Asterisk @ Home system’, ‘NOTE: Everything listed here has been done on A@H 2.5! I have upgraded to 2.6 and watched a lot of things break. I have installed a fresh 2.6 and a lot of stuff didn\’t work. I have installed 2.8 and a lot of stuff didn\’t work. Personally, I think 2.5 has been the most stable.. and in our case.. everything we need works.

ToC
Old Rollover Method
Proper Rollover Method
Digital Receptionist
Asterisk 2 Asterisk
Inbound Routing to Remote Locations
Voice Mail 2 E-Mail
Setting up Weather
Setting up Backups
Setting up Fax2PDF
Setting up Custom Logos on AMP
Customizing AMP Parameters
Recover your GXP-2000 from a bad firmware update.
Feature Codes

Ok.. Installing from the CD is fairly strait forward, so I won\’t bother walking through that here.. but, I will make some notes:

1) If the setup doesn\’t run through automatically, meaning, you just press enter at the boot prompt, and it does EVERYTHING for you, then it is most likely the hardware won\’t support Asterisk. I say this because I orginally messed around for a few hours on a Laptop prior to realizing that it wasn\’t installing like it should. I was getting prompted to make partitions, etc.. you shouldn\’t receive it.

Ok, so at a top level, you should put the CD in, boot the system and at the boot prompt, just press enter. Now, everything on this system will be wiped out, and CentOS will be installed. When it is complete, it will eject the CD and reboot. Remove the CD from the tray, and after it boots back up, it will auto log in,and setup Asterisk.

Once this is done, you can log in as root (password = password) and it will tell you your IP address. If you want to hard code the IP (as you should), just do a netconfig at the prompt.

Now you can log into using a web browser.

Quick Notes:


Rollover Lines
– Setup ext. 100 on Line 1.
– Setup ext. 200 (no voice mail) on Line 2.

Pick up line 1 and dial *90 and enter 200.

That\’s it.. when a caller dials 100, and you are on the phone, it will forward to line 2. If you do not answer, it will go to voice mail on ext. 100.

This can be used if your phones do not support the incominglimit= and outgoinglimit=


GXP-2000 Method (Works on 2.5, not on others). Also, editing an extension in AMP will remove this setting! See editing AMP Parameters for additional info.

edit sip_additional.conf and add the following:

incominglimit=11
outgoinglimit=11

This allows a GXP-2000 to have 11 (4 on the extension buttons, and 7 up the sides)


Digital Receptionist
– To allow an action without any input, leave the “Dialed Option #” blank or enter “t”, and choose an action. This allows you to play a message, and then route the call to a voice mail box.
– Always make 0 an option to go to an extension. Even if the message doesn\’t mention 0, everyone already knows it\’s supposed to take you to an operator.


Connecting 2 Asterisk Servers behind firewalls with AMP

Now, I could have sworn I had saw a page with this exact heading.. But, now that I am trying to do it, I can\’t find it..

So, here\’s the scene:

Location A:
External IP: 68.x.x.x
Server: 192.168.1.10
Extensions: 100\’s

Location B:
External IP: 24.x.x.x
Server: 10.10.10.30
Extensions: 300\’s

First, open port 4569 on both firewalls and forwarded them to the Asterisk servers at each location.

Location A has:
– Trunks
Outbound Caller ID: local phone number
Maximum Channels: 1

Outgoing Settings:

Trunk Name: LocB-peer
PEER Details:
context=from-internal
host=24.x.x.x (external IP of firewall)
secret=12341234
type=peer
username=LocA-user

USER Context: LocB-user
USER Details:
context=from-internal
host=68.x.x.x (External IP of firewall)
secret=12341234
trunk=yes
type=user

Next, under Outbound Routing:

Route Name: LocB

Dial Patterns:
3xx

Trunk Sequence
– 0 IAX2/LocB-peer

Locatoin B has:
– Trunks
Outbound Caller ID: Local number
Maximum Channels: 1

Outgoing Settings:

Trunk Name: LocA-peer
PEER Details:
context=from-internal
host=68.x.x.x (Again, IP of firewall)
secret=12341234
type=peer
username=LocB-user

Incoming Settings:

USER Context: LocA-user
USER Details:
context=from-internal
host=24.x.x.x (again, firewall IP)
secret=12341234
trunk=yes
type=user

And under Outbound Routing:

Route Name: LocA

Dial Patterns
1xx

Trunk Sequence
– 0 IAX2/LocA-peer


Inbound extensions to remote locations

In this example, we are going to create extension 115 and have it ring a phone at the remote office over the trunk we built above.

Create a custom extension.

Set the display name and outbound CID as you normally would.

dial will look like this:

IAX2/LocB-peer/115

This tells Asterisk to use IAX2, route it accorss trunk \’LocB-peer\’ and to extension 115 there. Of course, the Asterisk PBX at the remote office will need to have an extension 115 defined there, that the phone logs into.

To route it to a cell phone, for example, just create a new extension and set the dial like this:

ZAP/4/5555551212


Sending Voice-Mails to E-Mail

First, our server doesn\’t have a fully qualified domain name, so we need to give it one so the receiveing e-mail server will accept the e-mail from the asterisk server.

Add FQDN to /etc/hosts file. Infront of asterisk1.local. and give the actual IP address:

127.0.0.1 localhost
192.168.0.50 vm.someplace.com asterisk1.local
127.0.0.1 asterisk1

Edit vm_general.inc and change serveremail to vm@FQDN

Using Webmin, edit the sendmail options and you should see “Port=smtp,Addr=127.0.0.1, Name=MTA” listed under SMTP Port options. delete the Addr= section.

Add E-mail to your extension voice mail settings.

Reboot the server.

Call your extension and leave yourself a message.. check your e-maill.


Weather!

vi /var/lib/asterisk/agi-bin/weather.agi

change “city/ny” to “city/il” and the file name to chicago.txt.


Backups

cd /var/lib/asterisk
mkdir backups
chown asterisk.asterisk backups

Log into AMP and add a backup schedule.


Adding Fax ability

log in as root and type “install-pdf”. It will go out and install the needed apps to create pdf files that will be e-mailed to you, containing the incoming faxes. Log into AMP and go to the General Settings section.. Leave the fax extension as SYSTEM and enter an e-mail address.. That\’s it.. your done! (Using digium hardware of course, which we are.)


Editing A@H and AMP logos on web interface.

First, upload your new aah_logo.png (300px wide) and your new amp.png (256px wide) to the server. Next, copy aah_logo.png to /var/www/html (make a backup of the current logo if you like).
Copy amp.png to /var/www/html/admin/images (again, make a backup of the original if you like).

That\’s it!

Since we are in here customizing the interface now.. here is how we remove features on the main screen that we don\’t use.

vi /var/www/html/index.html

Remove or comment out what you don\’t want on the screen.. That\’s it.


Custom AMP Parameters

Ok.. first, go to the AMP directory:

# cd /var/www/html/admin

# grep dtmfmode *

it should return:
devices.php
extensions.php
and a few functions.php

So, let\’s start by editing devices.php and search for dtmfmode.

You should see something like:

                $advanced = array(
                        \'canreinvite\' => \'no\',
                        \'context\' => \'from-internal\',
                        \'host\' => \'dynamic\',
                        \'type\' => \'friend\',
                        \'nat\' => \'never\',
                        \'port\' => \'5060\',
                        \'qualify\' => \'no\',
                        \'callgroup\' => \'\',
                        \'pickupgroup\' => \'\',
                        \'disallow\' => \'\',
                        \'allow\' => \'\',
                        \'dial\' => \'\',
                        \'accountcode\' => \'\',
                        \'mailbox\' => \'\'

Add this someplace in the middle:

                        \'incominglimit\' => \'\',
                        \'outgoinglimit\' => \'\',

Edit extensions.php and search for the same thing. And make the same edits..

Now, edit functions.php and again, seard for dtmfmode. You\’ll find a section that looks like this:

        array($account,\'dtmfmode\',($_REQUEST[\'dtmfmode\'])?$_REQUEST[\'dtmfmode\']:\'\'),
        array($account,\'host\',($_REQUEST[\'host\'])?$_REQUEST[\'host\']:\'dynamic\'),
        array($account,\'type\',($_REQUEST[\'type\'])?$_REQUEST[\'type\']:\'friend\'),
        array($account,\'mailbox\',($_REQUEST[\'mailbox\'])?$_REQUEST[\'mailbox\']:$account.\'@device\'),
        array($account,\'username\',($_REQUEST[\'username\'])?$_REQUEST[\'username\']:$account),
        array($account,\'nat\',($_REQUEST[\'nat\'])?$_REQUEST[\'nat\']:\'never\'),
        array($account,\'port\',($_REQUEST[\'port\'])?$_REQUEST[\'port\']:\'5060\'),
        array($account,\'qualify\',($_REQUEST[\'qualify\'])?$_REQUEST[\'qualify\']:\'no\'),

You just need to add an array like this:

        array($account,\'incominglimit\',($_REQUEST[\'incominglimit\'])?$_REQUEST[\'incominglimit\']:\'\'),
        array($account,\'outgoinglimit\',($_REQUEST[\'outgoinglimit\'])?$_REQUEST[\'outgoinglimit\']:\'\'),

Keep searching, as you will need to do this in at least 2 places..

To verify that it is working, edit an extension and enter \’2\’ for each parameter (or more, if your phone handles them, GXP-2000 can handle 11), and save the changes. Next, go to the config editor (under maintenance) and look at the sip_additional.conf file. The extension you just editied should now show those two parameters as well.


GXP-2000 Firmware Recovery

Not long ago, we came into work and all of our GXP-2000 phones were dead, in the middle of a firmware update. Now, I\’m assuming they were set to do an automatic update (I hope someone learned their lessons as to why you should NEVER let ANYONE auto upgrade ANYTHING, including your computer!!!) as my home unit (with that “feature” turned off) was not affected. Luckily we were able to RMA them to get new ones, but here is a potential way to recover if it happens in the future:

Directly connect the phone to your computer and run ethereal to capture network traffic. Reboot the phone and you should see the phone trying to connect to a TFTP server. It\’ll probably be 168.75.215.188. Next, install a TFTP server on your computer, then set your computer\’s IP address to 168.75.215.188 with a netmask of 1.0.0.0 (because the phone will be on a totally different subnet), drop the boot55.bin and gxp2000.bin files in the tftp directory and restart the phone. It should connect to your machine and successfully update the firmware. If it doesn\’t, then you may have a different problem and hopefully you can get it replaced.


Feature Codes
*411 Directory
*43 Echo Test
*60 Time
*61 Weather
*62 Schedule wakeup call
*65 festival test (your extension is XXX)
*70 Activate Call Waiting (deactivated by default)
*71 Deactivate Call Waiting
*72 Call Forwarding System
*73 Disable Call Forwarding
*77 IVR Recording
*78 Enable Do-Not-Disturb
*79 Disable Do-Not-Disturb
*90 Call Forward on Busy
*91 Disable Call Forward on Busy
*97 Message Center (does no ask for extension)
*98 Enter Message Center
*99 Playback IVR Recording
666 Test Fax
7777 Simulate incoming call

Tested Hardware:

Grandstream GXP-2000
– Personally, My favorite SIP phone for the money. 4 lines, nice big display and it works great with Asterisk. Speaker phone kinda sucks, but I\’ve read/heard that with the “beta” firmware, they fix the major issues. I only tested the “beta” firmware for a little while, and didn\’t really play with the speaker phone (not really much use in my environment). The phone is SUPER easy to setup, the web based interface is SUPER easy to understand, and it works right off the bat.

Linksys/Sipura SPA-941NA (2 Line)
– This is very nice phone as well, and has been said to be close to the best sound quality available for the money.. I don\’t know if I would go that far, but it is a nice phone. One MAJOR problem we are having with it right now, and that is the fact that it interprets * codes. Meaning, you can\’t make changes to the extension in Asterisk using * codes because the phone doesn\’t pass them onto the line. 🙁 This one is also pretty easy to setup, but does have a little more confusing interface.

Polycom SoundPoint IP 301 SIP
– This was a rocky one. The first unit we received kept locking up all the time. Polycom doesn\’t deal with end users, so they don\’t care. We did everything we could to try to get it working and then gave up. Sent it back, and receive a replacment. We haven\’t had a problem with it since, and is now setup as our main phone. This one is a monster to get working. That is, without instructions written by someone besides Polycom. The interface was the most confusing, and the wording is different from the other phones. But, once you get it working (thanks to someone besides Polycom) you are set, and it is also a pretty nice phone.

Grandstream HandyTone 386 ATA
– Nice little Analog Telephone Adapter. It\’s to allow you to connect fax machines/modems/analog phones/etc. to your VoIP system. As with the GXP-2000, the interface is a breeze and the sound quality isn\’t bad either.

Links:

Asterisk@Home
Asterisk Wiki
Webmin
Asterisk4DumbMe

Bunch of good articles, including security.

How to hook to asterisk servers together:
Dual Servers
2 Asterisk

More iax configuration stuff:
IAX Stuff

Off topic, but cool anyway:
Mobile ATA
General Info

Things to do to the firewall:
Firewall Rules

SoftPhone:
X-Line

Hard Phones:
Phone Info
atacomm store

VOIP Providers:
Voice Pulse
BroadVoice

Leave a Reply