Вы находитесь на странице: 1из 77

Asterisk Advanced Lab Assignment Module 3

Installing Asterisk: Asterisk LibPRI DAHDI Extra Sound

3 !" Installing Asterisk


Module 3 Lab 1 Time Limit: 40 Minutes Welcome to the first Asterisk Advanced ourse lab! The "oal of this lab is to "et Asterisk and its related com#onents installed and $orkin"! This lab is formatted as a ste#-b%-ste# "uide! &ver%thin" %ou need to do to build a $orkin" Asterisk installation is s#elled out in detail! 'e fore$arned: future labs build on #ast labs and the ste#-b%-ste# "uides soon "ive $a% to# some$hat less detailed instructions( $hich ultimatel% "ive $a% to direct challen"es )thou"h $e do al$a%s "ive a solution*! +ote also that this ste#-b%-ste# "uide "ives %ou all of the ste#s re,uired to install Asterisk in the classroom environment on ent-. /!0 Linu0! 1n 2the $ild3 %ou ma% run into ver% different flavors of Linu0: 4ebian( .lack$are( .5.&( 6edora( 5buntu( Lins#ire( and hundreds of others( each $ith their o$n ,uirks! 'e #re#ared to be fle0ible and di" in $hen challen"ed $ith a ne$ Linu0 flavor )or $ith Mac -. 7( '.4 5ni0( .olaris or an% of the multitude of o#eratin" s%stems $hich su##ort Asterisk*! 1n this lab $e $ill: 1! 4o$nload( un#ack install Asterisk and 4A841 from tar archives $ith 4A841 and Asterisk confi"ured to auto-start( 9! .tart Asterisk and confirm that it runs! 3! use Asterisk to "et hel#!

Ste# !: Logging Into $our S%stem


1! 1f %our com#uter is not alread% turned on( turn it on! 9! at the ent-. lo"in $indo$ in the center of the screen( enter the username: root 3! &nter the follo$in" for the #ass$ord: #ass$ord 4! :ou should no$ be in the ;+-M& $indo$ environment!

Ste# &: '(eck De#endencies


1n a terminal $indo$ )A##lications -< Terminal* use %um to check for o#enssl( =lib( =lib-devel( and curl de#endencies! 4on>t $orr% if the versions don>t match %our s%stem e0actl%! The ke% #oint is to make sure %our s%stem has these libraries alread% installed! # yum check-update # yum C list ncurses ncurses-devel openssl zlib zlib-devel curl Setting up repositories Reading repository metadata in from local files Installed Packages curl I!"# $ %& %-' rhel ( installed ncurses i!"# ' (-%! installed ncurses-devel i!"# ' (-%! installed

openssl i#"# zlib i!"# zlib-devel i!"# +vailable Packages curl i!"# openssl i!"# openssl i!"# openssl i#"#

) * $a-(! & % & % &-% & % & % &-% & $ ) ) )

installed installed installed

