Hi,
I just notice an error in pua_reginfo and I was intrigued:
a REGISTER is received and then:
> proxy[30664]: DEBUG: usrloc [udomain.c:602]: db_load_urecord(): aor 88835677220000(a)X.X.X.X 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: 88835677220000(a)X.X.X.X (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(): '88835677220000(a)X.X.X.X (location)' Not found in usrloc
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.
> 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;
> }
This happens on update too:
> 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;
> }
So I would say that DB_ONLY should be honored here before calling the
callbacks