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.

Comments

aspope’s picture

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.

aspope’s picture

Assigned: Unassigned » aspope

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

Will White’s picture

Priority: Critical » Normal
Issue tags: +international

Tagging.

frazras’s picture

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?

univate’s picture

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.

asciikewl’s picture

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));
 }
univate’s picture

Project: SMS Framework » Clickatell for SMS Framework
Version: 6.x-1.0-beta1 » 6.x-1.0
Component: Clickatell » Code
dpi’s picture

Issue summary: View changes
Status: Active » Closed (outdated)