Continued from the discussion at http://drupal.org/node/532006.

When a user enters their mobile number, the leading zero is not stripped off.

At confirmation time, if I enter 012 234 456, and select the country, it fails. If I enter 12 234 456 and enter the country code, a confirmation SMS is sent fine and all is well.

Notifications do not work though for confirmed numbers. The country code is not being added to the outgoing number and a 114 error is returned from Clickatell.

As I write this, I'm wondering if it's because the user's country setting is not being stored anywhere, so it is lost after the initial confirmation process? I'll have a look at that in the next couple of days.

Cheers

Glenn

Comments

glennnz’s picture

After a very quick test, that is exactly what is happening. For a notification, the country code is not being added.

The error then is in line 94 off sms_clickatell.module:

  $number = $options['country'] . $number;

$options['country'] is not working.

Glenn

halfiranian’s picture

Wow - good spot. That was causing me a lot of trouble.

Is there a patch?

glennnz’s picture

Priority: Normal » Critical

Not yet... :-(

I've fiddled with the code, but can't get it working.

I've run out of ideas. It seems like this module is not being actively maintained, can anyone shed light on this?

N1029676’s picture

Version: 6.x-1.0 » 6.x-2.x-dev
Component: Clickatell » Core Framework

I've kinda been going crazy trying to figure this out.

I have the verification code sent out correctly as well as the SMS Blast. But any other module that tries to send out an SMS message (Even the testing module) results in an error, or gives an ok but the number receives nothing.

I've been having this issue on all versions of the Framework.

I'm not sure where these errors are logged, but it is not in the watchdog area of Drupal.

glennnz’s picture

Have you figured out a fix?

espenmoe’s picture

I have all my users from the same country. Would it be possible to tweak sms_clickatell.module to automatically add the norwegian country code - 47?

  $number = $options['country'] . $number;
budda’s picture

Also suffering form the same problem with a new SMS gateway I've written.

The users country code is saved under the 'gateway' data.
I'll have a play and report back the fix, if any.

budda’s picture

Hmm, in the hook_send() it would appear as if the $options argument passed in should contain information about the country.
For example:

<?php
function sms_clickatell_send($number, $message, $options) {
  $number = $options['country'] . $number;
  return sms_clickatell_command('sendmsg', array('number' => $number, 'message' => $message));
}
?>

In my debug tests $options is coming through empty every time.

NROTC_Webmaster’s picture

I've run across a very similar issue. I'm using the sms - email gateway and it appears that the number is stored but it is not recalling the users carrier. I have tried to manually do this but I have a limited working knowledge of php and I cannot for the life of me get it to work. If anyone has found a way to resolve this that would be a true blessing. The simplest way I see for this to work is instead of it storing country codes and gateways separate from the number is to have them all stored in the same variable. This would pose problems in the future if the admin changes the gateway but it would seem to resolve other issues with the database.

Please let me know if anyone has found a solution.

budda’s picture

Yes you could hack the module and replace the line you identified with:

  $number = '47' . $number;

This is assuming your $number stored for each user doesn't start with the 0 -- otherwise you will need to remove that first. ltrim() should do it if needed.

budda’s picture

The problem for me was in the messaging_sms module (part of the messaging project).

I fixed it with a one-liner - see http://drupal.org/node/337518#comment-3896748

dpi’s picture

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