[Freeswitch-trunk] [commit] r6990 - freeswitch/trunk/scripts/contrib/trixter

Freeswitch SVN trixter at freeswitch.org
Wed Dec 26 22:43:16 EST 2007


Author: trixter
Date: Wed Dec 26 22:43:16 2007
New Revision: 6990

Added:
   freeswitch/trunk/scripts/contrib/trixter/jp.pl   (contents, props changed)

Log:
test program, note that echo doesnt seem to work.  in addition record with only a duration set doesnt cut off after the duration specified


Added: freeswitch/trunk/scripts/contrib/trixter/jp.pl
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/trixter/jp.pl	Wed Dec 26 22:43:16 2007
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+use FreeSWITCH::Client;
+use Data::Dumper;
+
+my $fs = init FreeSWITCH::Client {} or die "Error $@";
+my $pid;
+
+for (;;) {
+  $fs->accept();
+
+  if (!($pid = fork)) {
+    last;
+  }
+}
+
+my $data = $fs->call_data();
+
+#print Dumper $data
+print "Call: $data->{'caller-channel-name'} $data->{'unique-id'}\n";
+
+
+$o = $fs->call_command("answer");
+#to turn on events when in async mode
+$o = $fs->raw_command("myevents");
+$o = $fs->call_command("playback","/sounds/you-have-reached-a-test-number.wav");
+$o = $fs->call_command("record","/tmp/recording.wav 5 300 5");
+$o = $fs->call_command("playback","/tmp/recording.wav");
+$o = $fs->call_command("echo");
+
+
+#comment exit in async mode
+#exit;
+
+while(my $r = $fs->readhash(undef)) {
+  if ($r->{socketerror}) {
+    last;
+  }
+
+  if ($r->{has_event}) {
+    print Dumper $r->{event};
+  }
+  if ($r->{event}->{'event-name'} !~ /execute/i) {
+    printf "wtf $data->{'unique-id'}\n";
+    $o = $fs->call_command("break");
+    $o = $fs->call_command("hangup");
+  }
+}
+
+$fs->disconnect();
+print "done\n";
+
+



More information about the Freeswitch-trunk mailing list