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

This commit is contained in:
Anthony Minessale 2011-08-25 08:46:40 -05:00
parent 329033ee86
commit 21482f011c
2 changed files with 10 additions and 0 deletions

View File

@ -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;
}

View File

@ -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));