orca.js Interactive Experience

Bob

Session

// Create Bob's Session
bob.session = orca.createSession(
  'sip:bob@example.com',
  'password',
  { uri: 'http://www.example.com:8080',
    provider: orcaStub,
    mediatypes: 'audio,video' }
);
// Add callbacks
bob.session.on('connected', session_onConnected);
bob.session.on('disconnected', session_onDisconnected);
bob.session.on('error', session_onError);
bob.session.on('incoming', session_onIncoming);
bob.session.on('status', session_onStatus);
// Connect
bob.session.connect();
// Disconnect Bob's Session
bob.session.disconnect();

Call with Alice

// Create call to Alice
bob.call = bob.session.createCall('sip:alice@example.com', 'audio,video');
// Add callbacks
bob.call.on('connecting', call_onConnecting);
bob.call.on('connected', call_onConnected);
bob.call.on('stream:add', call_onAddStream);
bob.call.on('disconnected', call_onDisconnected);
bob.call.on('rejected', call_onRejected);
bob.call.on('error', call_onError);
// Connect
bob.call.connect();
// Accept call from Alice
function onUserMediaSuccess(stream){
  bob.call.addStream(stream);
  bob.call.connect();
}
navigator.getUserMedia({video:video, audio:audio}, onUserMediaSuccess, onUserMediaError);
// Disconnect call
bob.call.disconnect();
// Reject call from Alice
bob.call.reject();
Please accept microphone/camera permissions

Alice

Session

// Create Alice's Session
alice.session = orca.createSession(
  'sip:alice@example.com',
  'password',
  { uri: 'http://www.example.com:8080',
    provider: orcaStub,
    mediatypes: 'audio,video' }
);
// Add callbacks
alice.session.on('connected', session_onConnected);
alice.session.on('disconnected', session_onDisconnected);
alice.session.on('error', session_onError);
alice.session.on('incoming', session_onIncoming);
alice.session.on('status', session_onStatus);
// Connect
alice.session.connect();
// Disconnect Alice's Session
alice.session.disconnect();

Call with Bob

// Create call to Bob
alice.call = alice.session.createCall('sip:bob@example.com', 'audio,video');
// Add callbacks
alice.call.on('connecting', call_onConnecting);
alice.call.on('connected', call_onConnected);
alice.call.on('stream:add', call_onAddStream);
alice.call.on('disconnected', call_onDisconnected);
alice.call.on('rejected', call_onRejected);
alice.call.on('error', call_onError);
// Connect
alice.call.connect();
// Accept call from Bob
function onUserMediaSuccess(stream){
  alice.call.addStream(stream);
  alice.call.connect();
}
navigator.getUserMedia({video:video, audio:audio}, onUserMediaSuccess, onUserMediaError);
// Disconnect call
alice.call.disconnect();
// Reject call from Bob
alice.call.reject();
Please accept microphone/camera permissions

 

 

 

 

 

 

 

 

 

 

Visit the documentation page to download a demo application that you can test in your local environment and which supports true machine-to-machine communication.