Showing posts with label webrtc. Show all posts
Showing posts with label webrtc. Show all posts

Tuesday, 29 September 2015

WebRTC Video Resolutions

Resolution is the number of pixels in an image.
In general terms, the higher the resolution, the better the image quality.
The following terms are used for different video resolution values that are common in video calling for WebRTC:
  • QVGA – 320×240
  • VGA – 640×480
  • 720p (or HD 720) – 1280×720
  • 1080p (or HD 1080) – 1920×1080
  • 4K – 4096×2160
WebRTC isn’t limited in the resolution it can support. The limit is caused by browser implementations, processor capabilities and network conditions, as the higher the resolution, the more computation and bandwidth it requires.
Most WebRTC implementations to date have been able to reach 720p resolutions, with 1080p starting to be introduced.

Saturday, 11 April 2015

Build and Install Doubango webrtc2sip on ubuntu

In an effort to verify webRTC driven new service operations, Doubango webrtc2sip codes are compiled and installed from source. Following the procedures provided by the Doubango guide here, the following procedures are verified with additional minor corrections during the build and installation process on Ubuntu 12.10.
  1. Download the webrtc2sip source codes
  2. Download Doubango IMS Framework v2.0:
    svn checkout http://doubango.googlecode.com/svn/ doubango-source
  3. Install all necessary packages such as “make, libtool, autoconf, subversion, git, cvs, wget, libogg-dev” etc.
  4. get and install “libsrtp”:
    git clone https://github.com/cisco/libsrtp/
    cd libsrtp
    CFLAGS=”-fPIC” ./configure –enable-pic && make && make install
  5. check OpenSSL version and make sure version 1.0c is installed: openssl version
  6. install libspeex-dev and libspeexdsp-dev
  7. build and install YASM (for VP8 video codec)
    wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
    tar -xvzf yasm-1.2.0.tar.gz
    cd yasm-1.2.0
    ./configure && make && make install
  8. install libvpx and libvpx-dev (for VP8 video codec support)
  9. build and install libyuv
    mkdir libyuv && cd libyuv
    svn co http://src.chromium.org/svn/trunk/tools/depot_tools . 
    ./gclient config http://libyuv.googlecode.com/svn/trunk
    ./gclient sync && cd trunk/source
    make -j6 V=1 -r libyuv.a BUILDTYPE=Release (makefile is missing in the original source, created one to do the job)
    cp libyuv.a /usr/local/lib
    mkdir –parents /usr/local/include/libyuv/libyuv
    cp -rf ../include/libyuv.h /usr/local/include/libyuv
    cp -rf ../include/libyuv/*.h /usr/local/include/libyuv/libyuv
  10. build and install libjpeg_turbo
    Makefile was not found in the downloaded webrtc2sip package, installed the libjpeg_turbo package by using other linux installation tool. It seems working fine so far.
  11. build and install opencore-amr
    git clone git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr/opencore-amr
    cd opencore-amr && autoreconf –install && ./configure && make && make install
  12. build and install opus
    wget http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz
    tar -xvzf opus-1.0.2.tar.gz
    cd opus-1.0.2
    ./configure –with-pic –enable-float-approx && make && make install
  13. build and install libgsm
    wget http://www.quut.com/gsm/gsm-1.0.13.tar.gz
    tar -xvzf gsm-1.0.13.tar.gz
    cd gsm-1.0-pl13 && make && make install (need to specify the installation path in Makefile before install — e.g. INSTALL_ROOT = /usr/local)
  14. build and install g729
    svn co http://g729.googlecode.com/svn/trunk/ g729b
    cd g729b
    ./autogen.sh && ./configure –enable-static –disable-shared && make && make install
  15. build and install iLBC
    svn co http://doubango.googlecode.com/svn/branches/2.0/doubango/thirdparties/scripts/ilbc
    cd ilbc
    wget http://www.ietf.org/rfc/rfc3951.txt
    awk -f extract.awk rfc3951.txt
    ./autogen.sh && ./configure
    make && make install
  16. Build and install x264
    wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
    tar -xvjf last_x264.tar.bz2
    # the output directory may be difference depending on the version and date
    cd x264-snapshot-20121201-2245
    ./configure –enable-static –enable-pic && make && make install (default install path is /usr/local/lib, set prefix=/usr in config.mak after “configure” if you want to install in /usr/lib instead — this might be required in building and installing ffmpeg)
  17. Build and install FFmpeg
    git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
    cd ffmpeg
    git checkout n1.2
    ./configure –extra-cflags=”-fPIC” –extra-ldflags=”-lpthread” –enable-pic –enable-memalign-hack –enable-shared –disable-static –disable-network –disable-protocols –disable-pthreads –disable-devices –disable-filters –disable-bsfs –disable-muxers –disable-demuxers –disable-parsers –disable-hwaccels –disable-ffmpeg –disable-ffplay –disable-ffserver –disable-encoders –disable-decoders –disable-zlib –enable-gpl –disable-debug –enable-encoder=h263 –enable-encoder=h263p –enable-decoder=h263 –enable-encoder=mpeg4 –enable-decoder=mpeg4 –enable-libx264 –enable-encoder=libx264 –enable-decoder=h264 (may need to install libx264_dev)
    make && make install
  18. Build and install Doubango
    • Minimum
      cd doubango-source/branches/2.0/doubango && ./autogen.sh && ./configure –with-ssl –with-srtp
      make && make install
    • Recommended
      cd doubango-source/branches/2.0/doubango && ./autogen.sh && ./configure –with-ssl –with-srtp –with-speexdsp –enable-speexjb –with-ffmpeg –with-h264
      make && make install
    • Full
      cd doubango-source/branches/2.0/doubango && ./autogen.sh && ./configure –with-ssl –with-srtp –with-vpx –with-yuv
      –with-amr –with-speex –with-speexdsp –enable-speexresampler –enable-speexjb –enable-speexdenoiser –with-gsm –with-ilbc –with-g729 –with-ffmpeg –with-h264
      make && make install
    • Build errors and handlings
      • /usr/local/include/libyuv/libyuv/compare.h:14:32: fatal error: libyuv/basic_types.h: No such file or directory
        • make symbol links for all header files from “/usr/local/include/libyuv/libyun” to “/usr/local/include/libyuv”
      • src/codecs/h263/tdav_codec_h263.c:186:93: error: parameter 3 (‘encoder’) has incomplete type
        • make sure your ffmpeg is from branch n1.2
  19. Build and install webrtc2sip
    export PREFIX=/opt/webrtc2sip
    # use –with-doubango=PATH to set path to the doubango installation (‘lib’ and ‘include’ folders).
    cd webrtc2sip && ./autogen.sh && ./configure –prefix=$PREFIX –with-doubango=/usr/local
    make clean && make && make install
    cp -f ./config.xml $PREFIX/sbin/config.xml
    export PATH=$PATH:/opt/webrtc2sip/sbin(to export the executable “webrtc2sip” path)
Run webrtc2sip
  1. issue “webrtc2sip” command
    • webrtc2sip –config=/opt/webrtc2sip/config.xml
  2. “export PREFIX=/opt/webrtc2sip” if command not found
  3. “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib” if complains libraries not found, such as “webrtc2sip: error while loading shared libraries: libtinySAK.so.0: cannot open shared object file: No such file or directory”
Attachment
    1. libyuv Makefile

CC = gcc
CPP = g++
AR = ar
RM = rm -f
CFLAGS = -O3 -Wall -pedantic -I../include -I../include/libyuv
OBJ = compare.o \
compare_common.o \
compare_neon.o \
compare_posix.o \
compare_win.o \
convert.o \
convert_argb.o \
convert_from.o \
convert_from_argb.o \
convert_jpeg.o \
convert_to_argb.o \
convert_to_i420.o \
cpu_id.o \
format_conversion.o \
mjpeg_decoder.o \
mjpeg_validate.o \
planar_functions.o \
rotate.o \
rotate_argb.o \
rotate_mips.o \
rotate_neon.o \
row_any.o \
row_common.o \
row_mips.o \
row_neon.o \
row_posix.o \
row_win.o \
scale.o \
scale_argb.o \
scale_argb_neon.o \
scale_mips.o \
scale_neon.o \
video_common.o
ASMOBJ = memcpy_mips.o \
row_x86.o \
x86inc.o
BIN = libyuv.a
%.o: %.cc
$(CPP) -c -o $@ $< $(CFLAGS)
$(BIN): $(OBJ)
ar r $(BIN) $(OBJ)
ranlib $(BIN)
clean:
$(RM) *.o *.a
Source : Geeksforum 

Monday, 6 April 2015

Asterisk Webrtc Setup (source : github/(jwoertink))

Setup Network config

  1. vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
DHCP_HOSTNAME=pbx.dev
HOSTNAME="pbx.dev"
IPV6INIT=yes
MTU=1500
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
HWADDR=00:00:00:00:00 #YOUR MAC ADDRESS of VirtualBox
DNS1=8.8.8.8
USERCTL=no
IPADDR=0.0.0.0 #IP YOU NEED i.e. 172.16.1.56
NETMASK=255.255.255.0
GATEWAY=0.0.0.0 #YOUR GATEWAY i.e. 172.16.1.1
  1. service network restart If any fail, you may need to run reboot
  2. ifconfig | grep "inet addr" Check for IP address
  3. service iptables save
  4. service iptables stop
  5. chkconfig iptables off

Update Server Hostname

  1. vi /etc/sysconfig/network
  2. HOSTNAME=pbx.dev Set the HOSTNAME to pbx.dev or whatever you want your hostname to be
  3. vi /etc/hosts
172.16.1.56 pbx.dev #use your IP address
127.0.0.1 localhost pbx.dev
::1 localhost pbx.dev
  1. hostname pbx.dev
  2. service network restart

Install Virtualbox Guest Additions

  1. Devices > Insert Guest Additions CD Image
  2. mkdir /media/VirtualBoxGuestAdditions
  3. mount -r /dev/cdrom /media/VirtualBoxGuestAdditions
  4. yum update -y
  5. yum groupinstall -y "Development Tools"
  6. rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  7. yum install -y gcc kernel-devel kernel-headers dkms make bzip2 perl
  8. yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)
  9. KERN_DIR=/usr/src/kernels/$(uname -r)/
  10. export KERN_DIR
  11. cd /media/VirtualBoxGuestAdditions
  12. ./VBoxLinuxAdditions.run
  13. reboot

Configure Terminal

  1. vi /etc/grub.conf
  2. Find the kernel line and add vga=791 to the end of the line
  3. vi /etc/bashrc
  4. update PS1 to PS1='\[\033[02;32m\]\u@\h\[\033[02;34m\]\w\$\[\033[00m\] '
  5. add alias currip="ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print \$1}'"
  6. save and exit
  7. sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
  8. reboot

Install Asterisk Current

  1. yum install -y wget gcc-c++ ncurses-devel libxml2-devel sqlite-devel libsrtp-devel libuuid-devel openssl-devel iksemel-devel jansson-devel
  2. cd /usr/local/src/
  3. wget downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
  4. wget downloads.asterisk.org/pub/telephony/dahdi-tools/dahdi-tools-current.tar.gz
  5. wget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2
  6. wget downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
  7. wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-12-current.tar.gz
  8. tar zxvf dahdi-linux*
  9. cd dahdi-linux*
  10. make && make install && make config
  11. cd ..
  12. tar zxvf dahdi-tools*
  13. cd dahdi-tools*
  14. make && make install && make config
  15. cd ..
  16. tar zxvf libpri*
  17. cd libpri*
  18. make && make install
  19. cd ..
  20. tar -xjvf pjproject-2.2.1.tar.bz2
  21. cd pjproject*
  22. ./configure --prefix=/usr/lib64/ --enable-shared
  23. make dep
  24. make && make install
  25. pjproject installs files to /usr/lib64/lib cd /usr/lib64/lib mv lib* .. mv pkgconfig/libpjproject.pc ../pkgconfig/
  26. cd /usr/local/src/pjproject*
  27. ldconfig
  28. ldconfig -p | grep pj should return a huge list of symlinked .so files
  29. PKG_CONFIG_PATH=/usr/lib64/pkgconfig/
  30. export PKG_CONFIG_PATH
  31. cd ..
  32. tar zxvf asterisk*
  33. cd asterisk*
  34. ./configure --libdir=/usr/lib64
  35. make menuselect
  36. Select Resource Modules then scroll down to ensure a * is next to res_srtp. Press x to save & quit
  37. vi include/asterisk/autoconfig.h this is a super hack >_<
  38. replace #undef HAVE_PJ_TRANSACTION_GRP_LOCK with #define HAVE_PJ_TRANSACTION_GRP_LOCK 1
  39. make && make install
  40. make samples
  41. make config

Configure Asterisk for WebRTC

  1. mkdir /etc/asterisk/keys
  2. cd /usr/local/src/asterisk*/contrib/scripts
  3. ./ast_tls_cert -C $(currip) -O "My Super Company" -d /etc/asterisk/keys
  4. vi /etc/asterisk/http.conf
[general]
enabled=yes
bindaddr=127.0.0.1 ; Replace this with your IP address
bindport=8088 ; Replace this with the port you want to listen on
  1. vi /etc/asterisk/sip.conf
[general]
context=default
allowguest=no
allowoverlap=no
accept_outofcall_message=yes
outofcall_message_context=default
realm=127.0.0.1 ; Replace this with your IP address
udpbindaddr=127.0.0.1 ; Replace this with your IP address
transport=ws,wss,udp
language=en
icesupport=yes
videosupport=yes
nat=auto_force_rport,auto_comedia
allow=!all,alaw,ulaw,gsm
;
[1060] ; This will be WebRTC client
type=friend
username=1060 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=password ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=ws,wss,udp ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS
videosupport=yes
nat=no
disallow=all
allow=ulaw,vp8,h264
;
[1061] ; This will be the legacy SIP client
type=friend
username=1061
host=dynamic
secret=password
context=default
directmedia=no
transport=udp
force_avp=yes
dtlsenable=no
videosupport=yes
nat=no
disallow=all
allow=ulaw,vp8
  1. vi /etc/asterisk/extensions.conf
[default]
exten => 1060,1,Dial(SIP/1060) ; Dialing 1060 will call the SIP client registered to 1060
exten => 1061,1,Dial(SIP/1061) ; Dialing 1061 will call the SIP client registered to 1061
  1. vi /etc/asterisk/manager.conf
