Voice calling app
Making a calling app
from scratch is surprisingly simple on Linux, so I intend to make one for
myself. It comes down mostly to configuring a bunch of controls in ALSA, and
talking to a modem via AT interface, using a small set of commands, like
A
to answer a call, D
to dial a number, or
H
to hangup. You don't need any libraries really to do that, and it
can be done with a few hundreds lines of C code without any
dependencies.
In total, the basics of controlling the modem and the audio
come down to using about 10 different ioctls
on four different
devices. Math
object in JavaScript has more complicated API surface
than this.
Implementing the UI will be slightly harder, but I can simplify things and not try to push everything to the UI interface and leave more complicated stuff to be configurable via some text files and scripts. It will be much more flexible and easier to manage too (for me ;)).
Features
I intend my voice calling app to have these features at the very least:
- Make calls
- Call a number directly (enter via on screen numpad)
- Select from contacts (contacts loaded from a file)
- Control audio
- Earphone volume, loudspeaker volume/enable, mic cutoff
- Modem cutoff from mic/earphone (but not AIF1)
- Play/record audio via AIF1 to/from all 4 channels selectively (modem, me)
- Disregard touchscreen input when proximity sensor detects the phone is near my head
- Incomming calls
- Show incomming call info with appropriate info from a contacts list file
- Notification
options:
- Play a ring tone
- Vibrate
- Blink (or variate brightness) of LCD backlight (with wite background)
- Blink a RGB led
- If on home WiFi, make a HTTP request to a web server (or send a
message to XMPP)
- The server can show me desktop notification that I have a call
- Nothing
- Have options in the contact list file to select notification options per contact
- Pass
incomming call notification through a JS file, that can decide the reaction (use
QuickJS)
- Decision criteria:
- Remote caller number or lack of
- My location (for example tower I'm registered to)
- Time/date
- Global setting (allow all calls, allow work, allow friends)
- Reactions:
- Drop the call immediately
- One or more of the above notifications
- Offer picking up the call normally on screen (with scriptable extra information displayed on the screen)
- Info mode: Pick up without turning on the mic or speaker/earphone and play some pre-recorded response.
- Telemarketer troll mode: Pick up without turning on the mic, but enable the speaker (or not) and automatically play short plausible responses at random whenever the other side stops talking, or talks for too long. Allow to take over the call at any time.
- Custom DTMF based menu system
- Call center emaulation mode (act like the caller reached a support call center of a bank, for example) – may encourage some marketers to drop the number from the list.
- Decision criteria:
- Call management during a
call
- Audio controls (volumes, enable speaker, mic cutoff + waiting music for the caller)
- Options to play from pre-recorded samples
- Call recording
- Ending a call
- Pickup + audio message
Progress
At the moment I have the core functionality of making and taking the calls and configuring the audio codec working in an interactive command line app, that can be also seen in this video:
Next step is to make the code more re-usable, and add a way to read/write audio streams via the PCM device and start implementing a touch UI for my app.