Hacker News new | ask | show | jobs
by nancyminusone 374 days ago
I'm going to assume this is more complex than generating DTMF tones yourself and injecting them into the audio stream?
5 comments

> generating DTMF tones yourself and injecting them into the audio stream?

When I was an undergrad I had an audio file for each digit and a winamp playlist for each of my frequently dialed numbers. I'd hold my (landline) phone against the computer speakers and double-click the playlist to dial. I'm sure I spent more time setting this up than it ever saved, but it was somehow pleasing that this ridiculously over-powered speed dialer worked.

Back in the days of phone line modems, there used to be a program that you could type in a number, the modem would emit the corresponding tones, and then you could pick up a phone and it'd already be connected. I can't remember what the one I saw was, but I'm sure there were multiple different ones, and I also vaguely recall there were dedicated physical machines that could before that.
You could do this with any terminal program. Your modem won't emit any noise until it hears a carrier tone, so you could just dial, pick up the extension, hang up the modem.
click. click. click-click-click-click-click-click-click.

...

...

PROCTOR TEST SET PLEASE SELECT TEST

LINE TEST PRESS 2

COIN RETURN TEST PRESS 3

COIN READER TEST PRESS 4

TONE TEST PRESS 5

ADDITIONAL TESTS PRESS 6

|

this isn't the one i referenced, but proves my memory is functional https://youtu.be/uOO9dFiwzGk - actually it has references to what i typed

There's a few different reasons things are more complex, but one interesting wrench to throw in is that audio tones may not be the best way to send DTMF. Many digital telephone networks support out-of-band DTMF where the digits are sent as digital keypress events instead of actual tones (tones are usually still emitted to the user for comfort). There are a few potential benefits but mostly it improves reliability over iffy connections, reducing instances of one press being detected as two due a dropout in the middle, for example. I believe 3GPP has supported out-of-band DTMF for some time but it may not have been common, VoLTE encourages it much more. The other end is always going to have support for traditional in-band DTMF because they don't know what type of connection the caller has, so it's not a fatal problem, but less than ideal to use in-band DTMF when out-of-band DTMF is supported. This type of consideration is one of the reasons that the telephony part of phones is more complicated than you might think.
If you are the dialer app, you could generate DTMF tones, yes.

If you want to do dialer things without being the dialer, then no. Android doesn't permit apps to access the audio streams of a call to non-dialer apps.

In this case, the solution was to use an accessibility service to perform accessibility tasks as an accessibility app. Quite appropriate, I think. Although it will fail if the dialer of your choice doesn't have a keypad with the exact right labels (or numbers? I don't know if phones in writing systems with alternative numbers still show Arabic numerals on the dialer).

indeed, non latin characters will probably fuck up my solution :(
yes, the solution presented in the article ultimately ends up using the accessibility APIs to click buttons in the dialer, due to restrictions on non-default-call apps
well technically you can, and a quick google search leads to apps that do this. but when you aren't in speakerphone mode, well the sound isn't loud enough to be properly processed on the other end of the line