You are here

function sms_devel_virtualgw_receiver in SMS Framework 7

Same name and namespace in other branches
  1. 6.2 modules/sms_devel/sms_devel.virtualgw.inc \sms_devel_virtualgw_receiver()
  2. 6 modules/sms_devel/sms_devel.virtualgw.inc \sms_devel_virtualgw_receiver()

Handles incoming messages.

Parameters

string $number: The sender numbers.

string $message: The message received.

array $options: Array of options.

1 call to sms_devel_virtualgw_receiver()
sms_devel_virtualgw_sendlogic in modules/sms_devel/sms_devel.virtualgw.inc
Invokes additional virtual gateway features eg: autoreplies, receipts.
1 string reference to 'sms_devel_virtualgw_receiver'
sms_devel_menu in modules/sms_devel/sms_devel.module
Implements hook_menu().

File

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

Code

function sms_devel_virtualgw_receiver($number = NULL, $message = NULL, $options = array()) {

  // Handle HTTP requests rather than direct function calls
  if ($number === NULL) {
    $number = $_REQUEST['number'];
    $message = array_key_exists('message', $_REQUEST) ? $_REQUEST['message'] : 'NO_MESSAGE';
    $options['gw_number'] = array_key_exists('gw_number', $_REQUEST) ? $_REQUEST['gw_number'] : 'NO_GW_NUMBER';
    $options['reference'] = array_key_exists('reference', $_REQUEST) ? $_REQUEST['reference'] : 'NO_REFERENCE';
  }

  // Write log record for incoming message
  sms_devel_virtualgw_log_insert(SMS_DEVEL_VIRTUALGW_TYPE_IN, $number, $message, $options);

  // Call SMS Framework incoming message handler
  sms_incoming($number, $message, $options);
}