Configuring outbound calls with SIP
Overview
Prerequisites
- Dasha CLI
$ npm install --global "@dasha.ai/cli"
- You have to be logged into your account using Dasha CLI:
$ dasha account login
- Your application (or example app from this tutorial)
- Access to SIP Provider or your PBX, for example, you can use Twilio
Configuration with Twilio SIP Trunking
- Buy a phone number https://www.twilio.com/console/phone-numbers/search
- Create sip trunk https://www.twilio.com/console/sip-trunking/trunks
- Go to tab
Numbers
- Press a
plus
button to assign the phone number to sip trunk - Go to tab
Termination
- Write
Termination URI
, for example,my-dasha-app.pstn.twilio.com
- Add credentials for auth with
username
=phoneNumber
you want to use, and some password
Configuring on Dasha side
$ dasha sip create-outbound --server <ip_or_dns_of_server:port> [--domain <domain_name>] [--ask-password] --account <accountName> --transport [tcp|udp] <config_name>
For this example
$ dasha sip create-outbound --server my-dasha-app.pstn.twilio.com --account +19733588889 --ask-password twilio password: enter_your_password_here
Where the password is the same, that was configured in Twilio, and the account same as Twilio phone number
Call to yourself with Dasha
node main.js +1...
- Receive the call from Twilio
Example SIP Flow
Here you can see an example of SIP flow, captured on the Twilio side
SIP flow logs can be downloaded from https://www.twilio.com/console/sip-trunking/dashboard
Invite +1XXXXXXXXXX
from +1YYYYYYYYYY
, where
- +1XXXXXXXXXX - phone number of user you are calling
- +1YYYYYYYYYY - phone number for Dasha
Authentication request from Twilio
New invite with the authentication response
Phone ringing event
User picked-up the phone
Dasha is closing the connection and hangs-up the phone call