Está en la página 1de 78

n tt nghip i hc

M u

M U
--o0o--

Cng ngh thoi qua nn Internet dng giao thc IP (Voice Over IP
VoIP), l mt cng ngh m cho php ta to cuc gi bng cch kt ni bng
thng rng thay v dng ng dy in thoi s dng tn hiu tng t (analog).
Cng ngh Voip da trn chuyn mch gi (thay th cng ngh chuyn
mch knh). N c th nn v ghp nhiu knh thoi trn mt ng truyn tn
hiu. Cc tn hiu ny c truyn qua mng Internet, v th c th gim gi thnh
ng k. thc hin vic truyn ti ny, in thoi IP phi tch hp sn cc giao
thc bo hiu chun nh SIP hay H.323 kt ni ti mt tng i IP ca doanh
nghip hay nh cung cp.
p ng nhu cu trn, c mt phn mm ra i trn s kt hp gia
chuyn mch VoIP v chuyn mch TDM. Sn phm ny l mt h thng chuyn
mch mm m ngun m. N c vit bng ngn ng C,tch hp chy trn nn
Linux. chnh l phn mm Asterisk. Sn phm ny thc hin y cc tnh
nng ca mt tng i cng mt s tin ch mi rt hp dn.
Asterisk ra i vo nm 1999 bi mt sinh vin sinh nm 1977 tn l Mark
Spencer. Anh ta vit phn mm ny ban u vi mc ch h tr cho cng ty ca
mnh trong vic lin lc m thoi.
Asterisk h tr nhiu giao thc truyn thng khc nhau do s kt hp cng
ngh hin i VoIP v cng ngh PSTN . iu ny lm cho n mt cng c mnh
cho vic xy dng cc gateway v vic chuyn i giao thc.
tm hiu thm v h thng phn mm Asterisk , chng ta phi hiu
cng ngh Voip v cc tin ch ca cng ngh ny.

SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc

Li cm n

LI CM N
--o0o--

Trong k thc tp tt nghip v lm lun vn tt nghip va qua,em c


c hi p dng nhng kin thc m mnh hc vo thc t. ng thi, em
c thm nhng kin thc c bn v k thut vin thng, kin thc v ngn ng
lp trnh C#.
Sau mt thi gian lm vic ,vi s hng dn v tr gip tn tnh ca thy
Trn Minh Nht, em hon thnh ti ny mt cch thun li v gt hi c
mt s kt qu kh quan.
Em xin chn thnh cm n khoa Cng ngh Thng tin II, to iu kin
thun li v gip chng em hon thnh tt kha lun tt nghip ny.
Em xin chn thnh cm n thy Trn Minh Nht gio vin hng dn ti
ny, ch dy tn tnh, gip em rt nhiu trong qu trnh lm ti.
Em xin chn thnh cm n cc thy c trong khoa Cng ngh thng tin II
to iu kin tt cho em hon thnh ti.
Em xin chn thnh cm n n cc anh ch cng ty quc t Sng Hng,
to iu kin v h tr cho em hon thnh tt ti trong k thc tp v lun vn
va qua.
Trn nn tng nhng g thc hin, em s tip tc pht trin ti ny
phn mm ny c th p dng trong thc t.
Tuy em c gng hon thnh tht tt n tt nghip nhng chc chn s
khng trnh khi nhng thiu st.
Knh mong qu Thy C v cc bn gp ti hon thin hn.
Xin chn thnh cm n!
Sinh vin thc hin
Nguyn Thanh Tm

SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc

Mc lc

MC LC
M U ......................................................................................................................................... 0
CHNG 1: TNG QUAN V VOIP ........................................................................................ 1
1.1 Gii thiu VoIP ................................................................................................................... 1
1.1.1

Khi nim: .............................................................................................................. 1

1.1.2

u v Khyt ca VoIP:.......................................................................................... 2

1.2 Cc thit b dng trong VoIP: ........................................................................................... 2


1.2.1

VoIP phone ............................................................................................................. 2

1.2.2

Softphone ................................................................................................................ 2

1.2.3

Card giao tip vi PSTN........................................................................................ 2

1.2.4

ATA (Analog Telephone Adaptors)...................................................................... 3

1.3 u im s dng tng i IP-PBX so vi PBX truyn thng......................................... 4


CHNG 2: TM HIU TNG I ASTERISK .................................................................... 6
2.1 L do chn tng i IP ........................................................................................................ 6
2.1.1

Tch hp d dng .................................................................................................... 6

2.1.2

Gim chi ph cuc gi ............................................................................................ 6

2.1.3

Khng cn dy in thoi ring ............................................................................ 6

2.1.4

Khng b kho bi nh sn xut v m rng c ............................................. 6

2.1.5

Dch v khch hng v hiu nng tt ................................................................... 7

2.1.6

Tnh nng mi cp nht lin tc ........................................................................... 7

2.1.7

Kim sot tt hn nh bo co y ................................................................. 7

2.1.8

Xem tng quan tnh trng h thng hin ti ........................................................ 7

2.1.9

Di chuyn d dng .................................................................................................. 7

2.2 Tm hiu h thng m ngun m Asterisk ....................................................................... 7


2.2.1

V sao chn phn mm Asterisk............................................................................ 7

2.2.2

Gii thiu Asterisk ................................................................................................. 8

2.3 Kin trc h thng ............................................................................................................ 10


2.3.1

Asterisk l thit b trung gian ............................................................................. 10

2.3.2

Asterisk h tr nhiu loi in thoi .................................................................. 10

2.3.3

H thng Asterisk PBX Switching Core ............................................................... 10

2.3.4

Chc nng cc API(Application Program Interface) ....................................... 11

2.4 Tnh nng c bn .............................................................................................................. 11


2.4.1

Mt s chc nng trong tng i Asterisk ......................................................... 11

SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc
2.4.2

Mc lc

Mt s nh dng file ........................................................................................... 13

2.5 Cc giao thc VoIP trong h thng Asterisk ................................................................. 13


2.5.1

IAX(Inter-Asterisk Exchange) ............................................................................ 13

2.5.2

SIP ......................................................................................................................... 14

2.5.3

H.323 ..................................................................................................................... 16

2.5.4

MGCP(Media Gateway Control Protocol) ........................................................ 18

2.5.5

Skinny/SCCP ........................................................................................................ 18

2.5.6

UNISTIM .............................................................................................................. 19

2.6 Ng cnh ng dng trong tng i IP ............................................................................ 19


2.6.1

Kt ni IP PBX vi PBX ...................................................................................... 19

2.6.2

Kt ni gia Server Asterisk ............................................................................... 20

2.6.3

Cc ng dng IVR,Conference Call ................................................................... 20

2.6.4

Phn phi cuc gi t ng ACD........................................................................ 21

2.7 T chc th mc trong h thng Asterisk ...................................................................... 22


2.7.1

Cc th mc trong h thng................................................................................ 22

2.7.2

Cc tp tin cu hnh trong h thng ................................................................... 24

2.8 C ch FastAGI ................................................................................................................ 24


2.8.1

FastAGI l g? ...................................................................................................... 24

2.8.2

Hot ng.............................................................................................................. 25

3.1 Khi nim: ......................................................................................................................... 26


3.1.1

S lc v ting ni trong VoIP: ......................................................................... 26

3.1.2

Khi nim v Text To Speech: ............................................................................ 26

3.1.3

L do chn Text To Speech .................................................................................. 26

3.1.4

Hn ch ca Text To Speech (TTS) .................................................................... 27

3.2 Cu trc file m thanh ..................................................................................................... 27


3.2.1

Khi nim: ............................................................................................................ 27

3.2.2

nh dng d liu:................................................................................................ 27

3.2.3

X l tp tin wave ................................................................................................. 28

CHNG 4: TM HIU DCH V TRA CU IM TUYN SINH .................................. 39


4.1 Tng quan v h thng tuyn sinh: ................................................................................. 39
4.1.1

Hot ng: ............................................................................................................ 39

4.1.2

Cc thnh phn v qu trnh hot ng: .......................................................... 39

4.2 Chc nng ca h thng: ................................................................................................. 40

SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc

Mc lc

4.2.1 Tng qut chc nng ................................................................................................... 40


4.2.2 S x l chc nng................................................................................................... 41
4.3 Thit k lc d liu quan h ERD ........................................................................... 42
4.3.1

Cc tp thc th ................................................................................................... 42

4.3.2

Diagram ................................................................................................................ 42

4.4 Cc bng d liu ............................................................................................................... 43


4.4.1

Danh sch bng d liu: ...................................................................................... 43

4.4.2

M t cc bng: .................................................................................................... 43

4.4.3

Cc mi lin h ..................................................................................................... 45

4.5 Nhng thun li v kh khn ca ng dng: ................................................................ 46


4.5.1

Thun li ............................................................................................................... 46

4.5.2

Kh khn............................................................................................................... 46

CHNG 5: CI T V CU HNH H THNG SERVER .......................................... 47


5.1

Ci t cc tnh nng c bn ca tng i Asterisk ...................................................... 47


5.1.1

Yu cu thit b: ................................................................................................... 47

5.1.2

Cc bc ci t cc gi Asterisk phin bn 1.6.2.20 ....................................... 47

5.1.3

Ti chng trnh Asterisk.NET: ......................................................................... 48

5.1.4

Cu hnh SIP cho softphone ................................................................................ 48

5.2 Ci t Sql Server 2005 v to cc bng d liu............................................................ 50


5.2.1

Ti sao chn Sql Server 2005 .............................................................................. 50

5.2.2

Bng d liu .......................................................................................................... 50

5.3 Kt qu t c ca vic thc thi tng i t ng .................................................... 53


5.3.1

Ci t Server ....................................................................................................... 53

5.3.2

Hot ng ca tng i:....................................................................................... 53

5.3.3

Qu trnh tng hp ting ni: ............................................................................. 62

5.4 Kt lun ............................................................................................................................. 63


5.5 Nhng hn ch: ................................................................................................................. 64
NH GI CHUNG V XU HNG PHT TRIN TI ............................................. 65
PH LC...................................................................................................................................... 67
TI LIU THAM KHO ........................................................................................................... 68

SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc

Danh mc hnh nh

DANH MC HNH NH
Chng 1
Hnh 1.1 : Thit b card phn cng giao tip vi PSTN .................................... 3
Hnh 1.2 : M hnh cc thit b kt ni vi Adapter .......................................... 4
Hnh 1.3 : H thng tng i IP-PBX ................................................................ 5
Chng 2
Hnh 2.1 : M hnh VoIP to PSTN s dng tng i Asterisk .......................... 8
Hnh 2.2 : Kin trc ca Asterik ....................................................................... 9
Hnh 2.3 : S kt ni gia tng i vi cc thit b ..................................... 10
Hnh 2.4 : Hot ng ca SIP ........................................................................... 15
Hnh 2.5 : M hnh iu khin cuc gi H.323 ................................................. 17
Hnh 2.6 : Hot ng ca giao thc MCGP ....................................................... 18
Hnh 2.7 : S kt ni IP PBX vi PBX ........................................................ 19
Hnh 2.8 : S kt ni cc server Asterisk ...................................................... 20
Hnh 2.9 : Cc ng dng ca tng i .............................................................. 21
Hnh 2.10 : Phn phi cuc gi ACD ................................................................ 23
Hnh 2.11 : Cu trc th mc trong var ............................................................. 23
Hnh 2.12 : M hnh kt ni ca chng trnh Asterisk.NET ........................... 27
Chng 3
Hnh 3.1 : nh dng chui sng ....................................................................... 28
Hnh 3.2 : Cu trc tp tin m thanh .................................................................. 29
Hnh 3.3 : Ln song dng RIFF ......................................................................... 30
Hnh 3.4 : nh dng d liu Chunk .................................................................. 33
Hnh 3.5 : Ln sng mu Interkind Stereo ......................................................... 34
Hnh 3.6 : nh dng thc t Chunk .................................................................. 35
Chng 4
Hnh 4.1 : Chc nng ca ng dng tuyn sinh ................................................. 40
Hnh 4.2 : M hnh tp thc th ......................................................................... 42
Hnh 4.3 : S Diagram .................................................................................. 42
Chng 5
Hnh 5.1 : Cu hnh SoftPhone .......................................................................... 51
Hnh 5.2 : Cu hnh gi dch v t xa ................................................................ 52
Hnh 5.3 : M hnh sau khi kt ni Asterisk ................................................. 53
Hnh 5.4 : Cu hnh file Sip ............................................................................... 54
Hnh 5.5 : Cu hnh file extensions.................................................................... 55
Hnh 5.6 : Cu hnh tp tin chia s ..................................................................... 55
Hnh 5.7 : Khi ng samba .............................................................................. 56
Hnh 5.8 : Khai bo user chia s ........................................................................ 56
Hnh 5.9 : ng dn vo server ....................................................................... 56
Hnh 5.10 : a ch share tp tin m thanh ........................................................ 57
Hnh 5.11: Kt ni gia my server v my client ............................................ 58
Hnh 5.12 : Script kt ni vi server .................................................................. 59
Hnh 5.13 : Mn hnh kt ni dch v ........................................................... 60
SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc

