summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2022-09-06 06:34:43 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2022-09-19 16:01:07 +0200
commitddcf2a1ee477de2630ab233c3fb34464666e3ac9 (patch)
tree02188d5a72cd3f652aa913f14aa1ad030ec8dcd8
parent69cea8aec97cc3d872ffe92a91c8c535865a4021 (diff)
mobile: vty: add 'audio_frame' cmdneels/voice
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index d6f6cd1d..d4f8449e 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -37,6 +37,7 @@
#include <osmocom/bb/mobile/app_mobile.h>
#include <osmocom/bb/mobile/gsm480_ss.h>
#include <osmocom/bb/mobile/gsm411_sms.h>
+#include <osmocom/bb/mobile/voice.h>
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
@@ -899,6 +900,28 @@ DEFUN(call_dtmf, call_dtmf_cmd, "call MS_NAME dtmf DIGITS",
return CMD_SUCCESS;
}
+DEFUN(audio_frame, audio_frame_cmd,
+ "audio_frame MS_NAME",
+ "Send a single audio frame with random data (a voice call must be active)\n"
+ "Name of MS (e.g. \"1\", see \"show ms\")\n")
+{
+ struct osmocom_ms *ms;
+ uint8_t buf[sizeof(struct gsm_data_frame) + 64] = {};
+ struct gsm_data_frame *frame = (void*)buf;
+ int rc;
+
+ frame->data[0] = 0xd0;
+
+ ms = get_ms(argv[0], vty);
+ if (!ms)
+ return CMD_WARNING;
+ if (gsm_send_voice(ms, (void*)buf) < 0) {
+ vty_out(vty, "sending audio frame failed, see log%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ return CMD_SUCCESS;
+}
+
DEFUN(sms, sms_cmd, "sms MS_NAME NUMBER .LINE",
"Send an SMS\nName of MS (see \"show ms\")\nPhone number to send SMS "
"(Use digits '0123456789*#abc', and '+' to dial international)\n"
@@ -2909,6 +2932,7 @@ int ms_vty_init(void)
install_element(ENABLE_NODE, &call_cmd);
install_element(ENABLE_NODE, &call_retr_cmd);
install_element(ENABLE_NODE, &call_dtmf_cmd);
+ install_element(ENABLE_NODE, &audio_frame_cmd);
install_element(ENABLE_NODE, &sms_cmd);
install_element(ENABLE_NODE, &service_cmd);
install_element(ENABLE_NODE, &test_reselection_cmd);