Phone silent mode

mmjoshi

Member
I have a very specific requirement. When I set my Do Not Disturb mode to alarms only the phone does not ring for any incoming calls. However, I would like to the phone to ring for a VIP (aka my wife's number!) even in this mode. The phone should ring for a maximum of 20 seconds with a specific ring tone. The ring tone should be silensed after the set period of 20 seconds if I don't answer it, or in either of the following two conditions: a) I answer the call or b) I reject the call.

Is it possible to do this using MacroDroid. I am using the pro version of MacroDroid on RealMe Narzo 50 running Android 13.

If that's possible, I would like to do the same for WhatsApp calls.

Will it be also possible to extend the same feature to more than one numbers in my contact list?
 

Dm114

Well-known member
You could use the Incoming call trigger to run a macro to:
- check the calling number
- play a sound on a specific sound channel (or allow playing music in DND) during a period of time
 

mmjoshi

Member
You could use the Incoming call trigger to run a macro to:
- check the calling number
- play a sound on a specific sound channel (or allow playing music in DND) during a period of time
@Dm114 Thanks. Based on your inputs and my limited (very!) knowledge of MacroDroid, I have written a macro which unfortunately has many problems as follows:

01. The sound for the incoming ring continues playing even after I pick up the phone or reject the call.
02. Some times the sound keeps playing forever.

I am attaching the macro. In this macro, vip_number is my wife's number and max_vip_ringer_time is the time duration for which the incoming ring sound should play. I have set it to 20 seconds. ringer_time is the stopwatch which is triggered once 20 seconds are over.

Can you please tell me where I am going wrong? Or is there any better way to write this macro?
 

Attachments

  • VIP!.png
    VIP!.png
    268.9 KB · Views: 8

Dm114

Well-known member
@Dm114 Thanks. Based on your inputs and my limited (very!) knowledge of MacroDroid, I have written a macro which unfortunately has many problems as follows:

01. The sound for the incoming ring continues playing even after I pick up the phone or reject the call.
02. Some times the sound keeps playing forever.

I am attaching the macro. In this macro, vip_number is my wife's number and max_vip_ringer_time is the time duration for which the incoming ring sound should play. I have set it to 20 seconds. ringer_time is the stopwatch which is triggered once 20 seconds are over.

Can you please tell me where I am going wrong? Or is there any better way to write this macro?
Here's a bit simpler example below... 😉

IMG-20240319-WA0002.jpg
 

Dm114

Well-known member
@Dm114 That worked like charm! An elegant solution than what I could have ever done myself.

Will the same approach work for WhatsApp calls too? Because many times she calls me on WhatsApp.
Thanks for the compliments you gave me: you're welcome.

According to Whatsapp you'll have to add 2 triggers based on WhatsApp notifications:
- 1 for incoming call
- 1 for call active
 

Dm114

Well-known member
Thanks, will try my hand. Will come back here in case I land in trouble.
Ok 😉

I must admit I don't remember what are exactly the Notification messages sent by WhatsApp but as far as I remember they exist in both cases (incoming and active state or equivalent).
 

mmjoshi

Member
Based on your inputs and browsing the forum I have written a macro to do the same for WhatsApp calls. Unfortunately does not work. 😔 I am attaching the macro for your information. Would appreciate if you can give me your inputs.

BTW, in the macro above you have set up a Call Active trigger which is not used in the macro. Is that unnecessary?
 

Attachments

  • WA_-_VIP_2.png
    WA_-_VIP_2.png
    416.4 KB · Views: 11

Dev777

Active member
The <1s constraint in the trigger prevents the macro from firing multiple items as WhatsApp incoming call can throw multiple triggers as the phone is ringing.

The dontwait variable prevents the macro from firing again when the call isn't answered after the 20s have run out.
 

Attachments

  • WhatsApp_call_test.macro
    11.2 KB · Views: 5

Dm114

Well-known member
BTW, in the macro above you have set up a Call Active trigger which is not used in the macro. Is that unnecessary?
It is necessary : you probably missed the last action of the macro which Stops playing sound. It has to be stopped in 2 cases: after 20s playing or if call becomes active...
 

Dm114

Well-known member
Based on your inputs and browsing the forum I have written a macro to do the same for WhatsApp calls. Unfortunately does not work. 😔 I am attaching the macro for your information. Would appreciate if you can give me your inputs.
Why don't you use the same statements (same logic) as for the previous macro? It is very close except for triggers based on Notifications.

According to these triggers I wouldn't use a Notification Present constraint (which is probably not available yet at this stage) but the Magic Texts based on notification content instead.
 

mmjoshi

Member
@Dev777 the macro works. I have also created a macro based on the macro written by @Dm114 for voice calls and taking the triggers from your macro for the WhatsApp calls. This also works! I am attaching the macro for your comments. Appreciate the inputs given by both of you.

@Dm114 thanks for pointing out the necessity for the Call Active trigger. I had missed that. My bad. 😬

BTW, how do I modify this macro for WhatsApp video calls? Apparently changing the voice to video didn't work. Can both these conditions be part of the same trigger using wildcards?

@Dm114 The notification present constraint seems to be working. What are Magic Texts and how do I use them in this macro?
 

Attachments

  • WhatsApp_VIP!_.png
    WhatsApp_VIP!_.png
    307.4 KB · Views: 6

Dev777

Active member
U
@Dev777 the macro works. I have also created a macro based on the macro written by @Dm114 for voice calls and taking the triggers from your macro for the WhatsApp calls. This also works! I am attaching the macro for your comments. Appreciate the inputs given by both of you.

@Dm114 thanks for pointing out the necessity for the Call Active trigger. I had missed that. My bad. 😬

BTW, how do I modify this macro for WhatsApp video calls? Apparently changing the voice to video didn't work. Can both these conditions be part of the same trigger using wildcards?

@Dm114 The notification present constraint seems to be working. What are Magic Texts and how do I use them in this macro?
Unfortunately the macro you made has a flaw because the constraint works for any notification. Even WhatsApp messages.

This is what will happen.
When you get a WhatsApp call from anyone, the macro will check if a notification from your wife is present (A WhatsApp message is enough) and the macro will fire.
You can test it.

What you you have to do is you have find a way of knowing which number is calling by extracting the incoming call notification for the caller then check if it's your wife's number then proceed with the macro.
The macro I made can help you with that
 

mmjoshi

Member
Gosh! @Dev777, @Dm114, you guys are way ahead of me in terms of understanding MacroDroid. @Dev777 based on your inputs, I have modified the macro keeping the same structure but incorporating additional check for the WhatsApp number. Hope that will work. Unfortunately, I have not been able to check it out as my wife is out and will be coming by the end of the day. However, I am sure with your understanding, you will be able to check it for all boundary conditions. Do let me know whether this will work.
 

Attachments

  • WhatsApp_VIP!_.png
    WhatsApp_VIP!_.png
    376.2 KB · Views: 3

Dev777

Active member
Tja
Gosh! @Dev777, @Dm114, you guys are way ahead of me in terms of understanding MacroDroid. @Dev777 based on your inputs, I have modified the macro keeping the same structure but incorporating additional check for the WhatsApp number. Hope that will work. Unfortunately, I have not been able to check it out as my wife is out and will be coming by the end of the day. However, I am sure with your understanding, you will be able to check it for all boundary conditions. Do let me know whether this will work.
That's better
 
Top