[asterisk-commits] mjordan: branch mjordan/12-messaging r418912 - in /team/mjordan/12-messaging:...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 18 11:00:36 CDT 2014
Author: mjordan
Date: Fri Jul 18 11:00:32 2014
New Revision: 418912
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418912
Log:
Update with merge failures; fix compilation issue
Added:
team/mjordan/12-messaging/contrib/ast-db-manage/config/versions/1d50859ed02e_create_accountcode.py
- copied unchanged from r418886, branches/12/contrib/ast-db-manage/config/versions/1d50859ed02e_create_accountcode.py
Modified:
team/mjordan/12-messaging/ (props changed)
team/mjordan/12-messaging/CHANGES
team/mjordan/12-messaging/channels/chan_pjsip.c
team/mjordan/12-messaging/channels/dahdi/bridge_native_dahdi.c
team/mjordan/12-messaging/configs/pjsip.conf.sample
team/mjordan/12-messaging/include/asterisk/res_pjsip.h
team/mjordan/12-messaging/main/bridge_channel.c
team/mjordan/12-messaging/main/features_config.c
team/mjordan/12-messaging/res/ari/ari_model_validators.c
team/mjordan/12-messaging/res/ari/ari_model_validators.h
team/mjordan/12-messaging/res/res_pjsip.c
team/mjordan/12-messaging/res/res_pjsip/pjsip_configuration.c
team/mjordan/12-messaging/rest-api/api-docs/endpoints.json
Propchange: team/mjordan/12-messaging/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jul 18 11:00:32 2014
@@ -1,1 +1,1 @@
-/branches/12:1-418726
+/branches/12:1-418910
Modified: team/mjordan/12-messaging/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/CHANGES?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/CHANGES (original)
+++ team/mjordan/12-messaging/CHANGES Fri Jul 18 11:00:32 2014
@@ -7,6 +7,17 @@
=== and the other UPGRADE files for older releases.
===
==============================================================================
+
+------------------------------------------------------------------------------
+--- 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: team/mjordan/12-messaging/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/channels/chan_pjsip.c?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/channels/chan_pjsip.c (original)
+++ team/mjordan/12-messaging/channels/chan_pjsip.c Fri Jul 18 11:00:32 2014
@@ -364,8 +364,13 @@
return NULL;
}
- if (!(chan = ast_channel_alloc_with_endpoint(1, state, S_OR(session->id.number.str, ""), S_OR(session->id.name.str, ""), "", "", "", 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)))) {
+ 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) {
return NULL;
}
Modified: team/mjordan/12-messaging/channels/dahdi/bridge_native_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/channels/dahdi/bridge_native_dahdi.c?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/channels/dahdi/bridge_native_dahdi.c (original)
+++ team/mjordan/12-messaging/channels/dahdi/bridge_native_dahdi.c Fri Jul 18 11:00:32 2014
@@ -40,7 +40,6 @@
#endif /* defined(HAVE_PRI) */
#include "../chan_dahdi.h"
-#include "asterisk/astobj.h"
#include "bridge_native_dahdi.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_technology.h"
Modified: team/mjordan/12-messaging/configs/pjsip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/configs/pjsip.conf.sample?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/configs/pjsip.conf.sample (original)
+++ team/mjordan/12-messaging/configs/pjsip.conf.sample Fri Jul 18 11:00:32 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: team/mjordan/12-messaging/include/asterisk/res_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/include/asterisk/res_pjsip.h?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/include/asterisk/res_pjsip.h (original)
+++ team/mjordan/12-messaging/include/asterisk/res_pjsip.h Fri Jul 18 11:00:32 2014
@@ -573,6 +573,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: team/mjordan/12-messaging/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/main/bridge_channel.c?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/main/bridge_channel.c (original)
+++ team/mjordan/12-messaging/main/bridge_channel.c Fri Jul 18 11:00:32 2014
@@ -1478,7 +1478,8 @@
} else if (!strcmp(dtmf, featuremap->parkcall)) {
feature = "parkcall";
}
- } else if (xfer) {
+ }
+ if (xfer) {
if (!strcmp(dtmf, xfer->atxferthreeway)) {
feature = "atxferthreeway";
}
Modified: team/mjordan/12-messaging/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/main/features_config.c?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/main/features_config.c (original)
+++ team/mjordan/12-messaging/main/features_config.c Fri Jul 18 11:00:32 2014
@@ -799,6 +799,7 @@
/* applicationmap and featuregroups are purposely not copied. A channel's applicationmap
* is produced on the fly when ast_get_chan_applicationmap() is called
+ * NOTE: This does not apply to the global cfg->applicationmap and cfg->featuresgroups
*/
}
@@ -1290,6 +1291,9 @@
return NULL;
}
+ /* global config must be initialized */
+ ast_assert(cfg->featuregroups != NULL);
+ ast_assert(cfg->applicationmap != NULL);
while ((name = strsep(&group_names, "#"))) {
RAII_VAR(struct featuregroup *, group, ao2_find(cfg->featuregroups, name, OBJ_KEY), ao2_cleanup);
@@ -1531,6 +1535,9 @@
* items refer to actual applicationmap items.
*/
+ /* global config must be initialized */
+ ast_assert(cfg->featuregroups != NULL);
+ ast_assert(cfg->applicationmap != NULL);
ao2_callback_data(cfg->featuregroups, 0, check_featuregroup, &err, cfg->applicationmap);
return err;
@@ -1790,7 +1797,7 @@
"", unsupported_handler, 0);
if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
- RAII_VAR(struct features_config *, features_cfg, __features_config_alloc(0), ao2_cleanup);
+ RAII_VAR(struct features_config *, features_cfg, features_config_alloc(), ao2_cleanup);
if (aco_set_defaults(&global_option, "general", features_cfg->global) ||
aco_set_defaults(&featuremap_option, "featuremap", features_cfg->featuremap)) {
Modified: team/mjordan/12-messaging/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/res/ari/ari_model_validators.c?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/res/ari/ari_model_validators.c (original)
+++ team/mjordan/12-messaging/res/ari/ari_model_validators.c Fri Jul 18 11:00:32 2014
@@ -629,8 +629,9 @@
} else
if (strcmp("variables", ast_json_object_iter_key(iter)) == 0) {
int prop_is_valid;
- prop_is_valid = ast_ari_validate_containers(
- ast_json_object_iter_value(iter));
+ prop_is_valid = ast_ari_validate_list(
+ ast_json_object_iter_value(iter),
+ ast_ari_validate_text_message_variable);
if (!prop_is_valid) {
ast_log(LOG_ERROR, "ARI TextMessage field variables failed validation\n");
res = 0;
@@ -665,6 +666,60 @@
ari_validator ast_ari_validate_text_message_fn(void)
{
return ast_ari_validate_text_message;
+}
+
+int ast_ari_validate_text_message_variable(struct ast_json *json)
+{
+ int res = 1;
+ struct ast_json_iter *iter;
+ int has_key = 0;
+ int has_value = 0;
+
+ for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
+ if (strcmp("key", ast_json_object_iter_key(iter)) == 0) {
+ int prop_is_valid;
+ has_key = 1;
+ prop_is_valid = ast_ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
+ ast_log(LOG_ERROR, "ARI TextMessageVariable field key failed validation\n");
+ res = 0;
+ }
+ } else
+ if (strcmp("value", ast_json_object_iter_key(iter)) == 0) {
+ int prop_is_valid;
+ has_value = 1;
+ prop_is_valid = ast_ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
+ ast_log(LOG_ERROR, "ARI TextMessageVariable field value failed validation\n");
+ res = 0;
+ }
+ } else
+ {
+ ast_log(LOG_ERROR,
+ "ARI TextMessageVariable has undocumented field %s\n",
+ ast_json_object_iter_key(iter));
+ res = 0;
+ }
+ }
+
+ if (!has_key) {
+ ast_log(LOG_ERROR, "ARI TextMessageVariable missing required field key\n");
+ res = 0;
+ }
+
+ if (!has_value) {
+ ast_log(LOG_ERROR, "ARI TextMessageVariable missing required field value\n");
+ res = 0;
+ }
+
+ return res;
+}
+
+ari_validator ast_ari_validate_text_message_variable_fn(void)
+{
+ return ast_ari_validate_text_message_variable;
}
int ast_ari_validate_caller_id(struct ast_json *json)
Modified: team/mjordan/12-messaging/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/res/ari/ari_model_validators.h?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/res/ari/ari_model_validators.h (original)
+++ team/mjordan/12-messaging/res/ari/ari_model_validators.h Fri Jul 18 11:00:32 2014
@@ -315,6 +315,24 @@
* See \ref ast_ari_model_validators.h for more details.
*/
ari_validator ast_ari_validate_text_message_fn(void);
+
+/*!
+ * \brief Validator for TextMessageVariable.
+ *
+ * A key/value pair variable in a text message.
+ *
+ * \param json JSON object to validate.
+ * \returns True (non-zero) if valid.
+ * \returns False (zero) if invalid.
+ */
+int ast_ari_validate_text_message_variable(struct ast_json *json);
+
+/*!
+ * \brief Function pointer to ast_ari_validate_text_message_variable().
+ *
+ * See \ref ast_ari_model_validators.h for more details.
+ */
+ari_validator ast_ari_validate_text_message_variable_fn(void);
/*!
* \brief Validator for CallerID.
@@ -1192,7 +1210,10 @@
* - body: string (required)
* - from: string (required)
* - to: string (required)
- * - variables: containers
+ * - variables: List[TextMessageVariable]
+ * TextMessageVariable
+ * - key: string (required)
+ * - value: string (required)
* CallerID
* - name: string (required)
* - number: string (required)
Modified: team/mjordan/12-messaging/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/res/res_pjsip.c?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/res/res_pjsip.c (original)
+++ team/mjordan/12-messaging/res/res_pjsip.c Fri Jul 18 11:00:32 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: team/mjordan/12-messaging/res/res_pjsip/pjsip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/res/res_pjsip/pjsip_configuration.c?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/res/res_pjsip/pjsip_configuration.c (original)
+++ team/mjordan/12-messaging/res/res_pjsip/pjsip_configuration.c Fri Jul 18 11:00:32 2014
@@ -1735,6 +1735,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");
Modified: team/mjordan/12-messaging/rest-api/api-docs/endpoints.json
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/rest-api/api-docs/endpoints.json?view=diff&rev=418912&r1=418911&r2=418912
==============================================================================
--- team/mjordan/12-messaging/rest-api/api-docs/endpoints.json (original)
+++ team/mjordan/12-messaging/rest-api/api-docs/endpoints.json Fri Jul 18 11:00:32 2014
@@ -229,6 +229,22 @@
}
}
},
+ "TextMessageVariable": {
+ "id": "TextMessageVariable",
+ "description": "A key/value pair variable in a text message.",
+ "properties": {
+ "key": {
+ "type": "string",
+ "description": "A unique key identifying the variable.",
+ "required": true
+ },
+ "value": {
+ "type": "string",
+ "description": "The value of the variable.",
+ "required": true
+ }
+ }
+ },
"TextMessage": {
"id": "TextMessage",
"description": "A text message.",
@@ -249,7 +265,7 @@
"required": true
},
"variables": {
- "type": "containers",
+ "type": "List[TextMessageVariable]",
"description": "Technology specific key/value pairs associated with the message.",
"required": false
}
More information about the asterisk-commits
mailing list