@ZimboKraut
Hi,
I just tested connecting SIP Trip Phone directly to the SIP provider and it works. So, you can skip installing Asterisk, and connect SIP Trip Phone directly to your SIP provider. I tested with Telnyx, but it should work with other SIP providers that allow direct connections from WebRTC applications. I describe below how to connect SIP Trip Phone directly to a Telnyx account.
First I want to point out that I donât have any affiliation with any of the SIP providers that I mention. I just searched a lot to find the SIP provider offering the services with the best quality at the lowest prices possible. I found that Telnyx and Localphone are the best for voice SIP services.
How to connect SIP Trip Phone to a Telnyx account directly, without the use of Asterisk
1. Configure your Telnyx account.
After you sign up for a Telnyx account click on the âMy Accountâ icon in the upper right corner of the screen, then click on âMy Accountâ, click the âVerificationsâ tab and take the steps to undergo verification, so that you become âLevel 1â and âLevel 2â verified. âLevel 1â verification usually requires verifying the email address you used to create your Telnyx account, by clicking a link included in a message sent to that email address. âLevel 2â verification can be requested by pressing the âVerifyâ button in the âLevel 2 Verificationâ section (on the âVerificationsâ tab). After you make your request for âLevel 2â verification, a representative from Telnyx will look at your account details and (s)he may send you an email asking about the way you plan to use your Telnyx account, after which (s)he will approve the âLevel 2â verification. Being âLevel 1â and âLevel 2â verified unlocks all the features of a Telnyx account: you can buy numbers, assign a connection/messaging profile to a number, set up global messaging capabilities, create a multi-user organization, make international calls, set up call forwarding, send SMS messages at a higher rate.
While logged in to your Telnyx account, click on Numbers on the left panel. To buy a real phone number located in a country of your choice click on the âSearch & Buy Numbersâ tab, then under âLocal Numbersâ, in the âSearch Typeâ select âRegionâ, in the âRegionâ text field enter the name of the country, in the âNumber Featuresâ select âVoiceâ, then, if you want your number to have other capabilities select other features such as âSMSâ from the drop-down list, then click on the âSearch Numbersâ button. You will see a list with all the numbers available in the selected region. Choose the number that you like, click âAdd to Cartâ, then click on âCartâ on the upper bar, then click on the âPlace Orderâ button.
After you have bought a local phone number click on âNumbersâ on the left panel; on the âMy Numbersâ tab you will see your number in the list of acquired phone numbers.
Then click on SIP connections on the left panel, click on the âAdd SIP Connectionâ button, in the âNameâ field enter the name of the new SIP connection, for example SIP_Trip_Phone, then click on âCreate SIP Connectionâ. After you create the new connection click on the small pencil icon to open the options window. On the options window, on the âBASICâ tab, under âSIP Connection Typeâ choose âCredentialsâ, then in the âUsernameâ field enter a username for this connection, siptripphoneuser for example, in the âPasswordâ field enter a strong password; write down the username and password to use them later. Next, under âAnchorSiteâ choose a town that is closer to the physical location of your server, then, under âExpert Settingsâ, in the âPortâ drop-down list choose ârtcp-muxâ. Next, click on the âINBOUNDâ tab and in the âNumber Format (DNIS)â drop-down list choose âSIP Usernameâ. (The last 2 settings are extremely important. If you connect SIP Trip Phone to Telnyx via Asterisk, the last 2 settings will be different, namely âPortâ: ârtp+1â and âNumber Format (DNIS)â: âE.164â) Leave all the other settings as they are and click on the âSave All Changesâ button.
To be able to make phone calls you will also need to configure an Outbound Voice Profile. On the left panel click on âOutbound Voice Profileâ, then click on the âAdd New Profileâ button. In the âNameâ field enter a name for the profile, 1_outbound for example, then click âCreateâ. In the new window, under âAssociated Connections and Applicationsâ click âAdd connections/apps to profileâ, select the name of the SIP connection created earlier, SIP_Trip_Phone in this example, by checking its checkbox, then click âAdd Connections/Apps to profileâ. Next, under âTraffic Typeâ choose âConversationalâ, then under âInternational Allowed Destinationsâ select the countries and regions to which outbound calls will be allowed, by clicking their name. You can select all the 253 countries and regions, to allow outbound calls to all of them. Click on âSaveâ to save the changes.
Next, create a Billing Group. Click on the âMy Accountâ icon in the upper right corner of the screen, then click on the âBilling Groupsâ tab. In the âCreate Billing Groupâ field enter a name, Default_Billing for example, then click on âCreateâ. Then add the billing group to your phone number: click on âNumbersâ on the left panel, then on your numberâs row, in the âBilling Groupâ field select the billing group that you have just created, Default_Billing in this example. Also, in the âConnection or Appâ field on the same row, choose the connection created earlier, SIP_Trip_Phone in this example.
2. Configure SIP Trip Phone
After you install SIP Trip Pphone like any other Nextcloud app, click on the profile picture in the upper right corner, click on âSettingsâ, then on the left sidebar, under âPersonalâ, click âSIP Trip Phoneâ. The credentials that have to be entered should look like this:
In the Display Name field you should enter the phone number that you have just configured in your Telnyx account, preceded by the country calling code: 49 for Germany, 33 for France, 44 for UK, 1 for USA, etc. So, if the number is 1212121212 and is located in Germany, the âDisplay Nameâ shoiuld be 491212121212.
In the SIP User field enter the username for the SIP connection that you associated with your phone number in your Telnyx account, siptripphoneuserin this example. In the SIP User Password field enter the password for siptripphoneuser.
In the WSS URL field enter wss://sip.telnyx.com:7443
In the SIP Realm field enter sip.telnyx.com
In the STUN Server domain or IPv4 address, and port number field enter stun.telnyx.com:3478
Click âSaveâ to save these settings.
3. Configure the web server
If you use Nginx (which I recommend), in the server blocks configuration file, /etc/nginx/sites-enabled/0-conf (replace 0-conf with the name of your file), add the following lines inside the server block for cloud.example.com, the subdomain that you use to serve Nextcloud, at the end of the block:
location /apps/sip_trip_phone/phone {
try_files $uri /index.html;
}
location /apps/sip_trip_phone/lib {
# prevents 502 bad gateway error
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_pass http://sip.telnyx.com:7443;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# enables WS support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
It is assumed that you use a subdomain like cloud.example.com to serve Nextcloud, and not a subdirectory, like example.com/nextcloud/ and that Nextcloud is served over HTTPS.
Restart Nginx:
systemctl restart nginx
If you use Apache (which I donât recommend), add the following lines in the configuration file for Nextcloud, /etc/apache2/sites-available/nextcloud.conf (replace nextcloud.conf with the name of your file), inside the <VirtualHost *:443> block, at the end:
<Directory /var/www/cloud.example.com/apps/sip_trip_phone/phone/>
DirectoryIndex index.html
</Directory>
<Location /var/www/cloud.example.com/apps/sip_trip_phone/lib/>
ProxyPass http://sip.telnyx.com:7443
ProxyPassReverse http://sip.telnyx.com:7443
Order allow,deny
Allow from all
RequestHeader set X-Real-IP $remote_addr
RequestHeader set Host $http_host
RequestHeader set X-Forwarded-For $proxy_add_x_forwarded_for
RequestHeader set Upgrade $http_upgrade
RequestHeader set Connection "upgrade"
</Location>
Enable the necessary Apache modules:
a2enmod rewrite headers env dir mime setenvif ssl proxy proxy_fcgi
Restart Apache:
systemctl restart apache2
If a SIP provider allows direct connections from web applications using SIP over WebSocket, they should list the settings needed for connection on their website. Telnyx lists these settings at the bottom of this page.
As a side note, Localphone, Vonage, Flowroute, Twilio donât seem to allow direct connections from web applications using SIP over WebSocket, like SIP Trip Phone, they can only connect via Asterisk.