res_pjsip: Support setting a default accountcode on endpoints

Most channel drivers let you specify a default accountcode to be set on
channels associated with a particular peer/endpoint/object. Prior to this
patch, chan_pjsip/res_pjsip did not support such a setting.

This patch adds a new setting to the res_pjsip endpoint object, 'accountcode'.
When a channel is created that is associated with an endpoint with this value
set, the channel will automatically have its accountcode property set to the
value configured for the endpoint.

Review: https://reviewboard.asterisk.org/r/3724/

ASTERISK-24000 #close
Reported by: Matt Jordan


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@418756 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2014-07-16 13:58:07 +00:00
parent 5e243281b3
commit 4895ddef28
7 changed files with 49 additions and 2 deletions

View File

@@ -364,8 +364,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, ""), "", "", "", 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(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));
if (!chan) {
return NULL;
}