Reference12r2:Concept myPBX WebRTC Softwarephone

From innovaphone wiki
Jump to navigation Jump to search
There are also other versions of this article available: Reference11r1 | Reference12r1 | Reference12r2 (this version)

The myPBX web application comes with an integrated WebRTC software phone that can be used in browsers that support WebRTC.

How it works

  • The web application has an integrated WebRTC endpoint that can be controlled like a regular phone using myPBX.
  • The endpoint connects to the PBX using Websocket. The PBX creates a signaling instance and a registration that controlls the endpoint.
  • Video telephony is supported.
  • Application sharing is supported (viewing only).

Features

For a feature overview refer to myPBX derivates and features.

Requirements

  • myPBX needs to be opened using HTTPS.

Licenses

  • myPBX license
  • Video license (for video telephony)
  • Application Sharing license (for viewing shared applications)
  • WebRTC channel license (per call leg of WebRTC endpoint)
Note: The WebRTC channel license must be activated on the PBX by configuring "Max WebRTC calls".
Example1: Call between 2 WebRTC Clients (Browsers) consume 2 WebRTC Channels. 
Example2: Call between 1 WebRTC Client (Browser) and IP Phone consume 1 WebRTC Channel.
Note2: webRTC channel licenses are obsolete starting with release V12r1sr28, V12r2sr23, V13r1 and up.

PBX

  • Recent firmware
  • WebRTC device enabled at the user object
  • Valid STUN/TURN configuration

Note: The WebRTC softwarephone can't be used on PBXes that have "RTP Proxy" enabled.

Computer

Remote endpoint

  • The remote endpoint has to support ICE, RTCP-MUX and DTLS-SRTP. (All innovaphone products from v12r2 upwards support it)

Configuration

PBX

  • Create a device at the user object. Make sure both hardware ID and name are given. Check "Config VOIP" and press "Apply".
  • The "Edit User" Dialog now shows a new tab with the name of the device. In that tab select "WebRTC" as the method for the Outgoing Registration.
  • If you now open myPBX in a suitable web browser the WebRTC phone appears as a normal phone.
  • Enable video and application sharing licenses at the user object (optional).

Media Configuration

  • The audio and video configuration is part of your browser and your operating system. We do not support it.
  • For testing the audio device please use this WebRTC test page. Open the page and follow the instructions. If you hear yourself or some nasty feedback sounds, the audio is working.
  • Only contact the innovaphone support if the audio is working on the test page but not in the myPBX WebRTC Softwarephone.

Usage

Start the myPBX web application in a Browser that supports WebRTC.

Activation

Select the corresponding device in myPBX.

Calling

Incoming and outgoing calls can be done as usual using myPBX.

The browser will ask for permission to use the microphone and the optionally the webcam. Please select the desired devices and confirm. If you use HTTPS the browser can be told to remember your decision.

Video telephony

Video calls can be started like in the launcher. The video of the remote party is displayed right in the main window at the call. By clicking the undock button, a video window can be opened that is resizable and shows both the local and the remote image.

MyPBX webrtc video.png

Application sharing

Applications that are shared by the remote party can be displayed in a separate window. It's also possible to request control using mouse and keyboard from the browser.

MyPBX webrtc appsharing.png

Codecs

Audio codecs

PCMU (G711u) PCMA (G711a) G722 Opus
Firefox yes yes yes yes
Chrome yes yes yes yes
Edge yes yes yes yes
Safari yes yes yes yes
Opera yes yes yes yes

Video codecs

VP8 VP9 H.264
myPBX launcher (native video) yes yes yes
myPBX launcher (WebRTC) yes yes no
PBX Conference Object no no yes
Firefox yes yes yes
Chrome yes yes yes
Edge yes no yes
Safari no no yes
Opera yes yes yes

Restrictions

  • Doesn't work on PBXes that have "RTP Proxy" enabled.
  • Three party conferences are not implemented.
  • Application sharing is viewing and controlling only(no sharing possible).
  • Video conferencing doesn't work with WebRTC in the myPBX launcher, because the used Chromium browser does not support H.264.
  • Headset physical buttons and its functions such as "onhook/offhook" will not be supported by the browser.

Tracing

Web application trace

