Add a context for OnSIP Trunking in sip.conf:[onsip]type=peerhost=sip.onsip.comusername=example_hirofromuser=hirofromdomain=example.onsip.comsecret=VqWyYuVcmM2yfYhbdtmfmode=RFC2833context=incoming-contextinsecure=invitesrvlookup=yes

Where “incoming-context” is a valid context in your extensions.conf to route inbound calls.

Save and exit your sip.confReload 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.

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:00012125555555@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/000${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.confReload 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 onThings 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 9999999999Things to look for: