Uploaded by mahram t

asterisk

advertisement
Asterisk PBX:
VoIP’s gateway to the future
By Alex Ayala
For Telecom class of 2003
Agenda

Introduction to VoIP






Benefits
Challenges
CODECS
Session Initiation Protocol
Asterisk PBX
Demonstration
What is VoIP?

Based on packet switching technology using
Internet as transport
Opposed to the traditional circuit switching
technology, which dominates the Public
Switched Telephone Network (PSTN)
Driven by low cost; flat-rate billing

So why haven’t we switch to VoIP??


VoIP: Benefits


Integration of Data & Voice
Simplification


Network Efficiently


Less equipment management
Save on Bandwidth (silence suppression)
Cost Reduction

Bypass PSTN toll fees
VoIP: Challenges

3 main factors affect the quality of voice




Latency
Jitter
Packet Loss
If cost is the only criteria
Managers/Administration would be only ones
who wouldn’t mind bad voice quality.
Employees won’t compromise quality to
reduce company’s bills.
VoIP: Quality of Voice

Quality of CODEC


Echo cancellation



give good quality low delay
2 wire -> 4 wire PBX (hybrid circuit used for conversion)
if delay > 10mS echo is notice
Delay



Total Delay ( > 200mS one-way; talkers overlap )
Jitter ( variable packet arrival )
Delay Management
 Prioritize (RSVP)
 Packet replay (Jitter buffer)
 Segmenting data packets (exit router faster)
VoIP: CODECS


Overview of a VoIP
connection:
Codecs supported by *



G.723 – 6.4kbps
G.729 – 8kbps
G.711 – 64kbps
Voice
ADC
DAC
Voice
Compression
Algorithm
Decompress
Algorithm
Assembling RTP/UDP
Dissembling RTP/UDP
VoIP: Protocols





RSVP (Resource ReSerVation Protocol)
RTP (Real Time Protocol)
RTCP (Real Time Control Protocol)
SIP (Session Initiation Protocol)
SDP (Session Description Protocol)
VoIP: SIP Addressing
Uses Internet URLs

Supports both Internet and PSTN addresses

General form is name@domain

To complete a call, needs to be resolved down to User@Host

Examples:
sip: alex@pbx.ayalanetworks.com
sip:Alex Home <3001@pbx.ayalanetworks.com>
sip:905-845-9430@pbx.ayalanetworks.com;user=phone
sip:guest@drkangel.org
VoIP: SIP Call Setup
SIP
User Agent
Client
SIP
User Agent
Server
INVITE sip:3004@pbx.ayalanetworks.com
200 OK
ACK
RTP Stream
BYE
200 OK
142.55.55.202
pbx.ayalanetworks.com
VoIP: SIP Requests
Example: INVITE
Method
Description
REGISTER
Used by client to register a particular address with the SIP server
INVITE
A session is being requested to be setup using a specified media
ACK
Message from client to indicate that a successful response to an INVITE has been
received
BYE
A call is being released by either party
CANCEL
Cancels any pending requests. Usually sent to a Proxy Server to cancel searches
OPTIONS
A Query to a server about its capabilities
VoIP: SIP REGISTER
Session Initiation Protocol
Request line: REGISTER sip:pbx.ayalanetworks.com SIP/2.0
Method: REGISTER
Message Header
Via: SIP/2.0/UDP 142.55.31.239:5060;rport;branch= <omit>
From: Alex <sip:3004@pbx.ayalanetworks.com>
To: Alex <sip:3004@pbx.ayalanetworks.com>
Contact: "Alex Ipaq" <sip:3004@142.55.31.239:5060>
Call-ID: <random seed>@pbx.ayalanetworks.com
CSeq: 43034 REGISTER
Expires: 1800
Max-Forwards: 70
User-Agent: X-Lite build 1082
Content-Length: 0
VoIP: SIP INVITE
Session Initiation Protocol
Request line: INVITE sip:3004@pbx.ayalanetworks.com SIP/2.0
Message Header
Via: SIP/2.0/UDP 142.55.55.202:5060;rport;branch=<omit>
From: Alex Home <sip:3001@pbx.ayalanetworks.com>;tag=<omit>
To: <sip:3004@pbx.ayalanetworks.com>
Contact: <sip:3001@142.55.55.202:5060>
Call-ID: <omit>@142.55.55.202
CSeq: 23277 INVITE
Max-Forwards: 70
Content-Type: application/sdp
User-Agent: X-Lite build 1088
Proxy-Authorization: Digest
username="3001",realm="asterisk",nonce=4c3e876b,
response=“<hash>”,uri="sip:3004@pbx.ayalanetworks.com"
Content-Length: 297
VoIP: SDP
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): 3001 173802875 173802875 IN IP4
142.55.55.202
Session Name (s): X-Lite
Connection Information (c): IN IP4 142.55.55.202
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 8000 RTP/AVP 0 8 …
Media Attribute (a): rtpmap:0 pcmu/8000
Media Attribute (a): rtpmap:8 pcma/8000
Media Attribute (a): rtpmap:3 gsm/8000
Media Attribute (a): rtpmap:98 iLBC/8000
Media Attribute (a): rtpmap:97 speex/8000
VoIP: SIP Responses
Description
Examples
1xx
Informational – Request received, continuing to
process request.
180 Ringing
100 Trying
2xx
Success – Action was successfully received,
understood and accepted.
200 OK
3xx
Redirection – Further action needs to be taken
in order to complete the request.
300 Multiple Choices
302 Moved Temporarily
4xx
Client Error – Request contains bad syntax or
cannot be fulfilled at this server.
401 Unauthorized
408 Request Timeout
5xx
Server Error – Server failed to fulfill an
apparently valid request.
503 Service Unavailable
505 Version Not Suported
6xx
Global Failure – Request is invalid at any server.
600 Busy Everywhere
603 Decline
VoIP: SIP Responses (cont)
Required Fields:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 142.55.55.202:5060
From: Alex Home <sip:3001@pbx.ayalanetworks.com>
To: <sip:3004@pbx.ayalanetworks.com>
Call-ID: <omit>@142.55.55.202
CSeq: 23278 INVITE

