使用 H.323 测试传统语音邮件系统

发布于 2024-10-01 17:54:49 字数 396 浏览 3 评论 0原文

我被要求开发一个脚本,可以通过 H.323 拨打需要更好监控的语音邮件系统。 (该设备以神秘的方式死亡,并且提供的功能很少)。这个想法是拨打一个号码,看看是否有人接听。如果出现问题,语音邮件系统将响铃或不应答。

我的问题在于我对 H.323 或可用的库一无所知。 (Perl 是我公司选择的语言,但对于这种特定的东西,我可能可以使用 python 或使用一些二进制程序。)

在搜索 H.323 时,我发现了一个黑暗的兔子洞。我不懂 C 或想作为客户端运行 pbx,我找到了开源库,但没有“call()”函数之类的东西。我没有足够的时间来学习每一个细节。

(如果这不是为了工作,我会连接几行 python 并使用 Twilio 来完成所有繁重的工作。)

我想我需要一些关于如何解决问题的指导。

谢谢

I've been asked to develop a script that can via H.323 dial a voicemail system that needs better monitoring. (The device dies in mysterious ways and offers very little over snmp). The idea is to call a number, and see if it the line gets answered. The Voice Mail system will ring busy or not answer if there's a problem.

My problem lies in the fact that I know nothing about H.323 or the available libraries. (Perl is the language of choice at my company, but for something this specific I could probably get away with python or a the use of some binary programs.)

I've found a dark rabbit hole of dispare when searching for H.323. I don't know C or want to run a pbx as a client, I've found open source libaries but there is no such thing as a "call()" function. I don't have the cycles to learn every in and out.

(If this wasn't for work I'd hook up a few lines of python and use Twilio to do all the heavy lifting.)

I think I need some guidance on how to solve the problem.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鹿! 2024-10-08 17:54:49

要进行测试 H.323 呼叫,您无法击败 ohphone:

(sleep 30; echo q) | ohphone -s Default -n -u from_user to_user@gateway > /tmp/output.$

您通常可以在 Linux 发行版中找到 ohphone 作为软件包:

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;

这个脚本已经有好几年了,但在那段时间对我们来说效果很好。

To place test H.323 calls, you can't beat ohphone:

(sleep 30; echo q) | ohphone -s Default -n -u from_user to_user@gateway > /tmp/output.$

You can typically find ohphone as a package in your linux distribution:

apt-get install ohphone

The source can be found on voxgratia
While older, it still works splendidly.

Processing the output is a tad tricky with ohphone, but you can use something like a perl script to process it into an errno value.

Here's a quick and dirty example does just that:

#!/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;

This script is a quite a few years old, but it has worked well for us during that time.

小清晰的声音 2024-10-08 17:54:49

有一些 SIP 测试工具可让您生成 SIP 流量。我过去曾在大学项目中使用过SIPp,也许这对你有帮助

* *编辑:**

快速搜索给出 Yate Seagull 我没有使用过它们,但也许它们可以解决您的问题。如果你发现了什么,一定要发布。

There are SIP Testing tools that allow you to generate SIP Traffic. I have used SIPp in the past as part of a university project maybe this is of help to you

**EDIT:**

A quick search gives Yate Seagull I have not used them but maybe they solve your issues. If you find something do post it definitely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文