frimtec / pikett-assist

:rotating_light: PAssist is an Android application to assist you while doing on-call duties. PAssist works for SMS based alerting systems.
Apache License 2.0
16 stars 2 forks source link

Add support for alphanumeric short code SMS phone numbers #475

Closed brenard closed 9 months ago

brenard commented 9 months ago

Hello,

Due to legislation change, it's quite difficult to send SMS from France with a dedicated/fixed sender phone number without restrictions (currently 100 SMS per hour, 1000 SMS per day but it could change in coming months). The legislation wants to force companies to send SMS using short numbers (3XXXX, usually random), numbers in 09 or with the name of the company as the sender. There is not yet a number in 09 dedicated to this subject and the providers therefore do not yet have any to rent.

It could be very practical that PAssist supports SMS sent with the name of the company as the sender : No more need of dedicated numbers and large choice of providers. I imagine that this would also require an evolution on the S2MSP side.

Do you think this would be possible?

Thanks!

frimtec commented 9 months ago

Hello @brenard I guess the problem is not fully clear to me yet ;-) Can these short alphanumeric numbers also be used to send a confirmation SMS back to the company? If yes, I guess S2MSP would not be impacted.

The main change would be in PAssist itself. The android contact application does not allow to use alphanumeric numbers as phone numbers. Somewhere it would be necessary to store the number of the company, maybe in an additional field of the contact or in PAssist itself.

If my first question can be answered with yes, I guess such a change is possible with a reasonable effort.

brenard commented 9 months ago

Hello @brenard I guess the problem is not fully clear to me yet ;-) Can these short alphanumeric numbers also be used to send a confirmation SMS back to the company? If yes, I guess S2MSP would not be impacted.

No, it's not possible to answer to this type of message (SMS apps disable the reply for this type of message).

The main change would be in PAssist itself. The android contact application does not allow to use alphanumeric numbers as phone numbers. Somewhere it would be necessary to store the number of the company, maybe in an additional field of the contact or in PAssist itself.

It's seem not possible to store this type of contact (SMS apps seem not offer this feature), so a field in PAssist to store the contact name would be great (or why not a regex for contacts name if it's not too complex).

If my first question can be answered with yes, I guess such a change is possible with a reasonable effort.

As explain, it's not possible to reply to this type of messages and I don't known what happen if you try. If you want, I can send you one of this type of SMS (just send me a phone in a private message).

frimtec commented 9 months ago

I guess the company field in the contact could be used to store this kind of company number.

Do you use PAssist already? Does your alerting system not require a confirmation reply? Our alerting system requires a confirmation reply, otherwise the alerting system escalates the alert further. In case of such a company number PAssist could just implicitly deactivate the sending of confirmation SMS. I guess that's all that can be done.

I can prepare a PR to support that. But for testing I would require some help from your side. Unfortunately I can not yet give you any promises until when I can implement that.

As a preparation it would be great to get such an SMS with a company number to my phone. I will send you my phone number in a private message.

brenard commented 9 months ago

I guess the company field in the contact could use to store this kind of company number.

If you fine a way, it's could be great.

Do you use PAssist already? Does your alerting system not require a confirmation reply? Our alerting system requires a confirmation reply, otherwise the alerting system escalates the alert further. In case of such a company number PAssist could just implicitly deactivate the sending of confirmation SMS. I guess that's all that can be done.

Yes, I use it since one year may be. Our alerting system does not require reply, we have to ack alerts directly by using its Web interface.

I can prepare a PR to support that. But for testing I would require some help from your side. Unfortunately I can not yet give you any promises until when I can implement that.

Of course! Say me if I could help you.

As a preparation it would be great to get such an SMS with a company number to my phone. I will send you my phone number in a private message.

Sent!

frimtec commented 9 months ago

