[OpenSIPS-Devel] ENUM module and optional partameters

Dan Pascu dan at ag-projects.com
Mon Apr 22 03:05:42 EDT 2019


After the refactoring of the enum module the signatures of the functions are inconsistent.

enum_query([number], [suffix], [service])
i_enum_query([suffix], [service])
isn_query([suffix], [service])

It would make sense to allow all of them to accept the same arguments.

On a different note, regarding optional parameters, I would suggest they are ordered in such a way that the most used ones go first and least used ones are at the end. Another consideration with them is to try to preserve backward compatibility, so that the script doesn't need to be modified everywhere.

In this particular example, I would move number to be last for the following reasons:

1. backward compatibility. previous code written like enum_query("e164.arpa") or enum_query("e164.arpa", "voice") still works without changes.

2. suffix is the most used parameter here, followed by service. number is the least used as most of the time the request uri is what we want.

3. calling functions like enum_query(, "e164.arpa") looks ugly. enum_query("e164.arpa", , $avp(enum_number)) while still not ideal, it looks more palatable.

--
Dan







More information about the Devel mailing list