You are here

function nexmo_receive_receipt in Nexmo SMS Gateway 7

Receive a message send receipt from Nexmo.

1 string reference to 'nexmo_receive_receipt'
nexmo_menu in ./nexmo.module
Implements hook_menu().

File

./nexmo.module, line 161
Provides NEXMO implementation methods.

Code

function nexmo_receive_receipt() {
  $number = $_REQUEST['msisdn'];
  $gateway_status = $_REQUEST['status'];
  $reference = array_key_exists('messageId', $_REQUEST) ? $_REQUEST['messageId'] : NULL;
  $options = array();
  $options['reference'] = $reference;
  if (array_key_exists('to', $_REQUEST) && !empty($_REQUEST['to'])) {
    $options['receiver'] = $_REQUEST['to'];
  }
  if (array_key_exists('network-code', $_REQUEST) && !empty($_REQUEST['network-code'])) {
    $options['network-code'] = $_REQUEST['network-code'];
  }
  if (array_key_exists('price', $_REQUEST) && !empty($_REQUEST['price'])) {
    $options['price'] = $_REQUEST['price'];
  }
  if (array_key_exists('messageId', $_REQUEST) && !empty($_REQUEST['messageId'])) {
    $options['messageId'] = $_REQUEST['messageId'];
  }
  sms_receipt($number, $reference, $gateway_status, $options);
  print "response 200 OK";
}