diff --git a/libs/freetdm/mod_openzap/mod_openzap.c b/libs/freetdm/mod_openzap/mod_openzap.c index 8f74c12902..51faebc011 100644 --- a/libs/freetdm/mod_openzap/mod_openzap.c +++ b/libs/freetdm/mod_openzap/mod_openzap.c @@ -821,11 +821,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } else if (*p == 'a') { direction = ZAP_TOP_DOWN; } else { - chan_id = atoi(dest); + chan_id = atoi(p); } } } - + if (!span_id) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing span\n"); return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;