<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Hi, Sasmita!</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 02.12.2020 11:19, Sasmita Panda
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CALf-Q45DCSjFoggX8im+EKOk3+DdWHsEWLC1iBmz2U70y_8U6w@mail.gmail.com">Hi
All ,
<div><br>
</div>
<div>I am using opensips-3.1 . I wanted to use the backend
database as mongodb rather than mysql . I have tested dynamic
routing , domain , dialplan, auth_db thes modules with mongodb
successfully without any error . </div>
<div><br>
</div>
<div>I have tested usrloc module with "
<span
style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:12px;text-align:justify">full-sharing-cachedb</span> "
, "federated-cachedb-cluster" and "full-sharing-cluster" .
Everything works perfectly fine . <br>
</div>
</blockquote>
You have no idea how happy (and proud) I am to hear that you had fun
playing with all of these toys. Congratulations!<br>
<blockquote type="cite"
cite="mid:CALf-Q45DCSjFoggX8im+EKOk3+DdWHsEWLC1iBmz2U70y_8U6w@mail.gmail.com">
<div><br>
</div>
<div>Now I am wondering . If I am running a single instance of
opensips and for usrloc module I want to use cachedb_mongodb .
Is that possible ? I have tried a lot but with no success . <br>
</div>
</blockquote>
<p>I gave this some testing and it worked. The only tricky part is
about the inability to have a table named "version" in MongoDB,
because it's a restricted keyword. Fortunately, there is an
OpenSIPS modparam which has this covered (could we turn this into
a meme?). See below examples, my registrations got stored in
Mongo easily:</p>
<p><br>
------- opensips.cfg -------<br>
db_version_table = "opensips_version"<br>
<br>
loadmodule "usrloc.so"<br>
modparam("usrloc", "working_mode_preset",
"single-instance-sql-write-through")<br>
modparam("usrloc", "db_url", "cachedb://mongodb")<br>
<br>
loadmodule "db_cachedb.so"<br>
modparam("db_cachedb", "cachedb_url",
"mongodb://192.168.0.212/opensipsDB.location")<br>
<br>
loadmodule "cachedb_mongodb.so"<br>
-----------------------------<br>
<br>
> use opensipsDB<br>
switched to db opensipsDB<br>
> db.location.find().pretty()<br>
{<br>
"_id" : ObjectId("5fd0f173fc095c0475046384"),<br>
"contact_id" : NumberLong("2340957012558380938"),<br>
"username" : "crina",<br>
"contact" : <a class="moz-txt-link-rfc2396E" href="mailto:sip:73810946@127.0.0.1:59298">"sip:73810946@127.0.0.1:59298"</a>,<br>
"expires" : 1607528939,<br>
"q" : -1,<br>
"callid" : "1fba6d83-f564-4298-b879-5d07537634d9",<br>
"cseq" : 3,<br>
"flags" : 0,<br>
"cflags" : "",<br>
"user_agent" : "Blink 3.2.1 (Linux)",<br>
"received" : null,<br>
"path" : null,<br>
"socket" : "udp:127.0.0.1:5060",<br>
"methods" : null,<br>
"last_modified" : ISODate("2020-12-09T15:47:59Z"),<br>
"sip_instance" :
"<urn:uuid:df6f1920-6259-42fe-912c-5fa9744497e6>",<br>
"kv_store" : null,<br>
"attr" : null<br>
}<br>
> db.opensips_version.find().pretty()<br>
{<br>
"_id" : ObjectId("5fd0f11884807b143c3a185b"),<br>
"table_name" : "location",<br>
"table_version" : 1013<br>
}<br>
</p>
<p>Cheers,<br>
</p>
<pre class="moz-signature" cols="72">--
Liviu Chircu
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/liviuchircu">www.twitter.com/liviuchircu</a> | <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
</body>
</html>