You are here

function sms_devel_virtualgw_sendlogic in SMS Framework 6.2

Same name and namespace in other branches
  1. 6 modules/sms_devel/sms_devel.virtualgw.inc \sms_devel_virtualgw_sendlogic()
  2. 7 modules/sms_devel/sms_devel.virtualgw.inc \sms_devel_virtualgw_sendlogic()
1 call to sms_devel_virtualgw_sendlogic()
sms_devel_virtualgw_send in modules/sms_devel/sms_devel.virtualgw.inc
Callback for sending messages.

File

modules/sms_devel/sms_devel.virtualgw.inc, line 91
Virtual Gateway for the sms_devel module of the SMS Framework.

Code

function sms_devel_virtualgw_sendlogic($number, $message, $options) {
  $autoreply_enabled = variable_get('sms_devel_virtualgw_autoreply_enabled', FALSE);
  $autoreply_format = variable_get('sms_devel_virtualgw_autoreply_format', '');
  $receipts_enabled = variable_get('sms_devel_virtualgw_receipts_enabled', FALSE);
  if ($autoreply_enabled) {

    // TODO Figure out the tokens logic

    //$echo_message = $autoreply_format . $message;
    $echo_message = 'echo: ' . $message;

    // Swap the numbers for the echo
    $echo_number = $options['gw_number'];
    $echo_options = array(
      'gw_number' => $number,
    );

    // Echo
    sms_devel_virtualgw_receiver($echo_number, $echo_message, $echo_options);
  }
  if ($receipts_enabled) {

    // Trigger a message delivery receipt
    $status = SMS_MSG_STATUS_DELIVERED;
    $reference = $options['reference'];
    $options['gateway_message_status'] = 'DELIVERED';
    $options['gateway_message_status_text'] = 'Message delivered OK';
    sms_receipt($number, $reference, $status, $options);
  }
}