Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv3119/channels

Modified Files:
        chan_iax2.c 
Log Message:
don't call reg_source_db() until after the peer has been added to the peer list


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.300
retrieving revision 1.301
diff -u -d -r1.300 -r1.301
--- chan_iax2.c 3 Jun 2005 22:04:54 -0000       1.300
+++ chan_iax2.c 5 Jun 2005 20:05:55 -0000       1.301
@@ -238,7 +238,6 @@
 
 static int global_rtautoclear = 120;
 
-static struct iax2_peer *realtime_peer(const char *peername);
 static int reload_config(void);
 static int iax2_reload(int fd, int argc, char *argv[]);
 
@@ -611,6 +610,9 @@
 
 AST_MUTEX_DEFINE_STATIC(dpcache_lock);
 
+static void reg_source_db(struct iax2_peer *p);
+static struct iax2_peer *realtime_peer(const char *peername);
+
 static void destroy_peer(struct iax2_peer *peer);
 static int ast_cli_netstats(int fd, int limit_fmt);
 
@@ -2567,6 +2569,8 @@
                peer->next = peerl.peers;
                peerl.peers = peer;
                ast_mutex_unlock(&peerl.lock);
+               if (ast_test_flag(peer, IAX_DYNAMIC))
+                       reg_source_db(peer);
        } else {
                ast_set_flag(peer, IAX_TEMPONLY);       
        }
@@ -7957,8 +7961,6 @@
                ast_clear_flag(peer, IAX_DELME);        
                /* Make sure these are IPv4 addresses */
                peer->addr.sin_family = AF_INET;
-               if (!found && ast_test_flag(peer, IAX_DYNAMIC) && !temponly)
-                       reg_source_db(peer);
        }
        if (oldha)
                ast_free_ha(oldha);
@@ -8458,6 +8460,8 @@
                                                peer->next = peerl.peers;
                                                peerl.peers = peer;
                                                ast_mutex_unlock(&peerl.lock);
+                                               if (ast_test_flag(peer, 
IAX_DYNAMIC))
+                                                       reg_source_db(peer);
                                        }
                                } else if (strcasecmp(utype, "user")) {
                                        ast_log(LOG_WARNING, "Unknown type '%s' 
for '%s' in %s\n", utype, cat, config_file);

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to