Skip to main content

Asterisk 1.6.1 on openSUSE 11.1 (Part 3)

To enable asterisk to communicate with PSTN lines we should have either a VOIP-PSTN gateway or FXO card. I will not explain about VOIP-PSTN gateway, there are some service providers out there who provides this service for their customers. In my work I use Digium TDM 410P with 4 FXO port per card. There are some alternatives in the market like Sangoma, Rhino, etc, the important is we should make sure that it works with Asterisk either with dahdi driver or zaptel/zapata driver. Also if possible select the card that already has hardware echo-canceler. Echo is a problem in voip communication, and if you have card with no echo-canceler than your server CPU will busy do the job.

Just remember that Digium cards are no longer use zapata driver, and some changes has been made to the configuration file name and location, /etc/zaptel.conf become /etc/dahdi/system.conf and /etc/asterisk/zapata.conf become /etc/asterisk/chan_dahdi.conf

In the client site you can use any SIP client hardwares or softwares. Ekiga and Emphaty are the good choice for you who prefer GTK libraries and KCall and KPhone are for you who prefer Qt libraries. IP phone hardware now widely available in the market from cheap to high price, you can select any brand as long as it compatibles with Asterisk. In this project I choose Polycom IP-330, I also used Grandstream and Aastra in other implementation. In this implementation the owner also ask me to use Polycom KIRK Wireless Server 600V3 with Polycom DECT Handset 3040.

Now the time for the dialplan, extensions.conf, which is the core of asterisk implementation, as an example let me introduce you with my configuration. It is a good habit to always backup default asterisk configuration, and start the new configuration from the scratch.

My extensions.conf is:

; extensions.conf - the Asterisk dial plan
; Created by M. Edwin Z for xxxxxxxxxxxxxxxx
; medwinz@gmail.com                        
;                                                           
; Static extension configuration file, used by              
; the pbx_config module. This is where you configure all your
; inbound and outbound calls in Asterisk.                    
;                                                            
; This configuration file is reloaded                        
; - With the "dialplan reload" command in the CLI            
; - With the "reload" command (that reloads everything) in the CLI
;                                                                

[general]
 static=yes
 writeprotect=yes
[globals]
 RINGDELAY => 20
 DYNAMIC_FEATURES => automon 
[incoming]
 exten => s,1,Answer
 exten => s,2,Background(en/greeting-indonesia)
 exten => s,3,Hangup()                    

 exten => h,1,Hangup()

 exten => 9999,1,VoiceMailMain()
 exten => asterisk,1,VoicemailMain()

 exten => 5000,1,Set(CHANNEL(language)=en) ; conference 1
 exten => 5000,2,Meetme(5000)                           
 exten => 5000,3,Hangup                                 

 exten => 6000,1,Set(CHANNEL(language)=en) ; conference 2
 exten => 6000,2,Meetme(6000)                           
 exten => 6000,3,Hangup                                 

 exten => 7000,1,Set(CHANNEL(language)=en) ; conference 3
 exten => 7000,2,Meetme(7000)                           
 exten => 7000,3,Hangup                                 

 exten => _XXXX,1,Answer
 exten => _XXXX,2,Dial(SIP/${EXTEN},${RINGDELAY},t)
 exten => _XXXX,3,Voicemail(${EXTEN}@default,u)   
 exten => _XXXX,4,Hangup()                        
 exten => _XXXX,103,Voicemail(${EXTEN}@default,b) 
 exten => _XXXX,104,Hangup

 [internal-fxo]
 exten => s,1,Answer
 exten => s,2,Wait(1)
 exten => s,3,Background(en/autoattendant)
 exten => s,4,WaitExten(2)               
 exten => 5000,1,MeetMe(5000)            
 exten => 6000,1,MeetMe(6000)            
 exten => 7000,1,MeetMe(7000)            
 exten => _XXXX,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m) 
 exten => _XXXX,2,Dial(SIP/${EXTEN},${RINGDELAY},t)                                                  
 exten => _XXXX,3,Voicemail(su${EXTEN})                                                              
 exten => _XXXX,4,Hangup()                                                                           
 exten => _XXXX,103,Voicemail(sb${EXTEN})                                                            
 exten => _XXXX,104,Hangup()                                                                         

 exten => h,1,Hangup()

 exten => t,1,Monitor(wav,Call-${CALLERID(num)}-9019-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m) 
 exten => t,2,Dial(SIP/9019&SIP/9006&SIP/9007&SIP/9001&SIP/9002&SIP/9015,${RINGDELAY},t)     
 exten => t,3,Hangup                                                                         
 exten => t,305,Dial(SIP/9001&SIP/9002&SIP/9003&SIP/9004&SIP/9005&SIP/9006&SIP/9007&SIP/9008&SIP/9009&SIP/9010&SIP/9011&SIP/9016&SIP/9017&SIP/9018&SIP/9019)                                                                                               
 exten => t,306,Hangup                                                                                                       

 include => incoming

