mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-12 20:27:19 +00:00
cleanup, null checks. etc.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6780 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
3e8b08b243
commit
fc7994a5e5
@ -185,7 +185,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
|
|||||||
char *pattern = NULL;
|
char *pattern = NULL;
|
||||||
char *pri = NULL;
|
char *pri = NULL;
|
||||||
char *app = NULL;
|
char *app = NULL;
|
||||||
char *arg = NULL;
|
char *argument = NULL;
|
||||||
char *expression = NULL, expression_buf[1024] = "";
|
char *expression = NULL, expression_buf[1024] = "";
|
||||||
char substituted[2048] = "";
|
char substituted[2048] = "";
|
||||||
char *field_data = caller_profile->destination_number;
|
char *field_data = caller_profile->destination_number;
|
||||||
@ -206,7 +206,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
|
|||||||
|
|
||||||
if (!strcasecmp(var, "exten")) {
|
if (!strcasecmp(var, "exten")) {
|
||||||
char *p;
|
char *p;
|
||||||
if ((p = strchr(pattern, '/'))) {
|
if (pattern && (p = strchr(pattern, '/'))) {
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
cid = pattern;
|
cid = pattern;
|
||||||
pattern = p;
|
pattern = p;
|
||||||
@ -224,7 +224,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*pattern == '_' || *pattern == '~') {
|
if (pattern && (*pattern == '_' || *pattern == '~')) {
|
||||||
if (*pattern == '_') {
|
if (*pattern == '_') {
|
||||||
pattern++;
|
pattern++;
|
||||||
if (switch_ast2regex(pattern, expression_buf, sizeof(expression_buf))) {
|
if (switch_ast2regex(pattern, expression_buf, sizeof(expression_buf))) {
|
||||||
@ -242,7 +242,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (strcasecmp(pattern, field_data)) {
|
if (pattern && strcasecmp(pattern, field_data)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,24 +260,24 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
|
|||||||
pri = argv[1];
|
pri = argv[1];
|
||||||
app = argv[2];
|
app = argv[2];
|
||||||
|
|
||||||
if ((arg = strchr(app, '('))) {
|
if ((argument = strchr(app, '('))) {
|
||||||
char *p;
|
char *p;
|
||||||
*arg++ = '\0';
|
*argument++ = '\0';
|
||||||
p = strrchr(arg, ')');
|
p = strrchr(argument, ')');
|
||||||
if (p) {
|
if (p) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
} else if ((arg = strchr(app, ','))) {
|
} else if ((argument = strchr(app, ','))) {
|
||||||
*arg++ = '\0';
|
*argument++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arg) {
|
if (!argument) {
|
||||||
arg = "";
|
argument = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strchr(expression, '(')) {
|
if (strchr(expression, '(')) {
|
||||||
switch_perform_substitution(re, proceed, arg, field_data, substituted, sizeof(substituted), ovector);
|
switch_perform_substitution(re, proceed, argument, field_data, substituted, sizeof(substituted), ovector);
|
||||||
arg = substituted;
|
argument = substituted;
|
||||||
}
|
}
|
||||||
switch_regex_safe_free(re);
|
switch_regex_safe_free(re);
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_caller_extension_add_application(session, extension, app, arg);
|
switch_caller_extension_add_application(session, extension, app, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_safe_free(field_expanded);
|
switch_safe_free(field_expanded);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user