summaryrefslogtreecommitdiff
path: root/channels/chan_pjsip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_pjsip.c')
-rw-r--r--channels/chan_pjsip.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 5812360c5..f638a1e35 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -371,8 +371,12 @@ static struct ast_channel *chan_pjsip_new(struct ast_sip_session *session, int s
return NULL;
}
- if (!(chan = ast_channel_alloc(1, state, S_OR(session->id.number.str, ""), S_OR(session->id.name.str, ""), session->endpoint->accountcode, "", "", assignedids, requestor, 0, "PJSIP/%s-%08x", ast_sorcery_object_get_id(session->endpoint),
- (unsigned)ast_atomic_fetchadd_int((int *)&chan_idx, +1)))) {
+ chan = ast_channel_alloc_with_endpoint(1, state, S_OR(session->id.number.str, ""),
+ S_OR(session->id.name.str, ""), session->endpoint->accountcode, "",
+ "", assignedids, requestor, 0, session->endpoint->persistent,
+ "PJSIP/%s-%08x", ast_sorcery_object_get_id(session->endpoint),
+ (unsigned)ast_atomic_fetchadd_int((int *)&chan_idx, +1));
+ if (!chan) {
ao2_ref(caps, -1);
return NULL;
}
@@ -455,8 +459,6 @@ static struct ast_channel *chan_pjsip_new(struct ast_sip_session *session, int s
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_VIDEO]->rtp, ast_channel_uniqueid(chan));
}
- ast_endpoint_add_channel(session->endpoint->persistent, chan);
-
return chan;
}