diff --git a/Android.mk b/Android.mk index 355a355f..579cbc7d 100644 --- a/Android.mk +++ b/Android.mk @@ -66,7 +66,8 @@ LOCAL_SRC_FILES:= \ serval-dna/keyring.c \ serval-dna/vomp.c \ serval-dna/lsif.c \ - serval-dna/monitor.c + serval-dna/monitor.c \ + serval-dna/monitor-cli.c LOCAL_MODULE:= serval diff --git a/Makefile.in b/Makefile.in index ff581bcd..33480776 100644 --- a/Makefile.in +++ b/Makefile.in @@ -39,7 +39,8 @@ SRCS= batman.c \ trans_cache.c \ vomp.c \ lsif.c \ - monitor.c + monitor.c \ + monitor-cli.c HAVE_VOIPTEST= @HAVE_VOIPTEST@ ifeq ($(HAVE_VOIPTEST), 1) diff --git a/commandline.c b/commandline.c index 30c2f422..71a4c22c 100644 --- a/commandline.c +++ b/commandline.c @@ -1453,6 +1453,8 @@ command_line_option command_line_options[]={ "Return information about SID, and optionally ask for DID resolution via network"}, {app_test_rfs,{"test","rfs",NULL},0, "Test RFS field calculation"}, + {app_monitor_cli,{"monitor","[]",NULL},0, + "Interactive servald monitor interface. Specify SID to auto-dial that peer and insert dummy audio data"}, #ifdef HAVE_VOIPTEST {app_pa_phone,{"phone",NULL},0, "Run phone test application"}, diff --git a/monitor-cli.c b/monitor-cli.c index 23be2cbc..714d7208 100644 --- a/monitor-cli.c +++ b/monitor-cli.c @@ -6,13 +6,18 @@ #include #include +#include "serval.h" + int fd; int writeLine(char *msg) { write(fd,msg,strlen(msg)); } -int main(int argc, char *argv[]) { +int app_monitor_cli(int argc, const char *const *argv, struct command_line_option *o) +{ + const char *sid=NULL; + cli_arg(argc, argv, o, "sid", &sid, NULL, ""); struct sockaddr_un addr; if ( (fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { @@ -51,7 +56,7 @@ int main(int argc, char *argv[]) { writeLine("monitor vomp\n"); writeLine("monitor rhizome\n"); - if (argc>1) { + if (sid!=NULL&&sid[0]) { char msg[1024]; snprintf(msg,1024,"call %s 5551 5552\n",argv[1]); writeLine(msg); diff --git a/serval.h b/serval.h index a945dd0a..9a5dc33b 100755 --- a/serval.h +++ b/serval.h @@ -1395,6 +1395,7 @@ int app_vomp_monitor(int argc, const char *const *argv, struct command_line_opti int app_pa_phone(int argc, const char *const *argv, struct command_line_option *o); #endif int app_vomp_dtmf(int argc, const char *const *argv, struct command_line_option *o); +int app_monitor_cli(int argc, const char *const *argv, struct command_line_option *o); int monitor_get_fds(struct pollfd *fds,int *fdcount,int fdmax);