[Asterisk-cvs] asterisk channel.c,1.45,1.46 pbx.c,1.54,1.55
martinp at lists.digium.com
martinp at lists.digium.com
Mon Sep 22 10:26:00 CDT 2003
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv1518
Modified Files:
channel.c pbx.c
Log Message:
Create better 'failed' CDRs for outgoing spool calls with context,extension,priority
Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- channel.c 18 Sep 2003 21:06:29 -0000 1.45
+++ channel.c 22 Sep 2003 15:27:09 -0000 1.46
@@ -1489,7 +1489,7 @@
return 0;
}
-struct ast_channel *ast_request_and_dial(char *type, int format, void *data, int timeout, int *outstate, char *callerid)
+struct ast_channel *__ast_request_and_dial(char *type, int format, void *data, int timeout, int *outstate, char *callerid, struct outgoing_helper *oh)
{
int state = 0;
struct ast_channel *chan;
@@ -1497,8 +1497,23 @@
int res = 0;
chan = ast_request(type, format, data);
if (chan) {
- if (callerid)
- ast_set_callerid(chan, callerid, 1);
+ if (oh) {
+ char *tmp, *var;
+ /* JDG chanvar */
+ tmp = oh->variable;
+ /* FIXME replace this call with strsep NOT*/
+ while( (var = strtok_r(NULL, "|", &tmp)) ) {
+ pbx_builtin_setvar( chan, var );
+ } /* /JDG */
+ if (*oh->context)
+ strncpy(chan->context, oh->context, sizeof(chan->context) - 1);
+ if (*oh->exten)
+ strncpy(chan->exten, oh->exten, sizeof(chan->exten) - 1);
+ if (*oh->callerid)
+ ast_set_callerid(chan, oh->callerid, 1);
+ chan->priority = oh->priority;
+ }
+
if (!ast_call(chan, data, 0)) {
while(timeout && (chan->_state != AST_STATE_UP)) {
res = ast_waitfor(chan, timeout);
@@ -1564,6 +1579,11 @@
chan = NULL;
}
return chan;
+}
+
+struct ast_channel *ast_request_and_dial(char *type, int format, void *data, int timeout, int *outstate, char *callerid)
+{
+ return __ast_request_and_dial(type, format, data, timeout, outstate, callerid, NULL);
}
struct ast_channel *ast_request(char *type, int format, void *data)
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- pbx.c 20 Sep 2003 00:34:03 -0000 1.54
+++ pbx.c 22 Sep 2003 15:27:09 -0000 1.55
@@ -162,13 +162,13 @@
static int pbx_builtin_ringing(struct ast_channel *, void *);
static int pbx_builtin_congestion(struct ast_channel *, void *);
static int pbx_builtin_busy(struct ast_channel *, void *);
-static int pbx_builtin_setvar(struct ast_channel *, void *);
static int pbx_builtin_setglobalvar(struct ast_channel *, void *);
static int pbx_builtin_noop(struct ast_channel *, void *);
static int pbx_builtin_gotoif(struct ast_channel *, void *);
static int pbx_builtin_gotoiftime(struct ast_channel *, void *);
static int pbx_builtin_saynumber(struct ast_channel *, void *);
static int pbx_builtin_saydigits(struct ast_channel *, void *);
+int pbx_builtin_setvar(struct ast_channel *, void *);
void pbx_builtin_setvar_helper(struct ast_channel *chan, char *name, char *value);
char *pbx_builtin_getvar_helper(struct ast_channel *chan, char *name);
@@ -3786,31 +3786,16 @@
struct async_stat *as;
int res = -1;
char *var, *tmp;
+ struct outgoing_helper oh;
if (sync) {
- chan = ast_request_and_dial(type, format, data, timeout, reason, callerid);
+ LOAD_OH(oh);
+ chan = __ast_request_and_dial(type, format, data, timeout, reason, callerid, &oh);
if (chan) {
- /* JDG chanvar */
- tmp = variable;
- /* FIXME replace this call with strsep NOT*/
- while( (var = strtok_r(NULL, "|", &tmp)) ) {
- pbx_builtin_setvar( chan, var );
- } /* /JDG */
if (chan->_state == AST_STATE_UP) {
- res = 0;
+ res = 0;
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_4 "Channel %s was answered.\n", chan->name);
- if (context && *context)
- strncpy(chan->context, context, sizeof(chan->context) - 1);
- if (exten && *exten)
- strncpy(chan->exten, exten, sizeof(chan->exten) - 1);
- if (callerid && *callerid) {
- /* XXX call ast_set_callerid? */
- if (chan->callerid)
- free(chan->callerid);
- chan->callerid = strdup(callerid);
- }
- if (priority > 0)
- chan->priority = priority;
+
if (sync > 1) {
if (ast_pbx_run(chan)) {
ast_log(LOG_WARNING, "Unable to run PBX on %s\n", chan->name);
@@ -4345,7 +4330,7 @@
}
}
-static int pbx_builtin_setvar(struct ast_channel *chan, void *data)
+int pbx_builtin_setvar(struct ast_channel *chan, void *data)
{
char *name;
char *value;
More information about the svn-commits
mailing list