예제 #1
0
파일: udomain.c 프로젝트: aallamaa/kamailio
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;
}
예제 #2
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;
}
예제 #3
0
int get_pcontact_by_src(udomain_t* _d, str * _host, unsigned short _port, unsigned short _proto, struct pcontact** _c) {
	char c_contact[256], *p;
	str s_contact;
	int ret;

	memset(c_contact, 0, 256);
	strncpy(c_contact, "sip:*@", 6);	//prepend *@ to host to wildcard on user search
	p = c_contact + 6;
	memcpy(p, _host->s, _host->len);
	p = p + _host->len;
	*p = ':';
	p++;
	sprintf(p, "%d", _port);
	s_contact.s = c_contact;
	s_contact.len = strlen(c_contact);
	
	LM_DBG("Trying to find contact by src with URI: [%.*s]\n", s_contact.len, s_contact.s);
	ret = get_pcontact(_d, &s_contact, _host, _port, _c);

	return ret;
}