void *private_info;
switch_thread_rwlock_t *rwlock;
+ int refs;
/* parent */
switch_loadable_module_interface_t *parent;
/*! function to deallocate the timer */
switch_status_t (*timer_destroy) (switch_timer_t *);
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_timer_interface *next;
};
/*! the function to read an extension and set a channels dialpan */
switch_dialplan_hunt_function_t hunt_function;
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_dialplan_interface *next;
};
/*! list of supported file extensions */
char **extens;
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_file_interface *next;
};
/*! an abstract representation of a file handle (some parameters based on compat with libsndfile) */
struct switch_file_handle {
/*! the interface of the module that implemented the current file type */
- const switch_file_interface_t *file_interface;
+ switch_file_interface_t *file_interface;
/*! flags to control behaviour */
uint32_t flags;
/*! a file descriptor if neceessary */
/*! function to read results from the ASR */
switch_status_t (*asr_get_results) (switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags);
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_asr_interface *next;
};
/*! an abstract representation of an asr speech interface. */
struct switch_asr_handle {
/*! the interface of the module that implemented the current speech interface */
- const switch_asr_interface_t *asr_interface;
+ switch_asr_interface_t *asr_interface;
/*! flags to control behaviour */
uint32_t flags;
/*! The Name */
void (*speech_numeric_param_tts) (switch_speech_handle_t *sh, char *param, int val);
void (*speech_float_param_tts) (switch_speech_handle_t *sh, char *param, double val);
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_speech_interface *next;
};
/*! an abstract representation of a asr/tts speech interface. */
struct switch_speech_handle {
/*! the interface of the module that implemented the current speech interface */
- const switch_speech_interface_t *speech_interface;
+ switch_speech_interface_t *speech_interface;
/*! flags to control behaviour */
uint32_t flags;
/*! The Name */
/*! function to pass down to the module */
switch_say_callback_t say_function;
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_say_interface *next;
};
/*! function to open the directory interface */
switch_status_t (*chat_send) (char *proto, char *from, char *to, char *subject, char *body, char *hint);
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_chat_interface *next;
};
/*! function to open the directory interface */
switch_status_t (*management_function) (char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen);
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_management_interface *next;
};
/*! function to advance to the next name/value pair in the current record */
switch_status_t (*directory_next_pair) (switch_directory_handle_t *dh, char **var, char **val);
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_directory_interface *next;
};
/*! an abstract representation of a directory interface. */
struct switch_directory_handle {
/*! the interface of the module that implemented the current directory interface */
- const switch_directory_interface_t *directory_interface;
+ switch_directory_interface_t *directory_interface;
/*! flags to control behaviour */
uint32_t flags;
/*! an abstract handle to a codec module */
struct switch_codec {
/*! the codec interface table this handle uses */
- const switch_codec_interface_t *codec_interface;
+ switch_codec_interface_t *codec_interface;
/*! the specific implementation of the above codec */
const switch_codec_implementation_t *implementation;
/*! fmtp line from remote sdp */
switch_codec_implementation_t *implementations;
uint32_t codec_id;
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_codec_interface *next;
};
/*! flags to control behaviour */
uint32_t flags;
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_application_interface *next;
};
/*! an example of the api syntax */
const char *syntax;
switch_thread_rwlock_t *rwlock;
+ int refs;
switch_loadable_module_interface_t *parent;
struct switch_api_interface *next;
};
-#define PROTECT_INTERFACE(_it) switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock)
-#define UNPROTECT_INTERFACE(_it) switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it = NULL
+#define PROTECT_INTERFACE(_it) if (!_it->refs) {switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); _it->refs++; _it->parent->refs++;}
+#define UNPROTECT_INTERFACE(_it) if (_it->refs) {switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it->refs--; _it->parent->refs--; _it = NULL;}
SWITCH_END_EXTERN_C
#endif
{
switch_memory_pool_t *pool;
switch_event_t *event;
- const switch_endpoint_interface_t *endpoint_interface = (*session)->endpoint_interface;
+ switch_endpoint_interface_t *endpoint_interface = (*session)->endpoint_interface;
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(const switch_endpoint_interface_t
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_endpoint_interface_t
*endpoint_interface, switch_memory_pool_t **pool, const char *use_uuid)
{
switch_memory_pool_t *usepool;
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(const char *endpoint_name, switch_memory_pool_t **pool)
{
- const switch_endpoint_interface_t *endpoint_interface, *e;
+ switch_endpoint_interface_t *endpoint_interface;
if ((endpoint_interface = switch_loadable_module_get_endpoint_interface(endpoint_name)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not locate channel type %s\n", endpoint_name);
return NULL;
}
- e = endpoint_interface;
- UNPROTECT_INTERFACE(e);
+
return switch_core_session_request(endpoint_interface, pool);
}
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(switch_core_session_t *session, const char *app, const char *arg)
{
- const switch_application_interface_t *application_interface;
+ switch_application_interface_t *application_interface;
char *expanded = NULL;
const char *var;