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

标签 php asterisk

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

我想到了这样的事情:

  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/

相关文章:

php - 如何从 Facebook 应用程序发布到 Facebook 页面?

php - pdo 不从 mysql 函数中读取字符串

c - Asterisk :对 `SQLAllocHandle' 的 undefined reference

linux - 系统重启时自动启动 Asterisk

php - PDO 事务是否涵盖 PDO::query()?

php - 访问 PHP 类常量

php - 如何判断MySQL事务成功

Asterisk ARI 将记录桥接到单独的文件/ channel

Asterisk :转接电话而不立即应答

python - *a, b, c = line.split() 中的 Asterisk 有什么作用?