Go What is a WebRTC Gateway anyway? (Lorenzo Miniero)

Source: Internet
Author: User
Tags dtls

Go What is a WebRTC Gateway anyway? (Lorenzo Miniero)

https://webrtchacks.com/webrtc-gw/

as I mentioned in my ' WebRTC meets Telecom ' article a couple of weeks ago, at Quobis we ' re currently involved In 30+ WebRTC field trials/pocs which involve in one or another a telco networ K. In the most cases service providers is trying to provide webrtc-based access to their existing/legacy infrastructure and s Ervices (Fortunately, in some cases it's not limited to does only).  to achieve all this, one of the pieces they NE Ed to deploy is a WebRTC Gateway. But, what's a WebRTC Gateway anyway? A year ago I had the chance to provide a first answer during the Kamailio world conference 2013 (see my presentation WebRTC and voip:bridging the gap) but, since Lorenzo Miniero have recently Released an open source, modular and Gener Al Purpose WebRTC Gateway called Janus, I thought it would be great to get him to share he experience here.

I ' ve known Lorenzo for some years now. He Is the co-founder of a small but great startup called Meetecho. Meetecho is an academic spinoff of the University of Napoli Federico II, where Lorenzo is currently also a Ph.D student. He has been involved in real-time multimedia applications over the Internet for years, especially from a standardisation p Oint of view. Within the IETF, in particular, he especially worked in XCON on centralized conferencing and Mediactrl on the interactions Between application Servers and Media Servers. He is currently working on webrtc-related applications, in particular on conferencing and large scale streaming as part of His Ph.D, focusing in the interaction with legacy Infrastructures-here It's where WebRTC gateways play an interesting Role. As part of the Meetecho team he also provides remote participation services in a regular basis to all IETF meetings. Most recently, he also spent some time reviewing Simon P. and Salvatore ' s l. new WebRTC boOk.

{"intro-by": "Victor"}

Lorenzo Miniero

What is a WebRTC Gateway anyway? (by Lorenzo Miniero)

Since day One, WebRTC have been seen as a great opportunity by both different worlds:those who envisaged the chance to Crea TE innovative and new applications based on a new paradigm, and those who basically just envisioned a new client to legacy Services and applications. Whether belong to the former or the latter (or anywhere in between, as me), good chances is that, sooner or later, yo U eventually faced the need for some kind of component to be placed between-or more WebRTC peers, thus going beyond (O R simply breaking) the end-to-end approach WebRTC is based upon. I, for one, did, and has devoted my webrtc-related efforts in that direction since WebRTC first saw the light.

A different Kind of peer

