class StopHoldMusicOperation
A class representing the status of a stopHoldMusic operation in Microsoft 365 communications, used to track the result of stopping hold music during a call.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/operations/stop_hold_music.py
4 - 7
simple
Purpose
This class serves as a status container for stopHoldMusic operations in the Microsoft 365 Communications API. It inherits from CommsOperation and is used to represent and track the asynchronous operation triggered when stopping hold music on an active call. The class encapsulates the operation's state, allowing developers to monitor whether the hold music has been successfully stopped.
Source Code
class StopHoldMusicOperation(CommsOperation):
"""
Represents the status of a stopHoldMusic operation, triggered by a call to the stopHoldMusic API.
"""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
CommsOperation | - |
Parameter Details
__init__: The constructor parameters are inherited from the parent CommsOperation class. Typically includes operation identifiers, status information, and metadata related to the communications operation.
Return Value
Instantiation returns a StopHoldMusicOperation object that represents the status of a stopHoldMusic API call. The object provides access to operation status, completion state, and any error information through inherited methods and properties from CommsOperation.
Class Interface
Methods
__init__(self, *args, **kwargs)
Purpose: Initializes a StopHoldMusicOperation instance, inheriting initialization from CommsOperation parent class
Parameters:
args: Positional arguments passed to parent CommsOperation constructorkwargs: Keyword arguments passed to parent CommsOperation constructor, typically including operation metadata
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
status |
str | The current status of the stop hold music operation (inherited from CommsOperation), typically values like 'running', 'completed', 'failed' | instance |
id |
str | Unique identifier for this operation instance (inherited from CommsOperation) | instance |
error |
object | Error information if the operation failed (inherited from CommsOperation) | instance |
Dependencies
office365
Required Imports
from office365.communications.operations.comms import CommsOperation
from office365.communications.operations.stop_hold_music import StopHoldMusicOperation
Usage Example
from office365.communications.operations.stop_hold_music import StopHoldMusicOperation
from office365.graph_client import GraphClient
# Authenticate with Microsoft Graph
client = GraphClient.with_client_secret(tenant_id, client_id, client_secret)
# Assuming you have an active call object
call_id = 'your-call-id'
call = client.communications.calls[call_id]
# Stop hold music and get operation status
operation = call.stop_hold_music()
# The operation object is a StopHoldMusicOperation instance
if isinstance(operation, StopHoldMusicOperation):
# Check operation status
if operation.status == 'completed':
print('Hold music stopped successfully')
elif operation.status == 'failed':
print(f'Failed to stop hold music: {operation.error}')
Best Practices
- This class is typically instantiated by the Microsoft Graph SDK internally when calling stopHoldMusic() on a call object, rather than being directly instantiated by developers
- Always check the operation status before assuming the hold music has been stopped successfully
- Handle potential errors and failed states appropriately in production code
- The operation may be asynchronous, so poll the status or use callbacks to determine when the operation completes
- Ensure proper authentication and permissions are configured before attempting to stop hold music
- This operation should only be called when hold music is currently playing on an active call
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class StartHoldMusicOperation 92.3% similar
-
class UpdateRecordingStatusOperation 65.8% similar
-
class Participant 61.9% similar
-
class CancelMediaProcessingOperation 61.4% similar
-
class CommsOperation 60.8% similar