📜 ⬆️ ⬇️

The principle of the SIP client in the browser

After talking in the comments to the post , I realized that not everyone fully understands the principle of SIP in the browser. Therefore, I decided impromptu to write a small article, where in general to reveal this topic.




Characters:
')

HTTP server


Nothing special is required from it, only support for the HTTP protocol.

SIP server


In addition to the usual SIP protocols - UDP, TCP, TLS, support for WebSocket is required. WebSocket is a very simple protocol, it works as follows:

Some SIP message headers contain information about the transport layer protocol, for example:

Via: SIP/2.0/UDP 192.168.1.1;branch=z9hG4bKyQz1234567

And since WebSocket is not described in the main SIP document, an extension was required, this is not yet a standard, but it can already be used. This document does not contain any fundamental changes to rfc3261, for the most part it simply resolves obvious things, such as the following heading:

Via: SIP/2.0/ WS df7jal23ls0d.invalid ;branch=z9hG4bKyQz1234567

Browser


It is more complicated here, a whole bunch of technologies are required: WebSocket to connect to the SIP server; SIP stack, which can be implemented in JavaScript; WebRTC to transfer audio and video.

How does it work


It is probably already clear, the beauty of the whole scheme is that no protocol matching agents are required. The client in the browser is a full participant and interacts directly with any SIP server, and any clients, for example, with a hardware IP phone. The only requirement is support for WebRTC codecs.

How to test


Information about whether Asterisk can communicate via WebSocket could not be found. But there are other SIP servers with WebSocket support, of course they are inferior in functionality, but enough to test it. For example, a server for Windows starting from version 3.2 supports WebSocket and even has a built-in HTTP server.

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


All Articles