Danh mc hnh nh

Hnh 5.14 : X l phm s 1 ............................................................................... 60


Hnh 5.15 : X l phm s 2 ............................................................................... 61
Hnh 5.16 :Trng hp sai phm bm ................................................................ 62
Hnh 5.17: X l ghp m thanh......................................................................... 62
Hnh 5.18: Th mc c file m thanh t Text ................................................. 63
nh gi chung
Hnh1 : M hnh dch v IVR ............................................................................ 65

SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc

K hiu cc cm t vit tt

K HIU CC CM T VIT TT
A
ATA : Analog Telephone Adaptors

B chuyn i in thoi s

API : Application Programming Interface

Giao din ng dng

AGI : Asterisk Gateway Interface


ACD : Automatic Call Distribution

Giao din cng Asterisk


Phn phi cuc gi t ng

C
CGI : Computer Graphics International

ha my tnh quc t

CSDL :

C s d liu

D
DoS : Denial of Service

T chi dch v

F
FXO : Foreign Exchange Office
FXS : Foreign Exchange Station

Cng tip nhn ng tn hiu tng t


Cng cung cp ng tn hiu tng t

H
HTTP : Hypertext Transfer Protocol

Giao thc truyn siu vn bn

I
IP : Internet Protocol
IP-PBX : Internet ProtocolPrivate Branch Exchange
IAX : Inter-Asterisk eXchange
IVR : Interactive Voice Response
ITSP : Internet Telephony Service Provider
IETF : Internet Engineering Task Force
ITU : International Telecommunication Union
ISDN : Interated Services Digital Network

SVTH: Nguyn Thanh Tm - Lp:D07THPM

Giao thc Internet


Tng i IP
Giao thc chuyn i IAX
Tng tc thoi
Nh cung cp dch v in thoi Internet
Cng ng quc t m v mng
Lin minh Vin thng quc t
Mng s tch hp dch v

n tt nghip i hc

K hiu cc cm t vit tt

M
MGCP : Media Gateway Control Protocol

Giao thc iu khin cng truyn thng

MD5 : Message-Digest algorithm 5

L hm bm mt m

N
NAT : Network Address Translators

Bin dch a ch mng

P
PBX : Private Branch Exchange
PSTN : Public Switched Telephone Network

Tng i Nhnh Ring


Mng in thoi chuyn mch cng cng

R
RJ-11 : Registered Jack 11
RJ-45 : Registered Jack 45
RTP : Real-Time Transport Protocol
RSA : Resgister Admission Status
RFC : Request for Comment
RTCP : Real Time Control Protocol

Kt ni cc thit b in thoi
Kt ni cc thit b trong mng Ethernet
Giao thc truyn thi gian thc
Bo hiu ng k, cp php, thng tin
trng thi
Yu cu cho kin
Giao thc iu khin thi gian thc

S
SIP : Session Initiation Protocol
SCCP : Signaling connection Control Part
SMTP : Simple Mail Transfer Protocol

Giao thc khi to phin


Phn iu khin kt ni tn hiu
Giao thc truyn thng tin n gin

T
TDM : Time Division Multiplexing
TTS :
TLS : Transport Layer Securit
TCP : Transport Control Protocol
TTS: Text To Speech

Ghp knh phn chia thi gian


Tng i in t s
Giao thc bo mt lp truyn ti
Giao thc iu khin truyn TCP
Chuyn vn bn thnh ting ni

SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc

K hiu cc cm t vit tt

U
UDP : User Datagram Protocol

Giao thc gi ngi s dng

V
VoIP : Voice over Internet Protocol

Ting ni qua giao thc Internet

VPN : Virtual Private NetWork


WAN : Wide Area Network

Mng ring o
Mng din rng

SVTH: Nguyn Thanh Tm - Lp:D07THPM

n tt nghip i hc

Chng 1:Tng quan v VOIP

CHNG 1: TNG QUAN V VOIP


1.1 Gii thiu VoIP
1.1.1 Khi nim:
VoIP (Voice Over Internet Protocol) l mt cng ngh cho php truyn
thoi s dng giao thc mng IP trn c s h tng sn c ca mng
Internet.
VoIP c th va thc hin mi cuc gi trn mng in thoi thng
thng va c th truyn d liu trn mng truyn s liu. Do cc u
im v gi thnh dch v v s tch hp nhiu loi hnh dch v nn
VoIP hin nay c trin khai rng ri.
Dch v in thoi VoIP bao gm vic s ha tn hiu ting ni, thc
hin nn tn hiu s, chia nh cc gi nu cn v truyn gi tin ny qua
mng. Ti ni nhn, cc gi tin ny c rp li theo ng trnh t bn
tin v gii m phc hi li ting ni ban u.
Cc cuc gi trong VoIP da trn c s s dng kt hp chuyn mch
knh v chuyn mch gi. Trong mi loi chuyn mch u c u v
nhc im.
Vi chuyn mch knh dnh ring mt knh c tc truyn
dn c nh (trong mng PSTN, tc ny l 64Kbit/s) do
c tr nh v chnh xc cao nn khng th xy ra tc
nghn.
Vi chuyn mch gi, cc bn tin c chia thnh cc gi
nh, s dng h thng lu tr v chuyn tip cc gi thng
tin trong nt mng. i vi loi chuyn mch gi ny khng
tn ti khi nim knh ring v bng thng hon ton c th
thay i c. Tuy nhin, k thut ny li cho tr ln v
trong chuyn mch ny khng quy nh thi gian mi gi ti
ch do khng p ng c tnh thi gian thc nh trong
thoi.
Nh vy truyn dn thoi trong mi trng mng chuyn mch gi,
VoIP phi kt hp c u im ca hai loi chuyn mch knh v gi.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 1

n tt nghip i hc

Chng 1:Tng quan v VOIP

1.1.2 u v Khyt ca VoIP:


u im:
i vi in thoi Internet c cc c ch pht hin khong lng
(khong thi gian khng c ting ni) nn s lm tng hiu sut mng.
in thoi IP l bc t ph v cng ngh v dch v, mang li kh
nng gi ng di v quc t vi gi r.
in thoi IP cn mang li li ch trong vic pht trin tch hp cc dch
v vin thng v m rng dch v .
Khuyt im ca VoIP:
Khng th thc hin mi cuc gi qua Internet nu nh ngi gi khng
c trc tuyn trn mng.
Khng m bo tnh bo mt.
1.2 Cc thit b dng trong VoIP:
1.2.1 VoIP phone
L thit b phn cng kt ni vi VoIP ging nh my in thoi c nh
thng thng. Tuy nhin s dng cho VoIP cn phi cu hnh trc
khi s dng.
Mt s tnh nng khi mua thit b in thoi VoIP:
Low Bandwidth: h tr cho loi Codec no, thng hin nay
ngi ta s dng G729.
Web Interface: phi c giao tip thit lp cu hnh thn thin , d
s dng.
Audio Interface: xt xem c speaker phone hay khng.
1.2.2 Softphone
L mt phn mm c ci trn my tnh, thc hin tt c cc chc nng
ging nh thit b in thoi VoIP.
Khi s dng softphone, ta phi c card m thanh giao tip my tnh,
headphone v firewall khng b kha(hoc tt firewall).
i vi h thng Asterisk, nn dng softphone vi cng ngh giao thc
mi dnh cho Asterisk l IAX.
1.2.3 Card giao tip vi PSTN
cc my in thoi ni b trong h thng Asterisk kt ni v thc
hin cuc gi vi mng PSTN, chng ta cn phi c thit b phn cng
tng thch. chnh l thit b ca cng ty Digium.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 2

n tt nghip i hc

Chng 1:Tng quan v VOIP

Thit b phn cng s dng cho h thng Asterisk do chnh tc gi lp


cng ty Digium phn phi, xut pht t tng phn phi phn mm
Asterisk v h thng ngun m min ph.

1.2.4

Hnh 1.1: Thit b card phn cng.


Thit b phn cng thng k hiu bt u bng cm t TDMxyB,
trong :
x l s lng port FXS.
y l s lng port FXO
Gi tr ti a ca c x v y l 4.
ATA (Analog Telephone Adaptors)
ATA l thit b kt ni vi in thoi Analog thng thng n mng
VoIP, mt thit b ATA gm c hai loi port:
RJ-11 kt ni vi my analog thng thng.
RJ-45 kt ni vi mng VoIP.
ATA l thit b FXS chuyn i tn hiu Analog sang tn hiu s, n s
dng cho mng VoIP tn dng thit b Analog kt ni VoIP.
Thit b ATA s dng vi giao thc IAX c Digium phn phi v
thit b ATA ny c s dng rng ri vi Asterisk c tn gi l IAXy.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 3

n tt nghip i hc

Chng 1:Tng quan v VOIP

Hnh 1.2: M hnh cc thit b kt ni vi Adapter


1.3 u im s dng tng i IP-PBX so vi PBX truyn thng.
Tn dng c ton b h tng mng ca n v truyn thng tin
thoi, n gin hn nhiu vi PBX truyn thng, phi thc hin vic u
ni vt l ng trung k gia hai tng i.
Qun l tp trung, thng qua giao din web. qun tr vin c th gim
st, vn hnh, cu hnh t bt k u v bt c khi no.
Kh nng nng cp h thng cao nht v khng gii hn s lng ngi
dng.
Tch hp phn mm Softphone ci trn my tnh, ch cn thm tai nghe
v mic l bin thnh in thoi IP.
in thoi IP c th kt ni v tng i ti bt c v tr no(c mng l
c th s dng c ngay) trong khi s in thoi khng h thay i,
thm ch qua c mi trng Internet.
Ct gim chi ph cuc gi n mc thp nht gia cc chi nhnh, vn
phng v cuc gi quc t khi kt hp vi cc nh cung cp dch v in
thoi quc t (ITSP).

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 4

n tt nghip i hc

Chng 1:Tng quan v VOIP

Hnh 1.3: H thng mt tng i IP-PBX

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 5

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

CHNG 2: TM HIU TNG I ASTERISK


