<div dir="ltr">thanks - that's really helpful</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 16 Nov 2020 at 18:13, Ovidiu Sas <<a href="mailto:osas@voipembedded.com">osas@voipembedded.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Use the sql_cacher module to cache the content of the file.<br>
First, declare the cache that you want to use, then configure the<br>
sql_cacher to use the file:<br>
loadmodule "cachedb_local.so"<br>
modparam("cachedb_local", "cache_collections", "my_cache")<br>
modparam("cachedb_local", "cachedb_url", "local:///my_cache")<br>
loadmodule "sql_cacher.so"<br>
modparam("sql_cacher", "cache_table",<br>
"id=my_cache_id<br>
db_url=text:///tmp/opensipsdb<br>
cachedb_url=local:///my_cache<br>
table=my_table<br>
key=my_key<br>
columns=my_value<br>
on_demand=0")<br>
<br>
Or you can simply use the avpops module directly on the db_text file.<br>
<br>
-ovidiu<br>
<br>
<a href="https://opensips.org/docs/modules/3.1.x/cachedb_local.html" rel="noreferrer" target="_blank">https://opensips.org/docs/modules/3.1.x/cachedb_local.html</a><br>
<a href="https://opensips.org/docs/modules/3.1.x/sql_cacher.html" rel="noreferrer" target="_blank">https://opensips.org/docs/modules/3.1.x/sql_cacher.html</a><br>
<a href="https://opensips.org/docs/modules/3.1.x/avpops.html" rel="noreferrer" target="_blank">https://opensips.org/docs/modules/3.1.x/avpops.html</a><br>
<br>
On Sun, Nov 15, 2020 at 9:49 AM Mark Allen <<a href="mailto:mark@allenclan.co.uk" target="_blank">mark@allenclan.co.uk</a>> wrote:<br>
><br>
> Being a bit dense here - the documentation says to set modparams like...<br>
><br>
> modparam("usrloc|auth_db", "db_url", "text:///tmp/opensipsdb")<br>
><br>
> ...if I'm using a separate table with our specific info rather than, say, usrloc - what am I putting in as the module name?<br>
><br>
> On Fri, 13 Nov 2020 at 16:39, Maxim Sobolev <<a href="mailto:sobomax@sippysoft.com" target="_blank">sobomax@sippysoft.com</a>> wrote:<br>
>><br>
>> Who doubted it?! I personally think db_text is absolutely brilliant, cuts devtesting effort 10x easily.<br>
>><br>
>> -Max<br>
>><br>
>> On Fri., Nov. 13, 2020, 7:31 a.m. johan, <<a href="mailto:johan@democon.be" target="_blank">johan@democon.be</a>> wrote:<br>
>>><br>
>>> And so is the usefulness of db_text proven :-)<br>
>>><br>
>>> On 13/11/2020 16:06, Ovidiu Sas wrote:<br>
>>><br>
>>> Take a look at db_text and sql_cacher modules!<br>
>>><br>
>>> Regards,<br>
>>> Ovidiu Sas<br>
>>><br>
>>> On Fri, Nov 13, 2020 at 09:50 Mark Allen <<a href="mailto:mark@allenclan.co.uk" target="_blank">mark@allenclan.co.uk</a>> wrote:<br>
>>>><br>
>>>> Just would like to consult the hive mind. I want to read the contents of a multi-line text file to be used by my OpenSIPS config. Ideally, I'll get a key:value CSV pair from the file and store each pair in memcache - e.g.<br>
>>>><br>
>>>> file contains:<br>
>>>><br>
>>>> a, 113<br>
>>>> b, 214<br>
>>>> c, 771<br>
>>>><br>
>>>> read it in line by line and cache_store() with the letter as the attribute and the number as the value.<br>
>>>><br>
>>>> I was thinking that I could use exec() to 'cat' the contents of the file, storing stdout in an AVP, and then work through that array splitting letter and number with a string transformation ready for cache_store(). However, if I do this the full file contents are stored as a single string in the first value with "#012" added in place of the new lines.<br>
>>>><br>
>>>> Obviously, I can use a string transform s.select{} using #012 as a delimiter in an intermediary step, but am I just doing this the hard way? Is there a better way to achieve this?<br>
>>>> _______________________________________________<br>
>>>> Users mailing list<br>
>>>> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
>>>> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
>>><br>
>>> --<br>
>>> VoIP Embedded, Inc.<br>
>>> <a href="http://www.voipembedded.com" rel="noreferrer" target="_blank">http://www.voipembedded.com</a><br>
>>><br>
>>> _______________________________________________<br>
>>> Users mailing list<br>
>>> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
>>> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
>>><br>
>>> _______________________________________________<br>
>>> Users mailing list<br>
>>> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
>>> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
>><br>
>> _______________________________________________<br>
>> Users mailing list<br>
>> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
>> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
<br>
<br>
-- <br>
VoIP Embedded, Inc.<br>
<a href="http://www.voipembedded.com" rel="noreferrer" target="_blank">http://www.voipembedded.com</a><br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>