APPRTC Instance Deployment Learning Notes

Source: Internet
Author: User
Tags constant install go json git clone aliyun
APPRTC Instance Deployment Learning notesPosted on April 3, 2018 by xyh421

Environment: VMware Virtual Machine ubuntu14.04

Attention

1. The Internet mode to bridge OH

2. Switch to root mode

Sudo-i
1. Replace Ali Source

Modify Source.list

Deb Http://mirrors.aliyun.com/ubuntu/trusty main restricted universe Multiverse
Deb http://mirrors.aliyun.com/ Ubuntu/trusty-security main restricted universe Multiverse
Deb Http://mirrors.aliyun.com/ubuntu/trusty-updates Main restricted universe Multiverse
Deb http://mirrors.aliyun.com/ubuntu/trusty-proposed main restricted universe Multiverse
Deb Http://mirrors.aliyun.com/ubuntu/trusty-backports main restricted universe multiverse
DEB-SRC http://mirrors.aliyun.com/ubuntu/trustymain restricted universe Multiverse
DEB-SRC/http Mirrors.aliyun.com/ubuntu/trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com /ubuntu/trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/trusty-backports Main Restricted Universe Multiverse
2. Install the necessary dependencies

Various dependencies

Apt-get install git unzip  lrzsz  nodejs npm automake autoconf libtool nodejs-legacy python-webtest Golang vim-y
Apt-get Install Openssh-server openssh-client-y

Installing jdk1.8

Add-apt-repository ppa:openjdk-r/ppa;apt-get update;apt-get Install openjdk-8-jdk-y;
3. Upgrade NPM, install grunt

NPM Latest Version Installation method

1. Install NPM

sudo apt-get install NPM

2. Upgrade NPM to the latest version

sudo npm install npm@latest-g

At this time through Npm-v can be found NPM version number is the latest version 3.10.3;

3. Install the module for installing Nodejs n

sudo npm install-g n

4. Then install the specified version of the Nodejs,n module through the N module for more information please refer to the official documentation

Install official latest version sudo n latest//install official stable version sudo n stable

You may need to restart the terminal or system after the update is complete

NPM Config Set registry https://registry.npm.taobao.org
NPM Info underscore
npm-g install GRUNT-CLI

4. Engage in APPRTC source code
Sudo-i
cd/root
git clone https://github.com/webrtc/apprtc.git

Backup source

Tar czf apprtc.tar.gz apprtc/

Installation dependencies

NPM Install

Sometimes it is wrong to report permissions, you need to add sudo

Compile

Grunt Build

To see more problems, copy the error log Google can
5. Modify the configuration file
constant.py

Modify it as follows, and pay attention to replacing it with your own IP address.

# Copyright Google Inc.

All rights Reserved.

"" "APPRTC Constants.
This module contains the constants used in APPRTC Python modules.
"" "Import OS # Deprecated domains which we should to redirect. Redirect_domains = [' apprtc.appspot.com ', ' apprtc.webrtc.org ', ' www.appr.tc '] # URL which we should REDIRECT to if MA
Tching in Redirect_domains. Redirect_url = ' https://appr.tc ' room_memcache_expiration_sec = * * * Memcache_retry_limit = Loopback_client_ ID = ' loopback_client_id ' # Turn/stun server override.
This allows APPRTC to connect to turn servers # directly rather than retrieving them from an ICE server provider. Ice_server_override = None # Enable by uncomment below and comment out above, then specify turn and stun # Ice_server_over RIDE = [# {# ' URLs ': [# ' TURN:HOSTNAME/IPTOTURNSERVER:19305?TRANSPORT=UDP ', # ' Turn:hostname/iptotur Nserver:19305?transport=tcp "#", # "username": "Turnserverusername", # "CredentiaL ":" Turnservercredentials "#}, # {#" URLs ": [#" stun:hostname/iptostunserver:19302 "#] #} #] TU Rn_base_url = ' http://192.168.23.114 ' turn_url_template = '%s/turn?username=%s&key=%s ' ceod_key = ' 4080218913 ' ICE_ Server_base_url = ' http://192.168.23.114 ' ice_server_url_template = '%s/v1alpha/iceconfig?key=%s ' Ice_server_api_key
= Os.environ.get (' Ice_server_api_key ') # Dictionary keys in the collider instance info constant. Wss_instance_host_key = ' Host_port_pair ' wss_instance_name_key = ' vm_name ' wss_instance_zone_key = ' ZONE ' WSS_INSTANCES = [{wss_instance_host_key: ' 192.168.23.114:8089 ', Wss_instance_name_key: ' Wsserver-std ', Wss_instance_zone_ke
    Y: ' Us-central1-a '}, {wss_instance_host_key: ' 192.168.23.114:8089 ', Wss_instance_name_key: ' Wsserver-std-2 ',  Wss_instance_zone_key: ' Us-central1-f '}] wss_host_port_pairs = [Ins[wss_instance_host_key] for ins in WSS_INSTANCES] #
