From 85e107a56e1cab1658fb6b0c8e04b9dbe8514d61 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 11 Jan 2011 14:53:14 -0500 Subject: [PATCH] freetdm: set channel name before caller profile otherwise the channel name is not set in 'show channels' --- libs/freetdm/mod_freetdm/mod_freetdm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7ac1b281a4..a477be5b75 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1101,7 +1101,6 @@ static ftdm_status_t on_channel_found(ftdm_channel_t *fchan, ftdm_caller_data_t chan_id = ftdm_channel_get_id(fchan); tech_init(hdata->tech_pvt, hdata->new_session, fchan); - hdata->tech_pvt->caller_profile = hdata->caller_profile; snprintf(name, sizeof(name), "FreeTDM/%u:%u/%s", span_id, chan_id, caller_data->dnis.digits); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect outbound channel %s\n", name); @@ -1110,6 +1109,9 @@ static ftdm_status_t on_channel_found(ftdm_channel_t *fchan, ftdm_caller_data_t switch_channel_set_variable_printf(channel, "freetdm_span_number", "%d", span_id); switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chan_id); + switch_channel_set_caller_profile(channel, hdata->caller_profile); + hdata->tech_pvt->caller_profile = hdata->caller_profile; + switch_channel_set_state(channel, CS_INIT); sess_uuid = switch_core_session_get_uuid(hdata->new_session); status = ftdm_channel_add_token(fchan, sess_uuid, ftdm_channel_get_token_count(fchan)); @@ -1395,7 +1397,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi if ((*new_session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_caller_profile_t *caller_profile; - switch_channel_t *channel = switch_core_session_get_channel(*new_session); switch_core_session_add_stream(*new_session, NULL); if (!(tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t)))) { @@ -1408,7 +1409,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); caller_profile->destination_number = switch_core_strdup(caller_profile->pool, switch_str_nil(dest_num)); caller_profile->caller_id_number = switch_core_strdup(caller_profile->pool, switch_str_nil(callerid_num)); - switch_channel_set_caller_profile(channel, caller_profile); hunting.result_cb = on_channel_found; hunt_data.var_event = var_event;