Monday, March 12, 2018

command line - How to call from console?


How to make or receive a call from console?


Expecting something like this, UNIX-style:


make_call +3750291234567 < played_data.wav > recorded_data.wav


wait_for_call < played_data.wav > recorded_data.wav 2> call_info.txt

Preferably this should have no side effects like sounds from the device. The phone is Xperia X10 (for which the call recording is reported to be working).


I want calls to be scriptable like other Linux things I've got used to.



Answer



You're not going to be able to achieve this using just userland tools, like what you describe -- at least not while Android is running.


The reason is because the RIL opens the radio device (generally some device node under /dev/*) as a low-level linux service, and while that has an exclusive lock on the device, nothing else can read from or write to the radio. The RIL then communicates to the Android platform for all radio-related events.


It could be done with some extensive modifications to the underlying Linux kernel (it's open source, so definitely a possibility if you don't mind getting your hands dirty in C), or by replacing the RIL daemon (not as easy, because the rild is not required to be open source, therefore you don't know what the underlying implementation is without reverse engineering). Doing the latter will break Android's ability to use it properly, unless you somehow come up with a compatibility channel to proxy communication between the new RIL and the existing RIL - and even then, there's a good chance that Android will become confused when it tries to make a call (knowing that the modem should not currently be in use, but getting a response from the radio saying that it is in use).


Failing that, you might also be able to achieve it by replacing the Phone app and using all-native platform APIs. But I'm kind of thinking that it won't work (at least based on my knowledge of how HTC radios work). In an HTC device, when you place a call, Android notifies rild, which places the call, and then rild tells the radio that it should route all call audio through the handset speaker and route all sound picked up from the microphone into the phone call. The Android platform does not handle call audio routing itself.


All of the above requires rooting the device and installing a custom-built ROM at a minimum.



No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...