summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorkkm <kkm@smartaction.com>2016-04-21 21:53:46 -0700
committerKirill Katsnelson <kkm@smartaction.com>2016-04-25 17:31:50 -0500
commit29bab0d1a4d6bbcdbf27fcff49b2e2262f65460e (patch)
tree9ff35ec292e2aa082c6a042c22c0b93f1dfa04a7 /channels
parent6c28e8c827d74f1b0d7a2a5deef0eb339a631d2a (diff)
chan_sip: Make autocreated peers send PeerStatus events
Since Stasis has been introduced, an attempt to send AMI messages by an autocreated peer caused a crash, and all events from autocreated peers were semi-inadvertently disabled altogether in 0b83761. This change restores the disabled functionality. ASTERISK-25950 Change-Id: Iecc350f23db603fadb2f302064643ebe9664e974
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 45827b448..e886772ca 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -17669,6 +17669,10 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
if (!peer && sip_cfg.autocreatepeer != AUTOPEERS_DISABLED) {
/* Create peer if we have autocreate mode enabled */
peer = temp_peer(name);
+ if (peer && !(peer->endpoint = ast_endpoint_create("SIP", name))) {
+ ao2_t_ref(peer, -1, "failed to allocate Stasis endpoint, drop peer");
+ peer = NULL;
+ }
if (peer) {
ao2_t_link(peers, peer, "link peer into peer table");
if (!ast_sockaddr_isnull(&peer->addr)) {