}
#define DIR_DESC "directory"
-#define DIR_USAGE "<profile_name> <domain_name>"
+#define DIR_USAGE "<profile_name> <domain_name> [<context_name>]"
static void free_profile(dir_profile_t *profile)
{
char *mydata = NULL;
const char *profile_name = NULL;
const char *domain_name = NULL;
+ const char *context_name = NULL;
dir_profile_t *profile = NULL;
int x = 0;
char *sql = NULL;
}
mydata = switch_core_session_strdup(session, data);
- argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough args [%s]\n", data);
+ return;
+ }
if (argv[x]) {
profile_name = argv[x++];
domain_name = argv[x++];
}
+ if (argv[x]) {
+ context_name = argv[x++];
+ }
+
if (!(profile = get_profile(profile_name))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
return;
}
+ if (!context_name) {
+ context_name = domain_name;
+ }
+
populate_database(session, profile, domain_name);
memset(&s_param, 0, sizeof(s_param));
if (!zstr(s_param.transfer_to)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Directory transfering call to : %s\n", s_param.transfer_to);
- switch_ivr_session_transfer(session, s_param.transfer_to, "XML", domain_name);
+ switch_ivr_session_transfer(session, s_param.transfer_to, "XML", context_name);
}
/* Delete all sql entry for this call */