[svn-commits] mmichelson: trunk r411158 - in /trunk: ./ include/asterisk/ res/ res/res_pjsip/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 25 12:40:57 CDT 2014


Author: mmichelson
Date: Tue Mar 25 12:40:51 2014
New Revision: 411158

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411158
Log:
Add a "message_context" option for PJSIP endpoints.
........

Merged revisions 411157 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/UPGRADE.txt
    trunk/include/asterisk/res_pjsip.h
    trunk/res/res_pjsip.c
    trunk/res/res_pjsip/pjsip_configuration.c
    trunk/res/res_pjsip_messaging.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/trunk/UPGRADE.txt?view=diff&rev=411158&r1=411157&r2=411158
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Tue Mar 25 12:40:51 2014
@@ -26,6 +26,9 @@
    REGISTER requests for each contact that is registered. If using realtime for
    PJSIP contacts, this means that the schema has been updated to add a user_agent
    column. An alembic revision has been added to facilitate this update.
+ 
+ - PJSIP endpoints now have a "message_context" option that can be used to determine
+   where to route incoming MESSAGE requests from the endpoint.
 
 Realtime Configuration:
  - PJSIP endpoint columns 'tos_audio' and 'tos_video' have been changed from yes/no

Modified: trunk/include/asterisk/res_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/res_pjsip.h?view=diff&rev=411158&r1=411157&r2=411158
==============================================================================
--- trunk/include/asterisk/res_pjsip.h (original)
+++ trunk/include/asterisk/res_pjsip.h Tue Mar 25 12:40:51 2014
@@ -562,6 +562,8 @@
 		AST_STRING_FIELD(fromuser);
 		/*! Domain to place in From header */
 		AST_STRING_FIELD(fromdomain);
+		/*! Context to route incoming MESSAGE requests to */
+		AST_STRING_FIELD(message_context);
 	);
 	/*! 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=411158&r1=411157&r2=411158
==============================================================================
--- trunk/res/res_pjsip.c (original)
+++ trunk/res/res_pjsip.c Tue Mar 25 12:40:51 2014
@@ -683,6 +683,14 @@
 					        When a new channel is created using the endpoint set the specified
 						variable(s) on that channel. For multiple channel variables specify
 						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>

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=411158&r1=411157&r2=411158
==============================================================================
--- trunk/res/res_pjsip/pjsip_configuration.c (original)
+++ trunk/res/res_pjsip/pjsip_configuration.c Tue Mar 25 12:40:51 2014
@@ -1723,6 +1723,7 @@
 	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");

Modified: trunk/res/res_pjsip_messaging.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_messaging.c?view=diff&rev=411158&r1=411157&r2=411158
==============================================================================
--- trunk/res/res_pjsip_messaging.c (original)
+++ trunk/res/res_pjsip_messaging.c Tue Mar 25 12:40:51 2014
@@ -464,13 +464,14 @@
 	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 */




More information about the svn-commits mailing list