• No results found

Why Cluster? Exploring some of the decentralizing tools in Asterisk 1.4 and beyond

N/A
N/A
Protected

Academic year: 2021

Share "Why Cluster? Exploring some of the decentralizing tools in Asterisk 1.4 and beyond"

Copied!
59
0
0

Loading.... (view fulltext now)

Full text

(1)

Why Cluster?

Exploring some of the decentralizing tools in Asterisk 1.4 and beyond

(2)

Overview

• We'll look at some of the currently

available tools in Asterisk we can use for clustering, in addition to making you

aware of the tools that can further be used in our quest for a distributed

federation of servers in future versions of Asterisk -- right around the corner!

(3)

Overview

• A high level overview of topologies and technologies we can use right now to

start building distributed systems, but we don't have time to look at every nut and bolt

(4)

Overview

• Will be from the view of my personal

experience in building a distributed virtual

PBX system for an Internet Telephony Service Provider, and any tools I am familiar with that may be of a benefit to you (and me), in the future

• Clustering comes in many flavours, and a "drop in" solution is not yet possible

(5)

Why do I want to cluster?

• Lets you scale up the number of calls simply by adding another node (server) • If a server dies, the rest of the cluster will

(6)

! !

"#$%&'(')*#+!,-*(*.#/

0 !"#$%&'()*+,+-.()*+,+-(()*! !"#$#%#&'( 0 /0123456+!"#$#%#&')#%&$*#+$,-.)/#0'*( 0 4/741!!,.1-*2#$,-.)34'*0)&0&$'2( 0 ($8$19+:+4.08;19+<'8=$1;'!!+'.$*#/,5'") +-.1,64*#$,-.( 0 >?09@"AB9!!784&$),.)$,2'9)"#$#)1*-2)$:');<) ,.$-)$:')",#/=/#.( 0 1&/!2'3#4

(7)
(8)

Single Server

• Handles all features of your PBX system • No redundancy, no fail-over; if the

system goes down, your phones are down

• Typical system would handle 20 phones and 2-4 phone lines

(9)
(10)

Multi-Server

• Multiple boxes, each one handles one or more services

• Voicemail server, Queue server, Conferencing server, etc...

• Lets you scale a bit better by directing heavy load applications to dedicated machines

(11)

Cluster Topologies

• Centralized registration server • Distributed registration server • Hybrid registration server

(12)

! !

5#&-36(*.#/!7#)*+-36-*'&!8#39#3

0 5#&-36(!:'*&-!;'3!3#)*+-36-*'&<!/*+-3*=>-#+! $6((+!-'!2#/*6!+#39#3+ 0 ?%'&#+!3#)*+-#3!-'!6!+*&)(#!:'*&-@!6&/!-%6-! +#39#3!$'&-3'(+!/*+-3*=>-*'&!A-%*&B!+';-+C*-$%! D!3'>-#3E 0 56&!=#!'&#!';!+#9#36(!2#-%'/+F!G/#6((H! *)&'3#+!2#/*6!AI:#&8J7<!1+-#3*+B<! K3##+C*-$%FFFE 0 1((!#&/:'*&-+!3#)*+-#3!-'!6!+*&)(#!:(6$#@!+'!!!

(13)
(14)
(15)
(16)
(17)
(18)

! !

