AGI: Why Is Stream File And Wait For Digit Result ASCII, But Get Data Is “normal”?

Home » Asterisk Users » AGI: Why Is Stream File And Wait For Digit Result ASCII, But Get Data Is “normal”?
Asterisk Users 2 Comments

Having been scratching my head the whole morning to find a bug, I now have an A4 poster on the wall (not joking!) saying:

“get data” = *number*
“wait for digit” and “stream file” = *ascii !!!*

As you can see here:

AGI Rx << STREAM FILE "hello-world" "1,2,3,4,5,6,7,8,9,*,0,#" AGI Tx >> 200 resultI endpos840
AGI Rx << GET DATA hello-world -1 1 AGI Tx >> 200 result=1
AGI Rx << WAIT FOR DIGIT -1 AGI Tx >> 200 resultI

OK, I should have RTFM a bit harder, but this is VERY confusing! Out of interest, any idea why it was done like this, and why someone would ever need the ascii result from a keypress, rather than the keypress as given by
“get data”?

Just curious!

2 thoughts on - AGI: Why Is Stream File And Wait For Digit Result ASCII, But Get Data Is “normal”?

  • Maybe because ABCD are valid DTMF events? Maybe because 0 means playback completed, not a 0 was pressed?

    IIRC there are some inconsistencies in the AGI API that I stumbled across when I wrote my library back in ’04. If you’re not using a library, you may want to consider it.

    ‘Comma’ is not a valid ‘digit’ so this the same as ‘#*0123456789’


    Thanks in advance,
    ————————————————————————-
    Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
    https://www.linkedin.com/in/steve-edwards-4244281

  • ‘Comma’ is not a valid ‘digit’ so this the same as ‘#*0123456789’

    I’m using ts-agi which has served me well. In the docs, it suggests phonekeys is an array:
    https://github.com/sergey12313/ts-agi/blob/master/src/__tests__/index.test.ts#L295

    ctx.streamFile(“test”, [1,2,3,4,5,6,7,8,9,0,”#”,”*”], 1000,)

    But in fact, you’re right! I just tried “12345*#” and it works. I learn something new every day here!

    Believe me, I’d love to be going full ARI right now, but with no way to get the current offset of a track I have to stick with AGI.

    Thanks again.