What is the Events Manager
The Events Manager consumes realtime events during conversations - it provides a framework to consume and take action on these events asychronously.Current Event Types
The current event types include:TRANSCRIPT: Indicates a partial transcript for the conversation has been received.TRANSCRIPT_COMPLETE: Indicates the transcript is complete (ie conversation has ended).ACTION: Indicates that a Vocode action has begun or completed.PHONE_CALL_CONNECTED: Indicates a phone call has been connected (only gets sent duringPhoneConversations)PHONE_CALL_ENDED: Indicates a phone call has ended.
Usage
Using the events manager to take particular action when events fire requires that you subclassvocode.streaming.utils.EventsManager and override the handle_event method.
You can also configure which events your EventsManager is subscribed to by using the subscriptions property (see example).
Example
EventsManager subclass is created with a subscription to the TRANSCRIPT_COMPLETE event and then print the transcript when we receive the event.
To use CustomEventsManager, you can pass it into any Conversation, e.g.
TelephonyServer, like:
