You are here

function sms_send in SMS Framework 6

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

Sends a message using the active gateway.

Parameters

$number: The destination number.

$message: The text of the messsage to send.

$options: An array of dditional properties as defined by gateway modules.

5 calls to sms_send()
sms_actions_send_action in modules/sms_actions/sms_actions.module
Implementation of a Drupal action.
sms_sendtophone_form_submit in modules/sms_sendtophone/sms_sendtophone.module
sms_send_form_submit in ./sms.module
Send form submission.
sms_user_send in modules/sms_user/sms_user.module
Send a message to a user.
sms_user_send_confirmation in modules/sms_user/sms_user.module

File

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

Code

function sms_send($number, $message, $options = array()) {
  $gateway = sms_default_gateway();

  // Pre process hook
  // Call any modules that implement hook_sms_send()
  // We do not use module_invoke_all() because we lose the ability to
  //   manipulate the variables passed to the function, eg $message.
  foreach (module_implements('sms_send') as $module) {
    $function = $module . '_sms_send';
    $function($number, $message, $options, $gateway);
  }

  // Send message via active gateway
  $response = NULL;
  if (function_exists($gateway['send'])) {
    $response = $gateway['send']($number, $message, $options);
  }
  $result = sms_handle_result($response, $number, $message, $gateway, $options);

  // Post process hook
  foreach (module_implements('sms_send_process') as $module) {
    $function = $module . '_sms_send_process';
    $function('post process', $number, $message, $options, $gateway, $result);
  }
  return $result;
}