2.1 L do chn tng i IP
2.1.1 Tch hp d dng
Tng i d ci t hn so vi h thng in thoi thng thng.
Thit lp cc thng s thng qua giao din web, khng cn ci t bt k
phn mm phc tp no vn hnh n. Do , bt k ai c hiu bit v
my tnh u c th ci t h thng PBX.So vi h thng in thoi
truyn thng th nhn vin ci t phi c hun luyn v cch vn
hnh h thng .
2.1.2 Gim chi ph cuc gi
Bn s tit kim c rt nhiu chi ph nu s dng dch v VoIP i
vi cuc gi ng di hay gi ra quc t.
Kt ni in thoi d dng gia cc vn phng hay chi nhnh v c
gi ni mng min ph.
2.1.3 Khng cn dy in thoi ring
Cho php bn kt ni in thoi phn cng trc tip vo cng mng tiu
chun ca my tnh c th chia s vi my tnh bn cnh.
in thoi ny dng phn mm nn c ci trc tip ln my tnh ,
khng cn lp t v duy tr mt dy ring cho h thng in thoi.
Linh ng trong vic m rng h thng v thm ngi dng. Nht l
trong trng hp bn chuyn n vn phng mi v cha ko dy in
thoi th bn c th tit kim bng cch lp t mt mng my tnh.
2.1.4 Khng b kho bi nh sn xut v m rng c
H thng VOIP l h thng tiu chun m, n s dng giao thc SIP.
Bn c th dng bt k in thoi VOIP chun SIP hay phn cng VOIP
gateway no.
So vi h thng in thoi thng thng, pht trin ln hn (nh
thm ng dy,thm s my nhnh), ta phi m rng thm cc m un,
nng cp nhng phn cng t tin hay c khi l lm mi h thng hon
ton.
Vi mt my tnh bnh thng, ta c th qun l mt lng ln cc
ng dy in thoi v cc s my nhnh con.Nu mun m rng ta
ch cn thm cc in thoi mi vo trong mng ca bn .

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 6

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

2.1.5 Dch v khch hng v hiu nng tt


D tch hp vi cc ng dng thng mi do cc cuc gi da trn my
tnh
Cc cuc gi i c th thc hin trc tip t Outlook , khng cn phi g
s in thoi vo.
Tt c tnh nng u c thc hin d dng t mt giao din ngi
dng vi cc ca s thn thin(nht l dng trong hi m)
2.1.6 Tnh nng mi cp nht lin tc
H thng VOIP da trn phn mm nn cc nh pht trin c th
thm,ci thin cc tnh nng mt cch d dng.
Cc chc nng cp nht lin tc nh tr li t ng,th thoi,cuc gi
ch,danh sch en
2.1.7 Kim sot tt hn nh bo co y
Cc thit lp VOIP lu tr thng tin cuc gi n v cuc gi i trong
mt c s d liu trn my ch ca bn. V th, bn s cp nht y
v chi ph gi v lu lng gi.
2.1.8 Xem tng quan tnh trng h thng hin ti
Thng qua trnh duyt web, bn c th ch nh ngi dng no c th
xem tnh trng ca h thng dng ho.
Nu vi h thng thng thng th bn phi cung cp cc my in thoi
vi h thng t tin bit nhng g ang din ra trong my in thoi.
2.1.9 Di chuyn d dng
Ngi dng ch cn ly in thoi v cm n vo cng Ethernet gn nht
.c bit, h vn gi c s in thoi hin c.
Cc cuc gi c th c chuyn hng n bt k u trn th gii nh
vo cc c im ca giao thc SIP.
2.2 Tm hiu h thng m ngun m Asterisk
2.2.1 V sao chn phn mm Asterisk
Tit kim chi ph ( chi ph thp hn so vi cc tng i khc).
Asterisk c xem nh l mt tng i PBX (Private Branch
eXchange) v tch hp nhiu tnh nng mi.
Ngoi nhng tnh nng ca mt tng i PBX thng thng, Asterisk
cn c tch hp c chuyn mch TDM v chuyn mch VoIP, c kh
nng m rng p ng nhu cu cho tng ng dng nh m rng giao
tip vi mng PSTN (Public Switched Telephone Network).

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 7

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

Asterisk c th chy trn cc h iu hnh khc nh: Mac OS X,


Linux,FreeBSD, OpenBSD v Microsoft Windown
Vi mt my tnh ci h iu hnh (mt trong cc h iu hnh ni
trn, y ta xt h iu hnh Linux) v c thm phn mm Asterisk
cu hnh, khi my tnh ny s c y tnh nng ca mt tng i
in thoi v c th hn th.
2.2.2 Gii thiu Asterisk
Asterisk l phn mm ngun m,mt h thng chuyn mch mm, c
vit bng ngn ng C, ra i nm 1999 bi Mark Spencer,
Phn mm u tin c thit k v trin khai trn GNU/Linux nn x86
(ca Intel).
Asterisk l mt b cng c m ngun m cho cc ng dng thoi. L
server x l y cc chc nng cuc gi, thc hin tt c cc tnh
nng ca tng i PBX.
Tch hp giao tip vi mng PSTN v mng VOIP cho php gi ra bt
c s in thoi no trn mng PSTN.

Hnh 2.1: M hnh VoIP-to-PSTN s dng tng i Asterisk


ng dng cho in thoi: chuyn mch cuc gi, cuc gi hi ngh,
voicemail, chuyn hng cuc gi,
Mt Asterisk server c kt ni ti mt mng vng ni ht s iu
khin cc in thoi trong mng kt ni n mng khc, cc in thoi
trong mng c th thc hin cuc gi v kt ni Internet thng qua
Asterisk server.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 8

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

Cng FXS dng Asterisk server iu khin cc in thoi tng t


trong ni ht. Cng FXO v knh T c dng kt ni gia Asterisk
server vi mng PSTN. Thu bao trong mng PSTN thc hin cuc gi
n cc thu bao c qun l bi Asterisk server, cc thu bao ca
Asterisk cng c th thc hin cuc gi n thu bao trong mng PSTN.

Hnh 2.2: Kin trc ca Asterisk


Khi khi ng h thng Asterisk th Dynamic Module Loader thc
hin np driver ca thit b v bt u np cc giao thc.
Hin nay h thng Asterisk ang c pht trin mnh, nhiu doanh
nghip, cng ty v ang trin khai h thng to.H to lin lc bn
trong v ra c mng ngoi thng qua mng my tnh, gi in thoi.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 9

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

Hnh 2.3: S kt ni gia tng i v cc thit b.


Asterisk khng ch giao tip, kt ni gia cc in thoi vi nhau m
cn c th m rng kt ni n cc tng i khc, vi IP Phone v nhiu
dch v nh: Softswitch, Media Gateway, Voicemail Services,
Conference Server, Music on hold
Asterisk l mt phn mm ngun m, min ph, c tin cy cao.
2.3 Kin trc h thng
2.3.1 Asterisk l thit b trung gian
Thit b lin kt cng ngh thoi v Internet.
c ng dng kt ni in thoi ,gi thoi n mt dch v khc.
Asterisk c tin vy cao v d dng trin khai cho cc h thng (t h
thng nh n h thng ln).
2.3.2 Asterisk h tr nhiu loi in thoi
H tr cc cng ngh thoi nh VoIP,SIP,H.323,IAX.
Kt ni vi hu ht loi in thoi truyn thng mng ISDN qua lung
T1 v E1 cng cc API c np vo h thng.
2.3.3 H thng Asterisk PBX Switching Core
Cc cuc gi c thc hin tu vo k hoch quay s.
Chc nng Application Launchar rung chung thu bao, kt ni vi
hp th thoi hoc gi ra ng trung k

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 10

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

Scheduler and I/O Manager m nhim cc ng dng nng cao nh: lp


thi biu v qun l cc cuc gi n gi ra ngoi. y l cc chc
nng c pht trin bi cng ng pht trin Asterisk.
Codec Translator xc nhn cc knh nn d liu ng vi cc chun khc
nhau c th kt hp lin lc c vi nhau.
Tt c cc cuc gi nh hng qua h thng Asterisk u thng qua cc
giao tip nh: SIP, Zaptel or IAX. Mi cuc gi vo v ra ngoi u
c thc hin thng qua cc giao tip trn. V th h thng Asterisk
phi m trch nhim v lin kt cc giao tip khc nhau x l
cuc gi.
2.3.4 Chc nng cc API(Application Program Interface)
Codec translator API: cc hm m nhim thc thi v gii nn cc chun
khc nhau nh: GMS, G723, Mu-Law
Asterisk Channel API : giao tip vi cc knh lin lc khc nhau, y l
u mi cho vic kt ni cc cuc gi tng thch vi nhiu chun khc
nhau nh SIP, ISDN, H323, Zaptel
Asterisk file format API : Asterisk tng thch vi vic x l cc loi
file c nh dng khc nhau nh: Mp3, WAV, GSM, AU
Asterisk Aplication API : bao gm tt c cc ng dng c thc thi
trong h thng Asterisk nh: cuc gi hi ngh, VoiceMail, CallerID
Ngoi ra, Asterisk cn c th vin Asterisk Gateway Interface (AGI, tng t
nh CGI) c ch kch hot ng dng bn ngoi, cho php vit kch bn phc
tp vi mt s ngn ng nh PHP hay Perl.
2.4 Tnh nng c bn
2.4.1 Mt s chc nng trong tng i Asterisk
2.4.1.a Voice mail - hp th thoi
Cho php h thng nhn cc thng ip tin nhn thoi.
Mi my in thoi c khai bo trong h thng cho php khai bo
thm cha nng hp th thoi.
Khi s in thoi bn hay ngoi vng ph sng th h thng nh hng
trc tip n cc cuc gi n hp th thoi tng ng khai bo
trc.
Voice mail cung cp cho ngi s dng nhiu la chn nh: xc nhn
password khi truy cp vo,gi mail bo c thng ip mi n.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 11

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

2.4.1.b Call Forwarding chuyn cuc gi


Cho php chuyn mt cuc gi n mt hay nhiu s my in thoi
c nh trc.
Mt s trng hp cn chuyn cuc gi nh: chuyn cuc gi khi
bn ,chuyn khi khng tr li, chuyn cuc gi tc thi, chuyn cuc
gi vi thi gian nh trc.
2.4.1.c Caller ID hin th s gi n
Cho php ta xc nhn s thu bao gi n,da vo ta c th bit m
tip nhn hay khng tip nhn cuc gi n t pha h thng.
Chc nng ny rt hu dng cho vic ta mun bit chnh xc cuc gi
n t ai v ngn c mt s cuc gi ngoi mun.
2.4.1.d Automated attendant tng tc thoi
Chc nng ny ng dng trong thc t rt nhiu v thn thin vi ngi
dng.
Mt s trng hp nh khi gi n ng dy nng mt cng ty,c
quanta s nghe thng ip:Cho mng bn n vi cng ty A, bn
vui lng bm phm 1 gp phng nhn s,bm phm 2 gp phng
kinh doanh
Cc dch v xem im thi,xem t s trn bng ,xem kt qu s
su thc hin nh chc nng tng tc thoi IVR.
Vi chc nng ny, h thng s nh hng cuc gi theo mong mun.
2.4.1.e Time and Date
Cuc gi c nh hng n mt s in thoi hay mt chc nng no
vo tng thi im m ta qui nh trong tng i.
Chc nng rt hu dng trong cc cng ty mun kim sot nhn vin.
Chng hn,trong cng ty A gim c ch cho php nhn vin dng in
thoi trong gi hnh chnh cn ngoi gi th s hn ch hoc khng cho
gi ra ngoi.
2.4.1.f Call Parking
Chc nng cho php chuyn cuc gi c qun l.
Vi chc nng ny ta phi c mt s in thoi trung gian v hai thu
bao c th gp nhau khi thu bao c gi nhn vo s in thoi m
thu bao ch ang ch trn v t y c th m thoi vi nhau.
Chng hn nh, khch hng mun gp gim c nhng khi gi vo
cng ty, khch hng s gp th k trc v sau th k s ni ng
dy vo cho gim c.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 12

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

2.4.1.g Remote call pickup


