Reference11r1:Concept myPBX WebRTC Softwarephone

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

The myPBX web application in version 11 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.

Requirements

PBX

  • Recent firmware (version 11 or higher)
  • myPBX license (enabled at the user object)

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

Computer

  • Browser supporting WebRTC (currently Firefox, Chrome and Opera)
  • Microphone or headset

Remote endpoint

  • The remote endpoint has to support ICE and DTLS-SRTP. All innovaphone devices support it from version 11.

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.

Audio Configuration

  • The audio 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.

Note: In the myPBX launcher the functionality is currently not available.

Activation

Select the corresponding device in myPBX. The browser asks for permission to access the microphone of the computer. Please select the audio device you want to use for telephony and accept.

Calling

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

Known issues

  • The WebRTC softwarephone is currently not available in the myPBX launcher because the underlying Internet Explorer does currently not support WebRTC.
  • The WebRTC softwarephone can't be used on PBXes that have "RTP Proxy" enabled.
  • Three party conferences are not implemented, yet.
  • Firefox does not support DTMF. In Chrome DTMF works.

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).


Webrtc softwarephone console.png

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