如何在星号中读取*终止的dtmf数字

时间:2016-01-19 10:48:30

标签: asterisk

我知道读取命令获取#已终止的dtmf数字。但是如何读取以星号 "*" 结尾的dtmf数字? 例如,如果我必须输入" 092",请按" 092 *"从键盘。

3 个答案:

答案 0 :(得分:1)

你有2种方法

1)不可行,但大部分时间都可以工作。只需使用AGI getdata或dialplan Read命令读取一位数字。

2)创建app_read的fork并在代码中将#更改为*。

答案 1 :(得分:1)

要修改行为,请参阅星号源目录中的 apps / app_read.c

if (tmp[x-1] == '#') {
    tmp[x-1] = '\0';
    status = "OK";
    break;
}

将#替换为*。

您只需要重新编译该模块:

rm apps/app_read.o apps/app_read.so
make
cp -f apps/app_read.so /lib/asterisk/modules/
service asterisk restart

答案 2 :(得分:1)

在apps / app_read.c中将tmp[x-1] == '#'更改为tmp[x-1] == '*'是必要的,但还不够。

您可以执行以下步骤:

1.在apps / app_read.c中替换#和*:

// if (tmp[x-1] == '#'){
if (tmp[x-1] == '*'){
    tmp[x-1] = '\0';
    status = "OK";
    break;
}


2.在main / app.c中替换#和*:

//res = ast_readstring_full(c, s, maxlen, to, fto, "#", audiofd, ctrlfd);
res = ast_readstring_full(c, s, maxlen, to, fto, "*", audiofd, ctrlfd);

//static const char default_acceptdtmf[] = "#";
static const char default_acceptdtmf[] = "*";

//res = ast_readstring(c, s, maxlen, to, fto, "#");
res = ast_readstring(c, s, maxlen, to, fto, "*");


3.重新编译星号:

sudo make clean
sudo make
sudo make install


我已经完成了这些步骤,它对我有用。

相关问题