diff options
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip.c | 8 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_configuration.c | 1 | ||||
-rw-r--r-- | res/res_pjsip_messaging.c | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c index 3ef203f85..3ff60ee5b 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -685,6 +685,14 @@ multiple 'set_var'(s). </para></description> </configOption> + <configOption name="message_context"> + <synopsis>Context to route incoming MESSAGE requests to.</synopsis> + <description><para> + 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> </configObject> <configObject name="auth"> <synopsis>Authentication type</synopsis> diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index 1f289ade9..164ca4a0e 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -1723,6 +1723,7 @@ int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_mod ast_sorcery_object_field_register(sip_sorcery, "endpoint", "srtp_tag_32", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.srtp_tag_32)); 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)); if (ast_sip_initialize_sorcery_transport()) { ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n"); diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c index 0f884aeda..07d207bdb 100644 --- a/res/res_pjsip_messaging.c +++ b/res/res_pjsip_messaging.c @@ -464,13 +464,14 @@ static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct as const char *field; pjsip_status_code code; struct ast_sip_endpoint *endpt = ast_pjsip_rdata_get_endpoint(rdata); + const char *context = S_OR(endpt->message_context, endpt->context); /* make sure there is an appropriate context and extension*/ - if ((code = get_destination(rdata, endpt->context, buf)) != PJSIP_SC_OK) { + if ((code = get_destination(rdata, context, buf)) != PJSIP_SC_OK) { return code; } - CHECK_RES(ast_msg_set_context(msg, "%s", endpt->context)); + CHECK_RES(ast_msg_set_context(msg, "%s", context)); CHECK_RES(ast_msg_set_exten(msg, "%s", buf)); /* to header */ |