提交 cc351ca0 authored 作者: Anthony Minessale's avatar Anthony Minessale

revert

上级 42bf44de
......@@ -98,7 +98,8 @@ typedef enum {
SSF_READ_TRANSCODE = (1 << 5),
SSF_WRITE_TRANSCODE = (1 << 6),
SSF_READ_CODEC_RESET = (1 << 7),
SSF_WRITE_CODEC_RESET = (1 << 8)
SSF_WRITE_CODEC_RESET = (1 << 8),
SSF_DESTROYABLE = (1 << 9)
} switch_session_flag_t;
......
BASE=../../../..
LOCAL_INSERT_CFLAGS= pkg-config opal --cflags
LOCAL_CFLAGS+=-g -ggdb -I.
LOCAL_INSERT_LDFLAGS= pkg-config opal --libs
PKG_DIR:=/usr/local/lib/pkgconfig
ifeq ($(PKG_CONFIG_PATH),)
export PKG_CONFIG_PATH:=$(PKG_DIR)
else
ifeq ($(findstring $(PKG_DIR),$(PKG_CONFIG_PATH)),)
export PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH):$(PKG_DIR)
endif
endif
#DEBUG_SUFFIX:=--define-variable=suffix=_d
LOCAL_INSERT_CFLAGS= pkg-config opal $(DEBUG_SUFFIX) --cflags
LOCAL_CFLAGS+=-g -ggdb
LOCAL_INSERT_LDFLAGS= pkg-config opal $(DEBUG_SUFFIX) --libs
include $(BASE)/build/modmake.rules
......
......@@ -429,6 +429,10 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
gateway_ptr = sofia_reg_find_gateway(gateway_name);
}
if (!tech_pvt) {
return SWITCH_STATUS_SUCCESS;
}
switch_mutex_lock(tech_pvt->sofia_mutex);
rec = sofia_test_flag(tech_pvt, TFLAG_RECOVERING);
......
......@@ -154,6 +154,7 @@ typedef struct sofia_dispatch_event_s {
int save;
switch_core_session_t *session;
switch_memory_pool_t *pool;
struct sofia_dispatch_event_s *next;
} sofia_dispatch_event_t;
struct sofia_private {
......@@ -166,6 +167,7 @@ struct sofia_private {
int is_call;
int is_static;
sofia_dispatch_event_t *de;
sofia_dispatch_event_t *deq;
};
#define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);}
......
......@@ -969,18 +969,25 @@ static void our_sofia_event_callback(nua_event_t event,
int locked = 0;
int check_destroy = 1;
if (sofia_private && sofia_private->is_call && sofia_private->de) {
sofia_dispatch_event_t *qde = sofia_private->de;
sofia_private->de = NULL;
if (sofia_private && sofia_private->is_call) {
sofia_dispatch_event_t *qde = NULL;
if (event == nua_i_cancel) {
nua_destroy_event(qde->event);
su_free(nh->nh_home, qde);
} else {
switch_mutex_lock(profile->flag_mutex);
if (sofia_private->de) {
qde = sofia_private->de;
sofia_private->de = NULL;
}
switch_mutex_unlock(profile->flag_mutex);
if (qde) {
sofia_process_dispatch_event(&qde);
}
}
if (sofia_private && (sofia_private->destroy_me == 12)) {
return;
}
profile->last_sip_event = switch_time_now();
/* sofia_private will be == &mod_sofia_globals.keep_private whenever a request is done with a new handle that has to be
......@@ -1525,22 +1532,51 @@ void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep)
void sofia_process_dispatch_event(sofia_dispatch_event_t **dep)
{
sofia_dispatch_event_t *de = *dep;
sofia_dispatch_event_t *de = *dep, *deq = NULL;
nua_handle_t *nh = de->nh;
nua_t *nua = de->nua;
sofia_profile_t *profile = de->profile;
sofia_private_t *sofia_private = nua_handle_magic(de->nh);
*dep = NULL;
our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile,
de->nh, nua_handle_magic(de->nh), de->sip, de, (tagi_t *) de->data->e_tags);
de->nh, sofia_private, de->sip, de, (tagi_t *) de->data->e_tags);
nua_destroy_event(de->event);
su_free(nh->nh_home, de);
switch_mutex_lock(profile->flag_mutex);
profile->queued_events--;
if (sofia_private && sofia_private->is_call && sofia_private->deq) {
deq = sofia_private->deq;
sofia_private->deq = NULL;
}
switch_mutex_unlock(profile->flag_mutex);
if (deq) {
for (;;) {
switch_mutex_lock(profile->flag_mutex);
if ((de = deq)) {
deq = deq->next;
de->next = NULL;
}
switch_mutex_unlock(profile->flag_mutex);
if (!de) {
break;
}
our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile,
de->nh, sofia_private, de->sip, de, (tagi_t *) de->data->e_tags);
nua_destroy_event(de->event);
su_free(nh->nh_home, de);
nua_handle_unref(nh);
nua_stack_unref(nua);
}
}
nua_handle_unref(nh);
nua_stack_unref(nua);
......@@ -1684,8 +1720,6 @@ void sofia_event_callback(nua_event_t event,
return;
}
switch_mutex_lock(profile->flag_mutex);
profile->queued_events++;
switch_mutex_unlock(profile->flag_mutex);
......@@ -1707,7 +1741,9 @@ void sofia_event_callback(nua_event_t event,
memset(sofia_private, 0, sizeof(*sofia_private));
sofia_private->is_call++;
sofia_private->is_static++;
switch_mutex_lock(profile->flag_mutex);
sofia_private->de = de;
switch_mutex_unlock(profile->flag_mutex);
nua_handle_bind(nh, sofia_private);
return;
}
......@@ -1715,7 +1751,23 @@ void sofia_event_callback(nua_event_t event,
if (sofia_private && sofia_private != &mod_sofia_globals.destroy_private && sofia_private != &mod_sofia_globals.keep_private) {
switch_core_session_t *session;
if (!zstr(sofia_private->uuid)) {
if (zstr(sofia_private->uuid)) {
if (sofia_private->is_call && !sofia_private->de) {
sofia_dispatch_event_t *dep;
switch_mutex_lock(profile->flag_mutex);
if (!sofia_private->deq) {
sofia_private->deq = de;
} else {
for (dep = sofia_private->deq; dep && dep->next; dep = dep->next);
dep->next = de;
}
switch_mutex_unlock(profile->flag_mutex);
return;
}
} else {
if ((session = switch_core_session_locate(sofia_private->uuid))) {
if (switch_core_session_running(session)) {
switch_core_session_queue_signal_data(session, de);
......@@ -1732,7 +1784,7 @@ void sofia_event_callback(nua_event_t event,
}
}
}
sofia_queue_message(de);
switch_os_yield();
}
......@@ -6040,9 +6092,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
}
}
if (sofia_private) {
sofia_private->destroy_me = 1;
}
// if (sofia_private) {
//sofia_private->destroy_me = 1;
//}
}
if (session) {
......@@ -8013,6 +8065,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
profile->ib_calls++;
if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING)) {
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
goto fail;
......@@ -8217,14 +8270,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
goto fail;
}
if (!(tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t)))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
switch_core_session_destroy(&session);
goto fail;
}
tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t));
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
switch_mutex_init(&tech_pvt->sofia_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
......@@ -9031,6 +9078,10 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
}
switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
if (switch_core_session_running(session) || switch_core_session_started(session)) {
return;
}
if (sip && switch_core_session_thread_launch(session) == SWITCH_STATUS_SUCCESS) {
const char *dialog_from_user = "", *dialog_from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = "";
const char *user_agent = "", *call_id = "";
......@@ -9119,6 +9170,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting NAT mode based on %s\n", is_nat);
switch_channel_set_variable(channel, "sip_nat_detected", "true");
}
return;
}
......@@ -9140,10 +9192,12 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
switch_mutex_unlock(tech_pvt->profile->flag_mutex);
}
nua_handle_bind(nh, NULL);
sofia_private_free(sofia_private);
switch_core_session_destroy(&session);
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
if (!switch_core_session_running(session)) {
nua_handle_bind(nh, NULL);
sofia_private_free(sofia_private);
switch_core_session_destroy(&session);
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
}
return;
fail:
......
<include>
<extension name="auth" continue="true">
<condition>
<condition field="${radius_auth_result}" expression="^$">
<action application="radius_auth" inline="true"/>
</condition>
</extension>
......@@ -18,5 +18,10 @@
</condition>
</extension>
<extension name="originate_leg" continue="true">
<condition>
<action application="export" data="nolocal:h323-call-origin=originate"/>
</condition>
</extension>
</include>
......@@ -22,10 +22,48 @@
<param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="src-gw-ip=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
<param vendor="Cisco" name="h323-conf-id" variable="Core-UUID" format="%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="number"/>
<param name="Called-Station-Id" variable="sip_to_user" format="%s"/>
<param name="Calling-Station-Id" variable="sip_from_user" format="%s"/>
<param name="User-Name" variable="sip_from_user" format="%s"/>
<param name="Digest-Response" variable="sip_auth_response" format="%s"/>
<param name="Digest-Realm" variable="sip_auth_realm" format="%s"/>
<param name="Digest-Nonce" variable="sip_auth_nonce" format="%s"/>
<param name="Digest-Username" variable="sip_auth_username" format="%s"/>
<param name="Digest-URI" variable="sip_auth_uri" format="%s"/>
<param name="Digest-Method" variable="sip_auth_method" format="%s"/>
<param name="Digest-Algorithm" variable="sip_auth_method" format="MD5"/>
<param name="Digest-Qop" variable="sip_auth_qop" format="%s"/>
<param name="Digest-CNonce" variable="sip_auth_cnonce" format="%s"/>
<param name="Digest-Nonce-Count" variable="sip_auth_nc" format="%s"/>
</fields>
</auth_invite>
<auth_reg>
<connection name="testing">
<param name="authserver" value="127.0.0.1:1812:testing123"/>
<param name="radius_timeout" value="10"/>
<param name="radius_retries" value="2"/>
<param name="radius_deadtime" value="0"/>
<param name="dictionary" value="/usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary"/>
<param name="seqfile" value="/var/run/radius.seq"/>
</connection>
<fields>
<param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="user"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="ip" format="src-gw-ip=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
<param name="User-Name" variable="sip_from_user" format="%s"/>
<param name="Digest-Response" variable="sip_auth_response" format="%s"/>
<param name="Digest-Realm" variable="sip_auth_realm" format="%s"/>
<param name="Digest-Nonce" variable="sip_auth_nonce" format="%s"/>
<param name="Digest-Username" variable="sip_auth_username" format="%s"/>
<param name="Digest-URI" variable="sip_auth_uri" format="%s"/>
<param name="Digest-Method" variable="sip_auth_method" format="%s"/>
<param name="Digest-Algorithm" variable="sip_auth_method" format="MD5"/>
<param name="Digest-Qop" variable="sip_auth_qop" format="%s"/>
<param name="Digest-CNonce" variable="sip_auth_cnonce" format="%s"/>
<param name="Digest-Nonce-Count" variable="sip_auth_nc" format="%s"/>
</fields>
</auth_reg>
<auth_app>
<connection name="testing">
<param name="authserver" value="127.0.0.1:1812:testing123"/>
......@@ -36,7 +74,7 @@
<param name="seqfile" value="/var/run/radius.seq"/>
</connection>
<fields>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_network_ip" format="src-gw-ip=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_host" format="src-gw-ip=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
<param vendor="Cisco" name="h323-conf-id" variable="Core-UUID" format="%s"/>
<param name="Called-Station-Id" variable="sip_to_user" format="%s"/>
......@@ -67,18 +105,19 @@
<fields>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_host" format="src-gw-ip=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>
<param vendor="Cisco" name="h323-conf-id" variable="uuid" format="%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>
<param vendor="Cisco" name="h323-conf-id" variable_secondary="uuid" variable="originating_leg_uuid" format="%s"/>
<param vendor="Cisco" name="h323-setup-time"/>
<param vendor="Cisco" name="h323-connect-time"/>
<param vendor="Cisco" name="h323-call-origin" variable="h323-call-origin" default="answer" format="%s"/>
<param name="Called-Station-Id" variable="sip_to_user" format="%s"/>
<param name="Calling-Station-Id" variable="sip_from_user" format="%s"/>
</fields>
<conditions>
<!-- <conditions>
<condition>
<param var="direction" regex="inbound"/>
</condition>
</conditions>
<param var="direction" regex="^outbound$"/>
</condition>
</conditions> -->
</acct_start>
<acct_end>
<connection name="testing">
......@@ -92,22 +131,23 @@
<fields>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_host" format="src-gw-ip=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-gw-name=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>
<param vendor="Cisco" name="h323-conf-id" variable="uuid" format="%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>
<param vendor="Cisco" name="h323-conf-id" variable_secondary="uuid" variable="originating_leg_uuid" format="%s"/>
<param vendor="Cisco" name="h323-setup-time"/>
<param vendor="Cisco" name="h323-connect-time"/>
<param vendor="Cisco" name="h323-disconnect-time"/>
<param vendor="Cisco" name="h323-disconnect-cause"/>
<param vendor="Cisco" name="h323-call-origin" variable="h323-call-origin" format="%s" default="answer"/>
<param name="Called-Station-Id" variable="sip_to_user" format="%s"/>
<param name="Acct-Session-Time" variable="billsec" format="%s"/>
<param name="Calling-Station-Id" variable="sip_from_user" format="%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" format="src-number-out=%s"/>
<param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_user" format="dst-number-out=%s"/>
</fields>
<conditions>
<!-- <conditions>
<condition>
<param var="direction" regex="inbound"/>
</condition>
</conditions>
<param var="direction" regex="^outbound$"/>
</condition>
</conditions> -->
</acct_end>
</configuration>
......@@ -576,10 +576,15 @@ SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel)
while (switch_queue_trypop(channel->dtmf_log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_safe_free(pop);
}
switch_core_hash_destroy(&channel->private_hash);
if (channel->private_hash) {
switch_core_hash_destroy(&channel->private_hash);
}
if (channel->app_flag_hash) {
switch_core_hash_destroy(&channel->app_flag_hash);
}
switch_mutex_lock(channel->profile_mutex);
switch_event_destroy(&channel->variables);
switch_event_destroy(&channel->api_list);
......
......@@ -80,8 +80,8 @@ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t *
#ifdef DEBUG_ALLOC
if (memory > 500)
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Session Allocate %s %d\n",
apr_pool_tag(session->pool, NULL), (int) memory);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Session Allocate %s %d\n",
(void *) session->pool, (void *) session, apr_pool_tag(session->pool, NULL), (int) memory);
#endif
ptr = apr_palloc(session->pool, memory);
......@@ -113,8 +113,8 @@ SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(switch_size_t memory,
#endif
#ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Perm Allocate %s %d\n",
apr_pool_tag(memory_manager.memory_pool, NULL), (int) memory);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n",
(void *)memory_manager.memory_pool, apr_pool_tag(memory_manager.memory_pool, NULL), (int) memory);
#endif
ptr = apr_palloc(memory_manager.memory_pool, memory);
......@@ -155,8 +155,8 @@ SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(const char *todup, c
switch_assert(duped != NULL);
#ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Perm Allocate %s %d\n",
apr_pool_tag(memory_manager.memory_pool, NULL), (int) len);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n",
(void *) memory_manager.memory_pool, apr_pool_tag(memory_manager.memory_pool, NULL), (int) len);
#endif
#ifdef LOCK_MORE
......@@ -248,8 +248,8 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(switch_core_session_t
#ifdef DEBUG_ALLOC
len = strlen(todup);
if (len > 500)
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Sess Strdup Allocate %s %ld\n",
apr_pool_tag(session->pool, NULL), strlen(todup));
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Sess Strdup Allocate %s %ld\n",
(void *) session->pool, (void *)session, apr_pool_tag(session->pool, NULL), strlen(todup));
#endif
duped = apr_pstrdup(session->pool, todup);
......@@ -287,8 +287,8 @@ SWITCH_DECLARE(char *) switch_core_perform_strdup(switch_memory_pool_t *pool, co
#ifdef DEBUG_ALLOC
if (len > 500)
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Core Strdup Allocate %s %d\n",
apr_pool_tag(pool, NULL), (int)len);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Strdup Allocate %s %d\n",
(void *) pool, apr_pool_tag(pool, NULL), (int)len);
#endif
duped = apr_pstrmemdup(pool, todup, len);
......@@ -400,7 +400,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
apr_pool_tag(*pool, tmp);
#ifdef DEBUG_ALLOC2
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "New Pool %s\n", apr_pool_tag(*pool, NULL));
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p New Pool %s\n", (void *) *pool, apr_pool_tag(*pool, NULL));
#endif
......@@ -416,7 +416,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m
switch_assert(pool != NULL);
#ifdef DEBUG_ALLOC2
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Free Pool %s\n", apr_pool_tag(*pool, NULL));
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Free Pool %s\n", (void *) *pool, apr_pool_tag(*pool, NULL));
#endif
#ifdef INSTANTLY_DESTROY_POOLS
......@@ -458,8 +458,8 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(switch_memory_pool_t *pool, swi
#ifdef DEBUG_ALLOC
if (memory > 500)
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Core Allocate %s %d\n",
apr_pool_tag(pool, NULL), (int) memory);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Allocate %s %d\n",
(void *) pool, apr_pool_tag(pool, NULL), (int) memory);
/*switch_assert(memory < 20000); */
#endif
......@@ -525,16 +525,26 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
#ifdef USE_MEM_LOCK
switch_mutex_lock(memory_manager.mem_lock);
#endif
#ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
#endif
apr_pool_destroy(pop);
#ifdef USE_MEM_LOCK
switch_mutex_unlock(memory_manager.mem_lock);
#endif
#else
apr_pool_mutex_set(pop, NULL);
#ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
#endif
apr_pool_clear(pop);
if (switch_queue_trypush(memory_manager.pool_recycle_queue, pop) != SWITCH_STATUS_SUCCESS) {
#ifdef USE_MEM_LOCK
switch_mutex_lock(memory_manager.mem_lock);
#endif
#ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
#endif
apr_pool_destroy(pop);
#ifdef USE_MEM_LOCK
......
......@@ -1260,6 +1260,11 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t *
switch_endpoint_interface_t *endpoint_interface = (*session)->endpoint_interface;
int i;
if (switch_core_session_running(*session) && !switch_test_flag((*session), SSF_DESTROYABLE)) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(*session), SWITCH_LOG_ERROR,
"Cowardly ignoring an attempt to call destroy on a running session.\n");
}
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(*session), SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
switch_channel_get_name((*session)->channel), switch_channel_state_name(switch_channel_get_state((*session)->channel)));
......@@ -1440,6 +1445,8 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thre
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Session %" SWITCH_SIZE_T_FMT " (%s) Ended\n",
session->id, switch_channel_get_name(session->channel));
switch_set_flag(session, SSF_DESTROYABLE);
switch_core_session_destroy(&session);
return NULL;
}
......@@ -1454,6 +1461,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_se
switch_threadattr_detach_set(thd_attr, 1);
if (switch_test_flag(session, SSF_THREAD_RUNNING) || switch_test_flag(session, SSF_THREAD_STARTED)) {
status = SWITCH_STATUS_INUSE;
goto end;
}
......
......@@ -336,7 +336,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
const switch_state_handler_table_t *driver_state_handler = NULL;
const switch_state_handler_table_t *application_state_handler = NULL;
int silly = 0;
uint32_t new_loops = 60000;
uint32_t new_loops = 5000;
/*
Life of the channel. you have channel and pool in your session
......
......@@ -761,7 +761,7 @@ static switch_status_t uuid_bridge_on_hibernate(switch_core_session_t *session)
static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_core_session_t *other_session = NULL;
switch_core_session_t *other_session;
const char *other_uuid = NULL;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CUSTOM SOFT_EXECUTE\n", switch_channel_get_name(channel));
......@@ -818,6 +818,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
if (switch_ivr_wait_for_answer(session, other_session) != SWITCH_STATUS_SUCCESS) {
switch_core_session_rwunlock(other_session);
if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_continue_on_cancel"))) {
switch_channel_set_state(channel, CS_EXECUTE);
} else if (!switch_channel_test_flag(channel, CF_TRANSFER)) {
......@@ -842,6 +843,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
}
switch_core_session_rwunlock(other_session);
goto done;
}
......@@ -867,17 +869,13 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
!switch_channel_test_flag(channel, CF_REDIRECT) && state < CS_HANGUP && state != CS_ROUTING && state != CS_PARK) {
switch_channel_set_state(channel, CS_EXECUTE);
}
switch_core_session_rwunlock(other_session);
} else {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
done:
if (other_session) {
switch_core_session_rwunlock(other_session);
other_session = NULL;
}
switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
return SWITCH_STATUS_FALSE;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论