📜 ⬆️ ⬇️

SIP registration, trunk, softphone and other scary words of cloud PBX

Aichi is a vast branch of knowledge. It happens that you have been doing different software for fifteen years, under different operating systems, in different programming languages. Like a lot of things you know. And then step aside - and there Narnia SIP, RTP, SDP and PBX. For the last few months I have been doing voice telephony closely and occasionally find myself thinking that this area is not well documented for beginners. Well, if ten articles on “xxx from scratch” have not yet been written on this topic, then this is an excellent reason to write Khabrapost for a wide circle of readers. Today I will tell a small, but interesting part of the theory of the craft: how cloud telephony systems interact with each other and with telecoms. On the example of VoxImplant, of course.



A bit about SIP


')

The main part of the interaction occurs through a bundle of protocols and standards, conventionally called SIP-telephony. SIP is similar to HTTP: the same plain text, headers, request bodies, responses. But instead of requesting web pages, SIP monitors voice and video calls. Despite the 200-page RFC, the protocol itself is very concise: it allows participants to register “phones”, initiate a call, answer it and end a call, and also offers several service functions. The rest is done through other protocols: the call parameters are transmitted in the body of SIP messages, but they are encoded using the SDP protocol; The call is made via RTP or encrypted via SRTP.

SIP trunk




The simplest interaction option widely used by telecoms is the trunk. In general, SIP trunking is the connection of subscribers not via a telephone cable, but via the Internet using the SIP protocol. But this term has taken root also for communications like “telecom-telecom” or “telecom-cloud”. Both interacting parties are involved in creating the trunk. Initially, the telecom IP addresses are added to the white list on the cloud side of VoxImplant: this will allow the telecom to make SIP calls to the cloud without authorization. The client then contacts the telecom and informs it that incoming calls must be “landed” in the cloud. It uses the SIP URI corresponding to the account and the user's application, which, using JavaScript code, informs the cloud what to do with these calls.

username@appname.accountname.voximplant.com 


The trunk described above is essentially unidirectional: the cloud will receive incoming calls from registered numbers, but it is not possible to make outgoing calls from such a number. That is, in fact, there is, but I will write separately about the substitution of numbers and traffic routing - and so the wall of the text has already turned out.

SIP registration




If the trunk is a connection from telecom to the cloud, the SIP registration is connected in the opposite direction. The SIP protocol uses the REGISTER message, which informs the server that a certain subscriber device (for example, a softphone - a software implementation of a SIP client) is ready to receive calls. In order for the cloud to act as such a device, the client needs to get SIP-addresses, logins and passwords for its numbers from the telecom and add this information to the VoxImpant admin area.

In contrast to a trunk, SIP registration works in both directions: having logins and passwords, the cloud both accepts and makes calls to the specified numbers. An important conceptual difference is that SIP registration is part of the SIP protocol (regularly sent REGISTER message), while a trunk is just a practice of using SIP solutions.

Example of VoxImplant SIP registration in Mango Office




Naked theory without practice is dead, so as an example I will show how to connect phone numbers of the popular Mango Office cloud solution to VoxImplant. The first thing to do is to get SIP information about the numbers, which is available in the Employees and Groups section of the Mango Office personal account, as described in this guide .

Then this information needs to be added to the admin panel of VoxImplant (see picture above).
After performing these simple actions, calls to Mango Office phones will automatically fall into the VoxImplant cloud, where you can do anything you want with JavaScript.

An example of a SIP trunk from Asterisk to VoxImplant



A more complicated example is setting up a trunk from Asterisk to the VoxImplant cloud. From the side of our cloud, we just need to add the Asterisk IP addresses to the white list (see the picture above). But from the Asterisk side, the trunk configuration looks like this:

 [voximplant] type=friend host=testapp.testuser.voximplant.com secret=asterisk-pass-for-vox fromdomain=testapp.testuser.voximplant.com fromuser=asterisk remotesecret=vox-pass-for-asterisk 


What's the difference?



Considering the possibility of number substitution, from the point of view of the client, SIP registration is no different from a trunk. However, telecom employees are not always ready to configure a trunk, and for many cloud PBXs this is not technically foreseen in principle. At the same time, SIP registration allows integration with any SIP-compatible service, be it a major provider of telecommunications services, an Asterisk installation, or a private cloud service.

As part of our blog, I try not only to advertise VoxImplant, but also to tell useful and interesting things about cloud telephony. If your keen eye has spotted a blatant mess or a controversial inaccuracy in the stated material, do not hesitate to write to me in a personal. Everything is promptly corrected and benefits those who come to Habr from the search. And yes, with the past day, the sysadmin of all :).

Source: https://habr.com/ru/post/264275/


All Articles