Clickatell areacode bug

frazras - April 2, 2009 - 14:19
Project:SMS Framework
Version:6.x-1.0-beta1
Component:Clickatell
Category:bug report
Priority:normal
Assigned:aspope
Status:active
Issue tags:international
Description

I use clickatell from JAMAICA where the area code is 1876. Clickatell appends the area code to the number to be sent so I end up sending messages to 18761876#######. What I find is that my clients either enter 876#######, 1876####### or even just their 7 digit number ####### that creates a mess.I hacked around in the code to modify validation to accept only 7-digit numbers but its all messy and it prevents support for other countries.
I believe the behaviour is different with email gateway because I faintly remember it working for me. Could anyone confirm this as a bug or suggest a work around.

#1

aspope - April 23, 2009 - 09:33

An updated Clickatell module is currently under review. In this module I have removed the line that appends the country code to the phone number, and left the country-code select field only for reference.

You can get the updated module from here (http://drupal.org/node/441650) but please be aware that the module has not yet been approved by the group.

#2

aspope - April 23, 2009 - 12:20
Assigned to:Anonymous» aspope

I'll assign this ticket to myself for now, and will close once the updated Clickatell module has been approved.

#3

Will White - May 13, 2009 - 19:44
Priority:critical» normal

Tagging.

#4

frazras - September 23, 2009 - 21:46

Hey Will, has hope for an international module died? I see there has been no commits to this module for a while. We in international still have problems with SMSframework. Will there be any hope in the near future?

#5

univate - November 9, 2009 - 06:16

Can't a check just be done on the number the user has entered and if the number is not already prefixed by the areacode, then append it.

#6

asciikewl - November 10, 2009 - 07:46

Here is the patch I've made for this, it takes care of leading zeros and not duplicating the country code. It will fail if someone enters a number that doesn't start with a 0 that starts with the same numbers as the country code.

--- sms_clickatell.module.orig  2009-07-09 15:58:59.000000000 +0200
+++ sms_clickatell.module       2009-11-10 09:43:34.000000000 +0200
@@ -91,7 +99,9 @@
  * Callback for sending messages.
  */
function sms_clickatell_send($number, $message, $options) {
-  $number = $options['country'] . $number;
+  if (!preg_match('/^'.$options['country'].'.*/',$number)) {
+    $number = $options['country'] . ltrim($number,0);
+  }
   return sms_clickatell_command('sendmsg', array('number' => $number, 'message' => $message));
}

 
 

Drupal is a registered trademark of Dries Buytaert.