[asterisk-commits] pbx spool: Set AST OUTGOING ATTEMPT variable on channel (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 9 14:29:02 CST 2017
Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5132 )
Change subject: pbx_spool: Set AST_OUTGOING_ATTEMPT variable on channel
......................................................................
pbx_spool: Set AST_OUTGOING_ATTEMPT variable on channel
Set a variable on the channel that indicates which attempt number we
are currently performing to allow for attempt-specific behavior.
ASTERISK-26568 #close
Reported by: Roman Shubovich
Change-Id: Iacd7e8d43b0ed5b6cb021c62f41f1a1f5733dd89
---
M CHANGES
M pbx/pbx_spool.c
2 files changed, 25 insertions(+), 14 deletions(-)
Approvals:
Richard Mudgett: Looks good to me, approved
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/CHANGES b/CHANGES
index 371e9e1..2a4f658 100644
--- a/CHANGES
+++ b/CHANGES
@@ -79,6 +79,12 @@
* Add 'QueueUpdate' application which can be used to track outbound calls
using app_queue.
+pbx_spool
+------------------
+ * Asterisk will now set the AST_OUTGOING_ATTEMPT channel variable so that
+ attempt-specific behavior is possible. This is a 1-based number that
+ simply increases by 1 for each attempt.
+
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 14.3.0 to Asterisk 14.4.0 ------------
------------------------------------------------------------------------------
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 0c6c401..644347f 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -161,6 +161,19 @@
return o;
}
+static void append_variable(struct outgoing *o, const char *name, const char *value)
+{
+ struct ast_variable *var = ast_variable_new(name, value, o->fn);
+
+ if (!var) {
+ return;
+ }
+
+ /* Always insert at the end, because some people want to treat the spool
+ * file as a script */
+ ast_variable_list_append(&o->vars, var);
+}
+
static void parse_line(char *line, unsigned int lineno, struct outgoing *o)
{
char *c;
@@ -261,20 +274,7 @@
strsep(&c2, "=");
if (c2) {
- struct ast_variable *var = ast_variable_new(c, c2, o->fn);
-
- if (var) {
- /*
- * Always insert at the end, because some people
- * want to treat the spool file as a script
- */
- struct ast_variable **tail = &o->vars;
-
- while (*tail) {
- tail = &(*tail)->next;
- }
- *tail = var;
- }
+ append_variable(o, c, c2);
} else {
ast_log(LOG_WARNING, "Malformed \"%s\" argument. Should be \"%s: variable=value\"\n", line, line);
}
@@ -328,6 +328,11 @@
"along with tech and dest in file %s\n", o->fn);
return -1;
}
+
+ if (snprintf(buf, sizeof(buf), "%d", o->retries + 1) < sizeof(buf)) {
+ append_variable(o, "AST_OUTGOING_ATTEMPT", buf);
+ }
+
return 0;
}
--
To view, visit https://gerrit.asterisk.org/5132
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iacd7e8d43b0ed5b6cb021c62f41f1a1f5733dd89
Gerrit-PatchSet: 4
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-commits
mailing list