These are copied from the request corresponding to 200 OK
To and From are NOT swapped

CSeq is incremented by 1

VoIP: SIP Routing

VIA headers are used for routing SIP messages

Requests


Request Initiator puts address in VIA header
Responses

Response initiator copies request VIA header
VoIP: SIP Security
ENCRYPTION

SIP offers various approaches
 End 2 end encryption
 Hob by hop encryption
AUTHENTICATION

Proxies might require auth
 Responds to INVITE with 407 proxy auth req.
 Client re-INVITE with Proxy Authorization header

UAS/Registrars might require auth
 Responds to INVITE with 401 unauthorize
 Client re-INVITE with Authorization header
Asterisk:What is it?



A complete PBX software for Linux platform
developed by Digium (M.S.)
Does PBX call switching, CODEC translation,
and various applications
Open Source under GNU license
Asterisk: Applications








Voicemail
Dial an interface (ZAP, SIP, IAX, etc)
Conference Bridging
ACD Queues (great for Call centres)
IVR ( press “1” if you know the ext)
DB operations
ENUMlookup
AGI (asterisk gateway interface, like CGI)

For advance scripting
Asterisk: Overview
VoIP
EnumLookup
VoIP
Voicemail
PSTN
ASTERISK PBX
Queue
Analog
Phones
Conference Bridging
PSTN
Analog
Phones
Asterisk: Call Logic

Asterisk uses a State Machine to determine
what to do with a Call



Context : The Origin of the call (SIP, PSTN, etc)
Extension: The number Dialed by user
Priority: A counter that orders a sequence of
commands
Asterisk: Call Logic Example
A user dials 3001, which is extension for Voicemail Central. The user
is define in context => local
extensions.conf
[local]
exten => 3001,1,Voicemailmain2


A sip user (4001) dials 1001 which is an analog phone (Zap/1), and
drop in voicemail if unavailable (no one answers for 30 secs)
sip.conf
[4001]
Username=4001
Context=from-sip
…
extensions.conf
[from-sip]
exten => 1001,1,Dial(Zap/1,30)
exten => 1001,2,Voicemail2(u1001)
Asterisk: ENUM




A PSTN user wants to call a SIP user? Only have a
dialpad. How to dial a URI?
ENUM. Creates a global directory which map telephone
number to sip address (or email ).
DNS lookup (E.164 -> URIs)
E.164 queries are formed as reversed dot-separated
digits and attach the enum.domain.tld at the end (usualy
e164.arpa)

905-845-9430  0.3.4.9.5.4.8.5.0.9.e164.arpa
Asterisk: Enum Example
ENUM
IN NAPTR 0.3.4.9.5.4.8.5.0.9.e164.arpa. ?
PSTN: 905-845-9430
GW
w/ Enum resolution
sip:3001@skewl.ayalanetworks.com
INVITE:
sip:3001@skewl.ayalanetworks.com
sip:3001@skewl.ayalanetworks.com
Asterisk: IAX





Inter-Asterisk eXchange used by Asterisk as
an alternative to SIP, H.323, etc
Supports PKI-style security and trunking
When trunking, it allocates BW in used only
Quality is similar to SIP, but as connections
increase IAX (in trunk mode) becomes better.
Versions: IAX and IAX2
Asterisk: IAX (cont)


IAX is NAT/PAT transparent
IAX2 trunking triples per megabyte


100 calls/MB (with G.729)
Over 1000 iaxtel registered users (like FWD)
Top Ten Reasons to Run Asterisk
Number 10
Convenient, unambiguous single
non-alphanumeric abbreviation: *
Number 9
Dial-an-MP3
Number 8
Can call you 5 minutes into a blind
date as 'emergency exit'
Number 7
Only way to build a call center on
your laptop
Number 6
Teleconferencing with your friends
allows you to be more lazy/unsocial
than you already are
Number 5
You can have a 31337 answering
machine.
Number 4
Finally you can tell telemarketers ,
“all representatives of our
household are busy attending other
telemarketers, your call will be
answer in order of received”.
Number 3
Answer unwanted calls (exgirlfriend) with a looping IVR “press
1 to speak to Alex…<beep>..Invalid
option, please try again…”
Number 2
Have screaming parents,siblings,etc
after they can’t call long
distance,…Password protected.
Number 1
Why settle for being just another
webmaster, hostmaster, or
postmaster when you too can be an
astmaster like me!
Asterisk: Demo






2 Asterisk servers
4 Sip clients , 4 local phones (2 in each
server)
IAX2 trunk between servers
Both will act as sip proxies
Server A is connected to PSTN via FXO
Using ENUM for least cost routing
ASTERISK PBX
Host: Home
Phone Line connected to FXO card
PSTN
SERVER A
SIP CLIENTS @School
SIP CLIENTS @Home
4001@school
3001@home
INTERNET
3002@home
1001
4002@school
2001
1002
Analog phones connected to FXS card
ASTERISK PBX
Host: School
2002
SERVER B
Analog phones connected
to FXS card
THANK YOU
Telecom Class ‘03
Download