Archive for March, 2007

Asterisk tips #1

Thursday, March 15th, 2007

I have been building an asterisk system at work for testing stuff. I started with a Fedora Core 6 box and then installed asterisk from source. Since we will be using a PRI we had to buy a T-1 card. We decided to go with sangoma. For our testing purpose we just got an A102. I installed the card and then went to the sangoma site for the latest wanpipe drivers. After installing them and setting up my zaptel.conf and zapata.conf I found nothing worked. I found out I needed to compile the wanpipe stuff first, and install zaptel from source instead of using the Fedora RPM because the wanpipe package needs to patch the zaptel stuff. Once I finished this and loaded the wanpipe modules and loaded ztdummy and then rebuilt asterisk I had a working sangoma card. I started with a very very basic config for asterisk. I just wanted to have 2 extensions and make them able to call each other using SIP, then I wanted to take 2 of the DID’s provided to me by our phone company and have them ring into the extensions. The SIP part of this was just plain simple. Here is what my sip.conf looks like for asterisk.

[231]
;Test Guy1
type=friend
username=231
secret=231
host=dynamic
context=local_test

[205]
;Test Guy2
type=friend
username=205
host=dynamic
context=local_test

The important thing to note here is the context=local_test Next to get this working completely we need a very basic extension.conf file. Mine looks like this:

; SIP extensions
[local_test]
;Test Guy1
exten => 231,1,Dial(SIP/231)
;Test Guy2
exten => 205,1,Dial(SIP/205,10)
exten => 205,2,PlayBack(vm-goodbye)
exten => 205,3,HangUp()

Thats it, this simple example will now make it so from 231 we can dial 205 then if after 10 seconds we dont answer the phone system will automaticly pick up and play the message vm-goodbye.gsm and then hangup the phone. Remember I said to note the context=local_test Well in our extensions.conf file if we had named our context block something else it wouldnt have worked because the context wouldnt have matched. You can name your context blocks what ever you want, but keep in mind they must match or nothing will work.

Now we need to expand on this just a little bit to get our calls from the outside to ring in. I will cover that later today or Friday. Its very simple so check back soon for the tip.