CallControl CallControl CallControl CallControl Class

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

Syntax

Declaration

public sealed class CallControlpublic sealed class CallControlPublic NotInheritable Class CallControlpublic sealed class CallControl

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 summary

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

Methods summary

Ends the specified call.

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

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

Indicates that the specified call is now active.

Informs the device that there is an incoming call.

Updates device indicators to indicate an outgoing call.

Events summary

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

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

Occurs when a number is dialed from the device.

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

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

Occurs when the device receives a request to redial.

Properties

  • HasRinger
    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 boolpublic bool HasRinger { get; }

    Property Value

    • bool
      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(UInt64 callToken)public void EndCall(UInt64 callToken)Public Function EndCall(callToken As UInt64) As voidpublic void EndCall(UInt64 callToken)

    Parameters

    • callToken
      System.UInt64
      System.UInt64
      System.UInt64
      System.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 Id being passed.

    public static CallControl FromId(String deviceId)public static CallControl FromId(String deviceId)Public Static Function FromId(deviceId As String) As CallControlpublic static CallControl FromId(String deviceId)

    Parameters

    • deviceId
      System.String
      System.String
      System.String
      System.String

      The Id of the specified audio communications device.

    Returns

    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 CallControlpublic static CallControl GetDefault()

    Returns

    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(UInt64 callToken)public void IndicateActiveCall(UInt64 callToken)Public Function IndicateActiveCall(callToken As UInt64) As voidpublic void IndicateActiveCall(UInt64 callToken)

    Parameters

    • callToken
      System.UInt64
      System.UInt64
      System.UInt64
      System.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(Boolean enableRinger, String callerId)public ulong IndicateNewIncomingCall(Boolean enableRinger, String callerId)Public Function IndicateNewIncomingCall(enableRinger As Boolean, callerId As String) As ulongpublic ulong IndicateNewIncomingCall(Boolean enableRinger, String callerId)

    Parameters

    • enableRinger
      System.Boolean
      System.Boolean
      System.Boolean
      System.Boolean

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

    • callerId
      System.String
      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
      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 ulongpublic ulong 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 AnswerRequestedpublic event CallControlEventHandler AnswerRequestedPublic Event AnswerRequestedpublic event CallControlEventHandler AnswerRequested

    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
    AudioTransferRequested

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

    public event CallControlEventHandler AudioTransferRequestedpublic event CallControlEventHandler AudioTransferRequestedPublic Event AudioTransferRequestedpublic event CallControlEventHandler AudioTransferRequested

    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
    DialRequested

    Occurs when a number is dialed from the device.

    public event DialRequestedEventHandler DialRequestedpublic event DialRequestedEventHandler DialRequestedPublic Event DialRequestedpublic event DialRequestedEventHandler DialRequested

    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
    HangUpRequested

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

    public event CallControlEventHandler HangUpRequestedpublic event CallControlEventHandler HangUpRequestedPublic Event HangUpRequestedpublic event CallControlEventHandler HangUpRequested

    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 KeypadPressedpublic event KeypadPressedEventHandler KeypadPressedPublic Event KeypadPressedpublic event KeypadPressedEventHandler KeypadPressed
  • RedialRequested
    RedialRequested
    RedialRequested
    RedialRequested

    Occurs when the device receives a request to redial.

    public event RedialRequestedEventHandler RedialRequestedpublic event RedialRequestedEventHandler RedialRequestedPublic Event RedialRequestedpublic event RedialRequestedEventHandler RedialRequested

    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.

Device family

Windows Desktop Extension SDK (introduced v10.0.10240.0)

API contract

Windows.Media.Devices.CallControlContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Media.Devices.dll