Slide 1

Slide 1 text

Implementa)on  Lessons  using   WebRTC  in  Asterisk   Astricon,  October  2013   Moisés  Silva     Manager,  So?ware  Engineering    

Slide 2

Slide 2 text

Agenda   •  WebRTC  Intro   •  WebRTC  Asterisk  Architecture   •  Install  &  Config   •  TroubleshooLng   2   Sangoma  Technologies  -­‐  ©  2013  

Slide 3

Slide 3 text

WebRTC  Intro   •  It  is  not  a  phone  in  the  browser!     3   Sangoma  Technologies  -­‐  ©  2013  

Slide 4

Slide 4 text

WebRTC  Intro   •  It  is  a  full  RTC  engine  in  the  browser!     4   Sangoma  Technologies  -­‐  ©  2013  

Slide 5

Slide 5 text

WebRTC  Intro   •  Yes,  it  can  be  used  for  a  phone  in  the  browser  J     5   Sangoma  Technologies  -­‐  ©  2013  

Slide 6

Slide 6 text

WebRTC  Intro   •  Full  media  engine  API  in  the  web  browser   •  No  “call”  or  “session”  signaling  defined   •  Generic  data  interchange  between  browsers,   peer  to  peer   •  State  of  the  art  NAT  traversal  techniques     6   Sangoma  Technologies  -­‐  ©  2013  

Slide 7

Slide 7 text

WebRTC  Intro   •  WebRTC  comes  with  mulLple  APIs,  ie:     •  Peer-­‐to-­‐Peer  ConnecLons  (RTCPeerConnecLon)   •  Peer-­‐to-­‐Peer  Data  API  (RTCDataChannel)     •  StaLsLcs  (RTCStats)   •  Media  Stream  (getUserMedia)     7   Sangoma  Technologies  -­‐  ©  2013  

Slide 8

Slide 8 text

WebRTC  Intro   •  WebRTC  uses  established  protocols:     •  SRTP/SRTCP  for  media  exchange  (secure  RTP)   •  SDP  (its  use  is  controversial  and  currently  challenged)   •  ICE,  STUN,  TURN  for  NAT  Traversal     •  DTLS  for  key  exchange   •  G.711,  Opus,  VP8/H.264  etc;  for  voice  and  video     8   Sangoma  Technologies  -­‐  ©  2013  

Slide 9

Slide 9 text

WebRTC  Intro   •  What  signaling  to  use  is  up  to  you:     •  SIP   •  XMPP/Jingle   •  RESTful  API  (json)   •  OpenPeer  ….   9   Sangoma  Technologies  -­‐  ©  2013  

Slide 10

Slide 10 text

