[Asterisk-cvs] asterisk/channels chan_iax2.c,1.327,1.328
markster
markster
Sat Aug 6 10:49:24 CDT 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv14803/channels
Modified Files:
chan_iax2.c
Log Message:
Fix timestamp + trunking (bug #4891)
Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.327
retrieving revision 1.328
diff -u -d -r1.327 -r1.328
--- chan_iax2.c 6 Aug 2005 06:40:05 -0000 1.327
+++ chan_iax2.c 6 Aug 2005 14:53:14 -0000 1.328
@@ -142,7 +142,6 @@
#endif
static int jittershrinkrate=2;
static int trunkfreq = 20;
-static int send_trunktimestamps = 1;
static int authdebug = 1;
static int autokill = 0;
static int iaxcompat = 0;
@@ -209,7 +208,7 @@
static int delayreject = 0;
static int iax2_encryption = 0;
-static struct ast_flags globalflags = {0};
+static struct ast_flags globalflags = { 0 };
static pthread_t netthreadid = AST_PTHREADT_NULL;
@@ -244,6 +243,7 @@
#define IAX_RTAUTOCLEAR (1 << 19) /* erase me on expire */
#define IAX_FORCEJITTERBUF (1 << 20) /* Force jitterbuffer, even when bridged to a channel that can take jitter */
#define IAX_RTIGNOREREGEXPIRE (1 << 21)
+#define IAX_TRUNKTIMESTAMPS (1 << 22) /* Send trunk timestamps */
static int global_rtautoclear = 120;
@@ -3636,7 +3636,7 @@
/* Append to meta frame */
ptr = tpeer->trunkdata + IAX2_TRUNK_PREFACE + tpeer->trunkdatalen;
- if(send_trunktimestamps) {
+ if (ast_test_flag(&globalflags, IAX_TRUNKTIMESTAMPS)) {
mtm = (struct ast_iax2_meta_trunk_mini *)ptr;
mtm->len = htons(f->datalen);
mtm->mini.callno = htons(pvt->callno);
@@ -5798,7 +5798,7 @@
/* We're actually sending a frame, so fill the meta trunk header and meta header */
meta->zeros = 0;
meta->metacmd = IAX_META_TRUNK;
- if(send_trunktimestamps)
+ if (ast_test_flag(&globalflags, IAX_TRUNKTIMESTAMPS))
meta->cmddata = IAX_META_TRUNK_MINI;
else
meta->cmddata = IAX_META_TRUNK_SUPERMINI;
@@ -7949,7 +7949,7 @@
}
}
if (peer) {
- ast_copy_flags(peer, (&globalflags), IAX_MESSAGEDETAIL | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+ ast_copy_flags(peer, &globalflags, IAX_MESSAGEDETAIL | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
peer->encmethods = iax2_encryption;
peer->secret[0] = '\0';
if (!found) {
@@ -7972,8 +7972,6 @@
ast_copy_string(peer->dbsecret, v->value, sizeof(peer->dbsecret));
else if (!strcasecmp(v->name, "mailboxdetail"))
ast_set2_flag(peer, ast_true(v->value), IAX_MESSAGEDETAIL);
- else if (!strcasecmp(v->name, "trunktimestamps"))
- send_trunktimestamps = ast_true(v->value);
else if (!strcasecmp(v->name, "trunk")) {
ast_set2_flag(peer, ast_true(v->value), IAX_TRUNK);
if (ast_test_flag(peer, IAX_TRUNK) && (timingfd < 0)) {
@@ -8093,7 +8091,6 @@
struct ast_ha *oldha = NULL;
struct iax2_context *oldcon = NULL;
int format;
- int found;
char *varname = NULL, *varval = NULL;
struct ast_variable *tmpvar = NULL;
@@ -8110,8 +8107,8 @@
}
} else
user = NULL;
+
if (user) {
- found++;
oldha = user->ha;
oldcon = user->contexts;
user->ha = NULL;
@@ -8137,11 +8134,7 @@
user->encmethods = iax2_encryption;
ast_copy_string(user->name, name, sizeof(user->name));
ast_copy_string(user->language, language, sizeof(user->language));
- ast_copy_flags(user, (&globalflags), IAX_USEJITTERBUF);
- ast_copy_flags(user, (&globalflags), IAX_FORCEJITTERBUF);
- ast_copy_flags(user, (&globalflags), IAX_CODEC_USER_FIRST);
- ast_copy_flags(user, (&globalflags), IAX_CODEC_NOPREFS);
- ast_copy_flags(user, (&globalflags), IAX_CODEC_NOCAP);
+ ast_copy_flags(user, &globalflags, IAX_USEJITTERBUF | IAX_FORCEJITTERBUF | IAX_CODEC_USER_FIRST | IAX_CODEC_NOPREFS | IAX_CODEC_NOCAP);
while(v) {
if (!strcasecmp(v->name, "context")) {
con = build_context(v->value);
@@ -8395,14 +8388,22 @@
ast_log(LOG_ERROR, "Unable to load config %s\n", config_file);
return -1;
}
+
+ /* Reset global codec prefs */
memset(&prefs, 0 , sizeof(struct ast_codec_pref));
- v = ast_variable_browse(cfg, "general");
+
/* Reset Global Flags */
memset(&globalflags, 0, sizeof(globalflags));
+
+ /* Set default options */
+ ast_set_flag(&globalflags, 0);
+
#ifdef SO_NO_CHECK
nochecksums = 0;
#endif
+ v = ast_variable_browse(cfg, "general");
+
while(v) {
if (!strcasecmp(v->name, "bindport")){
if (reload)
@@ -8485,7 +8486,9 @@
else if (!strcasecmp(v->name, "rtignoreregexpire"))
ast_set2_flag((&globalflags), ast_true(v->value), IAX_RTIGNOREREGEXPIRE);
else if (!strcasecmp(v->name, "rtnoupdate"))
- ast_set2_flag((&globalflags), ast_true(v->value), IAX_RTNOUPDATE);
+ ast_set2_flag((&globalflags), ast_true(v->value), IAX_RTNOUPDATE);
+ else if (!strcasecmp(v->name, "trunktimestamps"))
+ ast_set2_flag(&globalflags, ast_true(v->value), IAX_TRUNKTIMESTAMPS);
else if (!strcasecmp(v->name, "rtautoclear")) {
int i = atoi(v->value);
if(i > 0)
More information about the svn-commits
mailing list