transfer to inbound service¶
- class UASCallChannel
- transfer_to_inbound_service(other_call, call_to, call_from='', ringback_tone=None, seconds_timeout=120)
Perform a retrievable transfer to an inbound service.
- Required argument:
- other_call
the call channel instance to be used for the outbound leg.
- call_to
the name of an inbound service registered on your inbound services page.
- Optional arguments:
- call_from
The remote address of the call being transferred.
- ringback_tone
the ringback tone to play when the outbound leg is ringing. Default is RINGBACK.
- seconds_timeout
the amount of time to allow for the transfer to be accomplished. Default is 120 seconds. None means no timeout.
This function is used to transfer a connected call channel to one of your existing inbound services. This function will allow the application to retain control over the call channel and retrieve it when the transfer is no longer required - for example, when the far end hangs up.
The argument
other_call
is the call channel instance used for the transfer’s outbound leg. This call channel must be in theIDLE
state.An originating address
call_from
may be supplied. Setting this parameter to an empty string will result in a default value being used.This channel must be in
ANSWERED
state. If it isIDLE
, this function will raise aHangup
exception; otherwise, if it is notANSWERED
it will raise anError
exception.The argument
ringback_tone
is the ringback tone to play when the outbound call channel is in theRING_OUTGOING
state. Valid options forringback_tone
are listed in the server’s ToneManager resource. Ifringback_tone
isNone
a default tone will be used. For the channel to play a tone it must have a tone player object. It is essential that a tone player is created on the channel before a transfer is attempted.The argument
seconds_timeout
is the amount of time allowed for the transfer to be completed. If the timeout is None, no time limit will be imposed.When successfully transferred in this manner, this call channel will be in the
TRANSFERRED
state.If unsuccessful, the cause of the failure can be retrieved from transfer_cause() function.
After the transfer has completed successfully, this channel cannot be used to play or record audio (the audio path is no longer available, it has been transferred), it can be used only to hang up the call or to call either the retrieve_transferred_call function or the wait_for_transferred_call_retrieval function.
This function will block until confirmation has been received that the channel has been transferred, or that the transfer request has failed, or a timeout has expired.
This function will return the channel state.
Usage example:
state = channel.transfer_to_inbound_service(other_call, 'MyVoicemailRecorder') if state != channel.State.TRANSFERRED: cause = channel.transfer_cause() print("could not transfer the call, reason is {0}".format(cause))