You are here

function sms_handle_result in SMS Framework 7

Same name and namespace in other branches
  1. 5 sms.module \sms_handle_result()
  2. 6.2 sms.module \sms_handle_result()
  3. 6 sms.module \sms_handle_result()

Handles the response back from the sms gateway.

This method also logs an error message to watchdog if there was a failure.

Parameters

array $result: An array containing information on the message response, with the keys:

  • status: true if it was successful, false otherwise.
  • message: an error message if the 'status' is false.

string $number: The comma-separated list of the message's recipient numbers.

string $message: The message that was sent.

Return value

bool true if the message was sent to the server, false otherwise.

1 call to sms_handle_result()
sms_send in ./sms.module
Sends a message using the active gateway.

File

./sms.module, line 241
The core of the SMS Framework. Provides gateway management and API for sending and receiving SMS messages.

Code

function sms_handle_result($result, $number, $message) {
  if ($result['status']) {
    return TRUE;
  }
  else {
    $error_message = 'Sending SMS to %number failed.';
    $variables['%number'] = $number;
    if ($result['message']) {
      $error_message .= ' The gateway said ' . $result['message'];
      if (!empty($result['variables'])) {
        $variables = array_merge($variables, $result['variables']);
      }
    }
    watchdog('sms', $error_message, $variables, WATCHDOG_ERROR);
    return FALSE;
  }
}