freeswitch_CFLAGS = $(AM_CFLAGS)
freeswitch_LDFLAGS = -lfreeswitch
nodist_freeswitch_SOURCES = src/include/switch_version.h
-BUILT_SOURCES = depends version
+BUILT_SOURCES = version depends
CLEANFILES = src/include/switch_version.h
version: Makefile
yesdepends:
rm .nodepends
-
-depends:
+.depend:
./buildlib.sh . install sqlite-3.2.8.tar.gz --prefix=$(PREFIX) --disable-tcl --enable-threadsafe
./buildlib.sh . install apr-1.2.2.tar.gz --prefix=$(PREFIX)
./buildlib.sh . install apr-util-1.2.2.tar.gz --with-apr=../apr-1.2.2 --prefix=$(PREFIX)
cp libs/libresample-0.1.3/*.a $(PREFIX)/lib
cp libs/libresample-0.1.3/include/* $(PREFIX)/include
ranlib $(PREFIX)/lib/libresample.a
+ touch .depend
+
+depends: .depend
+
modules: $(NAME)
@echo making modules
freeswitch_CFLAGS = $(AM_CFLAGS)
freeswitch_LDFLAGS = -lfreeswitch
nodist_freeswitch_SOURCES = src/include/switch_version.h
-BUILT_SOURCES = depends version
+BUILT_SOURCES = version depends
CLEANFILES = src/include/switch_version.h
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-recursive
yesdepends:
rm .nodepends
-depends:
+.depend:
./buildlib.sh . install sqlite-3.2.8.tar.gz --prefix=$(PREFIX) --disable-tcl --enable-threadsafe
./buildlib.sh . install apr-1.2.2.tar.gz --prefix=$(PREFIX)
./buildlib.sh . install apr-util-1.2.2.tar.gz --with-apr=../apr-1.2.2 --prefix=$(PREFIX)
cp libs/libresample-0.1.3/*.a $(PREFIX)/lib
cp libs/libresample-0.1.3/include/* $(PREFIX)/include
ranlib $(PREFIX)/lib/libresample.a
+ touch .depend
+
+depends: .depend
modules: $(NAME)
@echo making modules
char *var, *val;
char app[1024] = "";
int catno = -1;
- char *regex = NULL;
char *exten_name = NULL;
pcre *re = NULL;
+ int match_count = 0;
+ int ovector[30];
channel = switch_core_session_get_channel(session);
caller_profile = switch_channel_get_caller_profile(channel);
while (switch_config_next_pair(&cfg, &var, &val)) {
if (cfg.catno != catno) { /* new category */
- regex = NULL;
catno = cfg.catno;
exten_name = cfg.category;
+ cleanre();
+ match_count = 0;
}
-
-
if (!strcasecmp(var, "regex")) {
const char *error = NULL;
&erroffset, /* for error offset */
NULL); /* use default character tables */
if (error) {
- switch_console_printf(SWITCH_CHANNEL_CONSOLE, "ERROR: %d %s\n", erroffset, error);
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "COMPILE ERROR: %d [%s]\n", erroffset, error);
cleanre();
+ switch_channel_hangup(channel);
return NULL;
}
- } else if (!strcasecmp(var, "match")) {
- int rc;
- int ovector[30];
- rc = pcre_exec(
+ match_count = pcre_exec(
re, /* result of pcre_compile() */
NULL, /* we didn't study the pattern */
caller_profile->destination_number, /* the subject string */
0, /* default options */
ovector, /* vector of integers for substring information */
sizeof(ovector) / sizeof(ovector[0])); /* number of elements (NOT size in bytes) */
-
-
- if (rc > 0) {
+ } else if (match_count > 0 && !strcasecmp(var, "match")) {
+ if (!re) {
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "ERROR: match without regex in %s line %d\n", cfg.path, cfg.lineno);
+ continue;
+ } else {
char newval[1024] = "";
char index[10] = "";
char replace[128] = "";
int x, y=0, z=0, num = 0;
char *data;
-
for (x = 0; x < sizeof(newval) && x < strlen(val);) {
if (val[x] == '$') {
x++;
z = 0;
num = atoi(index);
- if (pcre_copy_substring(caller_profile->destination_number, ovector, rc, num, replace, sizeof(replace)) > 0) {
+ if (pcre_copy_substring(caller_profile->destination_number, ovector, match_count, num, replace, sizeof(replace)) > 0) {
int r;
for(r = 0; r < strlen(replace); r++) {
newval[y++] = replace[r];
switch_caller_extension_add_application(session, extension, app, data);
}
-
}
-
}
-
+
switch_config_close_file(&cfg);
if (extension) {