CallManager and Call

class obelus.ami.CallManager(ami)

A CallManager helps you originate calls and track the status of those calls using an AMI instance.

originate(call, headers, variables=None)

Originate a call with the given headers (and, optionally, call-specific variables). call should be a Call instance.

queued_calls()

Return a set of all queued calls.

setup_event_handlers()

Setup the AMI event handlers required for call tracking. This is implicitly called on __init__().

setup_filters()

Setup server-side AMI event filters tailored for this CallManager, in order to limit resource consumption in the AMI protocol.

Calling this method is not required for proper functioning, but recommended if your Asterisk receives a lot of traffic and generates a lot of AMI events by default.

This method only relies on whitelisting, you can therefore setup more server-side filters if you are interested in other events.

tracked_calls()

Return a set of currently tracked calls (i.e. queued and successfully originated). This is a subset of queued_calls().

class obelus.ami.Call

Base class for call objects tracked by the CallManager. It is recommended you subclass this class and override the various event handlers.

call_ended(cause, cause_desc)

Called when the call ends. cause is the numeric cause sent by Asterisk, cause_desc its textual description.

call_failed(exc)

Called when a call fails early. This either means the Originate command was rejected, or a failed OriginateResponse event was received just after the command was accepted.

call_queued()

Called when a call is queued (i.e. when the Originate command is accepted).

call_state_changed(state, state_desc)

Called when a call has its state changed. state is the new numeric state, state_desc its textual description.

dialing_finished(status)

Called when dialing the call has finished with the given status.

dialing_started()

Called when dialing the call has started.

unique_ids()

Get the alive channels related this call. Return a list of unique ids.