WebAPI/WebTelephony: Difference between revisions

Jump to navigation Jump to search
consolidate: WebTelephony: Implementation Specifics
(consolidate: WebTelephony: DOM API)
(consolidate: WebTelephony: Implementation Specifics)
Line 77: Line 77:
   attribute nsIDOMEventListener onheld;  
   attribute nsIDOMEventListener onheld;  
   attribute nsIDOMEventListener onresuming;  
   attribute nsIDOMEventListener onresuming;  
};
=== Example ===
Here are few examples about how to use WebTelephony API.
==== Place a call ====
// First, obtain a telephony object.
var telephony = navigator.mozTelephony;
// Check if the speaker is enabled.
concole.log(telephony.speakerEnabled);
// Then, we dial out.
var outgoing = telephony.dial(phoneNumber);
// Event handlers for the call.
outgoing.onconnected = function onconnected(event) {
  /* Do something when the callee picks up the call. */
};
outgoing.ondisconnected = function ondisconnected(event) {
  /* Do something when the call finishes. */
};
// Hang up the call.
outgoing.hangUp();
==== Receive a call ====
// First, obtain a telephony object.
var telephony = navigator.mozTelephony;
// Receive an incoming call.
telephony.onincoming = function onincoming(event) {
  var incoming = event.call;
 
  // Answer the call.
  incoming.answer(); 
  };
  };
Confirmed users
978

edits

Navigation menu