]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Make autocreated peers send PeerStatus events 03/2703/1
authorkkm <kkm@smartaction.com>
Fri, 22 Apr 2016 04:53:46 +0000 (21:53 -0700)
committerKirill Katsnelson <kkm@smartaction.com>
Mon, 25 Apr 2016 22:31:50 +0000 (17:31 -0500)
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

channels/chan_sip.c

index 45827b4487f1a1fd7fffde6b3e96c1c0fa7a94a9..e886772caa529fb13897c60b8f8e4c68a1d93e7b 100644 (file)
@@ -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)) {