gpt4 book ai didi

php - 使用 Asterisk 通过网络服务器使电话响铃

转载 作者:行者123 更新时间:2023-12-03 23:17:15 25 4
gpt4 key购买 nike

什么是最简单的方法?如何实现?

我想到了这样的事情:

  1. 我向网络服务器请求一个页面
  2. PHP 向asterisk 发送一个号码进行拨号(php 和asterisk 在同一台机器上运行)
  3. Asterisk 打电话

  1. 一个 php sip 客户端注册到远程 asterisk 服务器
  2. Php sip 客户端向 asterik 发送要调用的号码
  3. 电话响了

我不在乎我是否能听到什么,只要它响就够了

最佳答案

调用文件

最简单的方法是生成调用文件。Asterisk 具有通过假脱机目录发起调用的功能。

https://wiki.asterisk.org/wiki/display/AST/Asterisk+Call+Files

提示和注意事项:

  • 您必须在单独的目录中创建调用文件并将其移动(不要使用复制,因为 asterisk 会立即解析文件,但移动是安全的)到假脱机目录中。

  • 调用文件必须由用户 asterisk runs as 拥有

  • asterisk(文件上的 utime())检查修改时间戳,如果修改时间戳在未来,则安排对其调用

AMI - Asterisk 管理器界面

也可以 initiate a Call over a Script (AMI) 。您必须在 manager.conf 中设置登录名(即用户名、密码)。在端口 5038 的 asterisk 服务器 ip 上使用 Telnet 测试 AMI:

Action: Login
Username: username
Secret: password

Action: Originate
Channel: SIP/123
Context: default
Exten: 012345678
Priority: 1
Callerid: AMICall

Action: Logoff

您也可以使用 PHP-AMI(随 PHP-AGI 一起提供)拨出。

manager.conf 的安全说明:

 ---------------------------- SECURITY NOTE -------------------------------
; Note that you should not enable the AMI on a public IP address. If needed,
; block this TCP port with iptables (or another FW software) and reach it
; with IPsec, SSH, or SSL vpn tunnel. You can also make the manager
; interface available over http/https if Asterisk's http server is enabled in
; http.conf and if both "enabled" and "webenabled" are set to yes in
; this file. Both default to no. httptimeout provides the maximum
; timeout in seconds before a web based session is discarded. The
; default is 60 seconds.
;

AJAM - 异步 Javascript Asterisk 管理器

AJAM 是一个 Web 服务器,您可以启用它并使用它通过 http 与 Asterisk 管理器界面 (AMI) 通信。

关于php - 使用 Asterisk 通过网络服务器使电话响铃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15041425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com