For the digital version of MFC/R2 (defined in ITU-T Q.421), the digital line signals are the ABCD bits of the channel associated signaling (CAS) in timeslot 16 of an E1.
They represent the states of the line, and are similar to the states of an analog line. In general, only bits A and B are used. In most systems bits C and D are set to fixed values, and never change. There are some national variants where bit C or D may be used for metering pulses.
Table 1.1. Forward line signals
Table 1.2. Backward line signals
Below is a table describing the bit patterns and related state changes used in R2 signalling via the CAS AB bits.
Table 2 : CAS AB bits and corresponding circuit states (source: ITU-T Q.421/Table 1)
|Circuit State||Forward Signal
(Caller's AB bits)
(Callee's AB bits)
|Clear Forward (before clear back)||10||01|
|Clear Forward (after clear back)||10||11|
- As you move vertically down the table columns the exclusive change of a single AB value on either the caller's or callee's end indicates transition to a new state.
- The table indicates that a circuit state change occurs when the codeword from either the Forward or Backward device changes one of its AB bits.
- An important note is that once in an idle state you can either transition to a seized state (indicative of a call taking place) or to a blocked state.
- Actual binary values transmitted will be AB * 4 + 1 (since CD = 01 always in the nibble)
Basic Call Flow
The following call scenario is based on examples in the ITU specification. This scenario demonstrates a call where the called party answers and releases the call.
Caller Switch A [MFC/R2 signaling] Switch B Called party <------------ Idle [0x08]-------->
- In the call flow diagram above there is no transfer of the caller ID.
- Around the world things may vary quite a bit from this call scenario. For example, the busy tone is shown as being generated from the caller's local switch. In some systems it is generated from the called party's local switch. The signals used for various purposes are often different. The signaling between the switches and the telephones could be by DTMF or pulse dialling on an analogue pair (FXO/FXS signalling). It could be ISDN signalling, over a BRI connection. It could be a VoIP connection. The actual signals passing between the switches and the telephone will be similar in most cases, and details do not affect the overall discussion of how MFC/R2 works.
WANPIPE: Debugging call sequences and events
1) First open a terminal and follow the kernel messages being printed
|tail -f /var/log/messages|
2) Tell wanpipe to print a D-channel snapshot to the kernel (do this in a separate window so you can keep an eye on kernel messages)
|wanpipemon -i wg1g1 -c dpr|
You will notice in your kernel messages window that you get the output
|Apr 13 16:18:25 pbx kernel: wanpipe1: 11111111112222222222333
Apr 13 16:18:25 pbx kernel: wanpipe1: 12345678901234567890123456789012
Apr 13 16:18:25 pbx kernel: wanpipe1: --------------------------------
Apr 13 16:18:25 pbx kernel: wanpipe1: TX A: 11111110110000000000000000000000
Apr 13 16:18:25 pbx kernel: wanpipe1: TX B: 00000001000000000000000000000000
Apr 13 16:18:25 pbx kernel: wanpipe1: TX C: 00000000000000000000000000000000
Apr 13 16:18:25 pbx kernel: wanpipe1: TX D: 11111111110000000000000000000000
Apr 13 16:18:25 pbx kernel: wanpipe1:
Apr 13 16:18:25 pbx kernel: wanpipe1: RX A: 01111111011000000000000000000000
Apr 13 16:18:25 pbx kernel: wanpipe1: RX B: 00000000000111110111111111111111
Apr 13 16:18:25 pbx kernel: wanpipe1: RX C: 00000000000000000000000000000000
Apr 13 16:18:25 pbx kernel: wanpipe1: RX D: 01111111111111110111111111111111
This is a snapshot of a single E1, D-channel frame which shows the ABCD bits for all channels.
This output is not extremely useful since it only shows us the current state of all channels at one point in time.
We are more interested in the change in a given channel's ABCD bits over time. Changes in the CAS bits indicate circuit state changes as shown in Table 1 above.
It is however good to note from this output that both the Forward and Backward machines are transmitting the value AB = 10 which tells us that both ends if the circuit are in an idle state.
3) Enable RBS bit change messaging for Received (Rx) and Transmitted (Tx) bits
|wanpipemon -i <interface name> -c derr
wanpipemon -i <interface name> -c dert
4) Try making an inbound call to the PBX of interest
The asterisk CLI will display the following in response to this incoming call:
|New MFC/R2 call detected on chan 3.
MFC/R2 call offered on chan 3. ANI = , DNIS = 5, Category = National Priority Subscriber
MFC/R2 call has been accepted on backward channel 3
The kernel messages window should output something like the following (note that all activity takes place on channel 3):
|Apr 16 07:31:48 pbx kernel: wanpipe1: E1:3 RX RBS A:0 B:0 C:0 D:1
Apr 16 07:31:48 pbx kernel: wanpipe1: E1:3 TX RBS A:1 B:1 C:0 D:1
Apr 16 07:31:49 pbx kernel: wanpipe1: E1:3 TX RBS A:0 B:1 C:0 D:1
Step by step, using Table 1 we can interpret the circuit state changes as follows:
NOTE* here we interpret the messages from RX and TX as the messages that our PBX system receives and transmits respectively (i.e. in this case RX is the Forward machine and TX is the Backward).
|RX: AB = 00||Call seized by Forward (i.e. the caller / system that's calling us)|
|TX : AB = 11||Seizure acknowledged by Backward (i.e. the callee / system being called into)|
|TX: AB = 01||Call is answered by Backward|
5) Hangup the call from the caller end
The asterisk CLI will display the following in response to the hangup:
|MFC/R2 call disconnected on channel 3
MFC/R2 call end on channel 3
-- Hungup 'DAHDI/3-1'
The kernel messages window should output:
|Apr 16 07:32:19 pbx kernel: wanpipe1: E1:3 RX RBS A:1 B:0 C:0 D:1
Apr 16 07:32:19 pbx kernel: wanpipe1: E1:3 TX RBS A:1 B:0 C:0 D:1
Step by step, we can again use Table 1 to interpret the circuit state changes as follows:
|RX: AB = 10||Clear Forward (before clear back) by Forward, since the Backward machine was previously transmitting AB = 01|
|TX : AB = 10||Idle by Backward
Now our link has returned to the idle state where it will stay until a new call is initiated on the line.
Asterisk: OpenR2 Debugging
To see a list of supported MFC-R2 variants you can execute the following command from a linux shell:
Inside the Asterisk CLI you can use:
|*CLI> mfcr2 show variants|
To show all active channels and their present circuit state, use the following asterisk command:
|*CLI> mfcr2 show channels|
Chan Variant Max ANI Max DNIS ANI First Immediate Accept Tx CAS Rx CAS
*NOTE: a useful method to monitor the circuit states in real time is by issuing a watch on the above command from Linux shell:
|watch -d -n 0.5 'asterisk -rx "mfcr2 show channels"'|
Debugging with the Asterisk CLI
You can enable OpenR2 debug messages in the asterisk CLI with the command shown below. This example demonstrates the transmission of a DNIS.
|*CLI> mfcr2 set debug debug|
Enable Call Sequence Logging
To enable extremely detailed R2 signal logging place something similar to the following in your /etc/asterisk/chan_dahdi.conf file.
Using these settings all call logs will be located in: var/log/asterisk/mfcr2/span1
all is a special value to log all the activity:
nothing is a clean-up value in case you don't want to log any activity for a channel or group of channels.
BE AWARE that the level of output logged will ALSO depend on the value you have in logger.conf.
If you disable output in logger.conf then it does not matter you specify all here; nothing will be logged, so logger.conf has the last word on what is going to be logged.