Presentation is loading. Please wait.

Presentation is loading. Please wait.

VoIP Study and Implementation Asterisk Installation and Configuration Part 1 Version 1.0 – Author : Marc PYBOURDIN / Julien BERTON Last Update : 15/05/2012.

Similar presentations


Presentation on theme: "VoIP Study and Implementation Asterisk Installation and Configuration Part 1 Version 1.0 – Author : Marc PYBOURDIN / Julien BERTON Last Update : 15/05/2012."— Presentation transcript:

1 VoIP Study and Implementation Asterisk Installation and Configuration Part 1 Version 1.0 – Author : Marc PYBOURDIN / Julien BERTON Last Update : 15/05/2012

2 Course objectives Asterisk overview Asterisk components By completing this course, you will see: Asterisk Overview

3 INTRODUCING ASTERISK Asterisk Installation and Configuration – Part 1

4 What is Asterisk ? Open Source PBX (Private Branch Exchange) system Distributed under the GNU GPL with commercial licenses available –Codec licensing also available(G729a) Current version is the 10.4.0 Overview

5 What is Asterisk ? Supports analog circuits with DAHDI –such as PSTN with hardware cards Supports several codecs : –G711 –G729 –Speex –LPC-10 –…–… Provides transcoding between codecs Can be used as an IVR platform Overview

6 What is Asterisk ? Asterisk features includes : –Complete management of the call flow(incoming/outgoing) with the DialPlan) –Traditional phones features(Hold, Transfer,…) –Voicemail –Conference rooms –MoH, IVR –Parking –Fax detection Overview

7 DAHDI DAHDI (previously called ZapTel) stands for : Digium Asterisk Hardware Device Interface Communication between Asterisk and hardware cards Also used by Asterisk components like MeetMe Architecture

8 Any questions?

9 INSTALLING ASTERISK Asterisk Installation and Configuration – Part 1

10 Installing Asterisk From package –Dependencies generally automatically handled From sources –Compile Asterisk with the components that fits your needs and your architecture Architecture

11 Installing Asterisk with packages Install from package with DAHDI with distribution repositories –Debian/Ubuntu apt-get install asterisk asterisk-dahdi –Fedora yum install asterisk asterisk-configs asterisk-voicemail dahdi-linux dahdi-tools Architecture

12 Installing DAHDI and Asterisk from sources Install from sources with Debian/Ubuntu –Make sure that the repositories are updated apt-get update && apt-get upgrade –Install the compilation dependencies apt-get install build-essential libxml2-dev libncurses5-dev linux- headers-`uname -r` libsqlite3-dev –Create the source directory and go inside mkdir /usr/src/asterisk && cd /usr/src/asterisk Architecture

13 Installing DAHDI and Asterisk from sources Install from sources with Debian/Ubuntu –Get the lastest version of DAHDI wget http://downloads.asterisk.org/pub/telephony/dahdi-linux- complete/dahdi-linux-complete-current.tar.gz –Extract the sources and go inside the source directory tar –xvzf dahdi-linux-complete-current.tar.gz && cd dahdi-linux- complete-2.6.0+2.6.0/ –Compile, install and start DAHDI make all && make install && make config && /etc/init.d/dahdi start Architecture

14 Installing DAHDI and Asterisk from sources Install from sources with Debian/Ubuntu –Get the lastest version of Asterisk wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-10- current.tar.gz –Extract the sources and go inside the source directory tar –xvzf asterisk-10-current.tar.gz && cd asterisk-10.2.1/ –Check the dependencies and launch menuselect./configure && make menuselect Architecture

15 Installing DAHDI and Asterisk from sources Install from sources with Debian/Ubuntu –Launch the compilation and the installation make && make install –Install samples configuration files make samples && make config –You can then launch Asterisk with the command /etc/init.d/asterisk start Architecture

16 Any questions?

17 ASTERISK ADMINISTRATION Asterisk Installation and Configuration – Part 1

18 Administrating Asterisk Two methods : –Asterisk console –Configuration files Architecture

19 Asterisk Console Central administration point to : –Do real-time debugging –Show status of Asterisk components –Do actions on the Asterisk server Can be launched using :asterisk -r Architecture

20 Asterisk Console CommandDescription sip show channelsShow currents active channels sip show registryShow trunk status sip show peersShow peers status set verbose XSet the verbosity of the console where X is a digit or a number core show translationShow transcode latency between codecs Architecture

