From: Anthony Minessale Date: Thu, 25 Aug 2011 13:46:40 +0000 (-0500) Subject: FS-3521 --resolve that was not a git diff, anyway i would prefer to not feed null... X-Git-Tag: v1.2-rc1~51^2~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21482f011c4354d019e54ba418a055a272801926;p=thirdparty%2Ffreeswitch.git 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 --- 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));