/* * This program is free software, distributed under the terms of * the GNU General Public License Version 2. See the LICENSE file * at the top of the source tree. */ /*! \file * * \brief Connect with Serval Distributed Numbering Architecture for Mesh Calling * * Paul Gardner-Stephen (paul@servalproject.org) * * \ingroup applications */ #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision: Serval $") #include #include #include #include #include "asterisk/utils.h" #include "asterisk/lock.h" #include "asterisk/file.h" #include "asterisk/logger.h" #include "asterisk/channel.h" #include "asterisk/callerid.h" #include "asterisk/pbx.h" #include "asterisk/module.h" #include "asterisk/translate.h" #include "asterisk/features.h" #include "asterisk/options.h" #include "asterisk/cli.h" #include "asterisk/config.h" #include "asterisk/say.h" #include "asterisk/localtime.h" #include "asterisk/cdr.h" #include "asterisk/options.h" #include "serval.c" #undef inet_ntoa #define inet_ntoa ast_inet_ntoa static char *sdnalookup_descrip = " SDNALookup(): Resolves a telephone number into SIP address via Serval Distributed Numbering Architecture\n"; static char *sdnalookup_app = "SDNALookup"; static char *sdnalookup_synopsis = "Resolve DID into SIP address via Serval DNA"; static char *handle_cli_sdnalookup(int fd, int argc, char *argv[]) { char *did=NULL; char *sid=NULL; unsigned char buffer[65535]; int len=0; int instance=0; if (argc != 4) { ast_cli(fd, "You did not provide an argument to serval dna lookup\n\n"); return RESULT_FAILURE; } did=argv[3]; ast_cli(fd,"Serval DNA Lookup: NOT IMPLEMENTED\n\n",len); return RESULT_FAILURE; buffer[len]=0; ast_cli(fd,"%s resolves to %s (len=%d)\n",did,buffer,len); return RESULT_SUCCESS; } static char *handle_cli_sdnapeers(int fd, int argc, char *argv[]) { int i; if (argc != 3) { ast_cli(fd, "serval dna peers does not argue about arguments.\n\n"); return RESULT_FAILURE; } getPeerList(); ast_cli(fd,"%d peers reachable:\n",peer_count); for(i=0;i