interactive servald monitor cli command implemented.

This commit is contained in:
gardners 2012-05-08 14:40:39 +09:30
parent 67c7c1a7c0
commit 596b20b5e8
5 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -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","[<sid>]",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"},

View File

@ -6,13 +6,18 @@
#include <poll.h>
#include <fcntl.h>
#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);

View File

@ -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);