I did some experiments. Looks all doable. In S2MSP some small changes are required as well. I opened a request their for myself (https://github.com/frimtec/secure-sms-proxy/issues/282). I hope to have a first release ready by end of this week.

brenard commented 9 months ago

I did some experiments. Looks all doable. In S2MSP some small changes are required as well. I opened a request their for myself (frimtec/secure-sms-proxy#282). I hope to have a first release ready by end of this week.

Awesome! Let me known if you need tests.

frimtec commented 9 months ago

The implementation is completed so far.

I was able to test alphanumeric short codes on the android-simulator. Therefore I'm quite confident that it should work also end to end on real devices. As there is a very little risk for regression issues I make a new full release shortly.

As soon as the new version 2.10.0 pops-up in Goole-Play or IzzyOnDroid, I would be very happy if you @brenard could make some tests with real alphanumeric short code SMS. The new PAssist version will ask to update S2MSP to version 3.2.1 which will be required when using the new feature of alphanumeric short code SMS numbers.

Looking forward to hear about your test results.

frimtec commented 9 months ago

The alphanumeric short code of your operations center contact can be configured as follows: Contacts-with-alphanumeric-short-codes In this example, the SMS numbers MON1 and MON2 would be monitored by PAssist. A combination of alphanumeric short codes and real phone numbers is possible as well.

brenard commented 9 months ago

The implementation is completed so far.

I was able to test alphanumeric short codes on the android-simulator. Therefore I'm quite confident that it should work also end to end on real devices. As there is a very little risk for regression issues I make a new full release shortly.

As soon as the new version 2.10.0 pops-up in Goole-Play or IzzyOnDroid, I would be very happy if you @brenard could make some tests with real alphanumeric short code SMS. The new PAssist version will ask to update S2MSP to version 3.2.1 which will be required when using the new feature of alphanumeric short code SMS numbers.

Looking forward to hear about your test results.

Of course, I will try! Many thanks!

brenard commented 9 months ago

After upgrading the 2 apps, I tried to configure Easter-eggs as the company name of my operations center contact and send sms with this name as sender but it's does not trigger PAssit. A test with a real phone number as sender still works great.

I noted that Easter-eggs does not appear with other numbers in S2MSP. It's normal?

I also try to reconfigure the operations center contact but it does not change anything.

Finally, I try to create a new contact with just Easter-eggs as the company name and configure it as operations center contact in Passist. It does not change anything and in the home page of Passist, I have an the error No valid number! under Operations center. Screenshot_2023-12-08-10-56-23-71_6ba589b35cca5ff8f234db69f4487e8f Screenshot_2023-12-08-10-56-02-98_2db2eb5db1f1f09ac9d1d1969c3e9706 If it could help, I join you my test contact as a VCF file. Test Ee.vcf.txt

If you want I can send you another real sms with this name as sender.

frimtec commented 9 months ago

1) Your right, at the moment at least one real number is still required. I will fix that. 2) If Easter-egg does not appear in the S2MSP UI then it won't work as the received SMS will not be transfered to PAssist.

Workaround for now: Can you try to combine a real number and Easter-egg in the same contact. Then PAssist should complain in the "SMS Adapter" state that a number is blocked. Press on it and accept the number in S2MSP. Now PAssist should also get SMS from Easter-egg.

Can you try this and let me know?

frimtec commented 9 months ago

My workaround from last comment does not work when I create a new contact. If I add Easter-eggs to an existing contact it works well. Strange, but at least I can reproduce it now => will find the issue with the debugger and fix it ;-)

brenard commented 9 months ago

My first try was with my existing contact with 3 real phone numbers : I just added the company name but it does not appear in S2MSP and SMS do not triggered passist. I also try to choose another contact in passist, removed the previous authorization in S2MSP, select back the contact in passist and add the authorization from passist home page in S2MSP, but it does not work and the organization name does not appear in S2MSP.

If you reproduce a problem, may be your fix will also solve my problem. Wait and see! Many thanks!

frimtec commented 9 months ago

Both problems 1 and 2 were related to an improper content resolver query not selecting the contacts company name for some contacts. The fix (https://github.com/frimtec/pikett-assist/commit/e8bcc8e8d8d6592046ce294c0a81b2818be0d017) is on the way with release 2.10.1.

brenard commented 9 months ago

With the latest release, all works great! I just noted one thing : when switching to a new contact, the phone numbers of the old contact are keeped as granted in S2MSP. It not really important, because a SMS sent by the old phone number does not trigger passist.

May be you could cleanup old granted phone numbers when configuring new ones.

Many thanks for this changes!

frimtec commented 9 months ago

With the latest release, all works great!

Thank you @brenard for your feedback. I'm happy that it works - at least in the second round 😉 If you are happy with PAssist, I would be very happy about new stars on the Github repo or even better about a positive review on Google-Play.

I just noted one thing : when switching to a new contact, the phone numbers of the old contact are keeped as granted in S2MSP. It not really important, because a SMS sent by the old phone number does not trigger passist.

The rational behind this intended behavior is, that in the view of PAssist the granting of numbers is only a burden. As you said, for the function of PAssist it has no impact if more than the used numbers are granted. The granting of numbers is a pure security feature of S2MSP. It gives the user the power to decide what app can communicate with what number (e.g. preventing that an app using S2MSP can see your bank access tokens received by SMS). Especially when switching between operations center more often in PAssist, it is a relief to not be forced to grant numbers over and over again. If you wanna cleanup the list once, the delete button in S2MSP can do the job.

brenard commented 9 months ago

I give you a star on Github, of course, but I installed PAssist from IzzyOnDroid so I guest I can't put a review on it on Google Play store.