,+*&)!/*6(:(6&!;>&$-*'&+!C*-%!

L,ML*

!"#$%&%#!%'()'

!"#$%&%#!%*!+,-.%&/0/123/4567893*:89;<= 45;9>?@7AB!"#$%&%#!%CAD451E1<@>;F>@A

G,%,%-'()'

G,%,%-*!+,-.%&/0/123/4567893*:89;<=

45;9>?@7ABG,%,%-CAD451E1<@>;F>@A

.&,#H*,-IJ%'()'

.&,#H*,-IJ%/0/123/4567893*:89;<=45;9>?@7AB,-IJ%C'

(19)

! !

,+*&)!/*6(:(6&!;>&$-*'&+!C*-%!

L,ML*

!"#$%&%#!%'()'

!"#$%&%#!%*!+,-.%&/0/123/4567893*:89;<= 45;9>?@7AB!"#$%&%#!%CAD451E1<@>;F>@A

(20)

! !

,+*&)!/*6(:(6&!;>&$-*'&+!C*-%!

L,ML*

!"#$%&%#!%'()'

!"#$%&%#!%'!()*+%&/0/123/4567893*:89;<= 45;9>?@7AB!"#$%&%#!%CAD451E1<@>;F>@A

(21)

! !

,+*&)!/*6(:(6&!;>&$-*'&+!C*-%!

L,ML*

!"#$%&%#!%'()'

!"#$%&%#!%*!+,-.%&/,/123/4567893*:89;<= 45;9>?@7AB!"#$%&%#!%CAD451E1<@>;F>@A

(22)

! !

,+*&)!/*6(:(6&!;>&$-*'&+!C*-%!

L,ML*

!"#$%&%#!%'()'

!"#$%&%#!%*!+,-.%&/0/-.//4567893*:89;<= 45;9>?@7AB!"#$%&%#!%CAD451E1<@>;F>@A

"#$%&'(')H!3#+'>3$#!ACD4/74EF6GH! /*6(:(6&!963*6=(#E

(23)

! !

,+*&)!/*6(:(6&!;>&$-*'&+!C*-%!

L,ML*

!"#$%&%#!%'()' !"#$%&%#!%*!+,-.%&/0/123/012345/'645789 0175:;<3=>!"#$%&%#!%?=@01-A-8<:7B:<= 7#+>(-!3#->3&#/!*&!CD4/744F(EH JN62:(#P! QRL,MLLJ8"S!3#->3&#/!TTU+H+-#2I&#

(24)

DUNDIRESULT()

and

DUNDIQUERY()

• Unfortunately, in 1.4, we have to query each server individually – but in 1.6, we

have solved this with DUNDIQUERY()

and DUNDIRESULT()

• DUNDIQUERY() retrieves the data from

the servers, and DUNDIRESULT()

(25)

! !

DUNDIQUERY()

!JN62:(#

exten => _X.,1,Set(ID=${DUNDIQUERY(${USERNAME},

trunk_usage,b)})

exten => _X.,n,Set(NUM=${DUNDIRESULT(${ID},getnum)})

exten => _X.,n,NoOp(There are ${NUM} results)

exten => _X.,n,Set(X=1)

exten => _X.,n,While($[${X} <= ${NUM}])

exten => _X.,n,NoOp(Result ${X} is ${DUNDIRESULT(${ID},$

{X})})

exten => _X.,n,Set(X=$[${X} + 1])

(26)
(27)
(28)
(29)
(30)

Centralized Advantages

• Easier to control where to send calls

based on prior load testing (DUNDi and GROUP_COUNT function)

• May be simpler to administer (hub and spoke topology)

(31)

Centralized Disadvantages

• It's... well... centralized -- single point of failure

• May be a ceiling on the number of registrations the server can handle

(32)

Distributed registration server

• No centralized distribution server

• Phones can register to any server in the cluster

• Asterisk seeks out the registration point and delivers the call

• Uses DUNDi and regexten/regcontext methods

(33)
(34)
(35)
(36)
(37)
(38)
(39)
(40)

Distributed Advantages

• No central registration point to fail; phones can auto-failover

• Creates a "self-healing" network by nature

(41)

Distributed Disadvantages

• Harder to control number of calls each server handles

• Requires careful network planning in order to scale

• Fully meshed networks are fault tolerant, but are not (reasonably) scalable

(42)

Hybrid registration server

• Combine the advantages of distributed and centralized registration servers

• Utilize heartbeat to auto-failover registration server to another server in the LAN

• OR, run a pair of registration servers, balance the

registrations between them, and have the phones fail-over if a server dies

• Still have separate servers handle media and processing of calls based on prior load testing

(43)
(44)

Hybrid Advantages

• Get the best of both distributed and centralized models

(45)

Hybrid Disadvantages

• May be more complicated of a topology to initially configure and maintain

• More technologies involved could possibly mean more places to break

(46)

Clustering Tools

• DUNDi

• Realtime / UnixODBC (database integration) • func_odbc

(47)

DUNDi

(Distributed Universal Number Discovery)

• Is utilized to get information from other servers in the cluster

• We then use the returned information in our dialplan to make decisions

• Example: how many calls is a remote box currently handling?

• Another example: Is the Queue() a channel looking for currently available elsewhere in the cluster? If so, we should probably redirect the call

(48)

Realtime and UnixODBC

• Realtime allows you to place your flatfile configuration files (e.g. sip.conf) into the database. This allows multiple boxes to read and manipulate the same data as if it were a single system

• Could create a script to pull the data from the database, generate a flatfile and write it to the diskdrive, but this is messy...

• UnixODBC is a database communication abstraction layer that lets Asterisk talk to a single interface, but communicate with multiple databases (MySQL, PostgresSQL, etc...)

(49)

func_odbc

• The coolest tool at our disposal – no more AGI • Read and write data from the database directly

from the dialplan

• Manipulate and retrieve the same data your graphical system is using (i.e. one data entry point)

• The power of func_odbc is best described by looking at an example

(50)

! !

;>&$V'/=$!+62:(#

0 ;>&$V'/=$F$'&; [ROUTE] readhandle=asterisk prefix=GET readsql=SELECT did_source,did_destination,did_dest_address_id FROM ast_did_route WHERE did_number = '${ARG1}'

0 #N-#&+*'&+F$'&;

exten => s,n,Set(HASH(MY_ROUTE)=${GET_ROUTE(${DID})})

(51)

(I'm cheating a bit...)

• svn co http://svncommunity.digium.com/svn/func_odbc/1.4 /usr/src/func_odbc-1.4 • svn co http://svncommunity.digium.com/svn/app_stack/1.4 /usr/src/app_stack-1.4

• app_stack gives us: – GoSub()

– GoSubIf() – Return() – StackPop()

(52)

Voicemail

• We can centralize our voicemail using IMAP or ODBC storage

• This way, we don't have pieces of

voicemail all over the place, and we don't need to rely on a single server for

voicemail -- all servers in the cluster can handle voicemail

(53)

! !

"#$%&%'$(#)!*%+$,&%'

- ./%'%!0%+$,&%'!+&%!(#!1'$%&('2!34546!+#7!8(99!:+2%! :+#;!<0!$/%!$&(=2'!&%>,(&%7!(#!34?!#<!9<#)%&! #%=%''+&;@ A 17+B$(C%!DEF!0<&!GEHD@!%+'(9;!+77!#%8! =<9,:#'!$<!;<,&!DEF!&%=<&7' A 0,#=I7%C'$+$%@!=,'$<:(J%!7%C(=%!'$+$%! (#0<&:+$(<#!0&<:!$/%!7(+9B9+# A 1==%''!+99!&%',9$'!0&<:!+!EKLE(!>,%&;! MEKLE"NKOFP!+#7!EKLE"FOQKR.!0,#=$(<#'S A E;#+:(=!8%()/$!=<#$&<9!(#!EKLE(

(54)

What does the future hold?

• Current efforts include a binary encoded system inside of Asterisk, allowing

events to be sent across servers • The first example of this would be

Message Waiting Indication for

Voicemail() being distributed across various boxes

(55)

What does the future hold?

• Another application would be sharing device state amongst the cluster

• Immediately this would be useful for

sharing presence information, and is a prerequisite for building distributed

systems that depend on device states; distributed queues for example

(56)

! !

"#$!%&'&($!)*!+,-.!

/012!($023!4,(!'$*'5167

8 4&19:2$;*'0'$<!=01&0>>3!*$'!'#$!2$;59$! *'0'$!,4!0!2$;59$!51!'#$!250>?>01 @ A09B?,('!0;05>0A>$!C #''?<DD*;19,==&15'3E2565&=E9,=D*;1D(&**$>>D0*'$(5*BFGEHD4&19:2$;*'0'$FGEHD 8 I5*'(5A&'$2!2$;59$!*'0'$!/51!2$;$>,?=$1'7 @ J*$*!K?$1L)M!>5A(0(3 @ N5>>!1,'!#0;$!0!A09B?,('!2&$!',!9,=?>$O5'3 #''?<DD*;1E2565&=E9,=D*;1D0*'$(5*BD'$0=D(&**$>>D$;$1'*D

(57)

! !

+,-!)*!"#$!%&'&($.

8 PIQ!L20?'5;$!KIRP @ 9&*',=!9,>&=1*!=02$!$0*3. #''?<DD*;19,==&15'3E2565&=E9,=D*;1D'5>6#=01DA(019#$*DGEHD92(:020?'5;$:,2A9E9 8 S,M&A!D!S,M&A)4!D!M'09BT,? @ 1,-!-5'#!0(6&=$1'*.!/U09(,!($?>09$=$1'7 GoSub(subCallForward,s,1(${USERNAME})) #''?<DD*;19,==&15'3E2565&=E9,=D*;1D0??:*'09BDGEV L*'$(5*B!GEV!A09B?,(' #''?<DD*;19,==&15'3E2565&=E9,=D*;1D0??:*'09BDGEH L*'$(5*B!GEH!A09B?,('

(58)
(59)

! !

!"#$%&$'(#)"*+%$,"#

!"#$%&'()"*

+,,-.//00012"#$3'()"*1453

2"#$6(#7#831453

,0#,,"9.%2"#$:3'()"*

References

Related documents

National Conference on Technical Vocational Education, Training and Skills Development: A Roadmap for Empowerment (Dec. 2008): Ministry of Human Resource Development, Department

• Follow up with your employer each reporting period to ensure your hours are reported on a regular basis?. • Discuss your progress with

Finally, this study focuses on the influences of various parameters, such as the external stress regime, fluid viscosity and pre-existing fractures, on the

4.1 The Select Committee is asked to consider the proposed development of the Customer Service Function, the recommended service delivery option and the investment required8. It

Comparison of concentrations of both saturated and unsaturated fatty acids to those in Mongolian sheep superficial fat demonstrates total amount of unsaturated fatty acids in

Field experiments were conducted at Ebonyi State University Research Farm during 2009 and 2010 farming seasons to evaluate the effect of intercropping maize with

LV: left ventricle; LVEDA: left ventricular end‑diastolic area; FAC: fractional area of change; LVEDD: left ventricular end‑diastolic diameter; FS: fractional shortening; LVEDS:

How Many Breeding Females are Needed to Produce 40 Male Homozygotes per Week Using a Heterozygous Female x Heterozygous Male Breeding Scheme With 15% Non-Productive Breeders.