[asterisk-commits] kharwell: branch kharwell/pimp_my_sip r384594 - /team/kharwell/pimp_my_sip/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 2 15:48:41 CDT 2013


Author: kharwell
Date: Tue Apr  2 15:48:38 2013
New Revision: 384594

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384594
Log:
check supplements for other message type handling for a session

Modified:
    team/kharwell/pimp_my_sip/res/res_sip_session.c

Modified: team/kharwell/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/res/res_sip_session.c?view=diff&rev=384594&r1=384593&r2=384594
==============================================================================
--- team/kharwell/pimp_my_sip/res/res_sip_session.c (original)
+++ team/kharwell/pimp_my_sip/res/res_sip_session.c Tue Apr  2 15:48:38 2013
@@ -1196,6 +1196,21 @@
 
 	handle_incoming_request(session, rdata);
 }
+
+static int has_supplement(struct ast_sip_session *session, pjsip_rx_data *rdata)
+{
+	struct ast_sip_session_supplement *supplement;
+	
+	struct pjsip_method *method = &rdata->msg_info.msg->line.req.method;
+
+	AST_LIST_TRAVERSE(&session->supplements, supplement, next) {
+		if (supplement->method && !pj_strcmp2(&method->name, supplement->method)) {
+			return PJ_TRUE;
+		}
+	}
+	return PJ_FALSE;
+}
+
 /*!
  * \brief Called when a new SIP request comes into PJSIP
  *
@@ -1214,10 +1229,9 @@
  */
 static pj_bool_t session_on_rx_request(pjsip_rx_data *rdata)
 { 
-	static const pjsip_method pjsip_message_method = {PJSIP_OTHER_METHOD, {"MESSAGE", 7} };
-
 	pj_status_t handled = PJ_FALSE;
 	pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
+	pjsip_inv_session *inv_session;
 
 	switch (rdata->msg_info.msg->line.req.method.id) {
 	case PJSIP_INVITE_METHOD:
@@ -1228,14 +1242,10 @@
 		handled = PJ_TRUE;
 		handle_new_invite_request(rdata);
 		break;
-	case PJSIP_OTHER_METHOD:
-		/* Area for INFO and REFER, possibly other methods */
-		if (dlg && pjsip_dlg_get_inv_session(dlg) &&
-		    !pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_message_method)) {
-			return PJ_TRUE;
-		}
-		break;
 	default:
+		/* Handle other in-dialog methods if their supplements have been registered */
+		handled = dlg && (inv_session = pjsip_dlg_get_inv_session(dlg)) &&
+			has_supplement(rdata, inv_session->mod_data[session_module.id]);
 		break;
 	}
 




More information about the asterisk-commits mailing list