🔍 Code Extractor

class Segment

Maturity: 50

Represents a portion of a User-User or User-Meeting communication segment in Microsoft Graph call records, typically corresponding to one segment per VOIP session or multiple segments for PSTN calls.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/callrecords/segment.py
Lines:
5 - 23
Complexity:
simple

Purpose

This class models a communication segment within Microsoft Graph call records API. It encapsulates information about a portion of a call, including the caller and callee endpoints. In VOIP scenarios, there's typically one segment per session, while PSTN calls may have multiple segments due to server-to-server communication requirements. The class inherits from Entity and provides property accessors for retrieving endpoint information from the underlying properties dictionary.

Source Code

class Segment(Entity):
    """Represents a portion of a User-User communication or a User-Meeting communication in the case of a
    Conference call. A typical VOIP call will have one segment per session. In certain scenarios, such as PSTN calls,
    there will be multiple segments per session due to additional server-to-server communication required to connect
    the call."""

    @property
    def callee(self):
        """Endpoint that answered this segment."""
        return self.properties.get("callee", Endpoint())

    @property
    def caller(self):
        """Endpoint that initiated this segment."""
        return self.properties.get("caller", Endpoint())

    @property
    def entity_type_name(self):
        return "microsoft.graph.callRecords.segment"

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

__init__: Inherits constructor from Entity base class. The exact parameters depend on the Entity parent class implementation, but typically accepts properties dictionary or keyword arguments that populate the internal properties storage.

Return Value

Instantiation returns a Segment object. The callee property returns an Endpoint object representing the answering endpoint (defaults to empty Endpoint if not present). The caller property returns an Endpoint object representing the initiating endpoint (defaults to empty Endpoint if not present). The entity_type_name property returns the string 'microsoft.graph.callRecords.segment'.

Class Interface

Methods

@property callee(self) -> Endpoint property

Purpose: Returns the endpoint that answered this segment

Returns: Endpoint object representing the callee, or an empty Endpoint object if not present in properties

@property caller(self) -> Endpoint property

Purpose: Returns the endpoint that initiated this segment

Returns: Endpoint object representing the caller, or an empty Endpoint object if not present in properties

@property entity_type_name(self) -> str property

Purpose: Returns the Microsoft Graph entity type identifier for this segment

Returns: String value 'microsoft.graph.callRecords.segment' identifying the entity type

Attributes

Name Type Description Scope
properties dict Inherited from Entity base class. Dictionary storing the segment's data including caller and callee information instance

Dependencies

  • office365

Required Imports

from office365.communications.callrecords.segment import Segment
from office365.communications.callrecords.endpoint import Endpoint
from office365.entity import Entity

Usage Example

from office365.communications.callrecords.segment import Segment
from office365.communications.callrecords.endpoint import Endpoint

# Typically instantiated from API response data
segment = Segment()

# Access caller endpoint
caller_endpoint = segment.caller
print(f"Caller: {caller_endpoint}")

# Access callee endpoint
callee_endpoint = segment.callee
print(f"Callee: {callee_endpoint}")

# Get entity type name
entity_type = segment.entity_type_name
print(f"Entity type: {entity_type}")

# In practice, segments are usually retrieved from call records
# segment_data = call_record.sessions[0].segments[0]
# caller = segment_data.caller
# callee = segment_data.callee

Best Practices

  • This class is typically instantiated by the office365 library when retrieving call records from Microsoft Graph API, rather than being manually constructed
  • The callee and caller properties return default empty Endpoint objects if the data is not present, so always check if the endpoint has meaningful data before using it
  • The class inherits from Entity, so it has access to all Entity base class methods and the properties dictionary for storing data
  • Use this class in conjunction with Session and CallRecord classes to navigate the complete call hierarchy
  • The entity_type_name property is used internally by the Microsoft Graph API serialization/deserialization mechanism
  • For PSTN calls, expect multiple Segment objects per session representing different legs of the call routing

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class Session 75.3% similar

    Represents a user-user communication or a user-meeting communication session, such as a conference call, in the Office 365 communications system.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/callrecords/session.py
  • class CallRecord 59.7% 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 Participant 58.8% similar

    Represents a participant in a call, providing methods to manage participant state including inviting others, controlling hold music, and accessing participant information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/calls/participant.py
  • class CloudCommunications 57.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 Call 56.1% 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
← Back to Browse