WebRTC and Direct Media for hosted PBX topology

Is there a way to get “direct media” between 2 WebRTC endpoints ? WebRTC should normally provide end-to-end RTP to both endpoints, but this is not the case with Asterisk as it stays in the middle for the RTP streams.

The reason for my question is that end-to-end RTP is really a must for hosted environments. For an on-premise service this is less important, but for a hosted service it is mandatory to keep RTP local for local extension to extension calls. So like for SIP clients also WebRTC clients and mix of both types need direct media for a hosted PBX service.

I’m aware that some Asterisk built-in features would be lost with direct media, as is the same for direct media using chan-sip or PJSIP, but that’s not an issue compared to bandwidth saving and less latency offered via direct media. Also codec limitations are not a problem : G.711 is fine for local extension to extension traffic.

If there is a way to solve this, then I have a second question : how to get direct media between a PJSIP and a WebRTC client ? SRTP is normally a prerequisite for WebRTC and I noticed that SRTP is also restricting direct media with SIP at this moment. As a workaround SRTP could maybe avoided until a solution (e.g. ZRTP ?) is available ?

It is not possible in Asterisk to do this without major rearchitecting of things. Call legs are between an endpoint and Asterisk.

I’ve noticed the same issue when using SRTP with SIP, due to the 2-leg key negotiation. That’s why I was wondering if the “ad-hoc” key negotiation with ZRTP could be a solution.

For WebRTC I would already be happy if SRTP could be replaced by normal RTP - then Direct Media should not have an issue with the 2 leg key negotiations.

WebRTC requires the use of ICE as well, which can’t go direct in Asterisk so even if SRTP were not in use it couldn’t be done.

It’s a bit weird to me that WebRTC architecture normally does provide end-to-end RTP (see “http://webrtc-security.github.io/”) - so I think the WebRTC implementation in Asterisk has a restriction built in ?

It’s not the WebRTC implementation in Asterisk that has a limitation, it’s the fundamental way that Asterisk works. It’s designed to connect arbitrary things together - thus the “connection” is between an endpoint and Asterisk not direct. Doing it this way provides a lot of control and functionality, but as you’ve noted comes at a cost.

There is indeed a cost : some Asterisk features (like recording) are lost, but with SIP Direct Media is possible - unless SRTP is used. The way it works with SIP is via RE-INVITE or UPDATE immediately after 200 OK message. Something similar for WebRTC is needed, but the “easier” way is probably to inform the calling party about the called party’s address information and establisch end-to-end RTP from the start in stead of updating after answer.

In WebRTC you can’t inform each side of the address information since it was negotiated using ICE. You have to force one side to do a renegotiation (somehow), transport that information to the other participant, and allow it to complete. This is work that noone is pursuing currently.

There is a huge trend to virtualize and host services in the cloud in stead of on premise PBX, so I believe that Asterisk needs to follow this trend. Without end-to-end RTP the bandwidth on the WAN would be excessively high otherwise. So I hope they will consider hosting in the near future.

Asterisk evolves based on the contributions and changes done by the community, it’s up to someone to show an interest in moving Asterisk into this direction and contributing changes to do so. Personally I’ve seen this come up a handful of times, not a ton.

There is already a lot of cloud PBX services offering today - even Digium is offering PBX as a Service, but without Direct Media the additional cost for the WAN bandwidth is eating a huge part of the hosting savings, especially because QOS is required. Without QOS the service will degrade and thus become unsatisfactory. I really believe that Direct Media is a key issue for today’s cloud PBX services.

tl;dr: if you see an area of Asterisk that you think could use improvement, that could benefit your own business, the best thing you can do is pitch in, and contribute code to make that happen.

From Digium’s own perspective, which is a perspective from which @jcolp and I speak, we do contribute a great deal of the code that’s in Asterisk, and we’re focused primarily on our own business objectives. Sometimes our objectives line up with others’ objectives, and everyone benefits. But, with a nod towards a recent -users’ list posting, there are also times where our own objectives don’t line up with what some users want to do. If you wait for Digium’s objectives, or the objectives of other contributors in the Asterisk community to line up with yours, you might not get what you want, when you want it.

1 Like