sriramtej / sipdroid

Automatically exported from code.google.com/p/sipdroid
GNU General Public License v3.0
0 stars 0 forks source link

VoIP application should not use AudioManager.setMode() API to change phone state #270

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am a developer in the Android audio framework team and I have noticed
that sipdroid was changing the phone state via the AudioManager.setMode() API.
There are several issues with VoIP applications using setMode(), the 2 main
ones being:
1 changing phone state has implications on audio routing and volume control
that go beyond the audio from app processor: It also acts on base band
audio and the impact varies among platforms. For instance, selecting phone
state may activate the phone DL audio path and generate some noise in the
receiver. 
2 If the application does not properly exit phone state, the audio routing
is altered permanently: for instance, music playback is stuck on earpiece.
This is what happens with sipdroid when the application crashes or is
stopped by application manager.
Before Android 2.0, using phone state was the only way to route audio to
earpiece on some platforms.
With Android 2.0, a better practice is to use STREAM_VOICE_CALL audio
stream type instead of STREAM_MUSIC for in call audio output. The audio
routing rules will then be the same as for a phone call. Also use
AudioManager.setSpeakerphoneOn() API to activate or deactivate speaker phone.
when changing volume of STREAM_VOICE_CALL stream please make sure to save
current volume when sipdroid is resumed and restore it when paused.

Given the risk associated to the use of setMode() by any application, it is
likely that the permission will be restricted to the phone app only in a
near future.

Thanks for taking these remarks into account.

Eric Laurent.
elaurent@google.com

Original issue reported on code.google.com by elaur...@google.com on 11 Jan 2010 at 6:55

GoogleCodeExporter commented 8 years ago
Thanks for your comment. We will try to integrate it for OS version 2.0 
upwards. 
Probably this is the reason for issue 241?

Unfortunately I have no device running under Android 2.0 (or higher) here to 
test with!

Original comment by pmerl...@googlemail.com on 12 Jan 2010 at 9:36

GoogleCodeExporter commented 8 years ago
Or would you like to do the necessary changes?

Original comment by pmerl...@googlemail.com on 12 Jan 2010 at 9:43

GoogleCodeExporter commented 8 years ago
We used STREAM_MUSIC to let the built-in volume control adjust in call volume. 
When 
changing to STREAM_VOICE_CALL will we need to grab the volume key events and 
adjust 
volume ourselves? When I checked Android sources recently I saw that the 
framework just 
checks for isMusicActive() and modifies music volume if true. This would not 
work if 
Siproid is running in the background.

Original comment by pmerl...@googlemail.com on 12 Jan 2010 at 10:04

GoogleCodeExporter commented 8 years ago
Issue 204 has been merged into this issue.

Original comment by pmerl...@googlemail.com on 12 Jan 2010 at 10:05

GoogleCodeExporter commented 8 years ago
For the volume control issue I might modify AudioService so that VOICE_CALL 
stream is
selected when either the phone is off hook (current behavior) or the stream
VOICE_CALL is active. This would offer a consistent behavior for all VoIP apps.

Original comment by elaur...@google.com on 12 Jan 2010 at 6:42

GoogleCodeExporter commented 8 years ago
Good. Please let us know which version you start this behavior with. So we will 
use the 
new stream type from that OS version on.

Original comment by pmerl...@googlemail.com on 12 Jan 2010 at 8:36

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

Original comment by pmerl...@googlemail.com on 20 Mar 2010 at 9:30

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Just a side note, out of desperation, I've tried the aSip on my Samsung Galaxy 
and apparently it worked. aSip says 
it's sipdroid 1.2.4 beta in its about window -- any chance I could download 
sipdroid 1.2.4 beta instead of using 
that shameless rip off sipdroid that aSip is? That is, while the fix hasn't 
been implemented yet.

Original comment by stangri%...@gtempaccount.com on 23 Mar 2010 at 3:22