[general]
enabled=yes
port=5038
bindaddr=0.0.0.0
;
[admin]
secret=password
read=all
write=all
writetimeout=5000
  1. service asterisk restart
  2. Ensure Linphone is installed, and all Video and Audio codecs are turned on
  3. SIP account should be sip:1061@CENT_OS_IP_ADDRESS with udp transport

Install & Configure ejabberd

  1. yum install -y ejabberd
  2. vi /etc/ejabberd/ejabberd.cfg
% Find this line and add the pbx.dev
{hosts, ["localhost", "pbx.dev"]}.
  1. service ejabberd start
  2. ejabberdctl register admin pbx.dev password to create an account called admin on pbx.dev with the password "password"
  3. vi /etc/ejabberd/ejabberd.cfg
% This goes under the ACCESS CONTROL section
{acl, admin, {user, "admin", "pbx.dev"}}.
  1. service ejabberd restart
  2. Browse to http://pbx.dev:5280/admin and use admin/password to log in
  3. Virtual Hosts > pbx.dev > Users - Make a user called "asterisk". Also make yourself a user
  4. vi /etc/asterisk/xmpp.conf
[general]
autoregister=yes
autoprune=no
;
[ejabberd]
type=client
serverhost=pbx.dev
username=asterisk@pbx.dev
secret=password ;your password you chose for asterisk
priority=1
port=5222
usetls=no
usesasl=yes
status=available
statusmessage="It's Asterisk!"
timeout=5
  1. asterisk -r
  2. module reload res_xmpp - should show reloading
  3. xmpp show connections - should show 1 client connected. If so, then exit
  4. vi /etc/asterisk/extensions.conf
; replace the exten 1061 dialplan with this
exten => 1061,1,Set(JSTATUS=${JABBER_STATUS(ejabberd,youruser@pbx.dev/Desktop)}) ; /Desktop is the resource you will set in your xmpp client like Adium/Pidgin
same => n,GotoIf($[0${JSTATUS}=1]?available:unavailable)
same => n(available), JabberSend(ejabberd,youruser@pbx.dev,"Incoming call from ${CALLERID(num)}")
same => n,Dial(SIP/1061)
same => n,Hangup()
same => n(unavailable),JabberSend(ejabberd,youruser@pbx.dev,"Missed call from ${CALLERID(num)}")
; do other dialplan stuff when you're not available
  1. service asterisk restart

E-mail Newsletter

Sign up now to receive breaking news and to hear what's new with us.

Recent Articles

© 2014 VOIP4Learn. WP themonic converted by Bloggertheme9. Powered by Blogger.
TOP