summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Klyuchnikov <kluchnikovi@gmail.com>2018-05-21 18:50:24 +0300
committerIvan Kluchnikov <kluchnikovi@gmail.com>2018-05-21 19:39:26 +0300
commitc2891e441cfdbbc23e302f42a986014d052b7975 (patch)
tree52aa8a9f362126682fa808f3a98cecfad84f0f74
parent34fda429e97f2ac35e0e8a154bd222def9aa2d58 (diff)
sms charging: Add socket for connection to OCS for sms charging
We use implementation of gsup client for this connection, but it makes sense to implement a separate client for these types of connection. Change-Id: I5089c2b68fd8c67dd838290256e677c213416d46
-rw-r--r--openbsc/include/openbsc/gsm_data.h2
-rw-r--r--openbsc/src/libmsc/vty_interface_layer3.c25
2 files changed, 27 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 18f097c06..17aa5a3ba 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -334,6 +334,8 @@ struct gsm_network {
struct gsup_client *hlr_sup_client;
struct gsup_client *ussd_sup_client;
struct gsup_client *sms_client;
+ struct gsup_client *sms_ctf;
+ struct charging_session_id session_id;
unsigned int num_bts;
struct llist_head bts_list;
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 37e794f46..36f793885 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -1078,6 +1078,30 @@ DEFUN(sms_destination, sms_destination_cmd,
return CMD_SUCCESS;
}
+DEFUN(sms_ocs, sms_ocs_cmd,
+ "sms ocs ADDR <0-65535>",
+ "Enable SMS OCS socket to a given address/port" "destination\n" "address or hostname\n" "port number\n")
+{
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+
+ if (gsmnet->sms_ctf) {
+ LOGP(DSUP, LOGL_FATAL, "Can't create two SMS OCS clients\n");
+ vty_out(vty, "%%SMS OCS client already configured%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ gsmnet->sms_ctf = gsup_client_create(argv[0], atoi(argv[1]), &sup_read_cb, NULL);
+ if (!gsmnet->sms_ctf) {
+ LOGP(DSUP, LOGL_FATAL, "Cannot set up SMS OCS socket\n");
+ vty_out(vty, "%%Cannot set up SMS OCS socket%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ init_charging_session_id(gsmnet);
+ gsmnet->sms_ctf->net = gsmnet;
+
+ return CMD_SUCCESS;
+}
+
DEFUN(logging_fltr_imsi,
logging_fltr_imsi_cmd,
"logging filter imsi IMSI",
@@ -1251,6 +1275,7 @@ int bsc_vty_init_extra(void)
install_element(NITB_NODE, &cfg_nitb_no_assign_tmsi_cmd);
install_element(NITB_NODE, &sup_ussd_destination_cmd);
install_element(NITB_NODE, &sms_destination_cmd);
+ install_element(NITB_NODE, &sms_ocs_cmd);
return 0;
}