Chc nng cho php ta c th nhn cuc gi t my in thoi khc
ang rung chung.
2.4.1.h Privacy Manager
Tnh nng ny qui nh in thoi ca ta ch c gi n nhng s c
nh no (c lp trnh sn trong h thng), nhng s ngoi danh
sch nh sn s khng thc hin c.
Chng hn, khi mt ch doanh nghip xy dng h thng in thoi
nhng khng mun nhn vin mnh gi ra ngoi tr chuyn vi bn b
hay dng trong vic ring.
2.4.1.i Backlist
Ging chc nng ca Privacy Manager nhng cung cp thm mt tnh
nng na. l nhng my in thoi nm trong danh sch ny s khng
c gi n my ca bn.
Tnh nng ny hu dng trong trng hp bn thng xuyn b quy ri
in thoi.
Vi nhng tnh nng trn cho thy s a dng v dch v ca h thng tng
i Asterisk. Tuy nhin, ch l cc tnh nng c bn,bn c th nng cp
cc tnh nng cao cp hn bng vic tch hp thm mt s sn phm phn
cng ca nh cung cp dch v thoi IP.
2.4.2 Mt s nh dng file
Raw : d liu 16 bit tuyn tnh
Pcm: d liu 8 bit.
Vox : d liu 4 bit IMA-ADPCM
Wav : file wav tuyn tnh 16 bit 8 KHz
Wav : file wav nn GSM 8 KHz
Gsm: d liu nn GSM
G723 : nh dng g723 n gin vi nhn thi gian.
2.5 Cc giao thc VoIP trong h thng Asterisk
2.5.1 IAX(Inter-Asterisk Exchange)
IAX l mt giao thc m, ta c th download v pht trin n hon ton
min ph.Phin bn hin ti ca n l IAX 2.
Tt c cc h tr cho IAX 1 khng cn tn ti na. V vy khi ni n
IAX c ngha l IAX2. Trong Asterisk, IAX c h tr bi module
chan_iax2.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 13

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

IAX c pht trin bi Digium vi mc ch giao tip vi cc server


Asterisk khc, v th n c gi l Inter-Asterisk eXchange. IAX l
giao thc truyn ti (ging nh SIP), s dng port UDP 4569 cho c
knh tn hiu ln dng d liu RTP.
IAX c kh nng kt hp li nhiu phin kt ni thnh mt dng d liu
duy nht. Vic kt hp ny lm tng kh nng s dng bng thng.
Thm vo vic s dng mt header chung duy nht lm gim thi
gian overhead cho mi knh ring l. Giao thc ny thch hp khi c
nhiu knh kt ni gia hai u cui.
V IAX c ti u ha cho thoi, nn trn thc t n khng u vit khi
truyn tn hiu video. Tuy nhin, v n l mt giao thc m, nn vic m
rng dnh cho cc loi d liu khc ngoi thoi l iu hon ton c th.
V kha cnh bo mt, IAX c kh nng nhn thc bng ba cch khc
nhau nh sau:
Plain text
M ha MD5
M ha trao i kha RSA.
Khng m ha phn header gia hai u cui. C nhiu gii php s
dng mng ring o (VPN) v cc phn mm m ha khc c s
dng, i hi u cui phi thit lp trc cc phng php tunnel v
hot ng.
Trong tng lai, IAX c th m ha dng d liu gia hai u cui s
dng vic trao i kha RSA hoc trao i ha ng ti thi im thit
lp cuc gi. iu ny rt hp dn v n c tnh bo mt kh cao, c
bit trong cc lnh vc i hi tnh bo mt nh ngn hng.
IAX2 c thit k tng thch vi cc thit b s dng giao thc
NAT. Vic s dng duy nht mt port UDP cho c tn hiu bo hiu v
truyn dn dn n tng cg tnh nng bo mt ca firewall. iu ny
lm cho IAX l mt trong cc giao thc bo mt tt nht cho mng.
2.5.2 SIP
S ra i ca SIP gip pht trin mnh VoIP. SIP c u im l giao
thc n gin, c cu trc syntax kh ging vi cc giao thc HTTP hay
SMTP.

SIP c h tr bi module trong Asterisk l chan_sip.so module.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 14

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

SIP c pht trin bi IETF vo thng 2-1996. Ban u SIP ch c


chc nng yu cu thit lp cuc gi. Vo thng 3-1999, phin bn th
11 c tn gi l SIP RFC 2543 ra i.
SIP c coi nh l giao thc thng dng ca VoIP. Tt c cc user v
doanh nghip u c xu hng h tr SIP.
Ngy nay,SIP h tr thm c nhng chc nng khng c trong VoIP nh
video, m nhc v cc dch v multimedia thi gian thc khc.

Hnh 2.4: M hnh hot ng SIP.


Yu cu SIP c 6 loi:
INVITE : thit lp phin
ACK: xc nhn yu cu invite
BYE : kt thc phin
CANCEL: hu b vic thit lp phin
REGISTER: trao i thng tin a im ngi dng (bao gm
tn my,IP)
OPTIONS : trao i cc thng tin v kh nng ca cc in
thoi SIP gi v nghe trong phin.
Phn hi SIP : cc yu cu SIP c tr li bng cc phn hi SIP v c
6 loi phn hi:

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 15

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

1xx = phn hi thng tin.


2xx = phn hi thnh cng
3xx = phn hi chuyn hng
4xx = yu cu b tht bi
5xx = li my ch
6xx = tht bi ton cc

DoS (Denial of Service) c xem nh phng thc tn cng thng


dng nht trn mng VoIP. Mt phin tn cng DoS s din ra khi c
mt s lng ln cc li mi INVITE khng hp l n proxy server
lm qu ti h thng. SIP c mt vi phng thc gim thiu tc
ng ca DoS nhng khng th hon ton phng nga n.
Mt lc h tr tnh bo mt c ci t thm bi SIP l mt m
phng thc truyn ti (TLS- Transport Layer Security). N c s
dng thit lp kt ni gia ngi gi v domain. Yu cu c gi
mt cch b mt n u cui, da trn cc chnh sch bo mt ca
mng. Lu rng phng thc mt m khng nm trong kh nng ca
SIP v phi c kt hp mt cch c lp.
SIP v NAT: Mt trong nhng vn ln nht khi trin khai SIP l
truyn ti thng qua lp NAT. Bi v SIP mt m thng tin a ch trong
cu trc khung ca n. NAT lp mng s khng nhn ng a ch
ny.V th dng d liu s khng c truyn ti ng nh mong mun.
Nh vy, cc firewall c tch hp chc nng NAT s loi b cc kt
ni SIP ny.
2.5.3 H.323
H323 c pht trin bi ITU t thng 5-1996, h tr truyn thoi,
video, d liu ,fax trong khi mng IP vn duy tr kt ni vi mng
PSTN truyn thng. T thi im , H323 c mt vi phin bn vi
cc tnh nng b sung cho php n hot ng trong mt mng thun
VoIP v cc mng phn b khc.
D c nhiu tranh ci xung quanh vic s dng H323 hay l SIP.Nhng
trn thc t mng VoIP, H323 c vi tr cao nht cn trn h thng
Asterisk, SIP vn l s la chn s mt.
Hai phin bn ca H323 c h tr trong Asterisk c h tr bi 2
module chan_h323.so v chan_oh323.so.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 16

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

V kha cnh bo mt, H323 l mt giao thc c tnh bo mt tng i


cao.V H323 s dng RTP kt ni media, n khng h tr mt m.
Vic s dng VPN hay cc phng php tunnel khc gia u cui l
cch thc thng dng nht m bo tnh bo mt. Tt nhin l n
cng gy ra mt vi vn . Khi VoIP c s dng cho cc lnh vc i
hi tnh bo mt cao nh ngn hng, i hi giao thc VoIP phi h tr
mt phng php mt m mnh.
H323 cng gp nhng vn tng t nh SIP khi trin khai vi NAT.
Phng php n gin nht l cho forward nhng port nht nh qua
thit b tch hp NAT i vi cc client ni b. tip nhn cuc gi,
TCP port 1720 phi lun c forward. Thm vo , port UDP cho cc
d liu RTP v RTCP cng phi c forward. Nhng client c nh MS
Netmeeting cng yu cu forward port TCP cho vic tunnel ca giao
thc H245.
Nu c mt s lng cc client ng sau thit b c tch hp NAT,
chng ta phi s dng gatekeeper chy proxy mode. Gatekeeper s cn
mt Interface lin lc vi mt mng IP subnet v mng Internet. H323
client trn mng ring s ng k n gatekeeper, sau gatekeeper s
gi cuc gi thay mt cho client. Cc client bn ngoi mun gi bn
trong cng phi thc hin th tc ng k n proxy server.

Hnh 2.5: M hnh iu khin cuc gi H.323

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 17

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

Vo thi im hin ti, Asterisk khng th ng vai tr gatekeeper,


chng ta phi s dng cc ng dng c lp nh Open H323
Gatekeeper.
2.5.4 MGCP(Media Gateway Control Protocol)
MGCP c thit k n gin ha thit b u cui .N c nh
ngha bi IETF.
MGCP c tin hnh kh nhanh nhng khng c tnh kh dng bng
SIP v IAX.
Vic thc hin x l u c tin hnh ti media gateway v call agent.
Khng ging nh SIP, MGCP s dng cu trc tp trung. Cuc gi
MGCP khng th c tin hnh trc tip m phi i qua controller.

Hnh 2.6 : Giao thc MGCP


Asterisk h tr MGCP qua module chan_mgcp.so v u cui c nh
ngha thng qua file cu hnh mgcp.conf. Bi v Asterisk cung cp cc
cuc gi c bn nn n khng th gi lp MGCP phone.
Nu c mt MGCP phone, chng ta c th s dng chng vi Asterisk.
Tuy nhin khng th xem MGCP phone nh mt sn phm ca h thng
Asterisk v n c nhng chun ring.
2.5.5 Skinny/SCCP
L giao thc mc nh cho cc u cui ca Cisco Call Manager PBX.

Skinny c h tr bi Asterisk .Nu chng ta kt ni Cisco phone n


Asterisk, thng thng chng ta mc nh s dng giao thc SIP.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 18

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

2.5.6 UNISTIM
L giao thc h tr ca Nortel cho VoIP, cng c b sung vo
Asterisk.
iu ng ni y l Asterisk l tng i PBX u tin h tr u
cui IP cho c hai nh sn xut ln nht trn lnh vc VoIP l Nortel v
Cisco.
2.6 Ng cnh ng dng trong tng i IP
2.6.1 Kt ni IP PBX vi PBX
Mt ng cnh t ra y nh sau :Hin ti cng ty trang b h
thng PBX by gi cn trang b thm p ng nhu cu lin lc trong
cng ty sao cho vi chi ph thp nht.
Gii php thc hin vic l trang b h thng Asterisk v kt ni
vi h thng PBX ang tn ti qua lung E1.

Hnh 2.7: S kt ni IP PBX vi PBX


Ngoi ra tng kh nng lin lc vi mng PSTN v VoIP khc, Cng
Ty s ng k kt ni dch v vi nh cung cp dch v VoIP.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 19

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

2.6.2 Kt ni gia Server Asterisk


Phng php trn ng dng rt hiu qu cho cc cng ty nm ri rc
cc v tr a l khc nhau nhm gim chi ph ng di.

2.6.3

Hnh 2.8 : S kt ni cc server Asterisk


V d cng ty M c tr s t ti nc M v c cc Chi nhnh t ti
Vit Nam vi hai a im l H Ni v thnh ph H Ch Minh. Thng
qua mng WAN ca cng ty, cc cuc gi ni b gia cc v tr khc
nhau c kt ni, v s gim chi ph ng k.
Cc ng dng IVR,Conference Call
ng dng thc hin cc server kt ni vi h thng PSTN hay tng i
PBX trin khai cc ng dng nh tng tc thoi IVR.
Mt v d cho ng dng tng tc thoi l cho bit kt qu x s,
kim tra cc cuc, dch v gii tr tra cu thng tin thng qua s
19001260. ng dng VoiceMail thu nhn nhng tin nhn thoi t pha
thu bao ging nh chc nng hp th thoi ca Bu in.
Chc nng cuc gi hi ngh c thit lp cho nhiu my in thoi
cng ni chuyn vi nhau.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 20

n tt nghip i hc

2.6.4

Chng 2: Tm hiu tng i Asterisk

Hnh 2.9 : Cc ng dng ca tng i IP


Phn phi cuc gi t ng ACD
ACD (Automatic Call Distribution): Phn phi cuc gi t ng.
Chc nng c ng dng cho nhu cu chm sc khch hng hay nhn
phn hi t pha khch hng.
Vi chc nng ny, h thng tng i s bt tnh trng tt nghn khi c
nhiu cuc gi cng lc.

Hnh 2.10: Phn phi cuc gi ACD

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 21

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

Gi s mt Cng ty h thng in thoi c kh nng tip nhn cng mt


lc 10 cuc gi,nu c thm cuc gi th 11 gi n th h thng gii
quyt nh th no? Bnh thng th s nghe tn hiu bn nhng vi
chc nng phn phi cuc gi s a thu bao vo hng i ch
tr li, trong khi ch tr li cuc gi thu bao c th nghe nhng bi ht
hay do asterisk cung cp v khi no mt trong mi s in thoi ang
gi tr v trng thi ri th cuc gi ang ch s c tr li. Ging
nh chc nng ca dch v: dch v h tr thng tin 1080, dch v
hn gi 116 ca Bu in, dch v h tr khch hng ca cc tng i
in thoi.
2.7 T chc th mc trong h thng Asterisk
2.7.1 Cc th mc trong h thng
Cd /etc/asterisk/
Cha cc tp tin cu hnh ASTERISK. Tuy nhin tp tin zaptel.conf
li nm trong th mc /etc/. zaptel.conf c dng cu hnh thc
hin lin lc gia my tnh v mi trng in thoi truyn thng.
Cd /usr/lib/asterisk/modules/
Cha tt c cc module c khi ng bi ASTERISK. Cc ng
dng chng trnh, codecs, formats, v cc knh thoi. Mc nh
ASTERISK s khi ng tt c cc modules lc khi ng.
Cd /var/lib/asterisk
Cha ng tp tin astdb v cc th mc con khc. Tp tin astdb
cha thng tin v c s d liu ca ASTERISK bao gm cc th
mc chnh:
agi-bin/ : Cha cc custom scripts, nh l cc ng dng
AGI.
Firmware : Cha cc thng tin v cc thit b gn kt vi
ASTERISK.
mohmp3 : Cha tp tin mp3 cho chc nng Music on Hold

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 22

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

sounds : Tt c cc thng bo t h thng ASTERISK u


nm trong th mc sounds.
Cd /var/spool/asterisk/
Cha mt s th mc con nh outgoing/, qcall/, tmp/, v voicemail/

Hnh 2.11: Cu trc th mc var


Th mc tmp/ c dng lu tr cc thng tin tm thi cho cc
qu trnh nh sao chp, hoc ngn cn hai qu trnh ghi v c tp tin
cng mt lc.
Tt c cc voicemail v cc li cho u cha trong th mc
voicemail.
Cd /var/run/
Cha tt c thng tin v cc tin trnh ang hot ng trong h
thng, bao gm ASTERISK (t bit l trong tp tin asterisk.conf).
Cd /var/log/asterisk/
Cha cc thng tin logs ca ASTERISK. Cc thng tin ny c th
c hiu chnh trong logger.conf trong th mc /etc/asterisk/.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 23

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

2.7.2 Cc tp tin cu hnh trong h thng


Cc file cu hnh cho h thng asterisk u nm ti th mc
/etc/asterisk
V d nh:
extensions.conf
sip.conf
voicemail.conf
asterisk.conf.
Tuy nhin, file zaptel.conf cu hnh cho phn cng TDM nm ti th
mc /etc, cch thc cu hnh ging nh tp tin .ini ca window.
Mt s file .conf quan trng
Extensions.conf : file cha dial plan
Sip.conf : dng cu hnh giao thc SIP.
Iax.conf : dng cu hnh cc knh truyn ca giao
thc IAX.
2.8 C ch FastAGI
2.8.1 FastAGI l g?
FastAGI c th c s dng nh mt khun mu thit k qu trnh
lp trnh AGI t xa ca bn.
C ch ny gip gim ti trn CPU ca bn. N s gi dch v t mt
my tnh khc trong mng v tr v kt qu cho server x l.N gip cho
server bt cng on x l cc cng vic,gim qu trnh tt nghn tng
i.
FastAGI vn l mt trong nhng la chn thay th tt nht xy dng
cc ng dng Asterisk, tch cc ng dng ring ca mnh, nhn rng
trn nhiu ng dng my ch FastAGI.
kt ni vi mt giao din AGI /API interfaces,ta phi c mt s th
vin kt ni. Chng bao gm:
Asterisk Java
Asterisk.NET
PHPAGI
Asterisk-Perl
Asterisk-PyThon
chy c dch v th my ch FastAgi , ta chn dng Asterisk.NET.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 24

n tt nghip i hc

Chng 2: Tm hiu tng i Asterisk

2.8.2 Hot ng
u tin,trn tng i ta ch khai bo a ch ca my cc b(ni x l
cng vic dm server)
AGI:\\192.168.1.123\script_cong_viec
Down v th vin Asterisk.NET chy cc script trn my cc b v
tr v kt qu cho server. Th vin ny bao gm mt tp hp cc lp C#
cho php bn d dng xy dng cc ng dng tng tc vi mt my
ch PBX Asterisk. C FastAGI v API u c h tr trong .NET /
Mono tng thch.
Asterisk NET h tr c hai giao din Asterisk cung cp cho kch bn
ny:Cc giao
thc FastAGI v qun l API.
Vic
thc
hin FastAGI h tr tt c cc lnh c sn t Asterisk.
Link down : http://sourceforge.net/projects/asterisk-dotnet/

Hnh 2.12: M hnh kt ni ca chng trnh Asterisk.NET

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 25

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

CHNG 3: TM HIU CHC NNG TEXT TO SPEECH


3.1 Khi nim:
3.1.1 S lc v ting ni trong VoIP:
L cng c din t ngh v giao tip gia ngi vi ngi.Ting
ni l mt s kt hp ca rt nhiu m thanh khc nhau.
Trong lnh vc vin thng , ta c cm t voice over IP. l ting
ni qua giao thc Internet. Ni n cng ngh ting ni qua IP l ni
n vic truyn dn ting ni qua cc mng li hot ng da trn
mng internet. Ban u giao thc Internet (Internet Protocol - IP) c
thit k ni mng d liu v sau khi vn hnh thnh cng, giao thc
c p dng vo vic ni mng ting ni.
Cng ngh ting ni qua IP (VoIP) c th d dng h tr cc nhim v
v p ng cc dch v m khi s dng h thng PSTN truyn thng c
th s phc tp hay tn km.
3.1.2 Khi nim v Text To Speech:
Text To Speech (k hiu TTS) l qu trnh chuyn dng vn bn dng
text sang ting ni.
TTS c phn loi nh sau:
Ni t (Concatenated Word):
L h thng cha nhng t c ghi m sn . Khi nhn c
mt chui vn bn cn c, h thng tch cc t trong chui ny
ra. Sau , tm cc t ny trong h thng t ghi m sn. Cui
cng, ta kt hp cc t tng ng trong chui li v pht m
thnh cu.
Hai m t(Diphone Concatenation):
L phng php ni li nhng on m thanh ngn c s ho
v to ra m thanh lin tc. Mi diphone bao gm hai m v : mt
m v bt u v mt m v kt thc.
Tng hp:
L phng php to m ging ging con ngi vi s m phng
v chiu di,c hng,khoang mingVi k thut ny, ta c th
thay i cht lng ging ,to ra m trm bng khc nhau.
3.1.3 L do chn Text To Speech
Thun tin cho vic c vn bn ng, nht l cc cm t ng ngn v
lun thay i lin tc m ta khng th ghi m ht tt c.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 26

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

Khi c ln vn bn hay s liu s gip ngi s dng c th nghe li


vn bn ca mnh v pht hin li khi g bn phm.
Cung cp nhng phn hi r rng v thng bo cho ngi dng bng m
thanh pht ra. Ngi dng c th nghe v p ng li thng bo.
ng dng ny rt thit thc v hu ch trong cuc sng nh: hp th
thoi, cc tng i tr li t ng,cc ng dy nng 1900xxx
3.1.4 Hn ch ca Text To Speech (TTS)
Cht lng ging cha tt i khi kh nghe nu c cm t di . V TTS
thc cht l ta phi ni tng t li vi nhau to thnh 1 cu di. N l
ging c tng hp cc t ng vi cc du nhn,nhp ngt,trng m,thi
gian c.
Biu cm cm xc nh chm than,chm hi ln xung ging s khng
p ng tht nh con ngi.
C th b li pht m t sai do c im pht m ca tng vng trong
nc.
3.2 Cu trc file m thanh
3.2.1 Khi nim:
T p tin m thanh la m t da ng t p tin dung lu tr d li u m thanh s
(dng sng ) v n l mt trong nhng nh dng ph bin nht ca h
i u hanh Windows.
T p tin wave thu c chu n RIFF ( Resource Interchange File Format dng tp tin ti nguyn co th trao i ).
c im ca nhng tp tin thuc chun RIFF l n s nhm ni
dung cua t p tin thnh cc khi ring bit .Mi mt khi s gm mt
header (dng qui nh kiu v kch thc ca khi ) v cc byte d
li u.
Tp tin wave c hai dng l dng nn v dng khng nn (dng
chun).V th trong ti ny ti ch cp n dng chun ca tp tin
wave tc l dng khng nn.
3.2.2 nh dng d liu:
Tt c cc gi tr d liu c lu tr trong th t nh dn v cui
(byte t quan trng u tin).
File sng c th cha cc chui vn bn quy nh c th cc nhn im
nhn, ghi ch, Strings c lu tr trong mt nh dng m cc byte
u tin xc nh s lng theo byte vn bn ASCII trong chui.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 27

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

Cc byte sau y l cc byte k t ASCII to nn cc chui vn bn.


y l nh dng c s dng cho cc chui Pascal.
7 'E' 'X' 'A' 'M' 'P' 'L' 'E'

3.2.3

Hnh 3.1: nh dng chui sng


X l tp tin wave
L mt dng tp tin dng lu tr d liu m thanh s(dng sng) v
n l mt trong nhng nh dng ph bin nht ca h iu hnh
Windows.
Mt file RIFF cha mt hay nhiu loi chunks.Mi chunk gm c loi
chunk v d liu theo sau loi chunk ,ng thi cha con tr tr
n chunk k tip.
Cu trc file m thanh gm ba khi: khi m t dng RIFF,khi thuc
tnh fmt v khi d liu data trong khi thuc tnh fmt v khi
d liu data l 2 khi con ca khi m t dng RIFF.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 28

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

Hnh 3.2: Cu trc tp tin m thanh


Khi m t dng RIFF:
Kh i nay xc nh dng RIFF v co kich thc la 12 byte g m cac
trng.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 29

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

Hnh 3.3 : Ln sng dng RIFF


Kh i thu c tin h fmt :
Khi ny xc nh cc thuc tnh ca d liu m thanh v c kch
thc l 24 byte.
Cu trc khi fmt nh sau:
class WavFormatChunk : WavChunk
{
// kiu m ho d liu m thanh
public ushort wFormatTag;
// c hai gi tr: bng 1 cho m thanh mono, bng 2 cho m thanh
stereo
public ushort wChannels;
// cho bit tc ly mu (11025-11,025kHz,22050-22,05
kHz)
public ulong dwSamplesPerSec;
//s byte trung bnh yu cu trong 1 giy pht li mu d liu
ca sng m
public ulong dwAvgBytesPerSec;
// cho bit s byte dng cha mt mu m thanh

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 30

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

