aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-24 21:47:04 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-24 21:47:04 +0000
commit7afb48003cda98d5330bd5635b173c9df54cda2d (patch)
tree186914f448dd6ef0f056c140cde8aa58a5a3eaf5 /channels/chan_sip.c
parent5ba2ef3659ba663f3c9522d8b0cbd46ddf6e4022 (diff)
Merged revisions 265449 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r265449 | mmichelson | 2010-05-24 16:44:30 -0500 (Mon, 24 May 2010) | 11 lines Allow type=user SIP endpoints to be loaded properly from realtime. (closes issue #16021) Reported by: Guggemand Patches: realtime-type-fix.patch uploaded by Guggemand (license 897) (altered by me slightly to avoid ref leaks) Tested by: Guggemand ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@265450 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 52fd9ce88..d087ea4e9 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4861,17 +4861,7 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
}
for (tmp = var; tmp; tmp = tmp->next) {
- /* If this is type=user, then skip this object. */
- if (!strcasecmp(tmp->name, "type") &&
- !strcasecmp(tmp->value, "user")) {
- if(peerlist)
- ast_config_destroy(peerlist);
- else {
- ast_variables_destroy(var);
- ast_variables_destroy(varregs);
- }
- return NULL;
- } else if (!newpeername && !strcasecmp(tmp->name, "name")) {
+ if (!newpeername && !strcasecmp(tmp->name, "name")) {
newpeername = tmp->value;
}
}
@@ -4992,6 +4982,24 @@ static struct sip_peer *find_peer(const char *peer, struct sockaddr_in *sin, int
if (!p && (realtime || devstate_only)) {
p = realtime_peer(peer, sin, devstate_only);
+ if (p) {
+ switch (which_objects) {
+ case FINDUSERS:
+ if (!(p->type & SIP_TYPE_USER)) {
+ unref_peer(p, "Wrong type of realtime SIP endpoint");
+ return NULL;
+ }
+ break;
+ case FINDPEERS:
+ if (!(p->type & SIP_TYPE_PEER)) {
+ unref_peer(p, "Wrong type of realtime SIP endpoint");
+ return NULL;
+ }
+ break;
+ case FINDALLDEVICES:
+ break;
+ }
+ }
}
return p;