Introduction
Introduction Statistics Contact Development Disclaimer Help
Stick the iaxrecord code into the tree - warvox - VoIP based wardialing tool, f…
Log
Files
Refs
README
---
commit 2458e746c691176083d95c7bb1585b5cc74bc1e2
parent 57fcf1447e67ef60c817f5a0fb6fd2723b0795de
Author: HD Moore <[email protected]>
Date: Fri, 13 Feb 2009 04:24:52 +0000
Stick the iaxrecord code into the tree
Diffstat:
A src/iaxrecord/Makefile | 4 ++++
A src/iaxrecord/iaxrecord.c | 168 +++++++++++++++++++++++++++++…
2 files changed, 172 insertions(+), 0 deletions(-)
---
diff --git a/src/iaxrecord/Makefile b/src/iaxrecord/Makefile
@@ -0,0 +1,4 @@
+all:
+ gcc -Wall -o iaxrecord iaxrecord.c -liaxclient
+clean:
+ rm -f iaxrecord *.o
diff --git a/src/iaxrecord/iaxrecord.c b/src/iaxrecord/iaxrecord.c
@@ -0,0 +1,168 @@
+/*
+ * IAXRecord: a utility for recording audio on an outbound IAX call
+ *
+ * Copyright (C) 2009, H D Moore <hdm[at]metasploit.com>
+ *
+ * Based on simpleclient from the IAXClient distribution
+ *
+ * Copyright (C) 1999, Linux Support Services, Inc.
+ *
+ * Mark Spencer <[email protected]>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include <iaxclient.h>
+
+int initialized = 0;
+int debug = 0;
+
+float silence_threshold = 0.0f;
+int call_state = 0;
+int call_trace = -1;
+int call_done = 0;
+int call_bytes = 0;
+char *iax_out;
+int reg_id;
+
+void cleanup(void) {
+ if ( reg_id ) {
+ iaxc_unregister(reg_id);
+ reg_id = 0;
+ }
+ if ( initialized ) {
+ iaxc_stop_processing_thread();
+ iaxc_shutdown();
+ initialized = 0;
+ }
+}
+
+void signal_handler(int signum) {
+ if ( signum == SIGTERM || signum == SIGINT ) {
+ cleanup();
+ exit(0);
+ }
+}
+
+void usage(char **argv) {
+ fprintf(stdout, "Usage: %s [server] [user] [pass] [cid] [output] [numb…
+ exit(1);
+}
+
+int state_event_callback(struct iaxc_ev_call_state call) {
+ call_state = call.state;
+ return 0;
+}
+
+int audio_event_callback( struct iaxc_ev_audio audio) {
+ if(call_state & IAXC_CALL_STATE_COMPLETE) {
+ if(call_trace == -1) call_trace = open(iax_out, O_CREAT|O_TRUN…
+ if(call_trace != -1) {
+ if(debug) printf("audio data: format=%d encoded=%d siz…
+ write(call_trace, audio.data, audio.size);
+ call_bytes += audio.size;
+ }
+ }
+ return 0;
+}
+
+int iaxc_callback(iaxc_event e) {
+ switch(e.type) {
+ case IAXC_EVENT_TEXT:
+ return ( debug ? 0 : 1 );
+ break;
+ case IAXC_EVENT_STATE:
+ return state_event_callback(e.ev.call);
+ break;
+ case IAXC_EVENT_AUDIO:
+ return audio_event_callback(e.ev.audio);
+ break;
+ default:
+ return 0;
+ break;
+ }
+}
+
+
+int main(int argc, char **argv) {
+
+ char *iax_host;
+ char *iax_user;
+ char *iax_pass;
+ char *iax_num;
+ char *iax_cid;
+ int iax_sec = 20;
+ int call_id = 0;
+ int i;
+ char dest[1024];
+
+ if(argc < 7) usage(argv);
+ iax_host = argv[1];
+ iax_user = argv[2];
+ iax_pass = argv[3];
+ iax_cid = argv[4];
+ iax_out = argv[5];
+ iax_num = argv[6];
+
+ if(argc > 7) iax_sec = atoi(argv[7]);
+
+ snprintf(dest, sizeof(dest), "%s:%s@%s/%s", iax_user, iax_pass, iax_ho…
+ iaxc_set_video_prefs(IAXC_VIDEO_PREF_CAPTURE_DISABLE | IAXC_VIDEO_PREF…
+ iaxc_set_audio_prefs(IAXC_AUDIO_PREF_SEND_DISABLE);
+
+ if(! debug) {
+ fclose(stderr);
+ stderr = fopen("/dev/null", "w");
+ }
+
+ fprintf(stdout, "STARTED %s BYTES=%d FILE=%s\n", iax_num, call_bytes, …
+
+ /* activate the exit handler */
+ atexit(cleanup);
+
+ /* install signal handler to catch CRTL-Cs */
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+
+ if ( iaxc_initialize(1) ) {
+ fprintf(stdout, "error: Could not initialize iaxclient!\n");
+ exit(0);
+ }
+
+ initialized = 1;
+
+ iaxc_set_callerid ("", iax_cid);
+ iaxc_set_formats(IAXC_FORMAT_ULAW | IAXC_FORMAT_ALAW, IAXC_FORMAT_ULAW…
+ iaxc_set_silence_threshold(silence_threshold);
+
+ iaxc_set_event_callback(iaxc_callback);
+ iaxc_start_processing_thread();
+ iaxc_set_audio_output(debug ? 0 : 1);
+
+ iaxc_set_audio_prefs(IAXC_AUDIO_PREF_RECV_REMOTE_RAW);
+
+ reg_id = iaxc_register(iax_user, iax_pass, iax_host);
+ if(debug) fprintf(stderr, " RegID: %d\n", reg_id);
+
+ call_id = iaxc_call(dest);
+ if(debug) fprintf(stderr, "CallID: %d\n", call_id);
+
+ if(call_id >= 0) {
+ iaxc_select_call(call_id);
+ for(i=0; i< (iax_sec*1000*2); i+= 500) {
+ if(iaxc_first_free_call() == call_id) break;
+ iaxc_millisleep(500);
+ }
+ }
+
+ fprintf(stdout, "COMPLETED %s BYTES=%d FILE=%s\n", iax_num, call_bytes…
+ return(0);
+}
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.