From a293625a363645b1d9b1eaede805526ec64c8c64 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sun, 2 Jul 2006 14:18:47 +0000 Subject: Added INVITE request verification in siprtp before incoming call is established git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@573 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/samples/siprtp.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c index 8e761ba2..7e8168a2 100644 --- a/pjsip-apps/src/samples/siprtp.c +++ b/pjsip-apps/src/samples/siprtp.c @@ -566,7 +566,7 @@ static pj_status_t make_call(const pj_str_t *dst_uri) */ 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 @@ static void process_incoming_call(pjsip_rx_data *rdata) 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 */ -- cgit v1.2.3