aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/jenkins.sh2
-rw-r--r--contrib/systemd/osmo-msc.service2
-rw-r--r--include/osmocom/msc/codec_sdp_cc_t9n.h4
-rw-r--r--include/osmocom/msc/gsm_data.h4
-rw-r--r--include/osmocom/msc/ran_msg.h2
-rw-r--r--include/osmocom/msc/vlr.h10
-rw-r--r--include/osmocom/smpp/smpp.h22
-rw-r--r--include/osmocom/smpp/smpp_smsc.h35
-rw-r--r--src/libmsc/codec_filter.c4
-rw-r--r--src/libmsc/codec_sdp_cc_t9n.c34
-rw-r--r--src/libmsc/gsm_04_08.c18
-rw-r--r--src/libmsc/msc_a.c23
-rw-r--r--src/libmsc/ran_msg_a.c5
-rw-r--r--src/libmsc/ran_msg_iu.c8
-rw-r--r--src/libmsc/sdp_msg.c12
-rw-r--r--src/libsmpputil/smpp_msc.c24
-rw-r--r--src/libsmpputil/smpp_smsc.c179
-rw-r--r--src/libsmpputil/smpp_vty.c8
-rw-r--r--src/libvlr/vlr_auth_fsm.c11
-rw-r--r--src/libvlr/vlr_lu_fsm.c33
-rw-r--r--src/osmo-msc/msc_main.c4
-rw-r--r--src/utils/Makefile.am10
-rw-r--r--src/utils/smpp_mirror.c65
-rw-r--r--tests/msc_vlr/msc_vlr_test_call.err26
-rw-r--r--tests/msc_vlr/msc_vlr_tests.c3
-rw-r--r--tests/stubs.c4
26 files changed, 308 insertions, 244 deletions
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index fb858d763..e1bbad480 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -35,7 +35,7 @@ export PATH="$inst/bin:$PATH"
osmo-build-dep.sh libosmo-abis
osmo-build-dep.sh libosmo-netif
osmo-build-dep.sh libosmo-sccp
-PARALLEL_MAKE="" osmo-build-dep.sh libsmpp34
+osmo-build-dep.sh libsmpp34
osmo-build-dep.sh osmo-mgw
osmo-build-dep.sh osmo-hlr
diff --git a/contrib/systemd/osmo-msc.service b/contrib/systemd/osmo-msc.service
index 343639cf3..36849f7f6 100644
--- a/contrib/systemd/osmo-msc.service
+++ b/contrib/systemd/osmo-msc.service
@@ -8,6 +8,8 @@ After=osmo-hnbgw.service
[Service]
Type=simple
Restart=always
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
ExecStart=/usr/bin/osmo-msc -c /etc/osmocom/osmo-msc.cfg
RestartSec=2
diff --git a/include/osmocom/msc/codec_sdp_cc_t9n.h b/include/osmocom/msc/codec_sdp_cc_t9n.h
index 150fd265b..8f91c788b 100644
--- a/include/osmocom/msc/codec_sdp_cc_t9n.h
+++ b/include/osmocom/msc/codec_sdp_cc_t9n.h
@@ -44,8 +44,8 @@ extern const struct codec_mapping codec_map[];
for ((CODEC_MAPPING) = codec_map; (CODEC_MAPPING) < codec_map + ARRAY_SIZE(codec_map); (CODEC_MAPPING)++)
const struct codec_mapping *codec_mapping_by_speech_ver(enum gsm48_bcap_speech_ver speech_ver);
-const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0808_speech_codec_type sct,
- uint16_t cfg);
+const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0808_speech_codec_type sct);
+const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec(const struct gsm0808_speech_codec *sc);
const struct codec_mapping *codec_mapping_by_perm_speech(enum gsm0808_permitted_speech perm_speech);
const struct codec_mapping *codec_mapping_by_subtype_name(const char *subtype_name);
const struct codec_mapping *codec_mapping_by_mgcp_codec(enum mgcp_codecs mgcp);
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 78b9c9a5b..43944e723 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -268,7 +268,7 @@ struct gsm_network {
struct sms_queue_config *sms_queue_cfg;
};
-struct osmo_esme;
+struct smpp_esme;
enum gsm_sms_source_id {
SMS_SOURCE_UNKNOWN = 0,
@@ -297,7 +297,7 @@ struct gsm_sms {
} gsm411;
struct {
- struct osmo_esme *esme;
+ struct smpp_esme *esme;
uint32_t sequence_nr;
int transaction_mode;
char msg_id[16];
diff --git a/include/osmocom/msc/ran_msg.h b/include/osmocom/msc/ran_msg.h
index 32b24a01f..86bf63a5b 100644
--- a/include/osmocom/msc/ran_msg.h
+++ b/include/osmocom/msc/ran_msg.h
@@ -240,7 +240,7 @@ struct ran_msg {
struct {
struct osmo_sockaddr_str remote_rtp;
bool codec_present;
- enum mgcp_codecs codec;
+ struct gsm0808_speech_codec codec;
const struct gsm0808_speech_codec_list *codec_list_bss_supported;
bool osmux_present;
uint8_t osmux_cid;
diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index d23661db0..c13fa21bf 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -288,6 +288,13 @@ static inline const char *vlr_ciph_name(enum vlr_ciph val)
return get_value_string(vlr_ciph_names, val);
}
+struct vlr_auth_ciph {
+ bool is_utran;
+ bool auth_required;
+ uint8_t a5_encryption_mask;
+ uint8_t uea_encryption_mask;
+};
+
/* Location Updating request */
struct osmo_fsm_inst *
vlr_loc_update(struct osmo_fsm_inst *parent,
@@ -298,8 +305,7 @@ vlr_loc_update(struct osmo_fsm_inst *parent,
enum vlr_lu_type type, uint32_t tmsi, const char *imsi,
const struct osmo_location_area_id *old_lai,
const struct osmo_location_area_id *new_lai,
- bool authentication_required,
- bool ciphering_required,
+ const struct vlr_auth_ciph *auth_ciph,
uint8_t key_seq,
bool is_r99, bool is_utran,
bool assign_tmsi);
diff --git a/include/osmocom/smpp/smpp.h b/include/osmocom/smpp/smpp.h
index df5e163c0..a2832d304 100644
--- a/include/osmocom/smpp/smpp.h
+++ b/include/osmocom/smpp/smpp.h
@@ -11,6 +11,21 @@ enum esme_read_state {
READ_ST_IN_MSG = 1,
};
+/* struct representing SMPP's External Short Messaging Entity */
+struct esme {
+ uint32_t own_seq_nr;
+
+ struct osmo_wqueue wqueue;
+ enum esme_read_state read_state;
+ uint32_t read_len;
+ uint32_t read_idx;
+ struct msgb *read_msg;
+
+ uint8_t smpp_version;
+ char system_id[SMPP_SYS_ID_LEN + 1];
+ char password[SMPP_SYS_ID_LEN + 1];
+};
+
#define LOGPESME(ESME, LEVEL, FMT, ARGS...) \
LOGP(DSMPP, LEVEL, "[%s] " FMT, (ESME)->system_id, ##ARGS)
@@ -32,6 +47,9 @@ enum esme_read_state {
(resp)->command_status = ESME_ROK; \
(resp)->sequence_number = (req)->sequence_number; }
+struct esme *esme_alloc(void *ctx);
uint32_t smpp_msgb_cmdid(struct msgb *msg);
-int smpp_openbsc_alloc_init(void *ctx);
-int smpp_openbsc_start(struct gsm_network *net);
+uint32_t esme_inc_seq_nr(struct esme *esme);
+int pack_and_send(struct esme *esme, uint32_t type, void *ptr);
+int smpp_msc_alloc_init(void *ctx);
+int smpp_msc_start(struct gsm_network *net);
diff --git a/include/osmocom/smpp/smpp_smsc.h b/include/osmocom/smpp/smpp_smsc.h
index fb5164faf..960707936 100644
--- a/include/osmocom/smpp/smpp_smsc.h
+++ b/include/osmocom/smpp/smpp_smsc.h
@@ -26,33 +26,24 @@ struct osmo_smpp_addr {
char addr[21+1];
};
-struct osmo_esme {
+/* struct wrapping ESME struct with additional SMSC-specific things like ACL, command list etc */
+struct smpp_esme {
struct llist_head list;
struct smsc *smsc;
+ struct esme *esme;
struct osmo_smpp_acl *acl;
int use;
struct llist_head smpp_cmd_list;
- uint32_t own_seq_nr;
-
- struct osmo_wqueue wqueue;
-
- enum esme_read_state read_state;
- uint32_t read_len;
- uint32_t read_idx;
- struct msgb *read_msg;
-
uint8_t smpp_version;
- char system_id[SMPP_SYS_ID_LEN+1];
-
uint8_t bind_flags;
};
struct osmo_smpp_acl {
struct llist_head list;
struct smsc *smsc;
- struct osmo_esme *esme;
+ struct smpp_esme *esme;
char *description;
char system_id[SMPP_SYS_ID_LEN+1];
char passwd[SMPP_PASSWD_LEN+1];
@@ -89,11 +80,11 @@ struct osmo_smpp_cmd {
struct osmo_timer_list response_timer;
};
-struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct osmo_esme *esme,
+struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct smpp_esme *esme,
uint32_t sequence_number);
void smpp_cmd_ack(struct osmo_smpp_cmd *cmd);
void smpp_cmd_err(struct osmo_smpp_cmd *cmd, uint32_t status);
-void smpp_cmd_flush_pending(struct osmo_esme *esme);
+void smpp_cmd_flush_pending(struct smpp_esme *esme);
struct smsc {
struct osmo_fd listen_ofd;
@@ -118,25 +109,25 @@ int smpp_smsc_start(struct smsc *smsc, const char *bind_addr, uint16_t port);
int smpp_smsc_restart(struct smsc *smsc, const char *bind_addr, uint16_t port);
void smpp_smsc_stop(struct smsc *smsc);
-void smpp_esme_get(struct osmo_esme *esme);
-void smpp_esme_put(struct osmo_esme *esme);
+void smpp_esme_get(struct smpp_esme *esme);
+void smpp_esme_put(struct smpp_esme *esme);
-int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct osmo_esme **emse);
+int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct smpp_esme **emse);
struct osmo_smpp_acl *smpp_acl_alloc(struct smsc *smsc, const char *sys_id);
struct osmo_smpp_acl *smpp_acl_by_system_id(struct smsc *smsc,
const char *sys_id);
void smpp_acl_delete(struct osmo_smpp_acl *acl);
-int smpp_tx_submit_r(struct osmo_esme *esme, uint32_t sequence_nr,
+int smpp_tx_submit_r(struct smpp_esme *esme, uint32_t sequence_nr,
uint32_t command_status, char *msg_id);
-int smpp_tx_alert(struct osmo_esme *esme, uint8_t ton, uint8_t npi,
+int smpp_tx_alert(struct smpp_esme *esme, uint8_t ton, uint8_t npi,
const char *addr, uint8_t avail_status);
-int smpp_tx_deliver(struct osmo_esme *esme, struct deliver_sm_t *deliver);
+int smpp_tx_deliver(struct smpp_esme *esme, struct deliver_sm_t *deliver);
-int handle_smpp_submit(struct osmo_esme *esme, struct submit_sm_t *submit,
+int handle_smpp_submit(struct smpp_esme *esme, struct submit_sm_t *submit,
struct submit_sm_resp_t *submit_r);
int smpp_route_pfx_add(struct osmo_smpp_acl *acl,
diff --git a/src/libmsc/codec_filter.c b/src/libmsc/codec_filter.c
index cdcec7967..96a4e0896 100644
--- a/src/libmsc/codec_filter.c
+++ b/src/libmsc/codec_filter.c
@@ -127,7 +127,7 @@ int codec_filter_run(struct codec_filter *codec_filter)
if (sdp_audio_codec_is_set(a)) {
/* Assignment has completed, the chosen codec should be the first of the resulting SDP.
* Make sure this is actually listed in the result SDP and move to first place. */
- struct sdp_audio_codec *select = sdp_audio_codec_by_descr(r, a);
+ struct sdp_audio_codec *select = sdp_audio_codecs_by_descr(r, a);
if (!select) {
/* Not present. Add. */
@@ -142,7 +142,7 @@ int codec_filter_run(struct codec_filter *codec_filter)
if (a->payload_type > 127)
return -ENOSPC;
}
- select = sdp_audio_codec_add_copy(r, a);
+ select = sdp_audio_codecs_add_copy(r, a);
}
sdp_audio_codecs_select(r, select);
diff --git a/src/libmsc/codec_sdp_cc_t9n.c b/src/libmsc/codec_sdp_cc_t9n.c
index 251fe66ce..7813a7c2b 100644
--- a/src/libmsc/codec_sdp_cc_t9n.c
+++ b/src/libmsc/codec_sdp_cc_t9n.c
@@ -121,6 +121,10 @@ const struct codec_mapping codec_map[] = {
* to match this entry, and it ends in an aborted call due to no codec match.
* If the peer offers plain "AMR/8000" and we reply with "AMR/8000 fmtp:octet-align=1",
* then everything works out happily, */
+ /* XXX what?? 3GPP TS 26.103 says "The bandwidth efficient mode of RFC 4867 shall be used. To
+ * offer the bandwidth-efficient mode, the octet-align parameter should be omitted in SDP."
+ * How can it work when we send bw-efficient AMR but said octet-aligned in the SDP??
+ */
.fmtp = "octet-align=1",
},
.mgcp = CODEC_AMR_8000_1,
@@ -203,6 +207,12 @@ const struct codec_mapping codec_map[] = {
.rate = 16000,
},
.mgcp = CODEC_IUFP,
+ .has_gsm0808_speech_codec = true,
+ .gsm0808_speech_codec = {
+ .fi = true,
+ .type = GSM0808_SCT_FR3,
+ .cfg = GSM0808_SC_CFG_DEFAULT_FR_AMR,
+ },
},
};
@@ -222,8 +232,7 @@ const struct codec_mapping *codec_mapping_by_speech_ver(enum gsm48_bcap_speech_v
return NULL;
}
-
-const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0808_speech_codec_type sct, uint16_t cfg)
+const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0808_speech_codec_type sct)
{
const struct codec_mapping *m;
foreach_codec_mapping(m) {
@@ -231,7 +240,22 @@ const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0
continue;
if (m->gsm0808_speech_codec.type == sct)
return m;
- /* TODO: evaluate cfg bits? */
+ }
+ return NULL;
+}
+
+const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec(const struct gsm0808_speech_codec *sc)
+{
+ const struct codec_mapping *m;
+ foreach_codec_mapping(m) {
+ if (!m->has_gsm0808_speech_codec)
+ continue;
+ if (m->gsm0808_speech_codec.type != sc->type)
+ continue;
+ /* Return only those where sc->cfg is a subset of m->gsm0808_speech_codec.cfg. */
+ if ((m->gsm0808_speech_codec.cfg & sc->cfg) != sc->cfg)
+ continue;
+ return m;
}
return NULL;
}
@@ -395,6 +419,7 @@ void sdp_audio_codecs_to_speech_codec_list(struct gsm0808_speech_codec_list *scl
if (scl->len >= ARRAY_SIZE(scl->codec))
break;
scl->codec[scl->len] = m->gsm0808_speech_codec;
+ /* FIXME: apply AMR configuration according to codec->fmtp */
scl->len++;
}
}
@@ -404,10 +429,11 @@ void sdp_audio_codecs_from_speech_codec_list(struct sdp_audio_codecs *ac, const
int i;
for (i = 0; i < cl->len; i++) {
const struct gsm0808_speech_codec *sc = &cl->codec[i];
- const struct codec_mapping *m = codec_mapping_by_gsm0808_speech_codec_type(sc->type, sc->cfg);
+ const struct codec_mapping *m = codec_mapping_by_gsm0808_speech_codec(sc);
if (!m)
continue;
sdp_audio_codecs_add_copy(ac, &m->sdp);
+ /* FIXME: for AMR, apply sc->cfg to the added codec's fmtp */
}
}
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 9d3b5a216..dc43f7315 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -408,16 +408,28 @@ static int mm_rx_loc_upd_req(struct msc_a *msc_a, struct msgb *msg)
gsm48_decode_lai2(&lu->lai, &old_lai);
LOG_MSC_A_CAT(msc_a, DMM, LOGL_DEBUG, "USIM: old LAI: %s\n", osmo_lai_name(&old_lai));
+ is_utran = (msc_a->c.ran->type == OSMO_RAT_UTRAN_IU);
+
+ if (!is_utran && !net->a5_encryption_mask) {
+ LOG_MSC_A(msc_a, LOGL_ERROR, "No A5 algorithm is enabled (no A5/0, nor any A5/n > 0)\n");
+ return -ENOTSUP;
+ }
+ if (is_utran && !net->uea_encryption_mask) {
+ LOG_MSC_A(msc_a, LOGL_ERROR, "No UEA algorithm is enabled (no UEA0, nor any UEAn > 0)\n");
+ return -ENOTSUP;
+ }
+
msc_a_get(msc_a, __func__);
msc_a_get(msc_a, MSC_A_USE_LOCATION_UPDATING);
- is_utran = (msc_a->c.ran->type == OSMO_RAT_UTRAN_IU);
lu_fsm = vlr_loc_update(msc_a->c.fi,
MSC_A_EV_AUTHENTICATED, MSC_A_EV_CN_CLOSE, NULL,
net->vlr, msc_a, vlr_lu_type, tmsi, imsi,
&old_lai, &msc_a->via_cell.lai,
- is_utran || net->authentication_required,
- msc_a_require_ciphering(msc_a),
+ is_utran,
+ net->authentication_required,
+ net->a5_encryption_mask,
+ net->uea_encryption_mask,
lu->key_seq,
osmo_gsm48_classmark1_is_r99(&lu->classmark1),
is_utran,
diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index 8eaece37b..a595458c3 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -108,16 +108,6 @@ struct msc_a *msc_a_fi_priv(struct osmo_fsm_inst *fi)
return fi->priv;
}
-bool msc_a_require_ciphering(const struct msc_a *msc_a)
-{
- struct gsm_network *net = msc_a_net(msc_a);
- bool is_utran = (msc_a->c.ran->type == OSMO_RAT_UTRAN_IU);
- if (is_utran)
- return net->uea_encryption_mask > (1 << OSMO_UTRAN_UEA0);
- else
- return net->a5_encryption_mask > 0x1;
-}
-
static void update_counters(struct osmo_fsm_inst *fi, bool conn_accepted)
{
struct msc_a *msc_a = fi->priv;
@@ -1392,8 +1382,8 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct
{
struct gsm_trans *cc_trans = msc_a->cc.active_trans;
struct rtp_stream *rtps_to_ran = msc_a->cc.call_leg ? msc_a->cc.call_leg->rtp[RTP_TO_RAN] : NULL;
- const enum mgcp_codecs *codec_if_known = ac->assignment_complete.codec_present ?
- &ac->assignment_complete.codec : NULL;
+ const struct gsm0808_speech_codec *codec_if_known = ac->assignment_complete.codec_present ?
+ &ac->assignment_complete.codec : NULL;
if (!rtps_to_ran) {
LOG_MSC_A(msc_a, LOGL_ERROR, "Rx Assignment Complete, but no RTP stream is set up\n");
@@ -1413,21 +1403,21 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct
if (codec_if_known) {
const struct codec_mapping *m;
- m = codec_mapping_by_mgcp_codec(*codec_if_known);
+ m = codec_mapping_by_gsm0808_speech_codec_type(codec_if_known->type);
+ /* TODO: use codec_mapping_by_gsm0808_speech_codec() to also match on codec_if_known->cfg */
if (!m) {
LOG_TRANS(cc_trans, LOGL_ERROR, "Unknown codec in Assignment Complete: %s\n",
- osmo_mgcpc_codec_name(ac->assignment_complete.codec));
+ gsm0808_speech_codec_type_name(codec_if_known->type));
call_leg_release(msc_a->cc.call_leg);
return;
}
LOG_TRANS(cc_trans, LOGL_INFO, "Assignment Complete: %s\n",
- osmo_mgcpc_codec_name(ac->assignment_complete.codec));
+ gsm0808_speech_codec_type_name(codec_if_known->type));
/* Update RAN-side endpoint CI: */
rtp_stream_set_one_codec(rtps_to_ran, &m->sdp);
- /* Update codecs filter with the codec chosen by Assignment */
cc_trans->cc.codecs.assignment = m->sdp;
} else {
cc_trans->cc.codecs.assignment = (struct sdp_audio_codec){};
@@ -1842,6 +1832,7 @@ static int msc_a_start_assignment(struct msc_a *msc_a, struct gsm_trans *cc_tran
msc_a->cc.active_trans = cc_trans;
cc_trans->cc.mncc_release_sent = false;
+ cc_trans->cc.codecs.assignment = (struct sdp_audio_codec){};
OSMO_ASSERT(cc_trans && cc_trans->type == TRANS_CC);
cl = msc_a_ensure_call_leg(msc_a, cc_trans);
diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c
index 1357324d7..6af229041 100644
--- a/src/libmsc/ran_msg_a.c
+++ b/src/libmsc/ran_msg_a.c
@@ -276,7 +276,6 @@ static int ran_a_decode_assignment_complete(struct ran_dec *ran_dec, struct msgb
struct tlv_p_entry *ie_codec_list_bss_supported = TLVP_GET(tp, GSM0808_IE_SPEECH_CODEC_LIST);
struct tlv_p_entry *ie_osmux_cid = TLVP_GET(tp, GSM0808_IE_OSMO_OSMUX_CID);
struct sockaddr_storage rtp_addr;
- struct gsm0808_speech_codec sc;
struct gsm0808_speech_codec_list codec_list_bss_supported;
int rc;
struct ran_msg ran_dec_msg = {
@@ -309,14 +308,14 @@ static int ran_a_decode_assignment_complete(struct ran_dec *ran_dec, struct msgb
if (ie_speech_codec) {
/* Decode Speech Codec (Chosen) element */
- rc = gsm0808_dec_speech_codec(&sc, ie_speech_codec->val, ie_speech_codec->len);
+ rc = gsm0808_dec_speech_codec(&ran_dec_msg.assignment_complete.codec,
+ ie_speech_codec->val, ie_speech_codec->len);
if (rc < 0) {
LOG_RAN_A_DEC_MSG(LOGL_ERROR, "Assignment Complete: unable to decode IE Speech Codec (Chosen)"
" (rc=%d).\n", rc);
return -EINVAL;
}
ran_dec_msg.assignment_complete.codec_present = true;
- ran_dec_msg.assignment_complete.codec = ran_a_mgcp_codec_from_sc(&sc);
}
if (ie_codec_list_bss_supported) {
diff --git a/src/libmsc/ran_msg_iu.c b/src/libmsc/ran_msg_iu.c
index ee1d0a5c2..5e38916f1 100644
--- a/src/libmsc/ran_msg_iu.c
+++ b/src/libmsc/ran_msg_iu.c
@@ -153,8 +153,14 @@ static int ran_iu_decode_rab_assignment_response_decode_setup_ies(struct ran_dec
.msg_type = RAN_MSG_ASSIGNMENT_COMPLETE,
.msg_name = "RANAP RAB Assignment Response",
.assignment_complete = {
+ /* For IuUP, the MGW decapsulates it to plain AMR RTP. So for the purpose of matching to the
+ * other call leg / figuring out codecs, set to AMR. */
.codec_present = true,
- .codec = CODEC_IUFP,
+ .codec = {
+ .fi = true,
+ .type = GSM0808_SCT_FR3,
+ .cfg = GSM0808_SC_CFG_DEFAULT_FR_AMR,
+ },
},
};
if (osmo_sockaddr_str_from_str(&ran_dec_msg->assignment_complete.remote_rtp, addr, port)) {
diff --git a/src/libmsc/sdp_msg.c b/src/libmsc/sdp_msg.c
index dd5551769..e16b7b229 100644
--- a/src/libmsc/sdp_msg.c
+++ b/src/libmsc/sdp_msg.c
@@ -240,8 +240,16 @@ int sdp_msg_to_sdp_str_buf(char *dst, size_t dst_size, const struct sdp_msg *sdp
{
const struct sdp_audio_codec *codec;
struct osmo_strbuf sb = { .buf = dst, .len = dst_size };
- const char *ip = sdp->rtp.ip[0] ? sdp->rtp.ip : "0.0.0.0";
- char ipv = osmo_ip_str_type(ip) == AF_INET6 ? '6' : '4';
+ const char *ip;
+ char ipv;
+
+ if (!sdp) {
+ OSMO_STRBUF_PRINTF(sb, "%s", "");
+ return sb.chars_needed;
+ }
+
+ ip = sdp->rtp.ip[0] ? sdp->rtp.ip : "0.0.0.0";
+ ipv = (osmo_ip_str_type(ip) == AF_INET6) ? '6' : '4';
OSMO_STRBUF_PRINTF(sb,
"v=0\r\n"
diff --git a/src/libsmpputil/smpp_msc.c b/src/libsmpputil/smpp_msc.c
index cc618cd1b..4a980ab7b 100644
--- a/src/libsmpputil/smpp_msc.c
+++ b/src/libsmpputil/smpp_msc.c
@@ -278,7 +278,7 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net,
}
/*! \brief handle incoming libsmpp34 ssubmit_sm_t from remote ESME */
-int handle_smpp_submit(struct osmo_esme *esme, struct submit_sm_t *submit,
+int handle_smpp_submit(struct smpp_esme *esme, struct submit_sm_t *submit,
struct submit_sm_resp_t *submit_r)
{
struct gsm_sms *sms;
@@ -329,7 +329,7 @@ int handle_smpp_submit(struct osmo_esme *esme, struct submit_sm_t *submit,
static void alert_all_esme(struct smsc *smsc, struct vlr_subscr *vsub,
uint8_t smpp_avail_status)
{
- struct osmo_esme *esme;
+ struct smpp_esme *esme;
llist_for_each_entry(esme, &smsc->esme_list, list) {
/* we currently send an alert notification to each ESME that is
@@ -341,7 +341,7 @@ static void alert_all_esme(struct smsc *smsc, struct vlr_subscr *vsub,
continue;
}
if (esme->acl && !esme->acl->alert_notifications) {
- LOGPESME(esme, LOGL_DEBUG, "is not set to receive Alert Notifications\n");
+ LOGPESME(esme->esme, LOGL_DEBUG, "is not set to receive Alert Notifications\n");
continue;
}
if (esme->acl && esme->acl->deliver_src_imsi) {
@@ -585,7 +585,7 @@ static void smpp_cmd_free(struct osmo_smpp_cmd *cmd)
talloc_free(cmd);
}
-void smpp_cmd_flush_pending(struct osmo_esme *esme)
+void smpp_cmd_flush_pending(struct smpp_esme *esme)
{
struct osmo_smpp_cmd *cmd, *next;
@@ -653,7 +653,7 @@ static void smpp_deliver_sm_cb(void *data)
smpp_cmd_err(data, ESME_RSYSERR);
}
-static int smpp_cmd_enqueue(struct osmo_esme *esme,
+static int smpp_cmd_enqueue(struct smpp_esme *esme,
struct vlr_subscr *vsub, struct gsm_sms *sms,
uint32_t sequence_number)
{
@@ -682,7 +682,7 @@ static int smpp_cmd_enqueue(struct osmo_esme *esme,
return 0;
}
-struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct osmo_esme *esme,
+struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct smpp_esme *esme,
uint32_t sequence_nr)
{
struct osmo_smpp_cmd *cmd;
@@ -694,7 +694,7 @@ struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct osmo_esme *esme,
return NULL;
}
-static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms,
+static int deliver_to_esme(struct smpp_esme *esme, struct gsm_sms *sms,
struct msc_a *msc_a)
{
struct deliver_sm_t deliver;
@@ -802,7 +802,7 @@ bool smpp_route_smpp_first()
int smpp_try_deliver(struct gsm_sms *sms, struct msc_a *msc_a)
{
- struct osmo_esme *esme;
+ struct smpp_esme *esme;
struct osmo_smpp_addr dst;
int rc;
@@ -824,8 +824,8 @@ struct smsc *smsc_from_vty(struct vty *v)
return g_smsc;
}
-/*! \brief Allocate the OpenBSC SMPP interface struct and init VTY. */
-int smpp_openbsc_alloc_init(void *ctx)
+/*! \brief Allocate the OsmoMSC SMPP interface struct and init VTY. */
+int smpp_msc_alloc_init(void *ctx)
{
g_smsc = smpp_smsc_alloc_init(ctx);
if (!g_smsc) {
@@ -836,9 +836,9 @@ int smpp_openbsc_alloc_init(void *ctx)
return smpp_vty_init();
}
-/*! \brief Launch the OpenBSC SMPP interface with the parameters set from VTY.
+/*! \brief Launch the OsmoMSC SMPP interface with the parameters set from VTY.
*/
-int smpp_openbsc_start(struct gsm_network *net)
+int smpp_msc_start(struct gsm_network *net)
{
int rc;
g_smsc->priv = net;
diff --git a/src/libsmpputil/smpp_smsc.c b/src/libsmpputil/smpp_smsc.c
index 4cc76f54a..a1f2b2f44 100644
--- a/src/libsmpputil/smpp_smsc.c
+++ b/src/libsmpputil/smpp_smsc.c
@@ -159,12 +159,12 @@ void smpp_acl_delete(struct osmo_smpp_acl *acl)
/* kill any active ESMEs */
if (acl->esme) {
- struct osmo_esme *esme = acl->esme;
+ struct esme *esme = acl->esme->esme;
osmo_fd_unregister(&esme->wqueue.bfd);
close(esme->wqueue.bfd.fd);
esme->wqueue.bfd.fd = -1;
- esme->acl = NULL;
- smpp_esme_put(esme);
+ acl->esme = NULL;
+ smpp_esme_put(acl->esme);
}
/* delete all routes for this ACL */
@@ -231,17 +231,17 @@ int smpp_route_pfx_del(struct osmo_smpp_acl *acl,
/*! \brief increaes the use/reference count */
-void smpp_esme_get(struct osmo_esme *esme)
+void smpp_esme_get(struct smpp_esme *esme)
{
esme->use++;
}
-static void esme_destroy(struct osmo_esme *esme)
+static void esme_destroy(struct smpp_esme *esme)
{
- osmo_wqueue_clear(&esme->wqueue);
- if (esme->wqueue.bfd.fd >= 0) {
- osmo_fd_unregister(&esme->wqueue.bfd);
- close(esme->wqueue.bfd.fd);
+ osmo_wqueue_clear(&esme->esme->wqueue);
+ if (esme->esme->wqueue.bfd.fd >= 0) {
+ osmo_fd_unregister(&esme->esme->wqueue.bfd);
+ close(esme->esme->wqueue.bfd.fd);
}
smpp_cmd_flush_pending(esme);
llist_del(&esme->list);
@@ -250,7 +250,7 @@ static void esme_destroy(struct osmo_esme *esme)
talloc_free(esme);
}
-static uint32_t esme_inc_seq_nr(struct osmo_esme *esme)
+uint32_t esme_inc_seq_nr(struct esme *esme)
{
esme->own_seq_nr++;
if (esme->own_seq_nr > 0x7fffffff)
@@ -260,7 +260,7 @@ static uint32_t esme_inc_seq_nr(struct osmo_esme *esme)
}
/*! \brief decrease the use/reference count, free if it is 0 */
-void smpp_esme_put(struct osmo_esme *esme)
+void smpp_esme_put(struct smpp_esme *esme)
{
esme->use--;
if (esme->use <= 0)
@@ -268,7 +268,7 @@ void smpp_esme_put(struct osmo_esme *esme)
}
/*! \brief try to find a SMPP route (ESME) for given destination */
-int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct osmo_esme **pesme)
+int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct smpp_esme **pesme)
{
struct osmo_smpp_route *r;
struct osmo_smpp_acl *acl = NULL;
@@ -308,14 +308,14 @@ int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struc
}
if (acl && acl->esme) {
- struct osmo_esme *esme;
+ struct smpp_esme *esme;
DEBUGP(DSMPP, "ACL even has ESME, we can route to it!\n");
esme = acl->esme;
if (esme->bind_flags & ESME_BIND_RX) {
*pesme = esme;
return 0;
} else
- LOGPESME(esme, LOGL_NOTICE, "is matching route, but not bound for Rx, discarding MO SMS\n");
+ LOGPESME(esme->esme, LOGL_NOTICE, "is matching route, but not bound for Rx, discarding MO SMS\n");
}
*pesme = NULL;
@@ -326,7 +326,7 @@ int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struc
}
/*! \brief pack a libsmpp34 data strcutrure and send it to the ESME */
-static int pack_and_send(struct osmo_esme *esme, uint32_t type, void *ptr)
+int pack_and_send(struct esme *esme, uint32_t type, void *ptr)
{
struct msgb *msg;
int rc, rlen;
@@ -357,7 +357,7 @@ static int pack_and_send(struct osmo_esme *esme, uint32_t type, void *ptr)
}
/*! \brief transmit a generic NACK to a remote ESME */
-static int smpp_tx_gen_nack(struct osmo_esme *esme, uint32_t seq, uint32_t status)
+static int smpp_tx_gen_nack(struct esme *esme, uint32_t seq, uint32_t status)
{
struct generic_nack_t nack;
char buf[SMALL_BUFF];
@@ -380,7 +380,7 @@ static inline uint32_t smpp_msgb_seq(struct msgb *msg)
}
/*! \brief handle an incoming SMPP generic NACK */
-static int smpp_handle_gen_nack(struct osmo_esme *esme, struct msgb *msg)
+static int smpp_handle_gen_nack(struct esme *esme, struct msgb *msg)
{
struct generic_nack_t nack;
char buf[SMALL_BUFF];
@@ -398,7 +398,7 @@ static int smpp_handle_gen_nack(struct osmo_esme *esme, struct msgb *msg)
return 0;
}
-static int _process_bind(struct osmo_esme *esme, uint8_t if_version,
+static int _process_bind(struct smpp_esme *esme, uint8_t if_version,
uint32_t bind_flags, const char *sys_id,
const char *passwd)
{
@@ -411,9 +411,9 @@ static int _process_bind(struct osmo_esme *esme, uint8_t if_version,
return ESME_RALYBND;
esme->smpp_version = if_version;
- snprintf(esme->system_id, sizeof(esme->system_id), "%s", sys_id);
+ snprintf(esme->esme->system_id, sizeof(esme->esme->system_id), "%s", sys_id);
- acl = smpp_acl_by_system_id(esme->smsc, esme->system_id);
+ acl = smpp_acl_by_system_id(esme->smsc, esme->esme->system_id);
if (!esme->smsc->accept_all) {
if (!acl) {
/* This system is unknown */
@@ -437,7 +437,7 @@ static int _process_bind(struct osmo_esme *esme, uint8_t if_version,
/*! \brief handle an incoming SMPP BIND RECEIVER */
-static int smpp_handle_bind_rx(struct osmo_esme *esme, struct msgb *msg)
+static int smpp_handle_bind_rx(struct smpp_esme *esme, struct msgb *msg)
{
struct bind_receiver_t bind;
struct bind_receiver_resp_t bind_r;
@@ -446,7 +446,7 @@ static int smpp_handle_bind_rx(struct osmo_esme *esme, struct msgb *msg)
SMPP34_UNPACK(rc, BIND_RECEIVER, &bind, msgb_data(msg),
msgb_length(msg));
if (rc < 0) {
- LOGPESMERR(esme, "in smpp34_unpack()\n");
+ LOGPESMERR(esme->esme, "in smpp34_unpack()\n");
return rc;
}
@@ -459,11 +459,11 @@ static int smpp_handle_bind_rx(struct osmo_esme *esme, struct msgb *msg)
(const char *)bind.system_id, (const char *)bind.password);
bind_r.command_status = rc;
- return PACK_AND_SEND(esme, &bind_r);
+ return PACK_AND_SEND(esme->esme, &bind_r);
}
/*! \brief handle an incoming SMPP BIND TRANSMITTER */
-static int smpp_handle_bind_tx(struct osmo_esme *esme, struct msgb *msg)
+static int smpp_handle_bind_tx(struct smpp_esme *esme, struct msgb *msg)
{
struct bind_transmitter_t bind;
struct bind_transmitter_resp_t bind_r;
@@ -473,7 +473,7 @@ static int smpp_handle_bind_tx(struct osmo_esme *esme, struct msgb *msg)
SMPP34_UNPACK(rc, BIND_TRANSMITTER, &bind, msgb_data(msg),
msgb_length(msg));
if (rc < 0) {
- LOGPESMERR(esme, "in smpp34_unpack()\n");
+ LOGPESMERR(esme->esme, "in smpp34_unpack()\n");
return rc;
}
@@ -495,13 +495,13 @@ static int smpp_handle_bind_tx(struct osmo_esme *esme, struct msgb *msg)
tlv.value.val16 = esme->smpp_version;
build_tlv(&bind_r.tlv, &tlv);
- rc = PACK_AND_SEND(esme, &bind_r);
+ rc = PACK_AND_SEND(esme->esme, &bind_r);
destroy_tlv(bind_r.tlv);
return rc;
}
/*! \brief handle an incoming SMPP BIND TRANSCEIVER */
-static int smpp_handle_bind_trx(struct osmo_esme *esme, struct msgb *msg)
+static int smpp_handle_bind_trx(struct smpp_esme *esme, struct msgb *msg)
{
struct bind_transceiver_t bind;
struct bind_transceiver_resp_t bind_r;
@@ -510,7 +510,7 @@ static int smpp_handle_bind_trx(struct osmo_esme *esme, struct msgb *msg)
SMPP34_UNPACK(rc, BIND_TRANSCEIVER, &bind, msgb_data(msg),
msgb_length(msg));
if (rc < 0) {
- LOGPESMERR(esme, "in smpp34_unpack()\n");
+ LOGPESMERR(esme->esme, "in smpp34_unpack()\n");
return rc;
}
@@ -523,11 +523,11 @@ static int smpp_handle_bind_trx(struct osmo_esme *esme, struct msgb *msg)
(const char *)bind.system_id, (const char *)bind.password);
bind_r.command_status = rc;
- return PACK_AND_SEND(esme, &bind_r);
+ return PACK_AND_SEND(esme->esme, &bind_r);
}
/*! \brief handle an incoming SMPP UNBIND */
-static int smpp_handle_unbind(struct osmo_esme *esme, struct msgb *msg)
+static int smpp_handle_unbind(struct smpp_esme *esme, struct msgb *msg)
{
struct unbind_t unbind;
struct unbind_resp_t unbind_r;
@@ -536,13 +536,13 @@ static int smpp_handle_unbind(struct osmo_esme *esme, struct msgb *msg)
SMPP34_UNPACK(rc, UNBIND, &unbind, msgb_data(msg),
msgb_length(msg));
if (rc < 0) {
- LOGPESMERR(esme, "in smpp34_unpack()\n");
+ LOGPESMERR(esme->esme, "in smpp34_unpack()\n");
return rc;
}
INIT_RESP(UNBIND_RESP, &unbind_r, &unbind);
- LOGPESME(esme, LOGL_INFO, "Rx UNBIND\n");
+ LOGPESME(esme->esme, LOGL_INFO, "Rx UNBIND\n");
if (esme->bind_flags == 0) {
unbind_r.command_status = ESME_RINVBNDSTS;
@@ -551,11 +551,11 @@ static int smpp_handle_unbind(struct osmo_esme *esme, struct msgb *msg)
esme->bind_flags = 0;
err:
- return PACK_AND_SEND(esme, &unbind_r);
+ return PACK_AND_SEND(esme->esme, &unbind_r);
}
/*! \brief handle an incoming SMPP ENQUIRE LINK */
-static int smpp_handle_enq_link(struct osmo_esme *esme, struct msgb *msg)
+static int smpp_handle_enq_link(struct smpp_esme *esme, struct msgb *msg)
{
struct enquire_link_t enq;
struct enquire_link_resp_t enq_r;
@@ -564,21 +564,21 @@ static int smpp_handle_enq_link(struct osmo_esme *esme, struct msgb *msg)
SMPP34_UNPACK(rc, ENQUIRE_LINK, &enq, msgb_data(msg),
msgb_length(msg));
if (rc < 0) {
- LOGPESMERR(esme, "in smpp34_unpack()\n");
+ LOGPESMERR(esme->esme, "in smpp34_unpack()\n");
return rc;
}
- LOGPESME(esme, LOGL_DEBUG, "Rx Enquire Link\n");
+ LOGPESME(esme->esme, LOGL_DEBUG, "Rx Enquire Link\n");
INIT_RESP(ENQUIRE_LINK_RESP, &enq_r, &enq);
- LOGPESME(esme, LOGL_DEBUG, "Tx Enquire Link Response\n");
+ LOGPESME(esme->esme, LOGL_DEBUG, "Tx Enquire Link Response\n");
- return PACK_AND_SEND(esme, &enq_r);
+ return PACK_AND_SEND(esme->esme, &enq_r);
}
/*! \brief send a SUBMIT-SM RESPONSE to a remote ESME */
-int smpp_tx_submit_r(struct osmo_esme *esme, uint32_t sequence_nr,
+int smpp_tx_submit_r(struct smpp_esme *esme, uint32_t sequence_nr,
uint32_t command_status, char *msg_id)
{
struct submit_sm_resp_t submit_r;
@@ -590,7 +590,7 @@ int smpp_tx_submit_r(struct osmo_esme *esme, uint32_t sequence_nr,
submit_r.sequence_number= sequence_nr;
snprintf((char *) submit_r.message_id, sizeof(submit_r.message_id), "%s", msg_id);
- return PACK_AND_SEND(esme, &submit_r);
+ return PACK_AND_SEND(esme->esme, &submit_r);
}
static const struct value_string smpp_avail_strs[] = {
@@ -601,7 +601,7 @@ static const struct value_string smpp_avail_strs[] = {
};
/*! \brief send an ALERT_NOTIFICATION to a remote ESME */
-int smpp_tx_alert(struct osmo_esme *esme, uint8_t ton, uint8_t npi,
+int smpp_tx_alert(struct smpp_esme *esme, uint8_t ton, uint8_t npi,
const char *addr, uint8_t avail_status)
{
struct alert_notification_t alert;
@@ -612,7 +612,7 @@ int smpp_tx_alert(struct osmo_esme *esme, uint8_t ton, uint8_t npi,
alert.command_length = 0;
alert.command_id = ALERT_NOTIFICATION;
alert.command_status = ESME_ROK;
- alert.sequence_number = esme_inc_seq_nr(esme);
+ alert.sequence_number = esme_inc_seq_nr(esme->esme);
alert.source_addr_ton = ton;
alert.source_addr_npi = npi;
snprintf((char *)alert.source_addr, sizeof(alert.source_addr), "%s", addr);
@@ -622,28 +622,28 @@ int smpp_tx_alert(struct osmo_esme *esme, uint8_t ton, uint8_t npi,
tlv.value.val08 = avail_status;
build_tlv(&alert.tlv, &tlv);
- LOGPESME(esme, LOGL_DEBUG, "Tx ALERT_NOTIFICATION (%s/%u/%u): %s\n",
+ LOGPESME(esme->esme, LOGL_DEBUG, "Tx ALERT_NOTIFICATION (%s/%u/%u): %s\n",
alert.source_addr, alert.source_addr_ton,
alert.source_addr_npi,
get_value_string(smpp_avail_strs, avail_status));
- rc = PACK_AND_SEND(esme, &alert);
+ rc = PACK_AND_SEND(esme->esme, &alert);
destroy_tlv(alert.tlv);
return rc;
}
/* \brief send a DELIVER-SM message to given ESME */
-int smpp_tx_deliver(struct osmo_esme *esme, struct deliver_sm_t *deliver)
+int smpp_tx_deliver(struct smpp_esme *esme, struct deliver_sm_t *deliver)
{
- deliver->sequence_number = esme_inc_seq_nr(esme);
+ deliver->sequence_number = esme_inc_seq_nr(esme->esme);
- LOGPESME(esme, LOGL_DEBUG, "Tx DELIVER-SM (from %s)\n", deliver->source_addr);
+ LOGPESME(esme->esme, LOGL_DEBUG, "Tx DELIVER-SM (from %s)\n", deliver->source_addr);
- return PACK_AND_SEND(esme, deliver);
+ return PACK_AND_SEND(esme->esme, deliver);
}
/*! \brief handle an incoming SMPP DELIVER-SM RESPONSE */
-static int smpp_handle_deliver_resp(struct osmo_esme *esme, struct msgb *msg)
+static int smpp_handle_deliver_resp(struct smpp_esme *esme, struct msgb *msg)
{
struct deliver_sm_resp_t deliver_r;
struct osmo_smpp_cmd *cmd;
@@ -653,13 +653,13 @@ static int smpp_handle_deliver_resp(struct osmo_esme *esme, struct msgb *msg)
SMPP34_UNPACK(rc, DELIVER_SM_RESP, &deliver_r, msgb_data(msg),
msgb_length(msg));
if (rc < 0) {
- LOGPESMERR(esme, "in smpp34_unpack()\n");
+ LOGPESMERR(esme->esme, "in smpp34_unpack()\n");
return rc;
}
cmd = smpp_cmd_find_by_seqnum(esme, deliver_r.sequence_number);
if (!cmd) {
- LOGPESME(esme, LOGL_ERROR, "Rx DELIVER-SM RESP !? (%s)\n",
+ LOGPESME(esme->esme, LOGL_ERROR, "Rx DELIVER-SM RESP !? (%s)\n",
get_value_string(smpp_status_strs, deliver_r.command_status));
return -1;
}
@@ -669,14 +669,14 @@ static int smpp_handle_deliver_resp(struct osmo_esme *esme, struct msgb *msg)
else
smpp_cmd_err(cmd, deliver_r.command_status);
- LOGPESME(esme, LOGL_INFO, "Rx DELIVER-SM RESP (%s)\n",
+ LOGPESME(esme->esme, LOGL_INFO, "Rx DELIVER-SM RESP (%s)\n",
get_value_string(smpp_status_strs, deliver_r.command_status));
return 0;
}
/*! \brief handle an incoming SMPP SUBMIT-SM */
-static int smpp_handle_submit(struct osmo_esme *esme, struct msgb *msg)
+static int smpp_handle_submit(struct smpp_esme *esme, struct msgb *msg)
{
struct submit_sm_t submit;
struct submit_sm_resp_t submit_r;
@@ -686,7 +686,7 @@ static int smpp_handle_submit(struct osmo_esme *esme, struct msgb *msg)
SMPP34_UNPACK(rc, SUBMIT_SM, &submit, msgb_data(msg),
msgb_length(msg));
if (rc < 0) {
- LOGPESMERR(esme, "in smpp34_unpack()\n");
+ LOGPESMERR(esme->esme, "in smpp34_unpack()\n");
return rc;
}
@@ -694,32 +694,32 @@ static int smpp_handle_submit(struct osmo_esme *esme, struct msgb *msg)
if (!(esme->bind_flags & ESME_BIND_TX)) {
submit_r.command_status = ESME_RINVBNDSTS;
- return PACK_AND_SEND(esme, &submit_r);
+ return PACK_AND_SEND(esme->esme, &submit_r);
}
- LOGPESME(esme, LOGL_INFO, "Rx SUBMIT-SM (%s/%u/%u)\n",
+ LOGPESME(esme->esme, LOGL_INFO, "Rx SUBMIT-SM (%s/%u/%u)\n",
submit.destination_addr, submit.dest_addr_ton, submit.dest_addr_npi);
INIT_RESP(SUBMIT_SM_RESP, &submit_r, &submit);
rc = handle_smpp_submit(esme, &submit, &submit_r);
if (rc == 0)
- return PACK_AND_SEND(esme, &submit_r);
+ return PACK_AND_SEND(esme->esme, &submit_r);
return rc;
}
/*! \brief one complete SMPP PDU from the ESME has been received */
-static int smpp_pdu_rx(struct osmo_esme *esme, struct msgb *msg __uses)
+static int smpp_pdu_rx(struct smpp_esme *esme, struct msgb *msg __uses)
{
uint32_t cmd_id = smpp_msgb_cmdid(msg);
int rc = 0;
- LOGPESME(esme, LOGL_DEBUG, "smpp_pdu_rx(%s)\n", msgb_hexdump(msg));
+ LOGPESME(esme->esme, LOGL_DEBUG, "smpp_pdu_rx(%s)\n", msgb_hexdump(msg));
switch (cmd_id) {
case GENERIC_NACK:
- rc = smpp_handle_gen_nack(esme, msg);
+ rc = smpp_handle_gen_nack(esme->esme, msg);
break;
case BIND_RECEIVER:
rc = smpp_handle_bind_rx(esme, msg);
@@ -750,11 +750,11 @@ static int smpp_pdu_rx(struct osmo_esme *esme, struct msgb *msg __uses)
case QUERY_SM:
case REPLACE_SM:
case SUBMIT_MULTI:
- LOGPESME(esme, LOGL_NOTICE, "Unimplemented PDU Command 0x%08x\n", cmd_id);
+ LOGPESME(esme->esme, LOGL_NOTICE, "Unimplemented PDU Command 0x%08x\n", cmd_id);
break;
default:
- LOGPESME(esme, LOGL_ERROR, "Unknown PDU Command 0x%08x\n", cmd_id);
- rc = smpp_tx_gen_nack(esme, smpp_msgb_seq(msg), ESME_RINVCMDID);
+ LOGPESME(esme->esme, LOGL_ERROR, "Unknown PDU Command 0x%08x\n", cmd_id);
+ rc = smpp_tx_gen_nack(esme->esme, smpp_msgb_seq(msg), ESME_RINVCMDID);
break;
}
@@ -781,7 +781,8 @@ static int smpp_pdu_rx(struct osmo_esme *esme, struct msgb *msg __uses)
/* !\brief call-back when per-ESME TCP socket has some data to be read */
static int esme_link_read_cb(struct osmo_fd *ofd)
{
- struct osmo_esme *esme = ofd->data;
+ struct smpp_esme *e = ofd->data;
+ struct esme *esme = e->esme;
uint32_t len;
uint8_t *lenptr = (uint8_t *) &len;
uint8_t *cur;
@@ -828,7 +829,7 @@ static int esme_link_read_cb(struct osmo_fd *ofd)
msgb_put(msg, rc);
if (esme->read_idx >= esme->read_len) {
- rc = smpp_pdu_rx(esme, esme->read_msg);
+ rc = smpp_pdu_rx(e, esme->read_msg);
msgb_free(esme->read_msg);
esme->read_msg = NULL;
esme->read_idx = 0;
@@ -844,9 +845,9 @@ dead_socket:
osmo_fd_unregister(&esme->wqueue.bfd);
close(esme->wqueue.bfd.fd);
esme->wqueue.bfd.fd = -1;
- if (esme->acl)
- esme->acl->esme = NULL;
- smpp_esme_put(esme);
+ if (e->acl)
+ e->acl->esme = NULL;
+ smpp_esme_put(e);
return -EBADF;
}
@@ -854,51 +855,67 @@ dead_socket:
/* call-back of write queue once it wishes to write a message to the socket */
static int esme_link_write_cb(struct osmo_fd *ofd, struct msgb *msg)
{
- struct osmo_esme *esme = ofd->data;
+ struct smpp_esme *esme = ofd->data;
int rc;
rc = write(ofd->fd, msgb_data(msg), msgb_length(msg));
if (rc == 0) {
- osmo_fd_unregister(&esme->wqueue.bfd);
- close(esme->wqueue.bfd.fd);
- esme->wqueue.bfd.fd = -1;
+ osmo_fd_unregister(&esme->esme->wqueue.bfd);
+ close(esme->esme->wqueue.bfd.fd);
+ esme->esme->wqueue.bfd.fd = -1;
if (esme->acl)
esme->acl->esme = NULL;
smpp_esme_put(esme);
} else if (rc < msgb_length(msg)) {
- LOGPESME(esme, LOGL_ERROR, "Short write\n");
+ LOGPESME(esme->esme, LOGL_ERROR, "Short write\n");
return -1;
}
return 0;
}
+struct esme *esme_alloc(void *ctx)
+{
+ struct esme *e = talloc_zero(ctx, struct esme);
+ if (!e)
+ return NULL;
+
+ e->own_seq_nr = rand();
+ esme_inc_seq_nr(e);
+ osmo_wqueue_init(&e->wqueue, 10);
+
+ return e;
+}
+
/* callback for already-accepted new TCP socket */
static int link_accept_cb(struct smsc *smsc, int fd,
struct sockaddr_storage *s, socklen_t s_len)
{
- struct osmo_esme *esme = talloc_zero(smsc, struct osmo_esme);
+ struct smpp_esme *esme = talloc_zero(smsc, struct smpp_esme);
if (!esme) {
close(fd);
return -ENOMEM;
}
+ esme->esme = esme_alloc(esme);
+ if (!esme->esme) {
+ close(fd);
+ return -ENOMEM;
+ }
+
INIT_LLIST_HEAD(&esme->smpp_cmd_list);
smpp_esme_get(esme);
- esme->own_seq_nr = rand();
- esme_inc_seq_nr(esme);
esme->smsc = smsc;
- osmo_wqueue_init(&esme->wqueue, 10);
- osmo_fd_setup(&esme->wqueue.bfd, fd, OSMO_FD_READ, osmo_wqueue_bfd_cb, esme, 0);
+ osmo_fd_setup(&esme->esme->wqueue.bfd, fd, OSMO_FD_READ, osmo_wqueue_bfd_cb, esme, 0);
- if (osmo_fd_register(&esme->wqueue.bfd) != 0) {
+ if (osmo_fd_register(&esme->esme->wqueue.bfd) != 0) {
close(fd);
talloc_free(esme);
return -EIO;
}
- esme->wqueue.read_cb = esme_link_read_cb;
- esme->wqueue.write_cb = esme_link_write_cb;
+ esme->esme->wqueue.read_cb = esme_link_read_cb;
+ esme->esme->wqueue.write_cb = esme_link_write_cb;
llist_add_tail(&esme->list, &smsc->esme_list);
diff --git a/src/libsmpputil/smpp_vty.c b/src/libsmpputil/smpp_vty.c
index 40514d490..fe5c22af7 100644
--- a/src/libsmpputil/smpp_vty.c
+++ b/src/libsmpputil/smpp_vty.c
@@ -522,12 +522,12 @@ DEFUN(cfg_esme_no_alert_notif, cfg_esme_no_alert_notif_cmd,
}
-static void dump_one_esme(struct vty *vty, struct osmo_esme *esme)
+static void dump_one_esme(struct vty *vty, struct smpp_esme *esme)
{
vty_out(vty, "ESME System ID: %s, Password: %s, SMPP Version %02x%s",
- esme->system_id, esme->acl ? esme->acl->passwd : "",
+ esme->esme->system_id, esme->acl ? esme->acl->passwd : "",
esme->smpp_version, VTY_NEWLINE);
- vty_out(vty, " Connection %s%s", osmo_sock_get_name(tall_vty_ctx, esme->wqueue.bfd.fd), VTY_NEWLINE);
+ vty_out(vty, " Connection %s%s", osmo_sock_get_name(tall_vty_ctx, esme->esme->wqueue.bfd.fd), VTY_NEWLINE);
if (esme->smsc->def_route == esme->acl)
vty_out(vty, " Is current default route%s", VTY_NEWLINE);
}
@@ -537,7 +537,7 @@ DEFUN(show_esme, show_esme_cmd,
SHOW_STR "SMPP Interface\n" "SMPP External SMS Entity\n")
{
struct smsc *smsc = smsc_from_vty(vty);
- struct osmo_esme *esme;
+ struct smpp_esme *esme;
llist_for_each_entry(esme, &smsc->esme_list, list)
dump_one_esme(vty, esme);
diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c
index a6b5cd271..dad7db61b 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -49,6 +49,7 @@ struct auth_fsm_priv {
bool is_r99;
bool is_utran;
bool auth_requested;
+ bool auth_mandatory;
int auth_tuple_max_reuse_count; /* see vlr->cfg instead */
};
@@ -344,6 +345,12 @@ static void auth_fsm_wait_ai(struct osmo_fsm_inst *fi, uint32_t event,
|| (event == VLR_AUTH_E_HLR_SAI_NACK &&
gsup->cause != GMM_CAUSE_IMSI_UNKNOWN)
|| (event == VLR_AUTH_E_HLR_SAI_ABORT)) {
+ /* We have no auth tuples. If Authentication is optional i.e. A5/0 is allowed, continue without
+ * authentication. */
+ if (!afp->auth_mandatory) {
+
+ }
+
if (vsub->vlr->cfg.auth_reuse_old_sets_on_error
&& vlr_subscr_has_auth_tuple(vsub, -1)) {
/* To re-use an old tuple, disable the max_reuse_count
@@ -595,7 +602,8 @@ struct osmo_fsm_inst *auth_fsm_start(struct vlr_subscr *vsub,
struct osmo_fsm_inst *parent,
uint32_t parent_term_event,
bool is_r99,
- bool is_utran)
+ bool is_utran,
+ bool auth_mandatory)
{
struct osmo_fsm_inst *fi;
struct auth_fsm_priv *afp;
@@ -618,6 +626,7 @@ struct osmo_fsm_inst *auth_fsm_start(struct vlr_subscr *vsub,
afp->by_imsi = true;
afp->is_r99 = is_r99;
afp->is_utran = is_utran;
+ afp->auth_mandatory = auth_mandatory || is_utran;
fi->priv = afp;
vsub->auth_fsm = fi;
diff --git a/src/libvlr/vlr_lu_fsm.c b/src/libvlr/vlr_lu_fsm.c
index 4f603b3ca..911749b5c 100644
--- a/src/libvlr/vlr_lu_fsm.c
+++ b/src/libvlr/vlr_lu_fsm.c
@@ -676,6 +676,7 @@ struct lu_fsm_priv {
struct osmo_location_area_id old_lai;
struct osmo_location_area_id new_lai;
bool authentication_required;
+ uint8_t a5_encryption_mask;
bool ciphering_required;
uint8_t key_seq;
bool is_r99;
@@ -1465,6 +1466,21 @@ static inline struct lu_fsm_priv *lu_fsm_fi_priv(struct osmo_fsm_inst *fi)
return (struct lu_fsm_priv*)fi->priv;
}
+static bool require_ciphering(const struct vlr_auth_ciph *auth_ciph)
+{
+ if (auth_ciph->is_utran)
+ return (auth_ciph->uea_encryption_mask && (1 << OSMO_UTRAN_UEA0)) == 0;
+ else
+ return (auth_ciph->a5_encryption_mask & GSM0808_ALG_ID_A5_0) == 0;
+}
+
+static bool require_auth(const struct vlr_auth_ciph *auth_ciph)
+{
+ if (auth_ciph->is_utran)
+ return true;
+ return require_ciphering(auth_ciph);
+}
+
struct osmo_fsm_inst *
vlr_loc_update(struct osmo_fsm_inst *parent,
uint32_t parent_event_success,
@@ -1474,19 +1490,23 @@ vlr_loc_update(struct osmo_fsm_inst *parent,
enum vlr_lu_type type, uint32_t tmsi, const char *imsi,
const struct osmo_location_area_id *old_lai,
const struct osmo_location_area_id *new_lai,
- bool authentication_required,
- bool ciphering_required,
+ const struct vlr_auth_ciph *auth_ciph,
uint8_t key_seq,
bool is_r99, bool is_utran,
bool assign_tmsi)
{
struct osmo_fsm_inst *fi;
struct lu_fsm_priv *lfp;
+ const char *auth_ciph_str;
fi = osmo_fsm_inst_alloc_child(&vlr_lu_fsm, parent, parent_event_failure);
if (!fi)
return NULL;
+ /* If A5/0 is not permitted, authentication is required. */
+ if (!(a5_encryption_mask & GSM0808_ALG_ID_A5_0))
+ authentication_required = true;
+
lfp = talloc_zero(fi, struct lu_fsm_priv);
lfp->vlr = vlr;
lfp->msc_conn_ref = msc_conn_ref;
@@ -1498,8 +1518,7 @@ vlr_loc_update(struct osmo_fsm_inst *parent,
lfp->parent_event_success = parent_event_success;
lfp->parent_event_failure = parent_event_failure;
lfp->parent_event_data = parent_event_data;
- lfp->authentication_required = authentication_required;
- lfp->ciphering_required = ciphering_required;
+ lfp->auth_ciph = *auth_ciph;
lfp->key_seq = key_seq;
lfp->is_r99 = is_r99;
lfp->is_utran = is_utran;
@@ -1511,6 +1530,8 @@ vlr_loc_update(struct osmo_fsm_inst *parent,
}
fi->priv = lfp;
+ if (authentication_required || (a5_encryption_mask & GSM0808_ALG_ID_A5_0) == 0) {
+ }
LOGPFSM(fi, "rev=%s net=%s%s%s\n",
is_r99 ? "R99" : "GSM",
is_utran ? "UTRAN" : "GERAN",
@@ -1520,10 +1541,6 @@ vlr_loc_update(struct osmo_fsm_inst *parent,
(ciphering_required? "+Ciph" : " (no Ciph)")
: "");
- if (is_utran && !authentication_required)
- LOGPFSML(fi, LOGL_ERROR,
- "Authentication off on UTRAN network. Good luck.\n");
-
osmo_fsm_inst_dispatch(fi, VLR_ULA_E_UPDATE_LA, NULL);
return fi;
diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index 4ef5948b1..9cc412086 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -608,7 +608,7 @@ int main(int argc, char **argv)
}
#ifdef BUILD_SMPP
- if (smpp_openbsc_alloc_init(tall_msc_ctx) < 0)
+ if (smpp_msc_alloc_init(tall_msc_ctx) < 0)
return -1;
#endif
sgs_iface_init(tall_msc_ctx, msc_network);
@@ -652,7 +652,7 @@ int main(int argc, char **argv)
* following code until iu_init() is legacy. */
#ifdef BUILD_SMPP
- smpp_openbsc_start(msc_network);
+ smpp_msc_start(msc_network);
#endif
/* start control interface after reading config for
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 75a292609..606967245 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -41,9 +41,19 @@ smpp_mirror_CFLAGS = \
smpp_mirror_LDADD = \
$(top_builddir)/src/libsmpputil/libsmpputil.a \
+ $(top_builddir)/src/libmsc/libmsc.a \
+ $(top_builddir)/src/libvlr/libvlr.a \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
+ $(LIBOSMOVTY_LIBS) \
$(LIBOSMONETIF_LIBS) \
$(LIBSMPP34_LIBS) \
+ $(LIBOSMORANAP_LIBS) \
+ $(LIBASN1C_LIBS) \
+ $(LIBOSMOSIGTRAN_LIBS) \
+ $(LIBOSMOMGCPCLIENT_LIBS) \
+ $(LIBOSMOGSUPCLIENT_LIBS) \
+ $(LIBSQLITE3_LIBS) \
+ -lsctp \
$(NULL)
endif
diff --git a/src/utils/smpp_mirror.c b/src/utils/smpp_mirror.c
index d6ac5cf4f..48b9ea292 100644
--- a/src/utils/smpp_mirror.c
+++ b/src/utils/smpp_mirror.c
@@ -21,54 +21,8 @@
#include <osmocom/msc/debug.h>
#include <osmocom/smpp/smpp.h>
-/* FIXME: merge with smpp_smsc.c */
-
-struct esme {
- uint32_t own_seq_nr;
-
- struct osmo_wqueue wqueue;
- enum esme_read_state read_state;
- uint32_t read_len;
- uint32_t read_idx;
- struct msgb *read_msg;
-
- uint8_t smpp_version;
- char system_id[SMPP_SYS_ID_LEN+1];
- char password[SMPP_SYS_ID_LEN+1];
-};
/* FIXME: merge with smpp_smsc.c */
-static uint32_t esme_inc_seq_nr(struct esme *esme)
-{
- esme->own_seq_nr++;
- if (esme->own_seq_nr > 0x7fffffff)
- esme->own_seq_nr = 1;
-
- return esme->own_seq_nr;
-}
-static int pack_and_send(struct esme *esme, uint32_t type, void *ptr)
-{
- struct msgb *msg = msgb_alloc(4096, "SMPP_Tx");
- int rc, rlen;
- if (!msg)
- return -ENOMEM;
-
- rc = smpp34_pack(type, msg->tail, msgb_tailroom(msg), &rlen, ptr);
- if (rc != 0) {
- LOGPESMERR(esme, "during smpp34_pack()\n");
- msgb_free(msg);
- return -EINVAL;
- }
- msgb_put(msg, rlen);
-
- if (osmo_wqueue_enqueue(&esme->wqueue, msg) != 0) {
- LOGPESME(esme, LOGL_ERROR, "Write queue full. Dropping message\n");
- msgb_free(msg);
- return -EAGAIN;
- }
- return 0;
-}
-/* FIXME: merge with smpp_smsc.c */
static struct tlv_t *find_tlv(struct tlv_t *head, uint16_t tag)
{
@@ -292,9 +246,6 @@ static int smpp_esme_init(struct esme *esme, const char *host, uint16_t port)
if (port == 0)
port = 2775;
- esme->own_seq_nr = rand();
- esme_inc_seq_nr(esme);
- osmo_wqueue_init(&esme->wqueue, 10);
esme->wqueue.bfd.data = esme;
esme->wqueue.read_cb = esme_read_cb;
esme->wqueue.write_cb = esme_write_cb;
@@ -322,7 +273,7 @@ const struct log_info log_info = {
int main(int argc, char **argv)
{
- struct esme esme;
+ struct esme *esme;
char *host = "localhost";
int port = 0;
int rc;
@@ -330,20 +281,22 @@ int main(int argc, char **argv)
msgb_talloc_ctx_init(ctx, 0);
- memset(&esme, 0, sizeof(esme));
-
osmo_init_logging2(ctx, &log_info);
- snprintf((char *) esme.system_id, sizeof(esme.system_id), "mirror");
- snprintf((char *) esme.password, sizeof(esme.password), "mirror");
- esme.smpp_version = 0x34;
+ esme = esme_alloc(ctx);
+ if (!esme)
+ exit(2);
+
+ snprintf((char *) esme->system_id, sizeof(esme->system_id), "mirror");
+ snprintf((char *) esme->password, sizeof(esme->password), "mirror");
+ esme->smpp_version = 0x34;
if (argc >= 2)
host = argv[1];
if (argc >= 3)
port = atoi(argv[2]);
- rc = smpp_esme_init(&esme, host, port);
+ rc = smpp_esme_init(esme, host, port);
if (rc < 0)
exit(1);
diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err
index 6c9a5fd07..363b15d1b 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -335,7 +335,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
- Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC
DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ callref-0x80000001 tid-8) Assignment Complete: AMR/8000/1
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ callref-0x80000001 tid-8) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -844,7 +844,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RES
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
- Assignment completes, triggering CRCX to CN
DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) Assignment Complete: AMR/8000/1
+DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -1378,7 +1378,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RES
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
- Assignment completes, triggering CRCX to CN
DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) Assignment Complete: AMR/8000/1
+DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -1831,7 +1831,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
- Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC
DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ callref-0x80000002 tid-8) Assignment Complete: AMR/8000/1
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ callref-0x80000002 tid-8) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -2288,7 +2288,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
- Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC
DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ callref-0x80000003 tid-8) Assignment Complete: AMR/8000/1
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ callref-0x80000003 tid-8) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -2641,7 +2641,7 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){0}: R
- VALIDATE_PERM_SPEECH OK: &bssap_assignment_command_last_channel_type == t->mo_tx_assignment_perm_speech == FR3 HR3 FR2 FR1 HR1
- Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) Assignment Complete: AMR/8000/1
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000004 tid-8) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483652:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483652:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483652:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -2965,7 +2965,7 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Rece
- VALIDATE_PERM_SPEECH OK: &bssap_assignment_command_last_channel_type == t->mt_tx_assignment_perm_speech == FR3 HR3
- Assignment completes, triggering CRCX to CN
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) Assignment Complete: AMR/8000/1
+DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: no change: codecs already set to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -3255,7 +3255,7 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){0}: R
- VALIDATE_PERM_SPEECH OK: &bssap_assignment_command_last_channel_type == t->mo_tx_assignment_perm_speech == FR1
- Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000005 tid-8) Assignment Complete: GSM/8000/1
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000005 tid-8) Assignment Complete: FR1
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483653:RTP_TO_RAN:no-CI){UNINITIALIZED}: no change: codecs already set to GSM#3
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483653:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483653:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -3574,7 +3574,7 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Rece
- VALIDATE_PERM_SPEECH OK: &bssap_assignment_command_last_channel_type == t->mt_tx_assignment_perm_speech == FR1
- Assignment completes, triggering CRCX to CN
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) Assignment Complete: GSM/8000/1
+DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) Assignment Complete: FR1
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: no change: codecs already set to GSM#3
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -3861,7 +3861,7 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){0}: R
- VALIDATE_PERM_SPEECH OK: &bssap_assignment_command_last_channel_type == t->mo_tx_assignment_perm_speech == FR1
- Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000006 tid-8) Assignment Complete: GSM/8000/1
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000006 tid-8) Assignment Complete: FR1
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483654:RTP_TO_RAN:no-CI){UNINITIALIZED}: no change: codecs already set to GSM#3
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483654:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483654:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -4180,7 +4180,7 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Rece
- VALIDATE_PERM_SPEECH OK: &bssap_assignment_command_last_channel_type == t->mt_tx_assignment_perm_speech == FR1
- Assignment completes, triggering CRCX to CN
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) Assignment Complete: GSM/8000/1
+DCC trans(CC:MO_TERM_CALL_CONF IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) Assignment Complete: FR1
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: no change: codecs already set to GSM#3
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -4471,7 +4471,7 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){0}: R
- VALIDATE_PERM_SPEECH OK: &bssap_assignment_command_last_channel_type == t->mo_tx_assignment_perm_speech == FR3 HR3 FR2 FR1 HR1
- Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) Assignment Complete: AMR/8000/1
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000007 tid-8) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483655:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483655:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483655:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
@@ -4885,7 +4885,7 @@ DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){0}: R
- VALIDATE_PERM_SPEECH OK: &bssap_assignment_command_last_channel_type == t->mo_tx_assignment_perm_speech == FR3 HR3 FR2 FR1 HR1
- Assignment succeeds, triggering MNCC_RTP_CREATE ack to MNCC
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) Assignment Complete: AMR/8000/1
+DCC trans(CC:INITIATED IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ callref-0x80000008 tid-8) Assignment Complete: FR3
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483656:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483656:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
DCC rtp_stream(IMSI-901700000010650:MSISDN-46071:GERAN-A:CM_SERVICE_REQ:trans-8:call-2147483656:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index bf21b2a29..ee17304f0 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -1054,13 +1054,12 @@ void ms_sends_assignment_complete(const char *sdp_codec_name)
struct ran_msg ran_dec;
const struct codec_mapping *m = codec_mapping_by_subtype_name(sdp_codec_name);
OSMO_ASSERT(m);
- enum mgcp_codecs assigned_codec = m->mgcp;
ran_dec = (struct ran_msg){
.msg_type = RAN_MSG_ASSIGNMENT_COMPLETE,
.assignment_complete = {
.codec_present = true,
- .codec = assigned_codec,
+ .codec = m->gsm0808_speech_codec,
},
};
osmo_sockaddr_str_from_str(&ran_dec.assignment_complete.remote_rtp, "1.2.3.4", 1234);
diff --git a/tests/stubs.c b/tests/stubs.c
index f29a20146..f4ccb48c7 100644
--- a/tests/stubs.c
+++ b/tests/stubs.c
@@ -46,8 +46,8 @@ int sctp_recvmsg(int sd, void *msg, size_t len, void *from, void *fromlen, void
struct gsm_sms;
struct msc_a;
struct gsm_trans;
-struct osmo_esme;
+struct smpp_esme;
bool smpp_route_smpp_first() { return false; }
-void smpp_esme_put(struct osmo_esme *esme) { return; }
+void smpp_esme_put(struct smpp_esme *esme) { return; }
int smpp_try_deliver(struct gsm_sms *sms, struct msc_a *msc_a) { return 0; }
int sms_route_mt_sms(struct gsm_trans *trans, struct gsm_sms *gsms) { return 0; }