[Asterisk-cvs] asterisk/channels chan_iax2.c, 1.330,
1.331 chan_sip.c, 1.805, 1.806
markster
markster
Tue Aug 9 12:38:02 CDT 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv14884/channels
Modified Files:
chan_iax2.c chan_sip.c
Log Message:
Centralize and fix tos for IAX (bug #4850 inspired)
Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.330
retrieving revision 1.331
diff -u -d -r1.330 -r1.331
--- chan_iax2.c 9 Aug 2005 01:59:59 -0000 1.330
+++ chan_iax2.c 9 Aug 2005 16:41:28 -0000 1.331
@@ -8370,6 +8370,7 @@
struct ast_variable *v;
char *cat;
char *utype;
+ char *tosval;
int format;
int portno = IAX_DEFAULT_PORTNO;
int x;
@@ -8399,6 +8400,12 @@
v = ast_variable_browse(cfg, "general");
+ /* Seed initial tos value */
+ tosval = ast_variable_retrieve(cfg, "general", "tos");
+ if (tosval) {
+ if (ast_str2tos(v->value, &tos))
+ ast_log(LOG_WARNING, "Invalid tos value, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n");
+ }
while(v) {
if (!strcasecmp(v->name, "bindport")){
if (reload)
@@ -8529,19 +8536,7 @@
if (!ast_context_find(regcontext))
ast_context_create(NULL, regcontext, channeltype);
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &format) == 1)
- tos = format & 0xff;
- else if (!strcasecmp(v->value, "lowdelay"))
- tos = IPTOS_LOWDELAY;
- else if (!strcasecmp(v->value, "throughput"))
- tos = IPTOS_THROUGHPUT;
- else if (!strcasecmp(v->value, "reliability"))
- tos = IPTOS_RELIABILITY;
- else if (!strcasecmp(v->value, "mincost"))
- tos = IPTOS_MINCOST;
- else if (!strcasecmp(v->value, "none"))
- tos = 0;
- else
+ if (ast_str2tos(v->value, &tos))
ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(accountcode, v->value, sizeof(accountcode));
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.805
retrieving revision 1.806
diff -u -d -r1.805 -r1.806
--- chan_sip.c 9 Aug 2005 16:20:32 -0000 1.805
+++ chan_sip.c 9 Aug 2005 16:41:28 -0000 1.806
@@ -11030,19 +11030,7 @@
} else if (!strcasecmp(v->name, "recordhistory")) {
recordhistory = ast_true(v->value);
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%i", &format) == 1)
- tos = format & 0xff;
- else if (!strcasecmp(v->value, "lowdelay"))
- tos = IPTOS_LOWDELAY;
- else if (!strcasecmp(v->value, "throughput"))
- tos = IPTOS_THROUGHPUT;
- else if (!strcasecmp(v->value, "reliability"))
- tos = IPTOS_RELIABILITY;
- else if (!strcasecmp(v->value, "mincost"))
- tos = IPTOS_MINCOST;
- else if (!strcasecmp(v->value, "none"))
- tos = 0;
- else
+ if (ast_str2tos(v->value, &tos))
ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
} else if (!strcasecmp(v->name, "bindport")) {
if (sscanf(v->value, "%d", &ourport) == 1) {
More information about the svn-commits
mailing list