Memcache key for the active collider host. Wss_host_actiVe_host_key = ' Wss_host_active_host ' # Dictionary keys in the collider probing result.

Wss_host_is_up_key = ' is_up ' wss_host_status_code_key = ' status_code ' wss_host_error_message_key = ' ERROR_MESSAGE ' Response_error = ' ERROR ' response_room_full = ' full ' response_unknown_room = ' unknown_room ' response_unknown_client = ' UN Known_client ' response_duplicate_client = ' duplicate_client ' response_success = ' SUCCESS ' response_invalid_request = ' Invalid_request ' is_dev_server = Os.environ.get (' application_id ', '). StartsWith (' DEV ') Bigquery_url = ' https://
Www.googleapis.com/auth/bigquery ' # Dataset used in production.
Bigquery_dataset_prod = ' PROD ' # DATASET used when running locally.
bigquery_dataset_local = ' Dev ' # BIGQUERY table within the DATASET. bigquery_table = ' Analytics '
apprtc.py

Find the Get_wss_parameters method

def get_wss_parameters (Request): Wss_host_port_pair = Request.get (' wshpp ') Wss_tls = Request.get (  ' Wstls ') if not wss_host_port_pair: # attempt to get a WSS server from the status provided by Prober, # if that
    Fails, use fallback value. Memcache_client = Memcache. Client () Wss_active_host = Memcache_client.get (constants. Wss_host_active_host_key) if wss_active_host in constants. Wss_host_port_pairs:wss_host_port_pair = Wss_active_host else:logging.warning (' Invalid or no Value returned from Memcache, using fallback: ' + json.dumps (wss_active_host)) Wss_host_port_pair = Consta Nts. Wss_host_port_pairs[0] If wss_tls and wss_tls = = ' false ': Wss_url = ' ws://' + wss_host_port_pair + '/ws ' Wss_po St_url = ' http//' + wss_host_port_pair Else:wss_url = ' wss://' + wss_host_port_pair + '/ws ' Wss_post_url = ' ht tps://' + Wss_host_port_pair return (Wss_url, Wss_post_url) 

Modify to

def get_wss_parameters (Request): Wss_host_port_pair = Request.get (' wshpp ') Wss_tls = Request.get (  ' Wstls ') if not wss_host_port_pair: # attempt to get a WSS server from the status provided by Prober, # if that
    Fails, use fallback value. Memcache_client = Memcache. Client () Wss_active_host = Memcache_client.get (constants. Wss_host_active_host_key) if wss_active_host in constants. Wss_host_port_pairs:wss_host_port_pair = Wss_active_host else:logging.warning (' Invalid or no Value returned from Memcache, using fallback: ' + json.dumps (wss_active_host)) Wss_host_port_pair = Consta Nts. Wss_host_port_pairs[0] If wss_tls and wss_tls = = ' false ': Wss_url = ' ws://' + wss_host_port_pair + '/ws ' Wss_po St_url = ' http//' + wss_host_port_pair Else:wss_url = ' ws://' + wss_host_port_pair + '/ws ' Wss_post_url = ' htt p://' + Wss_host_port_pair return (Wss_url, Wss_post_url) 
Index_template.html

Locate the following code block, modify and replace the IP address

{% if not chromeapp%}   <script type= "Text/javascript" > var servers=[{credential: "Helloword", Username: "Hel
LoWord ", urls:[" turn:192.168.23.114:3478?transport=udp "," Turn:192.168.23.114:3478?transport=tcp "]}];     var loadingparams = {      errormessages: {{error_messages}},       ISLOOPB Ack: {{is_loopback}},       warningmessages: {{warning_messages}}, {% if room_id%}     &NBSP ; Roomid: ' {{room_id} ',       Roomlink: ' {{room_link}} ', {% endif%}       Mediaconstrain TS: {{media_constraints | safe}},       offeroptions: {{offer_options | safe}},      pee Rconnectionconfig: {"Rtcpmuxpolicy": "Require", "iceservers": Servers, "Bundlepolicy": "Max-bundle"},       //peerconnectionconfig: {{pc_config | safe}},       peerconnectionconstraints: {{Pc_constra INTs | Safe}},      //IceserVerrequesturl: ' {{ice_server_url}} ',       Iceservertransports: ' {{ice_server_transports}} ',   &NB Sp   Wssurl: ' {{wss_url}} ',       Wssposturl: ' {{wss_post_url}} ',       bypassjoinconf
 Irmation: {{bypass_join_confirmation}},       Versioninfo: {{version_info}},    };

6. Start the server

Unzip the google_appengine_1.9.65.zip to the root directory, replace the following IP and run it

Root@xyh:~/google_appengine#/root/google_appengine/dev_appserver.py–host 192.168.22.170/root/apprtc/out/app_ Engine

This time is not able to see the image, the installation of the signaling server before you can see 7. Install the signaling server, signal server

Reference:

Https://github.com/webrtc/apprtc/blob/master/src/collider/README.md

Copy Collider to APPRTC sibling directory,

Cp/root/apprtc/src/collider/root/collider/src-r

Modify Main.go

Vim/root/collider/src/collidermain/main.go

Change to

var roomsrv = flag. String ("Room-server", "http://192.168.110.131:8080", "The origin of the guest")

Setting environment variables

Export Goroot=/root/go;
Export path= $PATH: $GOROOT/bin;
Export gopath=/root/collider/;

If there is a problem, reinstall go

Uninstalling the Apt-get install go

Apt-get Remove Golang-y;apt-get Remove golang*-y;apt-get autoremove;

You can also download the tar package for go, green installation

If a network problem occurs

Mkdir-p $GOPATH/src/golang.org/x cd $GOPATH/src/golang.org/x git clone https://github.com/golang/net.git

Installation dependencies

Go get collidermain;
go install collidermain;

Running the signaling server

/root/collider/bin/collidermain-port=8089-tls=false

This time you can see the image


8. Install the ICE server

Installation dependencies

Apt-get Install Libssl-dev Libsqlite3-dev libevent-dev libpq-dev-y

Download Coturn Code

git clone https://github.com/coturn/coturn.git

Compiling and installing

CD Coturn
./configure && make && make install

IP address for your own

/root/coturn/bin/turnserver–syslog-a-L 192.168.22.170-x 192.168.22.170-e 192.168.22.170-f–min-port=32355–max-port =65535–user=helloword:helloword-r Helloword–cert=turn_server_cert.pem–pkey=turn_server_pkey.pem–log-file=stdout -V

x external network ip,l and e are intranet IP
9.android end needs to be modified

Download code:

Https://github.com/njovy/AppRTCDemo

To modify the code:


Android only needs to change this file

The wreath is to be commented out

The horizontal line is to be added

Inside this IP needs to fill in your turn server IP

You need to change the room server address in the app configuration after launching the app

This is the Android modification.
10. How to use the phone after installation

Install demo APK

Open the Settings button

Set Room server address:


Last unresolved issues:

1. Log Error

Server side: Invalid or no value returned from Memcache, using Fallback:null

Android side: Ice_server_url=http://192.168.23.114/v1alpha/iceconfig?key=none

2. Chrome does not support, HTTPS pay, temporarily do not get

3. Many-to-many support, one-to-many

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.