Re: [OpenSIPS-Users] Registrar - max_contacts and 503 logging
Hello, Ok, thanks. Regards, Adrien Martin ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Registrar - max_contacts and 503 logging
Hello, OK, thanks for testing - I will push the fix I did in the public code. I will also give a bit more thinking to see what should be the best solution to expose the internal error. Regards, Bogdan-Andrei Iancu OpenSIPS Founder and Developer http://www.opensips-solutions.com On 10.02.2014 18:29, Adrien Martin wrote: Hello, I tested it, and it works. About the save() return codes, there are a lot of cases, so I would have sorted it this way: - no error, - error codes in parsing SIP, - server side errors (like manipulating usrloc), - and service errors (like too many registers). Here is a patch by way of example, but I can't say if it's the right way to do. Regards, ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Registrar - max_contacts and 503 logging
Hello, I tested it, and it works. About the save() return codes, there are a lot of cases, so I would have sorted it this way: - no error, - error codes in parsing SIP, - server side errors (like manipulating usrloc), - and service errors (like too many registers). Here is a patch by way of example, but I can't say if it's the right way to do. Regards, -- Adrien Martin diff --git a/modules/registrar/save.c b/modules/registrar/save.c index 63e2d4d..9c0b2cf 100644 --- a/modules/registrar/save.c +++ b/modules/registrar/save.c @@ -816,7 +816,42 @@ error: if (forced_c) free_contacts(&forced_c); - return 0; + switch (rerrno) { +case R_FINE: +case R_OOO: +case R_RETRANS: + return 0; +case R_TOO_MANY: + return -2; /* Account errors */ +case R_INV_CSEQ: +case R_TO_USER: +case R_AOR_PARSE: +case R_INV_EXP: +case R_INV_Q: +case R_PARSE: +case R_TO_MISS: +case R_CID_MISS: +case R_CS_MISS: +case R_PARSE_EXP: +case R_PARSE_CONT: +case R_STAR_EXP: +case R_STAR_CONT: +case R_UNESCAPE: +case R_CONTACT_LEN: +case R_CALLID_LEN: +case R_PARSE_PATH: +case R_PATH_UNSUP: + return -3; /* UAC's SIP errors */ +case R_UL_DEL_R: +case R_UL_GET_R: +case R_UL_NEW_R: +case R_UL_INS_C: +case R_UL_INS_R: +case R_UL_DEL_C: +case R_UL_UPD_C: +case R_AOR_LEN: + return -4; /* Server side errors */ + } return_minus_one: if (forced_c) free_contacts(&forced_c); signature.asc Description: OpenPGP digital signature ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Registrar - max_contacts and 503 logging
Hello, Try the attached patch for preventing save() to stop your script. In regards to the error itself, $err is not suitable for that. The idea will be to have save() returning detailed negative codes to reflect the actual internal error. Regards, Bogdan-Andrei Iancu OpenSIPS Founder and Developer http://www.opensips-solutions.com On 08.02.2014 11:14, Martin Adrien wrote: Hello, On 07/02/2014 21:00, Bogdan-Andrei Iancu wrote: Hello, Not sure a bug or an undocumented feature, but save() function, in case of internal error, is stopping the script. Assuming we change that (to continue the script execution), you will failure from "save()" without actually knowing the error itself. I assume you are looking the error code/reason, right ? That's right, the code/reason is quite useful. But if it can not be known, maybe can I get the sip status sent by Opensis, with $err.rcode for example. Regards, Bogdan-Andrei Iancu OpenSIPS Founder and Developer http://www.opensips-solutions.com Regards, Adrien Martin ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users diff --git a/modules/registrar/save.c b/modules/registrar/save.c index c2a88fa..7e9daec 100644 --- a/modules/registrar/save.c +++ b/modules/registrar/save.c @@ -876,7 +876,7 @@ error: if (forced_c) free_contacts(&forced_c); - return 0; + return -2; return_minus_one: if (forced_c) free_contacts(&forced_c); ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Registrar - max_contacts and 503 logging
Hello, On 07/02/2014 21:00, Bogdan-Andrei Iancu wrote: > Hello, > > Not sure a bug or an undocumented feature, but save() function, in case > of internal error, is stopping the script. > > Assuming we change that (to continue the script execution), you will > failure from "save()" without actually knowing the error itself. I > assume you are looking the error code/reason, right ? That's right, the code/reason is quite useful. But if it can not be known, maybe can I get the sip status sent by Opensis, with $err.rcode for example. > Regards, > > Bogdan-Andrei Iancu > OpenSIPS Founder and Developer > http://www.opensips-solutions.com Regards, Adrien Martin ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] Registrar - max_contacts and 503 logging
Hello, Not sure a bug or an undocumented feature, but save() function, in case of internal error, is stopping the script. Assuming we change that (to continue the script execution), you will failure from "save()" without actually knowing the error itself. I assume you are looking the error code/reason, right ? Regards, Bogdan-Andrei Iancu OpenSIPS Founder and Developer http://www.opensips-solutions.com On 07.02.2014 17:38, Adrien Martin wrote: Hello, In the registrar module I set the max_contacts parameter. Save function work as expected, but I did not manage to log the 503 status when max contacts is reached. It seems configuration after save function is not used by Opensips in this case. Is this an expected behavior and could I log the 503 in this way or another ? PS: I found an appropriate log at INFO level, but at the moment I would rather keep NOTICE level. Indeed I could use INFO level if there is no other way to check save function's return. PS2: Opensips version is 1.8.0. Regards, Adrien Martin ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users