// mu <= 8 bit s yu cu 1 byte, mu 9-16 bit s yu cu 2


bytes
public ushort wBlockAlign;
// cho bit s bit trong mt mu d liu(dng byte hay word)
public ushort wBitsPerSample;
}
Khi ny xc nh cc thuc tnh ca d liu m thanh v c kch thc
l 24 byte gm cc trng:
Subchunk1ID:
- Kch thc: 4 byte
- Chc nng: cha chui fmt .
Subchunk1Size:
- Kch thc: 4 byte
- Chc nng :cho bit tng kch thc ca cc trng thuc khi
thuc tnh ng pha sau trng ny.
(i vi tp tin wave khng nn th Subchunk1Size bng 16)
AudioFormat:
- Kch thc: 2 byte
- Chc nng: cho ta bit dng nn ca d liu trong tp tin wave.
Gi tr m t
- 0 :Khng xc nh
- 1: Khng nn (PCM-Pulse Code Modulation)
Mt s gi tr thng dng
NumChannels:
Kch thc: 2 byte
Chc nng: cho bit s knh ca tp tin wave.
(Mono=1,Stereo=2,v.v)
SampleRate:
- Kch thc: 4 byte
- Chc nng: cho bit s mu trn 1s v y chnh l tn s ly mu
ca tp tin wave.
ByteRate:
- Kch thc: 4 byte
- Chc nng:cho bit s byte trn 1 s ng vi tn s ly mu trn.
(ByteRate=SampleRate*NumChannels*(BitsperSample/8))

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 31

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

BlockAlign:
- Kch thc:2 byte
- Chc nng: cho bit s byte ca 1 mu gm tt c cc knh.
BitsPerSample: cho bit s bit trn 1 mu ch tnh cho 1 knh.
( 8 bit=8,16 bit=16,v.v)
Data Chunk - "d liu"
Chunk sng d liu cha d liu mu m thanh k thut s c th c
gii m bng cch s dng nh dng v phng php nn quy nh ti
Chunk nh dng Wave.
i vi mu m thanh 8 bit,d liu ca data bao gm cc gi tr 1
byte(t 0-255) ca cc mu m thanh. Vi mu m thanh 16 bits,mi
mu d liu gm 2 bytes (-32768 n 32767).
Cu trc :
typedef struct
{
ID chunkID;
Long chunkSize;
unsigned char waveformData [];
} DataChunk;
ChunkSize l s lng byte trong on.
phn gii bit v cc thng tin khc nhn c t cc on nh
dng(Format).
Cc mng waveformData cha d liu dng sng thc t. D liu c
sp xp thnh cc khung mu.
S lng cc khung mu trong waveformData c xc nh bng cch
chia ny chunkSize wBlockAlign on nh dng.
Chunk d liu l cn thit v ch c mt Chunk d liu c th xut hin
trong mt WAVE.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 32

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

Ln sng cc tp tin thng cha ch c mt on d liu, nhng chng


c th cha nhiu hn mt nu h c cha trong mt Chunk Danh
sch Wave ("wavl").

Hnh 3.4: nh dng d liu Chunk


Mu k thut s a knh m thanh c lu tr nh cc d liu sng xen
k (nh m thanh stereo v surround).
Sng tp tin c lu tr bng cch lt qua cc mu m thanh cho mi
knh trc khi tin ti mu tip theo. iu ny c thc hin cc
tp tin m thanh c th c pht hoc xem trc tip trc khi ton b
tp tin c th c c. y l tin dng khi pht mt file ln t a (c
th khng hon ton ph hp vi b nh) hoc trnh chiu mt tp tin
qua Internet.
Cc gi tr trong s di y s c lu tr trong mt file Wave
theo th t c lit k trong ct gi tr (trn xung di).

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 33

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

Hnh 3.5: Ln sng mu Interlaced Stereo


Mt im v d liu mu m c th gy ra mt s nhm ln khi mu
c biu din vi 8-bit, c quy nh nh gi tr unsigned. Tt c cc
mu khc - bit kch thc c quy nh c th nh cc gi tr k kt.
V d mt mu 16-bit c th l -32.768-32767 vi mt im gia (im
lng) 0.
Nh cp trc , tt c cc khi RIFF (bao gm c WAVE "d
liu" khi) phi c lin kt t. Nu d liu mu s dng mt s l ca
byte, mt byte padding vi mt gi tr khng phi c t phn cui
ca d liu mu. Cc on "d liu" tiu ca kch thc khng nn
bao gm byte ny.
Fact Chunk - "thc t"
Mt on thng tin thc t nn ph thuc m v ni dung ca tp tin
sng. l yu cu tt c cc nh dng WAVE nn v khi cc d liu
dng sng c cha bn trong mt on "wavl DANH SCH", nhng
khng cn thit cho cc tp tin nh dng khng nn PCM WAVE (nn
m 1) c cha cc d liu dng sng bn trong mt on "d liu" .

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 34

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

Hnh 3.6: nh dng thc t Chunk

nh dng Ph thuc d liu :


Hin ti ch c mt lnh vc quy nh cho cc d liu ph thuc vo nh
dng. l mt gi tr duy nht 4-byte quy nh c th s lng mu
trong on d liu dng sng. Gi tr ny c th c s dng vi cc
mu ,mi gi tr th hai quy nh trong nh dng on tnh ton
chiu di dng sng trong vi giy.
Khi nh dng WAVE mi c gii thiu, cc on thc t s c m
rng, lnh vc ph c thm vo sau khi s lng quy nh ca mu
nghin cu ly.
Cc ng dng c th s dng kch thc on thc t xc nh cc
lnh vc c mt trong on.
3.2.4 c file RIFF:
Ln sng tp tin header theo cu trc tp tin nh dng RIFF chun.
8 byte u tin trong tp tin tiu trong c mt ID on "RIFF" v
mt on kch thc bng kch thc tp tin tr i 8 byte c s dng
bi tiu .
V vy, chng ta cn phi bit tng chiu di ca tt c cc tp tin xc
nh ChunkSize v c NumChannels SampleRate v BitsPerSample.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 35

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

private void WaveHeaderIN( string spath)


{
FileStream
fs
=
new
FileStream(spath,
FileMode.Open,
FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
length = ( int )fs.Length - 8 ;
fs.Position = 22 ;
channels = br.ReadInt16();
fs.Position = 24 ;
samplerate = br.ReadInt32();
fs.Position = 34 ;
BitsPerSample = br.ReadInt16();
DataLength = ( int )fs.Length - 44 ;
br.Close ();
fs.Close();
}
Nh chng ta bit, cc knh c lu tr trong tiu WAV trong s
byte 22, chng ti di chuyn v tr hin ti ca tp tin n v tr ny v
kch thc ca n l 2 byte, do chng ti s dng br.ReadInt16 ()
c ch c 2 byte.
private void WaveHeaderOUT( string sPath)
{
FileStream fs = new FileStream(sPath, FileMode.Create,
FileAccess.Write );
BinaryWriter bw = new BinaryWriter(fs);
fs.Position = 0;
bw.Write(new char[4] { 'R', 'I', 'F', 'F' });
bw.Write(length);
bw.Write(new char[8] {'W','A','V','E','f','m','t',' '});
bw.Write((int)16);
bw.Write((short)1);
bw.Write(channels);
bw.Write(samplerate );
bw.Write((int)(samplerate * ((BitsPerSample * channels) / 8)));
bw.Write((short )((BitsPerSample * channels) / 8));
bw.Write(BitsPerSample);

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 36

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

bw.Write(new char[4] {'d','a','t','a'});


bw.Write(DataLength);
bw.Close();
fs.Close();
}
Khai bo "RIFF" nh l mt mng ca char, khng phi l chui v
s dng loi int lu tr 4 byte v loi ngn lu tr 2 byte.
public void Merge( string [] files, string outfile)
{
WaveIO wa_IN = new WaveIO();
WaveIO wa_out = new WaveIO();
wa_out.DataLength = 0;
wa_out.length = 0;
//Gather header data
foreach (string path in files)
{
wa_IN.WaveHeaderIN(@path);
wa_out.DataLength += wa_IN.DataLength;
wa_out.length += wa_IN.length;
}
//Recontruct new header
wa_out.BitsPerSample = wa_IN.BitsPerSample;
wa_out.channels = wa_IN.channels;
wa_out.samplerate = wa_IN.samplerate;
wa_out.WaveHeaderOUT(@outfile);
foreach (string path in files)
{
FileStream fs = new FileStream(@path, FileMode.Open,
FileAccess.Read);
byte[] arrfile = new byte[fs.Length - 44];
fs.Position = 44;
fs.Read(arrfile, 0, arrfile.Length);
fs.Close();
FileStream fo = new FileStream(@outfile, FileMode.Append,
FileAccess.Write);

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 37

n tt nghip i hc

Chng 3: Tm hiu chc nng Text to speech

BinaryWriter bw = new BinaryWriter(fo);


bw.Write(arrfile);
bw.Close();
fo.Close();
}
Chng ta cn tnh ton tng chiu di v chiu di d liu ca tt c
cc tp tin v sau xc nh cc knh, SampleRate v BitsPerSample
ca file.
Tt c chng ta cn lm l gi phng thc kt v quy nh c th cc
tp tin u vo v tp tin u ra.
string [] files = new string [ 2 ] { @" ..\ng dn\file.wav" ,
@"C:\WINDOWS\Media\Windows\XP Shutdown.wav" };
WaveIO wa = new WaveIO();
wa.Merge(files, @" c:\oou.wav" );

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 38

n tt nghip i hc

Chng 4: Tm hiu dch v tra cu im tuyn sinh

CHNG 4: TM HIU DCH V TRA CU IM TUYN SINH


4.1 Tng quan v h thng tuyn sinh:
4.1.1 Hot ng:
Khi khch hng gi n tng i , khch hng c th bit c m
trng , im thi ca mt th sinh no ng vi s bo danh.
Theo l thuyt, tu theo chng trnh m ta chuyn x l n in thoi
vin hay my x l t ng.V nu chuyn n in thoi vin th ta
phi qun l thm knh kt ni gia ngi v my.iu ny s lm ta
kh qun l hn.
V trong thc t, tng i thng c x l mt cch t ng. N to
hiu qu x l nhanh v d qun l. Chnh iu , trong ng dng ny,
ta s to mt ng dng hon ton t ng.
4.1.2 Cc thnh phn v qu trnh hot ng:
Cc thnh phn
Database server sql server : cha d liu ca dch v.
Hub router : kt ni mng v cc my tnh cc b.
My tnh : dng truy xut c s d liu c ci t softphone.
Softphone -3CX: in thoi giao tip vi ngi dng.
Khi bn gi ti h thng ,ng dng s xut hin ngay cu cho :
Cho mng bn n vi dch v tra im tuyn sinh.
X l ca ng dng
Giao tip trong mng Lan
Trong phn demo ny, ta cho cc my tnh giao tip trog mng
Lan cc b ch khng giao tip vi mng in thoi bn ngoi
mng c. Mun kt ni c ta phi mt thit b trung gian
no c th kt ni my tnh vi my in thoi bn
ngoi.
Trong thc t,ng dng s c giao tip trc tip vi mng
in thoi thng qua mt s Card do cng ty Digium sn
xut.N gip vic giao tip thun li hn.
Truy vn d liu
Ton b thng tin im ,s bo danh,danh sch th sinh u
c lu tr trong chng trinh SQL Server 2005.
Chng trnh x l da vo thng tin m ngi dng cung cp
nh m th sinh m p ng yu cu ngi dng.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 39

n tt nghip i hc

Chng 4: Tm hiu dch v tra cu im tuyn sinh

Chng trnh ng vai tr nh client giao tip vi SQL gi


v nhn d liu cn thit.
Thng tin ly c y l dng Text.
Pht ra m thanh
y l qu trnh giao tip gia ngi v my nn ta phi x l
sao cho ngi dng c th nghe c m thanh.
Khi thng tin c tr v, n c dng text nn ta phi chuyn
sang dng m thanh tng ng ngi s dng hiu c.
Tm li, chc nng chnh ca h thng l lm sao chuyn t dng text
sang dng vn ni (ting ni) tng ng vi ch . V chc nng
gi l Text to Speech.
Hot ng
Khi gi vo, h thng s yu cu bn nhp m s d thi bt
u tra cu.Khi nhp xong,da vo m s d thi ny,chng
trnh s tm kim trong c s d liu v thng bo kt qu cho
bn.
4.2 Chc nng ca h thng:
4.2.1 Tng qut chc nng

Hnh 4.1: Chc nng ca ng dng

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 40

n tt nghip i hc

4.2.2

Chng 4: Tm hiu dch v tra cu im tuyn sinh

S x l chc nng
Gi vo
s 200
Tr li t ng

Phm 1

La chn
phm bm

Nghe m
mn thi

Phm 2
ht thi gian thao tc

Nghe
im thi

ht
thi
gian
thao
tc

khng
c

Truy vn
CSDL

Khng c
sinh vin

c
im

c kt qu
theo SBD

ht thi gian x l

Nhp SBD
khc

Kt thc
cuc gi

Phm 2

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 41

n tt nghip i hc

Chng 4: Tm hiu dch v tra cu im tuyn sinh

4.3 Thit k lc d liu quan h ERD


4.3.1 Cc tp thc th

Hnh 4.2: M hnh tp thc th


4.3.2 Diagram

Hnh 4.3 : M hnh diagram

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 42

n tt nghip i hc

Chng 4: Tm hiu dch v tra cu im tuyn sinh

4.4 Cc bng d liu


4.4.1 Danh sch bng d liu:
Trng
- Cha cc thng tin v trng
- Thuc tnh: matruong,tentruong,status
MonHoc
- Cha thng tin v cc mn thi
- Thuc tnh: mamh,tenmh,status
SinhVien
- Cha thng tin chi tit v th sinh.
- Thuc tnh: masv ,tensv,ngaysinh,status,matruong
Diem
- Cha kt qu im thi ca th sinh
- Thuc tnh: masv,mamh,diem,status.
TuDien
- Cha tp hp cc t ng trong ting vit.
- Thuc tnh : matu, tu
4.4.2 M t cc bng:
Truong

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 43

n tt nghip i hc

Chng 4: Tm hiu dch v tra cu im tuyn sinh

MonHoc

SinhVien

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 44

n tt nghip i hc

Chng 4: Tm hiu dch v tra cu im tuyn sinh

Diem

TuDien

4.4.3 Cc mi lin h
Mi lin h bng Truong-SinhVien

Mi sinh vin thi vo 1 trng v mi trng th c nhiu sinh


vin d thi. V vy,mi quan h l mt-nhiu.
Mi lin h bng SinhVien- bng Diem
-

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 45

n tt nghip i hc

Chng 4: Tm hiu dch v tra cu im tuyn sinh

Mi th sinh thi vo 1 trng s c 1 im tng ng vi mn


thi
Mi lin h bng Monhc- bng Diem
-

Mi mn hc th c 1 im s v mi im s c chm cho
nhiu mn hc. V vy, quan h l nhiu-mt.

4.5 Nhng thun li v kh khn ca ng dng:


4.5.1 Thun li
Chng trnh server tng i nh,tn t dung lng b nh v d ci t.
Ngi dng d dng s dng dch v thng qua cc phm nhn trn
softphone.
4.5.2 Kh khn
Cha trin khai vi cuc gi ngoi mng do khng c h tr phn cng
l card digium.
Kt qu im tr v nhanh hay chm tu thuc vo tc ng truyn
nhanh hay chm.
Vic dng hm text to speech ghp tng t lm cho chui m thanh
cn ri rc nn m thanh khng hay lm.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 46

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

CHNG 5: CI T V CU HNH H THNG SERVER


5.1 Ci t cc tnh nng c bn ca tng i Asterisk
5.1.1 Yu cu thit b:
Ci t h iu hnh Linux trn my tnh , c th ci h iu hnh Linux
Fedora, CentOS, Redhat, hoc Debian , y ta ci bn Centos server
5.6.
My server ci h iu hnh Linux xy dng h thng Server
Asterisk. y, ta dng h iu hnh linux centos 5.6
My client ci hai softphone l X-Lite v 3CX ni mng vi my tnh
Server asterisk.( y server asterisk c chy trn my o Virtual
Boxlink
download:
https://www.virtualbox.org/wiki/Linux_Downloads.)
5.1.2 Cc bc ci t cc gi Asterisk phin bn 1.6.2.20
Ti cc gi sau v trong th mc : usr/src/asterisk
Asterisk 1.6.2.20
http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk1.6.2.20.tar.gz
Dahdi-2.4.1.2
http://downloads.asterisk.org/pub/telephony/dahdi- linux/releases/dahdilinux-2.4.1.2.tar.gz
Dahdi-tool-2.4.1.2
http://downloads.asterisk.org/pub/telephony/dahdi-tools/releases/dahditools2.4.1.2.tar.gz
Libpri 1.4.12
http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.12.tar.gz
Sau khi ti thnh cng, ta gii nn cc gi v ci t theo trnh t sau:
(lnh gii nn: tar xzvf file nn)

cd /usr/src/asterisk/libpri-1.4.12
make
make install

cd /usr/src/asterisk/dahdi-linux-2.4.1.2
make all
make install

cd /usr/src/asterisk/dahdi-tool-2.4.1.2
make

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 47

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server


make config

cd /usr/src/asterisk/asterisk-1.6.2.20
./configure
make
make install
make config
make samples

Ta c th ci thm gi Asterisk-Addon h tr cc file m thanh mp3.


Khi ng Asterisk bng lnh sau:

service dahdi start

asterisk cvvvv

asterisk r

Thot khi Asterisk:

Exit

Shut down

5.1.3 Ti chng trnh Asterisk.NET:


Chng trnh Asterisk.NET gip ta thc hin c ch gi t xa FastAGI.
N bao gm chc nng qun l API.
Khi my tng i mun ly mt ng dng no t xa th trn my ,ta
chy chng trnh ng dng Asterisk.NET ny ln v tr v kt qu cho
my server thng qua cc Script.
Link down: http://sourceforge.net/projects/asterisk-dotnet/
5.1.4 Cu hnh SIP cho softphone
Link down: http://www.3cx.vn/dien-thoai-voip/index.html
Vi in thoi phn mm 3CX, bn c th gi in trc tip t PC hoc
laptop ti mi in thoi phn mm, di ng hoc c nh bng cch s
dng cng ngh thoi qua giao thc IP (VOIP) truyn ging ni qua
mng Internet.
cu hnh cho SIP softphone dng vi 3CX hoc X-Lite ta ch cn cu
hnh mt s thng s chnh trong file sip.conf hoc file c include
trong file sip.conf nh sau:

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 48

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

[tn-knh]
- type : tn kiu;friend|user|peer.
- context : tn context ;dng cho vic iu khin cuc
gi trong dialplan v phn bit mt user theo quyn
(user, admin) hay phn bit theo phng ban.
- secret : mt-khu
- callerid : "tn-user" <s-in-thoi> ;s c hin th
trn my ngi c gi
- accountcode : tn-accountcode ;dng phn bit trong
cc file ghi cc CDR(tu m khai bo hay khng)
- host : dynamic
- mailbox : tn-hm-th@tn-context ;dng cho mc
ch voice mail

Khi cu hnh phn mm in thoi, ta cn in tn-knh vo mc


username, mt khu vo password v domain l a ch IP ca my
Asterisk.
Cc tham s khc khng t tn th h thng s ly tham s theo mc
nh. Gi tr mc nh c th theo gi tr mc nh ca h thng hoc
theo gi tr c t chung trong mc [general] trong file sip.conf

Hnh 5.1: Cu hnh Softphone

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 49

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

5.2 Ci t Sql Server 2005 v to cc bng d liu


5.2.1 Ti sao chn Sql Server 2005
So vi phin bn c SQL 7.0, SQL 2000 th SQL 2005 ch trng n
cng tc bo mt nhiu hn phn mm qun tr CSDL m ngun m.
M rng mt s chc nng so vi phin bn trc v d nh Report,
SQL Server Profiler , Schema, thm mt s kiu data mi, sao lu d
liu nhanh chng, an ton hn... nhm em li cho ngi s dng thun
tin, nhanh chng.
Chc nng SSL c t ng ha hn, thay v lc trc trn MS SQL
2000 khai bo tm lum, th trn SQL 2005 n khai bo cho mnh mt
cch t ng.
i vi ngi dng doanh nghip, SQL Server Express d dng cm vo
cho doanh nghip nht qun l mi trng SQL Server Express cng
cung cp h tr cho c hai ci t hoc thit lp da trn giao din v ci
t. iu ny cho php cc nh pht trin phn mm kim sot cui
cng v tnh linh hot trong vic ci t v thit lp ca nhng vo c s
d liu.
5.2.2 Bng d liu
TuDien
CREATE TABLE [dbo].[TuDien](
[matu] [int] IDENTITY(1,1) NOT NULL,
[tu] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL,
CONSTRAINT [PK_TuDien] PRIMARY KEY CLUSTERED
(
[matu] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]

Truong
CREATE TABLE [dbo].[Truong](
[matruong] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[tentruong] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[ghinho] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_Truong] PRIMARY KEY CLUSTERED
(

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 50

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

[matruong] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]

SinhVien
CREATE TABLE [dbo].[SinhVien](
[masv] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[tensv] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[ngaysinh] [datetime] NULL,
[matruong] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ghinhho] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_SinhVien] PRIMARY KEY CLUSTERED
(
[masv] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SinhVien] WITH CHECK ADD CONSTRAINT
[FK_SinhVien_Truong] FOREIGN KEY([matruong])
REFERENCES [dbo].[Truong] ([matruong])
GO
ALTER TABLE [dbo].[SinhVien] CHECK CONSTRAINT
[FK_SinhVien_Truong]

MonHoc
CREATE TABLE [dbo].[MonHoc](
[mamh] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[tenmh] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[ghinho] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_MonHoc] PRIMARY KEY CLUSTERED
(
[mamh] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 51

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

Diem
CREATE TABLE [dbo].[Diem](
[masv] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[mamh] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[diem] [float] NULL,
[ghinho] [nvarchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_Diem] PRIMARY KEY CLUSTERED
(
[masv] ASC,
[mamh] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Diem] WITH CHECK ADD CONSTRAINT
[FK_Diem_MonHoc] FOREIGN KEY([mamh])
REFERENCES [dbo].[MonHoc] ([mamh])
GO
ALTER TABLE [dbo].[Diem] CHECK CONSTRAINT
[FK_Diem_MonHoc]
GO
ALTER TABLE [dbo].[Diem] WITH CHECK ADD CONSTRAINT
[FK_Diem_SinhVien] FOREIGN KEY([masv])
REFERENCES [dbo].[SinhVien] ([masv])
GO
ALTER TABLE [dbo].[Diem] CHECK CONSTRAINT
[FK_Diem_SinhVien]

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 52

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

5.3 Kt qu t c ca vic thc thi tng i t ng


5.3.1 Ci t Server
xy dng ci t phn mm tng i Asterisk trn nn Linux Server
Centos 5.6.
Tm hiu c ch FASTAGI gi cc ng dng t xa trn cc my cc b.

Hnh 5.2: Cu lnh gi dch v t xa.


5.3.2 Hot ng ca tng i:
Khi ng tng i Asterisk trn server HH Linux Centos 5.6. bng
lnh : Asterisk r

Hnh 5.3 :Mn hnh kt ni Asterisk

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 53

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

Trong tng i, ta cu hnh trn 3 file chnh trong th mc etc/asterisk,


l: sip.cof,extensions.conf,smb.conf
o Vo sip.conf (etc/asterisk), ta ng k a ch cho softphone c chc
nng gi v nghe. u tin, ta ng k 2 phone l 101 v 102.

Hnh 5.4: Cu hnh file Sip


o Vo extensions.conf, ta ghi k hoch gi cho tng i.
Khai bo chc nng gi in thoi ln nhau cho 2 s in
thoi 101 v 102
Khai bo s 200 khi gi vo s 200 ny, server s gi
dch v t my c a ch 192.168.1.123 thng qua
script mang tn ivr.
Khai bo s 205 vi tnh nng ghi m, khi gi vo s
205,sau khi nghe ting bp th bn c th ghi m,kt thc
ghi m bm phm # v sau 2 giy n s pht li on ghi
m trn.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 54

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

Hnh 5.5:Cu hnh file extensions


Ci t gi samba chia s d liu:
o Kim tra gi samba ci cha:
rpm -qa | grep samba
o G lnh ci t
yum install samba
o To mt th mc thc hin share d liu. V d to th mc c
tn l share:
mkdir/share
o Phn quyn th mc share:
chmod 777 R /share/
o Ta cu hnh file smb.conf. G lnh: vi /etc/samba/smb.conf. Xung
dng cui cng v thm on sau:

Hnh 5.6: Cu hnh tp tin chia s

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 55

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

G lnh : service smb start khi ng samba

Hnh 5.7: Khi ng samba


Thit lp ti khon mt khu cho ngi dng samba:
G lnh: smbpasswd a root
Tin hnh nhp mt khu. Mt khu ny dng truy cp vo my cha
th mc chia s.

Hnh 5.8: Khai bo user chia s


Trn Client, vo RUN g ng my ch chia s d liu:

Hnh 5.9:ng dn vo server

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 56

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

Truy cp thnh cng, vo Th mc chia s c tp tin chia s

Hnh 5.10:a ch chia s tp tin m thanh

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 57

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

Chy chng trnh thc thi bng visual 2010 trn my win 7 n to ra
port 4573 v my server thng qua port thc thi chng trnh.

Hnh 5.11:Cng kt ni gia my client v my server

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 58

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

Dch v c gi thng qua cc Script trong chng trnh nh sau:

Hnh 5.12: Script kt ni vi server


Bt softphone 3CX ln vi s in thoi ng k. y l my c s
phone l 101.
Bm s 200 gi vo dch v.
Khi kt ni vo c h thng, th s xut hin cu cho mng bn n
vi h thng.Cu cho nh sau : Cho mng bn n vi tng i
thng tin tra cu im tuyn sinh. Mi bn chn s 1 nghe thng tin
v m mn thi, chn s 2 nghe v kt qu im thi tuyn sinh.
Sau khi nghe cu cho xong, bn c 2 la chn:

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 59

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

Hnh 5.13: Mn hnh kt ni vo dch v


o Bm phm 1 nghe thng tin tng qut

Hnh5.14: X l phm s 1

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 60

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

o Bm phm 2 bn nhp vo m th sinh.


Softphone nhn c chui phm nhp vo bng hm GetData()
Sau ,ly gi tr nhn vo ri tm kim gi tr trong c s d
liu.
Nu tm thy s c ln m thanh kt qu im cho th sinh
,nu khng tm thy th c ln kt qu khng tm thy cho th
sinh.

Hnh 5.15: X l phm s 2

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 61

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

o Mt s trng hp x l li:
Khi bn gi n s 200, nghe li cho xong, khng thao tc
hay chn bt k phm no, th sau khong thi gian nht nh,
h thng s t kt thc cuc gi.
Khi gi vo tng i, ta c hai la chn l s 1 v s 2, nu
bm ngoi hai s trn, h thng s a ra thng bo yu cu
nhp li s bo danh hoc kt thc cuc gi

Hnh 5.16: trng hp sai phm bm


Khi bm s 2 nghe im thi, nu sinh vin cha c im
hay nhp s bo danh khng c trong c s d liu th thng
bo li khng c th sinh
5.3.3 Qu trnh tng hp ting ni:
Tng hp cc t ng thnh mt chui
Dng hm MergeFile ghp cc tng t trong b t in ting vit
thnh mt chui k t.
Chp cc tt file .wav ca tng t ng vo trong ng dn bin ca
project chng trnh c th tm thy t v c ln.

Hnh 5.17: X l ghp m thanh

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 62

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

V d ta c project trong D:\ v ta phi chp filewave c sn vo


ng dn bin :

Hnh 5.18 : Th mc c cc m thanh t file Text


To cc file m thanh ca tng th sinh v ln server
Thuc tnh OutPath dng cha chui m thanh xut ra.
xut ra server th ta tr ng dn n th mc share gia my
win v my server.
ng vi mi t c ghi dng Text s c mt file m thanh ca n
trong thu mc ng dn bin pha trn. Ta dng hm mergerfile
ghp cc t ng n li thnh chui v c ra kt qu tng ng.
5.4 Kt lun
Th nghim c cc chc nng thc t ca tng i nh:
Dial gia cc phone ni b.
Record and Playback (ng dng cho vic ghi danh,in thng tin).
Chc nng ly d liu, c file m thanh trn cc my local.
Xy ng dch v im tuyn sinh i vi mng ni b, gia cc h thng
chi nhnh ca trng hot ng nh sau:
Bm s 200 gi vo tng i Asterisk
Tng i Asterisk c ci t trn h iu hnh Linux

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 63

n tt nghip i hc

Chng 5: Ci t v cu hnh h thng Server

Khi kt ni vo tng i v ta c 2 la chn cho khch hng


o Bm s 1 bn nghe thng tin v tuyn sinh cng nh m cc
mn thi
o Bm s 2 bn nghe kt qu im thi tuyn sinh.
5.5 Nhng hn ch:
Ch dng mc gi in cc b trong mt mi trng c th.
Cc file m thanh c nhp c nh trong c s d liu, cha linh ng
trong trng hp c t ng mi pht sinh.
Do thi gian c hn nn ng dng t ng cha c hon thin v y
nh thc t ,cht lng m thanh ging c cha chun.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 64

n tt nghip i hc

nh gi chung v hng pht trin

NH GI CHUNG V XU HNG PHT TRIN TI

Qua qu trnh tm hiu, em c nhng kin thc c bn v cc k thut


vin thng, cc kin thc v lp trnh trn phn cng.
Vi cng ngh VOIP, vic xy dng mt tng i thc t Asterisk ny s
rt hu ch cho cc doanh nghip mun c mt tng i vi chi ph va
phi.
Da vo nn tng l cc ng dng nh trong qu trnh lm ti, em s c
gng pht trin ln thnh mt h thng cuc gi hon chnh hn nh cc
ng dng v cc IVR.

Hnh 6.1: M hnh mt h thng IVR


Asterisk h tr rt nhiu cng ngh khc nhau v c cu trc ngun m,
cho php cc nhm pht trin ln ngi s dng c th ty bin ng
dng Asterisk ca mnh ng k.
c bit, phi k n giao tip Asterisk AGI&FASTAGI hay
AsteriskRealtime cho php Asterisk kt hp vi cc ngn ng lp trnh
thng dng nh : C, C++,C#, VB, PHP, Shell-script, Python cng vi h

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 65

n tt nghip i hc

nh gi chung v hng pht trin

c s d liu MySQL,Oracle,SQL Server pht trin nhng ng dng


Voice-Application khc nhau.
Asterisk l mt IP-PBX c trin khai cng kh nhiu cc cng ty
nhm gim chi ph lin lc, tuy nhin n cng cn kh mi nn vic ci
t, cu hnh ch yu t cc chuyn vin trong lnh vc vin thng.
Mc tiu ca n v hng pht trin tip theo l xy dng h thng
Asterisk vi cc tin ch thc t, thn thin nhng nhn vin bnh
thng cng c th xy dng v qun l h thng IP-PBX cho cng ty
mnh.
Kt lun, em hon tt vic ci t mt h thng PBX vi cc tnh nng ca
mt server tng i. V hon thnh c bn ni dung cng t ra trong
k n tt nghip.Trn c s c th pht trin ng dng khai thc h thng
Asterisk theo hng hon thin cc chc nng nu phn hn ch v c th
ng dng c chng trnh trong thc t.
Trong qu trnh lm bi lun vn tt nghip ny, em vn cn nhiu thiu st v
mong nhn c s gp kin ca qu thy c.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 66

n tt nghip i hc

Ph lc

PH LC
1. Cc gi phn mm ph thuc phi c trong h iu hnh Linux
yum -y update
yum -y upgrade
yum -y install dahdi-tools kernel-devel kernel-headers
yum -y install make bison bison-devel ncurses ncurses-devel zlib zlib-devel
openssl openssl-devel gnutls-devel gcc gcc-c++ kernel-devel flex libxml2-devel
which
yum -y install httpd httpd-devel
/etc/init.d/httpd start
yum -y install php php-mysql php-common php-gd php-mbstring php-mcrypt
php-devel php-xml php-imap php-ldap php-odbc php-pear php-xmlrpc
ImageMagick ImageMagick-devel
yum -y install linux-headers-$(uname -r) bison openssl libssl-dev libeditline0
libeditline-dev libedit-dev gcc make g++ mc php5-cli gt libgtk2.0-dev
2. Cc gi cn thit ca phn mm Asterisk
Asterisk Communications Engine bn mi nht l Asterisk 10.0.0
Source Tarball .
DAHDI Linux / DAHDI Tools
LibPRI
LibSS7
3. Khc phc li khi ci Dahdi
Bc 1:

o cd /usr/src
o wget http://mirror.anl.gov/pub/linux/kernel/v2.6/linux-2.6.18.tar.
o tar zxvf lilnux-2.6.18.tar.gz

Bc 2:
o ln -s linux-2.6.18 linux
o cd linux
o make oldconfig
o make
o make modules_install install
Bc 3:
o uname r
o 2.6.18-92.1.13.el5
Bc 4:

o cd /lib/modules/2.6.18-92.1.13.el5/
o mv build build.bak
o mv source source.bak

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 67

n tt nghip i hc

Ti liu tham kho


TI LIU THAM KHO

Ting Vit
[1]. Asterisk Ting Vit L Quc Ton
[2]. Cc dch v tng i
link: http://www.tongdai.com.vn
[3]. Cu trc tp tin wavefile
link:http://my.opera.com/f0ng_vn/blog/show.dml/671686
[4]. Din n gii php VoIP
Ting Anh
[1]. AsteriskThe Future of Telephony- Publisher: O'Reilly Media-2005
[2]. Configuration Guide For Asterisk PBX By Flavio E.Goncalves
Copyright 2006 V.Office Networks Ltda., All rights reserved.
[3]. How to setup Asterisk 1.6.2 on Centos 5.4
http://www.selbytech.com/2010/01/how-to-setup-asterisk-1-6-2-on-centos-5-4/
[4]. The Open Source Telephony Projects
link: http://www.asterisk.org/
[5]. The VOIP Wiki - a reference guide to all things VOIP
link: http://www.voip-info.org/
[6]. VoIP Telephony with Asterisk Paul Mahler.
[7]. , Building Telephony Systems with Asterisk - Barrie Dempster - David
Gomillion Packt Publishing Ltd, 2005.

SVTH: Nguyn Thanh Tm Lp: D07THPM

Trang 68