In android, how do I call myself programmatically? - android

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.

Related

How can I bridge phone calls to VoIP?

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.

Local call forward with 2 sim cards

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.

Will an Android Nearby advertisment trigger any kind of UI on nearby devices?

Following this article i discovered a comment stating that
Advertising with an AppIdentifer lets other devices on the network discover this application and prompt the user to install the application.
How does the second user interact with this solution? Is there any kind of UI, like a notification? Has anybody tried this yet? Is this available only for a specific use case like Android TV devices?
Nearby Connections leaves it to you, the developer, to create UX that makes sense for your use-case. There are two sides to the API. The advertising side and the discovering side. Nothing happens when you advertise unless another device calls the discovery API and even then, it's up to your app whether or not to display anything.
When a second device invokes startDiscovery it will get an onEndpointFound callback. That's an opportunity to display UX or call sendConnectionRequest (to establish the connection)

Send "something" to a Device that has my app installed?

when a certain condition is true, I need to send a message to a certain device that has my app installed.
How can I realize it? E.g. A klicks on the name B, B shall get an AlertDialog that A clicked on his name. I know that I will need something like a deviceID. But what else?
You don't need a device ID, you need a server that handles the communiation between the two devices.
In order for a device (A) to communicate directly to another device (B) without a server, A needs to know who B is and how to reach it.
You could do that either with an SMS and the only thing you need to know about B is its phone number, but I guess this is not what you want to hear.
The other options is through a TCP/IP network. A would need to know B's IP address, which is something almost unfeasible, unless both devices are connected to the same network, probably via WiFi, and even so, there's no direct way to know B's address.
The usual solution is that both devices connect to a server through the network, using a particular protocol. When A want's to send a message to B, it does it through the server, which forward the request to B (since B is also connected to the server). In order to identify the devices you can use any information bit you want (it can be a user name, such as in chat systems, it can be the device ID which is not very reliable...)
If the recipient device currently has your app running and is connected, then the app you would presumably maintain a connection to a server or implement polling by the app.
For a non-running recipient app, you'll either have to utilize a standard messaging protocol (SMS, email, etc.). Or you will have to implement a background service in your app that periodically wakes up and polls a server that maintains the messages. This is how Twitter, Facebook, etc. work.
Just to be clear, opening or maintaining direct network connections between multiple devices not on the same local network is not really doable.
You need to poll the app you want to send something to.

Is there a way for automatic/programatic pairing of 2 bluetooth devices in android?

I am developing an application which connects devices over bluetooth and exchanges messages. It works fine for paired devices, but I would also like it to automatically pair devices that are not paired. Like for example it could store and use the same PIN for pairing requests, I just dont know how to manage this request programatically in my applciation, how to automatically set and send the PIN when you get a pairing request and how to initiate such a request with the predefined PIN code.
Any snippets or thoughts would be highly appreciated! :)
EDIT:
I know its risky, I am developing this app for emergency situations only where no other means but bluetooth is available. Also is there maybe a way of premature pairing with devices without even connecting to them? Like lets say there is a list of MAC Addresses of those devices and I can use them to generate a bond with that devices so that they appear paired on my device?
You can't do this. To do what you want to do would create a huge security risk. Think about it, my device just comes anywhere in bluetooth range of yours and now I can send you anything I want without you knowing? You can't really do this and I highly recommend not trying to subvert it.
Reflecting the setPin method allowed me to send the pin automatically to the other device. I had to implement it in a broadcast receiver that is listening for pairing requests. Although I cant get rid of the dialog it just stucks there on the screen and I dont know how to close it (programatically) and continue the bonding procedure since this dialog is called from inside connect() which is a blocking method. I am not giving up on it yet though :)
With Bluetooth version 2.1 and above there is a method of pairing called the 'just works' association model. This is the lowest security method of pairing and has no protection against man-in-the-middle attacks.
However, this will provide a secure, encrypted link without the need to exchange pin numbers or verify device ID.
The API on different platforms may differ but the underlying HCI messages require that you indicate that your device (or one of the devices) has the following IO capabilities:
No Keyboard, No Display.
As you might have guessed, this is a mode for very
simple devices that use Bluetooth, such as a speaker or headphones.
If you can find the API to configure that, then the 'just works' association mode of Secure Simple Pairing will be used for pairing.
The next step is to store the link keys e.g. bonding. Many devices e.g. mobile phones, will still create a dialogue box to the user to ask if they want to 'remember this device', as user authorisation is specified by the BT specifications... but that's another problem.

Categories

Resources