Re: Question about how $rc works
Henning Westerholt via sr-users <[email protected]>
| Newsgroups | gmane.comp.voip.ser |
|---|---|
| Message-ID | <DB5PR07MB9453BAD1865E69F92CBEDAE7BF73A@DB5PR07MB9453.eurprd07.prod.outlook.com> |
Hello, I think both statements should be work similar. There used to be some special cases regarding evaluation of function return values in if-statements, but this is not the case you are referring to below. I have not tested it if this is still the case. It was discussed e.g. here https://kamailio.org/mailman3/hyperkitty/list/[email protected]/thread/ZBSKUC3K76DWETUVGHIC3QO235TCNCYH/ Cheers, Henning From: Joel Serrano via sr-users <[email protected]> Sent: Donnerstag, 12. Juni 2025 21:26 To: Kamailio (SER) - Users Mailing List <[email protected]> Cc: Joel Serrano <[email protected]> Subject: [SR-Users] Re: Question about how $rc works Hi All, Just to add some context to my previous question: I'm trying to understand the difference between assigning the return value of a function to a variable directly vs assigning the “$rc” value to a variable after the function has run. Rereading my initial email, I hope this makes my question clearer 🤣🤣 Thanks again, Joel On Wed, Jun 11, 2025 at 16:46 Joel Serrano <[email protected]<mailto:[email protected]>> wrote: Hi All, I have a simple doubt: are these snippets the same? One: secf_check_country($hdr(X-SRC-IP-CC)); $var(secf_cc_rc) = $rc; if ($var(secf_cc_rc) == -2) { ... Two: $var(secf_cc_rc) = secf_check_country($hdr(X-SRC-IP-CC)); if ($var(secf_cc_rc) == -2) { ... They both seem to work, the docs say to use option -one-. In case they do the same, is there a reason I should pick one over the other? Or is this purely cosmetic? Thanks, Joel. __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!