Android: receive dialer number press from the other party - java

I'm wondering if it's possible to receive a notification if user presses a number in dialer on the other side of connection during the phone call. Like the scheme used by various automated support services - "Press 1 to..., press 2 to...". So I would like to receive that number pressed.
Thanks

AFAIK it is not possible to tap into the phone's incoming audio stream...
There's a lot of "record incoming call" issues on that matter.
You would need the incoming audio stream to read the DTMF-codes being sent.

Related

Discord Bot Java - I'm trying to have my bot send a message every so often and need help on which event listener is best suited

I want my bot to send a message randomly throughout the day.
I was using the onMessageReceived event to achieve this, but that depends on a user sending a message, and I want the bot to still send a message randomly even if there hasn't been any server activity for a while.
Basically, what I'm hoping to find is if there's an Event Listener that fires every few seconds consistently while the bot is online. The event shouldn't be dependent on if users send messages or if people join voice channels, etc.
Does anyone know of an Event Listener that could help me achieve this?
Just use a timer in your bot after you run a command, you could add a command like !motd random for a random interval and then if you wanted to do it after a certain period of time do !motd 3hours

Does android system blocks FCM notification

I am sending a data notification every 2 min for the device in order to collect data (GPS, Signal strength ...).
The FCM trigger service that sends the collected data to an API
However, The device stops receive FCM notification to starts that app in some cases or even till restart it.
Is there any reason for this and how Can I pass it?
Note: I have Add server up to white list in the firebase console
Generally there are two types of FCM messages we can send to registered devices. First one is data message and the other one is notification message. The default priority of data message is NORMAL where as the notification messages have a HIGH priority. Messages with HIGH priority are considered to be delivered first (That means there is a chance of not receiving data messages in some case). But it is possible to change the priority of data message to HIGH while sending them from server.
https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message
But in my case i had some situations when i was not able to receive FCM messages even after setting priority to HIGH. Thus i opted to use FCM wrapper services like Onesignal to send push notification. It is way better in case of message delivery. Inside it is FCM, but they handled the message delivery problem up to an extent. Take a look at
https://onesignal.com/

Asterisk shared data between two channels in a call

I want to pass some message between two communicating channels in call, My requirement is two java applications will act as two different users in a call, There should be some message that can be shared only between two channels in specific call, so that if one application is going to play something it can send message saying that you record now and vice-verse. I will be thankful if somebody can help me out.
You can use AMI to watch for UserA trying to share data, and then set it on UserB's channel.
Background to this...
Sounds like a similar problem that I had. With two users in a call, I wanted user A to start recording the call. I wanted the recording to start on User B's channel so that if the call was transfer, that channel was not destroyed and the recording would continue. Simply calling MixMonitor starts the recording on the channel that calls MixMonitor which would be UserA's channel.
I wrote a small application that monitors UserA and listens for a UserEvent from UserA (see 'core show application UserEvent') and then start Mixmonitor on UserB's channel. It also has to keep track of channels so that it knows which channel belongs to UserB.

Auto response to incoming call with SMS

Is it possible to auto respond to incoming call with an SMS?
For example if a user is on a metting and want to set is phone state to busy, and automaticlly send reponse SMS saying "I am busy, call you later".
I saw that blocking incoming phones is impossible, but here i want the call to come and simply send reply SMS automaticlly.
Thanks.
Yes it is possible,it can be done by creating a broadcast listener and sms Manager,that is whenever the app is turned to do not disturb mode,you can register any incoming phone number in the app and can send an automated sms reply to the number as soon as possible. and as the matter of fact there's already an app present in the app store

How to know if i am successfully connected to my outgoing number in Android?

Need to know this so that i could send DTMF and that is going to be my second question!
You can use the PhoneStateLisenter to listen out for changes in the call state.
So you listen for the LISTEN_CALL_STATE change.
With the onCallStateChanged method.
So when the state changes from RINGING to OFFHOOK you know a phone call has been connected
Same principle applies for IDLE to OFFHOOK in your situation, listen out to the change from IDLE to OFFHOOK and you'll know your connected to a call.
You can also look into the ACTION_NEW_OUTGOING_CALL intent, Android allows you to "trap" this when a call is dialled and you may be able to get a result code back stating whether the call was connected or not.
For DTMF tones look into ToneGenerator, this allows you to create DTMF tones and .startTone() should allow you to play the DTMF tone then.
However you cant send DTMF tones through the uplink.

Categories

Resources