commit b12b2ab14b21d48460cca3df0e939caddda8dabe
parent 114e09893119525160d13768bcb8f5ee5e0ade32
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Tue, 15 Jun 2021 15:28:47 -0500
clear current commands when finished
Diffstat:
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/atd.c b/atd.c
@@ -233,6 +233,9 @@ handle_resp(int fd, int idx)
if (send_call_status(CALL_DIALING, currentcmd.data.dial.num) < 0)
fprintf(stderr, "failed to send call status\n");
}
+
+ currentcmd.op = CMD_NONE;
+ currentatcmd = ATNONE;
fprintf(stderr, "got OK\n");
} else if (strncmp(start, "ERROR", sizeof("ERROR") - 1) == 0) {
status = STATUS_ERROR;
@@ -242,6 +245,8 @@ handle_resp(int fd, int idx)
if (currentcmd.op == CMD_ANSWER || currentcmd.op == CMD_DIAL) {
active_command = false;
status = STATUS_ERROR;
+ currentcmd.op = CMD_NONE;
+ currentatcmd = ATNONE;
}
if (send_call_status(CALL_INACTIVE, "") < 0) {
diff --git a/atd.h b/atd.h
@@ -33,6 +33,7 @@ enum status {
};
enum atcmd {
+ ATNONE,
ATD,
ATA,
ATH,