# AP2 signaling

The AP2 TCP implements the specifications of the Telstra CAS protocol P2. This protocol is widely used in Australia to connect PBXs to the PSTN, for Telstra and other carriers.

The Australian P2 protocol uses the line signaling scheme specified by the CCITT for the MFC-R2 protocol (Recommendation Q.421). Two bits are used for each direction. The signaling channels supporting the line signaling of these protocols are referred to as Af and Bf in the forward direction, and Ab and Bb in the backward direction. The forward channel indicates the condition of the outbound switch equipment and reflects the condition of the calling party's line. The backward channel indicates the condition of the called party's line (the inbound equipment). The C and D bits are never used. Their value is fixed at 0 and 1 respectively.

The following table describes the signaling states of a typical call:

State | Outbound AfBf | Direction | Inbound AbBb
--- | --- | --- | ---
Idle | 10 |  | 10
Seizure | 00 |  | 10
Seizure acknowledged | 00 |  | 11
The outbound side sends the address information using in-band DTMF tones or decadic pulses. If decadic pulses are used, the Af bit pulses on and off to signal the address digits. If, after all the address information has been transferred, the inbound side accepts the call, it plays a ring tone on the line, and then signals that the call has been answered by setting the Ab bit to 0.
Ringing | 00 |  | 11
Answer - conversation state | 00 |  | 01
If the inbound side rejects the call, the outbound side clears forward by setting the Af bit to 1. The inbound side goes back to idle by setting the Bb bit to 0.
Clear forward | 10 |  | 11
Idle | 10 |  | 10
During conversation the outbound protocol can receive billing pulses to signal that a unit of cost has been billed to the call. The bit used to carry a billing pulse depends on national specifications.
Answer - conversation state | 00 |  | 01
Billing pulses | 00 |  | 11 or 00
Answer - conversation state | 00 |  | 01
Depending on which side hangs up the call first, either a clear back signal or a clear forward signal is generated. Depending on national specifications, there might be a period of time during which the inbound side holds a release guard state, which is the same as clear back but happens when the outbound side is already in the idle state. Idle follows.
Inbound hangs up first: Clear back | 00 |  | 11
Clear forward | 10 |  | 11
Idle | 10 |  | 10
Outbound hangs up first: Clear forward | 10 |  | 01
Release guard | 10 |  | 11
Idle | 10 |  | 10

The AP2 protocol uses either in-band DTMF tones or out-of-band decadic pulses to transfer register signaling information.

This protocol transfers only DID (direct inward dialing - the called address) information. To do this, the outbound side sends either a stream of DTMF tones or a sequence of decadic pulses to the inbound side, then considers the dialing done and waits for some confirmation from the inbound side. This register signaling technique, in which the outbound side has no acknowledgment from the inbound side until the dialing is finished, is called digit spill.