wait for outgoing callΒΆ

class UASCallChannel
wait_for_outgoing_call(seconds_timeout=120, return_on_ringing=False)

Wait for an outbound call to be answered.

Optional arguments:
  • seconds_timeout

    time allocated to wait for the ANSWERED state. Default is 120 seconds.

  • return_on_ringing

    if True, this function will return when the call is in the RING_OUTGOING state, otherwise it will wait until it is connected.

This is the function used to wait for an outbound call, which was started using the start_call function, to go to the ANSWERED or RING_OUTGOING (if return_on_ringing is True) state.

This function will block until the call has been connected, the timeout has been reached, or the call state has returned to IDLE. If seconds_timeout is None, this function will not time out.

This function should be called when the call state is CALL_OUTGOING, however, it is also safe to call it if the state is ANSWERED or RING_OUTGOING; if the state is IDLE this function will raise a Hangup exception; any other state will cause this function to raise an Error exception.

This function will return the current call state.

Usage example:

if channel.start_call('sip:3301@127.0.0.1:5060;user=phone') is True:
    # do some other processing
if channel.wait_for_outgoing_call() != channel.State.ANSWERED:
    # not answered, could be timeout or IDLE
    pass