[asterisk-commits] mmichelson: branch mmichelson/sip_options r394217 - in /team/mmichelson/sip_o...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 12 15:06:48 CDT 2013


Author: mmichelson
Date: Fri Jul 12 15:06:46 2013
New Revision: 394217

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394217
Log:
Add "mwifromuser" option.


Modified:
    team/mmichelson/sip_options/include/asterisk/res_sip.h
    team/mmichelson/sip_options/res/res_sip.c
    team/mmichelson/sip_options/res/res_sip/sip_configuration.c
    team/mmichelson/sip_options/res/res_sip_mwi.c

Modified: team/mmichelson/sip_options/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/include/asterisk/res_sip.h?view=diff&rev=394217&r1=394216&r2=394217
==============================================================================
--- team/mmichelson/sip_options/include/asterisk/res_sip.h (original)
+++ team/mmichelson/sip_options/include/asterisk/res_sip.h Fri Jul 12 15:06:46 2013
@@ -343,6 +343,8 @@
 		AST_STRING_FIELD(sdpsession);
 		/*! Default username to place in From header */
 		AST_STRING_FIELD(fromuser);
+		/*! Username to use when sending MWI NOTIFYs to this endpoint */
+		AST_STRING_FIELD(mwi_from);
 	);
 	/*! Identification information for this endpoint */
 	struct ast_party_id id;
@@ -1091,13 +1093,15 @@
  * \param endpoint Optional. If specified, the request will be created out-of-dialog
  * to the endpoint.
  * \param uri Optional. If specified, the request will be sent to this URI rather
+ * this value.
  * than one configured for the endpoint.
  * \param[out] tdata The newly-created request
  * \retval 0 Success
  * \retval -1 Failure
  */
 int ast_sip_create_request(const char *method, struct pjsip_dialog *dlg,
-		struct ast_sip_endpoint *endpoint, const char *uri, pjsip_tx_data **tdata);
+		struct ast_sip_endpoint *endpoint, const char *uri,
+		pjsip_tx_data **tdata);
 
 /*!
  * \brief General purpose method for sending a SIP request

Modified: team/mmichelson/sip_options/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip.c?view=diff&rev=394217&r1=394216&r2=394217
==============================================================================
--- team/mmichelson/sip_options/res/res_sip.c (original)
+++ team/mmichelson/sip_options/res/res_sip.c Fri Jul 12 15:06:46 2013
@@ -467,6 +467,12 @@
 				<configOption name="subminexpiry" default="60">
 					<synopsis>The minimum allowed expiry time for subscriptions initiated by the endpoint.</synopsis>
 				</configOption>
+				<configOption name="fromuser">
+					<synopsis>Username to use in From header for requests to this endpoint.</synopsis>
+				</configOption>
+				<configOption name="mwifromuser">
+					<synopsis>Username to use in From header for unsolicited MWI NOTIFYs to this endpoint.</synopsis>
+				</configOption>
 			</configObject>
 			<configObject name="auth">
 				<synopsis>Authentication type</synopsis>
@@ -1273,7 +1279,8 @@
 }
 
 int ast_sip_create_request(const char *method, struct pjsip_dialog *dlg,
-		struct ast_sip_endpoint *endpoint, const char *uri, pjsip_tx_data **tdata)
+		struct ast_sip_endpoint *endpoint, const char *uri,
+		pjsip_tx_data **tdata)
 {
 	const pjsip_method *pmethod = get_pjsip_method(method);
 

Modified: team/mmichelson/sip_options/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip/sip_configuration.c?view=diff&rev=394217&r1=394216&r2=394217
==============================================================================
--- team/mmichelson/sip_options/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/sip_options/res/res_sip/sip_configuration.c Fri Jul 12 15:06:46 2013
@@ -674,6 +674,7 @@
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subminexpiry", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subminexpiry));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subminexpirey", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subminexpiry));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fromuser", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, fromuser));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mwifromuser", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, mwi_from));
 
 	if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
 		ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");

Modified: team/mmichelson/sip_options/res/res_sip_mwi.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip_mwi.c?view=diff&rev=394217&r1=394216&r2=394217
==============================================================================
--- team/mmichelson/sip_options/res/res_sip_mwi.c (original)
+++ team/mmichelson/sip_options/res/res_sip_mwi.c Fri Jul 12 15:06:46 2013
@@ -281,6 +281,14 @@
 		return 0;
 	}
 
+	if (!ast_strlen_zero(endpoint->mwi_from)) {
+		pjsip_fromto_hdr *from = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_FROM, NULL);
+		pjsip_name_addr *from_name_addr = (pjsip_name_addr *) from->uri;
+		pjsip_sip_uri *from_uri = pjsip_uri_get_uri(from_name_addr->uri);
+
+		pj_strdup2(tdata->pool, &from_uri->user, endpoint->mwi_from);
+	}
+
 	switch (state) {
 	case PJSIP_EVSUB_STATE_ACTIVE:
 		state_name = "active";




More information about the asterisk-commits mailing list