X-Git-Url: http://git.rot13.org/?p=skype-conference-recorder.git;a=blobdiff_plain;f=SkypeAPI.pm;h=2b522ccce05974f14e8285545831b346b583ff23;hp=26683b5cf633747b6c840bd27b5033dfb7040756;hb=f513dc73d0a63af2547af4a2fd7a4e6bbebbd41f;hpb=c92c33858571291334976a7f86a8b3932cbc41a3 diff --git a/SkypeAPI.pm b/SkypeAPI.pm index 26683b5..2b522cc 100644 --- a/SkypeAPI.pm +++ b/SkypeAPI.pm @@ -107,10 +107,34 @@ sub Notify { $self->Invoke('SET USERSTATUS NA'); } - if ( $string =~ m{CALL (\d+) STATUS INPROGRESS} ) { + if ( $string =~ m{CALL (\d+) STATUS RINGING} ) { + $self->Invoke("ALTER CALL $1 ANSWER"); + } elsif ( $string =~ m{CALL (\d+) STATUS INPROGRESS} ) { my $call_id = $1; - my $port = 5000; + my $port = 5000 + $call_id; + + my $gst = qq{ + gst-launch -v + tcpserversrc port=$port ! + "audio/x-raw-int,rate=16000,width=16,channels=1" ! + wavenc ! + filesink location=/tmp/$port.wav + }; + $gst =~ s{[\s\n\r]+}{ }gs; + + warn "# $gst\n"; + open(my $g, '-|', $gst) || die $!; + while(<$g>) { + warn "## $_"; + last if m/PREROLL/; + } + $self->Invoke(qq|ALTER CALL $call_id set_output port="$port"|); + } elsif ( $string =~ m{CALL (\d+) STATUS FINISHED} ) { + my $port = $1 + 5000; + my $path = "/tmp/$port.wav"; + warn "# $path ", -s $path, " bytes\n"; +# } elsif ( $string =~ m{} ) { } return 0;