How to link Shoretel Connect and Asterisk as a SIP gateway

30th August 2017 | Reading Time: 5 minute read

Solutions Implementation Engineer

More information about Lee Harding

Reading Time: 5 minutes

Continuing our series of blogs written by the team of engineers at Blackstar, we have our Solutions Implementation Engineer, Lee Harding, covering how to link ShoreTel Connect and Asterisk. Lee as extensive experience in the ShoreTel universe and thrives in finding a solution. Here are his words…

We have a full Shoretel Connect Onsite system here in our test lab. This provides a useful platform for trialling new configurations and appliance deployments before we apply them to live customer environments.

The one key element missing from the lab Shoretel was external trunking. The lab test system is isolated from our production system and without some complicated network configurations we can’t make use of our production BRI or SIP trunking.

As a solution to this, we decided to spin up an Asterisk server to see if we could make use of it as a SIP gateway. The idea being we would link the Shoretel to the Asterisk via SIP tie trunks, then build separate trunks on the Asterisk registered as SIP peers to an ITSP. We could then send a call from Shoretel through Asterisk and out to the PSTN.

Traditionally, Shoretel only support a list of approved ITSPs. Also, you cannot just connect a SIP trunk group directly to an ITSP, a session border controller is pretty much a necessity (and an expensive one at that). The reason for this is that the Shoretel trunking hardware sits inside the private local area network, it’s not public facing. ITSPs expect to see traffic coming from a public IP address. The SBC also provides interoperability with the various ITSPs.

We don’t currently have an additional SBC for use with the test lab, but fortunately Asterisk is quite happy to be configured with an internal IP address, and present a public IP address to the ITSP, taking care of any NAT headaches.

There is a whole host of SIP providers that are capable of working with Asterisk. For this experiment, we decided to use Sipgate. A feature-rich ITSP with free signup, multiple concurrent calls and a UK DDI included. It takes only a few minutes to get the trunk registration live on the Asterisk server. We’ll assume you are familiar with setting up SIP trunking with Asterisk and an ITSP, and focus on the interoperability between Shoretel and Asterisk.

Some brief details of the 2 systems. Our Shoretel is using extensions in the 1xx range, whilst the Asterisk is using 2xx.

The basic configuration goes something like this…

On the Asterisk side, we create a SIP trunk with 2 channels to the Shoretel.

asterisk trunk

Trunk Outgoing Settings

asterisk SIP

Incoming Settings

asterisk sip

Note the context=from-internal – This is important for Asterisk to treat dialled digits coming across the trunk from Shoretel as digits dialled internally.
The host is the IP address of the Shoretel switch where the SIP trunks are setup

We create an outbound route which send 1xx dialled numbers across to the Shoretel:

asterisk dial patterns

Shoretel Side

We set up a SIP trunk group called Shoretel-Asterisk. It’s a Pretty basic configuration. The profile is ‘Default Tie Trunk’ with no amendments made.

shoretel asterisk

Digest authentication isn’t required here and as such the drop-down is set to ‘None’. The trunk will register on the Asterisk side without any authentication information set.

shoretel inbound

We use the access code of ‘9’ to place calls over the trunk. Asterisk extensions can be dialled without including the ‘9’ because Off-System extensions have been configured on the trunk group. This extension range is 200-299.

shoretel outbound

We create 2 individual trunks within the trunk group, of type SIP. The IP address/FQDN is the static IP address of the Asterisk server. The Switch is the Shoregear switch hosting the trunks.

shoretel SIP trunks

Verifying Connectivity

Now go back to the Asterisk server and verify the connectivity to the Shoretel is established:

Tools > Asterisk Info > Sip Info

The trunk status should be ‘OK’.

That’s pretty much it. A user on the Shoretel can now not only dial users on the Asterisk by their extension number, but also dial a 9+ full CLI across to the Asterisk and out of the Sipgate trunk.
If there is a requirement to route a DDI call through to a Shoretel user, then that is easy too. Just create an Inbound route on Sipgate trunk on the Asterisk side for the DDI in question. The destination of the DDI will be the tie trunk between the two systems:

asterisk inbound routes

On the Shoretel side, just set a DNIS entry on the tie trunk for the number to point at whatever extension you like.

Why might you want to do this?

This was an inexpensive experiment. Our Asterisk SIP appliance is installed on a basic Atom processor based PC. No serious hardware is required. The FreePBX distro we used is freeware. The Sipgate service is free to setup with a UK DDI. Inbound calls are free. Outbound calls require calling credit but rates are very cheap. We’ve now got an effective means of bringing external calls to the lab setup and we dial out too. For the sake of a couple of SIP trunk licences, this is more cost effective than an ISDN2.