CallControl CallControl CallControl CallControl Class

Definition

Represents the properties, commands and events for handling calls on a telephony related device.

public : sealed class CallControl : ICallControl
public sealed class CallControl : ICallControl
Public NotInheritable Class CallControl Implements ICallControl
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Media.Devices.CallControlContract (introduced v1)

Remarks

This class provides access to events that can be monitored and used for modifying the behavior of your telephony-aware app. The following JavaScript code snippet shows how to add event listeners to the CallControl class, and then to respond to one of the events, AnswerRequested.

// Define the user-defined valriables
var callControls = null;
var audioTag;

// Add code to initialize your user-defined variables as needed
<code goes here>

// Initialize the telephony device
    function initDevice() {
        if (!callControls) {
            try {
                callControls = Windows.Media.Devices.CallControl.getDefault();

                if (callControls) {
                    // Add the event listener to listen for the various button presses
                    callControls.addEventListener("answerrequested", answerButton, false);
                    callControls.addEventListener("hanguprequested", hangupButton, false);
                    callControls.addEventListener("audiotransferrequested", audiotransferButton, false);
                    callControls.addEventListener("redialrequested", redialButton, false);
                    callControls.addEventListener("dialrequested", dialButton, false);

                    sdkSample.displayStatus("Call Controls Initialized");
                    id("scenario1Ring").disabled = false;
                } else {
                    sdkSample.displayError("No Bluetooth device detected.");
                }
            }
            catch (e) {                
                sdkSample.displayError("No Bluetooth device detected.");
            }
        }

// Event handler code to respond to the AnswerRequested event
    function answerButton() {
        // When the answer button is pressed indicate to the device that the call was answered
        // and start a song on the headset (this is done by streaming music to the bluetooth
        // device in this sample)
        sdkSample.displayStatus("Answer requested: " + callToken);
        callControls.indicateActiveCall(callToken);
        audiotag = document.getElementById("audiotag");
        audiotag.play();
    }

For the complete listing of this sample see How to manage calls on the default Bluetooth communications device.

Properties

HasRinger HasRinger HasRinger HasRinger

Indicates whether the telephony device has a built-in ringer.

public : Platform::Boolean HasRinger { get; }
public bool HasRinger { get; }
Public ReadOnly Property HasRinger As bool
var bool = callControl.hasRinger;
Value
Platform::Boolean bool bool bool

A Boolean value that is True if the telephony device has a ringer, and False if it does not.

Methods

EndCall(UInt64) EndCall(UInt64) EndCall(UInt64) EndCall(UInt64)

Ends the specified call.

public : void EndCall(unsigned __int64 callToken)
public void EndCall(UInt64 callToken)
Public Function EndCall(callToken As UInt64) As void
callControl.endCall(callToken);
Parameters
callToken
unsigned __int64 UInt64 UInt64 UInt64

The unique identifier of the specified call.

Remarks

After this method is called, the callToken of the specified call is no longer valid.

FromId(String) FromId(String) FromId(String) FromId(String)

Returns a CallControl class that represents the audio communications device specified by the DeviceInformation ID being passed.

public : static CallControl FromId(Platform::String deviceId)
public static CallControl FromId(String deviceId)
Public Static Function FromId(deviceId As String) As CallControl
var callControl = Windows.Media.Devices.CallControl.fromId(deviceId);
Parameters
deviceId
Platform::String String String String

The DeviceInformation ID of the specified audio communications device.

Returns

A class that represents the specified audio communications device.

Remarks

This method may return a NULL pointer if the device doesn't support this functionality.

GetDefault() GetDefault() GetDefault() GetDefault()

Returns a CallControl class that represents the default audio communications device.

public : static CallControl GetDefault()
public static CallControl GetDefault()
Public Static Function GetDefault() As CallControl
var callControl = Windows.Media.Devices.CallControl.getDefault();
Returns

A class that represents the default audio communications device.

Remarks

This method may return a NULL pointer if the device doesn't support this functionality.

IndicateActiveCall(UInt64) IndicateActiveCall(UInt64) IndicateActiveCall(UInt64) IndicateActiveCall(UInt64)

Indicates that the specified call is now active.

public : void IndicateActiveCall(unsigned __int64 callToken)
public void IndicateActiveCall(UInt64 callToken)
Public Function IndicateActiveCall(callToken As UInt64) As void
callControl.indicateActiveCall(callToken);
Parameters
callToken
unsigned __int64 UInt64 UInt64 UInt64

The unique identifier of the specified call.

IndicateNewIncomingCall(Boolean, String) IndicateNewIncomingCall(Boolean, String) IndicateNewIncomingCall(Boolean, String) IndicateNewIncomingCall(Boolean, String)

Informs the device that there is an incoming call.

public : ulong IndicateNewIncomingCall(bool enableRinger, Platform::String callerId)
public ulong IndicateNewIncomingCall(Boolean enableRinger, String callerId)
Public Function IndicateNewIncomingCall(enableRinger As Boolean, callerId As String) As ulong
var ulong = callControl.indicateNewIncomingCall(enableRinger, callerId);
Parameters
enableRinger
bool Boolean Boolean Boolean

Specifies whether the device should activate its built-in ringer.

callerId
Platform::String String String String

A numeric string that specifies the incoming caller ID. This parameter can be null, and often is for many VoIP calls.

Returns
ulong ulong ulong ulong

A call token that uniquely identifies this call.

IndicateNewOutgoingCall() IndicateNewOutgoingCall() IndicateNewOutgoingCall() IndicateNewOutgoingCall()

Updates device indicators to indicate an outgoing call.

public : ulong IndicateNewOutgoingCall()
public ulong IndicateNewOutgoingCall()
Public Function IndicateNewOutgoingCall() As ulong
var ulong = callControl.indicateNewOutgoingCall();
Returns
ulong ulong ulong ulong

A call token that uniquely identifies this call.

Remarks

An application should call this method only after the dialing connection is actually initiated, and not before.

Events

AnswerRequested AnswerRequested AnswerRequested AnswerRequested

Occurs when the device receives a request to answer a call.

public : event CallControlEventHandler AnswerRequested<>
public event CallControlEventHandler AnswerRequested<>
Public Event CallControlEventHandler AnswerRequested( Of )
function onAnswerRequested(eventArgs){/* Your code */}


callControl.addEventListener("answerRequested", onAnswerRequested);
callControl.removeEventListener("answerRequested", onAnswerRequested);

Remarks

This class provides access to events that can be monitored and used for modifying the behavior of your telephony-aware app. The following JavaScript code snippet shows how to add event listeners to the CallControl class, and then to respond to one of the events, AnswerRequested.

See Also

AudioTransferRequested AudioTransferRequested AudioTransferRequested AudioTransferRequested

Occurs when the device receives a request for an audio transfer.

public : event CallControlEventHandler AudioTransferRequested<>
public event CallControlEventHandler AudioTransferRequested<>
Public Event CallControlEventHandler AudioTransferRequested( Of )
function onAudioTransferRequested(eventArgs){/* Your code */}


callControl.addEventListener("audioTransferRequested", onAudioTransferRequested);
callControl.removeEventListener("audioTransferRequested", onAudioTransferRequested);

Remarks

This class provides access to events that can be monitored and used for modifying the behavior of your telephony-aware app. The following JavaScript code snippet shows how to add event listeners to the CallControl class, and then to respond to one of the events, AudioTransferRequested.

See Also

DialRequested DialRequested DialRequested DialRequested

Occurs when a number is dialed from the device.

public : event DialRequestedEventHandler DialRequested<>
public event DialRequestedEventHandler DialRequested<>
Public Event DialRequestedEventHandler DialRequested( Of )
function onDialRequested(eventArgs){/* Your code */}


callControl.addEventListener("dialRequested", onDialRequested);
callControl.removeEventListener("dialRequested", onDialRequested);

Remarks

This class provides access to events that can be monitored and used for modifying the behavior of your telephony-aware app. The following JavaScript code snippet shows how to add event listeners to the CallControl class, and then to respond to one of the events, DialRequested.

See Also

HangUpRequested HangUpRequested HangUpRequested HangUpRequested

Occurs when the device receives a request to hang up a call.

public : event CallControlEventHandler HangUpRequested<>
public event CallControlEventHandler HangUpRequested<>
Public Event CallControlEventHandler HangUpRequested( Of )
function onHangUpRequested(eventArgs){/* Your code */}


callControl.addEventListener("hangUpRequested", onHangUpRequested);
callControl.removeEventListener("hangUpRequested", onHangUpRequested);

Remarks

This class provides access to events that can be monitored and used for modifying the behavior of your telephony-aware app. The following JavaScript code snippet shows how to add event listeners to the CallControl class, and then to respond to one of the events, HangUpRequested.

KeypadPressed KeypadPressed KeypadPressed KeypadPressed

Occurs when a keypad button on the device has been pressed.

public : event KeypadPressedEventHandler KeypadPressed<>
public event KeypadPressedEventHandler KeypadPressed<>
Public Event KeypadPressedEventHandler KeypadPressed( Of )
function onKeypadPressed(eventArgs){/* Your code */}


callControl.addEventListener("keypadPressed", onKeypadPressed);
callControl.removeEventListener("keypadPressed", onKeypadPressed);

RedialRequested RedialRequested RedialRequested RedialRequested

Occurs when the device receives a request to redial.

public : event RedialRequestedEventHandler RedialRequested<>
public event RedialRequestedEventHandler RedialRequested<>
Public Event RedialRequestedEventHandler RedialRequested( Of )
function onRedialRequested(eventArgs){/* Your code */}


callControl.addEventListener("redialRequested", onRedialRequested);
callControl.removeEventListener("redialRequested", onRedialRequested);

Remarks

This class provides access to events that can be monitored and used for modifying the behavior of your telephony-aware app. The following JavaScript code snippet shows how to add event listeners to the CallControl class, and then to respond to one of the events, RedialRequested.

See Also

See Also