The web console of the browser shows the trace of the web application. It contains the same information as the trace file of the myPBX launcher, but only the lines from the web application.

  • In Firefox the console is opened using CTRL-SHIFT-K.
  • In Chrome the console is opened using F12.
  • In Opera the console is part of the web inspector that can be found in the menu (Page > Developer Tools > Web Inspector).

Example: Outgoing call in Chrome

When the call is initiated the endpoint receives a SigChannels message with cmd=OfferRequest. The message also contains the STUN server that should be used.

 WebRTC: Endpoint: recv SigChannels ch=2, cmd=OfferRequest sdp=undefined iceServers=[{"urls":["stun:145.253.157.4"],"url":"stun:145.253.157.4"}]

The endpoint starts gathering ICE candidates.

 WebRTC: Endpoint: Channel(2): state=CREATE_OFFER
 WebRTC: Endpoint: Channel(2): create offer
 WebRTC: Endpoint: Channel(2): negotiation needed
 WebRTC: Endpoint: Channel(2): preliminary offer complete, start gathering candidates
 WebRTC: Endpoint: Channel(2): signaling state: have-local-offer
 WebRTC: Endpoint: Channel(2): local description set
 WebRTC: Endpoint: Channel(2): candidate: candidate:744822055 1 udp 2122260223 172.16.10.24 52469 typ host generation 0
 WebRTC: Endpoint: Channel(2): candidate: candidate:744822055 2 udp 2122260223 172.16.10.24 52469 typ host generation 0
 WebRTC: Endpoint: Channel(2): candidate: candidate:3665128691 1 udp 1686052607 145.253.157.4 50115 typ srflx raddr 172.16.10.24 rport 52469 generation 0
 WebRTC: Endpoint: Channel(2): candidate: candidate:3665128691 2 udp 1686052607 145.253.157.4 50115 typ srflx raddr 172.16.10.24 rport 52469 generation 0
 WebRTC: Endpoint: Channel(2): candidate: candidate:1659300311 1 tcp 1518280447 172.16.10.24 0 typ host tcptype active generation 0
 WebRTC: Endpoint: Channel(2): candidate: candidate:1659300311 2 tcp 1518280447 172.16.10.24 0 typ host tcptype active generation 0
 WebRTC: Endpoint: Channel(2): gathering candidates complete, create complete offer
 WebRTC: Endpoint: Channel(2): state=WAIT_ANSWER

Once the candidates are complete it generates an offer and sends it to the PBX using a SigChannels message with cmd=Offer.

 WebRTC: Endpoint: send SigChannels ch=2, cmd=Offer sdp=
 v=0
 o=- 8260445192877574991 2 IN IP4 127.0.0.1
 s=-
 t=0 0
 a=group:BUNDLE audio
 a=msid-semantic: WMS CJQPlxOl3Q7nDGzYd9rGqFnNmFHrS6toANy8
 m=audio 50115 RTP/SAVPF 111 103 104 9 0 8 106 105 13 126
 c=IN IP4 145.253.157.4
 a=rtcp:50115 IN IP4 145.253.157.4
 a=candidate:744822055 1 udp 2122260223 172.16.10.24 52469 typ host generation 0
 a=candidate:744822055 2 udp 2122260223 172.16.10.24 52469 typ host generation 0
 a=candidate:3665128691 1 udp 1686052607 145.253.157.4 50115 typ srflx raddr 172.16.10.24 rport 52469 generation 0
 a=candidate:3665128691 2 udp 1686052607 145.253.157.4 50115 typ srflx raddr 172.16.10.24 rport 52469 generation 0
 a=candidate:1659300311 1 tcp 1518280447 172.16.10.24 0 typ host tcptype active generation 0
 a=candidate:1659300311 2 tcp 1518280447 172.16.10.24 0 typ host tcptype active generation 0
 a=ice-ufrag:+240c/XZk+srJbqL
 a=ice-pwd:bwqqrJGGVv4nBXGuzZCy7dDE
 a=ice-options:google-ice
 a=fingerprint:sha-256 E0:41:08:D8:89:49:68:7A:5F:94:B6:B2:41:3C:23:F6:B6:7A:97:63:4C:F4:91:61:B0:A9:EE:6C:80:B2:51:75
 a=setup:actpass
 a=mid:audio
 a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
 a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
 a=sendrecv
 a=rtcp-mux
 a=rtpmap:111 opus/48000/2
 a=fmtp:111 minptime=10
 a=rtpmap:103 ISAC/16000
 a=rtpmap:104 ISAC/32000
 a=rtpmap:9 G722/8000
 a=rtpmap:0 PCMU/8000
 a=rtpmap:8 PCMA/8000
 a=rtpmap:106 CN/32000
 a=rtpmap:105 CN/16000
 a=rtpmap:13 CN/8000
 a=rtpmap:126 telephone-event/8000
 a=maxptime:60
 a=ssrc:4291706045 cname:q9rl/+NUMLj1qx2P
 a=ssrc:4291706045 msid:CJQPlxOl3Q7nDGzYd9rGqFnNmFHrS6toANy8 1b645655-19fb-49f3-8cbf-75f8cc073621
 a=ssrc:4291706045 mslabel:CJQPlxOl3Q7nDGzYd9rGqFnNmFHrS6toANy8
 a=ssrc:4291706045 label:1b645655-19fb-49f3-8cbf-75f8cc073621

