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
ANSWEREDstate. Default is 120 seconds.
- return_on_ringing
if
True, this function will return when the call is in theRING_OUTGOINGstate, 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_callfunction, to go to theANSWEREDorRING_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. Ifseconds_timeoutis 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 isANSWEREDorRING_OUTGOING; if the state isIDLEthis function will raise aHangupexception; any other state will cause this function to raise anErrorexception.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