Penguin
Blame: AsteriskSampleSetup
EditPageHistoryDiffInfoLikePages
Annotated edit history of AsteriskSampleSetup version 24, including all changes. View license author blame.
Rev Author # Line
22 ElroyLiddington 1 Note - most, if not all asterisk config files you need to change should be in /etc/asterisk
16 MattBrown 2
3 I recommend installing the asterisk sample configuration files, to achieve this in the asterisk source directory type
4 make samples
22 ElroyLiddington 5 You probably want to rename the ones we are modifying to .conf.old, so rename extensions.conf.old:
16 MattBrown 6 cd /etc/asterisk
7 for i in *; do cp $i $i.old; done
8 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).
9
10 The first step is to configure each phone device in the extensions.conf.
11 Each phone device should be assigned to an extension as below
23 LawrenceDoliveiro 12 <verbatim>
13 [globals]
16 MattBrown 14 PHONES1=SIP/2201
15 PHONES1VM=2201
23 LawrenceDoliveiro 16 </verbatim>
16 MattBrown 17
18 This means that there will be a SIP channel on extension 2201, and its voicemail will be stored in voicemail box 2201
19
20 you can keep going and assigning all your phones into their own extensions by simply increasing the numbers
21
23 LawrenceDoliveiro 22 <verbatim>
16 MattBrown 23 PHONES2=SIP/2202
24 PHONES2VM=2202
25 PHONES3=SIP/2203
20 WileySiler 26 PHONES3VM=2203
16 MattBrown 27
28 ..etc..
29
30 ;This will create a macro we will use in the dialling plan
23 LawrenceDoliveiro 31 [macro-vmessage]
16 MattBrown 32 exten => s,1,VoiceMail2(u${ARG1})
33 exten => s,2,Playback(groovy)
34 exten => s,3,Playback(goodbye)
35 exten => s,4,Hangup
36
20 WileySiler 37 ; ----------------------------------------------%%%
38 ; DEFINE EXTENSIONS%%%
39 ; ----------------------------------------------%%%
23 LawrenceDoliveiro 40 [home]
16 MattBrown 41 ; Next, add an extension for voicemail .
42 ; now if we dial 8, we can check voicemail.
43 ;
44 exten => 8,1,VoiceMailMain2
45 exten => 8,2,Hangup
22 ElroyLiddington 46 ; Add some more extensions for the two lines. Now we'll be able to call one line from the other.
16 MattBrown 47 ; And if no one answers, it will go to the mailbox for that line.
48 ;
49 ; Line 1
50 ;
51 exten => 2201,1,Dial(${PHONES1},20,Ttm)
52 exten => 2201,2,Macro(vmessage,${PHONES1VM})
53 exten => 2201,3,Hangup
54 ;
55 ; Line 2
56 ;
57 exten => 2202,1,Dial(${PHONES2},20,Ttm)
58 exten => 2202,2,Macro(vmessage,${PHONES2VM})
59 exten => 2202,3,Hangup
60 ;
61 ; Line 3
62 ;
63 exten => 2203,1,Dial(${PHONES3},20,Ttm)
64 exten => 2203,2,Macro(vmessage,${PHONES3VM})
65 exten => 2203,3,Hangup
23 LawrenceDoliveiro 66 ; ----------------------------------------------
67 ; END DEFINE EXTENSIONS
68 ; ----------------------------------------------
69 </verbatim>
16 MattBrown 70
20 WileySiler 71 In sip.conf we want to setup the secrets so each phone can authenticate onto the line we just assigned in extensions.conf%%%
72 WS - I find that encapsulating the SIP references with what extension it belongs to useful as well.%%%
73 This makes reading the config file easier for someone who may need to alter it other than yourself%%%
23 LawrenceDoliveiro 74 The same has been added to other parts of this example code.
75 <verbatim>
76 ;------------------------------------------------
77 ; RECEPTIONIST - JULIE - EXT. 2202
78 ; <extension use> - <users name> - <extension number>
79 ;------------------------------------------------
80 [general]
17 KyleCarter 81 ;make sure to add this line, otherwise things dont work as proved by weeks of debugging
82 port=5060
16 MattBrown 83 ;We want to configure each of the extensions we setup in extensions.conf like this one below (as a simple base)
23 LawrenceDoliveiro 84 [2202]
16 MattBrown 85 type=friend
86 ;Dynamic means you can connect from any IP, you can use host=192.168.1.1 (to limit to that ip)
87 host=dynamic
88 context=home
89 ;note - the PASSWORD below you would put in the password this phone uses to authenticate to the server
90 secret=PASSWORD
91 callerid="Name you want displayed" <2202>
92 mailbox=2202
93 dtmfmode=rfc2833
94 nat=0
20 WileySiler 95 ;context=home (this means that this unit is setup in the dial plan, which we have yet to setup)%%%
23 LawrenceDoliveiro 96 ;------------------------------------------------
97 ; END RECEPTIONIST
98 ;------------------------------------------------
99 </verbatim>
16 MattBrown 100 keep adding these sip.conf sections for each SIP unit we are adding to the network.
101
102 voicemail is the next section to setup, and just as in the other sections it doesnt take long
103
104 As long as we define them here, Asterisk will automatically create mailbox directories (under /var/spool/asterisk/voicemail).
105
106 Edit voicemail.conf, again in /etc/asterisk
107
23 LawrenceDoliveiro 108 <verbatim>
109 [general]
16 MattBrown 110 ; Choose a format to save voicemails as, I use gsm format, it ends up with small files
111 format=gsm
112 ;
23 LawrenceDoliveiro 113 ; if you set this to yes, the voicemail is attached as a file (so
114 ; you can play it from your email directly, you may want to turn
115 ; this off if your email is on another server or limited for space
116 ; or for various other reasons.
16 MattBrown 117 ;
118 attach=yes
119 ;
120 ; Each mailbox is listed in the form <mailbox>=<password>,<name>,<email>,<pager_email>
121 ; if the e-mail is specified, a message will be sent when a message is received, to the given mailbox.
122 ; If pager is specified, a message will be sent there as well.
123 ;
23 LawrenceDoliveiro 124 [home]
16 MattBrown 125 2201 => 1234,JON,JON@test.com
126 2202 => 1234,Name,BOB@test.com,bobs_pager@test.com
23 LawrenceDoliveiro 127 </verbatim>
16 MattBrown 128
129 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)
130
131 if asterisk is not already running, run it now (you may need to be root)
132 /usr/sbin/asterisk
133 if it is already running, reconnect to the asterisk server (then issue the reload command)
134 /usr/sbin/asterisk -r
135 reload
136
22 ElroyLiddington 137 while in asterisk try taking a look at the dialplan (so we can work out how this Asterisk thing works
138 Hopefully your dial plan will look something like this (if I haven't screwed up)
16 MattBrown 139
23 LawrenceDoliveiro 140 <verbatim>
141 show dialplan
16 MattBrown 142
23 LawrenceDoliveiro 143 [ Context 'home' created by 'pbx_config' ]
144 '2201' => 1. Dial(${PHONES1}|20|Ttm) [pbx_config]
145 2. Macro(vmessage|${PHONES1VM}) [pbx_config]
146 3. Hangup() [pbx_config]
147 '2202' => 1. Dial(${PHONES2}|20|Ttm) [pbx_config]
148 2. Macro(vmessage|${PHONES2VM}) [pbx_config]
149 3. Hangup() [pbx_config]
150 '2203' => 1. Dial(${PHONES3}|20|Ttm) [pbx_config]
151 2. Macro(vmessage|${PHONES3VM}) [pbx_config]
152 3. Hangup() [pbx_config]
153 '8' => 1. VoiceMailMain2() [pbx_config]
154 2. Hangup() [pbx_config]
155 Include => 'dialout' [pbx_config]
156 </verbatim>
16 MattBrown 157
158
159 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.
160 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.
161 you should also be able to leave voicemail and check the voicemail by dialling the voicemail system on extension 8.
162
163 ----
164
165 !STAGE ONE COMPLETE
22 ElroyLiddington 166 Ensure that you have an internally working system before going onto the next steps.
16 MattBrown 167
168 ----
169
170 !Adding FWD to the callplan and reveiving incoming FWD calls.
171
22 ElroyLiddington 172 To add dialling from and to FreeWorldDialUp, we need to make Asterisk register to the FWD servers with the correct password and username; we also need to make FWD ring the correct phones when Asterisk receives a call from FWD. To do this we need to add the following lines to extensions.conf. This configuration assumes that you also have an extension with the same number as your FWD user ID; if you do not already have this extension you should add it using the templates in the previous section.
16 MattBrown 173
24 LawrenceDoliveiro 174 <verbatim>
16 MattBrown 175 <in globals section>
176 FWDUSERID=<FWDUSERNUMBER>
177 MYNAME=<NAME>
178 MYPHONE=<MYPHONENUMBER>
179
180 <in dialout context>
181 ; If someone dials a "7" in front of their number, send to Free World Dialup
182 include => fwd-forced
183 include =>from-sip
184
185 <in context definition part of config file>
24 LawrenceDoliveiro 186 [fwd-forced]
16 MattBrown 187 ; Check to see if the called number starts with a "7" and
188 ; if so, set the call parameters and bounce the call to the
189 ; Free World Dialup SIP server.
190 ;
191 ; NOTE: Calls to unknown users will result in "invalid extension"
192 ; message being played.
193 ;
194 exten => _7.,1,SetCallerID(${FWDUSERID})
195 exten => _7.,2,SetCIDName(${MYNAME})
196 exten => _7.,3,Dial(SIP/${EXTEN:1}@fwd)
197 exten => _7.,4,Playback(invalid)
198 exten => _7.,5,Hangup
199
24 LawrenceDoliveiro 200 [from-sip]
16 MattBrown 201 ; To receive calls inbound from FWD, we set the extension
202 ; to our FWD user ID, in this case 94896
203 ; Changing the "Dial"
204 ; directive to something like this:
205 ; Dial(${PHONES1}&${PHONES2},15,Ttm)
206 ; would cause both lines to ring
207 ;exten => 94896,1,Dial(${PHONES2}&${PHONES1},15,Ttm)
208 ;exten => 94896,2,Voicemail2(u${PHONES1VM})
209 ;exten => 94896,3,Hangup
210 ;
211 exten => ${FWDUSERID},1,Dial(${PHONES1}&${PHONES2},30,Ttm)
212 exten => ${FWDUSERID},2,Voicemail2(u${PHONES1VM})
213 exten => ${FWDUSERID},3,Hangup
214
215 <in home context of extensions.conf>
216 include => dialout
24 LawrenceDoliveiro 217 </verbatim>
16 MattBrown 218
219 in sip.conf we have to setup the passwords etc for the FWD account this is done as below
220
24 LawrenceDoliveiro 221 <verbatim>
16 MattBrown 222 ; Here we register our FWD phone number so that when someone calls it,
223 ; we'll be able to receive that incoming call over SIP.
224 ;
225 register=<FWDUSERID>:<FWDPASSWORD>@fwd.pulver.com/<FWDUSERID>
226 ;
227 ; Next we set up some more info for FWD . this part is what will
228 ; allow us to make outgoing calls over SIP using FWD.
229 ;
230 [[fwd]
231 type=friend
232 secret=<FWDPASSWORD>
233 username=<FWDUSERID>
234 host=fwd.pulver.com
235 dtmfmode=inband
236 context=home
237 nat=yes
238 canreinvite=no
239 disallow=all
240 allow=all
24 LawrenceDoliveiro 241 </verbatim>
18 CraigMckenna 242
243 AsteriskSipPhoneSetup

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 2 times)