The PBX is starting the call. The WebRTC endpoints is told to play the ringback tone.

 WebRTC: Endpoint: recv SigToneOn ch=2, tone=0, time=[1000,3000,0,0,0,0,0,0]
 WebRTC: Endpoint: Channel(2): ToneGenerator: Tone on {"tone":0,"time":[1000,3000,0,0,0,0,0,0]}

When the call is connected the endpoint receives a SigChannelsMessage with cmd=Answer. It contains the remote SDP.

 WebRTC: Endpoint: recv SigChannels ch=2, cmd=Answer sdp=v=0
 o=- 0 0 IN IP4 0.0.0.0
 s=-
 t=0 0
 m=audio 16388 RTP/SAVPF 9 126
 c=IN IP4 172.16.13.44
 a=rtpmap:126 telephone-event/8000
 a=fmtp:126 0-15
 a=ptime:20
 a=silenceSupp:off - - - -
 a=sendrecv
 a=ice-ufrag:ixLq
 a=ice-pwd:9BmEXFZ2MJAyBNceqRQ6eW
 a=fingerprint:sha-256 44:7A:F6:C5:CF:E3:B6:6C:F0:90:1D:91:43:F6:82:4D:4C:5D:0B:A2:EE:8B:D9:D0:ED:9B:9F:69:68:02:77:D0
 a=candidate:1 1 UDP 2130569471 172.16.13.44 16388 typ host
 a=candidate:1 2 UDP 2130569726 172.16.13.44 16389 typ host
 a=candidate:2 1 UDP 1694362367 145.253.157.4 50118 typ srflx raddr 172.16.13.44 rport 16388
 a=candidate:2 2 UDP 1694362622 145.253.157.4 50119 typ srflx raddr 172.16.13.44 rport 16389
 a=candidate:3 1 UDP 2121611519 fec0:9033:0:8:290:33ff:fe30:b4 16388 typ host
 a=candidate:3 2 UDP 2121611774 fec0:9033:0:8:290:33ff:fe30:b4 16389 typ host
  iceServers=[]

Now the ringback tone is turned off and ICE checks start.

 WebRTC: Endpoint: recv SigToneOff ch=2
 WebRTC: Endpoint: Channel(2): ToneGenerator: Tone off
 WebRTC: Endpoint: Channel(2): state=CONNECTED
 WebRTC: Endpoint: Channel(2): DTMF supported
 WebRTC: Endpoint: Channel(2): signaling state: stable
 WebRTC: Endpoint: Channel(2): remote stream added
 WebRTC: Endpoint: Channel(2): ice connection state: checking
 WebRTC: Endpoint: Channel(2): ice connection state: completed

Now the call is connected and the audio stream is flowing.

When the call is disconnected the endpoint receives a SigChannels message with cmd=CloseRequest. If the tone generator was playing sounds they are also stopped.

 WebRTC: Endpoint: recv SigChannels ch=2, cmd=CloseRequest sdp=undefined iceServers=[]
 WebRTC: Endpoint: Channel(2): ToneGenerator: Tone off
 WebRTC: Endpoint: Channel(2): state=IDLE
 WebRTC: Endpoint: recv SigToneOff ch=2
 WebRTC: Endpoint: Channel(2): ice connection state: -
 WebRTC: Endpoint: Channel(2): signaling state: -

