2 * transsip - the telephony toolkit
3 * By Daniel Borkmann <daniel@transsip.org>
4 * Copyright 2011, 2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL, version 2.
16 static int tsocki
, tsocko
;
18 int cmd_call(char *arg
)
22 char **argv
= strntoargv(arg
, strlen(arg
), &argc
);
26 whine("Missing arguments: call <ipv4/ipv6/host> <port>\n");
30 if (strlen(argv
[0]) > ADDRSIZ
|| strlen(argv
[1]) > PORTSIZ
) {
31 whine("Arguments too long!\n");
36 memset(&cpkt
, 0, sizeof(cpkt
));
38 strlcpy(cpkt
.address
, argv
[0], sizeof(cpkt
.address
));
39 strlcpy(cpkt
.port
, argv
[1], sizeof(cpkt
.port
));
41 ret
= write(tsocko
, &cpkt
, sizeof(cpkt
));
42 ret
= write(tsocko
, &cpkt
, sizeof(cpkt
)); //XXX
43 if (ret
!= sizeof(cpkt
)) {
44 whine("Error notifying thread!\n");
48 printf("Calling ... hang up the line with: hangup\n");
54 int cmd_hangup(char *arg
)
59 memset(&cpkt
, 0, sizeof(cpkt
));
62 ret
= write(tsocko
, &cpkt
, sizeof(cpkt
));
63 if (ret
!= sizeof(cpkt
)) {
64 whine("Error notifying thread!\n");
71 int cmd_take(char *arg
)
76 memset(&cpkt
, 0, sizeof(cpkt
));
79 ret
= write(tsocko
, &cpkt
, sizeof(cpkt
));
80 if (ret
!= sizeof(cpkt
)) {
81 whine("Error notifying thread!\n");
88 void init_cli_cmds(int ti
, int to
)