Hello everyone,
I have a question regarding the usage of core keywords, specifically the possibility of printing their values in log messages. While I understand that core keywords such as 'dst_port' and 'af' etc... can be accessed directly in if conditions, I am interested to know if there is a way to print the values of these core keywords for logging purposes.
Thank you.
-------- Mensaje original -------- El 19/6/24 20:47, sadik.oualla.mohamed--- via sr-users sr-users@lists.kamailio.org ha escrito:
Hello everyone,
I have a question regarding the usage of core keywords, specifically the possibility of printing their values in log messages. While I understand that core keywords such as 'dst_port' and 'af' etc... can be accessed directly in if conditions, I am interested to know if there is a way to print the values of these core keywords for logging purposes.
Take a look over cfgt
https://www.kamailio.org/docs/modules/devel/modules/cfgt.html
Hello Victor,
I am impressed by how useful and helpful this module is. Thank you very much, I have tried it. It is very important to check the status of variables before and after a given route, as well as the SIP_IN and SIP_OUT messages.
I have configured the mask parameter with a value of 32. However, I still haven't received the core keyword values.
Thank you again, I really needed to know about this module.
Mohamed.
On 19 Jun 2024, at 20:47, sadik.oualla.mohamed--- via sr-users sr-users@lists.kamailio.org wrote:
Hello everyone,
I have a question regarding the usage of core keywords, specifically the possibility of printing their values in log messages. While I understand that core keywords such as 'dst_port' and 'af' etc... can be accessed directly in if conditions, I am interested to know if there is a way to print the values of these core keywords for logging purposes.
I think all of them exist as pseudovariables and can be found in the pv cookbook.
/O
Yes, the pv module has many useful pseudovariables, and many of the core keywords can be accessed through pv.
However, I am facing an issue with the source port of the SIP message. When I use $sp, it shows the source port of the transport layer, not the SIP application layer.
I want to explore other keywords to find the exact SIP application layer source port.
Regards, Mohamed.
Hello,
are you saying you are getting a different result when using:
- src_port, vs. - $sp
If not, please give more details what you are interested in.
Cheers,
Henning
-----Original Message----- From: sadik.oualla.mohamed--- via sr-users sr-users@lists.kamailio.org Sent: Donnerstag, 20. Juni 2024 14:07 To: sr-users@lists.kamailio.org Cc: sadik.oualla.mohamed@gmail.com Subject: [SR-Users] Re: Possibility to print values of Core Keywords in Kamailio configuration file
Yes, the pv module has many useful pseudovariables, and many of the core keywords can be accessed through pv.
However, I am facing an issue with the source port of the SIP message. When I use $sp, it shows the source port of the transport layer, not the SIP application layer.
I want to explore other keywords to find the exact SIP application layer source port.
Regards, Mohamed. __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
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.