21 Asterisk Console Commanddescription reloadForce Asterisk to read again the configuration file without restart it core restart nowForce Asterisk to restart Asterisk as the command is entered core restart gracefullyRestart Asterisk but allow active calls to continue. All new calls are rejected. core restart when convenientRestart Asterisk but allow active calls to continue. All new calls are accepted. Architecture

22 Configuration files FileDescription sip.confTrunk configuration users.confUsers configuration extensions.confDialPlan configuration iax.confIAX users, peers, friends, and parameters logger.confLog files, log levels, etc. meetme.confMeetMe conference configuration modules.confModules, preloads, globals, and noloads musiconhold.confMusic on hold configuration voicemail.confVoicemail mailboxes, general parameters Overview

23 Any questions?

24 DIALPLAN Asterisk Installation and Configuration – Part 1

25 DialPlan Asterisk is centered around the dialplan. –Responsible for directing and routing all calls of the calls through the PBX –Define the user’s environment by using contexts What numbers can be called What is happening when numbers called Extensions.conf

26 Extensions format exten => Number,Priority,App(arguments) –May be any number of digits –May be string literals –May pattern match (when proceeded with '_') »‘N’ matches digits from 2 to 9 »‘X’ matches digits from 0 to 9 »‘.’ matches one or more characters »‘!’ matches zero or more characters Extensions.conf

27 Diaplan structure Each step in the Dial Plan is an Application –For example, Playback() application is used to play sounds Each step is assigned a priority sequence –For example, to play a sound and then hangup : exten => s,1,Answer() exten => s,2,Playback(tt-weasels) exten => s,3,Hangup() Extensions.conf

28 Extension contexts A dialplan is composed with extension contexts –Represented in the file by brackets – [my_context] define a new context Contexts contain extensions –Example, to add two numbers to the context : [my_context] exten => 1,1,Answer() exten => 1,2,Playback(tt-weasels) exten => 1,3,Hangup() exten => 2,1,Answer() exten => 2,2,MusicOnHold() exten => 2,3,Hangup() Extensions.conf

29 Extension contexts Contexts can be nested with the include statement Example : to include [my_context] into [bigger_context] : [bigger_context] include => my_context Extensions.conf

30 Extensions variables As a call is created into a channel, variables can be used in extensions such as : –${EXTEN} The current extension that being called –${CONTEXT} The name of the current context –${CALLERID(name)} The current Caller ID name –${CALLERID(num)} The current Caller ID number –${EPOCH} The current UNIX-style epoch(number of seconds since 1 Jan 1970) Extensions.conf

31 Standard extensions ExtensionDescription 's’ (start)Used as a start point in your extension for calls that enter in the context without specific context information 't' (timeout)Used when calls have been inactive after a prompt was played(during an IVR for example). 'i’ (invalid)When a non-existant extension in the current context has been called. 'o’ (operator)Used for operator exit by pressing zero in voicemail. 'h’ (hangup)When the call is terminated. Extensions.conf

32 DialPlan applications  Answer() Makes Asterisk pick-up the call Always without argument  HangUp() Makes Asterisk hangup the call Always without argument Extensions.conf

33 DialPlan applications  Dial(type/identifier,timeout) Makes Asterisk dial a number Comes always with argument(s) Dial(SIP/6000,20) for calling the user 6000 during 20 seconds Dial(SIP/myTrunk/${EXTEN}) for calling number through SIP trunk Extensions.conf

34 DialPlan applications VoiceMail(user@context)  Makes Asterisk launch the voicemail IVR for callers to leave voice message  Always used with argument(s) VoiceMailMain(user@context)  Application used to check voicemail  Always used with argument(s) Extensions.conf

35 DialPlan applications Goto(context,extension,priority) Used in dialplan to jump into another context, extension, priority Playtones(tone) Plays a tone to the caller Playback(sound-file) Play a sound to the caller Located in /var/lib/asterisk/sounds Extensions.conf

36 DialPlan applications SayUnixTime(unixtime,timezone,format) Uses some of the sound files stored in /var/lib/asterisk/sounds to construct a phrase saying the specified date and/or time in the specified format. Extensions.conf

37 Quiz What can be done if you want to achieve to following? –wants to match all users from 6000 to 6999 –call the dialed user within this range –if peer not available, hangup In order to do that, you must only use one extension Extensions.conf

38 Quiz - Answer [my_context] ; if not existing already Exten => _6XXX,1,Answer() Exten => _6XXX,2,Dial(SIP/${EXTEN}) Exten => _6XXX,3,Hangup() We match the pattern « 6XXX » where X means any number between 0 and 9. Extensions.conf