WebRTC  Intro   •  ApplicaLons     •  A  phone,  video  calls,  conferencing  etc!   •  Video  games   •  P2P  Video  Streaming  (Chromecast)   •  MoLon-­‐detecLng  Baby  Monitor  ( hops://github.com/webrtcHacks/ webrtc_baby_monitor)       10   Sangoma  Technologies  -­‐  ©  2013  

Slide 11

Slide 11 text

WebRTC  Intro   •  WebRTC  Web  Triangle     11   Sangoma  Technologies  -­‐  ©  2013   Alice’s  Browser   Bob’s  Browser   Encrypted  Media   Web   Signaling   Signaling  

Slide 12

Slide 12 text

WebRTC  in  Asterisk       12   Sangoma  Technologies  -­‐  ©  2013   Alice’s  Browser   Bob’s  Browser   Encrypted  Media   SIP  over  WS   SIP  over  WS   Encrypted  Media  

Slide 13

Slide 13 text

WebRTC  in  Asterisk   •  WebRTC  Gateway     13   Sangoma  Technologies  -­‐  ©  2013   Alice’s  Browser   SIP/RTP,  Jingle,  FXO/FXS,     PRI,  SS7  etc  …   Encrypted  Media   SIP  over  WS  

Slide 14

Slide 14 text

WebRTC  in  Asterisk       14   Sangoma  Technologies  -­‐  ©  2013   Javascript  SIP   WebRTC   chan_sip   res_hop_websocket   res_rtp_asterisk   res_srtp  

Slide 15

Slide 15 text

WebRTC  in  Asterisk       15   Sangoma  Technologies  -­‐  ©  2013   sipml5   Chrome  30     Asterisk  11  

Slide 16

Slide 16 text

Installing  WebRTC  Support   •  Make  sure  you  have:   •  libuuid-­‐devel  (required  by  res_rtp_asterisk)   •  OpenSSL  w/  DTLS  support  (1.0.1e  has   SSL_CTX_set_tlsext_use_srtp)   •  libsrtp-­‐devel   16   Sangoma  Technologies  -­‐  ©  2013  

Slide 17

Slide 17 text

Installing  WebRTC  Support   •  Easy  usual  steps  …   •  ./configure   •  make  menuselect:   •  res_hop_websocket   •  res_rtp_asterisk   •  make  install   17   Sangoma  Technologies  -­‐  ©  2013  

Slide 18

Slide 18 text

Configuring  WebRTC  Support   •  Enable  the  websockets  server  (hop.conf)   •  enabled=yes   •  bindaddr=0.0.0.0   •  bindport=8088     18   Sangoma  Technologies  -­‐  ©  2013  

Slide 19

Slide 19 text

Configuring  WebRTC  Support   •  Good  idea  to  use  secure  websockets  (hop.conf)   •  tlsenable=yes   •  tlsbindaddr=0.0.0.0:8089   •  tlsceruile=localhost.crt   •  tlsprivatekey=localhost.key     19   Sangoma  Technologies  -­‐  ©  2013  

Slide 20

Slide 20 text

Configuring  WebRTC  Support   •  But  …  Asterisk  currently  seems  to  have  issues   with  secure  WebSockets,  patches  available  to  fix   them   •  hops://issues.asterisk.org/jira/browse/ ASTERISK-­‐21930   •  hop://svnview.digium.com/svn/asterisk/team/moy/ webrtc-­‐11/       20   Sangoma  Technologies  -­‐  ©  2013  

Slide 21

Slide 21 text

Configuring  WebRTC  Support   •  Verify  the  HTTP  server  status     21   Sangoma  Technologies  -­‐  ©  2013  

Slide 22

Slide 22 text

Configuring  WebRTC  Support   •  Test  websockets  connecLvity   •  npm  install  –g  ws   •  wscat  –s  echo  –c  ws://:/ws     wscat  –s  echo  –c  wss://:/ws   22   Sangoma  Technologies  -­‐  ©  2013  

Slide 23

Slide 23 text

Configuring  WebRTC  Support   •  Test  websockets  connecLvity   23   Sangoma  Technologies  -­‐  ©  2013  

Slide 24

Slide 24 text

Configuring  WebRTC  Support   24   Sangoma  Technologies  -­‐  ©  2013  

Slide 25

Slide 25 text

Configuring  WebRTC  Support   •  Enable  SIP  over  websockets  (sip.conf)   •  transport=ws,wss   •  Make  sure  you  use  the  /ws  URL  when  connecLng   from  JavaScript   •  Create  a  SIP  account  to  receive  ws/wss  calls     25   Sangoma  Technologies  -­‐  ©  2013  

Slide 26

Slide 26 text

Configuring  WebRTC  Support   •  TesLng  using  sipml5.org/call.htm     26   Sangoma  Technologies  -­‐  ©  2013  

Slide 27

Slide 27 text

Configuring  WebRTC  Support   27   Sangoma  Technologies  -­‐  ©  2013  

Slide 28

Slide 28 text

Troubleshoo)ng   •  TroubleshooLng  Toolkit   •  javascript  console   •  chrome://webrtc-­‐internals   •  Node  ws  (test  websockets)   •  Wireshark!   28   Sangoma  Technologies  -­‐  ©  2013  

Slide 29

Slide 29 text

Troubleshoo)ng   •  The  javascript  console  is  your  friend     29   Sangoma  Technologies  -­‐  ©  2013  

Slide 30

Slide 30 text

Troubleshoo)ng   •  Checking  out  chrome://webrtc-­‐internals     30   Sangoma  Technologies  -­‐  ©  2013  

Slide 31

Slide 31 text

Troubleshoo)ng   •  Checking  out  chrome://webrtc-­‐internals     31   Sangoma  Technologies  -­‐  ©  2013  

Slide 32

Slide 32 text

Troubleshoo)ng   •  Note  that  Wireshark  VoIP  calls  menu  won’t  work   for  calls  over  websockets   •  You  can  however  use  “Follow  TCP  stream”  and   see  the  enLre  SIP  signaling  flow   •  RTP  decoding  will  not  work  either  (rtcp-­‐mux)   32   Sangoma  Technologies  -­‐  ©  2013  

Slide 33

Slide 33 text

Troubleshoo)ng   •  TLS  decrypLon  can  be  achieved  by  installing  the   private  key  on  Wireshark   •  Preferences  -­‐>  Protocols  -­‐>  SSL  -­‐>  RSA  Key  List   33   Sangoma  Technologies  -­‐  ©  2013  

Slide 34

Slide 34 text

Troubleshoo)ng   •  Wireshark  decrypted  secure  WebSocket  payload   34   Sangoma  Technologies  -­‐  ©  2013  

Slide 35

Slide 35 text

Things  to  test  in  the  near  Future   •  Trickle  Ice   •  Use  of  other  codecs  (ie  Opus,  iSAC)   •  Video  (VP8)   •  Use  libwebsockets  in  res_hop_websocket?   35   Sangoma  Technologies  -­‐  ©  2013  

Slide 36

Slide 36 text

Conclusion   •  Asterisk  +  WebRTC  gateway  is  easy  to  setup!   •  Know  your  debugging  tools   •  Understand  the  protocols  involved   •  Have  fun  and  hack  away!   36   Sangoma  Technologies  -­‐  ©  2013  

Slide 37

Slide 37 text

QUESTIONS  

Slide 38

Slide 38 text

Contact  Us   •  Sangoma  Technologies   100  Renfrew  Drive,  Suite  100   Markham,  Ontario  L3R  9R6   Canada   •  Website   hop://www.sangoma.com/   •  Telephone   +1  905  474  1990  x2  (for  Sales)   •  Email   [email protected]   Sangoma  Technologies  -­‐  ©  2013   38  

Slide 39

Slide 39 text

THANK  YOU