You are here

function sms_clickatell_get_session_id in SMS Framework 6

Same name and namespace in other branches
  1. 5 modules/sms_clickatell/sms_clickatell.module \sms_clickatell_get_session_id()

Get a new or existing Clickatell session ID

Return value

Clickatell session ID

1 call to sms_clickatell_get_session_id()
sms_clickatell_command in modules/sms_clickatell/sms_clickatell.module
Executes a command using the Clickatell API

File

modules/sms_clickatell/sms_clickatell.module, line 368
Clickatell gateway module for Drupal SMS Framework. Outbound+Inbound+Receipts

Code

function sms_clickatell_get_session_id() {
  if (variable_get('sms_clickatell_session_id_timestamp', 0) < strtotime('-10 mins')) {
    if ($result = sms_clickatell_command()) {
      if ($result['status']) {
        variable_set('sms_clickatell_session_id', $result['sid']);
        variable_set('sms_clickatell_session_id_timestamp', time());
        watchdog('sms', 'Clickatell session ID refreshed: %sid', array(
          '%sid' => $result['sid'],
        ));
      }
    }
  }
  return variable_get('sms_clickatell_session_id', 0);
}