%& %-" rhel ( base * $a-(! " base * $a-(! " base * $a-(! " base

:ou should alread% have all of the needed #acka"es installed! ):ou ma% also see some u#dated versions of the libraries under 2Available ?acka"es3*!

Ste# 3: Do)nload *(e Source 'ode


This ste# should have been done for %ou as #art of the installation! 1f has not( %ou can do$nload the tarballs from the $eb server at htt#:@@1A9!1BC!1BC!101!1@#ub@ and save them in the @usr@src director%!

Ste# +: ,ntar *(e Source 'ode


1n the terminal $indo$ $here %ou are lo""ed in as root( chan"e directories to

#cd

,usr,src

4etermine the versions of the soft$are %ou have #ls -% 4ocument the versions %ou have! So-t)are asterisk-ibpridahdi-linu.-complete .ersion

&0tract the sources from the tarballs! # tar z.vf libpri-% ( . tar gz # tar z.vf dahdi-linu.-complete-& / tar gz # tar z.vf asterisk-% # . tar gz :ou should no$ have the follo$in" directories: # ls -% asterisk-% # . libpri-% ( . dahdi-linu.-complete-& . Ste# /: 'om#ile *(e 'ode

The order $e $an to com#ile the code is:

1! lib#ri 9! 4A841 3! Asterisk


To com#ile and install lib#ri( do the foll$in" ste#s:

# # # #

cd libpri-1.4.x make clean make install cd..

+e0t( $e>ll com#ile 4A841!

# cd dahdi-linux-complete-2.x # make all


:our s%stem $ill no$ check to see ho$ %our s%stem is confi"ured( and make sure that it can find all the necessar% s%stem libraries to com#ile 4A841! 1t $ill then com#ile the 4A841 drivers and utilities! +o$ $e can install 4A841:

# make install
Last but not least( $e>ll install the initscri#t and sam#le confi"uration files!

# make config # cd..


+o$ that 4A841 has been com#iled and installed( $e>ll com#ile and install Asterisk! The ste#s for Asterisk are sli"htl% more com#licated than the ones for 4A841:

# cd asterisk-1.6.x # ./configure # make menuselect


This $ill brin" u# a menu to allo$ %ou $hich modules to com#ile and $hich other o#tions to set! ?lease enter the 2?'7 Modules3 menu and 4&.&L& T #b0Dael( then enter the 2&0tras .ound ?acka"es3 menu and select 2&7TEA-.-5+4.-&+-;.M3! The #ress 619 to save and e0it! 'e sure to save %our chan"es chan"es!

# make # make install # make samples # make config cd..

0t(is installs a set o- sam#le con-ig -iles1

+ote the ste# that deselects #h0Dael! This module im#lements the Alternate &0tension Lan"ua"e $hich is outside of the sco#e of the 'ootcam#! +ot buildin" the module #revents Asterisk from dis#la%in" unnecessar% $arnin" and error messa"es durin" start-u# and $hen reloadin" e0tension!conf!

After the ne0t ste# of rebootin" %ou should have a runnin" Asterisk s%stemF

Se#t 2: Rebbot
At the Linu0 command #rom#t( t%#e reboot to reboot %our com#uter!

# reboot Se#t 3: .eri-% Installation


1! Lo" back in as root 9! o#en a terminal $indo$ 3! check if 4A841 is loaded:

# ismod / grep dahdi


:ou should see:

dahdi-dummy dahdi

dahdi#dummy$xpp$%ctdm$%cfxo$%ctdm24xxp$%ctellxp$%ctlxxp$%cte12xp$ %ct4xxp crc#ccitt "76! 1 dahdi 4! 1s Asterisk runnin"G :ou can check b% tr%in" to connect to Asterisk!

724 ! 1 4" !

# asterisk &r
:ou should see:
Asterisk 1.6.X, Copyright (C)1999-2008 Digium, In . !n" others. Cre!te" #y $!rk %pen er &m!rkster'"igium. om( Asterisk omes )ith A*%+,-./,0 1+ 2A33A1.04 type 5 ore sho) )!rr!nty6 7or "et!i8s. .his is 7ree so7t)!re, )ith omponents 8i ense" the 91- 9ener!8 :u#8i ,i ense ;ersion 2 !n" other 8i enses4 you )e8 ome to re"istri#ute it un"er ert!in on"itions. .ype 5 ore sho) 8i ense6 7or "et!i8s. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Conne te" to Asterisk 1.6.X urrent8y running on 8o !8host (pi" < XXXX) 8o !8host=C,I(

Ste# 4: Sto# Asterisk


There are several methods %ou can use to sto# Asterisk: 6or no$ t%#e the follo$in" at the L1< #rom#t

'()* stop no%


-r if %ou are in the Asterisk L1 %ou can:

C-I0 stop gracefully

;racefull% shut do$n Asterisk

C-I0 stop no1 C-I0 stop 1hen convenient


6rom the 5+17 #rom#t %ou cam:

.hut do$n Asterisk immediatel% .hut do$n Asterisk at em#t% call volume

# ,etc,rc d,init d,asterisk stop 2r # service asterisk stop Ste# 5: Re"Start Asterisk
Asterisk should have started $hen %ou rebooted the machine! 6rom the command line %ou can start Asterisk $ith:

# asterisk
.ince $e issued the command 2make confi"3 $hen $e com#iled Asterisk( $e can also do:

# /etc/rc.d/init.d/asterisk start +r # ser,ice asterisk start


'ecause of this( Asterisk should start automaticall% after ever% reboot!

Ste# !6: 'onnecting to Asterisk


To connect to Asterisk so %ou can access ommand Line 1nterface ) L1* t%#e:

# asterisk &,,,r Ste# !!: Integrated Asterisk Hel#


At Asterisk>s L1 %ou can ti#e:

'()* help
.hift H?a"e5# and .hiftH?a"e4o$n $ill allo$ %ou to scroll the screen throu"h the list! :ou can dis#la% a shorter list( b% sa%in":

'()* help stop

To dis#la% hel# on 2sto# no$3 t%#e:

'()* help stop no%

6ind out about the a##lications in Asterisk b% issuin" the follo$in" command:

'()* core sho% applications


.ho$ hel# on the dial a##lication

'()* core sho% applications dial


6ind out about functions

'()* core sho% functions


.ho$ the hel# on the L&+ function:

'()* core sho% function (-.


6ind out about the Asterisk ;ate$a% 1nterface )A;1*! #ro"rams to control the Asterisk dial#lan! A;1 allo$s %ou to interface $ith e0ternal

'()* agi sho%


And% %es( the follo$in" $orks to "et hel# on a s#ecific A;1 command:

'()* agi sho% send text Summar%


on"ratulation! 1f %ou have com#leted the #rocess above( %ou have a $orkin" Asterisk s%stem! +o$ the challen"e is to make it do $hat %ou need@$ant! 1n the ne0t section( $e $ill actuall% "et a #hone connected to %our Asterisk s%stem and make a call! :ou Learned: 1! 9! 3! 4! /! B! I! C! 8o$ to "et Asterisk 1!B source code! 8o$ to use the autoconf )confi"ure* s%stem! 8o$ to use the menuselect s%stem to s#ecif% build o#tions! 8o$ to com#ile Asterisk( 4A841( and lib ?E1! 8o$ to install the com#ile com#onents! 8o$ to confi"ure 4A841 and Asterisk to auto-start! 8o$ to manuall% start and sto# Asterisk! 8o$ to "et basic Asterisk hel#!

Asterisk Advanced Lab Assignment Module +


7uilding A 7asic P78 - &0tensions - .1? ?hones - onfi"uration 6iles

+ !" 7uilding A 7asic P78 9it( *)o Extensions


Module + : Lab ! *ime Limit: /6 Minutes

The "oal of this is to create a ver% sim#le ?'7 $ith t$o e0tensions $itch are ca#able of callin" each other! 1n order to do this %ou $ill to do some more e0#lorin" in the Linu0 command shell )also referred to as the J5ni0 ?rom#t>* Eela0! This is another of the ste#-b%-ste# labs )but don>t for"et-tou"her labs are on their $a%*! 1n the ne0t several ste#s %ou $ill not onl% set u# Asterisk to include a ver% basic set of ?'7 services( but %ou $ill also install and activate both a .1? soft-#hone )a Jvirtual> #hone $hich runs on %our Linu0 deskto#* and also a ?ol%com .1? #hone! 1f %ou>ve never done an% kind of net$ork or hard$are installation( #lase ask instructors to "ive %ou a hand! This lab is also the #oint at $hich $e $ill introduce the first t$o of three fictitious users $ho $e $ill be usin" throu"hout the course: Tom .mith and Koe Kones! Tom and Koe are t$o t%#ical ?'7 user! Tom $ill be usin" the 7lite .oft ?hone and $ill be assi"ned e0tension B001! Koe $ill be usin" the ?ol%com #hone and $ill be assi"ned e0tension B009!

Ste# !: Editing $our si# con- ;ile


-#en a terminal $indo$ on %our Linu0 s%stem! To o#en a terminal( click on the 2A##lications3 menu( select 2.%stem Tools3 then 2Terminal3! The terminal $ill start a command shell in %our home director% )@root*! 5se the chan"e director% command -cd to chan"e to the Asterisk confi"uration director%:

# cd /etc/asterisk
5se the Linu0 director% listin" command -1s- to have a look around:

# )s
Linu0 $ill dis#la% a lon" list of files( most of $hich end in 2!conf3! These are the infamous Asterisk confi"uration files! -ver the rest of the course %ou $ill become familiar $ith man% of them! +o$( use %our favorite editor )vi( nano or "edit* to edit the .1? confi"uration file! We>ve taken the librar% of sim#lif%in" several( of the sam#le confi"uration files to #revent confusion )the sam#les document virtuall% ever% feature( function and o#tion related to the module it serves( so me includin" si#!conf are necessaril% ver% com#le0 and difficult to read! ?lease re#lace the su##lied si#!conf b% creatin" an initial si#!conf files as follo$s( or obtain it from %our instructor:
344444444444444444444444444444444444444444444444444444444444444444 3 44 5-26+- S788I95 :2R 8;7 +S87RIS< SIP C;+997- v % # =general> conte.t?default 3 @efault conte.t for incoming calls realm?class digium com 3 Realm for digest authentication bindport?')#) 3 A@P Port to bind bindaddr?) ) ) ) 3 IP address to bind to B) ) ) ) binds to allC srvlookup?yes 3 7nable @9S SRD lookups on outbound calls disallo1?yes 3 :irst disallo1 all codecs allo1?ula1 3 +llo1 codecs in order of preference allo1?gsm language?en 3 @efault language 344444444444444444444444444444444444444444444444444444444444444444 344 R75IS87R S8+87E798S 344444444444444444444444444444444444444444444444444444444444444444 344 :RI79@F AS7RS +9@ P77R 67-2G 8;IS -I97

To add accounts for %our t$o #hones( move %our cursor into the bottom section of the file )belo$ the line that sa%s 26E1&+4.( 5.&E. A+4 ?&&E. '&L-W T81. L1+&!!!3 and add the follo$in":
/ts#xlite0 type 9 friend host 9 dynamic secret9 xlite context9 users /::#polycom0 type 9 friend host 9 dynamic secret9 polycom context9 users 1 23om 4mith5s 6lite 7hone8.

1 2;oe ;one5s 7olycom 7hone8.

<=*E: 1n #lace of the initials of the fictitious users( ?L&A.& use :-5E -W+ initials! 1f ever%one in the class uses the same 2ts3 and 2LL3 initials( it $ill make debu""in" #roblems difficult if one of %our 344444444444444444444444444444444444444444444444444444444444444444 fello$ enters %our com#uter>s address into a #hone instead 3 44students 5-26+S788I95 :2R 8;7 1? +S87RIS< SIP C;+997v of % his! (
=general> conte.t?default 3 @efault conte.t for incoming calls realm?class digium com 3 Realm for digest authentication bindport?')#) 3 A@P Port to bind bindaddr?) ) ) ) 3 IP address to bind to B) ) ) ) binds to allC srvlookup?yes 3 7nable @9S SRD lookups on outbound calls disallo1?yes 3 :irst disallo1 all codecs allo1?ula1 3 +llo1 codecs in order of preference allo1?gsm language?en 3 @efault language 344444444444444444444444444444444444444444444444444444444444444444 344 R75IS87R S8+87E798S 344444444444444444444444444444444444444444444444444444444444444444 344 :RI79@F AS7RS +9@ P77R 67-2G 8;IS -I97

After %ou edit file( it should look like this:


/ts#xlite0 type 9 friend host 9 dynamic secret9 xlite context9 users

1 23om 4mith8.

/::#polycom0 type 9 friend host 9 dynamic secret9 polycom context9 users

1 2;oe ;ones8.

+o$ save the file and e0it the editor!

Ste# &: Reloading Asterisk>s SIP con-iguration


'efore Asterisk $ill reco"ni=e the ne$ .1? accounts( %ou $ill have to reload the .1? confi"uration! To do this( lo" into Asterisk and e0ecute a .1? reload:

# asterisk &r '()* sip reload


heck the confi"uration usin" the si# sho$ #eers command: '()* sip sho% pears .ame/username <ost ::#polycom 2?nspecified ts#xtile 2?nspecified 2 sip peers /2 online$ ! offline0 =yn .at >'( 7ort = ! = ! 4tatus ?nmonitored ?nmonitored

:ou can further check the status usin" the si# sho$ users command:
%%%@'()* sip sho% pears ?sername 4ecret ::#polycom 7olycom ts#xtile xlite = >ccountcode =ef.'ontext >'( users .o users .o .>3 AB'C" 1 AB'C" 1

+o$ that %ou have confirmed that the .1? accounts are loaded( %ou can e0it the L1:
'()* exit

The s%stem $ill load the ne$ .1? confi"uration from the si#!conf file! 1M?-ETA+T +-T&: if %ou make a chan"e to a .1? device $hich is alread% re"istered to Asterisk( the chan"e $ill +-T take #lace until restart Asterisk or until the device un re"isters and the .1? confi"uration is reloaded!

Ste# 3: 'reating *(e Extensions


+o$ that %ou have the .1? accounts created and loaded( %ou need to add e0tensions $hich send calls to the accounts! To do this( %ou need to edit the e0tensions!conf file! To do so( make sure that %our command shell is in the @ etc @ director% and do the follo$in":

# gedit extensions.conf D
?lease remove )or rename* the e0istin" e0tensions!conf file and create a ne$ e0tensions!conf file as follo$s or obtain it from %our instructor:
344444444444444444444444444444444444444444444444444444444444444444 3 44 5797R+-S788I95 :2R 8;7 +S87RIS< SIP C;+997- v % # =general> static?yes 1riteprotect?no autofallthrough?yes clearglobalvars?no priorityHumping?no 344444444444444444444444444444444444444444444444444444444444444444 344 5-26+- D+RI+6-7S =general> 1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1@@ -63-.4)+. '+.3-634 E-(+F <-A/users0

To add %our ne$ e0tensions( #lace %our cursor Lust belo$ the conte0t header =users> and add the e0tensions! :our e0tensions should look like this:
1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 @@ -63-.4)+. '+.3-634 E-(+F <-A/users0 xten 9* 6!!1$1$=ial 24)7/ts#xlite$2!8 xten 9* 6!!2$1$=ial 24)7/::#polycom$2!8

+o$ save %our file and return the command line! -nce a"ain Asterisk re,uires a reload in order to notice the chan"e! To reload the e0tension confi"uration( lo" back into Asterisk and e0ecute an e0tensions reload:

# asterisk &,,,r cli* dialpan reload


To check the resultin" confi"uration( use the dial#lan sho$ command:

cli* dialpan sho% users


Asterisk should res#ond $ith:

/'ontext Gusers5 created by Gpbx#config50 G6!!15 9* 1. =ial24)7/ts#xlite/2!8 /pbx#config0 G6!!25 9* 1. =ial24)7/ts#polycom/2!8 /pbx#config0 -9 2 extensions 22 priorities8 in 1 context. 9'()*
:ou can no$ e0it the L1 $ith the e0it command:

cli* exit Ste# +: 'on-iguring 8"lite


+o$ that Asterisk has a valid confi"uration for both #hones( %ou need to confi"ure the #hones to talk to Asterisk! 1n order to do that( %our need to kno$ the 1? address of %our Asterisk com#uter! To "et the 1? address on a Linu0 machine( use the ifconfi" command:

# ifconfig
eth! (ink encapH -thernet <Faddr !!H -!H 4'H 7'H 64H 27 inet addrH66.2 .144.174 EcastH 66.2 .144.2"" IaskH 2"".2"".2"".! inet6 addrH fe !HH2e!H4cffHfe7cH6427/64 4copeH (ink ?7 EA+>='>43 A?..).J I?(3)'>43 I3?H1"!! IetricH1 A6 packetsH 246K76 7 errorsH! droppedH ! o,errunsH ! frameH! 36 packetsH 66 !62C errorsH! droppedH o o,errunsH ! carrierH! collisionsH! txLueuelenH 1!!! A6 bytesH 1K21!62C 4 21.7 JiE8 36 bytesH "6426" 4K 2"C .1 IiE8 )nterruptH 2!1 Ease addressH !xa!!! (ink encapH (ocal (oopback inet addrH 127.!.!.1 IaskH 22".!.!.! inet6 addrH HH1/12 4copeH <ost ?7 (++7E>'M A?..).J I3?H 164C6 IetricH 1 A6 packetsH "CK""CK errorsH ! droppedH ! o,errunsH ! frameH ! 36 packetsH "CK""CK errorsH ! droppedH ! o,errunsH ! carrierH ! 'ollisionsH ! txLueulenH! A6 bytesH 1C641K K 21.2 JiE8 36 bytesH 1C641K K 21.2 JiE8

lo

+ote the hi"hli"hted value- that>s the com#uter>s 1? address! ):ours $ill( of course( be different* Write do$n %ou>re %our s%stem>s 1? address here: M% 'om#uter>s IP Address: ??????????????????

+o$( %ou need to o#en u# the 7-Lite soft #hone and confi"ure it to connect $ith %our Asterisk! 7-Lite should alread% be installed on %our com#uter>s deskto#! .im#l% o#en the 7ten 7-Lite folder and doubleclick the 7-Lite icon to start the #ro"ram! 7-Lite $ill take %ou throu"h an audio tunin" $i=ard to set u# %our handset )or headset*! 'e sure that %our handset is #lu""ed in and that %ou have adLusted the audio confi"uration on Linu0 to enable the micro#hone and s#eakers! L1+57 A541- -441T:: With a ne$ Linu0 installation %ou $ill have to un-mute the audio devices %ou $ish to useF To do this( ri"ht-click on the audio icon in the u##er-ri"ht-hand corner of the screen and select 2.ound .ettin"3! When the sound mi0er a##lication o#ens( un-mute and adLust %our audio controls as necessar%! +ote that different audio confi"urations $ill have dramaticall% different sound control #anels( and %ou ma% need to e0#eriment! -nce the Audio Tunin" Wi=ard is com#lete( 7-Lite $ill dis#la% the #hone a##lication and check local net$ork conditions! 1t should automaticall% o#en the confi"uration menu and allo$ %ou to confi"ure %our .1? account! 1f not( click on the menu button as sho$n belo$! 5se the follo$in" settin": &nabled: 4is#la% +ame: 5sarname Authori=ation 5ser: ?ass$ord: 4omain@Eealm: .1? ?ro0% -utbound ?ro0% :es )click to set* Tom .mith tsD0lite tsD0lite 0lite class!di"ium!com M%our 1?N M%our 1?N

+o$ click the menu button on the #hone a"ain to close the menu! 7-Lite $ill save the settin"s and attem#t re"ister $ith %our Asterisk! 1f it encounters #roblems )lo"in failure( etc!* it $ill #o# the confi"uration $indo$ o#en a"ain( allo$in" %ou to make chan"es! ;IRS* '=ME SER.E: When an a##lication that uses the T ?@1? net$ork services on %our com#uter starts u#( it ma% attem#t to o#e a #articular T ?@1? #ort to listen for incomin" connections! 1f that #ort is alread% in use( the o#eratin" s%stem $ill den% the a##lication access! 1n the case of 7-Lite( this is a factor as both Asterisk and 7-Lite attem#t to use the .1? #ort )/0B0*! 1f Asterisk starts first( this is not a #roblem: 7-Lite sim#l% takes the ne0t #ort )/0B1*! 8o$ever( if %ou start Asterisk A.T&E 7-Lite( thin"s Lust $on>t $ork: 7-Lite $ill have o#ened /0B0 and Asterisk $ill not be able to load the .1? channel! To #revent this from ever ha##enin"( navi"ate to the +et$ork .ettin"s o#tion under .%stem .ettin" and chan"e the Listen .1? ?ort to somethin" different( like /0I0! That $a% if %ou accidentall% start 7-Lite first( it $on>t steal the critical .1? #ort! 1f %ou have brou"ht a la#to# to class( it ma% be much easier to run 7-Lite on %our la#to# rather than on %our Linu0 s%stem! -r( if %ou have bro"th a Wi6i .1? #hone $ith %ou( ma% $ish to confi"ure it in #lace of the 7-Lite #hone!

Ste# /: 'on-iguring t(e Pol%com Sound#oint P(one

-nce %ou have the ?ol%com #hone un#acked and installed on %our deskto#( #lu" in the #o$er and "ive it rou"hl% three minutes to com#lete its initial boot c%cle! -nce the #hone is active %ou $ill need to use the on-screen menu s%stem to retrieve its 1? address! ?ress 9 to access the 2.tatus3 menu! ?rees 9 a"ain to access the 2+et$ork3 menu! ?ress 1 to access the 2T ?@1? ?arameters3 list! The #hone>s 1? address is listed as 21?3 and is the first item in the list of net$ork values! Write do$n %our #hone>s 1? address belo$: M% P(one>s IP Address: ???????????????????????? +o$ $e need to access the #hone $ith the bro$ser! To do so( o#en %our bro$ser )%ou can launch it from the 21nternet3 o#tions of the 2A##lication3 menu or b% the "lobe icon on the task bar*! 'ro$se to %our #hone>s administration #a"e b% t%#in" the follo$in" in the bro$ser>s address $indo$: htt#:@@19!1BC!101!777 MEe#lace 777 $ith the last octet of the #hone>s 1? addressN

ima"en

To chan"e the settin" for the #hone( click the 2Lines3 link in the menu! 1f the #hone has securit% enabled it $ill challen"e %ou for a user name #ass$ord! 5se the defaults: ,sername: Pass)ord: Pol%com +/2

The s%stem $ill then dis#la% the full confi"uration menu! +o$ $e $ill need to set u# the #hone>s account and make a fe$ other minor t$eaks! *9= LI<ES@ The ?ol%com ?hone is considered a t$o-line #hone! 1n realit%( .1? #hones don>t conform to the traditional conce#t of 2Lines3! The #hone actuall% su##orts t$o 2call a##earances3 usin" the t$o buttons and L&4 #airs on the ri"h-hand side of the dis#la%! The a##earances can be connected to t$o different servers or to t$o different accounts on the same server! 1n this case( $e $ill set both a##earance to use the same account on the same server )%our Asterisk*!

ima"en

onfi"ure %our #hone as sho$n above! .et the 2Auth ?ass$ord3 field to 2#ol%com3 )$ithout the ,uotes*! -nce %ou have the values for the 21dentification3 section set( scroll do$n to the 2.erver 13 section!

ima"en

Ee#lace the 27773 $ith the last octet of %our Asterisk server>s 1? address( +-T T8& ?8-+&>. A44E&..FFF .croll do$n to the settin" for Line 9 )ski# the 2.erver 93 section for Line 1*! Ee#eat the #rocess above $ith the same values! 'oth Line 1 and Line 9 should be confi"ured identicall%! When %ou have this done( save %our chan"es b% clickin" either of the 2.ubmit3 buttons located on the #a"e! -T8&E ?-L: -M .&TT1+;.: :ou ma% also $ant to "o to the ;eneral o#tions #a"e and set the time s%nchroni=ation server )time-b!nist!"ov is a valid .+T? server name* and the ;MT offset! 1f da%li"ht savin"s time is active in %our area( feel free to set that as $ell!

ima"en

The #hone $ill store the chan"es and e0ecute a reboot! 1t $ill dis#la% the #a"e above! The reboot #rocess usuall% takes bet$een 1 and 9 minutes to com#lete! When com#lete( the #hone $ill attem#t to re"ister $ith %our Asterisk!

Ste# 2: Making 'alls

The %our installation! :ou should be able to call B001 and rin" the 7-Lite #hone )from the ?ol%com*( or B009 ad rin" the ?ol%com #hone )from 7-Lite #hone! The same $ill occur on the ?ol%com if %ou dial B009! Summar%: 1! 9! 3! 4! /! B! 8o$ to edit confi"uration files! 8o$ to add basic .1? accounts for #hones! 8o$ to add basic e0tensions for #hones! 8o$ to reload Asterisk after chan"es have been made! 8o$ to confi"ure %our 7-Lite soft #hone! 8o$ to confi"ure %our ?ol%com .1? desk #hone!

Asterisk Advanced Lab Assignment

Module /
Hello 9orld" $our ;irst A##lication - Dial#lan 7asics - A##lications

/ !" Hello 9orld: $our ;irst Dial#lan A##lication


Module / : Lab ! *ime Limit: !/ Minutes &0tensions in a traditional tele#hone s%stem are sim#l% #hones )or #erha#s #orts on the base unit if %ou>re the administrator*! 1n Asterisk( e0tensions are +-T #hones or #orts! &0tensions are lists of instructions

$ith an address )a number or sometimes an al#hanumeric name*! e0tensions can rin" #hones( but the% can also do much( much more! The "oal of this is to add an e0tension to %our Asterisk $hich ans$ers the incomin" call( #la%s back a brief messa"e and disconnects! When done( %ou should be"in to see ho$ e0tensions on Asterisk are trul% different from the le"ac% conce#t!

Ste# !: =#ening extensions con-#en a terminal $indo$ on %our Linu0 s%stem! To o#en a terminal( click on the 2A##lications3 menu( select .%stem Tools3 then 2Terminal3! The terminal $ill start a command shell in %our home director% )@root*! 5se the chan"e director% command )cd* to chan"e to the Asterisk confi"uration director%: # cd ,etc,asterisk 5se either vi( nano or "edit )2Te0t &dit3* to edit the 4ial#lan@&0tensions files: # gedit e.tensions conf :our e0tensions!conf file should look somethin" like this:

344444444444444444444444444444444444444444444444444444444444444444 3 44 5797R+-S788I95 :2R 8;7 +S87RIS< @I+-P-+9 =general> static?yes 1riteprotect?no autofallthrough?yes clearglobalvars?no priorityHumping?no 344444444444444444444444444444444444444444444444444444444444444444 344 5-26+- D+RI+6-7S =global> 1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 @@ -63-.4)+. '+.3-634 E-(+F <-A/users0 xten 9* 6!!1$1$=ial 24)7/ts#xlite$2!8 xten 9* 6!!2$1$=ial 24)7/::#polycom$2!8

Ste# &: Adding *(e <e) Extension


Add %our ne$ e0tension into the dial#lan inside the 2feature3 conte0t! 1f %our e0tensions!conf does not alread% have a features conte0t header )a line that reads )features*( add a fe$ blank lines after %our t$o e0tensions in the users conte0t( and then add a features conte0t header! Then #lace %our cursor belo$ the conte0t header and addin" the lines:

xten 9* 6KKK$1$>ns%er 28 xten 9* 6KKK$2$ 7layback 2hello-%ord8 xten 9* 6KKK$C$<angup 28

To "ive %our 2user3 access to the 2features3 conte0t( %ou must also include the line
include 9* features

Within the 2user3 conte0t! 1t ma% a##ear an%$here after the 2user3 conte0t header and before an% other conte0t header! :ou usuall% #lace 2includeO<3 statements after all the e0tensions in a conte0t! We $ill e0#lain a lot more about 2include3 later! .ave %our e0tensions!conf file and return to the command line! +ote that this e0tension( unlike the first t$o )B001 and B009*( has multi#le lines( each $ith its o$n line number )called a 2?riorit%3*! &0tensions can have man%( man% #riorities and can do much more than sim#l% rin" a #hone! The dial#lan environment in Asterisk actuall% allo$s %ou to create com#let sets of actions! 1n this re"ard the dial#lan is mucho more like a scri#tin" lan"ua"e than the sim#le table of numbers and devices $hich make u# the dial#lan on le"ac% s%stems!

Ste# 3: Reloading Asterisk>s Extensions


+o$( e0ecute an e0tensions reload from the Asterisk L1 to reload the e0tension confi"uration:
# asterisk &,,,r '()* dialplan reload

+o$ validate that the ne$ e0tension has been loaded usin" the 2dial#lan sho$3 command:
'()* dialplan reload sho% 6"KKNfeactures

Asterisk should res#ond b% sho$in" the ne$l% added e0tension:


/'ontext Gfeature5 created by Gpbx#config50 G6"KK59* 1. >ns%er 28 2. 7layback 2hello-%orld8 C. <angrup 28 -9 1 extension 2C priorities8 in 1 context. 92pbx#config8 2pbx#config8 2pbx#config8

Ste# +: *esting 7% 'alling


+o$( for the real test( #ick u# either %our 7-Lite soft #hone or %our ?ol%com #hone and call e0tension B/AA! :ou should be "reeted b% Allison $ho $ill $elcome %ou to the $orld of Asterisk!

Summar%:
:ou learned the follo$in": 1! That e0tensions are mucho more than #hones on desks! 9! 8o$ to add an a##lication e0tension! 3! 8o$ to use the Ans$er( ?la%back and 8an"u# a##lications! 4! 8o$ to vie$ an individual e0tension $ithin the dial#lan from the L1!

Asterisk Advanced Lab Assignment Module 2


7asic Dial#lan ;eatures: - Loo#ing 9it( Aoto - Adding .oicemail - 7uilding A Menu

2 !" Running In 'ircles: Loo#ing 9it( Aoto


Module 2 : Lab ! *ime Limit: 36 Minutes

The "oal this lab is to add ne$ conte0t $hich im#lements the basics of an 21PE Menu3 )a!k!a an Automated Attendant* This lab covers the conce#t in a ver% trivial $a%! 1n future labs %ou $ill build on the conce#t of the basic Automated Attendant to build additional dial #lan a##lications! Ste# !: Adding *(e <e) 'ontext -#en a terminal $indo$ on %our Linu0 s%stem( chan"e to the @etc@asterisk director% and o#en e0tensions!conf! .croll to the bottom and add a ne$ conte0t as follo$s: /demo-menu0 exten9* s$1$ >ns%er 28 exten9* s$n$ Fait 218 exten9* s$n$ Eackgraound 2press-18 exten9* s$n$ Eackgraound 2or8 exten9* s$n$ Eackgraound 2press-28 exten9* s$n$ Fait-xten 2C8 exten9* 1$1$ 7layback 2you-entered8 exten9* 1$n$ 7layback 2digits/18 exten9* 1$n$ Joto 2s$18 exten9* 2$1$ 7layback 2you-entered8 exten9* 2$n$ 7layback 2digits/28 exten9* 2$n$ Joto 2s$18 exten9* 2$n$ .o+p 24hucks$ they hung upO exten9* t$1$ 7layback 2too-lo%8 exten9* t$n$ <angup 28 exten9* i$1$ 7layback 2pbx-in,alid8 exten9* i$n$ <angup 28

Ste# &: Sending 'alls *o *(e Menu


+o$ %ou need to send calls into the ne$ Mdemo-menuN conte0t! .im#l% move %our cursor back u# into the MfeaturesN conte0t )above e0tension B/AA* and add the follo$in": /features0 exten9* 6"K $1 Joto 2demo-menu$ s$18 That creates a ne$ e0tension $hich %ou can dial to Lum# into %our Automated Attendant! .ave %ou>re a ne$ e0tension!conf file and return to the command line! +o$( e0ecute an e0tensions reload from the Asterisk L1 to reload the e0tension confi"uration: #asterisk -r '()* dialplan reload +o$ validate that the ne$ e0tension bas been loaded usin" the 2sho$ dial#lan3 command: '()* dialplan sho% 6"K Nfeatures '()* dialplan sho% sNdemo-menu

Ste# 3: *esting $our '(anges


+o$( #ick u# either %our 7-Lite soft #hone or %our Linsk%s #hone and call e0tension B/AC! :our s%stem should #rom#t %ou to 2?ress 1 or #ress 93! ;ive it a tr%!

Summar%:
:ou learned the follo$in": 1! 8o$ to use ;oto to Lum# the dial #lan! 9! 8o$ to use the 'ack"roun" and Wait&0ten to #rom#t for di"its! 3! 8o$ to im#lement the s#ecial e0tensions s( 1( t and h!

2 & " Adding .oicemail *o $our ,ser Extensions


Module 2 : Lab & *ime Limit: !/ Minutes

+e0t $e $ill add Poicemail to the t$o e0istin" e0tensions( and add a 2check voicemail3 e0tension! +ote that at this #oint $e>re not "ivin" %ou>re the e0act s%nta0 for reloads( editin"( etc! 1f %our reall% need hel#( ask %our instructor to take a look at %our confi"uration! Ste# !: 'reating .oicemail 7oxes &dit the voicemail confi"uration file )etc@asterisk@voicemail!conf* and add t$o mailbo0esQ one for each of the t$o e0tensions! .croll do$n and #lace the ne$ bo0es in the MdefaultN mailbo0 conte0t! /default0 6!!19* KKKK$ 3om 4mith$ yourNemail.com 6!!29* KKKK$ ;oe ;ones$ ::onesNde,null.com .ave %our chan"es! Ee-load the voicemail module so that Asterisk can see the ne$ mailbose0 b% e0ecutin" the follo$in" command! )4on>t for"e that %ou can use tab com#letion to make it easier*! '()* module reload app#,oicemail.so

Ste# &: Adding *(e 7oxes *o *(e SIP Accounts


1n order for Asterisk to kno$ $ith mailbo0 a .1? account uses %ou must add a mailbo0 directive )the same "oes for 1A79( 8! 393! &tc!* To do this( o#en %our si#!conf file and alter the accounts as follo$s: /ts#xlite0 type 9 friend hots9dynamic context9user /::#polycom0 type 9 friend hots9dynamic context9user

secretO0lite mailbo0OB001Rdefault

secretO0lite mailbo0OB001Rdefault

.ave %our chan"es( lo" into the Asterisk L1 and e0ecute a si# reload! +ote that chan"in" the mailbo0 definition on %our .1? accounts $ill not take #lace immediatel% if %our .1? devices are alread% re"istered! To force an immediate chan"e( use the restart command! Ste# 3: Adding *(e Mailbox *o *(e Dial Plan
+o$ %ou are read% to add the voicemail to %our e0tensions! &dit %our e0tensions!conf file and alter %our t$o e0tensions as follo$s! 4o no du#licate %our $orkQ Lust add a second line to each of %our e0tensions: /users0 exten9* 6!!1$1$ =ial 24-7/ts#xlite$2!8 exten9* 6!!1$n$ Poicemail 26!!1Ndefault8 exten9* 6!!2$1$ =ial 24)7/::#polycom$2!8 exten9* 6!!2$n$ Poicemail 26!!2Ndefault8 :ou $ill also need to add an e0tension $hich allo$s %ou to check mail in the MfeaturesN conte0t! A"ain( don>t add a ne$ section called MfeaturesN( Lust add this e0tension to %our e0istin" features conte0t!

/features0 exten9* 6"!!$1$>ns%er 28 exten9* 6"!!$2$PoiceIailIain 2Ndefault8 +o$ save %our e0tensions file and e0ecute an e0tensions reload from the Asterisk L1!

Ste# +: *est $our '(anges


:ou should no$ be able to dial either #hone and( after 90 secunds( reach the #hone>s mailbo0! :ou should also be able to dial in and check voicemail usin" e0tension B/00!

Ste# 3: Adding *(e Mailbox *o *(e Dial Plan Summar%:


:ou learned the follo$in": 1! 9! 3! 4! 8o$ to add voicemail bo0es to the voicemail!conf file 8o$ to associate .1? accounts $ith mailbo0es! ho$ to add basic voicemail su##ort to the e0tensions in the dial#lan! 8o$ to create a 2chek voicemail3 feature e0tension!

2 3 : 7uilding An Automated Attendant


Module 2 : Lab 3 *ime Limit: &6 Minutes

:ou no$ kno$ the basics re,uired to create a real( functionin" automated attendant )sometimes called an 1PE Menu*! An automated attendant allo$s #eo#le to select destinations from a list )%es( the dreaded 2?ress 1 for sales( #ress 9 for serviceS3*! 1n this lab %ou $ill build %our s%stem>s Main Menu! 1n an u#comin" lab $e $ill actuall% start sendin" callers from the outside to this menu! Ste# !: 'reate *(e Menu This menu is much like the Mdemo-menuN created in Module B Lab 1! 8o$ever( this time $e $ill have real o#tions! :our menu can include as man% o#tions as %ou like! Tee# in mind that too man% o#tions is bad for customer service! We $ill start off $ith a ver% sim#le menu $ith onl% four o#tions! 7utton 1 9 A U Action Transfer to Tom .mith )in .ales* Transfer to Koe Kones )in Technical .u##ort* 5se the com#an% director% Ee#eat the menu

At this time all other o#tions $ill de invalid! We $ill "ive the caller a total of / seconds follo$in" the and of #la%back to make a selection before $e time out! reate the ne$ conte0t listed belo$: Bda%"menuC exten9* s$ exten9* s$ exten9* s$ exten9* s$ 1$ n$ n$ n$ >ns%er 28 Fait 2!."8 Eackground 2day-menu8 Fait-xten 2"8

exten9* 1$ 1$ Joto 2users$ 6!!1$18 exten9* 2$ 1$ Joto 2users$ 6!!2$18 exten9* K$ 1$ =irectory 2default$ users$ e8 exten9* @1$Joto 2s$18 exten9* t$1$ 7layback 2goodbye8 exten9* t$n$ <angup 28 exten9* i$1$ 7layback 2pbx-in,alid8 exten9* i$n$ Joto 2s$18 Ste# &: 'reate A Record Extension Asterisk doesn>t shi# $ith 2da%-menu3 #rom#t )and if it did( it #robabl% $ouldn>t sa% $hat %ou $ant it to! To create a custom #rom#t( add an e0tension in the MfeaturesN conte0t that allo$s %ou to record: 3Record 8he @ay Eenu exten9* 66!!$1$>ns%er 28 exten9* 66!!$n$Fait 2!."8 exten9* 66!!$n$Aecord 2day-menu.gsm8

exten9* 66!!$n$Fait 218 exten9* 66!!$n$7layback 2day-menu8 exten9* 66!!$n$<ungup 28 Ste# 3: 'reate An Access Extension 1n order to test %our menu( %ou $ill need to create an e0tension to access it! Eefer to Lab B!1 for a reminder of ho$! 1n that lab %ou created e0tension B/AC to "o to %our Mdemo-menuN! 6or this lab( t( create e0tension BB01 in the MfeatureN conte0t( usin" the ;oto )* a##lication to access the Mda%-menuN! Ste# +: Reload Asterisk>s Extensions :ou kno$ the drill! Ste# /: Record *(e Menu 8ere>s a sam#le menu scri#t! 6eel free to have some fun $ith this: 2Thank %ou for callin" .u#er8%#erMe"aPo1?F :our call is ver% im#ortant to us! To s#eak $ith someone in our d%namic sales staff( #ress 1! To s#eak $ith our courteous and #rofessional su##ort de#artment( #ress 9! 6or a com#an% menu( #ress A! To re#eat this menu( #ress .tar3! 4ial into the record a##lication on BB00 and $ait for the tone! After the tone( record #rom#t! :ou can sto# recordin" b% #ressin" the #ound ke%! The s%stem $ill then #la% back %our recordin"! 1f %ou $ant to rerecord it( sim#l% call in a"ain! Ste# 2: *est $our '(anges +o$ test %our chan"es b% dialin" in on BB01! :ou should be able to access either of the t$o e0tensions b% #ressin" 1 or 9! :our com#an% director% )$ith the same t$o e0tensions available b% name* should kick $hen off $hen %ou #ress A! .tar should force the menu to re#eat! An%thin" else should "et %ou the 2invalid3 #rom#t! Summar%: :ou learned the follo$in": 1! 8o$ to build a menu $ith real o#tions! 9! 8o$ to create an e0tension to record a custom #rom#t! 3! 8o$ to create an e0tension to access %our ne$ menu! 4! 8o$ to use the 4irector% a##lication! '(allenge: 1! Add access to PoiceMailMain to a hidden o#tion on %our menu! 9! han"e the 4irector% so it uses first name rather than last!

Asterisk Advanced Lab Assignment Module 4


'reating .olP 'onnections: - SIP - IA8&

4 ! : 'onnecting 9it( .olP: SIP


Module 4 : Lab ! *ime Limit: 26 Minutes

Man% #eo#le have ado#ted Asterisk s#ecificall% because it su##orts the industr%-standard .1? #rotocol )more or less*! While #erha#s not the ideal Pol? #rotocol( .1? has become the common lan"ua"e of 1? communications! Most of the service #roviders )1T.?s* on the market toda% su##ort .1? trnkin"! 1n this lab %ou $ill create a connection bet$een %our Asterisk ?'7 and a service #rovider )also runnin" Asterisk*! 1n the e0am#les belo$( $hen the document refers to 2trainin"73 re#lace 7 $ith %our assi"ned trainin" 14 number! Ste# !: Adding A SIP Service Provider Account -#en %our si#!conf file! +ear the to#( in the M"eneralN section %ou $ill find a 2conte0tO3 statement! This s#ecifies the default incomin" conte0t for si# calls! han"e the conte0t name from its current value )most likel% it is 2default3* to 2fromDoutside3: 'ontext9from#outside +o$( move do$n to the re"istration section and set u# a re"ister statement for %our account in %our si#!conf files as follo$s )be sure to chan"e 273 to %our assi"ned trainin" number*: register 9* training6HtrainingN1K2.16 .1!1.1 1t is e0tremel% im#ortant to #lace the re"ister statement in the re"istration section! The e0am#le si#!conf $e have #rovided for %our in earlier labs has the re"istration section identified b% comments! 1f %our are $orkin" $ith the standard asterisk si#!conf or an% other version of si#!conf( rather than the one #rovided in earlier labs( the re"istration section ma% not be e0#licitl% identified! 1t is located after all statements in the 2"eneral3 section and before the 2authentification3 section )if it e0ists*( and if not( before the first si# #eer( user( or friend! 1f %ou #lace a re"ister statement in some other #ortion of si#!conf( it $ill be i"nored! +o$( add a .1? #eer account $hich $ill direct calls to the .ervice ?rovider and $ill receive traffic from the service #rovider! /to#sippro,ider0 type 9 peer username 9 training6 1 be sure to change 6 to your number fromuser 9 training6 1 be sure to change 6 to your number fromdomain 9 example.com secret 9 training canrein,ite 9 no insecure 9 in,ite$ port host 9 1K2.16 .1!1.1 deny 9 !.!.!.!/! permit 9 1K2.16 .1!11/22".2"".2"" disallo% 9 all allo% 9 gsm allo% 9 ala% allo% ala% Lualify 9 yes nat 9 no

.ave %our chan"es to si#!conf! +ote the of the 2insecure O invite( #ort3 o#tion! This is necessar% because %our Asterisk is #la%in" the #art of the customer! 1T.?s "enerall% authenticate calls comin" in )so the% no$ $ho to bill* but the% "enerall% don>t allo$ the remote devices to challen"e them $hen the% send a call! 1n this case $e use the den% and #ermit statements to limit incomin" calls to the 1T.?>s 1? address! Ste# &: Adding *(e -rom?outside 'ontext -#en u# e0tensions!conf and add a ne$ conte0t as follo$s: /inside0 exten9* 6!!1$1$=ial 24)7/666#xlite$2!8 exten9* 6!!1$n$Poicemail 26!!1Ndefault8 exten9* 6!!2$1$=ial 24)7/666#polycom$2!8 exten9* 6!!2$n$Poicemail 26!!2Ndefault8 /users0 include9* features +e0t( add a second include statement to %our users conte0t to also include inside! This allo$s %our #hone )$hich send their calls into the MusersN conte0t* to have access to both inside #hones and features( $hile "rantin" outside callers )$ho send their calls into the MfromDoutsideN contest* access onl% to the inside #hone! 'e ver% careful that %ou do not include features in %our MinsideN conte0t! /users0 include9* inside include9* features '% doin" this %ou have started the #rocess of buildin" classes of service into %our dial#lan! We $ill address this further in later labs! Ste# 3: Adding An =utbound Extension Add an e0tension in the MfeaturesN conte0t to call the server: /features0 exten 9* 67!!$1$=ial 24)7/6!!!Nto#sippro,ider8 This e0tension sends a call to e0tension B000 on the 1T.?>s server! +ote one of the ke% differences bet$een sendin" a call to a #hone and sendin" a call to a service #rovider )or a Pol? server*: When %ou call a #hone( %ou Lust send the call to the #eer! With a server( %our need to identif% the service %ou are tr%in" to reach! 8ard codin" the address )i!e!%our e0tension BI00 "oes to B000 at the #rovider* is a bit infle0ible! 1n an u#comin" module $e $ill see ho$ to make use of a #o$erful dial#lan techni,ue called #attern-matchin" to im#rove on this model! .ave %our dial #lan reload Asterisk to install the chan"es to both .1? and %our dial#lan!

Ste# +: *esting $our '(anges +o$ test %our connection to the server b% dialin" BI00 from %our #hone! :ou should hear Allison makin" some interestin" statementF 1f %ou $atch the Asterisk console( %ou should see Asterisk connectin" to the remote .1? service #rovider! +e0t( use one of the analo" #hone on %our desk or one of the #hones on the instructor>s desk to dial I77-B001 or I77-B009 )$here 77 is %our trainin" 14 number in 9 di"it form: 01-99*! :our #hone should rin"! 1f %ou ans$er( %ou should "et %our voicemail bo0! )note: the server onl% sends e0tensions be"innin" $ith 2B3 to %our machine!( $e>ll talk more about this in our future modele on 414 trunks!* Summar%: :ou learned the follo$in": 1! 8o$ to confi"ure a .1? #eer account to connect $ith a .1? 1T.?! 9! 8o$ to use a Ee"ister statement to re"ister %our Asterisk $ith the 1T.?!

4 & : 'onnecting 9it( .olP: IA8&


Module 4 : Lab &

*ime Limit: 36 Minutes +o$ $e are "oin" to re#roduce the #revious lab usin" 1A79 instead of .1?! While .1? is the most #o#ular Pol? #rotocol( 1A79 1. "enerall% the easiest to confi"ure! The do$n side: onl% 1T?s runnin" Asterisk can su##ort A179! Ste# !: Adding An IA8& I*SP Account -#en %our ia0!conf file! This time %ou $ill be $orkin" $ith the full sam#le ia0!conf from the Asterisk distribution! Move do$n to the re"istration section )note that tis is an%$here '&L-W the "eneral o#tions and A'-P& the first defined #eer or user structure( near other sam#le re"ister statements that have been commented out* and set u# a re"ister statement for %our account in %our ia0!conf file as follo$s )be sure to chan"e 7 to %our assi"ned trainin" number*: register 9* training6H trainingN1K2.16 .1!1.1 +o$( add a 1A7 #eer and user account! ?lease #lace these sections at the ver% bottom o the ia0!conf file! Eemember -the #eer $ill direct calls to the service #rovider( $hile the user $ill handle calls comin" from the service #rovider! /to#iaxpro,ider0 ?sername9training6 secret9training type9peer auth9md" transfer9no host91K2.16 .1!1.1 disallo%9all allo%9gsm allo%9ula% allo%9ala% Lualify9yes trunk9yes /training60 type9peer auth9md" transfer9no disallo%9all allo%9gsm allo%9ula% trunk9yes secret9training context9from#outside 1 change to your training number

Ste# &: Adding A *est Extension Add an e0tension in the MfeaturesN conte0t to call the server:

/features0 exten 9* 67!1$1$=ial 2)>62/to#iaxpro,ider/6!!!8 .imilar to the BI00 %ou used for %our .1? service in the #revious lab( $e>ll send BI01 to the 1A79 1T.? no$! 1n the ne0t module %ou $ill see ho$ can use a techni,ue called #attern matchin" to send an% e0tension $e $ant to the 1?.?F .ave %our dial #lan( reload Asterisk and test %our connection to the server b% dialin" BI01 from %our #hone! :ou should hear Allison! <ote: in %our ia0!conf( %our MtoDia0#roviderN entr% includes the username and #ass$ord used to dial %our 1A79 calls! 1t is #ossible to omit this( and to include this information in the 4ial )* a##lication: Di!8 (IAX2>usern!me? p!ss)or"'pro;i"er>e@tension)but this $ould #ut #ass$ords into e0tensions!conf( it is a better #ractice to restrict #ass$ord to si#!conf and ia0!conf! +e0t( use one of the analo" #hones on %our desk or one of the #hones on the instructor>s desk to dial C77-B001 or C77-B009 )$here 77 is %our trainin" 14 number in 9 di"it form: 01-99*! :our #hone should rin"!( if %ou don>t ans$er( should "et %our voicemail bo0! )+ote: the server onl% sends e0tensions be"innin" $ith 2B3 to %our machine! We>ll talk more about this in our future module on 414 trunks!* Summar%: :ou learned the follo$in": 1! 8o$ to confi"ure an 1A79 account! 9! 8o$ to re"ister $ith an 1A79 service #rovider! 3! 8o$ to 4ial a call via an 1A79 service #rovider!

Asterisk Advanced Lab Assignment Module 5


More Dial#lan: .ariables Included 'ontexts Pattern Matc(ing Parking Music"=n"Hold

5 ! : ,sing Pattern Mac(ing


Module 5 : Lab ! *ime Limit: &6 Minutes

5# to ne$( ever% e0tension %ou have dialed has had an e0act match in the dial #lan! 'ut this is not a #ractical $a% to handle man% classes of numbers! 6or e0am#le( if %ou $ant to add su##ort for various 2outside3 or #ublic numbers( %ou $ould have a lot of t%#in" to do! This is $here the #attern match comes in hand%! 1n this lab $e $ill add a set of #atterns for handlin" Local and Lon" 4istance numbers as dialed in the +orth American +umberin" ?lan )+A+?*( local numbers are dialed as either I di"it values or 10 di"it values )3 di"its of JArea ode> #lus I di"its of local number*! :ou $ill also add a 2catch-all3 for calls to unreco"ni=ed numbers $hich come in from the outside! Ste# !: 'reated *(e Patterns 8ere is $here start to make thin"s more challen"in"! 'efore %ou look to the solution listed belo$( tr% to come u# $ith the ans$er on %our o$n! reate %our #atterns in the MfeaturesN conte0t! 8ere are the rules for 5. numbers: I-4i"it numbers never start $ith 0 or 1 )this tells %our $hat the first #attern character should be* but an% valid di"it 0-A can be used in di"its 9-I! 10- 4i"it numbers include a 3- 4i"it area code $hich( like I-4i"it numbers( also never starts $ith 0 or 1! The ne0t t$o di"its ma% be an% valid di"it 0-A! The remainin" I di"its( of course( follo$ the rule for Idi"it numbers )since a 10- 4i"it number is nothin" than Are ode H I 4i"it +umber*! 8o$ %ou actuall% dial local and lon" distance numbers varies $idel% in different #arts of the countr%! There are #laces $here all local calls are Lust seven di"its( #laces $here there are both seven and ten di"it local calls and #laces $here all calls are ten di"its $hether local or lon" distance! 1n some of these #laces( the ten di"it calls must be #refi0ed b% an 2access code3 of 1 )$hich b% #ure coincidence and for historical and technical reasons is the same as the +orth American +umberin" Vone code aka countr% code*( but this is not al$a%s the case! The access code of 1 is sometimes re,uired onl% for lon" distance calls( sometimes for all calls $here the area code is different from %our o$n( and sometimes even for %our o$n area code! The 1 ma% in some areas indicate a lon" distance call but in other areas the 1 is re,uired for some or all local calls( and in some areas man% lon" distance calls are dialed $ithout a 1( sometimes even as Lust seven di"its( $ith no $a% for a caller to kno$ $hether a call is local or lon" distance $ithout consultin" rate tables in the tele#hone book! 1nformation about the actual dialin" #lan for each area of the countr% can be found at $$$!nan#a!com and information about local callin" areas can be found at $$$!localcallin""uide!com! ;iven that com#le0 situation( for lab $e are sim#l% "oin" to assume that $e are located in a #art of the countr% $here all local calls are dialed as either I for 10 di"its( and lon" distance calls are 1H10-4i"its! Ste# &: Send 'alls *o *(e Dialed <umbers -nce %ou>ve fi"ured out the #atterns( %ou need to do somethin" $ith the dialed numbers( so: .end local numbers across the 1A79 trunk! .end lon"-distance numbers across the .1? trunk! Also handle incomin" unreco"ni=ed numbers and send them to %our da%-menu! Sam#les Solution: /features0 H =ial (ocal .umbers ,ia )>62

e@ten<(1XXXXXX,1,Di!8 (IAX2>toAi!@pro;i"er>B(/X./1) e@ten<(1XXXXXXXXX,1,Di!8 (IAX2>toAi!@pro;i"er>B(/X./1) H =ial (ong =istance .umbers ,ia 4)7 e@ten<(1XXXXXX,1,Di!8 (%I:>B(/X./1)'toAsippro;i"er) /from#outside0 include 9* inside include 9* unkno%n /unkno%n0 1 4end any un-matched calls to the day menu. exten 9*#6.$Joto2day-menu$s$18 7onus: 5se the #atter matchin" lo"ic to create a feature e0tension to record ne$ #rom#t recordin"s from %our soft #hone! 8int: the soft #hone can send al#hanumeric te0t )#ress the s#ace bar*! Warnin": %ou could easil% accidentall% over$rite recordin"s b% Allison( so %ou ma% $ish to kee# this from ha##enin"! 8int: subdirector%! Summar%: :ou learned the follo$in": 1! 8o$ to use #attern matchin" to match a limited "rou# of numbers! 9! 8o$ to use a variable )WX&7T&+Y* to d%namicall% send calls across trunks!

5 & : ,sing 'ontext *o 7uild 'lasses =- Access


Module 5 : Lab &

*ime Limit: &6 Minutes We mentioned conte0t includes earl% on in this course and %ou>ve seen them since %our ver% first fora% into e0tensions!conf! +o$ %ou "et to see the real #o$er of conte0t and includes! +ot all users are e,ual )sounds bad( but it>s true*! .ome need tom make international calls( $hile others ma% onl% need to call inside the ?'7! 8ere>s %our chance to "ain controlF Ste# !: 'reated *(e 'ontext Hierarc(% reate a series of conte0t( each of $hich has a different level of access! The levels $e $ant to cover are: Local D *oll ;ree 1n the #revious lab %ou created #atterns for I and 10 local dialin"! Eemove those #atterns from the MfeaturesN conte0t and move them into a ne$ MlocalN conte0t! Add ne$ #atterns to handle +A+? toll-free numbers )1HC00( 1HCCC( 1HCCC( 1HCII( 1HCBB* b% sendin" them over the .1? trunk! 1nclude the MusersN conte0t! This $ill allo$ those $ho can call local and toll free numbers to also call numbers in the users conte0t( $hich b% inclusion are the inside numbers and features! Long Distance 1n the last lab %ou created a #atter for +A+? lon" distance numbers )dialed 1H*! Eemove the lon" distance #atter e0tension from the MfeaturesN conte0t and move it to a ne$ Mlon"distanceN conte0t! 'ecause $e don>t $ant the lon" distance lines abused( add a #attern to ban 1HA00 numbers )ver% hi"h cost numbers used for #a%-#er-call services*! .end all of these numbers to the on"estion )* a##lication! 1nclude the MlocalN conte0t! This $ill allo$ those $ho can call lon" distance numbers to also call local numbers( and b% inclusion( the users( inside( and features conte0ts! International 1n the +A+?( international numbers are dialed 011H countr% code H number! 'uild a conte0t called MinternationalN and include a #attern to handle all 011H numbers b% sendin" them them over the 1A79 trunk! 1nclude the Mlon"istanceN conte0t! This $ill allo$ those $ho can call international numbers to also call lon" distance numbers( and b% inclusion also the local( users( inside( and features conte0ts! Ste# &: ,#date t(e Entries -or $our P(ones in si# con1n si#!conf( chan"e the conte0t settin" for %our 7-Lite #hone from 2users3 to the ne$ 2local3 conte0t! han"e the conte0t for %our ?ol%com #hone from 2users3 to 2international3! .ave and reload %our .1? confi"uration! Ste# 3: *est $our '(anges ?ick u# the 7-Lite #hone and %ou should able to call internal and local numbers( nut no 1H lon" distance or international numbers! heck $ith %our instructor for the local Area ode associated $ith the 1T.?!

.ome instructors set the class u# as thou"h $e $ere located in C1B )Tansas it%*( others set the class u# as thou"h $ere located in 9/B )8untsville( Alabama*( and others set the class u# for the actual e0chan"e servin" the boot cam# location! 5se the ?ol%com #hone and %ou should be able to dial 1H numbers and even 011Hinternational numbers! +ote: there are also some s#ecial numbers set u# in the 1T.? in a bo0 $hich are handled as internal numbers for the course( such as the I77-B000 and C77-B000 numbers %ou have been usin" to test %our incomin" connections! These numbers $on>t be reachable on the ?.T+! Summar%: :ou learned the follo$in": 1! 8o$ to use conte0t to control access $ithin the dial#lan! 9! 8o$ to include or e0clude number "rou#s usin" #attern matches! Sam#le Solution: /local0 1 =ial (ocal .umbers ,ia )>62 e@ten<(1XXXXXX,1,Di!8 (IAX2>toAi!@pro;i"er>B(/X./1) e@ten<(1XXXXXXXXX,1,Di!8 (IAX2>toAi!@pro;i"er>B(/X./1) H =ial 3oll Bree .umbers ,ia 4)7 e@ten<(A18001XXXXX,1,Di!8 (%I:>BC/X./1D'toAsippro;i"er) e@ten<(A18881XXXXX,1,Di!8 (%I:>BC/X./1D'toAsippro;i"er) e@ten<(A18EE1XXXXX,1,Di!8 (%I:>BC/X./1D'toAsippro;i"er) e@ten<(A18661XXXXX,1,Di!8 (%I:>BC/X./1D'toAsippro;i"er) in 8uye <( users /longdistance0 H Ean K!! numbers e@ten<(A19001XXXXX,1,Congestion (F) 1 =ial (ong =istance .umbers ,ia 4)7 e@ten<(A11XX1XXXXXX,1,Di!8 (%I:>BC/X./1D'toAsippro;i"er) include 9* local /international0 1 =ial international numbers ,ia )>62 e@ten<(A011.,1,Di!8 (IAX2>'toAsippro;i"er)BC/X./1D include 9* longdistance

5 3 : Adding Local ;eatures And Services


Module 5 : Lab 3 *ime Limit: !6 Minutes

.o far can call numbers both inside and out( access voicemail( use a com#an% director% and build automated attendants! Lets add Lust a bit more value to the ?'7 b% settin" u# some additional features! 1n this lab %ou $ill add #arkin" and #icku#( MeetMe conferencin"( and music on hold aa#lications to %our MfeaturesN conte0t! Ste# !: Add *(e ;eatures 1n e0tensions!conf( edit %our MfeaturesN conte0t to contain the follo$in" conference rooms! )+ote that %ou>ll need to fi"ure out the s%nta0 on %our o$n-refer back to the slides if %ou need to*! An e0tension B/10 MeetMe conference room named 2Washin"ton3 An e0tension B/11 MeetMe conference room named 2Kefferson3 An e0tension B/19 MeetMe conference room named 2Lincoln3 An e0tension B/90 ?la% hold music )default class* <ote: :ou can use al#hanumeric names )like Washin"ton( Kefferson and Lincoln* to identif% the conferences! The firs #arameter of the MeetMe )* a##lication does not have to be a number! +ote also that %ou can used the 2d3 )d%namic creation* o#tion so that %ou do no need to define the conference rooms in meetme!conf! MeetMe)* has a lot of o#tions that interact in interestin" $a%s! 6or e0am#le( MeetMe) onf+o-r+ame(d?(#in* $ill d%namicall% create a conference room $ith the s#ecified ?1+ and #rom#t the user to enter the ?1+ $hen enterin" the conference! Ste# &: Add 'all Parking *o $our P78 To add call #arkin" to %our ?'7( sim#l% include the automaticall% created M#arkedcallsN conte0t in the features conte0t )include O< #arkedcalls*! Ste# 3: En(ance $our Menu &nhance %our Mda%-menuN b% addin" an o#tion 3 $hich takes callers into the Washin"ton conference brid"e! Also "ive callers dial-access to %our e0tensions )i!e! 21 %ou kno$ the e0tension of the #art% %ou are callin"( #lease enter it no$3! +ote: #lease do these t$o tasks b% addin" onl% a sin"le line #er task to %our da%-menu! Ee-record %our messa"e to announce both of these ne$ o#tions! Ste# +: *est $our '(anges -nce %ou reload the dial#lan( %ou should be able to dial an% of the above e0tensions and receive the e0#ected service! :ou should also be able to dial into %our da%-menu and access the brid"e )o#tion 3* and dial an% valid user e0tension! 'ut the da%-menu should not "ive callers access to other features or outside linesF Test all ?arkin" on the ?ol%com #hone! .ince this is an attended transfer( $e call to the ?ol%com #hone( then #ress the MTransferN soft ke%( #ress I00 Z4ial<( 8earS3I013( and then #ress! Summar%: :ou learned the follo$in": 1! 8o$ to confi"ured MeetMe conference brid"es

9! 8o$ to add #arkin" to %our ?'7 3! ?ractice: confi"urin" automated attendant o#tions!

Asterisk Advanced Lab Assignment Module !6


Ex#ressionsE ;unctions F More: Mat( In *(e Dial#lan En(anced I.R 9it( Loo# 'ontrol 'aller ID: Inside F =ut Parking Music"=n"Hold

!6 ! : Ex#ress $oursel-: Mat( In *(e Dial#lan


Module !6 : Lab !

*ime Limit: &6 Minutes &0#ressions are ver% useful structures in the dial#lan! &0#ressions allo$ %ou to com#are thin"s( to check values( and to handle basic mathematical o#erations! 1n this lab %ou $ill learn ho$ Asterisk e0#ression can hel# %ou to build a basic calculator! Ste# !: *(e <e) Mat( reate an e0tension in %our MfeaturesN conte0t that does the follo$in": 1! 9! 3! 4! /! .ets a channel variable named .5M to 0! ollects one or more di"it from the caller usin" the Eead )* a##lication! 5ses an e0#ression to add the ne$ value to the value of the .5M variable! ?la%s back the ne$ .5M to the caller! Ee#eat until the caller han"s u#!

+ote: 6or hel# $ith the #arameters of the Eead )* a##lication( use the built-in L1 hel# b% t%#in" Jcore sho$ a##lication Eead>! Summar%: :ou learned the follo$in": 1! 8o$ to the Eead a##lication to collect di"its! 9! 8o$ to use e0#ressions to do math! Sam#le Solution: e@ten e@ten e@ten e@ten e@ten e@ten e@ten <( <( <( <( <( <( <( 6FGF,1, 6FGF,n, 6FGF,n, 6FGF,n, 6FGF,n, 6FGF,n, 6FGF,n, Ans)er () 2!it (0.F) %et (%-$<0) (getit), 3e!" (.$:, to-enter-!-num#er,G,,2,G) %et (%-$<BHC%-$BDI) %!y1um#er(BC%-$BD) 9oto (getit)

!6 & : 'aller ID: Inside And =ut


Module !6 : Lab &

*ime Limit: &/ Minutes onfi"ure %our #hones to send a s#ecific caller 14 $hen makin" calls! Then( alter %our dial #lan to re#lace the aller 14 $hen calls "o toDoutside destinations!! Ste# !: 'on-iguring 'aller ID =n $our SIP Accounts &dit %our si#!conf file and alter %our si# #hones to transmit a set caller! 14! )Eemember that if %ou don>t set a caller 14( asterisk $ill either send 2asterisk3 or( $orse %et( $hatever the user>s #hone sends )throu"h!* /ts#xlite0 type 9 friend host 9 dynamic context 9 local secret 9 xlite mailbox 9 6!!1Ndefault callerid 9 Q3om 4mithR S6!!1* /::#polycom0 type 9 friend host 9 dynamic context 9 international secret 9 polycom mailbox 9 6!!2Ndefault callerid 9 Q;oe ;onesR S6!!2* .ave %our chan"es and reload Asterisk! +o$ dial out from one #hone to the other and make sure that the aller 14 dis#la% #ro#erl%! Ste# &: 'on-igure SIP *o Acce#t 'aller ID While it>s nice to kno$ $hat e0tension a user is callin" from for internal calls( it>s #rett% useless on the outside! 1n some cases )"enerall% traditional ?-T. lines* it doesn>t make an% different $hat %ou set because the #hone com#an% sets %our caller 14( but in other cases )"enerall% 1T.?s and ?E1 lines* %ou "et to set the out"oin" caller 14! 6irst( edit %our si#!conf to #ass and receive aller 14 information from the far end! -#en si#!conf and add the follo$in" Eemote ?art% 14 o#tions in the M"eneralN section at the to# of the files: trustrid = yes sendrpid = yes ; If Remote-Party-ID should be trusted ; If Remote-Party-ID should be sent

.ave the si#!conf file and lo" into asterisk! &0ecute a reload to force Asterisk to reset the values of the E?14 values and reset the aller 14 value for the #eers! +o$ %ou have E?14 enabled for both incomin" and out"oin" calls from the .1? #hones and the server! Ste# 3: 'on-iguring *(e =verride 'aller ID

To override the caller 14 on outbound calls( %ou $ill need to alter %our e0tensions! onf file to set a com#an% aller 14! 5se the ALL&E14 function to set both the caller 14 number and name values )num and name*! .end a 10 di"it +A+? number and the name of %ou choice! Sam#le Solution: /local0 e@ten <( A1XX1XXXXXX,1, %et (CA,,/3ID (num) < 800FFF1212) e@ten <( A1XX1XXXXXX,n, %et (CA,,/3ID (num) < $eg!Joip Co.) e@ten <( A1XX1XXXXXX,n, Di!8(!s you h!" 7or 10 "igit 8o !8 !88s in the pre;ious 8!#) in 8u"e <( 8o !8 /international0 e@ten <( A011.,1, %et (CA,,/3ID (num) < 800FFF1212) e@ten <( A011.,n, %et (CA,,/3ID (num) < $0 A%./3I%K) e@ten <( A011.,n, Di!8(!s you h!" 7or Intern!tion!8 !88s in the pre;ious 8!#) in 8u"e <( 8ong"ist!n e +o$ reload %our e0tensions and dial the server at the follo$in" number: 1 )///* AAA-AAAA! The s%stem $ill #la% back %our callin" number and name! Summar%: :ou learned the follo$in": 1! 8o$ to set aller 14 numbers for out"oin" calls! 9! 8o$ basics of usin" Asterisk functions!

!6 3 : *ime And Date =#erations 9it( Aotol-*ime01

Module !6 : Lab 3 *ime Limit: !/ Minutes Ei"ht no$ callers $ho hit %our automated attendant "et the same treatment da% or ni"ht! 1n the real $orld it is often better to offer different menus de#endin" on the time of da%( of $eek or even the da% of the %ear )think holida%s* With the ;oto1fTime )* a##lication( %ou can fine tune %our s%stem to su##ort timebased decision makin"! 1n the follo$in" lab %ou $ill create a ne$ Mni"ht-menuN that offers a limited sub-set of the o#tions in %our da% menu! 1t also tells callers that %ou are not currentl% o#en for business! :ou $ill then sendn incomin" callers to a sortin" e0tension that( de#endin" on the time of da% and of $eek( sends callers to either the Mda%-menuN or the Mda%-menuN! Ste# !: 'reate A <ig(t Menu 5se the Mda%-menuN as a tem#late and create a ni"ht menu! )'e sure to chan"e the file used in the 'ack"round )* ste# to a ne$ nameQ #referabl% 2da%-menu3*! The ne$ menu should thank the caller( #olitel% let them kno$ that the business is no$ closed( and that the hours of o#eration are A:30 AM to 4:30 ?M( Monda% throu"h 6rida%! -ffer onl% the com#an% director% as an o#tion )A*! Ste# &: *(e Sorting Extension +e0t( %ou need to chan"e %our catch-all )D7* e0tension in conte0t Munkno$nN to sort bet$een da% and ni"ht menus! 5se the ;oto1fTime )* a##lication to send callers durin" the hours@da%s mentioned in ste# 1 to the Mda%-menuN( $hile sendin" callers at an% other time to the Mni"ht-menuN! Ste# 3: *est $our '(anges ?lace a call into %our s%stem across one of %our outside links ).1? or 1A79*! The call should be directed to the #ro#er menu de#endin" on the time of da%! Tr% callin" both inside and outside of business hours! 'e sure to make to make sure the time is set correctl% on %our Asterisk s%stem! 1t is "enerall% no a "ood idea to be chan"in" the time for$ard and back$ards on a 5ni0 s%stem )it can confuse a number of com#onents such as 2make3 or entries in ,ueues such as asterisk>s call ,ueue or email ,ueues( not to mention confuse %ou $hen lookin" at file creation and modification times*! To test that %our ;oto1fTime A##lication branches #ro#erl%( %ou should modif% the time or da% tested in the a##lication to be a time that is 2no$3 or 2not no$3! -nce %ou>ve determined that the ni"ht menu $orks #ro#erl%( carefull% chan"e the ;oto1fTime test to be the time %our reall% $ant to use in #roduction! Summar%: :ou learned 1! 8o$ to im#lement time-based o#erations usin" ;oto1fTime )* Sam#le Solution: /unkno%n0 4 $!t h !ny un!ssigne" num#er !n" route it to the proper menu. e@ten <( AX.,1,9otoI7.ime (9?L0-16?29,mon-7ri,=,=M"!ymenu,s,1) e@ten <( AX.,n,9oto(night-menu,s,1)

!6 + :'ontrol $oursel-: Loo# 'ontrol In Menus1

Module !6 : Lab + *ime Limit: &6 Minutes &ver $onder ho$ man% times %ou could ask dad 2Are $e almost there %etG3 before he sto##ed the car( "ot out( and set on the side$alk to com#lete the Lourne% on footG Well( thus far once somebod% "ets into an Automated Attendant( there>s no "ettin" rid of them until the% han" u#! And if %ou ha##en to "et a 2hun" trunk3 %ou could $ind u# $astin" an Asterisk resource needlessl%! To #revent this( $e need to introduce a means of controllin" the number of loo#s our menus $ill do before "ivin" u# in dis"ust! The solution is more fun $ith Asterisk dial#lan e0#ressionsF Ste# !: Revie) $our Menu 6irst( take a look 4a% Menu! Looks "ood( ri"htG Well( #erha#s! 'ut it $ould be even better $ith loo# control! The trick is to count the number of times the caller has been throu"h the menu and either entered an invalid value or allo$ed the #rom#t to time-out! once the caller has failed to do their thin"( #erha#s three times( $e need to "ive u#! +o$ before %ou "et rude and sim#l% do the 8an"u#)* thin"( consider that in some case the caller is not ho#elessl% ine#t! 1t could be an e,ui#ment issue )their #hone doesn>t su##ort 4TM6( the Po1? service %our are usin" doesn>t su##ort 4TM6( etc* or it could be a lan"ua"e issue! 1n some cases %ou mi"ht consider usin" the Transfer a##lication to send the a##arentl% befuddled caller to a live o#erator! Ste# &: En(ance $our Menu &dit %our menu to kee# count of the tries the caller e0#erienced! 1f the tr% count "oes over 3( #olitel% han" u# on them! )i! e! #la% 2Thank %ou! ;oodb%e3 rather than 2'eat it( moron3*! 5se a counter variable( the 1 and t e0tensions( and an e0#ression to build %our lo"ic! Tr% 1 on %our o$n before %ou look at the solution belo$! Ste# 3: *est $our '(anges Eeload and test %our menu! 1f %ou "et kicked out after 3 tries( %ou>re doin" the ri"ht thin"! 1f not( %ou need to check %our code! 1f all else fails see the e0am#le belo$! Sam#le Solution: =day-menu> e.ten ?0 sF%F+ns1er BC e.ten ?0 sFnFSet B8RI7S?)C e.ten ?0 sFnFGait B%C e.ten ?0 sFnFBplaybackCF 6ackground Bday-menuC e.ten ?0 sFnFBGait7.ten B'C e.ten ?0 %F%F5otoBinsideF#))%F%C e.ten ?0 &F%F5otoBinsideF#))&F%C e.ten ?0 !F%FEeetEe BGashingtonFdC e.ten ?0 !FnF;angup BC

e.ten ?0 *F%F@irectory Bdefault , usersC include ?0 inside e.ten ?0 hF%F9o2p BShucksF they hung upIC e.ten e.ten e.ten e.ten e.ten e.ten e.ten e.ten e.ten e.ten ?0 ?0 ?0 ?0 ?0 ?0 ?0 ?0 ?0 ?0 tF%FPlayback Bim-sorryC tFnFSet B8RI7SC ? J=JK8RI7SL M %> tFnF5otoIf BJ=JK8RI7SL 0 &>NtF disconnectC tFnF5otoIf BsFplaybackC tFnFBdisconnectCF Plackback BgoodbyeC tFnF ;ungup BC iF %F Playback Bim-sorryC iF nF Set B8RI7S? J=JK8RI7SL M %> iFnF5otoIf BJ=JK8RI7SL 0 &>NtF disconnectC iFnF5otoIf BsFplaybackC

Asterisk Advanced Lab Assignment Module !!


Adding An Analog and Digital Pat(: DAHDI Analog P(one Analog Lines ;8S vs ;8= *!GE! PRI

!! !" Adding An Analog and Digital Pat(

Module 11 Lab 1 Time Limit: 4/ Minutes At this #oint have a $orkin" s%stem $ith man% features! +e0t $e are "oin" to add an additional set of connections -one to add an additional set of connections- one to ?-.T tele#hone )"ivin" %ou three #hones on %our desk* an one to an analo" line! We>ll also confi"ure the T1@&1 card! At the end of the lab %ou should be able to confi"ure the @etc@dahsi@s%stem!conf and @etc@asterisk@chanDdahdi!conf files for %our analo" card( direct incomin" calls cross the analo" line to %our ne$ automated attendant( and route a subset of out"oin" calls over the ne$ lines! Ste# !: 'on-iguring DAHDI Eemember that 4A841 is a se#arate #roLect from Asterisk ! 4A841 is actuall% a set of kernel drivers for the Wildcard series of tele#hon% cards! 4A841 is used no onl% b% Asterisk but also b% a number of other tele#hon% #roLects and #roducts! The confi"uration file for 4A841 is the one core file $hich is +-T stored in the @etc@asterisk folder! 'ecause it is from a se#arate #roLect and is a kernel confi"uration files( the 4A841 file )s%stem!conf* is stored in @ etc@ dahdi! 'e"in b% editin" the 4A841 confi"uration file as follo$s! .croll do$n until %ou reach a section $hich looks like: #8he channel list is a comma-separated list of channels or rangesF for # e.ampleO Add the follo$in" lines: span9 1$1$!$esf$b Ts bchan91-2C dchan924 fxoks92" fxsks92 echocanceller9mg2$1-24$2"$2 +o$ save %our file and e0it! :ou have Lust told 4A841 that %our s%stem includes t$o analo" #orts! ?ort 9/ is an 67. #ort $hich uses 67- si"nalin" to talk to and analo" #hone! ?ort 9C is an 67- #ort that uses 67. si"nalin" to talk to an analo" line! heck that driver for card is alread% loaded into memor% b% the 4A841 startu# s%stem! At the Linu0 command line( do the follo$in": # )smod / grep dahdi :ou should see an entr% for $ctdm9400#( $hich is the kernel driver for the analo" card %ou have installed in %our s%stem! :ou should also see the 4A841 driver listed( $hich is the master device for the 4A841 interface! 1f %ou are missin" either of these drivers %ou $ill need to check %our confi"uration( use mod#robe to load the re,uired modules and tr% a"ain! 1f all $ell( %ou can re,uest a reload of the 4A841 s%stem b% t%#in": # dahdi#cfg &,,,

4A841>s dahdiDcf" utilit% $ill reload the confi"uration and $ill dis#la% a channel ma#! :ou should see %our t$o channels loaded! :ou can further validate the channel confi"uration usin" the dahdiDtool command! # dahdi#tool The s%stem $ill dis#la% a dia"nostic utilit% $hich allo$s %ou to check the alarm status and confi"uration of the card! 1f the card is not in an alarm state( %ou>re read% to "o on! Ste# &: 'on-iguring Asterisk -or %our DAHDI c(annels +o$ %ou need to confi"ure the 4A841 channel driver b% editin" the chanDdahdi!conf file in the @etc@asterisk director%! We need to add some sim#le entries for %our analo" and di"ital #orts! .croll do$n throu"h the file until %ou see: =channels> 3 3@efault language 3 3@efault conte.t 3 Conte.?default 1f %ou like( %ou ma% remove 2conte0tO default3( but even if %ou do not( %our 2conte0tOusers3 belo$ $ill override the #revious 2contestO3 statement! 1n chanDdahdi!conf( the most recent statements al$a%s a##l% $hen a channel is created $ith the 2channelO<3 statement! Add the follo$in" immediatel% belo$: group?% conte.t?users signaling?f.oPks callerid?Q6ob +nalogQ R#))!0 mailbo.?Q#))!Q call1iting?yes three1aycalling?yes transfer?yes channel ?0 &' group?& conte.t?fromPoutside signaling?f.sPks callerid?asreceived call1aiting?no channel ?0 &" 3 configuration for 8% card Bas PRIC 5roup ? ! echocancel?yes echocancel1henbridged?no

echotraining?yes s1itchtype?'ess conte.t?fromOoutside signaling?priPcpe channel ?0 %-&! 3 note that 1e donSt include the d-channel 3 in chanPdahdi conf +otice that the first analo" channel( the 67.( #ort connected to the #hone( is assi"ned to "rou# 1( $hile the line channel is assi"ned to "rou# 9! +ote also the conte0ts: the line channel is set to send calls into the MfromDoutsideN conte0t $hile the station channel sends calls to the MusersN conte0t! The 2default3 conte0t $ould onl% be used at all if a ne$ channel is declared above %our first channel! .ave %our confi"uration files and restart Asterisk! .ome chan"es to 4A841 are onl% a##lied $hen Asterisk is restarted )such as si"nalin" chan"es or addin" channels*( but other $ill be a##lied b% a confi"uration Asterisk can actuall% fail to load( or in some cases the 4A841 module can fail to load! )This means %ou don>t $ant to be makin" chan"es to the 4A841 confituration on a live s%stem durin" business hoursF* Ste# 3: ,sing *(e Analog P(one The analo" #hone is no$ another #hone on %our ?'7! :ou need to create an e0tension to send calls to this #hone! 5se e0tension number B003 and confi"ure the ne$ e0tension!conf and in voicemail!conf! 5se the "rou# name: 4A841@;1 The user associated $ith this line is 'ob Kohnson! ?lease "ive 'ob voicemail( "ive him access to lon"distance! Ste# +: ,sing *(e Analog Line :ou can send out calls on %our analo" line as $ell! Alter %our dial #lan to use the analo" line for local calls! Eemember that %ou #robabl% $ant use the 4A841 line "rou# )9* in case %ou add another analo" trunk line in the future! 4A841@;9@Znumber to dial< Ste# /: 'alling In =n *(e Analog Line alls sent into conte0t 2fromDoutside3 on a ?-T. line do not have a number sent alon" $ith the call! The 2s3 start e0tension is activated! Add the follo$in" to %our e0tensions!conf /from#outside0 1 'ath analog %/o destination number send it to our QmainR number. exten 9* s$ 1$ Joto 26!!!$181 %ill end up at /unkno%n0 and go into the menu include 9* inside include 9* unkno%n

5se one of %our #hone( a classmate>s #hone( or one of the #hones on the front table to dial %our analo" line at: 1 I00 /// 4477 )$here 77 is the number 01 -94* for %our station! :ou should reach %our automated attendant! Test out the features %ou have set u#! Ste# /: '(ecking t(e *! connection The first ste# to makin" the T1 connection is $orkin" is to check to make sure the link is out of alarm! 6rom the Linu0 command-line( run the dahdiDtool utilit% and check to make sure there are no alarms on the T1 card! )1f %ou don>t "et the card out of alarm( %ou>ll never "et Asterisk $orkin" $ith it!* -nce the card is out of alarm( "o back into Asterisk and t%#e 2#ri sho$ s#an 13! 1t should sho$ that %our T1 s#an is #rovisioned( out of alarm( and that the 4 channel is u#! 1f not( %ou #robabl% have a #roblem $ith %our chanDdahdi!conf confi"uration files! Ask %our instructor to hel# %ou troubleshoot the #roblem! -nce %our ?E1 is u# and lookin" "ood( alter %our dial#lan so that MlocalN calls are all sent across the T1 link: /loca0 exten 9* #.666666$1$ 2same as before8 exten 9* #.666666$n$ 2same as before8 exten 9* #.666666$n$ =ial 2=><=)/gC/UV-63-.W exten 9* #.666666$1$ 2same as before8 exten 9* #.666666$n$ 2same as before8 exten 9* #.666666$n$ =ial 2=><=)/gC/UV-63-.W Eeload %our e0tensions and tr% local calls! :ou should see the calls bein" sent across the T1@&1 to the telco server! :ou ma% dial 1I00-977-B000 to send calls from the telco to %our T1( $here 77 is %our station number! )1f %ou station number is less than 10( add a 0 to %our station number! 6or e0am#le( station one $ould dial 1I00-901-B000!* Summar%: :ou learned the follo$in": 1! 8o$ to confi"ure both 4A841 and Asterisk>s chanDdahdi confi"uration files! 9! That an analo" ?-T. line send calls to the Js> e0tension is the conte0t s#ecified in chanDdahdi!conf and that %ou can then send this to %our Automated Attendant usin" lo"ic alread% #resent in %our dial#lan! 3! 8o$ to confi"ure Asterisk for the T1@&1 card! 4! 8o$ to route calls do$n a #articular channel "rou#!

Asterisk Advanced Lab Assignment Module !&


Advanced Dial#lan ;eatures: Macros AstD7 S)ic(es 'all ;iles

!& !" Sim#li-%ing *(e Dial#lan 9it( Macros Module 19 Lab 1 Time Limit: 30 Minutes +ote: Tr% to do this lab $ithout referrin" to the sam#le solution on the back of this #a"e until %ou have a $orkin" solution of %our o$n! 1n this lab %ou $ill re#lace the multi-#riorit% e0tensions %ou have created for %our users )e0tensions B001( B009 and B003* $ith a macro $hich #rovides the same set of enhanced services! This standar user macro )named stduser* $ill "ive all users voicemail and $ill #ro#erl% handle the full ran"e of 41AL.TAT5. return values! +ote that this macro is Lust the be"innin"! 5ltimatel% it $ill be e0#anded to offer additional features! The standard user macro is a "reat #lace to im#lement features! Ste# !: 7uilding $our Macro 5sin" the notes from the lecture( construct a macro called stduser! 1nclude the user>s device )i!e!.1?@device( 4A841@device( etc!* as the first ar"ument! .ince the mailbo0 number is the same as the e0tension number( %ou should be able to use the MA E-D&7T&+ variable to e0ecute the #ro#er mailbo0! Ste# &: Invoking *(e Macro :our user e0tensions )B001-B003* no$ need to be sim#lified to use the macro %ou built! Alter all three of these e0tensions to invoke the stduser macro( #assin" the necessar% ar"uments! Ste# 3: *est $our '(anges Test %our chan"es b% callin" each device! Test the follo$in" conditions: Ans$er( +o Ans$er( 'us%( 5navailable )un#lu" the device*! +ote that in man% cases it is difficult to "et #hones to return a 41AL.TAT5. of '5.: if the% su##ort multi#le a##earances )i!e! %our .1? #hones* or all Waitin"@3Wa% allin" )i!e! %our analo" #hone*! Ste# +: Revie) $our Solution Eevie$ %our solution a"ainst the sam#le solution belo$! +ote that there is not necessaril% a sin"le Jbest> solution Asterisk su##orts man% $a%s of accom#lishin" the "oals! Sam#le Solution: /inside0 exten 9* 6!!1$1$ Iacro 2stduser$ 4)7/ts#xlite8 exten 9* 6!!2$1$ Iacro 2stduser$ 4)7/::#polycom8 exten 9* 6!!C$1$ Iacro 2stduser$ =><=)/2"8 /macro-stduser0 exten 9* s$1$.o+p 24tandard ?ser 'all 3o U VI>'A+#-63-.W on U V>AJ1W8 exten 9* s$n$=ial 2UV>AJ1$2!W exten 9* s$n$.o+p 2U V=)>(43>3?4W8

exten exten exten exten exten exten exten exten exten exten exten exten exten exten exten exten exten exten <otes

9* 9* 9* 9* 9* 9* 9* 9* 9* 9* 9* 9* 9* 9* 9* 9* 9* 9*

s$n$Joto)f 2U/UVQ=)>(43>3?4WR 9 Q.+>.4F-AR0X ?.>P>)(8 s$n$Joto)f 2U/UVQ=)>(43>3?4WR 9 Q'<>.?.>P>)(R0X ?.>P>)(8 s$n$Joto)f 2U/UVQ=)>(43>3?4WR 9 Q'+.J-43)+.R0X ?.>P>)(8 s$n$Joto)f 2U/UVQ=)>(43>3?4WR 9 Q'>.'-(R0X<?.J?78 s$n$Joto)f 2U/UVQ=)>(43>3?4WR 9 QE?4YR0XE?4Y8 s$n$Joto)f 2'+.J-438 s$n$2?.>P>)(8$ >ns%er 28 s$n$Fait 2!."8 s$n$PoiceIail 2UVI>'A+#-63-.WNdefault$ u8 s$n$<angup 28 s$n$2E?4Y8$ >ns%er 28 s$n$Fait 2!."8 s$n$PoiceIail 2UVI>'A+#-63-.WNdefault$ b8 s$n$<angup 28 s$n$2'+.J-438$ >ns%er 28 s$n$Fait 2!."8 s$n$'ongestion 28 s$n$2<>.J?78$ <angup 28

The macro starts out usin" +o-# to lo" $hat>s "oin" on! This is "enerall% hel#ful for debu""in"! +e0t the macro dials the device #assed as AE;1 for 90 secunds! The 4ial command has man% o#tional ar"uments( fla"s( etc! To add advanced o#tions like call screenin"( alternate rin"back tones( #re-call macros( and much more( %ou could a##end additional ar"uments to the 4ial command here! 1f all "oes $ell and the call $as ans$ered( the o#eration ends $ith the 4ial #riorit%! 1f not( $e start checkin" various 41AL.TAT5. values! 1n most $e handle the 41AL.TAT5. b% #la%in" the unavailable messa"e! 1f the called #art% $as bus%( $e use the bus% messa"e! 1f $e "et an une0#ected 41AL.TAT5.( $e Lum# to con"estion!

!& &" 'reating ;eatures: D<D )it( AstD7


Module 19 Lab 9 Time Limit: 30 Minutes This lab "ives %ou a chance to tr% out the Ast4' database and to im#rove %our stduser macro b% addin" a 4o-+ot-4isturb feature! While man% .1? #hones include 4+4 as a #hone feature( it is $orth$hile to create a server-side feature( es#eciall% if a user ma% have more than one device! Eemember that features like 4+4 have t$o main com#onents: the activate@deactivate e0tension )s* and the feature state check $hich is e0ecuted #rior to 4ialin" the user>s device! 1n the case of the 4+4 feature( %ou $ill $ant to have an e0tension to activate and a different e0tension to de-activate! To check the feature state #rior to callin" the user>s device )i!e!$hen another user or an outside caller dials the user>s e0tension* sim#l% do the status check in the stduser macro before the 4ial! if the feature is active )i! e! 4+4 is on* "o directl% to the 5navailable voicemail #riorit%! 1t>s im#ortant to #revent abuse! :ou should build the 4+4 feature activation and de-activation e0tensions to onl% turn on@off the feature for the callin" device! To do this( %ou>ll $ant to use a uni,ue user identifier retrieved automaticall% b% the dial#lan! This $a% all the user has to do is dial the activate or de-activate e0tension - no entr% of a user 14 is necessar%! Ste# !: Assign a uniHue value to %our end#oints Add a 2setvar3 statement to each of %our users devices! 'ecause each user ma% have more than on device )and( in odd circumstances( more than one e0tension* %ou should not use the device name or the e0tension number as the uni,ue identifier! 1t is "enerall% "ood to use a uni,ue value $hich identified the ?&E.-+ )i!e! first initial( last name: ssokol( an em#lo%ee 14 number( etc!* 6or e0am#le( for %our ?ol%com .1? #hone %ou $ould edit the si#!conf file and add a line to %our MLLD#ol%comN section that sa%s: Setvar?AS7RI@?HHones 4on>t for"est to add this for %our analo" #hone as $ell! Eeload the Asterisk confi"uration so that the settin"s take effect! ?lease no that the uni,ue 14s %ou assi"n here must match u# $ith the ar"uments to the macro that %ou define in ste# 3! Ste# &: 'reating An ActivateGDesactivate Extension reate t$o ne$ e0tensions in %our MfeaturesN conte0t! 5se BI01 to active 4+4 and BI09 to deactivate 4+4 )in most #roduction s%stems %ou>ll $ant to use the U ke% #lus di"its( but for sim#licit%>s sake $e $ill use four-di"it numbers startin" $ith B or our features*! BI01 should ans$er( set a fla" in the database based on the caller>s 5.&E14 channel variable! )Eemember( onl% inside users should have access to the MfeaturesN conte0t*! BI09 should either set the value to an 2off3 value or delete the ke% to indicate that feature is no active!

Ste# &: 'reating An ActivateGDesactivate Extension reate t$o ne$ e0tensions in %our MfeaturesN conte0t! 5se BI01 to active 4+4 and BI09 to deactivate 4+4 )in most #roduction s%stems %ou>ll $ant to use the U ke% #lus di"its( but for sim#licit%>s sake $e $ill use four-di"it numbers startin" $ith B or our features*! Ste# 3: Alter $our Standard ,ser Macro han"e the user>s actual e0tensions )B001( B009( B003* to #ass the uni,ue user 14 to the macro es an additional ar"ument! Eemember that these must match u# $ith the uni,ue user 14s %ou added to the channel driver confi"urations in ste# 1! han"e the standard user macro to obtain the 4+4 value from the database usin" the uni,ue id )X WAE;9Y as the ke% to read 4+4 feature value from the database! )Eemember $e>re doin" this to check the 4+4 status for the callin" #art%!* This must be done #rior to the 4ial #riorit%! 1f the feature is active( ski# the 4ial command and send the caller directl% to the user>s voicemal! Ste# +: *est $our '(anges :ould be able to dial BI01 from an% of %our user devices and activate 4+4( and BI09 to disable 4+4! 1f %ou call to another user $ho has 4+4 activated( %ou should immediatel% "et voicemail! 1f %our results are not $hat %ou e0#ect( check the values from the L1 usin" the L1 database commands! Ste# /: 'om#are $our Solution 9it( Sam#le Solution om#are %our solution $ith belo$! +ote that there is no 2ri"ht3 $a% to build features in Asterisk( so %our solution )if $orks* is Lust as valid as the sam#le! Sam#le Solution: 1n si#!conf and chanDdahdi!conf )and ia0!conf( if a##licable* add the follo$in" to each user )friend* or channel definition: set,ar9?4-A)=9 /uniLue id0 1n e0tensions!conf( add the follo$in" e0tensions to %our features conte0t: /features0 exten9* 6 !1$ exten9* 6 !1$ exten9* 6 !1$ exten9* 6 !1$ exten9* 6 !1$ exten9* exten9* exten9* exten9* exten9* exten9* 6 6 6 6 6 6 !2$ !2$ !2$ !2$ !2$ !2$ 1$ n$ n$ n$ n$ 1$ n$ n$ n$ n$ n$ >ns%er 28 Fait 2!."8 4et 2=E 2users/UV?4-A)=W/=.=8918 7layback 2enabled8 <angup 28 >ns%er 28 Fait 2!."8 Iacro 2getmy?ser)=8 4et 2=E 2users/UV?4-A)=W/=.=89!8 7layback 2disabled8 <angup 28

+o$ alter user e0tensions to #ass the matchin" uni,ue 14 for the user( as set in ste# 1: /inside0 exten9* 6 !1$ 1$ Iacro 2stduser$ 4)7/ts#xlite$stmisth8 exten9* 6 !2$ 1$ Iacro 2stduser$ 4)7/::#polycom$ ::ones8 exten9* 6 !C$ 1$ Iacro 2stduser$ =><=)/2"$b:onson8 +o$ alter %our standar user macro to check the database for 4+4 status: /macro-stduser0 exten9* s$1$ .o+p 24tandard ?ser 'all 3o U VI>'A+#-63-.W on U V>AJ1W exten9* s$n$ Joto)f 2U/=E 2users/UV>AJ2W/=.=8WR 9 Q1R0X ?.>P>)(8 exten9* s$n$ =ial 2>AJ1W$2!8 exten9* s$n$ Joto)f 2U/QUV=)>(43>3?4WR 9 Q.+>.4F-AR0X ?.>P>)(8 exten9* s$n$ Joto)f 2U/QUV=)>(43>3?4WR 9 Q'<>.?.>P>)(R0X ?.>P>)(8 exten9* s$n$ Joto)f 2U/QUV=)>(43>3?4WR 9 Q'+.J-43)+.R0X ?.>P>)(8 exten9* s$n$ Joto)f 2U/QUV=)>(43>3?4WR 9 Q'<>.J-(R0XE?4Y8 exten9* s$n$ Joto) 2'+.J-438 exten9* s$n$ ?.>P>)($ >ns%er 28 exten9* s$n$ Fait 2!."8 exten9* s$n$ PoiceIail 2UVI>'A+#-63-.WNdefault$ u8 exten9* s$n$ <angup 28 exten9* s$n$ 2E?4Y8$ >ns%er 28 exten9* s$n$ Fait 2!."8 exten9* s$n$ PoiceIail 2UVI>'A+#-63-.WNdefault$ b8 exten9* s$n$ <angup 28 exten9* s$n$ 2'+.J-438$ congestion 2"8 exten9* s$n$ <angup 28 <otes :ou can a##l% the same #rinci#al to man% different features: call for$ardin"( call recordin"( call screenin"( etc! 6or a much more involved vie$ of features( see Module 11 Lab B! 1t im#lements man% of the most commonl% re,uested ?'7 functions usin" the same structure!

!& 3" Remote Processing 9it( S)itc( Statements


Module 19 Lab 3 Time Limit: 10 Minutes .$itches are "reat if %ou $ant to out-source some )or even all* of %our dial#lan to another Asterisk server so lon" as %ou use 1A79! A s$itch statement effectivel% includes the remote dial#lan in %our dial#lan )much like an include statement adds one conte0t into another*! A #rime use: buildin" ver% sim#le remote devices for use at customer locations! 6or e0am#le( ima"ine a service #rovider $ho $ants to re#lace the telco for local and lon" distance callin" on a le"ac% ?'7! The le"ac% ?'7 is likel% #ro"rammed to send an% call the is no on-s$ith )i!e! a local e0tension* offs$itch over a T1! .o the 1T.? sim#l% builds small Asterisk service $ith a T1 card( an &thernet #ort and dial#lan that looks like this: /from-legacy-cpe0 s%ich9* )>62/customerKKH /super,oipkey0Nsuper,oip/UV-63-.WNmaster All he then has to do is set u# the chanDdahdi confi"uration for the T1 to send all calls to the from-le"ac%c#e conte0t and all out"oin" calls are for$arded to his 1A7 server via 1A79 trunkin" for further #rocessin" )such as least-cost-routin"( screenin"( etc!* 6or this lab( $e alter %our dial #lan to s$itch calls to our server! The server has been confi"ured to handle all 1!A00!+77!7777 numbers )rather creativel%*! .oS Ste# !: 'reate An ,nlimited 'ontext reate an MunlimitedN conte0t to include a s$itch statement to send calls as sho$n belo$! 'e sure to confi"ure it to include the international or lon"distance conte0t( so that %ou can call somethin" other than 1-A00 numbers! 1n %our statement( the secret )but not the username* ma% come from the MtoDia0#roviderN section in %our ia0!conf! Eemember to chan"e 7 to %our trainin" number! s%ich9* )>62/training6Nto#iaxpro,ider/unlimited

Ste# &: Set A P(one *o ,nlimited


Alter one of %our #hone )b% chan"in" its conte0t statement in si#!conf( chanDdahdi!conf( or ia0!conf* to send calls to the unlimited conte0t! 1l $ill be most interestin" if %ou do this $ith %our 4A841 analo" #hone and $atch the 1A7 traffic sent from %our s%stem to the 1A7 #rovider as %ou #ress di"its on the 4A841 #hone! To see the traffic( enable 1A7 debu""in" in the L1( and remember to turn it back off $hen done! Ste# 3: *est $our Solution 4ial a A00 number and see $ath Allison has to sa%! 6or those not familiar $ith 5. A00 numbers( the% are 2hi"h char"e3 numbers used to im#lement #hone services! .ome A00 numbers have le"itimate #ur#oses )e!"!#a%-#er-incident or #a%-#er-minute tech su##ort* but most are used for some$hat more ,uestionable services! Sam#le Solution: /unlimited0 4%itch9*)>62/training6Nto#iaxpro,ider/unlimited )nclude 9* international

!& +" DIDs: Direct Access *o Peo#le and Services


Module 19 Lab 4 Time Limit: 1/ Minutes We alread% demonstrated the 414 conce#t $hen $e set u# %our .1? and 1A7 trunks in Modelo C! +o$ let>s look at fe$ more e0am#les! 414s im#rove the caller>s e0#erience b% eliminatin" the middle-men )menus( o#erators( etc!* and "ivin" direct access to a s#ecific #erson or service! 'oth .1? and 1A7 al$a%s #ass a called number - the e0tension or user the caller $ants reach! 1n the u#comin" 4i"ital Tele#hon% lab $e $ill confi"ure T1 or &1 1.4+-?E1 circuits( $hich also make use of 414 )also kno$n as 4+1.* numbers to identif% services! We>re "oin" to use %our trainin" number a #ortion of the ke%! 1n addition to the numbers %ou alread% had in the Modulo C labs ).1? Inn-B000 and 1A79 Cnn-B000*( each student "ets a block of / 414 numbers from %our 2.1? 1.?3 and another / numbers from %our 21A79 1T.?3! :our challen"e is to assi"n them as follo$s: .1?: C00H///H MTrainin" +umber )$ith a leadin" 0 if the number is less than 10*NH M11-1/N 1A79: I00H/H MTrainin" +umber )$ith a leadin" 0 if the number is less than 10*NH MB000-B004N &0am#le: Trainin" number 00 SIP DIDs C00 /// 0011 C00 /// 0019 C00 /// 0013 C00 /// 0014 C00 /// 001/ Service Main Menu MeetMe Washin"ton 4irector% .ales [ueue .u##ort [ueue IA8& I00 /00 B000 I00 /00 B001 I00 /00 B009 I00 /00 B003 I00 /00 B004 Service Main Menu Tom - B001 Koe - B009 'ob - B003 PoicemailMain ) heck Mail*

Ste# !: 7uild DID Extensions 1n %our Mfrom-outsideN conte0t( add e0tensions to match the assi"ned 414 numbers! 5nlike %our earlier seven di"it numbers $hich sent onl% the last four di"its to %ou( ne$ numbers send %ou ten di"its! :ou can use either full matches or #attern matches( de#endin" on the block of numbers! :ou do not %et have "ueues! 6or no$( Lust direct C00 /// AA14 and C00 /// AA1/ to the non-e0istent ,ueues usin" the a##lication [ueue )sales* and [ueue )su##ort* and remember to test them durin" Lab 14! Ste# &: *est $our Solution 5se %our #hone to first call %ou o$n service@funcions! -ne %ou>re sure %our o$n confi"uration is $orkin"( tr% callin" others in the class usin" their trainin" number! :ou should be able to dial all devices in the room directl% usin" the 414 I00 #attern( and all services usin" the C00 #attern! Ste# 3: 'om#are $our Solution 9it( *(e Sam#le Solution om#are %our solution $ith sam#le belo$! +ote that there are multi#le $a%s of achievin" the same results( none of $hich is the 2ri"ht3 ans$er! -ne item to kee# in mind: usin" ;oto can result in some ver% confusin" 4E records( so if billin" is an issue for %our im#lementation( %ou ma% $ant to have the 414 numbers invoke macros( services( etc!( directl% rather than throu"h a ;oto!

Sam#le Solution: 6or the #ur#oses of this sam#le( $e have used AA a"ain as the trainin" number! /from#outside0 exten9* !!"""KK11$1$Joto 26!!!$181 %ill get caught by#6. in /unkno%n0 exten9* exten9* exten9* exten9* !!"""KK12$1$IeetIe 2IeetIe 2Fashington$ d8 !!"""KK1C$1$=irectory 2default8 !!"""KK14$1$Zueue 2sales8 !!"""KK1"$1$Zueue 2support8

exten9* #7!!"KK6!! /1-C0$1 Joto 2UV-63-.H6W$11 reduce to 4 digits exten9* 7!!"KK6!4$1$ PoicemailIain2Ndefault8 include 9* inside include 9* unkno%n /unkno%n0 exten9* #6.1$ Joto3ime 2KH!!-17H!!$mon-fri$@$@X =ay-menu$s$18 exten9* #6.2$ Joto 2night-menu$s$18

!& /" 'all ;iles: Automated =utbound 'alling


Module 19 Lab / Time Limit: 1/ Minutes all files #rovide an eas% $a% to "enerate out"oin" calls! Kust about an #ro"rammin" or scri#tin" lan"ua"e is ca#able of creatin" these sim#le te0t files! 1n this lab( $e $ill create a file b% hand! Ste# !: 'reating An Announcement Extension .tart off b% creatin" a ne$ e0tension in a ne$ MservicesN conte0t! This is the e0tension that the call is sent to on a successful ans$er b% the far-end #art%! The e0tension sim#l% needs to ans$er the call( #la% a brief( informative announcement )or commercial messa"e( if %ou must* then han" u#! Ste# &: 'reate A 'all ;ile *em#late .o %ou don>t have to re-t%#e the entire call file each time( start out b% creatin" a tem#late! 5se %our favorite editor )vi( emacs( nano( "edit( etc!* to create a ne$ te0t file in @var@s#ool@asterisk name call!t0t! use the follo$in" #arameters: hannel: :our choice! 8ave it dial one of %our devices or( for fun( an outside number )don>t make a a #est of %ourself or "et us in trouble b% crank-callin" the White 8ouse*! onte0t: &0tension: ?riorit%: .ervices M:our ne$ announcement e0tensionN 1

.et the other o#tions to taste! -nce %ou have created the tem#late( save it! Ste# &: 'reate A 'all ;ile *em#late +e0t( use the Linu0 co#% command )c#* to #roduce a co#% of the file: cp call.txt UU. txt XX is a s#ecial 5ni0 construct that makes a some$hat uni,ue name( usin" %our #rocess id!

+o$ use the linu0 move command )mv* to relocate the file to the out"oin" director%: mm UU.txt /,ar/spool/asterisk/outgoing +o$ %ou can #roduce co#ies of the tem#late file( edit the co#%( alter the hannel field( and move %our altered co#% into the out"oin" folder! <ote Eemember that the hannel field isn>t Lust for directl% connected devices )such as %our .1? or 4A841 devices*! 6or the first le" of the call %ou ma% also s#ecif% a channel name $ith an outside number( for e0am#le( .1? @1C1B///1934RtoDsi##rovider( to send calls almost an%$here! 8o$ver( %ou should be sure to use a service $hich #rovides #ro#er ans$er su#ervision( so that the second %ou should be sure to use a service $hich #rovides #ro#er ans$er su#ervision( so that the second le" of the call doesn>t start until the first le" ans$er! this means a ?-T. line is no a "ood choice!

'(allenges hallen"e 1: 5se the local channel to sim#lif% the #rocessin" of the outbound le" of the call! hallen"e 9: reate a scri#t )shell( ?8? or ?erl* or a number as the #arameter! a##lication to "enerate calls( takin" Lust a #hone

hallen"e: 5se the .%stem )* a##lication to #rovide an e0tension )#ut it in MfeaturesN $hich( $hen called( $aits for the caller to han"( and then rin"s the caller>s #hone back( #rovidin" a rin"er test( a feature ever% #hone s%stem should have!

!& 2" Providing Personal Services 9it( Asterisk


Module 19 Lab B )-#tional - Advanced* Time Limit: 190 Minutes :our ?'7 has e0#anded over the #ast four da%s to include a number of e0tensions( .1? and 4A841 connections to the outside $orld( an automated attendant and several features! +o$ $e>re "oin" to add 2#ersonal features3! ?ersonal features )as o##osed to s%stem features* control ho$ individuals make and receive calls! .ome common #ersonal features are: Ste# !: List =- ;eatures

Poicemail: 1s this user a voicemail subscriberG Turn PM on@off on a user-b%-user basis!


all for$ard on 'us%: 6or$ard the call to another destination if the called account returns bus%! all for$ard on Ein"-+o-Ans$er: for$ard calls the call is not ans$ered )instead of "oin" to voicemail*! all for$ard unconditional: for$ard all calls $ithout e0ce#tion! 4o-+ot 4isturb: send all calls directl% to voicemail )if the called #art% is a voicemail subscriber* or to an 2unavailable3 messa"e )if not*! Last +umber Eedial: re-dial the last number dialed! Eeturn Last all: dial-back to the last number called! ?ersonal .#eed 4ials: short dial codes for commonl% called numbers! Eecord All alls: automaticall% record all calls! ?ersonal conference Eoom: a #ersonal conference brid"e for each user! 6ind-Me@6ollo$-Me: rin" a number of devices in a "iven se,uence! all screenin": force callers to identif% themselves!

Ste# &: 'reating $our ;eatures :our features $ill all be im#lemented b% au"mentin" standard user macro( addin" Ast4' entries for the various feature states )active( disabled( etc!* and feature date )most recentl% called number( most recent callin" number( etc!* :ou $ill also need to add feature e0tensions to activate and deactivate feature values in some cases-for$adin"( s#eed dial( find me @ follo$ me( etc!* .ome of %our features affect incomin" calls to the user )calls $hich #ass throu"h the standard user macro* $hile others are related to out"oin" calls! :ou $ill $ant to create an additional macro to handle out"oin" calls )to ca#ture last number dialed( to activate call recordin"( etc!* This lab can actuall% take several hours( de#endin" on the number of features %ou choose to create! 1t is often a "ood idea to create a call-flo$ dia"ram( or at least an outline before %ou be"in buildin" features! The order in $hich the features are #rocessed )i!e!4+4 is checked first and overrides all other features( unconditional for$ardin" is handled ne0t( etc!* is critical and should be $ell documented! Summar%: :ou learned the follo$in": 1! 8o$ to im#lement #ersonal features! 9! 8o$ to use the Ast4' functions and a##lications 3! 8o$ to build advanced macros

Sam#le Solution: reate the ne$ stduser macro!


/macro-stduser0 exten9* s$1$4et2=e,ice9UV>AJ1W exten9* s$n$4et2?ser)=9UV>AJ2W 1Poicemail 4ubscriber exten 9* s$n$4et 2=.=4tatus9U/QV=E2user/UV?ser)=8W/PIWR 9 Q1R08 exten 9* s$n$.o+p 2=.=H9UV=.=4tatusW8 1?nconditional Bor%arding exten9*s$n$4et2B?4tatus9U/QV=E2user/UV?ser)=8W/BF=/?nc/4tatus8WR9Q1R08 exten 9* s$n$.o+p 2Bor%ard ?nconditional 4tatusH UVB?4tatusW8 exten9*s$n$4et2B?.umber9UV=E2user/UV?ser)=8W/BF=/?nc/.umber8W8 exten9*s$n$.o+p 2Bor%ard ?nconditional .umberH UVB?.umberW8 1Bor%ard +n Eusy exten9*s$n$4et2BE4tatus9U/QV=E2user/UV?ser)=8W/BF=/busy/4tatus8WR9Q1R08 exten 9* s$n$.o+p 2Bor%ard busy 4tatusH UVBE4tatusW8 exten9*s$n$4et2BE.umber9UV=E2user/UV?ser)=8W/BF=/busy/.umber8W8 exten9*s$n$.o+p 2Bor%ard A.> .umberH UVBA.umberW8 1Bor%ard +n &.o->ns%er exten9*s$n$4et2BA4tatus9U/QV=E2user/UV?ser)=8W/BF=/A.>/4tatus8WR9Q1R08 exten 9* s$n$.o+p 2Bor%ard A.> 4tatusH UVBE4tatusW8 exten9*s$n$4et2BE.umber9UV=E2user/UV?ser)=8W/BF=/A.>/.umber8W8 exten9*s$n$.o+p 2(ast =ialed .umberH UV(=.umberW8 1(ast =ialed .umber exten9*s$n$4et2(=.umber9UV=E2user/UV?ser)=8W/(=.umber8W8 exten9*s$n$.o+p 2(ast =ialed .umberH UV(=.umberW8 1(ast 'alling .umber exten9*s$n$4et2('.umber9UV=E2user/UV?ser)=8W/('.umber8 exten9*s$n$.o+p 2(ast 'alling .umberH UV('.umberW8 1Aecord >ll 'alls exten9*s$n$4et2A'4tatus9U/V=E2user/UV?ser)=8W/Aecord8WWR9Q1R08 exten9*s$n$.o+p 2'all Aecording 4tatusH UVA'4tatusW8 1Bin Ie/Bollo% Ie 4tatus exten9*s$n$4et2BB4tatus9U/QV=E2user/UV?ser)=8W/BinIe8WWR9Q1R08 exten9*s$n$.o+p 2Bind Ie 4tatusH UVBB4tatusW8 1'all 4creening 4tatus exten9*s$n$4et2BB4tatus9U/QV=E2user/UV?ser)=8W/4creen8WWR9Q1R08 exten9*s$n$.o+p 2'all 4creening 4tatusH UV'44tatusW8 1'heck-Bor%ard ?nconditional exten9*s$n$Joto)f 2U/UVB?4tatusW910XB?8

1'heck-=.= exten9*s$n$Joto)f 2U/UV=.=4tatusW910X=.=8 1'all AecordingX exten9*s$n$Jo3o)f 2U/UV=.=4tatusW910XAecordingH.oAecord8 exten9*s$n$2Aecord8$ Ionitor 2%a,8 exten9*s$n$2.oAecord8$ .o+p 2.othing Joing +n...8 1@@@@@@@@@@@@@ =ial 3he 'all @@@@@@@@@@@@@ exten9*s$n$Jo3o)f 2U/UV'44tatusW910X4creenH.o4creen8 exten9*s$n24creen8$ =ial 24)7/U V=e,iceW$2!$p8 exten9*s$n$Jo3o 2'heckstatus8 exten9*s$n24creen8$ =ial 24)7/U V=e,iceW$2!8 exten9*s$n$2'heckstatus8$ Jo3o V=)>(43>3?4W8 exten9*s$n$<angup 28 1 Eusy & 'heck Bor Bor%ard exten9*s$n$2E?4Y8$ Jo3o)f 2U/UVBE4tatusW 9 10XBE8 exten9*s$n$ Jo3o 2PIE8 1 A.> & 'heck Bor Bor%ard exten9*s$n$2.+>.4F-A8$ .o+p 2.o >ns%er8 exten9*s$n$2'>.'-(8$ .o+p 2'ancel8 exten9*s$n$2'+.J-43)+.8$ .o+p 2'ongestion8 exten9*s$n$2'<>.?.>P>)(8$ .o+p 2una,ailable8 exten9*s$n$Jo3o)f 2U/UVBA4tatusW 9 10XPI?8 exten9*s$n$Jo3o 2.oIail8 1 4et the Bor%ard ?nconditional .umber exten9*s$n$2B?8$ 4et 2BF=.umber9UVB?.umberW8 exten9*s$n$ Jo3o 2Bor%ard8 1 4et the Bor%ard Eusy .umber exten9*s$n$2BE8$ 4et 2BF=.umber9UVB?.umberW8 exten9*s$n$ Jo3o 2Bor%ard8 1 4et the Bor%ard A.> .umber exten9*s$n$2BA8$ 4et 2BF=.umber9UVB?.umberW8 exten9*s$n$ Jo3o 2Bor%ard8 1 Iake Bor%ard 'alls exten9*s$n$2Bor%ard8$ 4et 2BF='+.3-639UV4)77--A 2UV>AJ1WH context8W8 exten9*s$n$2Bor%ard8$ 4et VBF=.umberWN UV4)77--A2UV>AJ1WH context8W8 1 <andle =.= exten9*s$n$2=.=8$ .o+p 2PI4tatusH UVPI4tatusW8 exten9*s$n$Jo3o)f $2U/VPI4tatusW9 10XPI? 1 =.= Fithout Poicemail exten9*s$n$2.omail$ >ns%er 28 exten9*s$n$ Fait 2!."8 exten9*s$n$7layback 2sorry8 exten9*s$n$ 7layback 2una,ailable8 exten9*s$n$ <angup28

1 <andle PI exten9*s$n$2PI?8$ >ns%er 28 exten9*s$n$ Fait 2!."8 exten9*s$n$Poicemail U V4)77-A 2UV>AJ1WHmailbox8W$ u exten9*s$n$ <angup28 exten9*s$n$2PIE8$ >ns%er 28 exten9*s$n$ Fait 2!."8 exten9*s$n$Poicemail U V4)77-A 2UV>AJ1WHmailbox8W$ b exten9*s$n$ <angup28 :ou $ill also $ant to build an out"oin" macro $hich ca#tures most recent call information and activates features )like recordin"* on out"oin" calls: /macro-outgoing0 exten 9* s$1 4et 2?ser)=9U V=E 2'han3o?ser/UV'?3 2'<>..-($ -$18W8W8 exten 9* s$n 4et 2=E2users/UV?ser)=W/(=.umber89UVI>'A+#-63-.W8 exten 9*s$n$ 4et 2A'4tatus9 U/QU=E2users/UV?ser)=W/Aecord8WR 9 Q1R08 exten 9*s$n$ .o+p 2'all Aecording 4tatusH U VA'4tatusW8 exten 9*s$n$ Jo3o)f 2U/U VA'4tatusW 9 10X AecordH .oAecord8 exten 9*s$n$ 2Aecord8$ Ionitor 2%a,8 exten 9*s$n$ 2.oAecord8$ .o+p 2.ot Aecording 'all...8 Add the feature activation codes as follo$s: /features0 exten 9* 6"!1$1$>ns%er 28 exten 9* 6"!1$n$Fait 2!."8 exten 9* 6"!1$n$4et 2=E 2user/UV?4-A)=W/=.=891 exten 9* 6"!1$n$7layback 2do-not-disturb8 exten 9* 6"!1$n$7layback 28 exten 9* 6"!1$n$<angup 28 exten exten exten exten exten exten 9* 9* 9* 9* 9* 9* 6"!2$1$>ns%er 28 6"!2$n$Fait 2!."8 6"!2$n$4et 2=E 2user/UV?4-A)=W/=.=89! 6"!2$n$7layback 2do-not-disturb8 6"!2$n$7layback 2off-duty8 6"!2$n$<angup 28

1#### B+AF>A= ?nconditional ######## 1 same number as last time exten 9* 6"!C$1$>ns%er 28 exten 9* 6"!C$n$Fait 2!."8 exten 9* 6"!C$n$4et 2=E 2user/UV?4-A)=W/BF=/?nc/4tatus8918 exten 9* 6"!C$n$7layback 2call-f%d-unconditional8 exten 9* 6"!C$n$7layback 2on8 exten 9* 6"!C$n$<angup 28

1ne% number exten 9* 6"!C$1$>ns%er 28 exten 9* 6"!C$n$Fait 2!."8 exten 9* 6"!C$n$4et 2=E 2user/UV?4-A)=W/BF=/?nc/.umber89U V-63-.HCW8 exten 9* 6"!C$n$4et 2=E 2user/UV?4-A)=W/BF=/?nc/4tatus8918 exten 9* 6"!C$n$7layback 2call-f%d-unconditional8 exten 9* 6"!C$n$7layback 2on8 exten 9* 6"!C$n$<angup 28 exten exten exten exten exten exten 9* 9* 9* 9* 9* 9* 6"!4$1$>ns%er 28 6"!4$n$Fait 2!."8 6"!4$n$4et 2=E 2user/UV?4-A)=W/BF=/?nc/4tatus89!8 6"!4$n$7layback 2call-f%d-unconditional8 6"!4$n$7layback 2off-duty8 6"!4$n$<angup 28

1#### B+AF>A= ?nconditional ######## 1 same number as last time exten 9* 6"1C$1$>ns%er 28 exten 9* 6"1C$n$Fait 2!."8 exten 9* 6"1C$n$4et 2=E 2user/UV?4-A)=W/BF=/busy/4tatus8918 exten 9* 6"1C$n$7layback 2call-for%arding8 exten 9* 6"1C$n$7layback 2on-busy8 exten 9* 6"1C$n$7layback 2on8 exten 9* 6"1C$n$<angup 28 1ne% number exten 9* -6"1C.$1$>ns%er 28 exten 9* -6"1C.$n$Fait 2!."8 exten 9* -6"1C.$n$4et 2=E 2users/UV?4-A)=W/BF=/?nc/.umber89UV-63-.HCW8 exten 9* -6"1C.$n$4et 2=E 2user/UV?4-A)=W/BF=/?nc/4tatus8918 exten 9* -6"1C.$n$7layback 2call-f%d-for%arding8 exten 9* -6"1C.$n$7layback 2on-busy8 exten 9* -6"1C.$n$7layback 2on8 exten 9* -6"1C.$n$<angup 28 exten exten exten exten exten exten exten 9* 9* 9* 9* 9* 9* 9* 6"14$1$>ns%er 28 6"14$n$Fait 2!."8 6"14$n$4et 2=E 2users/UV?4-A)=W/BF=/?nc/4tatus89! 6"14$n$7layback 2call-for%arding8 6"14$n$7layback 2on-busy8 6"14$n$7layback 2off-duty8 6"14$n$<angup 28

1#### B+AF>A= +. A.> ######## 1 same number as last time exten 9* 6"1C$1$>ns%er 28 exten 9* 6"1C$n$Fait 2!."8 exten 9* 6"1C$n$4et 2=E 2user/UV?4-A)=W/BF=/A.>/4tatus8918 exten 9* 6"1C$n$7layback 2call-for%arding8 exten 9* 6"1C$n$7layback 2on-on-ans%er8

exten 9* 6"1C$n$7layback 2on8 exten 9* 6"1C$n$<angup 28 1ne% number exten 9* -6"2C.$1$>ns%er 28 exten 9* -6"2C.$n$Fait 2!."8 exten 9* -6"2C.$n$4et 2=E 2users/UV?4-A)=W/BF=/A.> /.umber89UV-63-.HCW8 exten 9* -6"2C.$n$4et 2=E 2user/UV?4-A)=W/BF=/A.>/4tatus8918 exten 9* -6"2C.$n$7layback 2call-f%d-for%arding8 exten 9* -6"2C.$n$7layback 2on-on-ans%er8 exten 9* -6"2C.$n$7layback 2on8 exten 9* -6"2C.$n$<angup 28 exten exten exten exten exten exten exten 1#### exten exten exten exten exten exten exten exten exten exten exten exten 1#### exten exten exten exten exten exten exten exten exten exten exten exten 9* 9* 9* 9* 9* 9* 9* 6"24$1$>ns%er 28 6"24$n$Fait 2!."8 6"24$n$4et 2=E 2user/UV?4-A)=W/BF=/A.>/4tatus89!8 6"24$n$7layback 2call-for%arding8 6"24$n$7layback 2on-on-ans%er8 6"24$n$7layback 2off-duty8 6"24$n$<angup 28

'>(( A-'+A=).J ######## 9* 6"C!$1$>ns%er 28 9* 6"C!$n$Fait 2!."8 9* 6"C!$n$4et 2=E 2user/UV?4-A)=W/Aecord8918 9* 6"C!$n$7layback 2to record-call8 9* 6"C!$n$7layback 2on8 9* 6"C!$n$<angup 28 9* 9* 9* 9* 9* 9* 6"C1$1$>ns%er 28 6"C1$n$Fait 2!."8 6"C1$n$4et 2=E 2user/UV?4-A)=W/Aecord89!8 6"C1$n$7layback 2to record-call8 6"C1$n$7layback 2off-duty8 6"C1$n$<angup 28

'>(( 4'A--.).J ######## 9* 6"CC$1$>ns%er 28 9* 6"CC$n$Fait 2!."8 9* 6"CC$n$4et 2=E 2user/UV?4-A)=W/4creen8918 9* 6"CC$n$7layback 2screen-callee-options8 9* 6"CC$n$7layback 2on8 9* 6"CC$n$<angup 28 9* 9* 9* 9* 9* 9* 6"C4$1$>ns%er 28 6"C4$n$Fait 2!."8 6"C4$n$4et 2=E 2user/UV?4-A)=W/4creen89!8 6"C4$n$7layback 2screen-callee-options8 6"C4$n$7layback 2off-duty8 6"C4$n$<angup 28

1#### exten exten exten 1#### exten exten exten

(ast 'alling .umber 'allback ######## 9* 6"6K$1$4et 2('.umber9U2=E2users/UV?4-A)=W/('.umber8W8 9* 6"6K$n$.o+p 2(ast 'alling .umberHUV('.umber8W8 9* 6"6K$n$=ial 2(ocal/UV('.umberWNlongdistance8 (ast .umber Aedial ######## 9* 6"6K$1$4et 2('.umber9U2=E2users/UV?4-A)=W/(=.umber8W8 9* 6"6K$n$.o+p 2(ast 'alling .umberHUV('.umber8W8 9* 6"6K$n$=ial 2(ocal/UV(=.umberWNlongdistance8

That should take care f most of the end user features! '(allenge: reate tem#lates for various user classes of service! ome u# $ith either a dial#lan a##lication or a shell scri#t to default values for each ne$ user! Add the abilit% for an administrator to turn on and off various features on a user-b%-user basis!

Asterisk Advanced Lab Assignment Module !+


'all 'enter ;eatures o- Asterisk: - 'all Iueues - Agents - Agent Login

!+ !" 7uilding A 'all 'enter 9it( Asterisk


Module 14 Lab 1 Time Limit: 30 Minutes +obod% reall% likes to $ait in line( but sometimes %ou don>t have a choice! When %ou have more calls than #eo#le to take the calls( %ou need a ,ueue! Asterisk has inte"rated su##ort for ,ueues and a d%namic A"ent channel that lets call-takers lo" in and out as needed! The "oal of this lab is to create both a .ales and a ustomer .u##ort ,ueue for %our com#an%! -nce %ou have the ,ueue set u#( alter %ou 4a% Menu to ,ueue callers to these t$o ,ueues! .et u# a number of A"ents and ,ueue members! Ste# : ! 'reating $our Iueues &dit the ,ueues!conf file! reate the t$o ne$ ,ueues as follo$s:

/sales0 musiconhold9default announce9 Lueue-sales strategy9ringall announce-holdtime 9 yes member 9*=><=)/gl member 9* >gent/2!!1 /sales0 musiconhold9default announce9 Lueue-support strategy9leastrecent announce-holdtime 9 yes member 9*=><=)/gl member 9* >gent/2!!2

1 Your B64 port/analog phone

1 Your B64 port/analog phone

.ave %our chan"es! +ote that 'ob )on the analo" #hone* is a #ermanent member of both ,ueues( $hile the other ,ueue members are a"ents! Ste# : & 'reate $our Agents +o$( edit the a"ents!conf files! .croll to the bottom and add a"ents 9001 and 9009:
agent 9* 2!!1$KKKK$3om 4mith agent 9* 2!!2$KKKK$;oe ;ones

.ave %our chan"es! :ou $ill $ant to record files called 2,ueues-sales3 )that sa%s 2.alesF3* and 2,ueuesu##ort3 )that sa%s 2.u##ortF3*! these messa"es $ill be 2$his#ered3 to the a"ent $hen a call arrives so he kno$s $hat ,ueue the call cam from!

Ste# :3 ,#date $our Da% Menu +o$ alter o#tions 1 and 9 on %our 4a% Menu to route calls into the #ro#er ,ueues )instead of sendin" all sales calls to Tom and all .u##ort calls to Koe*!
exten 9* 1$1 Zueue 2sales8 exten 9* 2$1 Zueue 2support8

Ste# : + Add Agent Login Extensions +o$ add an a"ent lo"in e0tension in %our 6eatures conte0t:
/features0 exten 9* 6"""$1$ >gent(ogin 28

.ave %our dial #lan! -nce %ou have %our ,ueue messa"es recorded( tr% out the ,ueue b% dialin" %our automated attendant! Tr% lo""in" in usin" the A"entLo"in e0tension! T+ote that there are more ele"ant $a%s to lo" a"ents in@out )or to d%namicall% add@remove non-a"ent devices as ,ueue members* usin" the Mana"er interface and some clever 4ial#lan scri#tin"! Also remember to test direct callin" to %our sales and su##ort ,ueues usin" the C00 numbers %ou confi"ured in Lab 13( C00 ///-7714 for .ales and C00 ///-771/ for .u##ort( $here 77 is %our trainin" number! Summar%: :ou learned: 1! 8o$ to confi"ure call ,ueues( ,ueue members( and a"ents! 9! 8o$ to set u# the A"entLoin" a##lication!

Asterisk Advanced Lab Assignment Module !/


Asterisk Aate)a% Inter-ace 0AAI1: - Hello 9orld AAI

!/ !" Hello 9orld Redux: AAI


Module 1/ Lab 1 Time Limit: 30 Minutes 5# to #oint of the a##lications %ou have built have o#erated directl% inside the Asterisk dial#lan( usin" A##lications( 6unctions( &0#ression( Pariables( and the other constructs that make u# the 4ial#lan lan"ua"e! 8o$ever( the 4ial#lan lan"ua"e is directl% tied to the functions of Asterisk and lacks man% of the features found in "eneral #ur#ose lan"ua"es! A;1 e0ists to brid"e the "a# bet$een Asterisk and the outside $orld! 5sin" an A;1 #ro"ram %ou can connect to database( access other s%stems usin" sockets( E? ( and other remote o#eration techni,ues! :ou can control hard$are attached to %our Linu0 s%stem! Most im#ortantl%( %ou can access the enormous #otential re#resented b% the thousands of standard libraries included $ith most "eneral #ur#ose com#utin" lan"ua"es! 1n this lab %ou $ill use one of the most basic but #o$erful lan"ua"es -the 5ni0 shell lan"ua"e- to create a ne$ version of 8ello World! 1n this %ou $ill see the basic ideas behind A;1! Tee# in mind that this is a ver% basic e0am#le! &0tremel% com#le0 and #o$erful 1PE s%stems have been built usin" A;1( so this is onl% a startin" #oint! Also kee# in mind that there are no$ standart libraries and tem#lates that su##ort A;1 available for the most #o#ular #ro"rammin" lan"ua"es: ( ?erl( ?8?( Eub%( ?%thon and more! 1f %ou need to build an A;1 a##lication( invest some time in revie$in" the libraries before %ou char"e in -%ou $ill save %ourself hours of re-inventin" the $heel! Ste# : ! 'reate $our S(ell Program han"e director% to @var@lib@asterisk@a"i-bin 5se %our favorite editor to create hello!sh Add the follo$in" to the te0t file:
# I,bin,sh# save this file in ,var,lib,asterisk,agi-bin, # Set a variable called stdin to help us # get the variables from +sterisk Stdin ? T)Q #Read in the variables from +sterisk into a log file Ghile = TJstdinQ I? TQ > do read stdin if = TJstdinQ I? 72: > then echo Jstin 00 ,tmp,logfile t.t fi done # 8ell +sterisk to play the hello-1orld prompt

echo TS8R7+E :I-7 hello-1ord #U # 9o1 read the response back from +steriskF # and 1rite it to the log file Stdin?Q)Q 1hile = TJstdinQ I? TQ> do read stdin done e.it ) .ave %our #ro"ram! +o$ %ou need to make the #ro"ram e0ecutable b% usin" the Linu0 command \3chmod3 as follo$s: # chmod [x hello.sh This sim#l% tells the Linu0 environment that the te0t files is an e0ecutable! The first line that looks like a comment )#F@bin@sh-* tells the Linu0 kernel $hat inter#reter to use $hen e0ecutin" the file! 'efore %ou "o on( test %our shell #ro"ram b% runnin" it from the 5ni0 shell! T%#e !@hello!sh to run it! T%#e a fe$ lines to it( and then a fe$ blank lines! :ou should see it $orkin"!

Ste# : & 'reate An Extenion *o Run $our AAI +o$ %ou need to add an e0tension to %our MfeaturesN conte0t that runs the A;1 #ro"ram( as follo$s:
exten exten exten exten 9* 9* 9* 9* 6"7"$1$>ns%er 28 6"7"$n$Fait 2!."8 6"7"$n$>J) 2hello.sh8 6"7"$n$<angup 28

Ste# : 3 *est $our '(anges all the e0tension and %ou should a"ain hear Allison .mith>s lovel% voice $elcomin" %ou to the $orld of Asterisk! To see a bit more of $hat>s ha##enin"( %ou should on A;1 debu""in" b% t%#in":
'()* agi set debug on Summar%: :ou learned the follo$in": 1! 8o$ to create an A;1 scri#t in the bash shell lan"ua"e! 9! 8o$ to invoke %our A;1 scri#t from the dial#lan! 3! 8o$ to read from the lo" file "enerated b% the scri#t!

Вам также может понравиться