[Asterisk-cvs]
asterisk/pbx Makefile, 1.13, 1.14 pbx_config.c, 1.50,
1.51 pbx_dundi.c, 1.4, 1.5
markster at lists.digium.com
markster at lists.digium.com
Sat Oct 23 22:49:42 CDT 2004
Update of /usr/cvsroot/asterisk/pbx
In directory mongoose.digium.com:/tmp/cvs-serv4284/pbx
Modified Files:
Makefile pbx_config.c pbx_dundi.c
Log Message:
Add "Loopback" switch
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/Makefile,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Makefile 18 Oct 2004 21:45:13 -0000 1.13
+++ Makefile 24 Oct 2004 02:53:24 -0000 1.14
@@ -13,7 +13,7 @@
-PBX_LIBS=pbx_config.so pbx_spool.so pbx_dundi.so
+PBX_LIBS=pbx_config.so pbx_spool.so pbx_dundi.so pbx_loopback.so
# Add GTK console if appropriate
#PBX_LIBS+=$(shell gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so")
Index: pbx_config.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_config.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- pbx_config.c 16 Oct 2004 19:46:02 -0000 1.50
+++ pbx_config.c 24 Oct 2004 02:53:24 -0000 1.51
@@ -1754,10 +1754,13 @@
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
if (ast_context_add_ignorepat2(con, realvalue, registrar))
ast_log(LOG_WARNING, "Unable to include ignorepat '%s' in context '%s'\n", v->value, cxt);
- } else if (!strcasecmp(v->name, "switch")) {
+ } else if (!strcasecmp(v->name, "switch") || !strcasecmp(v->name, "lswitch")) {
char *stringp=NULL;
memset(realvalue, 0, sizeof(realvalue));
- pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
+ if (!strcasecmp(v->name, "switch"))
+ pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
+ else
+ strncpy(realvalue, v->value, sizeof(realvalue) - 1);
tc = realvalue;
stringp=tc;
appl = strsep(&stringp, "/");
Index: pbx_dundi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_dundi.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pbx_dundi.c 23 Oct 2004 21:41:17 -0000 1.4
+++ pbx_dundi.c 24 Oct 2004 02:53:24 -0000 1.5
@@ -480,7 +480,6 @@
{
int flags;
int x;
- struct ast_channel *chan=NULL;
if (!ast_strlen_zero(map->lcontext)) {
flags = 0;
if (ast_exists_extension(NULL, map->lcontext, called_number, 1, NULL))
@@ -501,27 +500,35 @@
flags &= ~(DUNDI_FLAG_MATCHMORE|DUNDI_FLAG_CANMATCH);
}
if (flags) {
- /* Clearly we can't say 'don't ask' anymore... */
- chan = ast_channel_alloc(0);
- if (chan) {
- flags |= map->options & 0xffff;
- dr[anscnt].flags = flags;
- dr[anscnt].techint = map->tech;
- dr[anscnt].weight = map->weight;
- dr[anscnt].expiration = DUNDI_DEFAULT_CACHE_TIME;
- strncpy(dr[anscnt].tech, tech2str(map->tech), sizeof(dr[anscnt].tech));
- dr[anscnt].eid = *us_eid;
- dundi_eid_to_str(dr[anscnt].eid_str, sizeof(dr[anscnt].eid_str), &dr[anscnt].eid);
- if (flags & DUNDI_FLAG_EXISTS) {
- pbx_builtin_setvar_helper(chan, "NUMBER", called_number);
- pbx_builtin_setvar_helper(chan, "EID", dr[anscnt].eid_str);
- pbx_builtin_setvar_helper(chan, "SECRET", cursecret);
- pbx_builtin_setvar_helper(chan, "IPADDR", ipaddr);
- pbx_substitute_variables_helper(chan, map->dest, dr[anscnt].dest, sizeof(dr[anscnt].dest));
- } else
- dr[anscnt].dest[0] = '\0';
- anscnt++;
- }
+ struct varshead headp;
+ struct ast_var_t *newvariable;
+ flags |= map->options & 0xffff;
+ dr[anscnt].flags = flags;
+ dr[anscnt].techint = map->tech;
+ dr[anscnt].weight = map->weight;
+ dr[anscnt].expiration = DUNDI_DEFAULT_CACHE_TIME;
+ strncpy(dr[anscnt].tech, tech2str(map->tech), sizeof(dr[anscnt].tech));
+ dr[anscnt].eid = *us_eid;
+ dundi_eid_to_str(dr[anscnt].eid_str, sizeof(dr[anscnt].eid_str), &dr[anscnt].eid);
+ if (flags & DUNDI_FLAG_EXISTS) {
+ AST_LIST_HEAD_INIT(&headp);
+ newvariable = ast_var_assign("NUMBER", called_number);
+ AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
+ newvariable = ast_var_assign("EID", dr[anscnt].eid_str);
+ AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
+ newvariable = ast_var_assign("SECRET", cursecret);
+ AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
+ newvariable = ast_var_assign("IPADDR", ipaddr);
+ AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
+ pbx_substitute_variables_varshead(&headp, map->dest, dr[anscnt].dest, sizeof(dr[anscnt].dest));
+ while (!AST_LIST_EMPTY(&headp)) { /* List Deletion. */
+ newvariable = AST_LIST_FIRST(&headp);
+ AST_LIST_REMOVE_HEAD(&headp, entries);
+ ast_var_delete(newvariable);
+ }
+ } else
+ dr[anscnt].dest[0] = '\0';
+ anscnt++;
} else {
/* No answers... Find the fewest number of digits from the
number for which we have no answer. */
@@ -541,8 +548,6 @@
}
}
}
- if (chan)
- ast_hangup(chan);
return anscnt;
}
More information about the svn-commits
mailing list