As you probably already know (and if you don ' t, head here and do your homework!), WebRTC have been conceived as a peer-to-p EER Solution:that is, while signalling goes through a web server/application, the media flow is peer-to-peer.

Figure 1:WEBRTC Native Peer-to-peer communication

I won ' t go into the details of what this paradigm could change, especially considering this have been the subject of A&NBSP ;p Revious blog Post. What's important to point out are, even in a simple peer-to-peer scenario, one of the involved parties (or maybe E Ven both) doesn ' t need to is a browser, but could very well is an application. The reasons for have such an application is several:it May is acting as an MCU, a media recorder, an IVR applicatio n, a  Bridge  towards a more or less different technology (e.g., SIP, RTMP, or any legacy streaming PLATF ORM) or something else. Such an application, which should implement most, if not all, the WebRTC protocols and technologies, are what are usually CAs lled a  WebRTC Gateway : One side talks WebRTC, while the other still WebRTC or something entirely dif Ferent (e.g., translating signalling protocols and/or transcoding media packets).

Figure 2:one of the peers as a logically decomposed WebRTC Gateway (SIP example)

Gateways? Why??

As anticipated, there is several reasons what a gateway can be useful. Technically speaking, MCUs and server-side stacks can be seen as gateways as well, which means that, even when you don ' t s Tep outside the WebRTC world and just want to extend the One-to-one/full-mesh paradigm among peers, have such a componen T can definitely help according to the scenario you want to achieve.

Nevertheless, the main motivation comes from the tons of existing and so called  Legacy  infrastructur Es out there, which may benefit from a webrtc-enabled kind of access. In fact, one would assume that the re-use of existing protocols like SDP, RTP and others in WebRTC would make this trivial . Unfortunately, the most of the times that's isn't the case. In fact, if for instance we refer to existing SIP infrastructures, even by making use of SIP as a signalling protocol in W EBRTC There is too many differences between the standards WebRTC endpoints implement and those available in the currently Widely available deployments.

Just to make a simple example, the most legacy the components of don ' t support media encryption, and when they does they usually only s Upport sdes. On the other end, for security REASONS WEBRTC mandates the use Of dtls as the only-to establish a Secure media connection, a mechanism that have been around for a while if that have seen little or no deployment in the Exi Sting communication frameworks so far. The same incompatibilities between the worlds emerge in other aspects as well, like the extensive use WebRTC endpoints Make Of ice for NAT traversal, rtcp feedback messages for managing the status of a connection or&nbsp ; Rtp/rtcp muxing, whereas existing infrastructures usually rely on simpler approaches like Hosted Nat traversal (HNT) in SB Cs, separate even/odd ports for RTP and RTCP, and more or less basic RFC3550 RTCP statistics and messages. Things get even wilder when we think of the additional stuff, mandatory or not, that's being added toWebRTC right now, As bundle, trickle ICE, new codecs the existing media servers would most likely not support and So on, not to Mention data Channels and websockets and the the-they could be used in a WebRTC environ ment to transport protocols like BFCP or MSRP, which SBCs or other legacy components would usually expect on TCP and/or UDP and negotiated the Old fashionedThe.

Ok, we need a gateway ... what's now?

Luckily for us all!, several people has worked on gateways since the first WebRTC browsers has been made a vailable. Even just to focus on open source efforts alone, a lot of work have been done on platforms like Asterisk or Kamailio to mak  E The interaction with existing SIP infrastructures easier, and new components like Doubango, Kurento, Licode or the Jitsi The stack has been released in the latest months. Each application usually addresses different requirements, depending on whether you just need a WEBRTC-TO-SIP gateway, a C Onferencing MCU, a webrtc-compliant streaming server, a more generic Stack/media server and so on.

Since I ' ve recently worked on an open source WebRTC gateway implementation called Janus myself, and considering it more C0>general purpose approach to gatewaying, I'll try and guide you through the common requirements and challenges such A Webrtc-driven project can face your with.

Where to start?

When it was comes to gateways, the harder step was always the first one. Where should you start? The easiest-on-the-starting from addressing the functional requirements, which usually is:

    • Architectural , as in "Should the gateway is monolithic, or somehow decomposed between signallin G and media plane "?;
    • Protocols , as you'll need to being able to  talk  webrtc and probably something else to O, if you ' re going to translate to a more or less different technology;
    • Media Management , depending on whether your ' re only going to relay media around or handle it directly (e.g., transcoding, mixing, recording, etc);
    • signalling , that's how you ' re going to setup and manage media sessions on either side;
    • putting this all together , as, especially in WebRTC, all current implementations has expectations on How the involved technologies should behave, and could not work if they ' re failed.

The first point in particular is quite important, as it would obviously impact the the gateway is subsequently going To is designed and implemented. In fact, while a monolithic approach (where signalling and media planes is handled together) might is easier to design, a Decomposed Gateway (with signalling and media planes handled separately, and the both interacting somehow) would allow for A separate management of scalability concerns. There is a middle ground, if for instance one relies on a more hybrid modular architecture. That is said, all of them has pros and cons, and if properly designed each of the them can be scaled as needed.

Apart from this, at least from a superficial point of view there's nothing in the requirements so is quite different fro M a webrtc-compliant endpoint in general. Of course, there was differences to take into Account:for one, a gateway was most likely going to handle many more session S-a single endpoint; Besides, no media needs to being played locally, which makes things easier on one side, but presents different complications When it comes to what must happen to the media themselves. The following paragraphs try to go a bit deeper in the genesis of a gateway.

Protocols

The first thing you need to ask when choosing or implementing a WebRTC implementation Is:can I avoid re-inventing the whe El? This was a very common question we ask ourselves everyday in several different contexts. Yet, it's even more important when talking about WebRTC, as it does partly re-use existing technologies and protocols, Ev En if "on steroids" as I explained before.

The answer luckily is, at least in, " mostly ". Course, just take the Chrome stack and start it all from there. As I anticipated, a gateway is, after all, a compliant WebRTC implementation, and so a complete codebase like that can def initely Help. For several different reasons, I chose a different approach, that's trying to write something new from scratch. Whatever the programming language, there is several open source libraries you can re-use for the purpose, like OpenSSL (C /c++) or Bouncycastle (Java) for DTLS-SRTP, Libnice (c + +), Pjnath (c + +) or ice4j (Java) for everything related to ice/ Stun/turn, LIBSRTP for SRTP and so on. Of course, a stack is only half of the solution:you ' ll need to prepare yourself for every situation, e.g., acting as Eith Er a DTLS server or client, handle heterogeneous NAT traversal scenarios, and basically be able to interact with all compl Iant implementations according to the WebRTC specs.

As imagine (especially if you read tim ' s rant), things does get a bit harder when it comes to sdp:while there Is libraries that allow you to parse, manipulate and generate SDP, the several attributes and features that is needed fo R WebRTC is quite likely not supported and if not is working on the library a lot. For instance, for Janus I personally chose a relatively lightweight approach:i used SOFIA-SDP as a stack for parsing sess Ion descriptions, while manually generating them instead of relying in a library for the purpose. Considering the mangling we already all does in JavaScript, until a webrtc-specific SDP library comes out it looked like the Safest course of action. What's important to point out was that, since the gateway was going to terminate the media connections somehow, the session Descriptions must be prepared correctly, and in a-a-all compliant implementations must is able to process:which me Ans, be prepared to handle whatever, as your GATeway'll need to understand it!

Media

Once you deal with the protocols, your ' re left with the media, and again, there is tons of rtp/rtcp libraries you can re-u SE for the purpose. Once you ' re at the media level, you can do, want:you may want to record the frames a peer is sending, reflect the M around for a webinar/conference, transcode them and send them somewhere else, translate RTP and the transported media to And from a different protocol/format, the receive some from the external source and send them to a WebRTC endpoint, and so on.

Figure 3:bridging to different technologies

RTCP in particular, though, needs special care, especially if you ' re bridging WebRTC peers through the gateway:in fact, R TCP messages is tightly coupled with the RTP session they ' re related to, which means we have to translate the messages G Oing back and forth if you want them to keep their meaning. Considering a gateway is a webrtc-compliant endpoint, you may also want to take care of the RTCP messages yourself:e.g., Retransmit RTP Packets When you get a NACK, adapting the bandwidth on reception of a remb, or keep the WebRTC peer up-to-d Ate on the status of the connection by sending proper feedback. Some more details was available in Draft-ietf-straw-b2bua-rtcp which was currently under discussion in the IETF.

Signalling

Last, but not least:what kind of signalling should your gateway employ? WebRTC doesn ' t mandate any, which means your ' re free to choose the one, fits your requirements. Several implementations rely on SIP, which looks as the natural choice when bridging to existing SIP infrastructures. Others make use of alternative protocols like Xmpp/jingle.

That said, there are not a perfect candidate, as it mostly depends on what are want your gateway to does and what's your ' re most Comfortable with on the first place. If you want it to is as generic as possible, as I did, an alternative approach could be relying on an AD-HOC protocol, e.g., Based on JSON or XML, which leaves you the greatest freedom when it comes to design a bridge to other technologies.

Long Story short ...

As you might has guessed, writing a gateway is isn't easy. You need to implement all the protocols, and use them in a, the allows you to seamlessly interact with all compliant IM Plementations, maybe even fixing what may cause them isn't to interact with all other as they is, while at the same time t Aking into account the requirements on THE  Legacy  side. You need to tame the SDP beast, being careful of RTCP, and take care of any possible issue so may arise when bridging WEBRT C to a different technology. Besides, as you know WebRTC are a moving target, and so any works today in the gateways world may not work Tomorrow:which means that keeping updated is of paramount importance.

Anyway, this doesn ' t need to scare. Several good implementations is already available the address different scenarios, so if all of you need be an MCU or a-a- To simply talk to well known legacy technologies, good chances is that one or more of the existing platforms can do it f Or you. Some implementations, like Janus itself, is even conceived as more or less extensible, which means this, in case no Gatew Ay currently supports what are need, you probably don ' t need to write a new one from scratch anyway. And besides, as time goes by the so-called legacy implementations would hopefully start aligning with the stuff We BRTC is mandating right now, so this gateways won ' t be needed anymore for bridging technologies Complex WebRTC scenarios.

That's said, make sure-Follow the server-oriented stack topic on DISCUSS-WEBRTC for more information!

{"Author": "Lorenzo Miniero"}

Want to keep up in our latest posts? Please click here for subscribe to our mailing list if you had not already. We only email post updates. You can also follow us on Twitter in @webrtcHacks for blogs updates and news of technical WebRTC topics or our individual F Eeds @chadwallacehart, @victorpascual and @tsahil.

Go What is a WebRTC Gateway anyway? (Lorenzo Miniero)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.