Introduction to WebTelephony Redirect 2

Jump to:

The basis of accessing the phone functionality is simply through navigator.mozTelephony, which is part of the WebTelephony API. Once you have a reference to that object you can start placing and recieving calls. Here are a few examples:

// Telephony object
var tel = navigator.mozTelephony;

// Check if the phone is muted (read/write property)

// Check if the speaker is enabled (read/write property)

// Place a call
var call = tel.dial("123456789");

// Events for that call
call.onstatechange = function (event) {
        Possible values for state:
        "dialing", "ringing", "busy", "connecting", "connected", 
        "disconnecting", "disconnected", "incoming"

// Above options as direct events
call.onconnected = function () {
    // Call was connected

call.ondisconnected = function () {
    // Call was disconnected

// Receiving a call
tel.onincoming = function (event) {
    var incomingCall =;

    // Get the number of the incoming call

    // Answer the call

// Disconnect a call

// Iterating over calls, and taking action depending on their changed status
tel.oncallschanged = function (event) {
    tel.calls.forEach(function (call) {
        // Log the state of each call

See also

Document Tags and Contributors

Last updated by: Sheppy,