[internal-fxs]
 include => incoming

[internal-sip]
 exten => _1.,1,Dial(IAX2/ygpabxsv:0000@10.1.1.120/${EXTEN:1}@local)
 exten => _1.,2,Hangup()                                           

 exten => _2.,1,Dial(IAX2/ygpabxsv:0000@10.7.1.120/${EXTEN:1}@local)
 exten => _2.,2,Hangup()                                           

;;GSM call to Telkomsel/HALO
 exten => _000811.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000811.,2,Dial(SIP/9031/${EXTEN:1})                                                                                     
 exten => _000811.,3,Hangup                                                                             

;;GSM call to Telkomsel/Simpati
 exten => _000812.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000812.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000812.,3,Hangup                                                                             

;;GSM call to Telkomsel/Simpati
 exten => _000813.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000813.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000813.,3,Hangup                                                                             

;GSM call to Telkomsel/As
 exten => _000852.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000852.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000852.,3,Hangup                                                                             

;;GSM call to Telkomsel/As
 exten => _000853.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000853.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000853.,3,Hangup                                                                             

;;GSM call to Indosat
 exten => _000814.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000814.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000814.,3,Hangup                                                                             

;;GSM call to Indosat
 exten => _000815.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000815.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000815.,3,Hangup                                                                             

;;GSM call to Indosat
 exten => _000816.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000816.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000816.,3,Hangup                                                                             

;;GSM call to Indosat
 exten => _000855.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000855.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000855.,3,Hangup                                                                             

;;GSM call to Indosat
 exten => _000856.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000856.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000856.,3,Hangup                                                                             

;;GSM call to Indosat
 exten => _000857.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000857.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000857.,3,Hangup                                                                             

;;GSM call to Indosat
 exten => _000858.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000858.,2,Dial(SIP/9031/${EXTEN:1})                                                          
 exten => _000858.,3,Hangup                                                                             

;;GSM call to XL
 exten => _000817.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000817.,2,Dial(SIP/9032/${EXTEN:1})                                                          
 exten => _000817.,3,Hangup                                                                             

;;GSM call to XL
 exten => _000818.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000818.,2,Dial(SIP/9032/${EXTEN:1})                                                          
 exten => _000818.,3,Hangup                                                                             

;;GSM call to XL
 exten => _000819.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000819.,2,Dial(SIP/9032/${EXTEN:1})                                                          
 exten => _000819.,3,Hangup                                                                             

;;GSM call to XL
 exten => _000859.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000859.,2,Dial(SIP/9032/${EXTEN:1})                                                          
 exten => _000859.,3,Hangup                                                                             

;GSM call to XL
 exten => _000878.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000878.,2,Dial(SIP/9032/${EXTEN:1})                                                          
 exten => _000878.,3,Hangup                                                                             

;GSM call to 3
 exten => _000898.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000898.,2,Dial(SIP/9032/${EXTEN:1})                                                          
 exten => _000898.,3,Hangup                                                                             

;GSM call to 3
 exten => _000899.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _000899.,2,Dial(SIP/9032/${EXTEN:1})                                                          
 exten => _000899.,3,Hangup                                                                             

;;GSM call to Axis
; exten => _000831.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
; exten => _000831.,2,Dial(SIP/9032/${EXTEN:1})                                                          
; exten => _000831.,3,Hangup                                                                             

;;GSM call to Axis
; exten => _000838.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:2}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
;exten => _000838.,2,Dial(SIP/9032/${EXTEN:1})                                                           
;exten => _000838.,3,Hangup                                                                              

 include => global
 include => incoming

[global]
 exten => _0.,1,Monitor(wav,Call-${CALLERID(num)}-${EXTEN:1}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},m)
 exten => _0.,2,Dial(DAHDI/g1/${EXTEN:1})                                                          
 exten => _0.,3,Hangup                                                                             
 exten => _0.,103,Playback(en/tt-allbusy)                                                          
 exten => _0.,104,Hangup                                                                           

