コード例 #1
0
ファイル: notify.c プロジェクト: tamy83/baresip-android-mtt
static int print_substate(struct re_printf *pf, const struct sipnot *not)
{
	int err;

	if (not->terminated) {

		err = re_hprintf(pf, "terminated;reason=%s",
				 sipevent_reason_name(not->reason));

		if (not->retry_after)
			err |= re_hprintf(pf, ";retry-after=%u",
					  not->retry_after);
	}
	else {
		uint32_t expires;

		expires = (uint32_t)(tmr_get_expire(&not->tmr) / 1000);

		err = re_hprintf(pf, "%s;expires=%u",
				 sipevent_substate_name(not->substate),
				 expires);
	}

	return err;
}
コード例 #2
0
ファイル: subscriber.c プロジェクト: QXIP/baresip
static void close_handler(int err, const struct sip_msg *msg,
			  const struct sipevent_substate *substate, void *arg)
{
	struct presence *pres = arg;
	uint32_t wait;

	pres->sub = mem_deref(pres->sub);

	info("presence: subscriber closed <%r>: ",
	     &contact_addr(pres->contact)->auri);

	if (substate) {
		info("%s", sipevent_reason_name(substate->reason));
		wait = wait_term(substate);
	}
	else if (msg) {
		info("%u %r", msg->scode, &msg->reason);
		wait = wait_fail(++pres->failc);
	}
	else {
		info("%m", err);
		wait = wait_fail(++pres->failc);
	}

	info("; will retry in %u secs (failc=%u)\n", wait, pres->failc);

	tmr_start(&pres->tmr, wait * 1000, tmr_handler, pres);

	contact_set_presence(pres->contact, PRESENCE_UNKNOWN);
}