Event Handling
The SDK provides two mechanisms for handling events: decorator-based handlers for discrete events, and async iterators for continuous audio streams.
Decorator-based Events
Use decorators for discrete, one-time events:
Available Events
Client-level events are registered on the TelcoflowClient instance and fire for any call.
Call-level events are registered on a specific ActiveCall instance and fire only for that call.
Async Iterators
Use async iterators for continuous audio streams:
The iterator yields audio chunks as they arrive. It terminates when the call ends or the media connection closes.
Combining Events and Streams
A typical pattern combines a call-level event with the audio stream:
The public 0.24.0 package docs also mention ClientEvent and CallEvent enums as type-safe alternatives to the string constants in telcoflow_sdk.events.
Next Steps
- Call States - See which events correspond to which state transitions
- Call Commands - Commands that trigger state changes
- API Reference - Full method signatures for event registration
