Hello kamailio lovers,

I am currently working on a Kamailio configuration where I need to check the 
source port of incoming SIP messages. Initially, I used the $sp pseudo-variable 
to get the source port, which worked perfectly while testing with SIPp.
Here is the snippets code that I use
"
if ($sp != 5080 && $sp != 8080 && $sp != 5060){
        sl_send_reply(403, "forbidden");
        xlog("this $rm received, is forbidden\n");
        exit;
    }
"
 However, I encountered an issue when I switched to using sipsak for testing.

It seems that sipsak uses a randomly assigned port for the actual network 
connection, even though it sets the source port in the SIP headers (e.g., Via, 
To and Contact headers) to a specified port using the -l option.
Here is the sipsak command that I use "sipsak -vv -s 
sip:jack@192.168.1.2:5060-l 5080"

My goal is to have Kamailio check the source port as specified in the 
application layer, rather than the transport layer port (i.e., the ephemeral 
port assigned by the OS randomly like 54691, 33017...).

Could anyone guide me on how to properly configure Kamailio to extract and 
check the port from the application layer or SIP headers, or am I doing this in 
the wrong way? Any advice or examples would be greatly appreciated.

"I am not a native english speak, so I use chatGPT to make my questions clear" 

Thank you!
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to