Understanding Asterisk
  Brian Capouch
  Saint Joseph's College
  July 23, 2007
www.s ain t jo e.ed u / ~ b r ian c/ OSCON
       b r ian c@s ain t jo e.ed u
Bas ic Plan

    It 's all ab ou t s p eech
●


    An alog t elep h on y s t ill m at t er s
●


    Digit iz at ion of s...
Me chanical As pe cts o f Spe e ch

    Air flow is m o d u lat ed t o m ake “s p eech ”
●

    –   Vocal cord s p rovid e...
The Te le pho ne Te rm inal

    Fo u r fu n d am en t al p ar t s :
●

     –   Sign alin g elem en ts
              Hook...
Te rm inals co nne ct to o ffice s

    Two- en d ed p r o t o col
●

    –   Sim ilar to clien t/ server, DCE/ DTE, etc.
...
Fo re ign Exchange (FX)

    Th e office (FXO) is p r ovid er of s er vices
●

    –   Origin ation : “Som eon e calls you...
Co m pute r- POTS Inte rface s

    Nam ed aft er wh ich s id e con n ect s t o t h em
●

    –   So t h eir beh avior is ...
1 9 7 0 s : The Digital Age Be gins

    Fir s t d igit al cir cu it s wer e in Ch icago
●


    Ad van t ages of d igit a...
Analo g to Digital Co nv e rs io n

    Co n ver t an alo g s ign al t o puls e train
●

    –   Each p u lse is an in sta...
The Clas s ic Diagram
Quantiz atio n No is e

    A/ D con ver s ion is a lw a y s ap p r oxim at e
●


    Er r or s in t h is d om ain called ...
POTS Jargo n co nfus e s IP ty pe s

    Or igin at ion ver s u s Ter m in at ion
●

    –   An oth er m ajor cau se of co...
Vo ice as ano the r ty pe o f data

    Ad van t ages
●

    –   Dram atically lower cost s
    –   Leveraged in frast ru ...
The Big Thre e

    Lat en cy
●

     –   Alm ost always slower th an PSTN
              e.g. d om estic PSTN latency ~ 20...
Packe tiz ing Digital Audio

    Fir s t q u es t ion : h o w m u ch p er p acket ?
●

    –   Too little: overh ead will ...
Co de cs carry v o ice

    Th is is t h e be are r p ar t of t h e call
●


    Two b as ic t yp es
●

    –   Waveform
 ...
So m e ty pical e xam ple s

    g.7 1 1 (var ian t s u law an d u law)
●

    –   Waveform ,64kbs, MOS 4.3
    Ad ap t iv...
Mo re co m m o n co de cs

    gs m
●

    –   Derived from classic cellp h on e tech n ology
    –   Hybrid
    –   Vario...
Signaling Pro to co ls

    No t e con t r as t t o b ear er fu n ct ion
●


    Th er e ar e m an y, an d it 's an act iv...
SIP

    Ses s ion In it iat ion Pr ot ocol
●


    Develop ed b y IETF WGs
●


    St ar t ed ou t s im p le
●

    –   C...
IAX

    In t er - As t er is k Exch an ge Pr ot ocol
●


    Develop ed b y Mar k Sp en cer an d As t er is k co m m u n ...
H.3 2 3

    Develop ed b y t h e ITU
●


    Clas s ic p r ot o col, n ow in wan in g u s e
●


    Co m p lex, m an y s ...
His to ry / Ov e rv ie w

    Th e Ad t r an Tr ad es h o w St or y
●


    Lin u x Su p p or t Ser vices
●


    L.S.S. b...
Functio nal Ov e rv ie w

    PBX: Swit ch in g fu n ct ion alit y
●

    –   Both TDM an d IP
    Tr an s co d er
●


   ...
Ins tallatio n

    So u r ce Bu ild s fair ly t r ivial
●

     –   Requ ires kern el h ead ers at m in im u m
    Packag...
