mqasim
mqasim

Reputation: 69

How to Read * terminated dtmf digits in asterisk

I know Read command gets # terminated dtmf digits. But how can I read dtmf digits terminated by asterisk character "*"? For example, if I have to enter "092", i press "092*" from keypad.

Upvotes: 1

Views: 1555

Answers (3)

Milad H.
Milad H.

Reputation: 122

Changing tmp[x-1] == '#' to tmp[x-1] == '*' in apps/app_read.c is necessary but not enough.

You can do these steps:

1. Replace # with * in apps/app_read.c:

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


2. Replace # with * in 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. Recompile asterisk:

sudo make clean
sudo make
sudo make install


I've done these steps and it worked for me.

Upvotes: 1

viktike
viktike

Reputation: 733

To modify the behaviour, see apps/app_read.c in the asterisk source directory.

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

Replace # with *.

You only need to recompile that module:

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

Upvotes: 1

arheops
arheops

Reputation: 15259

You have 2 ways here

1) not realible, but can work most of time. Just read one digit at time using AGI getdata or dialplan Read command.

2) create fork of app_read and change # to * in code.

Upvotes: 1

Related Questions