Setting Up a SIP Endpoint
Create a SIP Endpoint
You can create a SIP endpoint manually within your SignalWire space or programmatically through the Create A SIP Endpoint API.
If you want to create a SIP endpoint in your SignalWire Space, visit the SIP tab and click Create a Sip Endpoint.
You will need to set a few things; the username you will register your SIP endpoint as, a password to authenticate your endpoint when registering, which SignalWire or verified phone number you would like to show when dialing a PSTN number (if left blank, a random number from your purchased numbers will be chosen), encryption status, an outbound call policy (whether to allow calls to PSTN), and the default codecs/ciphers you would like to use.
You can create a SIP endpoint programmatically by making a POST request to the SIP Endpoint resource. The following request will use default advanced settings.
curl https://your-space.signalwire.com/api/relay/rest/endpoints/sip \
-X POST \
-u 'YourProjectID:YourAuthToken' \
-H 'Content-Type: application/json' \
-d '{
"username" : "c3p0",
"password" : "yavinOrBust",
"caller_id" : "C-3P0"
}'
Register SIP Endpoint to a SignalWire Phone Number
After creating a SIP Endpoint, you can register it to a phone number in the space for calls to function properly. Navigate to the Phone Numbers tab, click the phone number that you would like to register, and then click edit settings to make changes to how the phone number will handle inbound calls and messages.
Here you will select Voice Calls for Accept Incoming Calls As, a SIP Endpoint for Handle Calls Using and you will need to use your sip username from earlier so that the system knows which endpoint to dial.
Click Save, and you are ready to make a call to your SIP endpoint!
Dial a SIP Endpoint Using SignalWire Compatibility XML
You can also use SignalWire Compatibility XML to dial a SIP endpoint.
To do this, use an XML Bin with the following XML in the text area and replace alice@example.com with the actual sip endpoint address that was created above.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Sip>sip:alice@example.com</Sip>
</Dial>
</Response>
This time in Phone Number Settings you will select Voice Calls for Accept Incoming Calls As, LaML Webhooks for Handle Calls Using and the URL for your LaML Bin created above for When a Call Comes In.
Click Save and give it a call!