Asterisk 中的自定义 IVR 操作
您能否为我指出一个方向、示例代码或在线资源来完成以下任务:
要求: 我想编写一个简单的 IVR 菜单选项来运行脚本(Bash 或 Python)。 例如,给 Asterisk 机器打电话并请求重新启动另一个 Linux 机器上的服务。 “其他 Linux 盒子”详细信息将被硬编码到 IVR 菜单选项,并且不需要作为 IVR 交互的一部分提供 - 只需在盒子 Y 上重新启动服务 X 即可。我有点担心,也不确定如何使用密码(即使在版本中是硬编码的)。
背景: 我是 Asterisk 新手,从 AsteriskNow 发行版安装了它,并且我仍在学习该产品。 基本 PBX 功能正在运行并通过 FreePBX 进行管理。 Asterisk 不是我们开发工作的主要重点,而是工具箱中的一个工具。 我们主要从事 .NET 工作,但也具备 Unix 技能。
如果可能的话,我不想花几天时间学习 Asterisk 的集成细节来完成工作......
Can you someone please point in me in a direction, sample code or an online resource to accomplish the following:
Requirement:
I would like to write a simple IVR menu option that will run a script (Bash or Python). For example, phone the Asterisk machine and request to restart a service on another Linux box. The 'other Linux box' details would be hard coded to the IVR menu option and not needed to be supplied as part of the IVR interaction - just restart service X on box Y. I am little worried and unsure how one would secure this with a password (even if it is hard coded in version).
Background:
I am an Asterisk newbie and installed it from the AsteriskNow distribution and I am still learning the product. The basic PBX functionality is working and is administered through FreePBX. Asterisk is not our main focus of development work but rather a tool in the toolbox. We mostly do .NET work but have Unix skills.
If possible I would not like to spend days learning the integrate details of Asterisk to get the job done...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Asterisk 并不总是等待用户输入。 仅在后台、WaitExten、Read 命令期间。 如果您使用 Playback(),Asterisk 在播放音频文件时会忽略任何 DTMF。
您可以用 Read() 替换 Playback,但必须将读取超时设置为非常低的值,否则在使用 Read() 播放每个音频文件后将会出现静音。 如果您使用 Read() 那么您必须检查用户输入的值以检查退出,类似这样......
而不是
您需要
Asterisk is not always waiting for user input. Only during the Background, WaitExten, Read commands. If you're using Playback(), Asterisk ignores any DTMF while it's playing the audio file.
You can replace Playback with Read() but you have to set the read timeout to a very low value or there will be a silence after every audio file you play with Read(). If you use Read() then you have to check the value input by the user to check for exit, something like this...
Instead of
you need
Asterisk AGI 页面包含许多编程语言的应用程序的链接。
如果您主要使用 .NET,可能是 nasterisk 或更旧的 MONO-TONE 会有所帮助。
The Asterisk AGI page holds links to applications in many programming languages.
If you do mostly .NET, maybe nasterisk or the older MONO-TONE will help.
您会为此设置 Asterisk 还是它/将会执行其他操作,例如 PBX、IVR 等?
如果您正在使用 Asterisk 执行其他操作,请设置一个隐藏分机(IVR 菜单上未标明的分机),您可以在连接后拨打该分机; 在此扩展中,您可以检查来电显示并将其与您的号码进行比较,以便只有您可以执行该脚本(您可以通过询问 PIN 号码来添加更多安全性,这样如果您找不到您的手机)。
像这样的东西:
在您的脚本中,您检查 Pin 变量,如果它有效,则执行,否则退出而不执行任何操作。 这样,您就不必在拨号方案中对 pin 进行硬编码,而其他人可能会查看该 pin...如果它是受信任的机器,那么您可以在拨号方案中验证 pin :
Will you set up Asterisk just for this or is it/will it be doing other stuff such as PBX, IVR, etc?
If you are doing other stuff with Asterisk, then set up a hidden extension (one not advertised on the IVR menu) which you can dial once you're connected; in this extension, you can check the caller id and compare it to your number, so that only you can execute the script (you can add some more security by asking for a PIN number, so you can rest easier if you can't find your phone).
Something like this:
In your-script you check the Pin variable and if it's valid, execute, otherwise exit without doing anything. This way you don't have to hardcode the pin inside the dialplan, which someone else may look at... if it's a trusted machine then you can validate the Pin right in the dialplan: