[asterisk-commits] mjordan: trunk r418757 - in /trunk: ./ channels/ configs/ contrib/ast-db-mana...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 16 09:03:54 CDT 2014
Author: mjordan
Date: Wed Jul 16 09:03:51 2014
New Revision: 418757
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418757
Log:
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
........
Merged revisions 418756 from http://svn.asterisk.org/svn/asterisk/branches/12
Added:
trunk/contrib/ast-db-manage/config/versions/1d50859ed02e_create_accountcode.py
- copied unchanged from r418756, branches/12/contrib/ast-db-manage/config/versions/1d50859ed02e_create_accountcode.py
Modified:
trunk/ (props changed)
trunk/CHANGES
trunk/channels/chan_pjsip.c
trunk/configs/pjsip.conf.sample
trunk/include/asterisk/res_pjsip.h
trunk/res/res_pjsip.c
trunk/res/res_pjsip/pjsip_configuration.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=418757&r1=418756&r2=418757
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Jul 16 09:03:51 2014
@@ -177,6 +177,17 @@
pg_stat_activity view and CSV log entries. This setting is configurable
for res_config_pgsql via the dbappname configuration setting in
res_pgsql.conf.
+
+------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 12.4.0 to Asterisk 12.5.0 ------------
+------------------------------------------------------------------------------
+
+res_pjsip
+------------------
+ * The endpoint configuration object now supports 'accountcode'. Any channel
+ created for an endpoint with this setting will have its accountcode set
+ to the specified value.
+
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 12.3.0 to Asterisk 12.4.0 ------------
Modified: trunk/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_pjsip.c?view=diff&rev=418757&r1=418756&r2=418757
==============================================================================
--- trunk/channels/chan_pjsip.c (original)
+++ trunk/channels/chan_pjsip.c Wed Jul 16 09:03:51 2014
@@ -364,8 +364,12 @@
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;
}
Modified: trunk/configs/pjsip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/pjsip.conf.sample?view=diff&rev=418757&r1=418756&r2=418757
==============================================================================
--- trunk/configs/pjsip.conf.sample (original)
+++ trunk/configs/pjsip.conf.sample Wed Jul 16 09:03:51 2014
@@ -435,6 +435,8 @@
; SYNOPSIS: Endpoint
;100rel=yes ; Allow support for RFC3262 provisional ACK tags (default:
; "yes")
+;accountcode=foo ; Set a default account code for channels created for
+ ; this endpoint
;aggregate_mwi=yes ; (default: "yes")
;allow= ; Media Codec s to allow (default: "")
;aors= ; AoR s to be used with the endpoint (default: "")
Modified: trunk/include/asterisk/res_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/res_pjsip.h?view=diff&rev=418757&r1=418756&r2=418757
==============================================================================
--- trunk/include/asterisk/res_pjsip.h (original)
+++ trunk/include/asterisk/res_pjsip.h Wed Jul 16 09:03:51 2014
@@ -570,6 +570,8 @@
AST_STRING_FIELD(fromdomain);
/*! Context to route incoming MESSAGE requests to */
AST_STRING_FIELD(message_context);
+ /*! Accountcode to auto-set on channels */
+ AST_STRING_FIELD(accountcode);
);
/*! Configuration for extensions */
struct ast_sip_endpoint_extensions extensions;
Modified: trunk/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip.c?view=diff&rev=418757&r1=418756&r2=418757
==============================================================================
--- trunk/res/res_pjsip.c (original)
+++ trunk/res/res_pjsip.c Wed Jul 16 09:03:51 2014
@@ -713,6 +713,13 @@
If specified, incoming MESSAGE requests will be routed to the indicated
dialplan context. If no <replaceable>message_context</replaceable> is
specified, then the <replaceable>context</replaceable> setting is used.
+ </para></description>
+ </configOption>
+ <configOption name="accountcode">
+ <synopsis>An accountcode to set automatically on any channels created for this endpoint.</synopsis>
+ <description><para>
+ If specified, any channel created for this endpoint will automatically
+ have this accountcode set on it.
</para></description>
</configOption>
</configObject>
Modified: trunk/res/res_pjsip/pjsip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/pjsip_configuration.c?view=diff&rev=418757&r1=418756&r2=418757
==============================================================================
--- trunk/res/res_pjsip/pjsip_configuration.c (original)
+++ trunk/res/res_pjsip/pjsip_configuration.c Wed Jul 16 09:03:51 2014
@@ -1730,6 +1730,7 @@
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "redirect_method", "user", redirect_handler, NULL, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "set_var", "", set_var_handler, set_var_to_str, set_var_to_vl, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "message_context", "", OPT_STRINGFIELD_T, 1, STRFLDSET(struct ast_sip_endpoint, message_context));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "accountcode", "", OPT_STRINGFIELD_T, 1, STRFLDSET(struct ast_sip_endpoint, accountcode));
if (ast_sip_initialize_sorcery_transport()) {
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
More information about the asterisk-commits
mailing list