switch_thread_rwlock_unlock(globals.tech_rwlock);
}
+switch_endpoint_interface_t *verto_endpoint_interface = NULL;
+
+static switch_status_t verto_on_destroy(switch_core_session_t *session)
+{
+ UNPROTECT_INTERFACE(verto_endpoint_interface);
+ return SWITCH_STATUS_SUCCESS;
+}
static switch_status_t verto_on_hangup(switch_core_session_t *session)
{
/*.on_reset */ NULL,
/*.on_park */ NULL,
/*.on_reporting */ NULL,
- /*.on_destroy */ NULL,
+ /*.on_destroy */ verto_on_destroy,
SSH_FLAG_STICKY
};
const char *profile_name = NULL, *jsock_uuid_str = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
+ PROTECT_INTERFACE(verto_endpoint_interface);
profile_name = switch_channel_get_variable(channel, "verto_profile_name");
jsock_uuid_str = switch_channel_get_variable(channel, "jsock_uuid_str");
if (!(profile_name && jsock_uuid_str && (profile = find_profile(profile_name)))) {
+ UNPROTECT_INTERFACE(verto_endpoint_interface);
return 0;
}
}
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_uuid", call_id);
+
+ PROTECT_INTERFACE(verto_endpoint_interface);
if ((reason = switch_core_session_outgoing_channel(NULL, var_event, "rtc",
NULL, &session, NULL, SOF_NONE, &cancel_cause)) != SWITCH_CAUSE_SUCCESS) {
cJSON_AddItemToObject(obj, "message", cJSON_CreateString("Cannot create channel"));
return SWITCH_TRUE;
}
+ UNPROTECT_INTERFACE(verto_endpoint_interface);
+
if (session) {
switch_core_session_destroy(&session);
}
//// ENDPOINT
-switch_endpoint_interface_t *verto_endpoint_interface;
+
static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session,
switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_call_cause_t cause = SWITCH_CAUSE_CHANNEL_UNACCEPTABLE;
char *dest = NULL;
+ PROTECT_INTERFACE(verto_endpoint_interface);
+
if (!zstr(outbound_profile->destination_number)) {
dest = strdup(outbound_profile->destination_number);
}
end:
+ if (cause != SWITCH_CAUSE_SUCCESS) {
+ UNPROTECT_INTERFACE(verto_endpoint_interface);
+ }
+
switch_safe_free(dest);
return cause;