Hello Henning,
Thank you for your reply.
I am using sipsak for testing purposes and learn more about Kamailio, I was using SIPp fine before. My goal is to identify the source port from the User Agent Client (UAC). Here is the command I use in sipsak to send an OPTIONS ping request: ```sipsak -s sip:proxy_server@33.33.33.4:5060 -l 5060``` the -l flag to identify the source port.
In my Kamailio configuration file, I perform a basic check like this: ``` if ($sp != 5040 && $sp != 5060) { sl_send_reply(403, "Forbidden"); xlog("this $rm received, is forbidden\n"); exit; } ``` When my Kamailio server receives the OPTIONS request from sipsak, it sends a 403 error response. Using sngrep, I observed the following: ``` SIP From= sipsak@33.33.33.99:5060 SIP To= proxy_server@33.33.33.4:5060 Source: 33.33.33.99:36593 Destination: 33.33.33.4:5060 ```
However, the source port appears to be random (36593 in this case) rather than the expected 5060. This leads me to believe that Kamailio checks the source port from the transport layer (I am not certain about this). The $sp value in this case is 36593, not 5060.
I tried several ways to force sipsak to send the packet from port 5060, but I couldn't achieve this. While sipsak correctly sets the number port 5060 in the From and Via headers, it seems to use a random source port at the transport layer.
Cheers, Mohamed.