From 21482f011c4354d019e54ba418a055a272801926 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 25 Aug 2011 08:46:40 -0500 Subject: [PATCH] FS-3521 --resolve that was not a git diff, anyway i would prefer to not feed null to this function by practice because its the sign o f a bigger problem so I added an assert so we can tell if it happens again and protected against it from where its actually happening because NULL destination is not acceptable --- src/include/switch_utils.h | 2 ++ src/switch_ivr_originate.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index f798e92386..b5a1fa1868 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -426,6 +426,8 @@ static inline char *switch_sanitize_number(char *number) char warp[] = "/:"; int i; + switch_assert(number); + if (!(strchr(p, '/') || strchr(p, ':') || strchr(p, '@'))) { return number; } diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 2c84f760a7..c2c8f50727 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2353,6 +2353,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } + if (zstr(new_profile->destination_number)) { + if (caller_channel) { + switch_channel_hangup(caller_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + status = SWITCH_STATUS_FALSE; + goto done; + } + new_profile->callee_id_name = switch_core_strdup(new_profile->pool, "Outbound Call"); new_profile->callee_id_number = switch_sanitize_number(switch_core_strdup(new_profile->pool, new_profile->destination_number));