switch_event_add_header_string(jsock->user_vars, SWITCH_STACK_BOTTOM, var, val);
switch_mutex_unlock(jsock->flag_mutex);
+ switch_clear_flag(jsock, JPFLAG_AUTH_EXPIRED);
+
if (!strcmp(var, "login-expires")) {
uint32_t tmp = atol(val);
}
if (tech_pvt->detach_time && (now - tech_pvt->detach_time) > verto_globals.detach_timeout) {
- switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
+ jsock_t *jsock = NULL;
+
+ if ((jsock = get_jsock(tech_pvt->jsock_uuid))) {
+ if (switch_test_flag(jsock, JPFLAG_AUTH_EXPIRED)) {
+ switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTAUTH);
+ }
+ switch_thread_rwlock_unlock(jsock->rwlock);
+ } else {
+ switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
+ }
}
}
switch_thread_rwlock_unlock(verto_globals.tech_rwlock);
now = switch_epoch_time_now(NULL);
if (now >= jsock->exptime) {
+ switch_set_flag(jsock, JPFLAG_AUTH_EXPIRED);
die("%s Authentication Expired\n", jsock->uid);
}
cJSON *params = NULL;
cJSON *msg = jrpc_new_req("verto.ping", 0, ¶ms);
+ if (jsock->exptime) {
+ cJSON_AddItemToObject(params, "auth-expires", cJSON_CreateNumber(jsock->exptime));
+ }
+
cJSON_AddItemToObject(params, "serno", cJSON_CreateNumber(switch_epoch_time_now(NULL)));
jsock_queue_event(jsock, &msg, SWITCH_TRUE);
idle = 0;
static switch_bool_t verto__ping_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response)
{
*response = cJSON_CreateObject();
+
+ if (jsock->exptime) {
+ cJSON_AddItemToObject(*response, "auth-expires", cJSON_CreateNumber(jsock->exptime));
+ }
+
cJSON_AddItemToObject(*response, "message", cJSON_CreateString("PONG"));
return SWITCH_TRUE;
}