static inline void nodb_timer(pcontact_t* _c) { LM_DBG("Running nodb timer on <%.*s>, " "Reg state: %s, " "Expires: %d, " "Expires in: %d seconds, " "Received: %.*s:%d, " "Path: %.*s, " "Proto: %d, " "Hash: %u, " "Slot: %u\n", _c->aor.len, _c->aor.s, reg_state_to_string(_c->reg_state), (int)_c->expires, (int)(_c->expires - time(NULL)), _c->received_host.len, _c->received_host.s, _c->received_port, _c->path.len, _c->path.s, _c->received_proto, _c->aorhash, _c->sl); get_act_time(); if ((_c->expires - act_time) + expires_grace <= 0) {//we've allowed some grace time TODO: add as parameter //if ((_c->expires - act_time) <= -10) {//we've allowed some grace time TODO: add as parameter LM_DBG("pcscf contact <%.*s> has expired and will be removed\n", _c->aor.len, _c->aor.s); if (exists_ulcb_type(PCSCF_CONTACT_EXPIRE)) { run_ul_callbacks(PCSCF_CONTACT_EXPIRE, _c); } if (db_mode == WRITE_THROUGH && db_delete_pcontact(_c) != 0) { LM_ERR("Error deleting ims_usrloc_pcscf record in DB"); } update_stat(_c->slot->d->expired, 1); mem_delete_pcontact(_c->slot->d, _c); return; } //TODO: this is just for tmp debugging // p = _c->head; // while (p) { // if (p->is_default) // LM_DBG("public identity %i (default): <%.*s>\n", i, p->public_identity.len, p->public_identity.s); // else // LM_DBG("public identity %i: <%.*s>\n", i, p->public_identity.len, p->public_identity.s); // i++; // p=p->next; // } // // LM_DBG("There are %i service routes as follows:\n", _c->num_service_routes); // for (i=0; i<_c->num_service_routes; i++) { // LM_DBG("service route %i: <%.*s>\n", i+1, _c->service_routes[i].len, _c->service_routes[i].s); // } }
int delete_pcontact(udomain_t* _d, str* _aor, struct pcontact* _c) { if (_c==0) { if (get_pcontact(_d, _aor, &_c) > 0) { return 0; } } if (exists_ulcb_type(PCSCF_CONTACT_DELETE)) { run_ul_callbacks(PCSCF_CONTACT_DELETE, _c); } mem_delete_pcontact(_d, _c); return 0; }
int delete_pcontact(udomain_t* _d, str* _aor, struct pcontact* _c) { if (_c==0) { if (get_pcontact(_d, _aor, &_c) > 0) { return 0; } } if (exists_ulcb_type(PCSCF_CONTACT_DELETE)) { run_ul_callbacks(PCSCF_CONTACT_DELETE, _c); } if (db_mode == WRITE_THROUGH && db_delete_pcontact(_c) != 0) { LM_ERR("Error deleting contact from DB"); return -1; } mem_delete_pcontact(_d, _c); return 0; }