[asterisk-commits] rmudgett: branch group/issue8824 r142963 - /team/group/issue8824/funcs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 12 17:36:28 CDT 2008
Author: rmudgett
Date: Fri Sep 12 17:36:27 2008
New Revision: 142963
URL: http://svn.digium.com/view/asterisk?view=rev&rev=142963
Log:
* For the CONNECTEDLINE() and REDIRECTING() dialplan functions:
Added an optional update inhibit option to prevent the channel
protoocl from sending out messages because of the value being
set.
Modified:
team/group/issue8824/funcs/func_connectedline.c
team/group/issue8824/funcs/func_redirecting.c
Modified: team/group/issue8824/funcs/func_connectedline.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/funcs/func_connectedline.c?view=diff&rev=142963&r1=142962&r2=142963
==============================================================================
--- team/group/issue8824/funcs/func_connectedline.c (original)
+++ team/group/issue8824/funcs/func_connectedline.c Fri Sep 12 17:36:27 2008
@@ -84,9 +84,29 @@
{
struct ast_party_connected_line connected;
char *val;
+ char *option;
+ void (*set_it)(struct ast_channel *chan, const struct ast_party_connected_line *connected);
if (!value || !chan) {
return -1;
+ }
+
+ /* Determine if the update indication inhibit option is present */
+ option = strchr(data, ',');
+ if (option) {
+ option = ast_skip_blanks(option + 1);
+ switch (*option) {
+ case 'i':
+ set_it = ast_set_connected_line;
+ break;
+
+ default:
+ ast_log(LOG_ERROR, "Unknown connectedline option '%s'.\n", option);
+ return 0;
+ } /* end switch */
+ }
+ else {
+ set_it = ast_connected_line_update;
}
ast_channel_lock(chan);
@@ -102,22 +122,22 @@
ast_callerid_split(value, name, sizeof(name), num, sizeof(num));
connected.id.name = name;
connected.id.number = num;
- ast_connected_line_update(chan, &connected);
+ set_it(chan, &connected);
} else if (!strncasecmp("name", data, 4)) {
connected.id.name = ast_strdupa(value);
ast_trim_blanks(connected.id.name);
- ast_connected_line_update(chan, &connected);
+ set_it(chan, &connected);
} else if (!strncasecmp("num", data, 3)) {
connected.id.number = ast_strdupa(value);
ast_trim_blanks(connected.id.number);
- ast_connected_line_update(chan, &connected);
+ set_it(chan, &connected);
} else if (!strncasecmp("ton", data, 3)) {
val = ast_strdupa(value);
ast_trim_blanks(val);
if (('0' <= val[0]) && (val[0] <= '9')) {
connected.id.number_type = atoi(val);
- ast_connected_line_update(chan, &connected);
+ set_it(chan, &connected);
} else {
ast_log(LOG_ERROR, "Unknown connectedline type of number '%s', value unchanged\n", val);
}
@@ -137,7 +157,7 @@
ast_log(LOG_ERROR, "Unknown connectedline number presentation '%s', value unchanged\n", val);
} else {
connected.id.number_presentation = pres;
- ast_connected_line_update(chan, &connected);
+ set_it(chan, &connected);
}
} else if (!strncasecmp("source", data, 6)) {
val = ast_strdupa(value);
@@ -145,7 +165,7 @@
if (('0' <= val[0]) && (val[0] <= '9')) {
connected.source = atoi(val);
- ast_connected_line_update(chan, &connected);
+ set_it(chan, &connected);
} else {
ast_log(LOG_ERROR, "Unknown connectedline source '%s', value unchanged\n", val);
}
@@ -159,9 +179,12 @@
static struct ast_custom_function connectedline_function = {
.name = "CONNECTEDLINE",
.synopsis = "Gets or sets Connected Line data on the channel.",
- .syntax = "CONNECTEDLINE(datatype)",
+ .syntax = "CONNECTEDLINE(datatype[,i])",
.desc =
"Gets or sets Connected Line data on the channel.\n"
+ "The optional update Inhibit option prevents the channel\n"
+ "from sending out protocol messages because of the value\n"
+ "being set.\n"
"The allowable datatypes are:\n"
"\"all\", \"name\", \"num\", \"ton\", \"pres\", and \"source\"\n",
.read = connectedline_read,
Modified: team/group/issue8824/funcs/func_redirecting.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/funcs/func_redirecting.c?view=diff&rev=142963&r1=142962&r2=142963
==============================================================================
--- team/group/issue8824/funcs/func_redirecting.c (original)
+++ team/group/issue8824/funcs/func_redirecting.c Fri Sep 12 17:36:27 2008
@@ -256,9 +256,29 @@
{
struct ast_party_redirecting redirecting;
char *val;
+ char *option;
+ void (*set_it)(struct ast_channel *chan, const struct ast_party_redirecting *redirecting);
if (!value || !chan) {
return -1;
+ }
+
+ /* Determine if the update indication inhibit option is present */
+ option = strchr(data, ',');
+ if (option) {
+ option = ast_skip_blanks(option + 1);
+ switch (*option) {
+ case 'i':
+ set_it = ast_set_redirecting;
+ break;
+
+ default:
+ ast_log(LOG_ERROR, "Unknown redirecting option '%s'.\n", option);
+ return 0;
+ } /* end switch */
+ }
+ else {
+ set_it = ast_redirecting_update;
}
ast_channel_lock(chan);
@@ -270,7 +290,7 @@
if (!strncasecmp("from-", data, 5)) {
switch (redirecting_id_write(&redirecting.from, data + 5, value)) {
case ID_FIELD_VALID:
- ast_redirecting_update(chan, &redirecting);
+ set_it(chan, &redirecting);
ast_party_redirecting_free(&redirecting);
break;
@@ -284,7 +304,7 @@
} else if (!strncasecmp("to-", data, 3)) {
switch (redirecting_id_write(&redirecting.to, data + 3, value)) {
case ID_FIELD_VALID:
- ast_redirecting_update(chan, &redirecting);
+ set_it(chan, &redirecting);
ast_party_redirecting_free(&redirecting);
break;
@@ -312,7 +332,7 @@
} else {
redirecting.from.number_presentation = pres;
redirecting.to.number_presentation = pres;
- ast_redirecting_update(chan, &redirecting);
+ set_it(chan, &redirecting);
}
} else if (!strncasecmp("reason", data, 6)) {
val = ast_strdupa(value);
@@ -320,7 +340,7 @@
if (('0' <= val[0]) && (val[0] <= '9')) {
redirecting.reason = atoi(val);
- ast_redirecting_update(chan, &redirecting);
+ set_it(chan, &redirecting);
} else {
ast_log(LOG_ERROR, "Unknown redirecting reason '%s', value unchanged\n", val);
}
@@ -330,7 +350,7 @@
if (('0' <= val[0]) && (val[0] <= '9')) {
redirecting.count = atoi(val);
- ast_redirecting_update(chan, &redirecting);
+ set_it(chan, &redirecting);
} else {
ast_log(LOG_ERROR, "Unknown redirecting count '%s', value unchanged\n", val);
}
@@ -347,9 +367,12 @@
static struct ast_custom_function redirecting_function = {
.name = "REDIRECTING",
.synopsis = "Gets or sets Redirecting data on the channel.",
- .syntax = "REDIRECTING(datatype)",
+ .syntax = "REDIRECTING(datatype[,i])",
.desc =
"Gets or sets Redirecting data on the channel.\n"
+ "The optional update Inhibit option prevents the channel\n"
+ "from sending out protocol messages because of the value\n"
+ "being set.\n"
"The allowable datatypes are:\n"
"\"from-all\", \"from-name\", \"from-num\", \"from-ton\",\n"
"\"to-all\", \"to-name\", \"to-num\", \"to-ton\",\n"
More information about the asterisk-commits
mailing list