CallControl CallControl CallControl Class

Definition

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

public sealed class CallControl : ICallControlpublic sealed class CallControl : ICallControlPublic NotInheritable Class CallControl Implements ICallControl
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

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

public bool HasRinger { get; }public bool HasRinger { get; }Public ReadOnly Property HasRinger As bool
Value
bool bool bool

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

Attributes

Methods

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

Ends the specified call.

public void EndCall(UInt64 callToken)public void EndCall(UInt64 callToken)Public Function EndCall(callToken As UInt64) As void
Parameters
callToken
System.UInt64 System.UInt64 System.UInt64

The unique identifier of the specified call.

Attributes

Remarks

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

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(String deviceId)public static CallControl FromId(String deviceId)Public Static Function FromId(deviceId As String) As CallControl
Parameters
deviceId
System.String System.String System.String

The DeviceInformation ID of the specified audio communications device.

Returns

A class that represents the specified audio communications device.

Attributes

Remarks

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

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
Returns

A class that represents the default audio communications device.

Attributes

Remarks

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

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

Indicates that the specified call is now active.

public void IndicateActiveCall(UInt64 callToken)public void IndicateActiveCall(UInt64 callToken)Public Function IndicateActiveCall(callToken As UInt64) As void
Parameters
callToken
System.UInt64 System.UInt64 System.UInt64

The unique identifier of the specified call.

Attributes

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

Informs the device that there is an incoming call.

public ulong IndicateNewIncomingCall(Boolean enableRinger, String callerId)public ulong IndicateNewIncomingCall(Boolean enableRinger, String callerId)Public Function IndicateNewIncomingCall(enableRinger As Boolean, callerId As String) As ulong
Parameters
enableRinger
System.Boolean System.Boolean System.Boolean

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

callerId
System.String System.String System.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

A call token that uniquely identifies this call.

Attributes

IndicateNewOutgoingCall() IndicateNewOutgoingCall() IndicateNewOutgoingCall()

Updates device indicators to indicate an outgoing call.

public ulong IndicateNewOutgoingCall()public ulong IndicateNewOutgoingCall()Public Function IndicateNewOutgoingCall() As ulong
Returns
ulong ulong ulong

A call token that uniquely identifies this call.

Attributes

Remarks

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

Events

AnswerRequested AnswerRequested AnswerRequested

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

public event CallControlEventHandler AnswerRequestedpublic event CallControlEventHandler AnswerRequestedPublic Event AnswerRequested
Attributes

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.

AudioTransferRequested AudioTransferRequested AudioTransferRequested

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

public event CallControlEventHandler AudioTransferRequestedpublic event CallControlEventHandler AudioTransferRequestedPublic Event AudioTransferRequested
Attributes

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.

DialRequested DialRequested DialRequested

Occurs when a number is dialed from the device.

public event DialRequestedEventHandler DialRequestedpublic event DialRequestedEventHandler DialRequestedPublic Event DialRequested
Attributes

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.

HangUpRequested HangUpRequested HangUpRequested

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

public event CallControlEventHandler HangUpRequestedpublic event CallControlEventHandler HangUpRequestedPublic Event HangUpRequested
Attributes

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

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

public event KeypadPressedEventHandler KeypadPressedpublic event KeypadPressedEventHandler KeypadPressedPublic Event KeypadPressed
Attributes

RedialRequested RedialRequested RedialRequested

Occurs when the device receives a request to redial.

public event RedialRequestedEventHandler RedialRequestedpublic event RedialRequestedEventHandler RedialRequestedPublic Event RedialRequested
Attributes

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