使用 FreePBX 和 Asterisk 调用 PHP 脚本 [英] Calling a PHP script using FreePBX and Asterisk

查看:40
本文介绍了使用 FreePBX 和 Asterisk 调用 PHP 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我通过 FreePBX 服务器设置了 VOIP 系统.我想要它,以便当 FreePBX 接听新电话时,星号会将来电显示和通话 ID 发送到 php 脚本,然后该脚本将使用该信息收集与该来电显示相关的帐户的票证信息.然后它将使用找到的信息更新数据库.当用户接听电话时,我想将用户的分机号和呼叫 ID 发送到另一个 php 脚本,并使用新信息更新数据库.

So I have a VOIP system set up through a FreePBX server. I want to have it so that when a new call is picked up by FreePBX, asterisks will send the caller ID and the call ID to a php script, which will then use that information to gather ticket information for the account related to that caller ID. It will then update a database with the found information. When a user answers the phone, I then want to send the user's extension and the call ID to another php script and update the database with the new information.

我已经研究过 PHPARI,但缺少文档.我只需要它走一种方式,而 PHPARI 和类似的库似乎专注于双向,据我所知.

I have looked into PHPARI, but the documentation is lacking for me. I just need it to go one way, and PHPARI and similar libraries seem to focus on going both ways, from what I've understood.

我的互联网搜索一无所获,所以我向你们寻求帮助和指导.

My internet searches have yielded nothing, so I turn to you guys for help and guidance.

FreePBX 版本:13.0.83星号版本:13.7.1

FreePBX Version: 13.0.83 Asterisk Version: 13.7.1

推荐答案

看看 Asterisk AGI 您应该能够通过拨号计划 (extensions.conf) 编写脚本并包含任何诸如来电显示之类的变量.

Have a look at Asterisk AGI you should be able to script it through the dial plan (extensions.conf) and include any vars like caller ID.

我从我的 extension.conf 中做了一个快速测试;

I've done a quick test from my extension.conf;

s 使用捕捉上下文中没有使用被叫号码的地方.

s is used to catch where no called number is used in the context.

exten => s,1,Verbose(Incoming call from Sip line CallerID=${CALLERID(all)})
exten => s,2,AGI(phone.php,${CALLERID(all)})
exten => s,3,Goto(internal-ext,3001,1)

我的 phone.php 位于 /var/lib/asterisk/agi-bin/phone.php将您的变量作为 script.php,,...

my phone.php is located at /var/lib/asterisk/agi-bin/phone.php Pass your vars as script.php,<var>,<var>...

不要使用 script.php?callNum= 因为它只对 web 应用程序有效,这应该被视为命令行.

Don't use script.php?callNum= as that's only valid for web applications, this should be treated as command line.

该脚本将写入 /tmp/phone 中的文件,该文件使用主叫方 ID 进行更新.

That script writes to a file at /tmp/phone which is updated with the calling caller id.

在我的 php 脚本中,我做了以下操作;

In my php script I did the following;

#!/usr/bin/php

<?php
    $query = $argv[1];
    $file = fopen("/tmp/phone", "w");
        fwrite($file,$query);
        fclose($file);
?>

这篇关于使用 FreePBX 和 Asterisk 调用 PHP 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