msc {
	hscale=2;
	ms [label="MS"], bts [label="BTS"], bsc[label="BSC"], bsc_lchan[label="BSC lchan FSM"],
	bsc_gscon[label="BSC conn FSM"], msc_[label="MSC"];

	ms note bsc_gscon [label="various lchan release scenarios"];
	
	ms rbox msc_ [label="MSC releases"];
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_ACTIVE"];
	bsc_gscon abox bsc_gscon [label="ST_ACTIVE"];
	bsc_gscon <= msc_ [label="BSSMAP Clear Command"];
	bsc_gscon abox bsc_gscon [label="ST_CLEARING"];
	bsc_gscon => msc_ [label="BSSMAP Clear Complete"];
	bsc_gscon -> bsc_lchan [label="LCHAN_EV_RELEASE"];
	--- [label="IF SAPIs besides SAPI[0] are active"];
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_WAIT_\nSAPIS_RELEASED\nT3109"];
	bts <= bsc_lchan [label="RSL Release Request (Local End)..."];
	bts <= bsc_lchan [label="...for each SAPI, except link_id=0"];
	ms <= bsc_lchan [label="RR Channel Release"];
	bts <= bsc_lchan [label="RSL Deactivate SACCH",ID="if appropriate pchan"];
	...;
	bts => bsc_lchan [label="RSL Release ACKs"];
	--- [label="END: SAPIs besides SAPI[0] are active"];
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_WAIT_\nBEFORE_RF_RELEASE\nT3111"];
	bsc_lchan -> bsc_gscon [label="GSCON_EV_FORGET_LCHAN"];
	bsc_gscon note bsc_gscon [label="has already forgotten the lchan above."];
	...;
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_WAIT_\nRF_RELEASE_ACK\n4s"];
	bts <= bsc_lchan [label="RSL RF Channel Release"];
	...;
	bts => bsc_lchan [label="RSL RF Channel Release ACK"];
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_UNUSED"];
	...;
	...;

	ms rbox msc_ [label="BSC releases, outside of conn FSM's flow"];
	bsc -> bsc_lchan [label="LCHAN_EV_RELEASE"];
	--- [label="IF SAPIs besides SAPI[0] are active"];
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_WAIT_\nSAPIS_RELEASED\nT3109"];
	bts <= bsc_lchan [label="RSL Release Request (Local End)..."];
	bts <= bsc_lchan [label="...for each SAPI, except link_id=0"];
	ms <= bsc_lchan [label="RR Channel Release",ID="if conn is present"];
	bts <= bsc_lchan [label="RSL Deactivate SACCH",ID="if appropriate pchan"];
	...;
	bts => bsc_lchan [label="RSL Release ACKs"];
	--- [label="END: SAPIs besides SAPI[0] are active"];
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_WAIT_\nBEFORE_RF_RELEASE\nT3111"];
	bsc_lchan -> bsc_gscon [label="GSCON_EV_FORGET_LCHAN"];
	bsc_gscon note bsc_gscon [label="conn FSM notices that its primary lchan is gone"];
	bsc_gscon => msc_ [label="BSSMAP Clear Request"];
	bsc_gscon abox bsc_gscon [label="ST_WAIT_CLEAR_CMD"];
	...;
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_WAIT_\nRF_RELEASE_ACK\n4s"];
	bts <= bsc_lchan [label="RSL RF Channel Release"];
	...;
	bts => bsc_lchan [label="RSL RF Channel Release ACK"];
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_UNUSED"];
	...;
	bsc_gscon <= msc_ [label="BSSMAP Clear Command"];
	bsc_gscon abox bsc_gscon [label="ST_CLEARING"];
	bsc_gscon => msc_ [label="BSSMAP Clear Complete"];
	...;
	...;

	ms rbox msc_ [label="MS releases"];
	ms => bts [label="DISC"];
	bts => bsc_lchan [label="RLL Release Ind..."];
	bts => bsc_lchan [label="...for each SAPI"];
	bsc_lchan note bsc_lchan [label="The lchan FSM notices when all SAPIs have been released"];
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_WAIT_\nBEFORE_RF_RELEASE\nT3111"];
	...;
	bsc_lchan abox bsc_lchan [label="LCHAN_ST_WAIT_\nRF_RELEASE_ACK\n4s"];
	bts <= bsc_lchan [label="RSL RF Channel Release"];
	bsc_lchan -> bsc_gscon [label="GSCON_EV_FORGET_LCHAN"];
	bsc_gscon note bsc_gscon [label="conn FSM notices that its primary lchan is gone"];
	bsc_gscon => msc_ [label="BSSMAP Clear Request"];
	bsc_gscon abox bsc_gscon [label="ST_WAIT_CLEAR_CMD"];
	...;
	bts => bsc_lchan [label="RSL RF Channel Release ACK"];
	...;
	bsc_gscon <= msc_ [label="BSSMAP Clear Command"];
	bsc_gscon => msc_ [label="BSSMAP Clear Complete"];
}