GoogleCodeExporter commented 8 years ago
Seconded. I'd love to get Sipdroid working on my Samsung Moment, and the current
version is only giving one way calls. Is there any way to download old versions 
of
Sipdroid? Thank you!

Original comment by ezze...@gmail.com on 23 Mar 2010 at 8:30

GoogleCodeExporter commented 8 years ago
Could you please test release 1.4.1pre which is available here? It would be 
nice to 
know if it still works on Droid and N1, and might also work with Samsung etc.

Original comment by pmerl...@googlemail.com on 23 Mar 2010 at 9:19

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I seem to have spoken too soon -- the sip calls do seem to work with the 
1.4.1pre on Samsung Galaxy with the 
headset gain and headset mic set to highest, however neither incoming nor 
outgoing cell phone calls work -- I 
can't hear the other party.

Original comment by stangri%...@gtempaccount.com on 24 Mar 2010 at 2:47

GoogleCodeExporter commented 8 years ago
I tested 1.4.1pre on a Droid with 2.01. I have done three test calls so far. I
experienced very poor call quality, which is unusual for me with Sipdroid. (I 
use
PBXes and Call Centric.) I will test more later, but my immediate impression is 
that
call quality declined. 

Original comment by davestec...@gmail.com on 24 Mar 2010 at 2:54

GoogleCodeExporter commented 8 years ago
On mine samsung galaxy spica i5700 application doesn't event start, it crashes
everytime, so I could not test it.
Regards

Original comment by a.mysl...@gmail.com on 24 Mar 2010 at 8:10

GoogleCodeExporter commented 8 years ago
Could you please consider making the older versions available? Right now the 
aSip is my only option, I would 
rather use the original sipdroid 1.2.4 beta! 
If you make the older versions available we could narrow down for you when 
things got broken.

Original comment by stangri%...@gtempaccount.com on 25 Mar 2010 at 1:34

GoogleCodeExporter commented 8 years ago
They're available under the downloads tab.

Original comment by pmerl...@googlemail.com on 25 Mar 2010 at 8:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I just tried 1.4.1pre with my galaxy spica i5700 and the problem described in 
issue
341 still remains the same.
I have to mention that my phone now runs Android 2.1

Original comment by derhoch@gmail.com on 25 Mar 2010 at 10:47

GoogleCodeExporter commented 8 years ago
Thank you, 1.3.14 beta works fine on Samsung Galaxy with the latest 
Samsung-supplied 1.6 Android ROM.

Original comment by stangri%...@gtempaccount.com on 29 Mar 2010 at 1:54

GoogleCodeExporter commented 8 years ago

Original comment by pmerl...@googlemail.com on 29 Mar 2010 at 5:19

GoogleCodeExporter commented 8 years ago
Sorry, do you mean it's been fixed in 1.4.x? Which exact version/build has it 
been fixed then?

Original comment by stangri%...@gtempaccount.com on 29 Mar 2010 at 6:12

GoogleCodeExporter commented 8 years ago
1.4.2 is now available on the Market or download from the main project page.

Original comment by johndeze...@gmail.com on 29 Mar 2010 at 6:15

GoogleCodeExporter commented 8 years ago
Doesn't look like Samsung Galaxy issues were fixed in 1.4.4. 

Original comment by stangri%...@gtempaccount.com on 30 Mar 2010 at 1:27

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hello Experts..

Can you please help me how to play audio song to callee when phone call is 
lifted.
and call should be disconnected automatically once playing done.i tried with 
many forums and in android API, but i didn't find any solutions for this...

please help me how to do this issue..this will be helpful to many people.

thank you in advance..

Original comment by nagesh.g...@gmail.com on 5 Feb 2011 at 4:21

GoogleCodeExporter commented 8 years ago
I am also interested in playing music file during a call.
Is it possible at elast on latest android v4.21 ?

Original comment by Jasko2...@gmail.com on 21 Feb 2013 at 10:10