function sms_devel_virtualgw_send in SMS Framework 6.2
Same name and namespace in other branches
- 6 modules/sms_devel/sms_devel.virtualgw.inc \sms_devel_virtualgw_send()
- 7 modules/sms_devel/sms_devel.virtualgw.inc \sms_devel_virtualgw_send()
Callback for sending messages.
Options for this send function: gw_number - The sender of the message. MSISDN or text string. Min=3, max=11 chars. reference - Message reference tag (to appear on any receipt).
Parameters
$number: MSISDN of message recipient. Expected to include the country code prefix.
$message: Message body text.
$options: Options array from SMS Framework.
Return value
Gateway response array.
1 string reference to 'sms_devel_virtualgw_send'
- sms_devel_gateway_info in modules/
sms_devel/ sms_devel.module - Implement hook_gateway_info()
File
- modules/
sms_devel/ sms_devel.virtualgw.inc, line 38 - Virtual Gateway for the sms_devel module of the SMS Framework.
Code
function sms_devel_virtualgw_send($number, $message, $options) {
// Set a default sender if it is not specified
if (!array_key_exists('gw_number', $options)) {
$options['gw_number'] = '99999';
}
// Set a default reference if it is not specified
if (!array_key_exists('reference', $options)) {
$options['reference'] = md5($number . $message);
}
// Write log record for outgoing message
sms_devel_virtualgw_log_insert(SMS_DEVEL_VIRTUALGW_TYPE_OUT, $number, $message, $options);
// Invoke additional virtual gateway features eg: autoreplies, receipts.
sms_devel_virtualgw_sendlogic($number, $message, $options);
// Always return success
return array(
'status' => TRUE,
'status_code' => SMS_GW_OK,
'gateway_status_code' => 'OK',
'gateway_status_text' => 'sms_devel_virtualgw: send: OK',
);
}