Contact Sales

All fields are required

How to Connect Asterisk to SignalWire CLOUD for SIP… | SignalWire
Product

How to Connect Asterisk to SignalWire CLOUD for SIP Connectivity

Connect to the future of telecom: SignalWire's elastic global real-time communications network.

Just one of the things that SignalWire can do is act as a SIP trunk, providing inbound and outbound calling for your PBX or hosted PBX infrastructure.

The first thing to do is to create a SignalWire account. This is very easy and straightforward, and you are even given a $5.00 credit to do things like buy DID numbers. Incidentally, a single US DID costs just 8 cents per month. SIP connectivity is metered per minute/per call leg at just $0.0007, and that includes SRTP and TLS encryption that many providers charge extra for.

Next, create a new resource and choose a SIP endpoint, as this is how your Asterisk will connect with SignalWire. You will notice that you need to give the endpoint a name and that the full SIP URI for it includes the name you chose for your Space URL as well as a multi-character unique ID.

You can leave all of the settings for the SIP endpoint at their defaults, so now you just need to set a (very strong) password.

Then you will add a phone number. When you configure it you will see that there are a number of settings – the only one you need to change at this point is "handle calls using" – set this to be SIP endpoint. This, in turn, will require you to choose an endpoint.

That is all your work done at the SignalWire end!

Now let’s configure Asterisk. You should be using at least version 13.x.x and this post will show the PJSIP and dialplan settings.

First, here are the relevant entries for PJSIP:

/etc/asterisk/pjsip.conf

Now your SIP connection is made. Asterisk should register with SignalWire using the registration section, which in turn used the information in your auth section to authenticate.

Inbound calls are matched to the SignalWire endpoint using the identify section, and then handled in the from-signalwire context in the dialplan.

Outbound calls are sent out through the SignalWire endpoint to the host which is identified in the aor section.

In the from-signalwire context, you will notice that the number 1 priority of the s extension sets a variable called numb to a CUT() of a CUT() of the result of a read of the PJSIP_HEADER function, looking at the To field.

This is because as far as Asterisk is concerned, the call has arrived without any dialed digits (that is why we have to run with the s extension).

The dialed number is actually contained in the To field of the SIP header, and so that first line is just to obtain the dialed number.

/etc/asterisk/extensions.conf

A note on outbound dialing:
If you have an endpoint connected to your Asterisk that can get into the outbound context, you should be able to send calls out to US numbers using the pattern shown.

However, when your SignalWire account is first created, it will be in "Trial Mode" with a $5.00 credit, but you cannot send outbound calls until you add some credit (from $5.00 to $50.00) to bring the account out of Trial Mode.
Without doing this, outbound calls will be greeted with a 404 error!

So now you can see how easy it is to get your Asterisk connected to the outside world with SignalWire. You can learn about our disruptive pricing here.

Related Articles