summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/vty_interface.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2011-11-01 16:29:18 +0100
committerSylvain Munaut <tnt@246tNt.com>2011-11-13 20:25:20 +0100
commitfe2e57bc800448703208ab52688b34ffb65bb386 (patch)
treebe456cb7e25ce2f1d3d2f5cfc54ad67be2436c21 /src/host/layer23/src/mobile/vty_interface.c
parentfb7be589e6f2a7e8dcbd560a0b0fdbda7d1fd316 (diff)
host/mobile: Mobile will use SMS Service Center Address from SIM
In case the SMS Service Center Address is not set in the config, the Address from the SIM card is used. The mobile checks if either one is defined, otherwise it will refuse sending SMS. Since records of SIM are read, this patch includes fixes to talk correctly with the SIM client. Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/host/layer23/src/mobile/vty_interface.c')
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index aed6cfa5..5c8d60b7 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -846,7 +846,7 @@ DEFUN(sms, sms_cmd, "sms MS_NAME NUMBER .LINE",
struct osmocom_ms *ms;
struct gsm_settings *set;
struct gsm_settings_abbrev *abbrev;
- char *number;
+ char *number, *sms_sca = NULL;
ms = get_ms(argv[0], vty);
if (!ms)
@@ -859,9 +859,14 @@ DEFUN(sms, sms_cmd, "sms MS_NAME NUMBER .LINE",
return CMD_WARNING;
}
- if (!set->sms_sca[0]) {
- vty_out(vty, "SMS sms-service-center not defined in settings%s",
- VTY_NEWLINE);
+ if (ms->subscr.sms_sca[0])
+ sms_sca = ms->subscr.sms_sca;
+ else if (set->sms_sca[0])
+ sms_sca = set->sms_sca;
+
+ if (!sms_sca) {
+ vty_out(vty, "SMS sms-service-center not defined on SIM card, "
+ "please define one at settings.%s", VTY_NEWLINE);
return CMD_WARNING;
}
@@ -877,7 +882,7 @@ DEFUN(sms, sms_cmd, "sms MS_NAME NUMBER .LINE",
if (vty_check_number(vty, number))
return CMD_WARNING;
- sms_send(ms, number, argv_concat(argv, argc, 2));
+ sms_send(ms, sms_sca, number, argv_concat(argv, argc, 2));
return CMD_SUCCESS;
}