MNCC: Add some useful templates / helper functions

Change-Id: I59374f9f17600bd405b52dd3a0bcdb39b9ac9adc
This commit is contained in:
Harald Welte 2018-01-17 13:58:16 +01:00
parent 8b2a258808
commit 251b52b71c
2 changed files with 27 additions and 0 deletions

View File

@ -46,5 +46,19 @@ type port MNCC_CODEC_PT message {
};
template MNCC_send_data t_SD_MNCC(integer id, template MNCC_PDU pdu) := {
data := pdu,
id := id
}
template MNCC_send_data t_SD_MNCC_MSGT(integer id, template MNCC_MsgType msg_type) := {
data := {
msg_type := msg_type,
u := ?
},
id := id
}
}

View File

@ -1434,4 +1434,17 @@ template MNCC_PDU ts_MNCC_RTP_CONNECT(uint32_t call_id, uint32_t ip, uint32_t rt
/* MSC <- MNCC: RTP_FREE.req; request connect of RTP */
template MNCC_PDU ts_MNCC_RTP_FREE(uint32_t call_id) := ts_MNCC_SIMPLE_RTP(MNCC_RTP_FREE, call_id);
function f_mncc_get_call_id(MNCC_PDU pdu) return uint32_t {
if (ischosen(pdu.u.rtp)) {
return pdu.u.rtp.callref;
} else if (ischosen(pdu.u.data)) {
return pdu.u.data.callref;
} else if (ischosen(pdu.u.signal)) {
return pdu.u.signal.callref;
} else {
setverdict(fail, "Unable to determine Callref for MNCC", pdu);
self.stop
}
}
} with { encode "RAW" ; variant "FIELDORDER(msb)" }