Contact Sales

All fields are required

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

How to Connect Asterisk to SignalWire CLOUD for SIP Connectivity

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

By David Duffett, Worldwide Community Advocate

Having recently started working with SignalWire, I was very keen to see if I could get Asterisk connected up – as 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.

Now it’s true that SignalWire is massively more than just competitively priced SIP trunking, but seeing as I already know Asterisk I thought that this would be a great place for me to start!

The first thing to do is to go to and 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. 

As you create your account, you create a "Space URL", effectively the subdomain at for your account. I went with

Then you can create a project. I simply called my project "Asterisk". From here on in, you are working within your project.

The next job is to create 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 (I went again with "asterisk") 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 – mine looked like this:

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.

Next you will add a phone number, so just pick a number that you would like and when you come to 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, and since you have only created one so far, it will be that one! Mine, you might remember, was called "asterisk".

That is all your work done at the SignalWire end!

Now let’s configure Asterisk. I am assuming you are using at least version 13.x.x and so I am going to show the PJSIP and dialplan settings.

First, here are the relevant entries for PJSIP:


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.

And now for the entries in the dialplan!

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.


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: