Hi Jesus,
I had to change your sample because isNumber is not something I had
imported/defined. I used this:
public char readID(String ma) throws AgiException {
char[] maAr = ma.toCharArray();
char res = ' ';
int i = 0;
while ((i < maAr.length) && (!Character.isDigit(res))) {
System.out.println("loop index: " + i);
res = sayAlpha("" + maAr[i], "0123456789");
i++;
}
return res;
}
When I ran it with a large digit string, such as:
System.out.println(readID(java.lang.Math.PI+""));
My output when I hit 9 in after a bit is:
loop index 0
loop index 1
loop index 2
9
This is what I expected. Perhaps you aren't catching an exception being
thrown, or Asterisk isn't getting your digits correctly? I would expect
sayAlpha delegates most of what it does to Asterisk, and that Asterisk isn't
correctly picking up your DTMF. I believe you can play with those settings
and relax the requirements.
Best,
Martin
|