From fd495dbbe1b51096bc7da06d8f1053e086200a9b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 26 Oct 2011 09:00:59 -0500 Subject: [PATCH] FS-3640 try this patch, not sure what you are doing because I can recover 300 channels fine. I added a patch to deal with what looks like corrupted data in the cdr or something so it should fail more gracefully --- src/mod/endpoints/mod_sofia/sofia_glue.c | 8 +++++++- src/switch_core_session.c | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index cba2828376..c05cff06e4 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1959,6 +1959,12 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) caller_profile = switch_channel_get_caller_profile(channel); + if (!caller_profile) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + return SWITCH_STATUS_FALSE; + } + + cid_name = caller_profile->caller_id_name; cid_num = caller_profile->caller_id_number; sofia_glue_tech_prepare_codecs(tech_pvt); @@ -5368,7 +5374,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName return 0; if (!(session = switch_core_session_request_xml(sofia_endpoint_interface, NULL, xml))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "skipping non-bridged entry\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid cdr data, call not recovered\n"); return 0; } diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 46bffa7df5..a7ab9d8ddc 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1748,6 +1748,13 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e } + if (!channel || !switch_channel_get_caller_profile(channel)) { + if (session) { + switch_core_session_destroy(&session); + } + } + + return session; }