如何读取星号中 * 终止的 dtmf 数字
How to Read * terminated dtmf digits in asterisk
我知道读取命令获取 # 个终止的 dtmf 数字。但是如何读取以星号字符 "*"
结尾的 dtmf 数字?
例如,如果我必须输入“092”,我会在键盘上按“092*”。
这里有两种方法
1) 不可行,但大部分时间都可以。使用 AGI getdata 或 dialplan Read 命令一次只读取一位数字。
2) 创建 app_read 的分支并在代码中将 # 更改为 *。
要修改行为,请参阅星号源目录中的 apps/app_read.c。
if (tmp[x-1] == '#') {
tmp[x-1] = '[=10=]';
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
在 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] = '[=10=]';
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.重新编译asterisk:
sudo make clean
sudo make
sudo make install
我已经完成了这些步骤并且对我有用。
您可以同时使用 STAR and/or HASH 终止输入。您可以在不修补星号的情况下执行相同的操作。
如下使用 READ 应用程序。
READ(keyPressed,audio-file,maxDigits,t(#,*),maxAttempts,dtmfInputTimeoutSec)
仅对于 STAR 终止输入,只需在读取应用程序中使用 t(*)
我知道读取命令获取 # 个终止的 dtmf 数字。但是如何读取以星号字符 "*"
结尾的 dtmf 数字?
例如,如果我必须输入“092”,我会在键盘上按“092*”。
这里有两种方法
1) 不可行,但大部分时间都可以。使用 AGI getdata 或 dialplan Read 命令一次只读取一位数字。
2) 创建 app_read 的分支并在代码中将 # 更改为 *。
要修改行为,请参阅星号源目录中的 apps/app_read.c。
if (tmp[x-1] == '#') {
tmp[x-1] = '[=10=]';
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
在 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] = '[=10=]';
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.重新编译asterisk:
sudo make clean
sudo make
sudo make install
我已经完成了这些步骤并且对我有用。
您可以同时使用 STAR and/or HASH 终止输入。您可以在不修补星号的情况下执行相同的操作。 如下使用 READ 应用程序。
READ(keyPressed,audio-file,maxDigits,t(#,*),maxAttempts,dtmfInputTimeoutSec)
仅对于 STAR 终止输入,只需在读取应用程序中使用 t(*)