Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 1 | /* OpenBSC interface to quagga VTY */ |
| 2 | /* (C) 2009 by Harald Welte <laforge@gnumonks.org> |
Holger Hans Peter Freyther | c1cf9d5 | 2011-04-18 17:15:53 +0200 | [diff] [blame] | 3 | * (C) 2009-2011 by Holger Hans Peter Freyther |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 4 | * All Rights Reserved |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 7 | * it under the terms of the GNU Affero General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 14 | * GNU Affero General Public License for more details. |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 15 | * |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 16 | * You should have received a copy of the GNU Affero General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include <stdlib.h> |
Holger Hans Peter Freyther | ae9c9d9 | 2010-12-25 00:33:40 +0100 | [diff] [blame] | 22 | #include <limits.h> |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 23 | #include <unistd.h> |
Max | 3911533 | 2016-06-07 15:32:16 +0200 | [diff] [blame] | 24 | #include <stdbool.h> |
| 25 | #include <inttypes.h> |
Holger Hans Peter Freyther | 2a835d8 | 2013-07-27 19:42:35 +0200 | [diff] [blame] | 26 | #include <time.h> |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 27 | |
Harald Welte | bd9591f | 2010-05-19 19:45:32 +0200 | [diff] [blame] | 28 | #include <osmocom/vty/command.h> |
| 29 | #include <osmocom/vty/buffer.h> |
| 30 | #include <osmocom/vty/vty.h> |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 31 | |
| 32 | #include <arpa/inet.h> |
| 33 | |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 34 | #include <osmocom/core/linuxlist.h> |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 35 | #include <openbsc/gsm_data.h> |
| 36 | #include <openbsc/gsm_subscriber.h> |
Harald Welte | 0101b81 | 2009-11-17 06:00:23 +0100 | [diff] [blame] | 37 | #include <openbsc/silent_call.h> |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 38 | #include <openbsc/gsm_04_11.h> |
Pablo Neira Ayuso | 42e41df | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 39 | #include <osmocom/abis/e1_input.h> |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 40 | #include <openbsc/abis_nm.h> |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 41 | #include <osmocom/gsm/gsm_utils.h> |
| 42 | #include <osmocom/core/utils.h> |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 43 | #include <openbsc/db.h> |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 44 | #include <osmocom/core/talloc.h> |
Harald Welte | b8678a7 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 45 | #include <openbsc/signal.h> |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 46 | #include <openbsc/debug.h> |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 47 | #include <openbsc/vty.h> |
Holger Hans Peter Freyther | b506d72 | 2010-07-26 20:01:07 +0800 | [diff] [blame] | 48 | #include <openbsc/gsm_04_80.h> |
| 49 | #include <openbsc/chan_alloc.h> |
Holger Hans Peter Freyther | 6ec8098 | 2010-12-25 14:08:00 +0100 | [diff] [blame] | 50 | #include <openbsc/sms_queue.h> |
Harald Welte | 1ed89d4 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 51 | #include <openbsc/mncc_int.h> |
Holger Hans Peter Freyther | f4dfea1 | 2012-12-25 08:37:36 +0100 | [diff] [blame] | 52 | #include <openbsc/handover.h> |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 53 | |
Holger Hans Peter Freyther | 75cf52a | 2014-12-28 18:54:32 +0100 | [diff] [blame] | 54 | #include <osmocom/vty/logging.h> |
| 55 | |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 56 | #include "meas_feed.h" |
| 57 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 58 | extern struct gsm_network *gsmnet_from_vty(struct vty *v); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 59 | |
Holger Hans Peter Freyther | dd1f026 | 2015-04-06 09:55:10 +0200 | [diff] [blame] | 60 | static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr) |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 61 | { |
| 62 | int rc; |
Holger Hans Peter Freyther | d2421df | 2015-08-04 13:18:47 +0200 | [diff] [blame] | 63 | int reqs; |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 64 | struct gsm_auth_info ainfo; |
| 65 | struct gsm_auth_tuple atuple; |
Holger Hans Peter Freyther | d2421df | 2015-08-04 13:18:47 +0200 | [diff] [blame] | 66 | struct llist_head *entry; |
Holger Hans Peter Freyther | 2a835d8 | 2013-07-27 19:42:35 +0200 | [diff] [blame] | 67 | char expire_time[200]; |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 68 | |
| 69 | vty_out(vty, " ID: %llu, Authorized: %d%s", subscr->id, |
| 70 | subscr->authorized, VTY_NEWLINE); |
Holger Hans Peter Freyther | 477f928 | 2014-04-04 11:50:41 +0200 | [diff] [blame] | 71 | if (strlen(subscr->name)) |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 72 | vty_out(vty, " Name: '%s'%s", subscr->name, VTY_NEWLINE); |
Holger Hans Peter Freyther | 4fcba8e | 2014-04-04 11:53:18 +0200 | [diff] [blame] | 73 | if (strlen(subscr->extension)) |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 74 | vty_out(vty, " Extension: %s%s", subscr->extension, |
| 75 | VTY_NEWLINE); |
Holger Hans Peter Freyther | ff8dd57 | 2010-12-25 16:40:54 +0100 | [diff] [blame] | 76 | vty_out(vty, " LAC: %d/0x%x%s", |
| 77 | subscr->lac, subscr->lac, VTY_NEWLINE); |
Holger Hans Peter Freyther | b0be39b | 2013-07-14 08:38:24 +0200 | [diff] [blame] | 78 | vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE); |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 79 | if (subscr->tmsi != GSM_RESERVED_TMSI) |
| 80 | vty_out(vty, " TMSI: %08X%s", subscr->tmsi, |
| 81 | VTY_NEWLINE); |
| 82 | |
Sylvain Munaut | 48858d2 | 2010-06-09 11:32:51 +0200 | [diff] [blame] | 83 | rc = db_get_authinfo_for_subscr(&ainfo, subscr); |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 84 | if (!rc) { |
| 85 | vty_out(vty, " A3A8 algorithm id: %d%s", |
| 86 | ainfo.auth_algo, VTY_NEWLINE); |
| 87 | vty_out(vty, " A3A8 Ki: %s%s", |
Pablo Neira Ayuso | b1d5a69 | 2011-05-07 12:12:48 +0200 | [diff] [blame] | 88 | osmo_hexdump(ainfo.a3a8_ki, ainfo.a3a8_ki_len), |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 89 | VTY_NEWLINE); |
| 90 | } |
| 91 | |
Sylvain Munaut | 48858d2 | 2010-06-09 11:32:51 +0200 | [diff] [blame] | 92 | rc = db_get_lastauthtuple_for_subscr(&atuple, subscr); |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 93 | if (!rc) { |
| 94 | vty_out(vty, " A3A8 last tuple (used %d times):%s", |
| 95 | atuple.use_count, VTY_NEWLINE); |
| 96 | vty_out(vty, " seq # : %d%s", |
| 97 | atuple.key_seq, VTY_NEWLINE); |
| 98 | vty_out(vty, " RAND : %s%s", |
Harald Welte | 34ef4c5 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 99 | osmo_hexdump(atuple.vec.rand, sizeof(atuple.vec.rand)), |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 100 | VTY_NEWLINE); |
| 101 | vty_out(vty, " SRES : %s%s", |
Harald Welte | 34ef4c5 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 102 | osmo_hexdump(atuple.vec.sres, sizeof(atuple.vec.sres)), |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 103 | VTY_NEWLINE); |
| 104 | vty_out(vty, " Kc : %s%s", |
Harald Welte | 34ef4c5 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 105 | osmo_hexdump(atuple.vec.kc, sizeof(atuple.vec.kc)), |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 106 | VTY_NEWLINE); |
| 107 | } |
Holger Hans Peter Freyther | 2a835d8 | 2013-07-27 19:42:35 +0200 | [diff] [blame] | 108 | |
| 109 | /* print the expiration time of a subscriber */ |
| 110 | strftime(expire_time, sizeof(expire_time), |
| 111 | "%a, %d %b %Y %T %z", localtime(&subscr->expire_lu)); |
| 112 | expire_time[sizeof(expire_time) - 1] = '\0'; |
| 113 | vty_out(vty, " Expiration Time: %s%s", expire_time, VTY_NEWLINE); |
Holger Hans Peter Freyther | d2421df | 2015-08-04 13:18:47 +0200 | [diff] [blame] | 114 | |
| 115 | reqs = 0; |
| 116 | llist_for_each(entry, &subscr->requests) |
| 117 | reqs += 1; |
| 118 | vty_out(vty, " Paging: %s paging Requests: %d%s", |
| 119 | subscr->is_paging ? "is" : "not", reqs, VTY_NEWLINE); |
Holger Hans Peter Freyther | 1dd0a1b | 2010-01-06 06:00:40 +0100 | [diff] [blame] | 120 | vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE); |
| 121 | } |
| 122 | |
| 123 | |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 124 | /* Subscriber */ |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 125 | DEFUN(show_subscr_cache, |
| 126 | show_subscr_cache_cmd, |
| 127 | "show subscriber cache", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 128 | SHOW_STR "Show information about subscribers\n" |
| 129 | "Display contents of subscriber cache\n") |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 130 | { |
| 131 | struct gsm_subscriber *subscr; |
| 132 | |
| 133 | llist_for_each_entry(subscr, &active_subscribers, entry) { |
| 134 | vty_out(vty, " Subscriber:%s", VTY_NEWLINE); |
Holger Hans Peter Freyther | dd1f026 | 2015-04-06 09:55:10 +0200 | [diff] [blame] | 135 | subscr_dump_full_vty(vty, subscr); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | return CMD_SUCCESS; |
| 139 | } |
| 140 | |
| 141 | DEFUN(sms_send_pend, |
| 142 | sms_send_pend_cmd, |
Sylvain Munaut | c2e0a44 | 2009-12-22 13:22:29 +0100 | [diff] [blame] | 143 | "sms send pending", |
Neels Hofmeyr | 375e3f4 | 2016-04-01 02:17:24 +0200 | [diff] [blame] | 144 | "SMS related commands\n" "SMS Sending related commands\n" |
Sylvain Munaut | c2e0a44 | 2009-12-22 13:22:29 +0100 | [diff] [blame] | 145 | "Send all pending SMS") |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 146 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 147 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 148 | struct gsm_sms *sms; |
Sylvain Munaut | c2e0a44 | 2009-12-22 13:22:29 +0100 | [diff] [blame] | 149 | int id = 0; |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 150 | |
| 151 | while (1) { |
Holger Hans Peter Freyther | ae9c9d9 | 2010-12-25 00:33:40 +0100 | [diff] [blame] | 152 | sms = db_sms_get_unsent_by_subscr(gsmnet, id, UINT_MAX); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 153 | if (!sms) |
Sylvain Munaut | c2e0a44 | 2009-12-22 13:22:29 +0100 | [diff] [blame] | 154 | break; |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 155 | |
| 156 | gsm411_send_sms_subscr(sms->receiver, sms); |
Sylvain Munaut | c2e0a44 | 2009-12-22 13:22:29 +0100 | [diff] [blame] | 157 | |
| 158 | id = sms->receiver->id + 1; |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | return CMD_SUCCESS; |
| 162 | } |
| 163 | |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 164 | static int _send_sms_str(struct gsm_subscriber *receiver, |
| 165 | struct gsm_subscriber *sender, |
| 166 | char *str, uint8_t tp_pid) |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 167 | { |
| 168 | struct gsm_sms *sms; |
| 169 | |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 170 | sms = sms_from_text(receiver, sender, 0, str); |
Harald Welte | 9ee8ee9 | 2009-11-05 15:51:17 +0900 | [diff] [blame] | 171 | sms->protocol_id = tp_pid; |
Nico Golde | 2e6bc80 | 2010-06-29 20:13:06 +0200 | [diff] [blame] | 172 | |
Holger Hans Peter Freyther | e78b443 | 2010-12-25 15:57:34 +0100 | [diff] [blame] | 173 | /* store in database for the queue */ |
| 174 | if (db_sms_store(sms) != 0) { |
Holger Hans Peter Freyther | d0a34ed | 2012-11-10 19:46:58 +0100 | [diff] [blame] | 175 | LOGP(DLSMS, LOGL_ERROR, "Failed to store SMS in Database\n"); |
Holger Hans Peter Freyther | e78b443 | 2010-12-25 15:57:34 +0100 | [diff] [blame] | 176 | sms_free(sms); |
| 177 | return CMD_WARNING; |
Nico Golde | 2e6bc80 | 2010-06-29 20:13:06 +0200 | [diff] [blame] | 178 | } |
Neels Hofmeyr | 69cc0a1 | 2016-05-09 21:48:53 +0200 | [diff] [blame] | 179 | LOGP(DLSMS, LOGL_DEBUG, "SMS stored in DB\n"); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 180 | |
Holger Hans Peter Freyther | e78b443 | 2010-12-25 15:57:34 +0100 | [diff] [blame] | 181 | sms_free(sms); |
Jacob Erlbeck | da8770b | 2014-12-03 09:28:24 +0100 | [diff] [blame] | 182 | sms_queue_trigger(receiver->group->net->sms_queue); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 183 | return CMD_SUCCESS; |
| 184 | } |
| 185 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 186 | static struct gsm_subscriber *get_subscr_by_argv(struct gsm_network *gsmnet, |
| 187 | const char *type, |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 188 | const char *id) |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 189 | { |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 190 | if (!strcmp(type, "extension")) |
Jacob Erlbeck | da8770b | 2014-12-03 09:28:24 +0100 | [diff] [blame] | 191 | return subscr_get_by_extension(gsmnet->subscr_group, id); |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 192 | else if (!strcmp(type, "imsi")) |
Jacob Erlbeck | da8770b | 2014-12-03 09:28:24 +0100 | [diff] [blame] | 193 | return subscr_get_by_imsi(gsmnet->subscr_group, id); |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 194 | else if (!strcmp(type, "tmsi")) |
Jacob Erlbeck | da8770b | 2014-12-03 09:28:24 +0100 | [diff] [blame] | 195 | return subscr_get_by_tmsi(gsmnet->subscr_group, atoi(id)); |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 196 | else if (!strcmp(type, "id")) |
Jacob Erlbeck | da8770b | 2014-12-03 09:28:24 +0100 | [diff] [blame] | 197 | return subscr_get_by_id(gsmnet->subscr_group, atoi(id)); |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 198 | |
| 199 | return NULL; |
| 200 | } |
| 201 | #define SUBSCR_TYPES "(extension|imsi|tmsi|id)" |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 202 | #define SUBSCR_HELP "Operations on a Subscriber\n" \ |
Neels Hofmeyr | 375e3f4 | 2016-04-01 02:17:24 +0200 | [diff] [blame] | 203 | "Identify subscriber by extension (phone number)\n" \ |
| 204 | "Identify subscriber by IMSI\n" \ |
| 205 | "Identify subscriber by TMSI\n" \ |
| 206 | "Identify subscriber by database ID\n" \ |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 207 | "Identifier for the subscriber\n" |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 208 | |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 209 | DEFUN(show_subscr, |
| 210 | show_subscr_cmd, |
| 211 | "show subscriber " SUBSCR_TYPES " ID", |
| 212 | SHOW_STR SUBSCR_HELP) |
| 213 | { |
| 214 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 215 | struct gsm_subscriber *subscr = |
| 216 | get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
| 217 | |
| 218 | if (!subscr) { |
| 219 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 220 | argv[0], argv[1], VTY_NEWLINE); |
| 221 | return CMD_WARNING; |
| 222 | } |
| 223 | |
Holger Hans Peter Freyther | dd1f026 | 2015-04-06 09:55:10 +0200 | [diff] [blame] | 224 | subscr_dump_full_vty(vty, subscr); |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 225 | |
| 226 | subscr_put(subscr); |
| 227 | |
| 228 | return CMD_SUCCESS; |
| 229 | } |
| 230 | |
Alexander Chemeris | e092dec | 2013-10-04 23:54:17 +0200 | [diff] [blame] | 231 | DEFUN(subscriber_create, |
| 232 | subscriber_create_cmd, |
| 233 | "subscriber create imsi ID", |
| 234 | "Operations on a Subscriber\n" \ |
| 235 | "Create new subscriber\n" \ |
| 236 | "Identify the subscriber by his IMSI\n" \ |
| 237 | "Identifier for the subscriber\n") |
| 238 | { |
| 239 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 240 | struct gsm_subscriber *subscr; |
| 241 | |
Holger Hans Peter Freyther | 19206b8 | 2016-04-01 20:21:03 +0200 | [diff] [blame] | 242 | subscr = subscr_get_by_imsi(gsmnet->subscr_group, argv[0]); |
| 243 | if (subscr) |
| 244 | db_sync_subscriber(subscr); |
| 245 | else { |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 246 | subscr = subscr_create_subscriber(gsmnet->subscr_group, argv[0]); |
Holger Hans Peter Freyther | 19206b8 | 2016-04-01 20:21:03 +0200 | [diff] [blame] | 247 | |
| 248 | if (!subscr) { |
| 249 | vty_out(vty, "%% No subscriber created for IMSI %s%s", |
| 250 | argv[0], VTY_NEWLINE); |
| 251 | return CMD_WARNING; |
| 252 | } |
Alexander Chemeris | e092dec | 2013-10-04 23:54:17 +0200 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | /* Show info about the created subscriber. */ |
Holger Hans Peter Freyther | dd1f026 | 2015-04-06 09:55:10 +0200 | [diff] [blame] | 256 | subscr_dump_full_vty(vty, subscr); |
Alexander Chemeris | e092dec | 2013-10-04 23:54:17 +0200 | [diff] [blame] | 257 | |
| 258 | subscr_put(subscr); |
| 259 | |
| 260 | return CMD_SUCCESS; |
| 261 | } |
| 262 | |
Nico Golde | 55ab246 | 2011-02-22 17:54:47 +0100 | [diff] [blame] | 263 | DEFUN(subscriber_send_pending_sms, |
| 264 | subscriber_send_pending_sms_cmd, |
Holger Hans Peter Freyther | e6a500e | 2012-07-20 23:55:08 +0200 | [diff] [blame] | 265 | "subscriber " SUBSCR_TYPES " ID sms pending-send", |
Nico Golde | 55ab246 | 2011-02-22 17:54:47 +0100 | [diff] [blame] | 266 | SUBSCR_HELP "SMS Operations\n" "Send pending SMS\n") |
| 267 | { |
| 268 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | e6e99e1 | 2013-07-04 20:34:46 +0200 | [diff] [blame] | 269 | struct gsm_subscriber *subscr; |
Nico Golde | 55ab246 | 2011-02-22 17:54:47 +0100 | [diff] [blame] | 270 | struct gsm_sms *sms; |
| 271 | |
Holger Hans Peter Freyther | e6e99e1 | 2013-07-04 20:34:46 +0200 | [diff] [blame] | 272 | subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
| 273 | if (!subscr) { |
| 274 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 275 | argv[0], argv[1], VTY_NEWLINE); |
| 276 | return CMD_WARNING; |
| 277 | } |
| 278 | |
Nico Golde | 55ab246 | 2011-02-22 17:54:47 +0100 | [diff] [blame] | 279 | sms = db_sms_get_unsent_by_subscr(gsmnet, subscr->id, UINT_MAX); |
| 280 | if (sms) |
| 281 | gsm411_send_sms_subscr(sms->receiver, sms); |
| 282 | |
| 283 | subscr_put(subscr); |
| 284 | |
| 285 | return CMD_SUCCESS; |
| 286 | } |
| 287 | |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 288 | DEFUN(subscriber_send_sms, |
| 289 | subscriber_send_sms_cmd, |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 290 | "subscriber " SUBSCR_TYPES " ID sms sender " SUBSCR_TYPES " SENDER_ID send .LINE", |
Holger Hans Peter Freyther | ebe3725 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 291 | SUBSCR_HELP "SMS Operations\n" SUBSCR_HELP "Send SMS\n" "Actual SMS Text\n") |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 292 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 293 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 294 | struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 295 | struct gsm_subscriber *sender = get_subscr_by_argv(gsmnet, argv[2], argv[3]); |
Harald Welte | 3699e20 | 2010-05-16 19:28:32 +0200 | [diff] [blame] | 296 | char *str; |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 297 | int rc; |
| 298 | |
Harald Welte | 81cf198 | 2009-11-14 10:11:45 +0100 | [diff] [blame] | 299 | if (!subscr) { |
| 300 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 301 | argv[0], argv[1], VTY_NEWLINE); |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 302 | rc = CMD_WARNING; |
| 303 | goto err; |
Harald Welte | 81cf198 | 2009-11-14 10:11:45 +0100 | [diff] [blame] | 304 | } |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 305 | |
| 306 | if (!sender) { |
| 307 | vty_out(vty, "%% No sender found for %s %s%s", |
| 308 | argv[2], argv[3], VTY_NEWLINE); |
| 309 | rc = CMD_WARNING; |
| 310 | goto err; |
| 311 | } |
| 312 | |
| 313 | str = argv_concat(argv, argc, 4); |
| 314 | rc = _send_sms_str(subscr, sender, str, 0); |
Harald Welte | 3699e20 | 2010-05-16 19:28:32 +0200 | [diff] [blame] | 315 | talloc_free(str); |
Harald Welte | 9ee8ee9 | 2009-11-05 15:51:17 +0900 | [diff] [blame] | 316 | |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 317 | err: |
| 318 | if (sender) |
| 319 | subscr_put(sender); |
| 320 | |
| 321 | if (subscr) |
| 322 | subscr_put(subscr); |
Harald Welte | bbe3172 | 2009-11-14 10:10:54 +0100 | [diff] [blame] | 323 | |
Harald Welte | 9ee8ee9 | 2009-11-05 15:51:17 +0900 | [diff] [blame] | 324 | return rc; |
| 325 | } |
| 326 | |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 327 | DEFUN(subscriber_silent_sms, |
| 328 | subscriber_silent_sms_cmd, |
Harald Welte | 3ed864f | 2014-07-10 20:19:00 +0200 | [diff] [blame] | 329 | |
| 330 | "subscriber " SUBSCR_TYPES " ID silent-sms sender " SUBSCR_TYPES " SENDER_ID send .LINE", |
| 331 | SUBSCR_HELP "Silent SMS Operations\n" SUBSCR_HELP "Send SMS\n" "Actual SMS Text\n") |
Harald Welte | 9ee8ee9 | 2009-11-05 15:51:17 +0900 | [diff] [blame] | 332 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 333 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 334 | struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 335 | struct gsm_subscriber *sender = get_subscr_by_argv(gsmnet, argv[2], argv[3]); |
Harald Welte | 3699e20 | 2010-05-16 19:28:32 +0200 | [diff] [blame] | 336 | char *str; |
Harald Welte | 9ee8ee9 | 2009-11-05 15:51:17 +0900 | [diff] [blame] | 337 | int rc; |
| 338 | |
Harald Welte | 81cf198 | 2009-11-14 10:11:45 +0100 | [diff] [blame] | 339 | if (!subscr) { |
| 340 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 341 | argv[0], argv[1], VTY_NEWLINE); |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 342 | rc = CMD_WARNING; |
| 343 | goto err; |
Harald Welte | 81cf198 | 2009-11-14 10:11:45 +0100 | [diff] [blame] | 344 | } |
Harald Welte | 9ee8ee9 | 2009-11-05 15:51:17 +0900 | [diff] [blame] | 345 | |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 346 | if (!sender) { |
| 347 | vty_out(vty, "%% No sender found for %s %s%s", |
| 348 | argv[2], argv[3], VTY_NEWLINE); |
| 349 | rc = CMD_WARNING; |
| 350 | goto err; |
| 351 | } |
| 352 | |
| 353 | str = argv_concat(argv, argc, 4); |
| 354 | rc = _send_sms_str(subscr, sender, str, 64); |
Harald Welte | 3699e20 | 2010-05-16 19:28:32 +0200 | [diff] [blame] | 355 | talloc_free(str); |
Harald Welte | 9ee8ee9 | 2009-11-05 15:51:17 +0900 | [diff] [blame] | 356 | |
Sylvain Munaut | 9431faa | 2012-12-28 00:49:01 +0100 | [diff] [blame] | 357 | err: |
| 358 | if (sender) |
| 359 | subscr_put(sender); |
| 360 | |
| 361 | if (subscr) |
| 362 | subscr_put(subscr); |
Harald Welte | bbe3172 | 2009-11-14 10:10:54 +0100 | [diff] [blame] | 363 | |
Harald Welte | 9ee8ee9 | 2009-11-05 15:51:17 +0900 | [diff] [blame] | 364 | return rc; |
| 365 | } |
| 366 | |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 367 | #define CHAN_TYPES "(any|tch/f|tch/any|sdcch)" |
| 368 | #define CHAN_TYPE_HELP \ |
| 369 | "Any channel\n" \ |
| 370 | "TCH/F channel\n" \ |
| 371 | "Any TCH channel\n" \ |
| 372 | "SDCCH channel\n" |
| 373 | |
Sylvain Munaut | 1c378a7 | 2010-01-02 14:29:43 +0100 | [diff] [blame] | 374 | DEFUN(subscriber_silent_call_start, |
| 375 | subscriber_silent_call_start_cmd, |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 376 | "subscriber " SUBSCR_TYPES " ID silent-call start (any|tch/f|tch/any|sdcch)", |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 377 | SUBSCR_HELP "Silent call operation\n" "Start silent call\n" |
| 378 | CHAN_TYPE_HELP) |
Sylvain Munaut | 1c378a7 | 2010-01-02 14:29:43 +0100 | [diff] [blame] | 379 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 380 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 381 | struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
Sylvain Munaut | 1c378a7 | 2010-01-02 14:29:43 +0100 | [diff] [blame] | 382 | int rc, type; |
| 383 | |
| 384 | if (!subscr) { |
| 385 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 386 | argv[0], argv[1], VTY_NEWLINE); |
| 387 | return CMD_WARNING; |
| 388 | } |
| 389 | |
| 390 | if (!strcmp(argv[2], "tch/f")) |
| 391 | type = RSL_CHANNEED_TCH_F; |
| 392 | else if (!strcmp(argv[2], "tch/any")) |
| 393 | type = RSL_CHANNEED_TCH_ForH; |
| 394 | else if (!strcmp(argv[2], "sdcch")) |
| 395 | type = RSL_CHANNEED_SDCCH; |
| 396 | else |
| 397 | type = RSL_CHANNEED_ANY; /* Defaults to ANY */ |
| 398 | |
| 399 | rc = gsm_silent_call_start(subscr, vty, type); |
| 400 | if (rc <= 0) { |
| 401 | vty_out(vty, "%% Subscriber not attached%s", |
| 402 | VTY_NEWLINE); |
| 403 | subscr_put(subscr); |
| 404 | return CMD_WARNING; |
| 405 | } |
| 406 | |
| 407 | subscr_put(subscr); |
| 408 | |
| 409 | return CMD_SUCCESS; |
| 410 | } |
| 411 | |
| 412 | DEFUN(subscriber_silent_call_stop, |
| 413 | subscriber_silent_call_stop_cmd, |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 414 | "subscriber " SUBSCR_TYPES " ID silent-call stop", |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 415 | SUBSCR_HELP "Silent call operation\n" "Stop silent call\n" |
| 416 | CHAN_TYPE_HELP) |
Harald Welte | b8678a7 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 417 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 418 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 419 | struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
Harald Welte | b8678a7 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 420 | int rc; |
| 421 | |
| 422 | if (!subscr) { |
| 423 | vty_out(vty, "%% No subscriber found for %s %s%s", |
Harald Welte | 81cf198 | 2009-11-14 10:11:45 +0100 | [diff] [blame] | 424 | argv[0], argv[1], VTY_NEWLINE); |
Harald Welte | b8678a7 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 425 | return CMD_WARNING; |
| 426 | } |
| 427 | |
Sylvain Munaut | 1c378a7 | 2010-01-02 14:29:43 +0100 | [diff] [blame] | 428 | rc = gsm_silent_call_stop(subscr); |
| 429 | if (rc < 0) { |
| 430 | subscr_put(subscr); |
| 431 | return CMD_WARNING; |
Harald Welte | b8678a7 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | subscr_put(subscr); |
| 435 | |
| 436 | return CMD_SUCCESS; |
| 437 | } |
| 438 | |
Holger Hans Peter Freyther | b506d72 | 2010-07-26 20:01:07 +0800 | [diff] [blame] | 439 | DEFUN(subscriber_ussd_notify, |
| 440 | subscriber_ussd_notify_cmd, |
Holger Hans Peter Freyther | 7429476 | 2010-07-27 18:27:46 +0800 | [diff] [blame] | 441 | "subscriber " SUBSCR_TYPES " ID ussd-notify (0|1|2) .TEXT", |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 442 | SUBSCR_HELP "Send a USSD notify to the subscriber\n" |
Harald Welte | 557f399 | 2012-08-16 23:23:50 +0200 | [diff] [blame] | 443 | "Alerting Level 0\n" |
| 444 | "Alerting Level 1\n" |
| 445 | "Alerting Level 2\n" |
| 446 | "Text of USSD message to send\n") |
Holger Hans Peter Freyther | b506d72 | 2010-07-26 20:01:07 +0800 | [diff] [blame] | 447 | { |
| 448 | char *text; |
| 449 | struct gsm_subscriber_connection *conn; |
| 450 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 451 | struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
Holger Hans Peter Freyther | 7429476 | 2010-07-27 18:27:46 +0800 | [diff] [blame] | 452 | int level; |
Holger Hans Peter Freyther | b506d72 | 2010-07-26 20:01:07 +0800 | [diff] [blame] | 453 | |
| 454 | if (!subscr) { |
| 455 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 456 | argv[0], argv[1], VTY_NEWLINE); |
| 457 | return CMD_WARNING; |
| 458 | } |
| 459 | |
Holger Hans Peter Freyther | 7429476 | 2010-07-27 18:27:46 +0800 | [diff] [blame] | 460 | level = atoi(argv[2]); |
| 461 | text = argv_concat(argv, argc, 3); |
Holger Hans Peter Freyther | b506d72 | 2010-07-26 20:01:07 +0800 | [diff] [blame] | 462 | if (!text) { |
| 463 | subscr_put(subscr); |
| 464 | return CMD_WARNING; |
| 465 | } |
| 466 | |
| 467 | conn = connection_for_subscr(subscr); |
| 468 | if (!conn) { |
| 469 | vty_out(vty, "%% An active connection is required for %s %s%s", |
| 470 | argv[0], argv[1], VTY_NEWLINE); |
| 471 | subscr_put(subscr); |
| 472 | talloc_free(text); |
| 473 | return CMD_WARNING; |
| 474 | } |
| 475 | |
Neels Hofmeyr | c58c0e5 | 2016-05-10 12:50:31 +0200 | [diff] [blame] | 476 | msc_send_ussd_notify(conn, level, text); |
| 477 | msc_send_ussd_release_complete(conn); |
Holger Hans Peter Freyther | b506d72 | 2010-07-26 20:01:07 +0800 | [diff] [blame] | 478 | |
| 479 | subscr_put(subscr); |
| 480 | talloc_free(text); |
| 481 | return CMD_SUCCESS; |
| 482 | } |
| 483 | |
Ruben Pollan | 6af2b40 | 2014-09-24 20:50:13 -0500 | [diff] [blame] | 484 | DEFUN(ena_subscr_delete, |
| 485 | ena_subscr_delete_cmd, |
| 486 | "subscriber " SUBSCR_TYPES " ID delete", |
| 487 | SUBSCR_HELP "Delete subscriber in HLR\n") |
| 488 | { |
| 489 | int rc; |
| 490 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 491 | struct gsm_subscriber *subscr = |
| 492 | get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
| 493 | |
| 494 | if (!subscr) { |
| 495 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 496 | argv[0], argv[1], VTY_NEWLINE); |
| 497 | return CMD_WARNING; |
| 498 | } |
| 499 | |
| 500 | if (subscr->use_count != 1) { |
| 501 | vty_out(vty, "Removing active subscriber%s", VTY_NEWLINE); |
| 502 | } |
| 503 | |
| 504 | rc = db_subscriber_delete(subscr); |
| 505 | subscr_put(subscr); |
| 506 | |
| 507 | if (rc != 0) { |
| 508 | vty_out(vty, "Failed to remove subscriber%s", VTY_NEWLINE); |
| 509 | return CMD_WARNING; |
| 510 | } |
| 511 | |
| 512 | return CMD_SUCCESS; |
| 513 | } |
| 514 | |
Keith | b4aba77 | 2017-01-18 17:09:33 +0100 | [diff] [blame] | 515 | DEFUN(ena_subscr_expire, |
| 516 | ena_subscr_expire_cmd, |
| 517 | "subscriber " SUBSCR_TYPES " ID expire", |
| 518 | SUBSCR_HELP "Expire the subscriber Now\n") |
| 519 | { |
Keith | b4aba77 | 2017-01-18 17:09:33 +0100 | [diff] [blame] | 520 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 521 | struct gsm_subscriber *subscr = |
| 522 | get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
| 523 | |
| 524 | if (!subscr) { |
| 525 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 526 | argv[0], argv[1], VTY_NEWLINE); |
| 527 | return CMD_WARNING; |
| 528 | } |
| 529 | |
| 530 | subscr->expire_lu = time(0); |
| 531 | db_sync_subscriber(subscr); |
| 532 | subscr_put(subscr); |
| 533 | |
| 534 | return CMD_SUCCESS; |
| 535 | } |
| 536 | |
Ruben Pollan | 6af2b40 | 2014-09-24 20:50:13 -0500 | [diff] [blame] | 537 | DEFUN(ena_subscr_authorized, |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 538 | ena_subscr_authorized_cmd, |
| 539 | "subscriber " SUBSCR_TYPES " ID authorized (0|1)", |
| 540 | SUBSCR_HELP "(De-)Authorize subscriber in HLR\n" |
| 541 | "Subscriber should NOT be authorized\n" |
| 542 | "Subscriber should be authorized\n") |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 543 | { |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 544 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 545 | struct gsm_subscriber *subscr = |
| 546 | get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
| 547 | |
| 548 | if (!subscr) { |
| 549 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 550 | argv[0], argv[1], VTY_NEWLINE); |
| 551 | return CMD_WARNING; |
| 552 | } |
| 553 | |
| 554 | subscr->authorized = atoi(argv[2]); |
| 555 | db_sync_subscriber(subscr); |
| 556 | |
| 557 | subscr_put(subscr); |
| 558 | |
| 559 | return CMD_SUCCESS; |
| 560 | } |
| 561 | |
| 562 | DEFUN(ena_subscr_name, |
| 563 | ena_subscr_name_cmd, |
Harald Welte | 3368e36 | 2010-06-24 08:06:38 +0200 | [diff] [blame] | 564 | "subscriber " SUBSCR_TYPES " ID name .NAME", |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 565 | SUBSCR_HELP "Set the name of the subscriber\n" |
| 566 | "Name of the Subscriber\n") |
| 567 | { |
| 568 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 569 | struct gsm_subscriber *subscr = |
| 570 | get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
Harald Welte | 3368e36 | 2010-06-24 08:06:38 +0200 | [diff] [blame] | 571 | char *name; |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 572 | |
| 573 | if (!subscr) { |
| 574 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 575 | argv[0], argv[1], VTY_NEWLINE); |
| 576 | return CMD_WARNING; |
| 577 | } |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 578 | |
Harald Welte | 3368e36 | 2010-06-24 08:06:38 +0200 | [diff] [blame] | 579 | name = argv_concat(argv, argc, 2); |
Holger Hans Peter Freyther | a36df37 | 2010-07-26 19:43:54 +0800 | [diff] [blame] | 580 | if (!name) { |
| 581 | subscr_put(subscr); |
Harald Welte | 3368e36 | 2010-06-24 08:06:38 +0200 | [diff] [blame] | 582 | return CMD_WARNING; |
Holger Hans Peter Freyther | a36df37 | 2010-07-26 19:43:54 +0800 | [diff] [blame] | 583 | } |
Harald Welte | 3368e36 | 2010-06-24 08:06:38 +0200 | [diff] [blame] | 584 | |
Jacob Erlbeck | 508c310 | 2015-04-07 17:49:49 +0200 | [diff] [blame] | 585 | if (strlen(name) > sizeof(subscr->name)-1) { |
| 586 | vty_out(vty, |
Holger Hans Peter Freyther | c3b9cf6 | 2015-08-03 09:28:41 +0200 | [diff] [blame] | 587 | "%% NAME is too long, max. %zu characters are allowed%s", |
Jacob Erlbeck | 508c310 | 2015-04-07 17:49:49 +0200 | [diff] [blame] | 588 | sizeof(subscr->name)-1, VTY_NEWLINE); |
| 589 | return CMD_WARNING; |
| 590 | } |
| 591 | |
Neels Hofmeyr | 5644c2b | 2017-01-13 03:12:08 +0100 | [diff] [blame] | 592 | osmo_strlcpy(subscr->name, name, sizeof(subscr->name)); |
Harald Welte | 3368e36 | 2010-06-24 08:06:38 +0200 | [diff] [blame] | 593 | talloc_free(name); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 594 | db_sync_subscriber(subscr); |
| 595 | |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 596 | subscr_put(subscr); |
| 597 | |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 598 | return CMD_SUCCESS; |
| 599 | } |
| 600 | |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 601 | DEFUN(ena_subscr_extension, |
| 602 | ena_subscr_extension_cmd, |
| 603 | "subscriber " SUBSCR_TYPES " ID extension EXTENSION", |
| 604 | SUBSCR_HELP "Set the extension (phone number) of the subscriber\n" |
| 605 | "Extension (phone number)\n") |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 606 | { |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 607 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 608 | struct gsm_subscriber *subscr = |
| 609 | get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
Holger Hans Peter Freyther | c1cf9d5 | 2011-04-18 17:15:53 +0200 | [diff] [blame] | 610 | const char *ext = argv[2]; |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 611 | |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 612 | if (!subscr) { |
| 613 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 614 | argv[0], argv[1], VTY_NEWLINE); |
| 615 | return CMD_WARNING; |
| 616 | } |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 617 | |
Jacob Erlbeck | 508c310 | 2015-04-07 17:49:49 +0200 | [diff] [blame] | 618 | if (strlen(ext) > sizeof(subscr->extension)-1) { |
| 619 | vty_out(vty, |
Holger Hans Peter Freyther | c3b9cf6 | 2015-08-03 09:28:41 +0200 | [diff] [blame] | 620 | "%% EXTENSION is too long, max. %zu characters are allowed%s", |
Jacob Erlbeck | 508c310 | 2015-04-07 17:49:49 +0200 | [diff] [blame] | 621 | sizeof(subscr->extension)-1, VTY_NEWLINE); |
| 622 | return CMD_WARNING; |
| 623 | } |
| 624 | |
Neels Hofmeyr | 64a40bf | 2017-01-13 03:10:54 +0100 | [diff] [blame] | 625 | osmo_strlcpy(subscr->extension, ext, sizeof(subscr->extension)); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 626 | db_sync_subscriber(subscr); |
| 627 | |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 628 | subscr_put(subscr); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 629 | |
| 630 | return CMD_SUCCESS; |
| 631 | } |
| 632 | |
Holger Hans Peter Freyther | f4dfea1 | 2012-12-25 08:37:36 +0100 | [diff] [blame] | 633 | DEFUN(ena_subscr_handover, |
| 634 | ena_subscr_handover_cmd, |
| 635 | "subscriber " SUBSCR_TYPES " ID handover BTS_NR", |
| 636 | SUBSCR_HELP "Handover the active connection\n" |
| 637 | "Number of the BTS to handover to\n") |
| 638 | { |
| 639 | int ret; |
| 640 | struct gsm_subscriber_connection *conn; |
| 641 | struct gsm_bts *bts; |
| 642 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 643 | struct gsm_subscriber *subscr = |
| 644 | get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
| 645 | |
| 646 | if (!subscr) { |
| 647 | vty_out(vty, "%% No subscriber found for %s %s.%s", |
| 648 | argv[0], argv[1], VTY_NEWLINE); |
| 649 | return CMD_WARNING; |
| 650 | } |
| 651 | |
| 652 | conn = connection_for_subscr(subscr); |
| 653 | if (!conn) { |
| 654 | vty_out(vty, "%% No active connection for subscriber %s %s.%s", |
| 655 | argv[0], argv[1], VTY_NEWLINE); |
| 656 | subscr_put(subscr); |
| 657 | return CMD_WARNING; |
| 658 | } |
| 659 | |
| 660 | bts = gsm_bts_num(gsmnet, atoi(argv[2])); |
| 661 | if (!bts) { |
| 662 | vty_out(vty, "%% BTS with number(%d) could not be found.%s", |
| 663 | atoi(argv[2]), VTY_NEWLINE); |
| 664 | subscr_put(subscr); |
| 665 | return CMD_WARNING; |
| 666 | } |
| 667 | |
| 668 | /* now start the handover */ |
| 669 | ret = bsc_handover_start(conn->lchan, bts); |
| 670 | if (ret != 0) { |
| 671 | vty_out(vty, "%% Handover failed with errno %d.%s", |
| 672 | ret, VTY_NEWLINE); |
| 673 | } else { |
| 674 | vty_out(vty, "%% Handover started from %s", |
| 675 | gsm_lchan_name(conn->lchan)); |
| 676 | vty_out(vty, " to %s.%s", gsm_lchan_name(conn->ho_lchan), |
| 677 | VTY_NEWLINE); |
| 678 | } |
| 679 | |
| 680 | subscr_put(subscr); |
| 681 | return CMD_SUCCESS; |
| 682 | } |
| 683 | |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 684 | #define A3A8_ALG_TYPES "(none|xor|comp128v1)" |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 685 | #define A3A8_ALG_HELP \ |
| 686 | "Use No A3A8 algorithm\n" \ |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 687 | "Use XOR algorithm\n" \ |
Harald Welte | 18ce31c | 2010-05-14 20:05:17 +0200 | [diff] [blame] | 688 | "Use COMP128v1 algorithm\n" |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 689 | |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 690 | DEFUN(ena_subscr_a3a8, |
| 691 | ena_subscr_a3a8_cmd, |
| 692 | "subscriber " SUBSCR_TYPES " ID a3a8 " A3A8_ALG_TYPES " [KI]", |
Harald Welte | c4bf319 | 2010-05-27 10:48:11 +0200 | [diff] [blame] | 693 | SUBSCR_HELP "Set a3a8 parameters for the subscriber\n" |
| 694 | A3A8_ALG_HELP "Encryption Key Ki\n") |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 695 | { |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 696 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 697 | struct gsm_subscriber *subscr = |
| 698 | get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
| 699 | const char *alg_str = argv[2]; |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 700 | const char *ki_str = argc == 4 ? argv[3] : NULL; |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 701 | struct gsm_auth_info ainfo; |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 702 | int rc, minlen, maxlen; |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 703 | |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 704 | if (!subscr) { |
| 705 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 706 | argv[0], argv[1], VTY_NEWLINE); |
| 707 | return CMD_WARNING; |
| 708 | } |
| 709 | |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 710 | if (!strcasecmp(alg_str, "none")) { |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 711 | ainfo.auth_algo = AUTH_ALGO_NONE; |
| 712 | minlen = maxlen = 0; |
| 713 | } else if (!strcasecmp(alg_str, "xor")) { |
| 714 | ainfo.auth_algo = AUTH_ALGO_XOR; |
| 715 | minlen = A38_XOR_MIN_KEY_LEN; |
| 716 | maxlen = A38_XOR_MAX_KEY_LEN; |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 717 | } else if (!strcasecmp(alg_str, "comp128v1")) { |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 718 | ainfo.auth_algo = AUTH_ALGO_COMP128v1; |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 719 | minlen = maxlen = A38_COMP128_KEY_LEN; |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 720 | } else { |
| 721 | /* Unknown method */ |
Holger Hans Peter Freyther | 32531c4 | 2010-12-28 22:26:34 +0100 | [diff] [blame] | 722 | subscr_put(subscr); |
Pablo Neira Ayuso | 9cda7a0 | 2011-05-03 22:44:39 +0200 | [diff] [blame] | 723 | vty_out(vty, "%% Unknown auth method %s%s", |
| 724 | alg_str, VTY_NEWLINE); |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 725 | return CMD_WARNING; |
| 726 | } |
| 727 | |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 728 | if (ki_str) { |
Pablo Neira Ayuso | b1d5a69 | 2011-05-07 12:12:48 +0200 | [diff] [blame] | 729 | rc = osmo_hexparse(ki_str, ainfo.a3a8_ki, sizeof(ainfo.a3a8_ki)); |
Holger Hans Peter Freyther | 32531c4 | 2010-12-28 22:26:34 +0100 | [diff] [blame] | 730 | if ((rc > maxlen) || (rc < minlen)) { |
| 731 | subscr_put(subscr); |
Pablo Neira Ayuso | 9cda7a0 | 2011-05-03 22:44:39 +0200 | [diff] [blame] | 732 | vty_out(vty, "%% Wrong Ki `%s'%s", |
| 733 | ki_str, VTY_NEWLINE); |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 734 | return CMD_WARNING; |
Holger Hans Peter Freyther | 32531c4 | 2010-12-28 22:26:34 +0100 | [diff] [blame] | 735 | } |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 736 | ainfo.a3a8_ki_len = rc; |
| 737 | } else { |
| 738 | ainfo.a3a8_ki_len = 0; |
Holger Hans Peter Freyther | 32531c4 | 2010-12-28 22:26:34 +0100 | [diff] [blame] | 739 | if (minlen) { |
| 740 | subscr_put(subscr); |
Pablo Neira Ayuso | 9cda7a0 | 2011-05-03 22:44:39 +0200 | [diff] [blame] | 741 | vty_out(vty, "%% Missing Ki argument%s", VTY_NEWLINE); |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 742 | return CMD_WARNING; |
Holger Hans Peter Freyther | 32531c4 | 2010-12-28 22:26:34 +0100 | [diff] [blame] | 743 | } |
Sylvain Munaut | 4887644 | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 744 | } |
| 745 | |
| 746 | rc = db_sync_authinfo_for_subscr( |
| 747 | ainfo.auth_algo == AUTH_ALGO_NONE ? NULL : &ainfo, |
| 748 | subscr); |
| 749 | |
Sylvain Munaut | 0d7d991 | 2010-06-10 22:00:48 +0200 | [diff] [blame] | 750 | /* the last tuple probably invalid with the new auth settings */ |
| 751 | db_sync_lastauthtuple_for_subscr(NULL, subscr); |
Holger Hans Peter Freyther | 32531c4 | 2010-12-28 22:26:34 +0100 | [diff] [blame] | 752 | subscr_put(subscr); |
Sylvain Munaut | 0d7d991 | 2010-06-10 22:00:48 +0200 | [diff] [blame] | 753 | |
Pablo Neira Ayuso | 9cda7a0 | 2011-05-03 22:44:39 +0200 | [diff] [blame] | 754 | if (rc) { |
| 755 | vty_out(vty, "%% Operation has failed%s", VTY_NEWLINE); |
| 756 | return CMD_WARNING; |
| 757 | } |
| 758 | return CMD_SUCCESS; |
Sylvain Munaut | dcf8c4c | 2009-12-27 19:30:46 +0100 | [diff] [blame] | 759 | } |
| 760 | |
Holger Hans Peter Freyther | ed1d030 | 2010-12-22 16:33:23 +0100 | [diff] [blame] | 761 | DEFUN(subscriber_purge, |
| 762 | subscriber_purge_cmd, |
| 763 | "subscriber purge-inactive", |
| 764 | "Operations on a Subscriber\n" "Purge subscribers with a zero use count.\n") |
| 765 | { |
| 766 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 767 | int purged; |
| 768 | |
Jacob Erlbeck | da8770b | 2014-12-03 09:28:24 +0100 | [diff] [blame] | 769 | purged = subscr_purge_inactive(net->subscr_group); |
Holger Hans Peter Freyther | ed1d030 | 2010-12-22 16:33:23 +0100 | [diff] [blame] | 770 | vty_out(vty, "%d subscriber(s) were purged.%s", purged, VTY_NEWLINE); |
| 771 | return CMD_SUCCESS; |
| 772 | } |
| 773 | |
Holger Hans Peter Freyther | 0c29e5f | 2010-12-22 18:12:11 +0100 | [diff] [blame] | 774 | DEFUN(subscriber_update, |
| 775 | subscriber_update_cmd, |
| 776 | "subscriber " SUBSCR_TYPES " ID update", |
| 777 | SUBSCR_HELP "Update the subscriber data from the dabase.\n") |
| 778 | { |
| 779 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 780 | struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]); |
| 781 | |
| 782 | if (!subscr) { |
| 783 | vty_out(vty, "%% No subscriber found for %s %s%s", |
| 784 | argv[0], argv[1], VTY_NEWLINE); |
| 785 | return CMD_WARNING; |
| 786 | } |
| 787 | |
| 788 | subscr_update_from_db(subscr); |
| 789 | subscr_put(subscr); |
| 790 | return CMD_SUCCESS; |
| 791 | } |
| 792 | |
Harald Welte | b8678a7 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 793 | static int scall_cbfn(unsigned int subsys, unsigned int signal, |
| 794 | void *handler_data, void *signal_data) |
| 795 | { |
| 796 | struct scall_signal_data *sigdata = signal_data; |
| 797 | struct vty *vty = sigdata->data; |
| 798 | |
| 799 | switch (signal) { |
| 800 | case S_SCALL_SUCCESS: |
| 801 | vty_out(vty, "%% silent call on ARFCN %u timeslot %u%s", |
Holger Hans Peter Freyther | d3aaf66 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 802 | sigdata->conn->lchan->ts->trx->arfcn, sigdata->conn->lchan->ts->nr, |
Harald Welte | b8678a7 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 803 | VTY_NEWLINE); |
| 804 | break; |
| 805 | case S_SCALL_EXPIRED: |
| 806 | vty_out(vty, "%% silent call expired paging%s", VTY_NEWLINE); |
| 807 | break; |
| 808 | } |
| 809 | return 0; |
| 810 | } |
| 811 | |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 812 | DEFUN(show_stats, |
| 813 | show_stats_cmd, |
| 814 | "show statistics", |
| 815 | SHOW_STR "Display network statistics\n") |
| 816 | { |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 817 | struct gsm_network *net = gsmnet_from_vty(vty); |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 818 | |
| 819 | openbsc_vty_print_statistics(vty, net); |
| 820 | vty_out(vty, "Location Update : %lu attach, %lu normal, %lu periodic%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 821 | net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_TYPE_ATTACH].current, |
| 822 | net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_TYPE_NORMAL].current, |
| 823 | net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_TYPE_PERIODIC].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 824 | VTY_NEWLINE); |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 825 | vty_out(vty, "IMSI Detach Indications : %lu%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 826 | net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_TYPE_DETACH].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 827 | VTY_NEWLINE); |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 828 | vty_out(vty, "Location Update Response: %lu accept, %lu reject%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 829 | net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_ACCEPT].current, |
| 830 | net->msc_ctrs->ctr[MSC_CTR_LOC_UPDATE_RESP_REJECT].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 831 | VTY_NEWLINE); |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 832 | vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, " |
| 833 | "%lu completed, %lu failed%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 834 | net->msc_ctrs->ctr[BSC_CTR_HANDOVER_ATTEMPTED].current, |
| 835 | net->msc_ctrs->ctr[BSC_CTR_HANDOVER_NO_CHANNEL].current, |
| 836 | net->msc_ctrs->ctr[BSC_CTR_HANDOVER_TIMEOUT].current, |
| 837 | net->msc_ctrs->ctr[BSC_CTR_HANDOVER_COMPLETED].current, |
| 838 | net->msc_ctrs->ctr[BSC_CTR_HANDOVER_FAILED].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 839 | VTY_NEWLINE); |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 840 | vty_out(vty, "SMS MO : %lu submitted, %lu no receiver%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 841 | net->msc_ctrs->ctr[MSC_CTR_SMS_SUBMITTED].current, |
| 842 | net->msc_ctrs->ctr[MSC_CTR_SMS_NO_RECEIVER].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 843 | VTY_NEWLINE); |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 844 | vty_out(vty, "SMS MT : %lu delivered, %lu no memory, %lu other error%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 845 | net->msc_ctrs->ctr[MSC_CTR_SMS_DELIVERED].current, |
| 846 | net->msc_ctrs->ctr[MSC_CTR_SMS_RP_ERR_MEM].current, |
| 847 | net->msc_ctrs->ctr[MSC_CTR_SMS_RP_ERR_OTHER].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 848 | VTY_NEWLINE); |
Harald Welte | c56006b | 2010-12-24 16:06:33 +0100 | [diff] [blame] | 849 | vty_out(vty, "MO Calls : %lu setup, %lu connect ack%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 850 | net->msc_ctrs->ctr[MSC_CTR_CALL_MO_SETUP].current, |
| 851 | net->msc_ctrs->ctr[MSC_CTR_CALL_MO_CONNECT_ACK].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 852 | VTY_NEWLINE); |
Harald Welte | c56006b | 2010-12-24 16:06:33 +0100 | [diff] [blame] | 853 | vty_out(vty, "MT Calls : %lu setup, %lu connect%s", |
Alexander Couzens | d8aad3a | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 854 | net->msc_ctrs->ctr[MSC_CTR_CALL_MT_SETUP].current, |
| 855 | net->msc_ctrs->ctr[MSC_CTR_CALL_MT_CONNECT].current, |
Alexander Couzens | 65bfd76 | 2016-07-12 15:42:02 +0200 | [diff] [blame] | 856 | VTY_NEWLINE); |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 857 | return CMD_SUCCESS; |
| 858 | } |
| 859 | |
Holger Hans Peter Freyther | 6ec8098 | 2010-12-25 14:08:00 +0100 | [diff] [blame] | 860 | DEFUN(show_smsqueue, |
| 861 | show_smsqueue_cmd, |
| 862 | "show sms-queue", |
| 863 | SHOW_STR "Display SMSqueue statistics\n") |
| 864 | { |
| 865 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 866 | |
| 867 | sms_queue_stats(net->sms_queue, vty); |
| 868 | return CMD_SUCCESS; |
| 869 | } |
| 870 | |
Holger Hans Peter Freyther | 58fe028 | 2010-12-25 14:15:32 +0100 | [diff] [blame] | 871 | DEFUN(smsqueue_trigger, |
| 872 | smsqueue_trigger_cmd, |
| 873 | "sms-queue trigger", |
| 874 | "SMS Queue\n" "Trigger sending messages\n") |
| 875 | { |
| 876 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 877 | |
| 878 | sms_queue_trigger(net->sms_queue); |
| 879 | return CMD_SUCCESS; |
| 880 | } |
Holger Hans Peter Freyther | e789b21 | 2010-04-15 11:28:14 +0200 | [diff] [blame] | 881 | |
Holger Hans Peter Freyther | 96b4d35 | 2010-12-25 14:25:12 +0100 | [diff] [blame] | 882 | DEFUN(smsqueue_max, |
| 883 | smsqueue_max_cmd, |
| 884 | "sms-queue max-pending <1-500>", |
Holger Hans Peter Freyther | e6a500e | 2012-07-20 23:55:08 +0200 | [diff] [blame] | 885 | "SMS Queue\n" "SMS to deliver in parallel\n" "Amount\n") |
Holger Hans Peter Freyther | 96b4d35 | 2010-12-25 14:25:12 +0100 | [diff] [blame] | 886 | { |
| 887 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 888 | |
| 889 | sms_queue_set_max_pending(net->sms_queue, atoi(argv[0])); |
| 890 | return CMD_SUCCESS; |
| 891 | } |
| 892 | |
Holger Hans Peter Freyther | 416c7de | 2010-12-25 14:38:30 +0100 | [diff] [blame] | 893 | DEFUN(smsqueue_clear, |
| 894 | smsqueue_clear_cmd, |
| 895 | "sms-queue clear", |
| 896 | "SMS Queue\n" "Clear the queue of pending SMS\n") |
| 897 | { |
| 898 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 899 | |
| 900 | sms_queue_clear(net->sms_queue); |
| 901 | return CMD_SUCCESS; |
| 902 | } |
| 903 | |
Holger Hans Peter Freyther | 70428d9 | 2010-12-25 14:50:50 +0100 | [diff] [blame] | 904 | DEFUN(smsqueue_fail, |
| 905 | smsqueue_fail_cmd, |
| 906 | "sms-queue max-failure <1-500>", |
Holger Hans Peter Freyther | e6a500e | 2012-07-20 23:55:08 +0200 | [diff] [blame] | 907 | "SMS Queue\n" "Maximum amount of delivery failures\n" "Amount\n") |
Holger Hans Peter Freyther | 70428d9 | 2010-12-25 14:50:50 +0100 | [diff] [blame] | 908 | { |
| 909 | struct gsm_network *net = gsmnet_from_vty(vty); |
| 910 | |
| 911 | sms_queue_set_max_failure(net->sms_queue, atoi(argv[0])); |
| 912 | return CMD_SUCCESS; |
| 913 | } |
| 914 | |
Harald Welte | 1ed89d4 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 915 | |
| 916 | DEFUN(cfg_mncc_int, cfg_mncc_int_cmd, |
| 917 | "mncc-int", "Configure internal MNCC handler") |
| 918 | { |
| 919 | vty->node = MNCC_INT_NODE; |
| 920 | |
| 921 | return CMD_SUCCESS; |
| 922 | } |
| 923 | |
| 924 | static struct cmd_node mncc_int_node = { |
| 925 | MNCC_INT_NODE, |
Harald Welte | 45362bb | 2012-08-17 13:16:10 +0200 | [diff] [blame] | 926 | "%s(config-mncc-int)# ", |
Harald Welte | 1ed89d4 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 927 | 1, |
| 928 | }; |
| 929 | |
| 930 | static const struct value_string tchf_codec_names[] = { |
| 931 | { GSM48_CMODE_SPEECH_V1, "fr" }, |
| 932 | { GSM48_CMODE_SPEECH_EFR, "efr" }, |
| 933 | { GSM48_CMODE_SPEECH_AMR, "amr" }, |
| 934 | { 0, NULL } |
| 935 | }; |
| 936 | |
| 937 | static const struct value_string tchh_codec_names[] = { |
| 938 | { GSM48_CMODE_SPEECH_V1, "hr" }, |
| 939 | { GSM48_CMODE_SPEECH_AMR, "amr" }, |
| 940 | { 0, NULL } |
| 941 | }; |
| 942 | |
| 943 | static int config_write_mncc_int(struct vty *vty) |
| 944 | { |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 945 | uint16_t meas_port; |
| 946 | char *meas_host; |
Holger Hans Peter Freyther | 65b8992 | 2015-01-31 09:47:37 +0100 | [diff] [blame] | 947 | const char *meas_scenario; |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 948 | |
| 949 | meas_feed_cfg_get(&meas_host, &meas_port); |
Holger Hans Peter Freyther | 65b8992 | 2015-01-31 09:47:37 +0100 | [diff] [blame] | 950 | meas_scenario = meas_feed_scenario_get(); |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 951 | |
Harald Welte | 1ed89d4 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 952 | vty_out(vty, "mncc-int%s", VTY_NEWLINE); |
| 953 | vty_out(vty, " default-codec tch-f %s%s", |
| 954 | get_value_string(tchf_codec_names, mncc_int.def_codec[0]), |
| 955 | VTY_NEWLINE); |
| 956 | vty_out(vty, " default-codec tch-h %s%s", |
| 957 | get_value_string(tchh_codec_names, mncc_int.def_codec[1]), |
| 958 | VTY_NEWLINE); |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 959 | if (meas_port) |
| 960 | vty_out(vty, " meas-feed destination %s %u%s", |
| 961 | meas_host, meas_port, VTY_NEWLINE); |
Holger Hans Peter Freyther | 65b8992 | 2015-01-31 09:47:37 +0100 | [diff] [blame] | 962 | if (strlen(meas_scenario) > 0) |
| 963 | vty_out(vty, " meas-feed scenario %s%s", |
| 964 | meas_scenario, VTY_NEWLINE); |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 965 | |
Harald Welte | 1ed89d4 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 966 | |
| 967 | return CMD_SUCCESS; |
| 968 | } |
| 969 | |
| 970 | DEFUN(mnccint_def_codec_f, |
| 971 | mnccint_def_codec_f_cmd, |
| 972 | "default-codec tch-f (fr|efr|amr)", |
| 973 | "Set default codec\n" "Codec for TCH/F\n" |
| 974 | "Full-Rate\n" "Enhanced Full-Rate\n" "Adaptive Multi-Rate\n") |
| 975 | { |
| 976 | mncc_int.def_codec[0] = get_string_value(tchf_codec_names, argv[0]); |
| 977 | |
| 978 | return CMD_SUCCESS; |
| 979 | } |
| 980 | |
| 981 | DEFUN(mnccint_def_codec_h, |
| 982 | mnccint_def_codec_h_cmd, |
| 983 | "default-codec tch-h (hr|amr)", |
| 984 | "Set default codec\n" "Codec for TCH/H\n" |
| 985 | "Half-Rate\n" "Adaptive Multi-Rate\n") |
| 986 | { |
| 987 | mncc_int.def_codec[1] = get_string_value(tchh_codec_names, argv[0]); |
| 988 | |
| 989 | return CMD_SUCCESS; |
| 990 | } |
| 991 | |
Holger Hans Peter Freyther | ebe3725 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 992 | #define OBSOLETE_MSG "Obsolete\n" |
Harald Welte | 3073f52 | 2013-02-12 11:15:49 +0100 | [diff] [blame] | 993 | /* this is just for backwards compatibility as the sms code moved into |
| 994 | * libosmocore and old config files no longer parse... */ |
| 995 | DEFUN_DEPRECATED(log_level_sms, log_level_sms_cmd, |
| 996 | "logging level sms (everything|debug|info|notice|error|fatal)", |
Holger Hans Peter Freyther | ebe3725 | 2013-03-03 09:32:08 +0100 | [diff] [blame] | 997 | ".HIDDEN\n" OBSOLETE_MSG OBSOLETE_MSG OBSOLETE_MSG OBSOLETE_MSG |
| 998 | OBSOLETE_MSG OBSOLETE_MSG OBSOLETE_MSG OBSOLETE_MSG) |
Harald Welte | 3073f52 | 2013-02-12 11:15:49 +0100 | [diff] [blame] | 999 | { |
| 1000 | vty_out(vty, "%% 'logging level sms' is now called 'logging level " |
| 1001 | "lsms', please update your config %s", VTY_NEWLINE); |
| 1002 | |
| 1003 | return CMD_SUCCESS; |
| 1004 | } |
| 1005 | |
Holger Hans Peter Freyther | 54c0124 | 2015-01-31 09:26:20 +0100 | [diff] [blame] | 1006 | #define MEAS_STR "Measurement export related\n" |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 1007 | DEFUN(mnccint_meas_feed, mnccint_meas_feed_cmd, |
| 1008 | "meas-feed destination ADDR <0-65535>", |
Holger Hans Peter Freyther | 54c0124 | 2015-01-31 09:26:20 +0100 | [diff] [blame] | 1009 | MEAS_STR "destination\n" "address or hostname\n" "port number\n") |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 1010 | { |
| 1011 | int rc; |
| 1012 | |
| 1013 | rc = meas_feed_cfg_set(argv[0], atoi(argv[1])); |
| 1014 | if (rc < 0) |
| 1015 | return CMD_WARNING; |
| 1016 | |
| 1017 | return CMD_SUCCESS; |
| 1018 | } |
| 1019 | |
| 1020 | DEFUN(meas_feed_scenario, meas_feed_scenario_cmd, |
| 1021 | "meas-feed scenario NAME", |
Holger Hans Peter Freyther | 54c0124 | 2015-01-31 09:26:20 +0100 | [diff] [blame] | 1022 | MEAS_STR "scenario\n" "Name up to 31 characters included in report\n") |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 1023 | { |
| 1024 | meas_feed_scenario_set(argv[0]); |
| 1025 | |
| 1026 | return CMD_SUCCESS; |
| 1027 | } |
| 1028 | |
Holger Hans Peter Freyther | 75cf52a | 2014-12-28 18:54:32 +0100 | [diff] [blame] | 1029 | |
| 1030 | DEFUN(logging_fltr_imsi, |
| 1031 | logging_fltr_imsi_cmd, |
| 1032 | "logging filter imsi IMSI", |
| 1033 | LOGGING_STR FILTER_STR |
| 1034 | "Filter log messages by IMSI\n" "IMSI to be used as filter\n") |
| 1035 | { |
| 1036 | struct gsm_subscriber *subscr; |
| 1037 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1038 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
| 1039 | |
| 1040 | if (!tgt) |
| 1041 | return CMD_WARNING; |
| 1042 | |
| 1043 | subscr = subscr_get_by_imsi(gsmnet->subscr_group, argv[0]); |
| 1044 | if (!subscr) { |
| 1045 | vty_out(vty, "%%no subscriber with IMSI(%s)%s", |
| 1046 | argv[0], VTY_NEWLINE); |
| 1047 | return CMD_WARNING; |
| 1048 | } |
| 1049 | |
| 1050 | log_set_imsi_filter(tgt, subscr); |
| 1051 | return CMD_SUCCESS; |
| 1052 | } |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1053 | |
| 1054 | static struct cmd_node nitb_node = { |
| 1055 | NITB_NODE, |
| 1056 | "%s(config-nitb)# ", |
| 1057 | 1, |
| 1058 | }; |
| 1059 | |
| 1060 | DEFUN(cfg_nitb, cfg_nitb_cmd, |
| 1061 | "nitb", "Configure NITB options") |
| 1062 | { |
| 1063 | vty->node = NITB_NODE; |
| 1064 | return CMD_SUCCESS; |
| 1065 | } |
| 1066 | |
Max | 3911533 | 2016-06-07 15:32:16 +0200 | [diff] [blame] | 1067 | /* Note: limit on the parameter length is set by internal vty code limitations */ |
| 1068 | DEFUN(cfg_nitb_subscr_random, cfg_nitb_subscr_random_cmd, |
| 1069 | "subscriber-create-on-demand random <1-9999999999> <2-9999999999>", |
| 1070 | "Set random parameters for a new record when a subscriber is first seen.\n" |
| 1071 | "Set random parameters for a new record when a subscriber is first seen.\n" |
| 1072 | "Minimum for subscriber extension\n""Maximum for subscriber extension\n") |
| 1073 | { |
| 1074 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1075 | uint64_t mi = atoi(argv[0]), ma = atoi(argv[1]); |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 1076 | gsmnet->auto_create_subscr = true; |
| 1077 | gsmnet->auto_assign_exten = true; |
Max | 3911533 | 2016-06-07 15:32:16 +0200 | [diff] [blame] | 1078 | if (mi >= ma) { |
| 1079 | vty_out(vty, "Incorrect range: %s >= %s, expected MIN < MAX%s", |
| 1080 | argv[0], argv[1], VTY_NEWLINE); |
| 1081 | return CMD_WARNING; |
| 1082 | } |
| 1083 | gsmnet->ext_min = mi; |
| 1084 | gsmnet->ext_max = ma; |
| 1085 | return CMD_SUCCESS; |
| 1086 | } |
| 1087 | |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1088 | DEFUN(cfg_nitb_subscr_create, cfg_nitb_subscr_create_cmd, |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 1089 | "subscriber-create-on-demand [no-extension]", |
Max | 0a378ba | 2016-05-24 14:23:27 +0200 | [diff] [blame] | 1090 | "Make a new record when a subscriber is first seen.\n" |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 1091 | "Do not automatically assign extension to created subscribers\n") |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1092 | { |
| 1093 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 1094 | gsmnet->auto_create_subscr = true; |
| 1095 | gsmnet->auto_assign_exten = argc ? false : true; |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1096 | return CMD_SUCCESS; |
| 1097 | } |
| 1098 | |
| 1099 | DEFUN(cfg_nitb_no_subscr_create, cfg_nitb_no_subscr_create_cmd, |
| 1100 | "no subscriber-create-on-demand", |
| 1101 | NO_STR "Make a new record when a subscriber is first seen.\n") |
| 1102 | { |
| 1103 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 1104 | gsmnet->auto_create_subscr = false; |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1105 | return CMD_SUCCESS; |
| 1106 | } |
| 1107 | |
Holger Hans Peter Freyther | 1387df7 | 2015-07-13 20:33:08 +0200 | [diff] [blame] | 1108 | DEFUN(cfg_nitb_assign_tmsi, cfg_nitb_assign_tmsi_cmd, |
| 1109 | "assign-tmsi", |
| 1110 | "Assign TMSI during Location Updating.\n") |
| 1111 | { |
| 1112 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1113 | gsmnet->avoid_tmsi = 0; |
| 1114 | return CMD_SUCCESS; |
| 1115 | } |
| 1116 | |
| 1117 | DEFUN(cfg_nitb_no_assign_tmsi, cfg_nitb_no_assign_tmsi_cmd, |
| 1118 | "no assign-tmsi", |
| 1119 | NO_STR "Assign TMSI during Location Updating.\n") |
| 1120 | { |
| 1121 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
| 1122 | gsmnet->avoid_tmsi = 1; |
| 1123 | return CMD_SUCCESS; |
| 1124 | } |
| 1125 | |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1126 | static int config_write_nitb(struct vty *vty) |
| 1127 | { |
| 1128 | struct gsm_network *gsmnet = gsmnet_from_vty(vty); |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 1129 | |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1130 | vty_out(vty, "nitb%s", VTY_NEWLINE); |
Max | 5872641 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 1131 | if (!gsmnet->auto_create_subscr) |
| 1132 | vty_out(vty, " no subscriber-create-on-demand%s", VTY_NEWLINE); |
| 1133 | else |
| 1134 | vty_out(vty, " subscriber-create-on-demand%s%s", |
| 1135 | gsmnet->auto_assign_exten ? "" : " no-extension", |
| 1136 | VTY_NEWLINE); |
| 1137 | |
Max | 3911533 | 2016-06-07 15:32:16 +0200 | [diff] [blame] | 1138 | if (gsmnet->ext_min != GSM_MIN_EXTEN || gsmnet->ext_max != GSM_MAX_EXTEN) |
| 1139 | vty_out(vty, " subscriber-create-on-demand random %"PRIu64" %" |
| 1140 | PRIu64"%s", gsmnet->ext_min, gsmnet->ext_max, |
| 1141 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 1387df7 | 2015-07-13 20:33:08 +0200 | [diff] [blame] | 1142 | vty_out(vty, " %sassign-tmsi%s", |
| 1143 | gsmnet->avoid_tmsi ? "no " : "", VTY_NEWLINE); |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1144 | return CMD_SUCCESS; |
| 1145 | } |
| 1146 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 1147 | int bsc_vty_init_extra(void) |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 1148 | { |
Pablo Neira Ayuso | ef717c6 | 2011-05-06 12:12:31 +0200 | [diff] [blame] | 1149 | osmo_signal_register_handler(SS_SCALL, scall_cbfn, NULL); |
Harald Welte | b8678a7 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 1150 | |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 1151 | install_element_ve(&show_subscr_cmd); |
| 1152 | install_element_ve(&show_subscr_cache_cmd); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 1153 | |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 1154 | install_element_ve(&sms_send_pend_cmd); |
Harald Welte | 194ef7b | 2009-11-14 08:00:53 +0100 | [diff] [blame] | 1155 | |
Alexander Chemeris | e092dec | 2013-10-04 23:54:17 +0200 | [diff] [blame] | 1156 | install_element_ve(&subscriber_create_cmd); |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 1157 | install_element_ve(&subscriber_send_sms_cmd); |
| 1158 | install_element_ve(&subscriber_silent_sms_cmd); |
| 1159 | install_element_ve(&subscriber_silent_call_start_cmd); |
| 1160 | install_element_ve(&subscriber_silent_call_stop_cmd); |
Holger Hans Peter Freyther | b506d72 | 2010-07-26 20:01:07 +0800 | [diff] [blame] | 1161 | install_element_ve(&subscriber_ussd_notify_cmd); |
Holger Hans Peter Freyther | 0c29e5f | 2010-12-22 18:12:11 +0100 | [diff] [blame] | 1162 | install_element_ve(&subscriber_update_cmd); |
Harald Welte | 7bc28f6 | 2010-05-12 16:10:35 +0000 | [diff] [blame] | 1163 | install_element_ve(&show_stats_cmd); |
Holger Hans Peter Freyther | 6ec8098 | 2010-12-25 14:08:00 +0100 | [diff] [blame] | 1164 | install_element_ve(&show_smsqueue_cmd); |
Holger Hans Peter Freyther | 75cf52a | 2014-12-28 18:54:32 +0100 | [diff] [blame] | 1165 | install_element_ve(&logging_fltr_imsi_cmd); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 1166 | |
Ruben Pollan | 6af2b40 | 2014-09-24 20:50:13 -0500 | [diff] [blame] | 1167 | install_element(ENABLE_NODE, &ena_subscr_delete_cmd); |
Keith | b4aba77 | 2017-01-18 17:09:33 +0100 | [diff] [blame] | 1168 | install_element(ENABLE_NODE, &ena_subscr_expire_cmd); |
Harald Welte | a8ca70f | 2010-05-27 10:44:58 +0200 | [diff] [blame] | 1169 | install_element(ENABLE_NODE, &ena_subscr_name_cmd); |
| 1170 | install_element(ENABLE_NODE, &ena_subscr_extension_cmd); |
| 1171 | install_element(ENABLE_NODE, &ena_subscr_authorized_cmd); |
| 1172 | install_element(ENABLE_NODE, &ena_subscr_a3a8_cmd); |
Holger Hans Peter Freyther | f4dfea1 | 2012-12-25 08:37:36 +0100 | [diff] [blame] | 1173 | install_element(ENABLE_NODE, &ena_subscr_handover_cmd); |
Holger Hans Peter Freyther | ed1d030 | 2010-12-22 16:33:23 +0100 | [diff] [blame] | 1174 | install_element(ENABLE_NODE, &subscriber_purge_cmd); |
Holger Hans Peter Freyther | 58fe028 | 2010-12-25 14:15:32 +0100 | [diff] [blame] | 1175 | install_element(ENABLE_NODE, &smsqueue_trigger_cmd); |
Holger Hans Peter Freyther | 96b4d35 | 2010-12-25 14:25:12 +0100 | [diff] [blame] | 1176 | install_element(ENABLE_NODE, &smsqueue_max_cmd); |
Holger Hans Peter Freyther | 416c7de | 2010-12-25 14:38:30 +0100 | [diff] [blame] | 1177 | install_element(ENABLE_NODE, &smsqueue_clear_cmd); |
Holger Hans Peter Freyther | 70428d9 | 2010-12-25 14:50:50 +0100 | [diff] [blame] | 1178 | install_element(ENABLE_NODE, &smsqueue_fail_cmd); |
Nico Golde | 55ab246 | 2011-02-22 17:54:47 +0100 | [diff] [blame] | 1179 | install_element(ENABLE_NODE, &subscriber_send_pending_sms_cmd); |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 1180 | install_element(ENABLE_NODE, &meas_feed_scenario_cmd); |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 1181 | |
Harald Welte | 1ed89d4 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 1182 | install_element(CONFIG_NODE, &cfg_mncc_int_cmd); |
| 1183 | install_node(&mncc_int_node, config_write_mncc_int); |
Jacob Erlbeck | f414e85 | 2013-10-29 09:30:30 +0100 | [diff] [blame] | 1184 | vty_install_default(MNCC_INT_NODE); |
Harald Welte | 1ed89d4 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 1185 | install_element(MNCC_INT_NODE, &mnccint_def_codec_f_cmd); |
| 1186 | install_element(MNCC_INT_NODE, &mnccint_def_codec_h_cmd); |
Harald Welte | d597317 | 2012-11-11 10:58:51 +0100 | [diff] [blame] | 1187 | install_element(MNCC_INT_NODE, &mnccint_meas_feed_cmd); |
Holger Hans Peter Freyther | 65b8992 | 2015-01-31 09:47:37 +0100 | [diff] [blame] | 1188 | install_element(MNCC_INT_NODE, &meas_feed_scenario_cmd); |
Harald Welte | 1ed89d4 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 1189 | |
Harald Welte | 3073f52 | 2013-02-12 11:15:49 +0100 | [diff] [blame] | 1190 | install_element(CFG_LOG_NODE, &log_level_sms_cmd); |
Holger Hans Peter Freyther | 75cf52a | 2014-12-28 18:54:32 +0100 | [diff] [blame] | 1191 | install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd); |
Harald Welte | 3073f52 | 2013-02-12 11:15:49 +0100 | [diff] [blame] | 1192 | |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1193 | |
| 1194 | install_element(CONFIG_NODE, &cfg_nitb_cmd); |
| 1195 | install_node(&nitb_node, config_write_nitb); |
| 1196 | install_element(NITB_NODE, &cfg_nitb_subscr_create_cmd); |
Max | 3911533 | 2016-06-07 15:32:16 +0200 | [diff] [blame] | 1197 | install_element(NITB_NODE, &cfg_nitb_subscr_random_cmd); |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1198 | install_element(NITB_NODE, &cfg_nitb_no_subscr_create_cmd); |
Holger Hans Peter Freyther | 1387df7 | 2015-07-13 20:33:08 +0200 | [diff] [blame] | 1199 | install_element(NITB_NODE, &cfg_nitb_assign_tmsi_cmd); |
| 1200 | install_element(NITB_NODE, &cfg_nitb_no_assign_tmsi_cmd); |
Holger Hans Peter Freyther | e144211 | 2015-01-27 10:58:29 +0100 | [diff] [blame] | 1201 | |
Holger Hans Peter Freyther | bdae6f9 | 2009-08-10 10:17:50 +0200 | [diff] [blame] | 1202 | return 0; |
| 1203 | } |