Skip to content

georganix/one-to-one-js-sample

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sightcall JavaScript One To One Sample

This is an example of a bare-bones sightcall installation

For a full JavaScript API reference please refer to our official documentation website.

How to deploy the examples

Requirement
  • It is important that the project is served from a webserver and not from the file system when using WebRTC.
  • Be aware of your AppId, and understand what is a UID and a Display Name. All of them are described in our definition page.

You can find more details about AppID, UID and Display Name here

You also need to be able to get tokens out of the weemo cloud. The fastest way to obtain a token is to use one of our Authentication Client for backends. Description and samples are available here.

Setting up the AppID and the Authentication URL

Once you have received your AppID provided by Sightcall, you can setup these examples with your AppId in order to test the API. The only thing you have to do is to setup the AppId as well as the Authentication URL. To do so, for each of the Javascript examples you want to use, you must edit the .html file and replace the placeholder "YOUR_APP_IDENTIFIER" by your AppID in the following lines"

<script type="text/javascript" src="https://download.rtccloud.net/js/webappid/YOUR_APP_IDENTIFIER"></script>

and

var rtcc = new Rtcc("YOUR_APP_IDENTIFIER", "callee_uid", "internal", options);

You also need to replace the following line if you are using our java, node.js or ruby Authentication API Client sample:

//AUTH_URL = 'http://YOUR_AUTH_URL/gettoken?uid=',

or if you are using our PHP Authentication API Client Sample.

// AUTH_URL = 'http://YOUR_AUTH_URL/gettoken.php?uid=',

In any case, you have to uncomment the right line and specify the URL where a token can be found by the web page. Of course, if you have implemented your own client parameters and URL might be different and you need to update the samples accordingly.

Now you can upload the examples on a webserver and start using them.

One-to-one example

In this example, the UID and Display Name are already set. In the caller.html, you will be connected using caller_uid as a UID and Caller as a Display Name, and if you are using callee.html, you will be connected using callee_uid as a UID and Callee as a Display Name.

You can find more details about AppID, UID and Display Name here

How to use

This example is composed of four html files. Three of them called ``caller*.htmland the other one namedcallee.html```. With all files a user called ```callee_uid```logged in the callee.html file connects and can be joined by a caller.
In order to initiate a call between these two pages here a the steps you have to follow:

  • Open callee.html in one computer and wait te be connected. You will know that you are connected when you will see these sentences appear in your browswer:
Connected as Callee using (RtccDriver|WebRTC).
Waiting for a call.
  • At this moment open the caller.html in another computer and wait to be connected. You will know that you are connected when you will see the following sentence appears in your browser as well as a button labeled 'Click to call Callee':
Connected as Caller using (RtccDriver|WebRTC)
  • Click the button 'Click to call Callee' in the caller.html page in your browser. The call is initiated.
  • Answer the call in the callee.html page and the Video Chat starts.

Warning: If using WebRTC, you will be ask to allow access to your microphone and camera when initiating a call and when accepting a call. Click Allow in order to give WebRTC access to these peripherics.

Managing an external caller

If you wish to use external users, instead of using the page caller.html, just use the page caller_external.html. In that case, the caller is not an authentified user but an external one, attached to the premium user callee_uid, and only allowed to call that premium user.
The behaviour of the external in the example is exactly the same as before. Please note that you have a limited number of external calls allowed.

Managing auto-start calls

The last case is pretty much the same except that the caller will automatically call when the connected to the cloud. It is availbale through the caller_external_automatic.html. Automatic calls can be done either with internal or external users.

  • First connect as the callee

  • Then Launch the automatic external page. The external user connects to the cloud and then automatically starts a call to the callee page.

Warning: Please remember that the JS API sends a sipOK notification on the onConnectionHandler callback when the user is ready to make or receive calls. It is then send again every 15 minutes to notify the application that the user is still connected. The automatic call in the example is initiated by the sipOK connection handler, if and only if, the call has not been started yet. Without that check, the application could restart a call each time the sipOK notification is sent.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 100.0%