(not logged in)
 
 
 
 

Outbound Connect

Filename:


Description:


An outbound application that makes calls to two destination addresses and connects them together. The destination addresses are supplied in the outbound_parameters variable, using the semi-colon (;) as a delimiter. This application also requires one extra channel.

First the two call destination addresses are extracted from outbound_parameters using Python's split() function. Then the extra channel is retrieved from the channel.ExtraChannel list. Extra channels are set on the Inbound and Outbound Services pages.

The application places two calls and the calling code has been put in a function called _place_call, which takes a channel, destination address and call_from as parameters. The call_from variable identifies the calling party and its value is taken from application_parameters which is configured on the Outbound Services page.

The first outbound call is placed and, if successful, TTS is used to ask the user to speak a message after the beep. To create a beep, a DTMF tone is played using the channel.DTMFPlayer.play() function. The message is recorded and then the caller is asked to hold while the system calls the second destination..

The extra channel is used to call the second destination and the recorded message from the first call is played using the channel.FilePlayer.start() function which does not block. This allows the application to use TTS to tell the first caller that his message is being played.

Once the message has been played, the application joins the two calls together using the channel.connect() function, this allows the two calls to communicate with each other. The application then waits for either party to hang up, using the channel.state() function on each channel.

In this application we extract two call destination addresses from the outboundParameters argument using the String.split() method and then ensure we have at least one extra channel available. This will allow us to make one outbound call on the primary channel (the channel argument) and one outbound call on an extra channel.

If either of the destination addresses are PSTN numbers then the source address (caller Id) that is passed into the application via the applicationParameters argument may be set to a PSTN number (see the outbound calls page on your platform).

We call the first destination address on the primary channel using the channel.call() method and when answered, we use TTS to ask the callee to record a message that will ultimately be played to the second callee. We can record a message using the channel.getFileRecorder().start() method. This requires a filename as a parameter to identify where to store the recorded data. To play a message prompt, we use the channel.getDtmfPlayer().play() method. We wait for silence from the other end for a couple of seconds before ending the recording.

We then call the second destination address on one of the extra channels and when answered, we play the previously recorded message to the second callee. Then we use TTS to notify both callees that they are being connected and use the connect() method to connect both calls together bidirectionally. To wait for either caller to hangup, we use the channel.waitForIdle() method.

In this application we extract two call destination addresses from the outboundParameters argument using the String.Split() method and then ensure we have at least one extra channel available. This will allow us to make one outbound call on the primary channel (the channel argument) and one outbound call on an extra channel.

If either of the destination addresses are PSTN numbers then the source address (caller Id) that is passed into the application via the applicationParameters argument may be set to a PSTN number (see the outbound calls page on your platform).

We call the first destination address on the primary channel using the channel.Call() method and when answered, we use TTS to ask the callee to record a message that will ultimately be played to the second callee. We can record a message using the channel.FileRecorder.Start() method. This requires a filename as a parameter to identify where to store the recorded data. To play a message prompt, we use the channel.DTmfPlayer.Play() method. We wait for silence from the other end for a couple of seconds before ending the recording.

We then call the second destination address on one of the extra channels and when answered, we play the previously recorded message to the second callee. Then we use TTS to notify both callees that they are being connected and use the Connect() method to connect both calls together bidirectionally. To wait for either caller to hangup, we use the channel.WaitForIdle() method.

In this application we extract two call destination addresses from the outboundParameters argument using the String.Split() method and then ensure we have at least one extra channel available. This will allow us to make one outbound call on the primary channel (the channel argument) and one outbound call on an extra channel.

If either of the destination addresses are PSTN numbers then the source address (caller Id) that is passed into the application via the applicationParameters argument may be set to a PSTN number (see the outbound calls page on your platform).

We call the first destination address on the primary channel using the channel.Call() method and when answered, we use TTS to ask the callee to record a message that will ultimately be played to the second callee. We can record a message using the channel.FileRecorder.Start() method. This requires a filename as a parameter to identify where to store the recorded data. To play a message prompt, we use the channel.DTmfPlayer.Play() method. We wait for silence from the other end for a couple of seconds before ending the recording.

We then call the second destination address on one of the extra channels and when answered, we play the previously recorded message to the second callee. Then we use TTS to notify both callees that they are being connected and use the Connect() method to connect both calls together bidirectionally. To wait for either caller to hangup, we use the channel.WaitForIdle() method.

In this application we first ensure we have at least one extra channel available. Then we extract two call destination addresses from the outboundParameters argument using the String.Split() method. This will allow us to make one outbound call on the primary channel (the channel argument) and one outbound call on an extra channel.

If either of the destination addresses are PSTN numbers then the source address (caller Id) that is passed into the application via the applicationParameters argument may be set to a PSTN number (see the outbound calls page on your platform). You can set this in the Application Parameters field of the Outbound Service that runs this application. In the application this is checked using the recursive member function ContainsPSTNAddress().

We call the first destination address on the primary channel using the channel.Call() method and when answered, we use TTS to ask the callee to record a message that will ultimately be played to the second callee. We can record a message using the channel.FileRecorder.Start() method. This requires a filename as a parameter to identify where to store the recorded data. To play a message prompt, we use the channel.DTmfPlayer.Play() method. We wait for silence from the other end for a couple of seconds before ending the recording.

We then call the second destination address on one of the extra channels and when answered, we play the previously recorded message to the second callee. Then we use TTS to notify both callees that they are being connected and use the Connect() method to connect both calls together bidirectionally. To wait for either caller to hangup, we use the channel.WaitForIdle() method.

Code: