Asterisk and Signalwire Trunks

Hey everyone,

Just thought that I would share some config info for anyone else that maybe is having trouble setting up on Signalwire… They have pretty good rates… but I had to bash my head against the wall for a bit before finding all the pieces… so here goes…

First off… what you’ll need in your sip.conf

In the [general] section you’ll need to add your registration string like this:

[general]
register=username:password@your-signalwire-space-ID.sip.signalwire.com
context=from-trunk

also in the sip.conf

[SIGNALWIRE]
type=peer
port=5060
nat=auto
insecure=port,invite
host=your-signalwire-space-ID.sip.signalwire.com
username=username
fromuser=username
fromdomain=your-signalwire-space-ID.sip.signalwire.com
secret=password
context=from-trunk
canreinvite=no
qualify=yes
disallow=all
allow=ulaw

Then we move on to the extensions.conf

Since signalwire doesn’t just send the DID number through, we need to go take it out of the SIP HEADER…

[from-trunk]

exten => s,1,Set(HEADER_TO={SIP_HEADER(To)}) ;This saves the sip header into HEADER_TO exten => s,n,Set(CALLED_NUMBER={HEADER_TO:5:12}) ;This gets the DID number part
exten => s,n,Goto(${CALLED_NUMBER:1},1) ;This will send you to where you can handle the DID

exten=>19995551212,1,Dial(SIP/100,20) ;Just an example DID number and where to send it.
exten=>19995552323,1,Dial(SIP/200,20)

Hope this saves someone the headache…

Thanks

Rick

what does the asterisk cli shows, ?

If you do a sip show peers you will see something like this – Don’t mind all my disconnected extensions… at the bottom you’ll see the SIGNALWIRE trunk connected and responding

Name/username Host Dyn Forcerport Comedia ACL Port Status Description

101 (Unspecified) D Auto (No) No 0 UNKNOWN
102 (Unspecified) D Auto (No) No 0 UNKNOWN
103 (Unspecified) D Auto (No) No 0 UNKNOWN
104 (Unspecified) D Auto (No) No 0 UNKNOWN
105 (Unspecified) D Auto (No) No 0 UNKNOWN
106 (Unspecified) D Auto (No) No 0 UNKNOWN
107 (Unspecified) D Auto (No) No 0 UNKNOWN
108 (Unspecified) D Auto (No) No 0 UNKNOWN
109 (Unspecified) D Auto (No) No 0 UNKNOWN
110 (Unspecified) D Auto (No) No 0 UNKNOWN
111 (Unspecified) D Auto (No) No 0 UNKNOWN
113 (Unspecified) D Auto (No) No 0 UNKNOWN
114 (Unspecified) D Auto (No) No 0 UNKNOWN
115 (Unspecified) D Auto (No) No 0 UNKNOWN
116 (Unspecified) D Auto (No) No 0 UNKNOWN
117 (Unspecified) D Auto (No) No 0 UNKNOWN
118 (Unspecified) D Auto (No) No 0 UNKNOWN
SIGNALWIRE/asterisk 111.111.111.111 No No 5060 OK (77 ms)

This is just an example on my test box… With the settings mentioned in my post, I am able to make and receive calls just fine.

Sorry guys, just noticed this won’t let me post the dollar sign in there… was missing a couple of dollar signs in the variables… this is correct now.

It just means the remote peer is replying to the OPTION packet sent by Asterisk and is reachable, but nothing relevant to determine why calls doesnt work

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.