Está en la página 1de 8

4.4.

Cu hnh Asterisk Sau khi ci t xong asterisk trn linux, c th thc hin chc nng tng i thit lp cuc gi, ta phi cu hnh cho asterisk. C nhiu loi file cu hnh nh zaptel.conf, zapata.conf, extensions.conf, sip.conf, iax.conf phn ny ta ch quan tm ti file sip.conf, extensions.conf. - Sip.conf : file cu hnh v cc thng tin cu hnh ngi dng nh username, password, IP, type, security, codec, v giao thc bo hiu SIP, y l thnh phn cn bn nht lu gi thng tin trong Asterisk. - Extension.conf: file cu hnh v cc lut nh tuyn cuc gi, lut quay s, cc extension trong ngoi v nhng tnh nng c bit khc. Extensions.conf l file quan trng nht trong bt k cu hnh Asterisk no 4.4.1 cu hnh file sip.conf to mt file sip.conf ta c th dng nhiu cng c, y s dng nano. - Vo Terminal Cu lnh ci t nano: ~$ sudo apt-get -y install nano. - To file sip.conf: Vo th mc etc/asterisk: ~$ Cd / etc/asterisk y l th mc ny v y l th mc chc cc file cu hnh ca asterisk Sau g lnh: Sudo nano sip.conf Ca s son tho c hin th, y ta s to cc username v password nh sau:

Trong : - [1001]: l username - Context: cch chia nhm user d qun l. Mi context cha nhiu user. cc thu bao trong nhm ny s c cu hnh mt k hoch quay s chung. Context trong sip.conf v extensions.conf phi khp nhau asterisk c th i chiu v thc hin qu trnh cuc gi - Secret: password ca user - Host = dynamic: a ch ca host c username s c xc nh khi ng k vo tng i Sau khi cu hnh xong, lu file bng phm Ctrl+O. thot bng phm Ctrl+X 4.4.2 cu hnh file extensions.conf Dng lnh nano to mi file: ~$ Sudo nano extensions.conf G cc lnh cu hnh nh hnh sau:

Cc thu bao trong nhm c context l my-phones s c thit lp k hoch quay s nh sau: Exten => 1001,1,dial(SIP/1001): cuc gi ti thu bao 1001 s c chuyn ti a ch tng ng vi thu bao 1001. Exten => 1002,1,dial(SIP/1002): cuc gi ti thu bao 1002 s c chuyn ti a ch tng ng vi thu bao 1002. S 1 l u tin Lu v thot file

By gi tng i c cu hnh c bn, c th thc hin cuc gi gia c thit b c username password nh trong file cu hnh. Cc thit b ny c th l pc, ipphone Sau y l cc thc hin cuc gi PC to Pc trong LAN 4.5. Thc hin cuc gi PC to PC trong LAN Hai PC v asterisk server trong cng mnh LAN (ni vi nhau qua modem ADSL hay qua Switch) Khi ng tng i bng lnh asterisk vvvvvc

Cc PC ci t softphone s c cu hnh username, password nh hnh sau y s dng 2 phn mm l Blink v Xlite

Trong Blink display name l tn hin th, sip address c dng username@serverdomain password: mt khu ca user

Trong Xlite ta ch cn g a ch ip ca server vo domain Sau khi cu hnh xong th cc user name t ng nhp vo tng i, tng i s hin thng bo:

V trn Xlite s thy:

By gi hai thu bao s gi cho nhau: 1002 gi 1001

PC 1001 c th chp nhn(accept) hoc t chi cuc gi (reject) Nh vy 2 PC thc hin c cuc gi trong LAN Nhng nhu cu s dng dch v thoi gi r ngy cng tng, Asterisk server phi phc v c c cc thu bao ngoi mng LAN ca n m rng dch v, sau y chng ta s thc hin cuc gi gia cc thu bao trong mng WAN 4.6. Thc hin cuc gi PC to PC trong WAN Vic thc hin thoi trn WAN t ra mt vn l khi ra ngoi mng LAN, th a ch IP privite khng c ngha, cc thu bao khng th thy c server trong LAN, v vy chng ta phi gii quyt vic PC khc mng c th thy Asterisk server. Mi modem ADSL c mt a ch WAN ring, v a ch ny thay i sau mi ln reset modem (dynamic). Nh vy cc thit b khc mng ch tht a ch WAN ca Modem. lm c cc PC c th truy cp asterisk server, th trn Modem ADSL phi thc hin NAT port. NAT port thc hin nh sau G a ch trong LAN ca Modem vo trnh duyt Web,

nhp pass truy cp modem vo

Trong hnh ta thy a ch WAN ca modem l: 118.69.171.191

Sau vo NAT chn vo Enable SIP ALG

Chuyn sang Tab Port Forwarding Service Name = VoIP (SIP) Server IP Address = ip ca PC ci asterisk y l 192.168.1.33 Add

Sau lu li th ta c hnh sau:

Nh vy khi PC user truy cp vo a ch WAN 118.69.171.191 theo port ca VoIP (5060) th modem s chuyn kt ni vo server c a ch 192.168.1.33 port 5060 By gi th cc user trong WAN c th truy cp Asterisk server v thc hin cuc gi. vic cu hnh Account ging nh thc hin gi trong LAN. Nh vy vic ta c th phn no hiu c ti sao cc user khp ni trn th gii c th gi nhau qua cc dch v VoIP nh Yahoo, skype