commit 9820663609e071119a02cdd037d44e5442ebaf00
parent 6f2a50de8c62f625f84bef17a027a0f161425283
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Tue, 15 Jun 2021 15:51:40 -0500
handle call dialing
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/clients/calld.c b/clients/calld.c
@@ -66,7 +66,6 @@ launchchild(char *prog, char *number)
void
handle_update()
{
- fprintf(stderr, "handle update\n");
// TODO handle multiple calls
switch (current.status) {
case CALL_INACTIVE:
@@ -75,7 +74,12 @@ handle_update()
strcpy(current.num, deccall.num);
state = STATE_ANSWER;
launchchild(ANSWER_PROGRAM, current.num);
- }
+ } else if (deccall.status == CALL_DIALING) {
+ current.status = deccall.status;
+ strcpy(current.num, deccall.num);
+ state = STATE_INCALL;
+ launchchild(CALL_PROGRAM, current.num);
+ }
break;
case CALL_DIALING:
@@ -201,6 +205,7 @@ main(int argc, char *argv[])
fprintf(stderr, "call accepted!\n");
atd_cmd_answer(sock);
state = STATE_INCALL;
+ current.status = CALL_ACTIVE;
launchchild(CALL_PROGRAM, current.num);
} else {
fprintf(stderr, "call declined!\n");
@@ -214,7 +219,6 @@ main(int argc, char *argv[])
assert("not possible!\n");
}
}
- childpid = 0;
}
}
err: