从源辞典

查阅生活点点滴滴

Starhub Digital Voice Global to work with Asterisk PBX

March 28th, 2013 by congyuan

I have been able to extract the SIP settings for my starhub digital voice global long time ago. Only recently I could make it to work with Asterisk.

Problems that I faced previously:
Asterisk is able to register successfully but were not able to make outgoing calls. Error is 403 Forbidden.

PhoneNumber = 6xxxxxxx (8 digits)
Username = 3xxxxxxx (8 digits)

Correct values when registering:

From: sip:6xxxxxxx@sipproxy1.starhub.com;
Authorization: Digest username=”3xxxxxxx”, realm=”Registered_Subscribers”, algorithm=MD5, uri=”sip: sipproxy1.starhub.com”,

and calling requires proxy-authorization:

From: “asterisk” sip:6xxxxxxx@sipproxy1.starhub.com;
Proxy-Authorization: Digest username=”3xxxxxxx”, realm=”Registered_Subscribers”, algorithm=MD5,

I set Asterisk to have debug on and found out that
1. Asterisk uses username as the phone number when register.
2. Asterisk send the phone number as the username for Proxy-Authorization as a result.

In the users.conf file, I tried to change the username= 6xxxxxxx to username=3xxxxxxx, but the line could not register. Because Asterisk will use the 3xxxxxxx as phone number, which will be rejected by starhub.

The correct way to make both register and call works is to have a separate register => in sip.conf, and disable registersip in users.conf.

The correct settings are as follows.

file: sip.conf

[general]
register => 6xxxxxxx:YOURPASSWORD:3xxxxxxx@sipproxy1.starhub.com~600

file: users.conf

[starhub]
type = friend
host = sipproxy1.starhub.com
username = 3xxxxxxx
secret = YOURPASSWORD
trunkname = starhub
context = DID_starhub
hasexten = no
hasiax = no
hassip = yes
registeriax = no
registersip = no
trunkstyle = voip
insecure = port,invite
fromuser = 6xxxxxxx
authuser = 3xxxxxxx
outboundproxy = sipproxy1.starhub.com
fromdomain = sipproxy1.starhub.com
nat = yes
canreinvite = yes
disallow = all
allow = ulaw,alaw,g729

Now configure the outbound calling rules.

file: extensions.conf

[CallingRule_Local]
exten = _[3689]XXXXXXX,1,Macro(trunkdial-failover-0.3,${starhub}/${EXTEN:0},,starhub,)
[CallingRule_Local1800]
exten = _1800XXXXXXX,1,Macro(trunkdial-failover-0.3,${starhub}/${EXTEN:0},,starhub,)
[CallingRule_LocalFree]
exten = _1XXX,1,Macro(trunkdial-failover-0.3,${starhub}/${EXTEN:0},,starhub,)
[DLPN_DialPlan1]
include = CallingRule_Local
include = CallingRule_Local1800
include = CallingRule_LocalFree
include = default

Now configure the incoming rules.
file: extensions.conf

[DID_starhub]
include = DID_starhub_default
[DID_starhub_default]
exten = s,1,Goto(ringroups-custom-1,s,1)
[ringroups-custom-1]
exten = s,1,NoOp(Home)
exten = s,n,Dial(SIP/6001,20,${DIALOPTIONS}i)
exten = s,n,Hangup

Note 1: Home is my ring group including extension 6001.
Note 2: Trunk, Outbound and Incoming rules, Ring groups can be created from GUI.
Note 3: Modify the registersip to no for [starhub] in users.conf after the section being generated from GUI.
Note 4: Manually add register => to sip.conf.

Posted in All Others, Singnet Fibre | 6 Comments »