Fundam e ntal Ide as

    Ever yt h in g h ap p en s o n ch an n els
●

     –   A sign alin g sch em e on an in terface
 ...
Co nfiguring the s e rv e r

    Gen er ally d o n e wit h t ext .con f files
●

    –   / etc/ asterisk is u su al h om e...
Dialplan Bas ics

    Glo b al p ar am et er s an d d efin it ion s
●


    Bas ic Hier ar ch ical Or ien t at ion
●

    ...
Exte ns io ns

    Mo s t ext en s ion s ar e n u m er ic
●

    –   Th ey d on 't h ave to be, “brian c” is valid
    –  ...
Applicatio ns pro v ide be hav io r

    So m e ar e b u ilt in t o s er ver
●


    So m e ar e load ab le m od u les
●

...
Bas ic Call Flo w

    Mo s t act ion s t ar t s wit h ch an n el even t
●

    –   Asterisk calls it a “rin g”
    Ch an ...
De m o ns tratio n Se tup
Upcoming SlideShare
Loading in …5
×

Os Capouchtutorial

525 views
473 views

Published on

Published in: Business, Travel
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
525
On SlideShare
0
From Embeds
0
Number of Embeds
31
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Os Capouchtutorial

  1. 1. Understanding Asterisk Brian Capouch Saint Joseph's College July 23, 2007
  2. 2. www.s ain t jo e.ed u / ~ b r ian c/ OSCON b r ian c@s ain t jo e.ed u
  3. 3. Bas ic Plan It 's all ab ou t s p eech ● An alog t elep h on y s t ill m at t er s ● Digit iz at ion of s ou n d ● Cir cu it ver s u s p acket - s wit ch ed com m u n icat ion s ● En cod in g d igit iz ed s p eech ● In t er n et s ign alin g p r ot o cols ● As t er is k Fu n d am en t als ● – Brief h istory – Overview – Basic Op eration al Con cep t s As t er is k in Act ion ● – Th e CLI – Th e Man ager In terface
  4. 4. Me chanical As pe cts o f Spe e ch Air flow is m o d u lat ed t o m ake “s p eech ” ● – Vocal cord s p rovid e “voice” – Sh ap e of cavity m akes “vowels” – Im p ed im en ts to airflow m ake “con son an ts” E.g. lip s, tongue, teeth, glottis ● Par t icles of s p eech ar e pho ne m e s ● – Rem em ber th is com e cod ec tim e
  5. 5. The Te le pho ne Te rm inal Fo u r fu n d am en t al p ar t s : ● – Sign alin g elem en ts Hook switch ● Ringer ● – Au d io (bearer) elem en ts Microp hone ● Sp eaker ● Ph on e lin es s u p p ly t h eir own p ower ! ●
  6. 6. Te rm inals co nne ct to o ffice s Two- en d ed p r o t o col ● – Sim ilar to clien t/ server, DCE/ DTE, etc. Ser vice p r ovid ed on t wo wir es (“p air ”) ● – Both A/ C an d D/ C Elem en ts – Tip an d Rin g Swit ch es p r ovid e s er vices t o t er m in als ● – In bou n d an d ou tbou n d calls – Tru n ks to rem ote switch es – Featu res Th e PSTN is n et wor k of s wit ch es ●
  7. 7. Fo re ign Exchange (FX) Th e office (FXO) is p r ovid er of s er vices ● – Origin ation : “Som eon e calls you ” – Term in ation : “You call som eon e” – Featu res: CallerID, Call Wait in g, etc. Th e s t at ion (FXS) m akes r eq u es t s ● Eas y t o d is cer n wit h POTS: ● – Station s h ave p lu gs – Offices h ave sockets Th is p oin t is m ajo r s ou r ce of con fu s ion ● – How cou ld th at be???
  8. 8. Co m pute r- POTS Inte rface s Nam ed aft er wh ich s id e con n ect s t o t h em ● – So t h eir beh avior is o ppo s ite of th eir n am es! FXO p orts behave like stations ● FXS p orts behave like offices ● Both use hard ware “sockets” ● Lead in g cau s e o f b egin n er in s an it y ● Th er e is a co s t t o t h e con fu s ion ● – Rin g voltage can d efin itely be felt – Rin g voltages can kill POTS p orts Exp er ien ce is t h e b es t t each er ●
  9. 9. 1 9 7 0 s : The Digital Age Be gins Fir s t d igit al cir cu it s wer e in Ch icago ● Ad van t ages of d igit al ● – Lower circu it cost – Im m u n it y to n oise – Im m u n it y to crosstalk – Ease of sign al p rocessin g – Sep aration of sign al an d bearer fu n ction s So m e d is ad van t ages , t oo ● – Less efficien t u se of ban d wid th – More com p lex to u n d erstan d an d im p lem en t
  10. 10. Analo g to Digital Co nv e rs io n Co n ver t an alo g s ign al t o puls e train ● – Each p u lse is an in stan tan eou s voltage – Each su ch volt age read in g is a sam p le Th e Nyq u is t Fr eq u en cy s et s s o m e lim it s ● – PSTN sam p les at 8Kh z Th e gr an u lar it y of s am p les is im p or t an t ● – More gran u larity= h igh er fid elity – PTSN u ses 8 bits/ sam p le
  11. 11. The Clas s ic Diagram
  12. 12. Quantiz atio n No is e A/ D con ver s ion is a lw a y s ap p r oxim at e ● Er r or s in t h is d om ain called quantiz atio n ● So ft er s ou n d s (lower valu es ) s u ffer m or e ● Co m p an d in g: n o n - u n ifor m q u an t iz at ion ● – More resolu tion at softer levels th an lou d er – Stu ffs 12 bits of resolu tion in to 8 bits Tr an s lat io n p r oces s co d in g- de cod in g ● – Co de cs are tran slators u - law an d a- law ar e u s ed in PSTN ● – Stan d ard iz ed as ITU G.711
  13. 13. POTS Jargo n co nfus e s IP ty pe s Or igin at ion ver s u s Ter m in at ion ● – An oth er m ajor cau se of con fu sion – Both are n etwork su bscriber services – Term in ate: You call som eon e – Origin ate: Som eon e calls you Seem s s im p le en o u gh on t h e s u r face ● Wh y d is cer n ? In VoIP, t h ey can b e sep a ra ted ! ● – Term in ation services m ore com m on th an origin ation
  14. 14. Vo ice as ano the r ty pe o f data Ad van t ages ● – Dram atically lower cost s – Leveraged in frast ru ct u re – Con vergen ce wit h com p u ter ap p lication s Dis ad van t ages ● – Packet switch in g versu s circu it switch in g – Ch aot ic vs. Cen traliz ed m an agem en t – Dyn am ic rou tin g cau ses su rp rises – Secu rity con cern s abou n d
  15. 15. The Big Thre e Lat en cy ● – Alm ost always slower th an PSTN e.g. d om estic PSTN latency ~ 20m s m ax ● VoIP latency can reach 1000 m s! ● Packet Los s ● – Not every p acket get s d elivered – Ou t of ord er d elivery p ossible, too Jit t er ● – Defin ed as variation in laten cy – Can cau se very seriou s qu ality p roblem s
  16. 16. Packe tiz ing Digital Audio Fir s t q u es t ion : h o w m u ch p er p acket ? ● – Too little: overh ead will kill you – Too m u ch : Packet loss or d elay will get you – 20- 30m s are m ost com m on valu es i.e. 33/ 50 p ackets p er second ● VoIP term : fram es ● Man y ways t o en co d e t h e au d io ● – Clever sch em es d ram atically red u ce b/ w One could d o a whole tutorial on cod ecs ● Som e are p rop rietary, introd ucing m ore confusion ● Som e require a lot of p rocessor resources ● Processing itself introd uces d elays ●
  17. 17. Co de cs carry v o ice Th is is t h e be are r p ar t of t h e call ● Two b as ic t yp es ● – Waveform – Vocod er (AKA sou rce) – Hybrid s are com m on resu lt Bas ic id ea: h igh q u alit y, lo w b an d wid t h ● Th eo r y is r an k m at h em at ical t er r it or y ● Qu alit y m et r ic is Mean Op in ion Sco r e ● – MOS, valu es 1- 5 Man y cod ecs go b y t h eir ITU n am es ● Lot s of var iat ion in m an y ar eas ●
  18. 18. So m e ty pical e xam ple s g.7 1 1 (var ian t s u law an d u law) ● – Waveform ,64kbs, MOS 4.3 Ad ap t ive PCM (g.7 2 1 , g.7 2 6 ) ● – Waveform , variou s bitrates an d MOS g.7 2 9 ● – Hybrid , proprietary, 8kbs, 4.0 MOS iLBC (In t er n et Low Ban d wid t h Cod ec) ● – Hybrid , ~ 13- 15kbs, > 4.0 MOS – Freely- licen sed version of p rop rietary – Design ed to with stan d p acket loss
  19. 19. Mo re co m m o n co de cs gs m ● – Derived from classic cellp h on e tech n ology – Hybrid – Variou s low (5- 8kbs) rates – Variou s (3.5- 4.0) MOS valu es Sp eex ● – Tru ly Op en Sou rce cod ec – Hybrid – Dyn am ically ad ap tive bitrates – High - m ed iu m - low MOS varian ts Th is s cr at ch es t h e s u r face; go go oglin g ●
  20. 20. Signaling Pro to co ls No t e con t r as t t o b ear er fu n ct ion ● Th er e ar e m an y, an d it 's an act ive ar ea of r es ear ch ● Most of t h em u s e RTP for b ear er p ar t ● – So cod ecs en cod e for RTP, n ot sign alin g – Cod ecs are n egotiated by sign alin g p rotocols Her e we'll m en t ion t h r ee, p lay wit h t wo: ● – SIP, th e u n d isp u ted lead er, IETF- based – IAX, d evelop ed by an d for Asterisk – H.323, old classic, d evelop ed by ITU TDM h as it s o wn s et , t oo ●
  21. 21. SIP Ses s ion In it iat ion Pr ot ocol ● Develop ed b y IETF WGs ● St ar t ed ou t s im p le ● – Cu rren tly over 1K p ages of RFCs – Th is lead s to in terop erability p roblem s Th e am az in g layer b ou n d ar y flaw ● – SIP en cod es IP in form ation in layer 4 – Cau se of fam ou s NAT d ifficu lties – Mot h er of session bord er con troller m arket Us es RTP for b ear er t r an s p or t ●
  22. 22. IAX In t er - As t er is k Exch an ge Pr ot ocol ● Develop ed b y Mar k Sp en cer an d As t er is k co m m u n it y ● – In form ation al RFC in IETF Co m b in ed s ign al an d b ear er p r ot ocol ● – Th is m ean s NAT- h ard in ess Im p lem en t ed in s om e fir m war es ● Allows exch an ge of d ialp lan in for m at ion ●
  23. 23. H.3 2 3 Develop ed b y t h e ITU ● Clas s ic p r ot o col, n ow in wan in g u s e ● Co m p lex, m an y s u b - p ar t s ● Us es RTP for b ear er t r an s p or t ● Mas t er - s lave o r ien t at ion ● – Masters are called gatekeep ers Bas is o f m os t ear ly VoIP s ys t em s ●
  24. 24. His to ry / Ov e rv ie w Th e Ad t r an Tr ad es h o w St or y ● Lin u x Su p p or t Ser vices ● L.S.S. b eco m es Digiu m ● Th e Zap at a Pr oject ● Ot h er Op en Sou r ce PBX- t yp e p r oject s ● – VOVIDA – Bayon n e – SER
  25. 25. Functio nal Ov e rv ie w PBX: Swit ch in g fu n ct ion alit y ● – Both TDM an d IP Tr an s co d er ● Co n fer en ce Br id ge ● Call Cen t er Fu n ct ion s ● Ro u t in g En gin e ● Feat u r es Ser ver ● – Voicem ail – Directory – CDR
  26. 26. Ins tallatio n So u r ce Bu ild s fair ly t r ivial ● – Requ ires kern el h ead ers at m in im u m Packages , e.g. RPM, .ip k ● Fu ll d is t r ib u t ion s , e.g. As t lin u x ● ABE ● In t egr at or s ● St ealt h Ver s ion s (3 Co m ?) ● Nu m b er ed ver s ion s , p lu s SVN t r u n k ● – 1.2 series m ost com m on in p rod u ction , d ep recated – 1.4 cu rren t version – SVN- tru n k will becom e 1.6
  27. 27. Fundam e ntal Ide as Ever yt h in g h ap p en s o n ch an n els ● – A sign alin g sch em e on an in terface TDM Ch an n els ● – Each in terface t yp e h as ch an n el typ e e.g. T1, ISDN, POTS, etc. ● IP Ch an n els ● – Man y IP ch an n els sh are an in terface Usually Ethernet ● – e.g. SIP, IAX, H.323, SCCP, etc. Typ e vs . in s t an ce vs . call- in s t an ce ●
  28. 28. Co nfiguring the s e rv e r Gen er ally d o n e wit h t ext .con f files ● – / etc/ asterisk is u su al h om e d irectory On e file p er ch an n el t ech n o lo gy ● – e.g. sip .con f, iax.con f. h 323.con f Co n figu r at ion for feat u r es p r o ces s or s ● – voicem ail.con f – m eetm e.con f for con feren cin g – agen ts.con f for call agen ts Th e d ialp lan is t h e h ear t o f t h e s ys t em ● – exten sion s.con f
  29. 29. Dialplan Bas ics Glo b al p ar am et er s an d d efin it ion s ● Bas ic Hier ar ch ical Or ien t at ion ● – Dialp lan is a set of con texts – Each con text is a set of exten sion s – Each exten sion is a set of ap p lication s in p riority ord er Logic for m acr os , var iab les , flow con t r ol ● Co n t ext s ar e ver y im p or t an t ● – Lin kage between d ialp lan an d ch an n els – Determ in es allowable exten sion s – Con text s can in clu d e ot h er con text s
  30. 30. Exte ns io ns Mo s t ext en s ion s ar e n u m er ic ● – Th ey d on 't h ave to be, “brian c” is valid – Sm all set of bu ilt- in sp ecial exten sion s e.g. s is the start extension for POTS calls ● Each is a s et , in p riority o r d er ● – Priorities can be n u m eric 1,2,3, etc. – Th ey can also h ave labels – Flow con trol p ossible to oth er p riorities Always as s o ciat ed wit h at leas t on e ch an n el ●
  31. 31. Applicatio ns pro v ide be hav io r So m e ar e b u ilt in t o s er ver ● So m e ar e load ab le m od u les ● A few com m on in t u it ive exam p les ● – Dial – Voicem ail – Meetm e (Con feren ce en gin e) – Mu sicon h old – Han gu p – Record
  32. 32. Bas ic Call Flo w Mo s t act ion s t ar t s wit h ch an n el even t ● – Asterisk calls it a “rin g” Ch an n el con figu r at ion file is con s u lt ed ● – Au th en ticates – Negotiates cod ec ch oices – Miscellan eou s op tion s (CallerID, DTMF) – Sp ecifies d ialp lan con text Dialp lan con t ext is s ear ch ed for ext en s ion m at ch ● Ap p licat io n s ar e execu t ed b y p r io r it y ●
  33. 33. De m o ns tratio n Se tup

×