[asterisk-users] Call is not coming through sipgate.co.uk+Asterisk
Brian Candler
B.Candler at pobox.com
Wed Oct 25 07:01:58 MST 2006
On Wed, Oct 25, 2006 at 01:54:43AM -0700, Crazy Boy wrote:
> My sip.conf file contents:
...
> [250]
> type=friend
> username=250
> secret=danny
> callerid="Danny"
> host=dynamic
> context=demo
> register => 100xxxx:password at sipgate.co.uk/100xxxx
...
> My Extensions.conf file contents:
> [demo]
> exten => 250,1,Dial(SIP/250,20)
> exten => 250,2,Voicemail(u250)
> exten => 250,3,Voicemail(b250)
> exten => 250,4,Hangup
> exten => _0207.,1,SetCallerID("" <100xxxx>|a)
> ;Outgoing
> exten => _0207.,2,Dial(SIP/${EXTEN:4}@sipgate4,40,tr)
> exten => 100xxxx,1,Dial(SIP/250,30,tr)
> ;Incoming
> Am I have to install any other libraries?
No.
In the first case, getting incoming calls to work is easy. Start with a
configuration which has nothing to do with sipgate in it. At the top of
sip.conf you should have a [general] section, and you can put the
registration statement there, i.e.
[general]
register => 100XXXX:PPPPPPPP at sipgate.co.uk/101
context=default
In this case, incoming calls to your sipgate.co.uk PSTN number will ring as
101 in context 'default'. I've just tested this with a sipgate.co.uk and it
works fine. (I actually have two accounts, with two register statements,
pointing at two different extensions)
Now, getting outbound to work is a little harder. You need a new entry in
sip.conf to place outbound calls. My first attempt was:
[sipgate-out]
type=peer
host=sipgate.co.uk
username=100XXXX
secret=PPPPPPPP
fromuser=100XXXX
fromdomain=sipgate.co.uk
With the correct extensions.conf config (see below), outbound calls worked.
Unfortunately, doing this stopped incoming calls from working; they are
rejected with "401 unauthorised" because Asterisk now explictly matches this
SIP entry for incoming calls from sipgate.co.uk, in preference to [general]
So what I eventually ended up with was:
[sipgate-out]
type=friend
host=sipgate.co.uk
username=100XXXX
secret=PPPPPPPP
fromuser=100XXXX
fromdomain=sipgate.co.uk
insecure=invite
;context=default ; not required because I have this in [general] still
I'm not sure if this is the best way to go, but it does seem to work. I
tried moving the "register" lines under [sipgate-out] and Asterisk no longer
registered. Perhaps "register" doesn't work for friend entries?
Finally, you need a rule in extensions.conf to route outbound calls via this
link, in whichever context(s) your local phone(s) sit where you want to
allow outbound calls. For example:
[internal]
exten => _9.,1,Dial(SIP/${EXTEN:1}@sipgate-out,15,r)
exten => _9.,2,Congestion()
exten => _9.,102,Congestion()
This will match all numbers which begin with 9, and route them via sipgate,
stripping off the leading 9.
Regards,
Brian.
P.S. All my testing was with SVN trunk, which is close to 1.4. Behaviour may
be different in earlier versions.
More information about the asterisk-users
mailing list