The TDM sample application uses three different state tables, and one custom server.
TromboneIn answers the customer’s call and prompts the customer to enter a telephone number. When the customer has entered the number, TromboneIn makes a request to the custom server to dial the number on a second channel, and when the call is answered, to make a TDM connection between the two channels. TromboneIn then waits for completion of this custom server request. When the custom server confirms that it has completed this request, TromboneIn invokes the TromboneMonitor state table (described later) to monitor activities of the calling party.
TromboneOut is invoked by the custom server dial the telephone number specified by the customer. The number is passed to TromboneOut by parameter. TromboneOut uses a MakeCall action to select a free outgoing channel and dial the telephone number. The MakeCall action completes either when the call is answered by the called party, or when the call fails, for example because the number is invalid or busy, or there are no outbound lines available. On completion of the MakeCall action, TromboneOut notifies the custom server of the outcome of the call attempt, and then invokes the TromboneMonitor state table to monitor subsequent activities of the called party.
TromboneMonitor monitors one channel for DTMF keys, caller hangup events, or asynchronous channel events from the custom server. If a caller presses a DTMF key, the name of the key is announced to the caller; this feature does not serve any real purpose, but demonstrates how a real application could use DTMF keys to invoke service features. In this application, custom server channel events are used to report that the other party has hung up, so when TromboneMonitor receives such an event, it plays a brief message to the caller on this channel, then exits. If the party on this channel hangs up, the state table exits.
TromboneCS is a custom server which manages the relationships between different channels, including making and breaking TDM connections between them. TromboneCS provides two user functions which may be used by state tables, and one system function:
TromboneCS uses these three functions as events in a state machine which coordinates the making of the trombone connection between the two parties, and breaking that connection when one of the parties hangs up. Figure 1 summarises the steps involved in making and breaking the connection.