diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-10 23:18:45 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-10 23:18:45 +0000 |
commit | 56cd6867f1a272ea980b7c673cbe6cbee7f8f8c5 (patch) | |
tree | d2de9878db0d047e5a92e78a2292c16abf4d569a /channels | |
parent | 8fc286506933e25ddf3e15fea462039d97e437d3 (diff) |
Merged revisions 217916 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r217916 | tilghman | 2009-09-10 18:12:16 -0500 (Thu, 10 Sep 2009) | 2 lines
Make calltoken support work with realtime users and peers.
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@217924 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_iax2.c | 11 | ||||
-rw-r--r-- | channels/chan_sip.c | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 09a01ac37..35665e27b 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -824,6 +824,7 @@ static AST_LIST_HEAD_STATIC(dpcache, iax2_dpcache); static void reg_source_db(struct iax2_peer *p); static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in *sin); +static struct iax2_user *realtime_user(const char *username, struct sockaddr_in *sin); static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt); static char *complete_iax2_peers(const char *line, const char *word, int pos, int state); @@ -1894,7 +1895,11 @@ static int calltoken_required(struct sockaddr_in *sin, const char *name, int sub /* ----- Case 2 ----- */ if ((subclass == IAX_COMMAND_NEW) && (user = find_user(find))) { calltoken_required = user->calltoken_required; - } else if ((subclass != IAX_COMMAND_NEW) && (peer = find_peer(find, 1))) { + } else if ((subclass == IAX_COMMAND_NEW) && (user = realtime_user(find, sin))) { + calltoken_required = user->calltoken_required; + } else if ((subclass != IAX_COMMAND_NEW) && (peer = find_peer(find, 0))) { + calltoken_required = peer->calltoken_required; + } else if ((subclass != IAX_COMMAND_NEW) && (peer = realtime_peer(find, sin))) { calltoken_required = peer->calltoken_required; } @@ -3976,7 +3981,7 @@ static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in if (!strcasecmp(tmp->name, "host")) { struct ast_hostent ahp; struct hostent *hp; - if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) { + if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) { /* No match */ ast_variables_destroy(var); var = NULL; @@ -4088,7 +4093,7 @@ static struct iax2_user *realtime_user(const char *username, struct sockaddr_in if (!strcasecmp(tmp->name, "host")) { struct ast_hostent ahp; struct hostent *hp; - if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) { + if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) { /* No match */ ast_variables_destroy(var); var = NULL; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 5fda830ce..d967bde59 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4145,7 +4145,7 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i if (!strcasecmp(tmp->name, "host")) { struct hostent *hp; struct ast_hostent ahp; - if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) { + if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) { /* No match */ ast_variables_destroy(var); var = NULL; |