Multi-SIM target number identification

Post your questions and help other users.

Moderator: Martin

drboa
Posts: 27
Joined: 01 Dec 2016 07:24

Multi-SIM target number identification

Post by drboa » 27 Jul 2020 05:23

Dear all,

I have an issue that needs your competent help. I have a Samsung S10+ with two SIM-cards. I would like to build a flow that identifies (in an incoming phone call) WHICH of my two SIM-cards that is being called to. Reason: I travel a lot and want to change the ring tone to alert me of roaming calls directed unnecessarily to the "wrong" SIM depending on which country I'm presently in...

Many thanks for your help! / B-O

drboa
Posts: 27
Joined: 01 Dec 2016 07:24

Re: Multi-SIM target number identification

Post by drboa » 27 Jul 2020 05:35

Additional info to my request:
I'm NOT interested in the "roaming detection" function that is hidden in the "initialize system variables" module. It only tells me IF I have forgotten to switch to the "right" SIM-card and NOT if the incoming call is being MADE to the "right" (or most convenient) SIM-card with respect to roaming...

Thanks / B-O

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Multi-SIM target number identification

Post by Desmanto » 27 Jul 2020 10:06

At mine, when there is incoming call, {notification_text} will contain the caller number/name and "Incoming call via CARD 2" (CARD 2 is the SIM slot 2's name).

If yours is similar, you can use trigger notification on statusbar, and check for the text containing the SIM Card name. Usually you can modify it in the Setting > Network & Internet > SIM Cards. If the caller call to the wrong SIM, use action silence ringer and then create action sound to give different sound to indicate it is wrong line. Or you can auto reject it too by perfom action on notification on statusbar, Click Button "Reject". Then create notif to indicate there has been wrong SIM.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

drboa
Posts: 27
Joined: 01 Dec 2016 07:24

Re: Multi-SIM target number identification

Post by drboa » 27 Jul 2020 12:07

Dear Desmanto,

Thanks for shedding light! I assume your trigger is ”Incoming phone call”, but from where do you extract {notification_text}?, it's not delivered with the trigger itself...

Thanks!

drboa
Posts: 27
Joined: 01 Dec 2016 07:24

Re: Multi-SIM target number identification

Post by drboa » 27 Jul 2020 12:35

Dear Desmanto and all other in the forum,

I have experimented one more hour and I seem unable to replicate your observations. I have tried both triggers; "incoming phone call" and "notification shown in status bar" - both generate positive triggers by incoming phone calls (and with slightly different output variables) but no-one contains info about which SIM-card that was actually targeted by the external caller...

However!!! I see two different icons in the status bar (one with a handset and a number 1 for the first SIM-slot and correspondingly another with a handset and a number 2 for the second). Unfortunately I cannot get a fix on them with Automagic - maybe because Phone overlay outtrumps all other applications while active... ... any ideas anyone?

Many thanks in advance!

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Multi-SIM target number identification

Post by Desmanto » 27 Jul 2020 13:37

Not Trigger Incoming Phone Call, as that intent doesn't provide the indication of the SIM card being called (at least, not at my phone). Use Trigger Notification on Statusbar Displayed, you can filter it on com.android.dialer (in most phone), or just leave it * (to select all app). Add a condition debug dialog after the trigger and call your phone from other phone. You can see the debug dialog pop up every available variables provided by the trigger. From there you can see which one have the SIM card indication. In my case, it is the {notification_text}. At yours can be different, so need to check.

If you need to log it down for multiple testing (or the phone overlay cover the debug dialog), it is better to use my variable logger flow : viewtopic.php?f=3&t=7285
Change the trigger and the glovar name accordingly. I also use this to log the variable, before testing it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

drboa
Posts: 27
Joined: 01 Dec 2016 07:24

Re: Multi-SIM target number identification

Post by drboa » 27 Jul 2020 19:15

Dear Desmanto,

Thank you for devoting your time (again). I have followed your quite detailed instructions and return to square one all the time...
I'll attach the information enclosed in the original trigger variable output, followed by your suggested variable logger flow - please hold on!

Do you operate your phone on android 10?.. ...everything seem different here...🤷‍♂️

drboa
Posts: 27
Joined: 01 Dec 2016 07:24

Re: Multi-SIM target number identification

Post by drboa » 27 Jul 2020 19:34

Screenshot_20200727-123117.jpg
Screenshot_20200727-123117.jpg (341.3 KiB) Viewed 22517 times
Screenshot_20200727-123124.jpg
Screenshot_20200727-123124.jpg (358.93 KiB) Viewed 22517 times

drboa
Posts: 27
Joined: 01 Dec 2016 07:24

Re: Multi-SIM target number identification

Post by drboa » 27 Jul 2020 21:46

Dear Desmanto,

Presse don't give up on me, I have read many threads of you, and I find you extremely resourceful. I'm sure that many other Automagic users will find this thread useful, since there are (still in 2020 d.c.) huge roaming penalties between countries...

@Martin - maybe this could become included in the next program version - an extension of the trigger "all incoming calls", to which SIM-card"!?

Cheers / B-O

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Multi-SIM target number identification

Post by Desmanto » 28 Jul 2020 10:24

I have colleagues using Samsung S8, Note 8, S9; but none of them use dual SIM, only single SIM + single microsd. I tried to call them and no indication of SIM 1 or SIM 2 in the notification statusbar. Maybe it is because single SIM. S8 and Note 8 still Android 9.

Mine is Redmi Note 5 whyred, using AEX Pie 9.0 ROM. It is AOSP ROM, hence closer to stock android and has standard dialer (com.android.dialer).

Try to look at the glovar and scroll above for the first element, you might find different notification_text. Your Screenshot show 00:00... which might indicate the notification_text after you have picked up the phone. You need the one before the call picked up. It might show you the SIM Card number.


If there is no any info on the SIM Card, then the workaround is to use custom notification sound. viewtopic.php?f=5&t=8440#p26572
The method in the link is for whatsapp group but can be applied to other usage as well. Just set both your ringtone to custom sound. If you use SIM 1 to receive call and SIM 2 may not receive any call; then use normal ringtone for SIM 1 and alert warning sound for SIM 2. This is more complex than the solution below, so maybe this is just for idea.

If you discipline yourself to always put primary receive call SIM into slot 1 and call retricted (may not receive call) into slot 2, then you don't even need to use custom ringtone above. You only need to change the ringtone sound of slot 2 everytime you are abroad. You can use set system setting and change ringtone2 as shown here : viewtopic.php?t=7879
(for SIM 1 ringtone, action Set Default Ringtone can be used)

Or, if you want to be sure, no need to use Automagic, just change ringtone sound for SIM 2 manually after you change SIM Card.


Roaming cost is certainly very costly, while we have many free internet call already since several years ago. Adding the SIM card call source for the trigger is great. But unfortunately it doesn't guarantee to work on all phone, since different ROM can use different dialer app. Maybe Martin can find out the way to do it for popular dialer (built-in android, samsung, huawei and others).
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply