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)
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.