从源辞典

查阅生活点点滴滴

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 »

NEC PBX Call SMDR Logger

January 17th, 2011 by congyuan

This is a Windows program written in C# to retrieve phone call log via TCP/IP from the PBX system.

Requirement:
1. Windows with .NET framework 1.1 or above
2. PBX system which can output SMDR via TCP/IP

How to use: (eg. NEC Univerge SV8100)
1. Enable NEC SMDR Output
http://univergesv8000series.blogspot.com/2009/04/setup-smdr-output-via-ip-for-nec.html
At SV8100
PROG 10-12-01/02: confirm your IP address given for the CPU
PROG 35-01-01: Output Port Type (select: LAN)
PROG 10-20-05: SMDR Output (input: 60010)
PROG 14-01-06: SMDR Print-Out (checked)
Repeat for all the trunks necessary
Reboot SV8100

2. Download the windows program here
http://www.xucongyuan.com/nec-smdr-logger.zip
It contains 3 files:
InstallUtil.exe The utility program to install a service
NecSmdrLogger.exe The main program for SMDR logging
NecSmdrLogger.exe.config The configuration file

3. Unzip it to a folder and edit the NecSmdrLogger.exe.config

NecHost: The Ip address of the NEC PBX
NecPort: The port of SMDR output
workingDir: The directory where the program will be running, auto create if not exist
CallLogDir: The directory where all the call logs be stored, auto create if not exist
logFile: The log file of the program, auto create if not exist

4. Open a Command prompt, and type the following command to install it a service
cd to_where_the_files_are
InstallUtil NecSmdrLogger.exe

5. Right click on “My computer” and go to “Manage”.
Under “Services”, look for “NEC SMDR Logging”. Click “Start” to run it.

6. Set it to run Automatically every time the windows starts.
By default, it is installed as start automatically. Check it to make sure it is set.

Note:
This program can only be run as a service.
It automatically reconnects to PBX every 24 hours if no data received for that period.
Call logs will be stored into files by month.

DISCLAIMER:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Posted in All Others | 2 Comments »