dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9231
Change subject: MSC_ConnectionHandler: check channel mode in f_establish_fully ...................................................................... MSC_ConnectionHandler: check channel mode in f_establish_fully The helper function f_establish_fully() checks the channel type for compatibility. If the channel type is compatible with the desired mode a channel mode modification could be necessary if the current channel mode is different from the desired channel mode. However, this is not checked at the momemend. We just blindly expect a MODE MODIFY message from the BSC and ignore the cases where the current channel mode and the desired channel mode already matches up. This is the case if only a signalling channel is requested with f_establish_fully for example. - Check if the channel mode of the current channel and the desired channel mode match up. - Make sure that the MODE MODIFY from the BSC is only expected when the channel modes are different. Change-Id: I9004f299220b01ecea6b2316ba3f913c316947dc Closes: OS#2762 Related: OS#2936 --- M bsc/MSC_ConnectionHandler.ttcn 1 file changed, 46 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/31/9231/1 diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn index 991a693..f799bfe 100644 --- a/bsc/MSC_ConnectionHandler.ttcn +++ b/bsc/MSC_ConnectionHandler.ttcn @@ -674,6 +674,35 @@ return false; } +/* Determine if the channel mode specified within rsl_chan_nr requires a + * MODE MODIFY in to match the channel mode specified by given BSSMAP + * ChannelType */ +function f_channel_needs_modify(BSSMAP_IE_ChannelType bssmap, RslChannelNr rsl_chan_nr) +return boolean { + + var boolean current_signalling := false; + var boolean desired_signalling := false; + + select (rsl_chan_nr) { + case (t_RslChanNr_SDCCH4(?, ?)) { current_signalling := true; } + case (t_RslChanNr_SDCCH8(?, ?)) { current_signalling := true; } + } + + if (bssmap.speechOrDataIndicator == '0011'B) { + desired_signalling := true; + } + + if (current_signalling == desired_signalling) { + /* The desired channel mode is equal to the one we currently + * have, there is no mode modification needed or expected */ + return false; + } else { + /* The desired channel mode and the current channel mode do + * not match. A mode modification is required */ + return true; + } +} + /* establish a channel fully, expecting an assignment matching 'exp' */ function f_establish_fully(template (omit) PDU_BSSAP ass_tpl, template PDU_BSSAP exp_ass_cpl) runs on MSC_ConnHdlr { @@ -698,6 +727,7 @@ timer T := 10.0; var boolean exp_compl := ischosen(exp_ass_cpl.pdu.bssmap.assignmentComplete); var boolean exp_fail := ischosen(exp_ass_cpl.pdu.bssmap.assignmentFailure); + var boolean exp_modify; var ExpectCriteria mgcpcrit := { connid := omit, endpoint := omit, @@ -707,10 +737,23 @@ /* if the channel type is SIGNAL, we're not handling a voice call */ if (ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechOrDataIndicator != '0011'B) { st.voice_call := true; + exp_modify := true; } + /* determine if the current channel can support the given service or not */ if (not f_channel_compatible(ass_cmd.pdu.bssmap.assignmentRequest.channelType, g_chan_nr)) { st.is_assignment := true; + + /* We decided to assign a new channel, so we do not expect + * any mode modify messages on RSL */ + exp_modify := false; + } else { + + /* We will continue working with the currently assigned + * channel, we must now check if the mode of the current + * channel is compatible. If not we expect the BSC to modify + * the mode */ + exp_modify := f_channel_needs_modify(ass_cmd.pdu.bssmap.assignmentRequest.channelType, g_chan_nr); } f_create_mgcp_expect(mgcpcrit); @@ -722,21 +765,20 @@ [st.is_assignment] as_assignment(st); /* modify related bits */ - [not st.is_assignment] as_modify(st); + [not st.is_assignment and exp_modify] as_modify(st); /* voice call related bits (IPA CRCX/MDCX + MGCP) */ [st.voice_call] as_Media(); /* if we receive exactly what we expected, always return + pass */ - [st.is_assignment and st.assignment_done or - (not st.is_assignment and st.modify_done)] BSSAP.receive(exp_ass_cpl) -> value bssap { + [st.is_assignment and st.assignment_done or (not st.is_assignment and (st.modify_done or not exp_modify))] BSSAP.receive(exp_ass_cpl) -> value bssap { setverdict(pass); } [exp_fail] BSSAP.receive(exp_ass_cpl) -> value bssap { setverdict(pass); } [(st.is_assignment and st.assignment_done or - (not st.is_assignment and st.modify_done)) and + (not st.is_assignment and (st.modify_done or not exp_modify))) and exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentComplete) { setverdict(fail, "Received non-matching ASSIGNMENT COMPLETE"); } -- To view, visit https://gerrit.osmocom.org/9231 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I9004f299220b01ecea6b2316ba3f913c316947dc Gerrit-Change-Number: 9231 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pma...@sysmocom.de>