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 in ANSWERED state. If the local call channel state is IDLE, this function will raise a Hangup exception; otherwise, if the local call state is not ANSWERED it will raise an Error exception. If the other_call state is not ANSWERED 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() and get_digits(); however, they may not use transmitter functions such as play() or play_dtmf(). Additionally, a call channel may not connect 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")