mtree.h defines MT_MAX_DEPTH as 32 and the tprefix database table field is defined as a varchar(32) but the module fails to start if a prefix of 32 characters is present in the database table mapped to the mtree. The error message on start is:
0(10465) ERROR: mtree [mtree.c:156]: mt_add_to_tree(): max prefix len exceeded 0(10465) ERROR: mtree [mtree_mod.c:603]: mt_load_db(): Error adding info to tree
To reproduce do the following:
Kamailio script: ``` loadmodule "mtree.so" modparam("mtree", "db_url", DBURL) modparam("mtree", "mtree", "name=mtree;dbtable=mtree;type=0;multi=0") modparam("mtree", "char_list", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+-.") ```
MySQL: (create a table called mtree per the code in utils/kamctl/mysql/mtree-create.sql) ```sql insert into mtree values (1, '12345678901234567890123456789012', 'foo', 'bar', current_timestamp, 'baz'); ```
Start kamailio and observe that it fails to start. Enable debugging to see the error messages specified above.
Changing the tprefix to '1234567890123456789012345678901' makes Kamailio start successfully.
I propose a fix would entail making Kamailio support prefixes of 32 characters since we then can use GUIDs/UUIDs as "prefixes" without alteration and also adding to the mtree documentation that the maximum prefix length is 32 characters. Another fix would be to let the mtree code be but change the table creation scripts under utils/kamctl/ to create the tprefix field as varchar(31) (and add info about the constraint to the documentation).
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/179
I propose a fix would entail making Kamailio support prefixes of 32 characters since we then can use GUIDs/UUIDs as "prefixes" without alteration
GUIDs/UUIDs with the hyphens removed that is.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/179#issuecomment-107361554
Closed #179.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/179#event-321192374
I changed the internal limit to 64, which is 63 chars + ending 0 -- added relevant info to docs. The database definition stays with lower size, can be increased by need.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/179#issuecomment-108385863
Thank you very much!
The issue was fixed through the following commits: * 47086a4ee0a6ee6a766d7591e91e5663acf31562 * 74fadc549929d3dc873ce3b8b1db20559562ab54 * c36b93f61a7fe76321aab8e62e1bbeee5122c5ed
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/179#issuecomment-108391775