[recordings]
 exten => 500,1,Answer
 exten => 500,2,Playback(en/silakanrekamgreeting)
 exten => 500,3,Record(en/mymessage:gsm)        
 exten => 500,4,Playback(en/pesananda)          
 exten => 500,5,Playback(en/mymessage)          
 exten => 500,6,Playback(en/tekan1)
 exten => 500,7,WaitExten(3)

 exten => t,1,Playback(en/maafmohonulangi)
 exten => t,2,Goto(500,5)

 exten => i,1,Playback(en/pesanandasalah)
 exten => i,2,Goto(500,5)

 exten => 1,1,System(/bin/mv /var/lib/asterisk/sounds/en/mymessage.gsm  /var/lib/asterisk/sounds/en/autoattendant.gsm)
 exten => 1,2,Playback(en/terimakasih)
 exten => 1,3,Playback(en/tekan3)

 exten => 2,1,Goto(500,1)
 exten => 3,1,Goto(500,1)
 exten => 4,1,Hangup

 include => internal-sip

[local]
;
; Master context for local, toll-free, and iaxtel calls only
;
 ignorepat => 9
 include => default
 include => parkedcalls
 include => internal-sip

[default]
 include => internal-sip

I know it seems make pain in your head, so now take a cup of coffee, read the above configuration carefully until it comes up into your dream :-) . I will explain everything in the next post.

Have a lot of fun. 

Comments

Popular posts from this blog

openSUSE.Asia Summit 2017

openSUSE.Asia Summit 2017 was held at University of Electro Communication (UEC) Chofu Tokyo on October 20-22, 2017. Japan is an advance developed country. Tokyo is a big city that can be compared with other major big cities in the world. While it is not the first time for me to go to Tokyo, I was so excited when the committee approved my talk, and openSUSE, as always, give me TSP to come to the event.


During the preparation we have  online meeting every week since February 15, 2017. I was so happy to help the preparation of this yearly openSUSE Summit for Asia Region. Indonesia community also contribute to provide the online voting for the logo contest this year through the voting site.

On the midnight on October 17, 2017 together with my friend Estu Fardani, I went to Tokyo.

It was 7 hours long flight. While almost half of the flight was so bumpy because the initiation of Lan Cyclone, in the morning of October 18, 2017 I enjoyed the clear sky with the golden hour in Japan air around…

FOSSASIA 2017

It's been a while since last time I wrote to this blog. I've been busy with my work and don't have time to make a notes here. However there are some posts I write for openSUSE Indonesia, you can go this link if you will.

On January 12, Douglas DeMaio from openSUSE contact me if I have time to go to FOSSASIA 2017 schedule in Singapore on 17-19 March. I checked my calendar and the date was available for me. So I reply his email and said I will go there to represent openSUSE at booth.

openSUSE become Silver sponsor for FOSSASIA 2017, and also have 2 talks by my colleagues Gary Lin from SUSE Labs Taipei and Zhao Qiang from SUSE Beijing on Day 2. I (only) became a booth-person this time :-)

Doug sent me some stickers to bring to the crowd which consists of:
94 webcam covers
128 Tumbleweed stickers
108 Leap stickers
213 openSUSE stickers
174 OBS stickers
175 Portus stickers
116 Alex the Geeko stickers
56 small black Geeko stickers
78 power by openSUSE stickers
30 openSUSE pamphl…

Heartbeat dan DRBD

Dalam sebuah implementasi saya harus mengganti implementasi vrrpd (virtual router redundancy protocol) dengan heartbeat+drbd disebabkan adanya penambahan database dalam server yang digunakan. Service awal pada mesin ini hanyalah web server statis, named dan dhcpd yang relatif statis dan file-filenya saya sinkronisasi dengan rsync. Tetapi dengan adanya penambahan database (mysql) dibutuhkan sebuah mekanisme dimana data yang disimpan dalam satu mesin primary dapat secara langsung ditulis juga ke mesin backup. Untuk hal yang terakhir ini vrrpd saja tidak mencukupi karenanya saya harus mengganti vrrpd dengan heartbeat (baca hartbit, bukan hertbet :-) )sedangkan untuk menjamin mekanisme clusternya saya menggunakan drbd.

Implementasi heartbeat saja sangatlah mudah. Cukup mendownload, mengkompilasi dan mengkonfigurasi tiga buah file /etc/ha.d/ha.cf, /etc/ha.d/authkeys dan /etc/ha.d/haresources. Untuk drbd bisa download tarball dan jangan lupa untuk membaca dokumentasinya, karena drbd harus d…