<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
indeed, it seems the callbacks are called early for db only mode --
you can push a fix for it if you get the time.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 21/05/15 13:07, Victor Seva wrote:<br>
</div>
<blockquote cite="mid:555DBC7F.3070908@torreviejawireless.org"
type="cite">
<pre wrap="">Hi,
I just notice an error in pua_reginfo and I was intrigued:
a REGISTER is received and then:
</pre>
<blockquote type="cite">
<pre wrap="">proxy[30664]: DEBUG: usrloc [udomain.c:602]: db_load_urecord(): aor <a class="moz-txt-link-abbreviated" href="mailto:88835677220000@X.X.X.X">88835677220000@X.X.X.X</a> not found in table location
proxy[30664]: DEBUG: usrloc [ul_callback.h:89]: run_ul_callbacks(): contact=0x7fddc7836b40, callback type 1/1, id 0 entered
proxy[30664]: DEBUG: pua_reginfo [usrloc_cb.c:240]: reginfo_usrloc_cb(): AOR: <a class="moz-txt-link-abbreviated" href="mailto:88835677220000@X.X.X.X">88835677220000@X.X.X.X</a> (location)
proxy[30664]: DEBUG: pua_reginfo [usrloc_cb.c:241]: reginfo_usrloc_cb(): type= UL_CONTACT_INSERT
proxy[30664]: DEBUG: usrloc [udomain.c:702]: db_load_urecord_by_ruid(): aor uloc-555da99c-77c8-1 not found in table location
proxy[30664]: ERROR: pua_reginfo [usrloc_cb.c:261]: reginfo_usrloc_cb(): '<a class="moz-txt-link-abbreviated" href="mailto:88835677220000@X.X.X.X">88835677220000@X.X.X.X</a> (location)' Not found in usrloc
</pre>
</blockquote>
<pre wrap="">
So I took a look over usrloc and I found that the callbacks are been
called after insert in mem but before insert on DB
when you set DB_ONLY.
</pre>
<blockquote type="cite">
<pre wrap="">int insert_ucontact(urecord_t* _r, str* _contact, ucontact_info_t* _ci, ucontact_t** _c)
{
if ( ((*_c)=mem_insert_ucontact(_r, _contact, _ci)) == 0) {
LM_ERR("failed to insert contact\n");
return -1;
}
if (exists_ulcb_type(UL_CONTACT_INSERT)) {
run_ul_callbacks( UL_CONTACT_INSERT, *_c);
}
if (db_mode == WRITE_THROUGH || db_mode==DB_ONLY) {
if (db_insert_ucontact(*_c) < 0) {
LM_ERR("failed to insert in database\n");
return -1;
} else {
(*_c)->state = CS_SYNC;
}
}
return 0;
}
</pre>
</blockquote>
<pre wrap="">
This happens on update too:
</pre>
<blockquote type="cite">
<pre wrap="">int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci)
{
int res;
/* we have to update memory in any case, but database directly
* only in db_mode 1 */
if (mem_update_ucontact( _c, _ci) < 0) {
LM_ERR("failed to update memory\n");
return -1;
}
/* run callbacks for UPDATE event */
if (exists_ulcb_type(UL_CONTACT_UPDATE))
{
LM_DBG("exists callback for type= UL_CONTACT_UPDATE\n");
run_ul_callbacks( UL_CONTACT_UPDATE, _c);
}
if (_r && db_mode!=DB_ONLY)
update_contact_pos( _r, _c);
st_update_ucontact(_c);
if (db_mode == WRITE_THROUGH || db_mode==DB_ONLY) {
if (ul_db_update_as_insert)
res = db_insert_ucontact(_c);
else
res = db_update_ucontact(_c);
if (res < 0) {
LM_ERR("failed to update database\n");
return -1;
} else {
_c->state = CS_SYNC;
}
}
return 0;
}
</pre>
</blockquote>
<pre wrap="">
So I would say that DB_ONLY should be honored here before calling the
callbacks
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
</body>
</html>