kalkun-sms/Kalkun

Phone format check error with 3 comma separated numbers

Closed this issue · 4 comments

Describe the bug
When sending sms manually ("input manually") to 3 or more spanish numbers (format 600000000 or +34600000000) separated by commas this error happens: "The string supplied did not seem to be a phone number."

To Reproduce
Steps to reproduce the behavior:

  1. Go to kalkun main page.
  2. Click on "compose".
  3. Select "input manually"
  4. Write in the input box 3 or more spanish numbers (e.g. "+34600000000, +34600000000, +34600000000")
  5. Red error message: "The string supplied did not seem to be a phone number."

Expected behavior
You should be able to send messages to 3 or more spanish numbers.

Screenshots
Captura desde 2022-10-12 11-42-02

Browser, kalkun setup, database setup..:

  • Kalkun version: 0.8.0-rc-1 [Lang: spanish] [CountryCode: ES]
  • Operating system: Linux kalkunpod 5.14.0-70.26.1.el9_0.x86_64 #1 SMP PREEMPT Tue Sep 20 17:53:31 UTC 2022 x86_64
  • PHP Version: 8.0.24
  • DB Backend: MySQLi 10.9.3-MariaDB-1:10.9.3+maria~ubu2204 (mysqli)
  • Gammu version: Gammu 1.42.0, Linux, kernel 5.14.0-70.26.1.el9_0.x86_64 (#1 SMP PREEMPT Tue Sep 20 17:53:31 UTC 2022), GCC 11.2
  • Gammu DB schema: 17
  • Browser: Chrome 106.0.0.0
  • Plugins: ``

Additional context
Error happens at /application/helpers/kalkun_helper.php, line 448. It seems related to kalkun's implementation of \libphonenumber being unable to recognised the string as three valid phone numbers.
I was able to bypass this issue by running this commands through my dockerfile & it worked, albeit it did not check the phonenumber format obviously:

RUN /bin/busybox sed -i "s|tr(\'Please specify a valid mobile phone number\')|TRUE|g" /var/www/application/helpers/kalkun_helper.php \  
&& /bin/busybox sed -i "s|\$e->getMessage()|TRUE|g" /var/www/application/helpers/kalkun_helper.php

Precisely that use case is indeed not supported. You must enter in single number when using the "Input manually" option. The value you enter for the phonenumber is checked as is by libphonenumber-for-php.

For your use case you may:

  • input manually one contact, and then click the "send and repeat" button. The compose box remains open, you then just have to enter the subsequent phone number
  • select "Phonebook" which permits to have multiple recepients, provided you added them to the phonebook for a single "send" action
  • select "import from file" = the https://github.com/kalkun-sms/Kalkun/wiki/SMS-merge feature

May you please check if the last commit (1e17455) on https://github.com/kalkun-sms/Kalkun/tree/fix-478

  • fixes your issue
  • doesn't bring a regression

Works great, thanks for the fix!

Reopen, until this is pushed to devel (after 0.8.0 release).