<p>Hi Igor,</p>

<p>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:</p>

<pre><code>typedef int16_t carrier_t;
...
struct dt_node_t {
    struct dt_node_t *child[10];
    carrier_t carrier;
};
</code></pre>

<p>Also I think you should try:</p>

<pre><code>bufsize = slen + 1 + 1 + *5* + 1 + 1; // instead of your "+ 4"
</code></pre>

<p>Also the utils/pdbt/pdb_server.c is using the same int16_t for carrierid.</p>

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

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/kamailio/kamailio/issues/433#issuecomment-162839566">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZY21JS_XIZAHIxXQc1t-ym8kbCTBks5pNqS_gaJpZM4Gw2Iw.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/433#issuecomment-162839566"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>