You are here

function sms_simplegateway_receive_message in SMS Framework 6

Receive an SMS message and pass it into the SMS Framework

1 string reference to 'sms_simplegateway_receive_message'
sms_simplegateway_menu in modules/sms_simplegateway/sms_simplegateway.module
Implement hook_menu()

File

modules/sms_simplegateway/sms_simplegateway.module, line 278
Simple gateway module for Drupal SMS Framework. Outbound+Inbound

Code

function sms_simplegateway_receive_message() {

  // Get config
  $gateway = sms_gateways('gateway', 'simplegateway');
  $config = $gateway['configuration'];
  $number_field = $config['sms_simplegateway_recv_number_field'];
  $gwnumber_field = $config['sms_simplegateway_recv_gwnumber_field'];
  $message_field = $config['sms_simplegateway_recv_message_field'];
  $number = $_REQUEST[$number_field];
  $message = $_REQUEST[$message_field];
  $options = array();

  // Define raw gateway response parameters
  $options['gateway_params'] = array();

  // Define message receiver if possible
  if (array_key_exists($gwnumber_field, $_REQUEST) && !empty($_REQUEST[$gwnumber_field])) {
    $options['receiver'] = $_REQUEST[$gwnumber_field];
  }
  sms_incoming($number, $message, $options);
}