switch_caller_profile_t *profile = NULL;
profile = switch_core_alloc(pool, sizeof(*profile));
+ memset(profile, 0, sizeof(*profile));
+
switch_assert(profile != NULL);
if (!context) {
switch_mutex_lock(channel->profile_mutex);
if (!channel->variables || !(v = switch_event_get_header(channel->variables, varname))) {
- switch_caller_profile_t *cp = channel->caller_profile;
+ switch_caller_profile_t *cp = switch_channel_get_caller_profile(channel);
if (cp) {
if (!strncmp(varname, "aleg_", 5)) {
switch_caller_profile_t *profile;
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
- profile = channel->caller_profile;
+ profile = channel->hunt_caller_profile ? channel->hunt_caller_profile : channel->caller_profile;
switch_mutex_unlock(channel->profile_mutex);
return profile;
}
}
dpstr = switch_core_session_strdup(session, new_profile->dialplan);
+
+
switch_channel_set_hunt_caller_profile(channel, new_profile);
argc = switch_separate_string(dpstr, ',', dp, (sizeof(dp) / sizeof(dp[0])));