summaryrefslogtreecommitdiff
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-06-05 20:05:55 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-06-05 20:05:55 +0000
commit8a0ade1fd833778375e50686e9bb54c8f90f0274 (patch)
treea605d9de43bcf9e8b515a1400d9b3d821368874b /channels/chan_iax2.c
parent723d6b5be8060543e2924e379b62569bc8f92f10 (diff)
don't call reg_source_db() until after the peer has been added to the peer list
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5850 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rwxr-xr-xchannels/chan_iax2.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 5dc213f2c..232f6f2fb 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -238,7 +238,6 @@ struct iax2_context {
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 @@ static struct iax2_dpcache {
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 @@ static struct iax2_peer *realtime_peer(const char *peername)
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 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, in
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 @@ static int set_config(char *config_file, int reload)
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);