diff --git a/srsepc/hdr/mme/s1ap.h b/srsepc/hdr/mme/s1ap.h index a8a813831..318c15382 100644 --- a/srsepc/hdr/mme/s1ap.h +++ b/srsepc/hdr/mme/s1ap.h @@ -97,6 +97,7 @@ public: bool delete_ue_ctx(uint64_t imsi); uint32_t allocate_m_tmsi(uint64_t imsi); + uint64_t find_imsi_from_m_tmsi(uint32_t m_tmsi); s1ap_args_t m_s1ap_args; srslte::log_filter *m_s1ap_log; diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index f20ae3fa0..557fe5eaf 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -582,6 +582,19 @@ s1ap::allocate_m_tmsi(uint64_t imsi) return m_tmsi; } +uint64_t +s1ap::find_imsi_from_m_tmsi(uint32_t m_tmsi) +{ + std::map::iterator it = m_s1ap->m_tmsi_to_imsi.find(m_tmsi); + if (it != m_s1ap->m_tmsi_to_imsi.end()) { + m_s1ap_log->debug("Found IMSI %015lu from M-TMSI 0x%x", it->second, m_tmsi); + return it->second; + } else { + m_s1ap_log->debug("Could not find IMSI from M-TMSI 0x%x", m_tmsi); + return 0; + } +} + void s1ap::print_enb_ctx_info(const std::string &prefix, const enb_ctx_t &enb_ctx) {