[asterisk-commits] kharwell: branch kharwell/pimp_sip_video r384586 - /team/kharwell/pimp_sip_vi...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 2 13:43:54 CDT 2013


Author: kharwell
Date: Tue Apr  2 13:43:50 2013
New Revision: 384586

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384586
Log:
on requests checks to see if a supplement exists and if so handles it

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

Modified: team/kharwell/pimp_sip_video/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/res/res_sip_session.c?view=diff&rev=384586&r1=384585&r2=384586
==============================================================================
--- team/kharwell/pimp_sip_video/res/res_sip_session.c (original)
+++ team/kharwell/pimp_sip_video/res/res_sip_session.c Tue Apr  2 13:43:50 2013
@@ -1203,6 +1203,20 @@
 
 	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
  *
@@ -1221,10 +1235,9 @@
  */
 static pj_bool_t session_on_rx_request(pjsip_rx_data *rdata)
 {
-	static const pjsip_method pjsip_info_method = {PJSIP_OTHER_METHOD, {"INFO", 4} };
-
 	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:
@@ -1235,14 +1248,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_info_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