From 860d952efd5864e03a885bb9522e1a8537a55fbb Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Sat, 30 Mar 2013 12:00:58 +0100 Subject: [PATCH 1/3] EndCall for incoming call while on hold doesn't close both legs on a skinny phone Fixes #FS-5232, thanks to Nathan Neulinger for the patch --- src/mod/endpoints/mod_skinny/skinny_server.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index db0ce5b971..21bdf08a2b 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1820,6 +1820,9 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); if(session) { channel = switch_core_session_get_channel(session); + if (switch_channel_test_flag(channel, CF_HOLD)) { + switch_ivr_unhold(session); + } switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); } break; From dd1e61e0d4b660f0d61ec4f10dc70c711b51b2d7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 30 Mar 2013 15:39:49 -0500 Subject: [PATCH 2/3] part 2 of other cid patch --- src/include/switch_channel.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 50 ++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 14706d441a..4eac1643b8 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -603,6 +603,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(_In_ switch_channel_ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *channel, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur); #define switch_channel_expand_variables(_channel, _in) switch_channel_expand_variables_check(_channel, _in, NULL, NULL, 0) +#define switch_channel_inbound_display(_channel) (switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_INBOUND || switch_channel_test_flag(_channel, CF_DIALPLAN)) SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile, _In_opt_ const char *prefix); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4f30bb334f..42593e4050 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -787,20 +787,38 @@ void sofia_send_callee_id(switch_core_session_t *session, const char *name, cons switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel); - if (zstr(name)) { - name = caller_profile->callee_id_name; - } - - if (zstr(number)) { - number = caller_profile->callee_id_number; - } - - if (zstr(name)) { - name = number; - } - - if (zstr(number)) { - number = caller_profile->destination_number; + if (switch_channel_inbound_display(channel)) { + if (zstr(name)) { + name = caller_profile->caller_id_name; + } + + if (zstr(number)) { + number = caller_profile->caller_id_number; + } + + if (zstr(name)) { + name = number; + } + + if (zstr(number)) { + name = number = "UNKNOWN"; + } + } else { + if (zstr(name)) { + name = caller_profile->callee_id_name; + } + + if (zstr(number)) { + number = caller_profile->callee_id_number; + } + + if (zstr(name)) { + name = number; + } + + if (zstr(number)) { + number = caller_profile->destination_number; + } } if ((uuid = switch_channel_get_partner_uuid(channel)) && (session_b = switch_core_session_locate(uuid))) { @@ -843,7 +861,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro } - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { + if (switch_channel_inbound_display(channel)) { name_var = "caller_id_name"; num_var = "caller_id_number"; ename_var = "effective_caller_id_name"; @@ -935,7 +953,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro caller_profile = switch_channel_get_caller_profile(channel); - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { + if (switch_channel_inbound_display(channel)) { if (!strcmp(caller_profile->caller_id_name, name) && !strcmp(caller_profile->caller_id_number, number)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s Same Caller ID \"%s\" <%s>\n", switch_channel_get_name(channel), name, number); From 4f47c49590819743405f05892aee47508a86652e Mon Sep 17 00:00:00 2001 From: Brian West Date: Sat, 30 Mar 2013 19:55:55 -0500 Subject: [PATCH 3/3] missing zset --- src/include/switch_utils.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index f547df624a..11a4cdc38e 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -266,6 +266,10 @@ static inline switch_bool_t switch_is_moh(const char *s) return SWITCH_TRUE; } + +#define zset(_a, _b) if (!zstr(_b)) _a = _b + + /* find a character (find) in a string (in) and return a pointer to that point in the string where the character was found using the array (allowed) as allowed non-matching characters, when (allowed) is NULL, behaviour should be identical to strchr() */