Prerequisites
- Familiarity with configuring Asterisk 1.8 or newer.
- Asterisk 1.8 or newer is installed and running with appropriate permissions and behind a secure firewall.
- A valid OnSIP Hosted PBX account
- An OnSIP Trunking enabled user
Step 1: Gather information for the OnSIP Trunking User
You will need the following information from the OnSIP Trunking User in the Admin portal:
- Username
- Auth Username
- SIP Password
- Domain
You can find this information in the user detail pages under the Users tab in the Phone Configuration section.
Step 2: Edit sip.conf with OnSIP Trunking details
In your sip.conf add the register string and OnSIP Trunking context
Assemble your register string, the [general] context should already exist in your sip.conf
[general]
register => hiro@example.onsip.com:VPG3hockrifv:example_hiro@sip.onsip.com
generically:
username@domain:SIP Password:authorized-username@sip.onsip.com
Add a context for OnSIP Trunking in sip.conf:
[onsip]
type=peer
host=sip.onsip.com
username=example_hiro
fromuser=hiro
fromdomain=example.onsip.com
secret=VqWyYuVcmM2yfYhb
dtmfmode=RFC2833
context=incoming-context
insecure=invite
srvlookup=yes
Where “incoming-context” is a valid context in your extensions.conf to route inbound calls.
Save and exit your sip.conf
Reload asterisk with the new sip.conf details
Verify registration from the Asterisk cli by typingsip show registry
Step 3: Edit extensions.conf with outbound dialing modifications
In your extensions.conf set the outbound CallerID name and append "000" as a prefix to all outbound calls.
- The outbound "From:" section of an outbound SIP Invite request should look like this:
From: "15135555555" <sip:hiro@example.onsip.com >;tag=as04cfd8df
Where 15135555555 is your inbound DID.
Your outbound dialing context in extensions.conf should include something like this:
exten => _X.,n,Set(CALLERID(name)=15135555555)
- The outbound invite header should look like this :
INVITE sip:12125555555@sip.onsip.com SIP/2.0
Where “1 212 555 5555” is the outbound telephone number you wish to reach.
Your outbound dialing context in extensions.conf should include something like this:
exten => _X.,n,Dial(SIP/{EXTEN}@onsip)
Where "onsip" is a defined peer in sip.conf .
Save and exit extensions.conf
Reload Asterisk with the new extensions.conf details
Step 4: Edit extensions.conf to route inbound calls
Now that outbound calls work, you should make sure that your dial plan in extensions.conf appropriately routes incoming calls. This can generally be accomplished by a line such as:exten => 15135555555,1,Dial(SIP/7031,20)
Where “15135555555” is the number routed to your account and “7031” is a valid extension.
Save and exit extensions.conf
Reload Asterisk with the new extensions.conf details
Step 5: Make test calls
Verify connectivity and correct signaling by placing test calls against a land line or cell phone.
You may need to make minor adjustments to your dialplan depending on your individual configuration.
Troubleshooting:
For initial testing please turn on sip debugging and turn up the verbosity of your asterisk server.:
From the Asterisk CLI type: sip set debug on
Things to look for :
- Registration transaction completes successfully
- Inbound sip invite is formatted correctly
- Outbound CallerID is formatted correctly
- Outbound dialed number contains the "000" prefix
- Outbound call authentication is completed successfully
You can turn off SIP debugging from the Asterisk cli using : sip set debug off
Also, From the Asterisk CLI type: core set verbose 9999999999
Things to look for:
- Incoming calls match an existing dial plan
- Outgoing calls match an existing dial plan
You can turn off verbose logging using: core set verbose 0
Comments