summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2010-10-27 20:30:13 +0200
committerSteve Markgraf <steve@steve-m.de>2010-10-27 20:30:13 +0200
commit8f007bacedcd130d85d96d0e4a4a1573b18d70ca (patch)
tree9cc9d0504f80da0c18402f71a854438000fa09ed /src
parent4dea28252c07af448be86ad1272b04918a70a711 (diff)
layer23/mobile: Add configuration option for automatically answering calls
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/settings.h1
-rw-r--r--src/host/layer23/src/mobile/mnccms.c4
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c26
3 files changed, 31 insertions, 0 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/settings.h b/src/host/layer23/include/osmocom/bb/mobile/settings.h
index a6708e6d..178ef081 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/settings.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/settings.h
@@ -31,6 +31,7 @@ struct gsm_settings {
/* call related settings */
uint8_t cw; /* set if call-waiting is allowed */
+ uint8_t auto_answer;
uint8_t clip, clir;
uint8_t half, half_prefer;
diff --git a/src/host/layer23/src/mobile/mnccms.c b/src/host/layer23/src/mobile/mnccms.c
index bebb5864..c4e3275e 100644
--- a/src/host/layer23/src/mobile/mnccms.c
+++ b/src/host/layer23/src/mobile/mnccms.c
@@ -444,6 +444,10 @@ int mncc_recv_mobile(struct osmocom_ms *ms, int msg_type, void *arg)
memset(&mncc, 0, sizeof(struct gsm_mncc));
mncc.callref = call->callref;
mncc_send(ms, MNCC_ALERT_REQ, &mncc);
+ if (ms->settings.auto_answer) {
+ LOGP(DMNCC, LOGL_INFO, "Auto-answering call\n");
+ mncc_answer(ms);
+ }
break;
case MNCC_SETUP_COMPL_IND:
vty_notify(ms, NULL);
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index 32aa43ae..c1d00f44 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -904,6 +904,8 @@ static void config_write_ms_single(struct vty *vty, struct osmocom_ms *ms)
else
vty_out(vty, " no emergency-imsi%s", VTY_NEWLINE);
vty_out(vty, " %scall-waiting%s", (set->cw) ? "" : "no ", VTY_NEWLINE);
+ vty_out(vty, " %sauto-answer%s", (set->auto_answer) ? "" : "no ",
+ VTY_NEWLINE);
vty_out(vty, " %sclip%s", (set->clip) ? "" : "no ", VTY_NEWLINE);
vty_out(vty, " %sclir%s", (set->clir) ? "" : "no ", VTY_NEWLINE);
if (set->alter_tx_power)
@@ -1183,6 +1185,28 @@ DEFUN(cfg_cw, cfg_ms_cw_cmd, "call-waiting",
return CMD_SUCCESS;
}
+DEFUN(cfg_no_auto_answer, cfg_ms_no_auto_answer_cmd, "no auto-answer",
+ NO_STR "Disable auto-answering calls")
+{
+ struct osmocom_ms *ms = vty->index;
+ struct gsm_settings *set = &ms->settings;
+
+ set->auto_answer = 0;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_auto_answer, cfg_ms_auto_answer_cmd, "auto-answer",
+ "Enable auto-answering calls")
+{
+ struct osmocom_ms *ms = vty->index;
+ struct gsm_settings *set = &ms->settings;
+
+ set->auto_answer = 1;
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_clip, cfg_ms_clip_cmd, "clip",
"Force caller ID presentation")
{
@@ -1991,6 +2015,8 @@ int ms_vty_init(void)
install_element(MS_NODE, &cfg_ms_emerg_imsi_cmd);
install_element(MS_NODE, &cfg_ms_cw_cmd);
install_element(MS_NODE, &cfg_ms_no_cw_cmd);
+ install_element(MS_NODE, &cfg_ms_auto_answer_cmd);
+ install_element(MS_NODE, &cfg_ms_no_auto_answer_cmd);
install_element(MS_NODE, &cfg_ms_clip_cmd);
install_element(MS_NODE, &cfg_ms_clir_cmd);
install_element(MS_NODE, &cfg_ms_no_clip_cmd);