From e79e6146c5cbed324c2cdf95a5af51bbb6705e8c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 9 Jul 2012 10:56:04 -0500 Subject: [PATCH] FS-4378 add sofia::error custom event --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 6ccb9ef0f8..98975bdfdb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -90,6 +90,7 @@ typedef struct private_object private_object_t; #define MY_EVENT_RECOVERY "sofia::recovery_recv" #define MY_EVENT_RECOVERY_SEND "sofia::recovery_send" #define MY_EVENT_RECOVERY_RECOVERED "sofia::recovery_recovered" +#define MY_EVENT_ERROR "sofia::error" #define MULTICAST_EVENT "multicast::event" #define SOFIA_REPLACES_HEADER "_sofia_replaces_" diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 072d212d71..b5cd480d46 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7316,6 +7316,16 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_ivr_session_transfer(b_session, exten, NULL, NULL); switch_core_session_rwunlock(b_session); } else { + switch_event_t *event; + + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR)) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Error-Type", "attended_transfer"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Transfer-Exten", exten); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Full-Refer-To", full_ref_to); + + switch_channel_event_set_data(channel, event); + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Blind Transfer 1 Legged calls\n"); switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR"); nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),