function sms_devel_virtualgw_send in SMS Framework 7
Same name and namespace in other branches
- 6.2 modules/sms_devel/sms_devel.virtualgw.inc \sms_devel_virtualgw_send()
- 6 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
string $number: MSISDN of message recipient. Should include the country code prefix.
string $message: Message body text.
array $options: Options array from SMS Framework.
Return value
array Gateway response array with the following keys:
- status: true (successful) or false (failed).
- status_code: standardized sms gateway status codes.
- gateway_status_code: gateway-specific status code.
- gateway_status_text: text describing the gateway-specific status code.
2 string references to 'sms_devel_virtualgw_send'
- sms_devel_gateway_info in modules/
sms_devel/ sms_devel.module - Implements hook_gateway_info().
- sms_devel_virtualgw_form in modules/
sms_devel/ sms_devel.virtualgw.admin.inc - Form constructor for the virtual gateway configuration.
File
- modules/
sms_devel/ sms_devel.virtualgw.inc, line 42 - 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',
);
}