39 Demonstration Show how to implement this solution on Asterisk and test it Extensions.conf

40 Any questions?

41 USER & VOICEMAIL CONFIGURATION Asterisk Installation and Configuration – Part 1

42 SIP types in Asterisk Asterisk has three SIP types –peer A SIP entity that can handle inbound and outbound calls –Essentially for trunks connected to a SIP provider –user A SIP entity than can handle only inbound calls –Not commonly used nowadays –friend A SIP entity that’ll be instanciated as an user and a peer –Essentially for SIP clients –Can receive and place calls Defined by the type=value in the user/trunk configuration Extensions.conf

43 Users management Created in users.conf The syntax is the following : [6000] ; username type=friend ; always friend for end devices secret=Th15iSSp@rt@! ; user password host=dynamic ; allow dynamic IP to log in context=my_context mailbox=6000 ; mailbox number qualify=yes ; enable real-time monitoring Users.conf

44 Users templates In order to create template, do the following : [aperture_clients](!) type=friend secret=Th15i5Sp@rt@! host=dynamic context=my_context qualify=yes nat=yes In order to create users with the template, do the following : [6000](aperture_clients) mailbox=6000 Users.conf

45 Voicemail mailboxes In the voicemail.conf file. –Format : =,,,, –Contexts are also available in voicemail.conf. Voicemail.conf

46 Any questions?

47 INCOMING & OUTGOING CALL ROUTING Asterisk Installation and Configuration – Part 1

48 Trunk configuration In the sip.conf file. Trunk configuration need two actions: –Define the SIP trunk in the [general] context –Define the SIP trunk dedicated user You can check the trunk status in the Asterisk console with: –show sip registry –show sip peers Sip.conf

49 Trunk configuration Define the SIP trunk in the [general] context –register => username:password@provider.com/username –For example, for an OVH trunk: register => 0033123456789:MySecr3t@sip.ovh.net/003312345 6789 Sip.conf

50 Trunk configuration Define the SIP trunk dedicated user [myTrunk] type=peer ;always peer for trunk secret=MySecr3t host=sip.ovh.net fromuser=003312345678901 username=003312345678901 nat=never ;Asterisk server has a public address context=from-trunk insecure=invite,port ;accept calls w/o auth qualify=yes Sip.conf

51 Outgoing call setup If our trunk to the service provider work, we can now configure Asterisk to use the trunk four outgoing calls. Configuration of the DialPlan still and always on the extensions.conf file. Extensions.conf

52 Outgoing call setup In your internal context [my_context], add the following : exten => _0XXXXXXXXX,1,Dial(SIP/myTrunk/${EXTEN}) exten => _0XXXXXXXXX,2,Playtones(congestion) exten => _0XXXXXXXXX,3,Congestion() exten => _XXXX,1,Dial(SIP/myTrunk/${EXTEN}) exten => _XXXX,2,Playtones(congestion) exten => _XXXX,3,Congestion() At this point, your users are able to dial French phone numbers(extended or short). Extensions.conf

53 Quiz Oh! You forgot to set short number for French emergencies numbers such as: –15 –17 –18 Modify your configuration to allow routing and calling of these three numbers in your internal context [my_context]. –Use only one extension to do that Extensions.conf

54 Quiz - Answer Add the following at the end of your context: exten => _1[578],1,Dial(SIP/myTrunk/${EXTEN}) exten => _1[578],2,Playtones(congestion) exten => _1[578],3,Congestion() Number inside bracket means a possibility for one unique digit. –Here, [578] means 5 or 7 or 8 for the second digit. Extensions.conf

55 Demonstration Show how to implement this solution on Asterisk and test it Extensions.conf

56 Incoming call setup In order to accept calls from a public PSTN number, you need to : –Define the trunk context –Define a start action on it Always done in the extensions.conf file. Extensions.conf

57 Incoming call setup To set incoming calls : [from-trunk] exten => s,1,Dial(SIP/6000,20) exten => s,2,Voicemail(6000@default) exten => s,3,Hangup() In this example, if someone calls us on the PSTN public number : 1.the SIP user 6000 will ring during 20s 2.If no one answer, transfer to Voicemail of the user 3.then hangup Extensions.conf

58 Demonstration Show how to implement this solution on Asterisk and test it Extensions.conf

59 Any questions?

60


Download ppt "VoIP Study and Implementation Asterisk Installation and Configuration Part 1 Version 1.0 – Author : Marc PYBOURDIN / Julien BERTON Last Update : 15/05/2012."

Similar presentations


Ads by Google