[asterisk-users] SIP Registration conundrum

Tony Mountifield tony at softins.clara.co.uk
Wed Jul 19 14:19:56 MST 2006


I have a customer on one of my Asterisk boxes that wants a small number
of DIDs in Hong Kong. Referring to voip-info.org, we found the provider
HKBN and their 2b service at www.2b.com.hk.

Following the information at
http://www.voip-info.org/wiki/index.php?page=asterisk+settings+HKBN+2b
we successfully set up one DID, with Asterisk configured to receive
incoming calls from it, as follows (in sip.conf):

[general]
register => 39999999hk:xxxxxx at s2hkbntel.net:5060/39999999

;--- Hong Kong Broadband incoming. Section name must match register statements.
[s2hkbntel.net]
type=user
context=from-hkbn
canreinvite=no
insecure=very
disallow=all
allow=alaw
dtmfmode=rfc2833
nat=no

And in /etc/hosts we have the entries:

#203.80.89.135   s2hkbntel.net s21.hkbntel.net
203.80.89.139   s2hkbntel.net s22.hkbntel.net

As I said, this works fine. We registered a second number and added a
register statement, which also worked fine:

register => 38888888hk:xxxxxx at s2hkbntel.net:5060/38888888

The problem came when we registered a third number. I added another
register statement in the same way, but when Asterisk tried to register
this number, it received a "301 Moved Permanently" response, indicating
that this third account was on the s21 proxy instead of the s22 one.

This system has been in production for over a year, and is running the
v1-0 CVS from April 2005.

The first question is: does either the 1.2 or trunk version of Asterisk
support 301 redirection to automatically re-attempt registration at the
specified new IP address?

The second question is: how can I set up my sip.conf to register these
numbers with different proxies?

I've tried using different proxy names and type=friend sections:

register => 39999999hk:xxxxxx at hkbn1:5060/39999999
register => 37777777hk:xxxxxx at hkbn2:5060/37777777

[hkbn1]
type=friend
host=s22.hkbntel.net
fromdomain=s2hkbntel.net
context=from-hkbn
canreinvite=no
insecure=very
disallow=all
allow=alaw
dtmfmode=rfc2833
nat=no

[hkbn2]
type=friend
host=s21.hkbntel.net
fromdomain=s2hkbntel.net
context=from-hkbn
canreinvite=no
insecure=very
disallow=all
allow=alaw
dtmfmode=rfc2833
nat=no

However, this doesn't work. The SIP REGISTER packet looks like this:

REGISTER sip:hkbn2 SIP/2.0
Via: SIP/2.0/UDP 194.nn.nnn.n:5060;branch=z9hG4bK0d1223ab
From: <sip:37777777hk at s21.hkbntel.net>;tag=as1ec60bd6
To: <sip:37777777hk at s21.hkbntel.net>
Call-ID: 328fa7ff64dfc00314f2029b13ee7b86 at s2hkbntel.net
CSeq: 102 REGISTER
User-Agent: Asterisk PBX
Expires: 120
Contact: <sip:37777777 at 194.nn.nnn.n>
Event: registration
Content-Length: 0

And the response that comes back is:

SIP/2.0 403 Registrations to foreigndomains are forbidden

So it evidently doesn't like either the hkbn2 in the REGISTER line or the
s21.hkbntel.net in the From and/or To header. Originally, when one number
was working, all those values were s2hkbntel.net.

If you're still with me, thanks! I would appreciate any advice from either
a SIP expert or someone who has successfully done this with HKBN.

I can update to a newer Asterisk if necessary, but only if it will help
with this issue.

Thanks in advance,
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list