Now the call is completely disconnected.

Typical problems as seen in traces

The remote party has to support ICE and DTLS-SRTP. For that the following fields have to be in the SDP:

  • SRTP profile (RTP/SAVPF)
  • ICE parameters (a=ice-ufrag, a=ice-pwd, a=candidate)
  • DTLS-SRTP fingerprint (a=fingerprint)
 o=- 0 0 IN IP4 0.0.0.0
 s=-
 t=0 0
 m=audio 16388 RTP/SAVPF 9 126
 c=IN IP4 172.16.13.44
 a=rtpmap:126 telephone-event/8000
 a=fmtp:126 0-15
 a=ptime:20
 a=silenceSupp:off - - - -
 a=sendrecv
 a=ice-ufrag:ixLq
 a=ice-pwd:9BmEXFZ2MJAyBNceqRQ6eW
 a=fingerprint:sha-256 44:7A:F6:C5:CF:E3:B6:6C:F0:90:1D:91:43:F6:82:4D:4C:5D:0B:A2:EE:8B:D9:D0:ED:9B:9F:69:68:02:77:D0
 a=candidate:1 1 UDP 2130569471 172.16.13.44 16388 typ host
 a=candidate:1 2 UDP 2130569726 172.16.13.44 16389 typ host
 a=candidate:2 1 UDP 1694362367 145.253.157.4 50118 typ srflx raddr 172.16.13.44 rport 16388
 a=candidate:2 2 UDP 1694362622 145.253.157.4 50119 typ srflx raddr 172.16.13.44 rport 16389
 a=candidate:3 1 UDP 2121611519 fec0:9033:0:8:290:33ff:fe30:b4 16388 typ host
 a=candidate:3 2 UDP 2121611774 fec0:9033:0:8:290:33ff:fe30:b4 16389 typ host

If one that parameters is missing the browser rejects the remote SDP. In Firefox it looks like this:

 WebRTC: Endpoint: Channel(2): Abort call: Could not set remote description: 
   Could not negotiate answer SDP; cause = SDP_PARSE_FAILED |
   SDP Parsing Error:  Warning: Transport protocol type unsupported (RTP/AVPF). |
   SDP Parsing Error:  Invalid port format (16392) specified for transport protocol (Unsupported), parse failed.
 WebRTC: Endpoint: send SigChannels ch=2, cmd=CloseRequest sdp=null
 WebRTC: Endpoint: Channel(2): ice connection state: closed
 WebRTC: Endpoint: Channel(2): signaling state: closed
 WebRTC: Endpoint: Channel(2): state=IDLE

In Chrome it looks like that:

 WebRTC: Endpoint: Channel(2): Abort call: Could not set remote description: 
   Failed to set remote answer sdp: Called with SDP without DTLS fingerprint.
 WebRTC: Endpoint: send SigChannels ch=2, cmd=CloseRequest sdp=null
 WebRTC: Endpoint: Channel(2): state=IDLE
 WebRTC: Endpoint: Channel(2): ice connection state: -
 WebRTC: Endpoint: Channel(2): signaling state: -

Remote endpoint

On innovaphone devices the ICE and DTLS-SRTP tracing can be useful to track down connection problems.

 !config add H323 /ice-trace on /dtls-trace on
 !config add SIP /ice-trace on /dtls-trace on
 !config add TSIP /ice-trace on /dtls-trace on
 !config add SIPS /ice-trace on /dtls-trace on

Browser Interoperability

For current browser compatibility information, see http://iswebrtcreadyyet.com/#interop.
For a quick webRTC test, see https://test.webrtc.org/

A compatible browser has "green" in lines

  • PeerConnection API
  • getUserMedia
  • dataChannels
  • TURN
  • VP8 video or H.264 video (H.264 preferred as this allows calling in to a video multi.party conference)

Please note that WebRTC support in browsers is an ever moving target. For example, Microsoft's Edge used to not support WebRTC (instead, it favoured a variant known as ORTC). myPBX detected the missing WebRTC support and used ORTC instead. However, lately we have seen that Edge now advertises support for WebRTC, so myPBX will use this interface. However, the implementation is still buggy. As a result, WebRTC currently does not work in myPBX. It will likely start working in Edge again, when Edge's WebRTC support is improved.

Related Documentation