且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Asterisk AMI - 代答呼叫

更新时间:2023-12-03 09:42:16

您无法直接通过 AMI 接听电话.这是因为新呼叫将到达"在拨号计划中配置的给定上下文/优先级/分机(或者如果找不到适用的将被拒绝).因此,无论该呼叫发生什么,都将从拨号计划中的给定上下文/优先级/分机号开始.

You can't answer a call directly via AMI. This is because a new call will "arrive" at the given context/priority/extension configured in the dialplan (or it will be rejected if cant find one that applies). So whatever happens with that call will start at the given context/priority/extension in the dialplan.

如果您想通过 AMI 处理调用,请尝试使用异步 AGI,如下所示:

If you want to handle calls via AMI, try using asynchronous AGI, like this:

exten => _X.,1,AGI(agi:async)

这将通过发出一个您可以用您的 AMI 客户端处理的事件 (AsyncAGI) 来处理对任何至少有 1 位数字的分机的所有呼叫.

This will handle all calls to any extension that has at least 1 digit, by issuing an event (AsyncAGI) that you can handle with your AMI client.

然后,从您的 AMI 客户端,您可以发送 AGIAction,例如:

Then, from your AMI client, you can send AGIAction's, like:

Action: AGI
Channel: SIP/adevice
Command: ANSWER
CommandID: MyCommandID

这将有效地允许您从 AMI 客户端运行 AGI 命令(并像通常在任何 AGI 脚本中一样处理调用).

This will effectively allow you to run AGI commands (and handle a call like you would normally do in any AGI script) from your AMI client.

希望能帮到你!