answerΒΆ

class UASCallChannel
answer(codecs=None)

Answer a call.

Optional arguments:
  • codecs

    the codecs to offer on this call. Default is None (use the default).

The list of codecs offered by the incoming call can be retrieved by looking at Details after an incoming call has been detected. One or more of these codecs can be chosen and offered here in a semi-colon delimited list (in priority order) of codec names; for example, g711a;g711u.

This function should be called when the call state is CALL_INCOMING or RING_INCOMING. If, when the function is called, the call state is IDLE, it will raise a Hangup exception; otherwise, if called whilst in an inappropriate state, this function will raise an Error exception.

This function will block until the call is in the ANSWERED state (which is normally only an extremely short delay), a timeout has been reached, or the call state has returned to IDLE. If the call does timeout, the call will be abandoned. If the call state returns to IDLE, a Hangup exception will be raised.

This function will return the current call state.

Usage example:

state = channel.answer() # answer the call
if state != channel.State.ANSWERED:
    raise Hangup('state is {0}'.format(state))