RTCall.js — A library for Browser-to-Browser audio-only calling
Now, RTCMultiConnection-v1.4 and upper releases supports admin/guest features; so RTCMultiConnection.js is preferred.
Why RTCall.js?
- In your own site; as an admin; you may want to be auto-alerted for each new visitor i.e. customer.
- You may want to make voice-only calls between admin and customers
The entire process is browser to browser.
=
First Step: Link the library
<script src="https://www.webrtc-experiment.com/RTCall.js"></script>
=
Second Step: Start using it!
Remember: All lines are optional!
call = new RTCall();
=
onincomingcall
onincomingcall fires each time if someone calls you:
call.onincomingcall = function(caller) {
call.receive(caller.receiverid);
};
=
oncustomer
oncustomer is fired only for admin:
call.oncustomer = function(customer) {
call.call(customer.callerid);
};
=
onstream
onstream returns remote media stream:
call.onstream = function(e) {
// e.stream ---- remote media stream object
// e.callerid ---- id of the remote person
audio = e.audio;
audio.play(); // "e.audio" object is paused by default
document.documentElement.appendChild(audio);
};
=
init
initializing RTCall object:
call.init();
=
call
Admin can call customers using their caller-ids. Remeber, customers caller-ids are always passed over oncustomer method:
call.oncustomer = function(customer) {
call.call(customer.callerid);
};
Customers can call the admin too; using admin's caller-id:
call.call('admin-caller-id');
=
receive
receiver-id is always passed over onincomingcall:
call.onincomingcall = function(caller) {
call.receive(caller.receiverid);
};
=
admin
By default: admin is false:
call.admin = true;
=
Demo
=
Browser Support
RTCall.js supports following browsers:
| Browser | Support |
|---|---|
| Firefox | Stable / Aurora / Nightly |
| Google Chrome | Stable / Canary / Beta / Dev |
| Android | Chrome Beta |
=
License
RTCall.js is released under MIT licence . Copyright (c) 2013 Muaz Khan.