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

Prejudice and Privilege

Notes : It is not about Linux or other geeky stuff nor it is a political writing.  It was a day in the end of March 2007. I was just landed at the Franz Josef Strauss Munich Airport  around 10 AM in the morning. I had 5 days free time from my work in Astrium. At that time I was contracted by EADS Astrium  (now become Airbus Defense and Space) to work with them in Toulouse . I worked for one of their project. I flew from Toulouse where I worked to visit my brother family in Munich. Just after I picked up my luggage from the conveyor, three guys without uniform approaching me and asked me in English what i'm doing in Munich. I asked them if I did anything wrong. One of them told me that it was a random checked.     "Who are you guys? Sorry sir if it is a random check, why do you choose me instead of other?" I reply to their answer.  One of them said they're from the Munich immigration, and at the same time showing a gun behind his jacket. For my itinerary Munich was not

Asterisk 1.6.1 on openSUSE 11.1 (Part 2)

In this second part I will explain step-by-step configuration to use our appliance to build an Asterisk PABX server. Without further ado, here is the list: Install the Digium card on the PCI slot Install our appliance. You can also use any linux distribution, download asterisk from its website and install it. There are several softwares I forget when I made the appliance, it is not the mandatory (dependencies) but they are useful when we want to use asterisk optimally. They are: mpg123, sox, libmad, and festival. The easiest way to install it in openSUSE is using zypper. Check it first where they reside in repositories and add the repositories accordingly. mpg123 and sox are in the packman repositoriy, libmad in OBS (please check with webpin) and festival in oss. Then as root run: "zypper install mpg123 sox libmad0 festival". It is always useful to update your installation to update repository, to make sure that all the security update is up to date. Download the

In Search of Manohara

Notes: I always write note in my laptop and put it somewhere either on disk or cloud when I think there is an interesting experience. I found this 7 years old note when I try to clear some space in my disk, and before I wipe it out from my disk I think it is an interesting story to share with you. This happened in 2011, at that time I was working to build Linux based computer labs for 500 elementary and junior high schools in Yogyakarta Indonesia. No it is not about computer and other geeky stuff. So here it is.  Well, it is very out of topic everyone, you've already been warned 😁 During my busy weeks in implementing openSUSE Li-f-e for schools in Yogyakarta Indonesia (see the pictures below), me and one of my colleague use our free time in a Sunday afternoon to visit Borobudur , the biggest Buddhist temple in the world. One of the World Heritage preserve by Unesco. 85% of Indonesia population are Moslem and this make Indonesia the biggest Moslem country in the world. We