I'd to check whether it's possible to make a normal call (not only emergency call) and if it is then get the number of a sim card by what it is possible to do (including the case when it is a dual sim card - get the active number). And I also want to check whether or not the phone is in roaming. So overall there might be 3 cases:
It is not possible to make a normal call - the phone is in roaming and there is no operator which supports its "home" operator or the phone is just unavailable due to its location (in a subway, for example).
It is possible to make a call and the phone is in roaming
It is possible to make a call and the phone is not in roaming, it is in its home country.
Is this all possible and if yes then how? The general instructions are ok.
Take a look at TelephonyManager.
There are methods to check whether you are roaming,cell info and more data.
You can use this information to achieve what you are trying to do.
Related
I want to have one stationary device like an android phone that can use a standard local SIM card and forward all calls to a second device over some kind of VoIP protocol. When someone calls the phone number of the stationary device, I want my second device to ring and handle the call through something like linphone, element, or whatever. Ideally, it should be possible from the second device to initiate a call from the stationary device's phone number as well. Bridging SMS too would be nice, but I already have a solution for this on android.
There are many use cases like
when traveling abroad, being able to bring the latter device and receive/make calls via the stationary device at home
forwarding multiple phone numbers to a single device and e.g. switching off the work number when away from work
having privacy when the location of SIM cards is logged, by making calls over wifi from somewhere else than the stationary device
when traveling somewhere with bad mobile coverage but available wifi, without having to think about how the second device handles it
Are there any existing projects for doing this?
If not, then what would be necessary to make something myself? Is the best solution something like connected an android device by bluetooth to something running asterisk like was discussed here? Or has something changed in the past 11 years, maybe the existence of some working linux phones makes this possible on a dedicated purism or pinephone device?
I think you can achieve this with Brekeke SIP Server. I am using their solution to achieve something similar to what you want to do.
there are multiple ways to achieve it technically, but the most practical solution to your use case will be to use a VOIP Gateway device.
Actually we can not use a mobile phone as gateway between SIM and VOIP calls.
so you can buy a voip gateway example GOIP (single SIM) and put your sim, connect to your home internet and configure. your phones softphone (eg linphone) will be able to directly register on it and you will be able to make/receive calls and sms.
there will be a new problem as mobile OS platforms are more and more restrictive about power, your sip client will not be able to receive calls while in background for that you will need push, so you can use twillio's mobile sdk to make a client that works fine then forward your calls to twillio from gateway. since there is no number or telecom services involved, cost on twillio should be minimal.
A more common way to do this is with an operator service, rather than implementing it yourself.
The operator is able to see the routing to your number and simultaneously call multiple numbers you have set up. Different operators will have different names and details so you would need to speak to your local operator.
For example BT in the UK (who I have no affiliation to - just an example) provide a service called 'Follow ME': https://support.ringcentral.co.uk/s/article/9010?language=en_GB
If you do want to do it yourself than an open source PBC like Asterisk is indeed a good starting point.
It's just impossible to find any information about "local" forwarding with phone, without using the usual network forwarder.
I have idea how it could work, but I need to know if something couldn't be done, even on rooted android.
This how it could work.
We should have:
Phone A with 2 simcards (X and Z).
Phone B number - where's we redirect the calls (one default number to forward all calls to)
And the app could work like this:
.
1. Incoming call to phone A (to X simcard). App starts calling (from Z card) to the phone B.
.
2. If phone B answers the call,
app answers the call from simcard X,
connects the sound out from sim X to sim Z in (so phone B could hear what the caller is saying),
connects the sound out from sim Z to sim X in, (so the caller could hear what the phone B is answering)
When call is ended on sim Z, the app hangs up the phone for sim X too or in reverse.
Basically with the forwarding step, that's it. The app then could do more stuff, like recording, tracking call duration, calls history and more.
This kind of app would be really helpful for businesses, so it's strange that it doesn't exist (I did research).
So the questions are:
Maybe it wouldn't be possible to call at the same time to another number while we are on another call? But if various spy trackers do that, then it means it is possible?
Any issues about doing this with 2 sim cards?
If these spy trackers have all the functionality we need on this app, why no one creates an app like this? Even if it would require a rooted phone - it would still be pretty useful and valuable! There are many lead business trying to track calls, forwarding and manually managing them. Other solutions are pretty expensive.
If this couldn't be done this way, how could it be done? Maybe connecting 2 phones to computer, then answering and forwarding from one to another within computer? Of course it should be always turned on, but there could be solutions like blueberry and so.
What do you think as experienced android developer? Is it super hard to achieve it? I am web developer and have very little experience on android, so I see it's possible.
I am working on an app that successfully intercepts NEW_OUTGOING_CALL broadcast on outgoing calls and handles calls accordingly. Everything works perfectly fine on single SIM devices.
On Dual SIM devices, I am able to detect which SIM is the default calling SIM by reading the ICCID (it changes depending on which SIM is the default calling SIM) and I am also able to handle calls accordingly (either handle it by my app or pass it back to the native dialer).
The problem I am facing is when users choose the "Ask every time" option. When they choose that option, the ICCID is still read as whichever SIM was set as the default SIM last.
I would like to detect that users have chosen this option so I can pop up a dialog thats asks them, which SIM they want to conduct their call over.
I searched through stackoverflow and scoured everything I could find on Dual SIM but I couldn't find an answer to this question. All the logic I added into handling calls on Dual SIM phones has been rendered useless by this part.
Is there something I can read (whether its a broadcast or an intent extra or an android setting) that would tell me that users want to be asked which SIM to use every time they attempt a call?
Thanks for the help.
I wan't to check if the user is operating the phone while a call is being made by using device's sensors and GPS.
I need to check if we are in hand free mode because in that case I should hear noise but may not see any movements or rotation.
I tried looking in android.telephony but found nothing. Also tried my good old friend google and no luck. Is it even doable?
Thanks!
Here you go. Your problem can be divided into 4 steps. Plus you dont need any sensors or GPS to achieve this.
1) Try to get connected Bluetooth Device list, via BluetoothAdapter class.
2) Check device class, via BluetoothDevice's APIs.
3) If you see Phone is connected to Bluetooth Device with capabilities like A2DP(audio) etc. Then you will know phone is in handsfree mode.
4) also try to find out phone_state of the phone. It shouln't be Idle, if you just want to check in state of making/receiving/during call.
I've seen an app that enables you to call yourself with the caller number "0123456789", how do I replicate this?
The spoofing (fake number) is not something that happens on the device itself. It is something that happens via a telephony network. The app I've seen that does it calls some other number, which then spoofs the call to the number you wanted.
And if you mean nothing more than call your device from your device, then it would require a 3rd party telephone connection, because cell phone networks don't allow you to actually call yourself (it would usually go to VM). That, and as I described, the spoofed number requires an intermediary.