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: https://origsvn.digium.com/svn/asterisk/trunk@265449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
4e38beb960
commit
f908dd984c
|
@ -4379,17 +4379,7 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tmp = var; tmp; tmp = tmp->next) {
|
for (tmp = var; tmp; tmp = tmp->next) {
|
||||||
/* If this is type=user, then skip this object. */
|
if (!newpeername && !strcasecmp(tmp->name, "name")) {
|
||||||
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")) {
|
|
||||||
newpeername = tmp->value;
|
newpeername = tmp->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4510,6 +4500,24 @@ static struct sip_peer *find_peer(const char *peer, struct sockaddr_in *sin, int
|
||||||
|
|
||||||
if (!p && (realtime || devstate_only)) {
|
if (!p && (realtime || devstate_only)) {
|
||||||
p = realtime_peer(peer, sin, 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;
|
return p;
|
||||||
|
|
Loading…
Reference in New Issue