You are here

function sms_simplegateway_receive_message in SMS simple gateway 6

Same name and namespace in other branches
  1. 7 sms_simplegateway.module \sms_simplegateway_receive_message()

Receive an SMS message and pass it into the SMS Framework

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

File

./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);
}