Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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.

share|improve this question
1  
It's an excellent question, but I really think (based on my answer below) this is not the best place to ask, since android.stackexchange.com is more for user-oriented questions, and this question is most definitely a hardcore "developer" question. You're better off asking on stackoverflow.com, or maybe even sites like XDA. –  Joe Jun 2 '11 at 3:26
add comment

2 Answers

up vote 8 down vote accepted

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.

share|improve this answer
1  
Are there ready-made applications to allow at least partial thing, for example, making or waiting for call without sound redirection? –  Vi0 Jun 2 '11 at 10:36
    
What a clear, succinct response. Welcome to Android Stack Exchange. Answers like this will gain you respect :) - keep up the good work! –  WhiskeyTangoFoxtrot Nov 29 '12 at 16:31
add comment

You should be able to make phone calls easily in the command line, assuming you have root.

The command is service call phone 2 s16 "+18001231234". This will automatically start calling that phone number.

However, this is all done in the foreground. If you had the phone, you would see the normal call screens show up. If you were trying to launch a phone call behind the scenes without the user knowing, I'm not sure how you would do that.

Also, this is only for sending calls, not receiving. And you can't pipe a sound file to the call in lieu of using the actual microphone, nor can you record the incoming sound.

More information: Android – Call/Dial from the adb shell command line

share|improve this answer
    
Just initiating a call is already better than nothing. The next question is waiting for call and accepting/rejecting it. –  Vi0 Nov 29 '12 at 16:45
    
Where to find a full description of what to do with "service call <whatever>"? I only trial-and-errored "service call wifi 3 s32 0" to disable Wi-Fi (but not re-enable it). –  Vi0 Nov 30 '12 at 0:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.