Added INVITE request verification in siprtp before incoming call is established

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@573 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c
index 8e761ba..7e8168a 100644
--- a/pjsip-apps/src/samples/siprtp.c
+++ b/pjsip-apps/src/samples/siprtp.c
@@ -566,7 +566,7 @@
  */
 static void process_incoming_call(pjsip_rx_data *rdata)
 {
-    unsigned i;
+    unsigned i, options;
     struct call *call;
     pjsip_dialog *dlg;
     pjmedia_sdp_session *sdp;
@@ -587,6 +587,33 @@
 	return;
     }
 
+    /* Verify that we can handle the request. */
+    options = 0;
+    status = pjsip_inv_verify_request(rdata, &options, NULL, NULL,
+				      app.sip_endpt, &tdata);
+    if (status != PJ_SUCCESS) {
+
+	/*
+	 * No we can't handle the incoming INVITE request.
+	 */
+
+	if (tdata) {
+	    pjsip_response_addr res_addr;
+
+	    pjsip_get_response_addr(tdata->pool, rdata, &res_addr);
+	    pjsip_endpt_send_response(app.sip_endpt, &res_addr, tdata, 
+				      NULL, NULL);
+
+	} else {
+
+	    /* Respond with 500 (Internal Server Error) */
+	    pjsip_endpt_respond_stateless(app.sip_endpt, rdata, 500, NULL,
+					  NULL, NULL);
+	}
+
+	return;
+    } 
+
     call = &app.call[i];
 
     /* Create UAS dialog */