简体   繁体   English

用于测试调用的 Linux Asterisk 脚本

[英]Linux Asterisk script for test call

I need to measure the MOS and quality of the VOIP service in a network.我需要测量网络中 VOIP 服务的 MOS 和质量。 I want to create a script that simulates calls and then measure the networks metrics.我想创建一个脚本来模拟呼叫,然后测量网络指标。

I'm using asterisk.我正在使用星号。

Do you have any suggestion about how to script and schedulate test calls with asterisk?您对如何使用星号编写和安排测试调用有什么建议吗?

I would like to make calls of different duration maybe using some avi files.我想使用一些 avi 文件拨打不同持续时间的电话。

Obviously I need to automate both outgoing call and automatic answer to that outgoing calls.显然,我需要自动拨出电话和自动接听拨出电话。

I would suggest using Asterisk Call Files我建议使用星号调用文件

Create a file name /tmp/example.call such as:创建一个文件名/tmp/example.call如:

Channel: SIP/peerdevice/1234
Application: Playback
Data: silence/1&tt-weasels 

And then copy that file and move it into the asterisk outgoing spool, such as:然后复制该文件并将其移动到星号输出线轴中,例如:

cp /tmp/example.call /tmp/example.call.new
mv /tmp/example.call.new /var/spool/asterisk/outgoing

You'll notice at the Asterisk CLI it will originate a new call.您会在 Asterisk CLI 中注意到它将发起一个新调用。

You can make another asterisk box answer the call automatically by saying to answer it in the dialplan, eg If you have another device SIP/peerdevice , and you're dialing 1234 per my example, in your dialplan:您可以通过说在拨号计划中接听电话来让另一个星号框自动接听电话,例如,如果您有另一台设备SIP/peerdevice ,并且您在拨号计划中按我的示例拨打 1234:

[somecontext]
exten => 1234,1,Answer()
same =>       n,Noop(Example call inbound)
same =>       n,Playback(hello-world)
same =>       n,Hangup()

And you could create multiple extensions to do what you like to vary the behavior of the call.您可以创建多个扩展来执行您喜欢的操作来改变呼叫的行为。

You can also use the originate command, such as:也可以使用 originate 命令,例如:

ast*CLI> channel originate SIP/755XXXXX@sip-outbound extension s@context_name

Which can also be issued from a shell as:也可以从 shell 发出:

[user@host]$ asterisk -rx 'channel originate SIP/755XXXXX@sip-outbound extension s@context_name'

SIP/755XXXXX@sip-outbound = Is what device to use when dialing out so this could be IAX.,SIP,DAHDI following a slash and phone number SIP/755XXXXX@sip-outbound = 拨出时使用的设备,因此这可能是 IAX.,SIP,DAHDI 后跟斜杠和电话号码

extension = Is required for the command. extension = 命令需要。 You may also use application followed by an Asterisk application, a la channel originate SIP/device/1234 application playback tt-monkeys which would playback a sound file.您还可以使用application后跟一个 Asterisk 应用程序,一个channel originate SIP/device/1234 application playback tt-monkeys将播放声音文件。

s = This is what extension to send to within the context specified below s = 这是在下面指定的上下文中发送到的扩展名

@context_name = Which context to send to in extensions.conf @context_name = 在extensions.conf发送到哪个上下文

More information available in this Asterisk guide 此星号指南中提供的更多信息

如果您要调用星号扩展:

asterisk -rx "console dial extension@context"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM