You are here

function sms_clickatell_get_session_id in SMS Framework 5

Same name and namespace in other branches
  1. 6 modules/sms_clickatell/sms_clickatell.module \sms_clickatell_get_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 157
Adds support for sending SMS messages using the Clickatell gateway.

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', t('Clickatell session ID refreshed: %sid', array(
          '%sid' => $result['sid'],
        )));
      }
    }
  }
  return variable_get('sms_clickatell_session_id', 0);
}