Penguin
Note: You are viewing an old revision of this page. View the current version.

I will be adding a walkthrough to setting up a simple asterisk setup with SIP devices as i work out how to do it myself. so this will not make a working system till i have had a few days to complete the documentation

note - most, if not all asterisk config files you need to change should be in /etc/asterisk for

I recommend installing the asterisk sample configuration files, and renaming the ones we are modifying to .conf.old, so rename extensions.conf.old then create a new one as below. this means the asterisk samples are still there to refer to if you want to see more options, and the modules etc should all be setup correctly (we dont change these yet).

The first step is to configure each phone device in the extensions.conf. Each phone device should be assigned to an extension as below

[globals? PHONES1=SIP/2201 PHONES1VM=2201

This means that there will be a SIP channel on extension 2201, and its voicemail will be stored in voicemail box 2201

you can keep going and assigning all your phones into their own extensions by simply increasing the numbers

PHONES2=SIP/2202 PHONES2VM=2202 PHONES3=SIP/2203 PHONESVM=2203

..etc..

;This will create a macro we will use in the dialling plan [macro-vmessage? exten => s,1,VoiceMail2(u${ARG1}) exten => s,2,Playback(groovy) exten => s,3,Playback(goodbye) exten => s,4,Hangup

[home? ; Next, add an extension for voicemail . ; now if we dial 8, we can check voicemail. ; exten => 8,1,VoiceMailMain2 exten => 8,2,Hangup ; Add some more extensions for the two lines . now we'll be able to call one line from the other. ; And if no one answers, it will go to the mailbox for that line. ; ; Line 1 ; exten => 2201,1,Dial(${PHONES1},20,Ttm) exten => 2201,2,Macro(vmessage,${PHONES1VM}) exten => 2201,3,Hangup ; ; Line 2 ; exten => 2202,1,Dial(${PHONES2},20,Ttm) exten => 2202,2,Macro(vmessage,${PHONES2VM}) exten => 2202,3,Hangup ; ; Line 3 ; exten => 2203,1,Dial(${PHONES3},20,Ttm) exten => 2203,2,Macro(vmessage,${PHONES3VM}) exten => 2203,3,Hangup

In sip.conf we want to setup the secrets so each phone can authenticate onto the line we just assigned in extensions.conf

[general? ;We want to configure each of the extensions we setup in extensions.conf like this one below (as a simple base) [2202? type=friend ;Dynamic means you can connect from any IP, you can use host=192.168.1.1 (to limit to that ip) host=dynamic context=home ;note - the PASSWORD below you would put in the password this phone uses to authenticate to the server secret=PASSWORD callerid="Name you want displayed" <2202> mailbox=2202 dtmfmode=rfc2833 nat=0 ;context=home (this means that this unit is setup in the dial plan, which we have yet to setup)

keep adding these sip.conf sections for each SIP unit we are adding to the network.

voicemail is the next section to setup, and just as in the other sections it doesnt take long

As long as we define them here, Asterisk will automatically create mailbox directories (under /var/spool/asterisk/voicemail).

Edit voicemail.conf, again in /etc/asterisk

[general? ; Choose a format to save voicemails as, I use gsm format, it ends up with small files format=gsm ; ; if you set this to yes, the voicemail is attached as a file (so you can play it from your email directly, you may want to turn this off if your email is on another server or limited for space or for various other reasons. ; attach=yes ; ; Each mailbox is listed in the form <mailbox>=<password>,<name>,<email>,<pager_email> ; if the e-mail is specified, a message will be sent when a message is received, to the given mailbox. ; If pager is specified, a message will be sent there as well. ; [home? 2201 => 1234,JON,JON@test.com 2202 => 1234,Name,BOB@test.com,bobs_pager@test.com

Once we are up to here, hopefully (if i havent cut too much out of the samples files as im adding them to the wiki) have a system where we can register sipphones to the asterisk server, and the asterisk server will let you dial from one units extension to the other units extension.. first however we need to start the asterisk server (or reload the configuration if its already running)

if asterisk is not already running, run it now (you may need to be root)

/usr/sbin/asterisk

if it is already running, reconnect to the asterisk server (then issue the reload command)

/usr/sbin/asterisk -r reload

while in asterisk try taking a look at the dialplan (so we can work out how this asterisk thing works Hopefully your dial plan will look something like this (if i havent screwed up)

show dialplan

[ Context 'home' created by 'pbx_config'?

'2201' => 1. Dial(${PHONES1}|20|Ttm) [pbx_config?

2. Macro(vmessage|${PHONES1VM}) [pbx_config? 3. Hangup() [pbx_config?

'2202' => 1. Dial(${PHONES2}|20|Ttm) [pbx_config?

2. Macro(vmessage|${PHONES2VM}) [pbx_config? 3. Hangup() [pbx_config?

'2203' => 1. Dial(${PHONES3}|20|Ttm) [pbx_config?

2. Macro(vmessage|${PHONES3VM}) [pbx_config? 3. Hangup() [pbx_config?

'8' => 1. VoiceMailMain2() [pbx_config?

2. Hangup() [pbx_config?

Include => 'dialout' [pbx_config?

If your dialplan looks something like this now feel free to take whichever sip client you would like, point it to the sip server and see if you can register the client, using 2201 (or whichever extensions you have used), and the secrets you set in sip.conf as your password. If you can register 2 machines, or 2 clients, or if your client lets you setup lets you register different profiles you should be able to register them both, and even ring from one extension to the other. you should also be able to leave voicemail and check the voicemail by dialling the voicemail system on extension 8.