The Loomiverse

The universe according to Loom

Entries Comments



Configuring Asterisk – Part 2

9 October, 2008 (16:56) | Asterisk, OpenWRT, VOIP | By: loom

In Part 1 I looked at how to add extensions to an Asterisk configuration. If all went well, we have two extensions 1000 and 1001 which are able to dial each other and not much else

While this is incredibly exciting – for about 5 minutes – it isn’t actually very useful. In this article, I’ll be adding the first of two Trunks to Asterisk.

Again, my terminology is what works for me, I recognise that some people may disagree with this and suggest that I should use the propper terms for everything – I even agree with people who say that kind of thing – but it doesn’t mean that I’m going to do it. As far as what I’m doing here goes, a Trunk is any connection to the outside world. I’ll be setting up a connection to a VOIP provider using SIP, later, I’ll and an IAX2 connection to another ASterisk box – run by a friend of mine.

Connecting to a VOIP provider.

I use PennyTel for my VOIP provider, I live in Australia, they’re in Australia, and I’m happy with their offering. In particular, cheap calls, and a normal phone number that supports multiple dial-in lines.

PennyTel let me connect using SIP, so the configration goes in the same sip_local.conf file that we created in Part 1. If you wanted, you could use #includes in the cip.conf to seperate extensions and trunks into two seperate files – in fact I may do that myself some time.

Basically, we add the following blocks into sip_local.conf to create an incoming and an outgoing connection for PennyTel.

[613nnnnnnnn]
username=nnnnnnnn
type=user
secret=PASSWORD
qualify=yes
nat=yes
fromuser=613nnnnnnnn
context=from-trunk
canreinvite=no

[PennyTel]
username=613nnnnnnnn
type=peer
secret=PASSWORD
qualify=yes
nat=yes
insecure=very
host=sip.pennytel.com
disallow=all
context=from-trunk
canreinvite=no
canredirect=no

And finally so PennyTel knows where to find us when a call comes in, add the following to the [General] section of sip.conf

register=613nnnnnnnn:PASSWORD@sip.pennytel.com/613nnnnnnnn

Possibly Related Posts:


Comments

Comment from Al
Time: 12 July 2010, 5:23 pm

Very useful info and site. Have been successful in setting Asterisk on my router. Following your guide, I was able to setup Internal , and Incoming calls.
But no luck with outgoing calls, as it complaining extensions 9162342354 rejected (out of state friends number).

In Part 2, you used “from-trunk”, which one does it correspond to.

Thanks,
Al

Comment from loom
Time: 13 July 2010, 4:06 pm

The dialing rules I set up in Part 4 are for Australian phone numbers, essentially:

[dial-out]
exten => 000,1,Dial(SIP/PennyTel/000)
exten => _0011,1,Dial(SIP/PennyTel/${EXTEN:4})
exten => _0NXXXXXXXX,1,Dial(SIP/PennyTel/61${EXTEN:1})
exten => _ZXXXXXXX,1,Dial(SIP/PennyTel/613${EXTEN})
exten => _1300XXXXXX,1,Dial(SIP/PennyTel/61${EXTEN})
exten => _1800XXXXXX,1,Dial(SIP/PennyTel/61${EXTEN})

To dial internationally, we dial 0011 then a country code, then a number
Otherwise we have a ten digit phone number starting with a zero, or an 8 digit number starting with non-zero, depending on a bunch of stuff.

You will need to change this to the way things are done in (I assume) the US.

Something like this

exten => 911,1,Dial(SIP/PennyTel/911)
exten => _011,1,Dial(SIP/PennyTel/${EXTEN})
exten => _ZXXXXXXXXX,1,Dial(SIP/PennyTel/{EXTEN})

The specifics will depend on how your VOIP provider expects numbers to arrive and other special numbers you want to handle. You could block ranges of numbers if you wanted.
The key to writing these things is understanding what the different characters mean.

More here

Write a comment





Spam protection by WP Captcha-Free