All pastes #17433 Raw Edit

Miscellany

public text v1 · immutable
#17433 ·published 2005-07-11 06:23 UTC
rendered paste body
#!/usr/bin/perl -w
use strict;

use Asterisk::AGI;

my $agi = new Asterisk::AGI;
my %in = $agi->ReadParse();

print STDERR "CID: $in{callerid}\n";
unless(($in{cid_name}, $in{cid_num}) = $in{callerid} =~ /^"(.*)" <(.*)>$/) {
  $in{cid_name} = "Unknown";
  ($in{cid_num}) = $in{callerid} =~ /\d+/;
  $in{cid_num} ||= "Unknown";
}

system("echo $in{cid_name} |text2wave -o /tmp/cid.ulaw -otype ulaw - &") if $in{cid_name} ne 'Unknown';
$agi->stream_file('privacy-your-callerid-is');
$agi->exec('SayDigits', $in{cid_num});
$agi->stream_file('cid') if $in{cid_name} ne 'Unknown';