New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDB module prefixes #433
Comments
Hi Igor, Looking at the kamailio pdb module code I can see that it should work well for prefixes smaller than the MAX_SHORT_INT= 32767 = 2^15-1 because:
Also I think you should try:
Also the utils/pdbt/pdb_server.c is using the same int16_t for carrierid. This can be an idea of enhancing the kamailio pdb module to be able to set the number of prefix digits via modparam (and use uint32_t for carrierid). |
Hi, Yes sorry, I had:
Good point, I think you are right about the int16 limitation, I will try and let you know hank you very much. |
Where did you find :
In dt.h I only see:
|
I have now made the following changes: pdbt.c:
common.h:
I still get no answer for prefixes bigger than 32767. I have a server with only this two lines :
The results of 2 querys are:
|
The changes are not trivial. You have to change to uint_32 in all the places where int_16 is used (or short int) for the carrierid, in order to avoid conversion. This implies changes to both pdb client (kamailio pdb module) and pdb server(see utils/pdbt folder). Also have a look on the comunication protocol between pdb server<->client (see utils/pdbt/docs/network_protocol.txt) |
I have made some progress, I can reach now 65535. I have no pdb client module running now, it's just the server and I am testing with pdbt:
Now I have changed the int16_t to uint32_t and the short int to uint32_t also but I get the same result eventhough is unsigned: pdbt.c:
common.h:
My server has only this two lines :
The results of 2 querys are:
Should I change all the int to uint32_t? |
You should try have a look in pdbt.c, query_udp():
You should try have a look in pdb_server.c, udp_server():
Try to change all the short int related to the carrier id to uint32_t (or unsigned int). |
Thank you very much!!! That solved my issue :) |
I'm glad I could help. If you consider extending the kamailio pdb module to make the length of the prefix configurable(e.g. via modparam) just make a pull request for it. |
Hi all,
I had configured my pdb module to accept 5 number prefixes by modifying:
In pdbt.c:
And in common.h:
And i hadn't had any problem until now. I had rows in my .csv like:
0645052050;10122
And it worked. The problem I have now is with prefixes bigger than 40000. I get segmentation fault when doiong a query with pdbt, however the pdbt build works good without any error.
At first i thought of a buffer problem but eventhough testing with a .csv of 2 rows with 50000 prefixes will not work. Another curious effect is that for a prefix like 84238 the server changes the answer to 18754. I dont know why...
Could anyone help me please?
Thanks.
The text was updated successfully, but these errors were encountered: