diff --git a/libs/freetdm/mod_openzap/mod_openzap.c b/libs/freetdm/mod_openzap/mod_openzap.c index 243135959a..b997997dd6 100644 --- a/libs/freetdm/mod_openzap/mod_openzap.c +++ b/libs/freetdm/mod_openzap/mod_openzap.c @@ -717,18 +717,25 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } + if (switch_strlen_zero(outbound_profile->destination_number)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string\n"); + return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + } + dest = outbound_profile->destination_number; if ((p = strchr(outbound_profile->destination_number, '/'))) { dest = p + 1; span_id = atoi(outbound_profile->destination_number); - chan_id = atoi(dest); - if ((p = strchr(dest, '/'))) { - dest = p + 1; + if (!switch_strlen_zero(dest)) { + chan_id = atoi(dest); + if ((p = strchr(dest, '/'))) { + dest = p + 1; + } } } - if (!dest) { + if (!switch_strlen_zero(dest)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string\n"); return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } @@ -753,8 +760,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } - - if ((*new_session = switch_core_session_request(openzap_endpoint_interface, pool)) != 0) { private_t *tech_pvt; switch_channel_t *channel;