發出測試H.323呼叫,你不能擊敗ohphone:
(sleep 30; echo q) | ohphone -s Default -n -u from_user [email protected] > /tmp/output.$$
通常,您可以找到ohphone作爲一個整體在你的Linux發行版:
apt-get install ohphone
來源可以是發現在voxgratia 雖然年紀大了,它仍然出色地工作。
使用ohphone處理輸出有點棘手,但是您可以使用類似perl腳本的東西將其處理爲errno值。
這裏有一個快速和骯髒的例子就是這樣做的:
#!/usr/bin/env perl
$delay=$ARGV[0];
if(! $delay) { $delay = 10; }
$from=$ARGV[1];
if(! $from) { $from = "default_from_user"; }
$to=$ARGV[2];
if(! $to) { $to = "default_to_user"; }
$gateway=$ARGV[3];
if(! $gateway) { $gateway = "127.0.0.1"; }
print "Running: (sleep $delay; echo q) | (ohphone -s Default -n -u $from $to\@$gateway)|\n";
open(IN,"(sleep $delay; echo q) | (ohphone -s Default -n -u $from $to\@$gateway)|");
my $call_started=false;
my $call_completed=false;
my @results;
my $skip=1;
while($line=<IN>) {
if($line=~/Listening interfaces/) {
$skip=0;
next;
}
if($skip) {
next;
}
if($line=~/^Could not open sound device/) {
next;
}
chomp($line);
push(@results,$line);
if($line=~/was busy$/) {
print "$to: Called party busy\n";
exit 1;
}
if($line=~/^Call with .* completed, duration (.*)$/) {
print "$to: Completed duration $1 call.\n";
exit 0;
}
if($line=~/has cleared the call, duration (.*)$/) {
print "$to: Completed duration $1 call.\n";
exit 0;
}
if($line=~/^Call with .* completed$/) {
print "$to: No call duration.\n";
exit 2;
}
}
close(IN);
$result=join("\n",@results);
print "$ARGV[0]: Unknown results:\n$result\n";
exit 255;
這個腳本是一個相當幾年的歷史,但在這段時間裏的工作很適合我們。
這看起來很有希望! 「SIPp可用於運行一個呼叫並退出,提供通過/失敗的判決」 – reconbot 2010-11-10 17:07:32
woops - 錯誤的協議不再適用= \你有一個用於h.323嗎? – reconbot 2010-11-10 20:16:15