Ejemplo n.º 1
0
static int qualify_and_schedule_cb(void *obj, void *arg, int flags)
{
	struct ast_sip_contact *contact = obj;
	struct ast_sip_aor *aor = arg;
	int initial_interval;
	int max_time = ast_sip_get_max_initial_qualify_time();

	contact->qualify_frequency = aor->qualify_frequency;
	contact->qualify_timeout = aor->qualify_timeout;
	contact->authenticate_qualify = aor->authenticate_qualify;

	/* Delay initial qualification by a random fraction of the specified interval */
	if (max_time && max_time < contact->qualify_frequency) {
		initial_interval = max_time;
	} else {
		initial_interval = contact->qualify_frequency;
	}

	initial_interval = (int)((initial_interval * 1000) * ast_random_double());

	unschedule_qualify(contact);
	if (contact->qualify_frequency) {
		schedule_qualify(contact, initial_interval);
	} else {
		update_contact_status(contact, UNKNOWN);
	}

	return 0;
}
Ejemplo n.º 2
0
static int qualify_and_schedule_cb(void *obj, void *arg, int flags)
{
	struct ast_sip_contact *contact = obj;
	struct ast_sip_aor *aor = arg;
	int initial_interval;

	contact->qualify_frequency = aor->qualify_frequency;
	contact->authenticate_qualify = aor->authenticate_qualify;

	/* Delay initial qualification by a random fraction of the specified interval */
	initial_interval = contact->qualify_frequency * 1000;
	initial_interval = (int)(initial_interval * ast_random_double());

	if (contact->qualify_frequency) {
		schedule_qualify(contact, initial_interval);
	}

	return 0;
}
Ejemplo n.º 3
0
static void qualify_and_schedule_contact(struct ast_sip_contact *contact)
{
	int initial_interval;
	int max_time = ast_sip_get_max_initial_qualify_time();

	/* Delay initial qualification by a random fraction of the specified interval */
	if (max_time && max_time < contact->qualify_frequency) {
		initial_interval = max_time;
	} else {
		initial_interval = contact->qualify_frequency;
	}

	initial_interval = (int)((initial_interval * 1000) * ast_random_double());

	unschedule_qualify(contact);
	if (contact->qualify_frequency) {
		schedule_qualify(contact, initial_interval);
	} else {
		update_contact_status(contact, UNKNOWN, 0);
	}
}
Ejemplo n.º 4
0
/*! Randomly select a character for a salt string */
static char gen_salt_char(void)
{
	int which = ast_random_double() * 64;
	return salt_chars[which];
}