connectΒΆ
- class UASCallChannel
- connect(other_call)
Connect two calls together.
- Required argument:
- other_call
an instance of the call channel to which to connect.
This function is used to invoke a full-duplex connection between the lines owned by two active calls.
The argument
other_call
is an instance of the call channel being connected to the current call. For connect to succeed both channels must be inANSWERED
state. If the local call channel state isIDLE
, this function will raise aHangup
exception; otherwise, if the local call state is notANSWERED
it will raise anError
exception. If theother_call
state is notANSWERED
this function will return False.When connected in this manner, the call channels will return the connected call channel ID in the
Details
property:connected_id = channel.Details.connected_id
.Once connected, the two call channels should be kept alive since quitting either of them will break the connection between the two calls.
While the call channels are connected they are permitted to use receiver functions such as
record()
andget_digits()
; however, they may not use transmitter functions such asplay()
orplay_dtmf()
. Additionally, a call channel may notconnect
if it is part of a conference or if it has been added to a music on hold resource.If this function is called while either the local or the remote call channel is already transmitting or connected; or if it has already been added to a conference or music on hold; it will raise an
Error
exception.This function will block until confirmation has been received that the call channels are connected, or that the connection has failed, or the timeout has expired.
This function will return True if successful, otherwise False.
Usage example:
if channel.connect(channel2) is False: print("could not connect the calls")