summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-07-02 14:18:47 +0000
committerBenny Prijono <bennylp@teluu.com>2006-07-02 14:18:47 +0000
commita293625a363645b1d9b1eaede805526ec64c8c64 (patch)
tree553d4e652502c80082d2ec63ca5db8d0a1599674
parentddd1da862bcdb019a518991245c1deed6d18c1ab (diff)
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
-rw-r--r--pjsip-apps/src/samples/siprtp.c29
1 files changed, 28 insertions, 1 deletions
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 */