<div dir="ltr"><div>Hello,</div><div><br></div><div>What will be the best way to save ISP Information in Kamailio memory?</div><div><br></div><div>I have the following information for each ISP into the DB:</div><div><br></div><div><b>ISP Name |  ISP IP  | ISP Username | ISP Password | ISP Prefix</b></div><div>ISP1          |  1.1.1.1 | user                  | pass                 | 1234<b><br></b></div><div><br></div><div>This info it's not changed/updated too often, so I want to avoid querying the DB on every call and get this info directly from the memory.</div><div><br></div><div>I was thinking to use htable for that, so I created a htable as an array for that and loaded all the information there manually, something like that:</div><div><br></div><div><b>kamcmd htable.sets isp ISP1[address] 1.1.1.1</b></div><div><b>
kamcmd htable.sets isp ISP1[username] user</b></div><div><b>
kamcmd htable.sets isp ISP1[password] pass</b></div><div><b>
kamcmd htable.sets isp ISP1[prefix] 1234 <br></b></div><div><b><br></b></div><div><b>$sht(
isp 

=>
ISP1[address]) == "1.1.1.1"</b></div><div><b>
$sht(
isp 

=>
ISP1[username]) == "user" <br></b></div><div><b>
$sht(
isp 

=>
ISP1[password]) == "pass" <br></b></div><div><b>
$sht(
isp 

=>
ISP1[prefix]) == "1234"
</b>
</div><div><br></div><div>So far so good, I'm able to get this information from the htable and use it whenever I need it.</div><div>Now, the problem comes when I want to load all this information automatically from the DB. How can I setup htable module to get the array key (address, username...) from the database automatically on server restart, and append this array_key to the column value?</div><div><br></div><div>I've tried this way: <br></div><div>

<div style="color:rgb(171,178,191);background-color:rgb(40,44,52);font-family:"Fira Code",Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(198,120,221)">modparam</span><span style="color:rgb(171,178,191)">(</span><span style="color:rgb(152,195,121)">"htable"</span><span style="color:rgb(171,178,191)">, </span><span style="color:rgb(152,195,121)">"htable"</span><span style="color:rgb(171,178,191)">, </span><span style="color:rgb(152,195,121)">"isp=>size=8;dbtable=isp;cols='trunk_name[address],trunk_address'"</span><span style="color:rgb(171,178,191)">)</span></div></div>

</div><div><br></div><div>But it's not working unfortunately, getting back this error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '[address]'</div><div><br></div><div>If I'm setting this way:<br></div><div>

<div style="color:rgb(171,178,191);background-color:rgb(40,44,52);font-family:"Fira Code",Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(198,120,221)">modparam</span><span style="color:rgb(171,178,191)">(</span><span style="color:rgb(152,195,121)">"htable"</span><span style="color:rgb(171,178,191)">, </span><span style="color:rgb(152,195,121)">"htable"</span><span style="color:rgb(171,178,191)">, </span><span style="color:rgb(152,195,121)">"isp=>size=8;dbtable=isp;cols='trunk_name,trunk_address'"</span><span style="color:rgb(171,178,191)">)</span></div></div>

</div><div><br></div><div>and setting trunk_name value to: ISP1[address], then it's working fine, but in this case I will have to create by one column for each array key, which may be confusing and it's a lot of unnecessarily information into the DB.</div><div>Is it possible to do that, or better to trigger a script on each restart which will load this information from the DB into htable?</div><div>Thanks<br></div><div><br></div><div><b></b>

</div></div>