if (!caller_profile || zstr(caller_profile->destination_number)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Obtaining Profile!\n");
+
return NULL;
}
if (!switch_config_open_file(&cfg, cf)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+
return NULL;
}
}
} else {
if (pattern && strcasecmp(pattern, field_data)) {
+ switch_safe_free(field_expanded);
continue;
}
}
if (cid) {
if (strcasecmp(cid, caller_profile->caller_id_number)) {
+ switch_safe_free(field_expanded);
continue;
}
}
switch_perform_substitution(re, proceed, argument, field_data, substituted, sizeof(substituted), ovector);
argument = substituted;
}
+
switch_regex_safe_free(re);
if (!extension) {
if (zstr(field_data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No extension!\n");
+ switch_safe_free(field_expanded);
break;
}
+
if ((extension = switch_caller_extension_new(session, field_data, field_data)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ switch_safe_free(field_expanded);
break;
}
}