🔍 Code Extractor

class CallCollection

Maturity: 38

CallCollection is a specialized entity collection class for managing Microsoft Teams/Graph API call operations, including creating outgoing calls and logging teleconferencing device quality data.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/calls/collection.py
Lines:
6 - 36
Complexity:
moderate

Purpose

This class provides a high-level interface for managing call-related operations in Microsoft Teams through the Graph API. It extends EntityCollection to handle Call entities specifically, enabling bots to create peer-to-peer or group calls, join meetings, and log video teleconferencing (VTC) device quality metrics. It's particularly useful for Cloud Video Interop (CVI) scenarios where third-party VTC devices need to integrate with Microsoft Teams infrastructure.

Source Code

class CallCollection(EntityCollection):
    def __init__(self, context, resource_path=None):
        super(CallCollection, self).__init__(context, Call, resource_path)

    def create(self, callback_uri):
        """
        Create call enables your bot to create a new outgoing peer-to-peer or group call, or join an existing meeting

        :param str callback_uri: The callback URL on which callbacks will be delivered. Must be https.
        """
        return super(CallCollection, self).add(callbackUri=callback_uri)

    def log_teleconference_device_quality(self, quality=None):
        """
        Log video teleconferencing device quality data.
        The Cloud Video Interop (CVI) bot represents video teleconferencing (VTC) devices and acts as a back-to-back
        agent for a VTC device in a conference call. Because a CVI bot is in the middle of the VTC and Microsoft Teams
        infrastructure as a VTC proxy, it has two media legs. One media leg is between the CVI bot
        and Teams infrastructure, such as Teams conference server or a Teams client. The other media leg is between
        the CVI bot and the VTC device.

        The third-party partners own the VTC media leg and the Teams infrastructure cannot access the quality
        data of the third-party call leg. This method is only for the CVI partners to provide their media quality data.

        :param TeleconferenceDeviceQuality quality : Quality data of VTC media leg.
        """
        qry = ServiceOperationQuery(
            self, "logTeleconferenceDeviceQuality", None, quality
        )
        self.context.add_query(qry)
        return self

Parameters

Name Type Default Kind
bases EntityCollection -

Parameter Details

context: The execution context object that manages API requests, authentication, and communication with the Microsoft Graph API. This context is passed to the parent EntityCollection and used for executing queries.

resource_path: Optional string representing the API resource path for this collection. If not provided, defaults to None and the parent class will determine the appropriate path based on the entity type (Call).

Return Value

The constructor returns a CallCollection instance. The create() method returns a Call entity object representing the newly created call. The log_teleconferencing_device_quality() method returns self (the CallCollection instance) for method chaining.

Class Interface

Methods

__init__(self, context, resource_path=None)

Purpose: Initializes a new CallCollection instance with the provided context and optional resource path

Parameters:

  • context: The execution context for API operations
  • resource_path: Optional API resource path string, defaults to None

Returns: None (constructor)

create(self, callback_uri: str) -> Call

Purpose: Creates a new outgoing peer-to-peer or group call, or joins an existing meeting

Parameters:

  • callback_uri: The HTTPS callback URL where call notifications will be delivered

Returns: A Call entity object representing the newly created call

log_teleconference_device_quality(self, quality=None) -> CallCollection

Purpose: Logs video teleconferencing device quality data for the VTC media leg in CVI scenarios

Parameters:

  • quality: TeleconferenceDeviceQuality object containing quality metrics for the VTC device media leg

Returns: Self (CallCollection instance) for method chaining

Attributes

Name Type Description Scope
context Context The execution context inherited from EntityCollection, used for managing API requests and authentication instance
resource_path str or None The API resource path for this collection, inherited from EntityCollection instance

Dependencies

  • office365

Required Imports

from office365.communications.calls.call import Call
from office365.entity_collection import EntityCollection
from office365.runtime.queries.service_operation import ServiceOperationQuery

Usage Example

# Assuming you have a configured context object with authentication
from office365.communications.calls.call_collection import CallCollection
from office365.graph_client import GraphClient

# Initialize Graph client with credentials
client = GraphClient.with_token(lambda: 'your_access_token')

# Get the calls collection
calls = client.communications.calls

# Create a new outgoing call
callback_url = 'https://your-bot.example.com/callback'
new_call = calls.create(callback_url)
client.execute_query()

# Log teleconference device quality (for CVI scenarios)
from office365.communications.calls.teleconference_device_quality import TeleconferenceDeviceQuality

quality_data = TeleconferenceDeviceQuality()
quality_data.call_chain_id = 'chain-id-123'
quality_data.media_leg_id = 'leg-id-456'

calls.log_teleconference_device_quality(quality_data)
client.execute_query()

Best Practices

  • Always use HTTPS URLs for callback_uri parameter in create() method as required by Microsoft Graph API
  • Ensure proper authentication context is established before creating CallCollection instances
  • Call execute_query() on the context after operations to actually execute the API requests
  • The log_teleconference_device_quality() method is specifically designed for CVI partners and should only be used in VTC proxy scenarios
  • Handle callback notifications asynchronously at the provided callback URI endpoint
  • Implement proper error handling for API calls as network operations may fail
  • The class supports method chaining for log_teleconference_device_quality() by returning self
  • Ensure your application has the necessary Microsoft Graph API permissions before attempting call operations

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class Call 77.0% similar

    Represents a call resource in Microsoft Graph Communications API, managing both incoming and outgoing calls for applications with capabilities for call control, media operations, and participant management.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/calls/call.py
  • class OnlineMeetingCollection 71.4% similar

    A collection class for managing Microsoft Graph OnlineMeeting entities, providing methods to create and retrieve online meetings.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/onlinemeetings/collection.py
  • class CallRecord 64.6% similar

    Represents a single peer-to-peer call or a group call between multiple participants in Microsoft 365, sometimes referred to as an online meeting.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/callrecords/call_record.py
  • class CloudCommunications 64.3% similar

    CloudCommunications is a class that provides access to Microsoft Graph API cloud communications resources including calls, call records, online meetings, and user presence information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/cloud_communications.py
  • class PlannerPlanCollection 63.6% similar

    A collection class for managing Microsoft Planner Plan entities, providing methods to create and manage multiple PlannerPlan objects within a Microsoft Graph API context.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/plans/collection.py
← Back to Browse