diff options
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 15 | ||||
-rw-r--r-- | channels/sip/include/sip.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8cd739e49..7cf5f37dd 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -295,6 +295,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "sip/include/security_events.h" #include "asterisk/sip_api.h" #include "asterisk/app.h" +#include "asterisk/stasis_endpoints.h" /*** DOCUMENTATION <application name="SIPDtmfMode" language="en_US"> @@ -5326,6 +5327,9 @@ static void sip_destroy_peer(struct sip_peer *peer) peer->caps = ast_format_cap_destroy(peer->caps); ast_rtp_dtls_cfg_free(&peer->dtls_cfg); + + ast_endpoint_shutdown(peer->endpoint); + peer->endpoint = NULL; } /*! \brief Update peer data in database (if used) */ @@ -8012,6 +8016,14 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit return NULL; } + if (i->relatedpeer) { + if (ast_endpoint_add_channel(i->relatedpeer->endpoint, tmp)) { + ast_channel_unref(tmp); + sip_pvt_lock(i); + return NULL; + } + } + /* If we sent in a callid, bind it to the channel. */ if (callid) { ast_channel_callid_set(tmp, callid); @@ -30770,6 +30782,9 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str if (!(peer = ao2_t_alloc(sizeof(*peer), sip_destroy_peer_fn, "allocate a peer struct"))) { return NULL; } + if (!(peer->endpoint = ast_endpoint_create("SIP", name))) { + return NULL; + } if (!(peer->caps = ast_format_cap_alloc_nolock())) { ao2_t_ref(peer, -1, "failed to allocate format capabilities, drop peer"); return NULL; diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h index 090f1bcb2..d852ee945 100644 --- a/channels/sip/include/sip.h +++ b/channels/sip/include/sip.h @@ -1377,6 +1377,8 @@ struct sip_peer { unsigned int disallowed_methods; struct ast_cc_config_params *cc_params; + struct ast_endpoint *endpoint; + struct ast_rtp_dtls_cfg dtls_cfg; }; |