2 * transsip - the telephony toolkit
3 * By Daniel Borkmann <daniel@transsip.org>
4 * Copyright 2011, 2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>
5 * Subject to the GPL, version 2.
15 static int tsocki
, tsocko
;
17 int cmd_call(char *arg
)
21 char **argv
= strntoargv(arg
, strlen(arg
), &argc
);
25 whine("Missing arguments: call <ipv4/ipv6/host> <port>\n");
29 if (strlen(argv
[0]) > ADDRSIZ
|| strlen(argv
[1]) > PORTSIZ
) {
30 whine("Arguments too long!\n");
35 memset(&cpkt
, 0, sizeof(cpkt
));
37 strlcpy(cpkt
.address
, argv
[0], sizeof(cpkt
.address
));
38 strlcpy(cpkt
.port
, argv
[1], sizeof(cpkt
.port
));
40 ret
= write(tsocko
, &cpkt
, sizeof(cpkt
));
41 ret
= write(tsocko
, &cpkt
, sizeof(cpkt
)); //XXX
42 if (ret
!= sizeof(cpkt
)) {
43 whine("Error notifying thread!\n");
47 printf("Calling ... hang up the line with: hangup\n");
53 int cmd_hangup(char *arg
)
58 memset(&cpkt
, 0, sizeof(cpkt
));
61 ret
= write(tsocko
, &cpkt
, sizeof(cpkt
));
62 if (ret
!= sizeof(cpkt
)) {
63 whine("Error notifying thread!\n");
70 int cmd_take(char *arg
)
75 memset(&cpkt
, 0, sizeof(cpkt
));
78 ret
= write(tsocko
, &cpkt
, sizeof(cpkt
));
79 if (ret
!= sizeof(cpkt
)) {
80 whine("Error notifying thread!\n");
87 void init_cli_cmds(int ti
, int to
)