function sms_send in SMS Framework 7
Same name and namespace in other branches
- 5 sms.module \sms_send()
- 6.2 sms.module \sms_send()
- 6 sms.module \sms_send()
Sends a message using the active gateway.
Parameters
string $number: The destination number.
string $message: The text of the messsage to send.
array $options: An array of additional properties as defined by gateway modules.
Return value
bool true if the message was sent to the server, false otherwise.
See also
7 calls to sms_send()
- SmsFrameworkWebTest::testSendSms in tests/
sms.module.test - Tests the sending of messages.
- sms_actions_send_action in modules/
sms_actions/ sms_actions.module - Implements the action sms_action_send_action.
- sms_rules_action_sms_send in ./
sms.rules.inc - Action Implementation: Send sms.
- sms_sendtophone_form_submit in modules/
sms_sendtophone/ sms_sendtophone.module - Submit handler for sms_sendtophone_form().
- sms_send_form_submit in ./
sms.module - Form submission handler for sms_send_form().
1 string reference to 'sms_send'
- SmsContainsKeywordConditionTestCase::testSmsContainsKeywordCondition in tests/
sms.rules.test - Tests whether the sms rules condition for sms contains keyword works as it is supposed to.
File
- ./
sms.module, line 191 - The core of the SMS Framework. Provides gateway management and API for sending and receiving SMS messages.
Code
function sms_send($number, $message, $options = array()) {
// Check if preferred gateway is specified in the $options.
if (isset($options['gateway'])) {
$gateway = sms_gateways('gateway', $options['gateway']);
}
if (empty($gateway)) {
$gateway = sms_default_gateway();
}
foreach (module_implements('sms_send') as $module) {
$function = $module . '_sms_send';
$function($number, $message, $options, $gateway);
}
if (module_exists('token')) {
$message = token_replace($message);
}
$response = NULL;
if (isset($gateway['send']) && function_exists($gateway['send'])) {
$response = $gateway['send']($number, $message, $options);
}
$result = sms_handle_result($response, $number, $message);
// 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;
}