Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Enable / disable 'receive incoming calls' #4

Open
joost opened this issue Oct 11, 2013 · 12 comments
Open

Enable / disable 'receive incoming calls' #4

joost opened this issue Oct 11, 2013 · 12 comments

Comments

@joost
Copy link

joost commented Oct 11, 2013

More a feature request.

Would be great if the widget had an easy one click button to enable / disable 'receive incoming calls'. IMHO the 'settings shortcut' button could be used for that.

@robert7k
Copy link
Owner

The Android API unfortunately doesn't support this at the moment.

@joost
Copy link
Author

joost commented Oct 13, 2013

Bummer. Thx for the reply!
On 13 Oct 2013 21:16, "Robert" [email protected] wrote:

The Android API unfortunately doesn't support this at the moment.


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-26224672
.

@scheich
Copy link

scheich commented Jul 21, 2016

Seems to be possible now? There seems to be a setter method for that:

https://android.googlesource.com/platform/packages/apps/Phone/+/650fe766347b4a896085ce8924ace69c029e49d9/src/com/android/phone/sip/SipSharedPreferences.java

@robert7k
Copy link
Owner

This class has been there for some time, but it's part of the phone app and thus cannot be called from an outside app.

@scheich
Copy link

scheich commented Jul 21, 2016

Just tried it with SDK 22, it worked for me:

Settings.System.putInt(getApplicationContext().getContentResolver(), "sip_receive_calls", 1);

@robert7k
Copy link
Owner

The last time I tried this, only the settings dialog reflected the change. The behavior of the phone was unaffected, i.e. incoming SIP calls would not be received.

@scheich
Copy link

scheich commented Jul 21, 2016

Ah, OK. I didnt test, if it really works :), just, as you said, that the settings checkbox changed the state.

@scheich
Copy link

scheich commented Jul 21, 2016

Ok, tested. :-P

I could see the changed settings immediately with:

Settings.System.getInt(getApplicationContext().getContentResolver(), "sip_receive_calls");

But I had to send the notify broadcast com.android.phone.SIP_CALL_OPTION_CHANGED, like you do, otherwise it wont worked for me.

If I set it to 0, there was no delay, I didn't receive calls anymore. But if I set to 1, the call is only incoming after a period of time. For me it was 30-60 seconds. I think this has something to do with the sip registration. Perhaps you can force an registration, theres a method for that, but I couldn't find out yet, how to parse through the already defined profiles to get the profile uris.

Tested with CM12 nightly. SIP Provider is Telekom Germany.

EDIT: Perhaps you can get the profiles with the SipSession.Listener

@robert7k
Copy link
Owner

I actually tried this some time ago, but maybe I was too impatient. I think this should be investigated further.

@robert7k robert7k reopened this Jul 24, 2016
@wolfgangasdf
Copy link

I do really need this, therefore I wrote a small app which works for me very well since months (but requires "root"):
https://bitbucket.org/wolfgang/wifisiptoggle

@madmuffin1
Copy link

See my MR #16 which should triage this

@lx1
Copy link

lx1 commented Oct 3, 2021

But I had to send the notify broadcast com.android.phone.SIP_CALL_OPTION_CHANGED, like you do, otherwise it wont worked for me.

Just for reference if someone arrives here googling around, like I did: it seems to me that at a certain point the API was changed. At least on Android 11 (Evolution-X on Poco X3, specifically) the intent to broadcast is now "android.net.sip.action.SIP_CALL_OPTION_CHANGED" .
I'm absolutely no Android nor Java expert, so take this with caution, but it works for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants