class Segment
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.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/callrecords/segment.py
5 - 23
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
-
class CallRecord 59.7% similar
-
class Participant 58.8% similar
-
class CloudCommunications 57.3% similar
-
class Call 56.1% similar