Each call channel provides all call and media processing for a single call. Each application is provided with a single call channel. The call channel that is given to the application will be modified to be appropriate to the “direction” of that particular application. So a call channel that is given to an inbound application will not have the functionality for making outbound calls. Please see the applications section for more information on this.
Since a call channel object (just like other Python objects) is just a reference to that object, it can be passed around, copied, put into queues, and used in a variety of ways by different threads; however, sensible measures must be taken to coordinate access to the object to avoid unexpected behaviour.
Access to media functionality is provided via the following public properties:
- Details: to retrieve the call details.
- DTMFPlayer: to play DTMF digits.
- DTMFDetector: to retrieve DTMF digits that have been detected.
- FilePlayer: to play a WAV file.
- FileRecorder: to record a WAV file.
- SpeechDetector: to perform automatic speech recognition.
- FaxSender: to send a fax.
- FaxReceiver: to receive a fax.
- SIP: to work with SIP Headers.
The call and media (play, record, detect, etc) controls maintain various states and causes. Some functions return a relevant “cause” or “state”, others return True or False. If a function returns False, the cause can be retrieved by calling the appropriate cause() function. For instance, if a player state becomes IDLE to indicate that play has stopped, the cause could be BARGEIN to indicate that it stopped because a DTMF digit was detected.
Please see the tutorial for examples on how to use the channel class and its public properties.