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

Remarkable Year 2018 for openSUSE Indonesia Community

Year 2018 is a remarkable year for the Indonesian openSUSE community. There are quite a lot of our achievements as a community that make us proud. As a long time person in this community, I feel that there are quite a lot of young people who can be role models for future generations. Even though the dominance of "you again" cannot be denied, because the same people are also activists in BlankON, LibreOfficeID, Glib, and other communities, it does not reduce my admiration for their militancy towards the spread of FOSS use in Indonesia.



One of openSUSE community friend once said to me, the first step is the most difficult. When I started using Linux in 1997 no one used it at my workplace. I have been using Unix for about 2 years and it happens that many GNU software is also used on both operating systems so the commands are not so weird for me. But it is very difficult to find people to have direct discussion at that time. At present the obstacles that I felt before seemed to b…

LibreOffice Conference Indonesia 2018

In early 2018 I got a news from community that LibreOffice Indonesian Community will held a conference in Electronic Engineering Polytechnic Institute of Surabaya (EEPIS) on March 23-25, 2018. I discussed with some member of openSUSE Indonesia community and we're willing to give our hands and also to open openSUSE booth on that event. I sent the proposal to Douglas De Maio from openSUSE and he agree to give some donation for the event.

On March 1st, I received some marketing material from openSUSE that we can put on our booth and distribute to the conference participant. Thanks openSUSE!


LibreOffice Conference Indonesia (LOCI) 2018 is the first LibreOffice Conference in Indonesia so as a user of Libre Office  since a long time I'm so excited to attend this conference.
On early morning March 23, 2018 I took the flight flying through the golden hour to Surabaya. It was still 6.00 o'clock in the morning and I'm very surprised that Darian, the local committee of LOCI 2018,…

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…