[OpenSIPS-Devel] How to reject a SIP message from OpenSIPS core

Muhammad Shahzad Shafi shahzad at voip-demos.com
Tue Jul 23 05:48:37 CEST 2013


I am experimenting with some stuff, where i action.c in method 
run_top_route (immediately after variable declaration) i have added an 
IF condition, if that matches i want to reject SIP request e.g. with 403 
Forbidden.

I tried this code,

if(my_condition_is_true) {
     LM_CRIT("CRIT - Not going to process this message...");
     set_err_reply(403, "Forbidden");
     return EXIT_T;
}

But it does not work (though i can see log message after condition is 
matched), the message is silently dropped without sending 403 response 
first. If i remove the return statement and let it flow through rest of 
method, then message is processed according to opensips.cfg but still 
403 isn't received at client.

What am i doing wrong here? Is there any better approach (different 
file and/or different method) where i put my IF condition to drop 
matched packet. I want to do it in native code, NOT in opensips.cfg.

Thank you.


-- 
Mit freundlichen Grüßen
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +49 176 99 83 10 85
MSN: shari_786pk at hotmail.com
Email: shaheryarkh at googlemail.com



More information about the Devel mailing list