Separate phone status publication from incoming caller warning
This commit is contained in:
1 parent
ab0a5dc8f1
commit
c8b2dfa7a3
11 files changed
+210
-9
No files matched your search
+6
-5
@@ -206,7 +206,7 @@ static void call_event_incoming(struct call_ctx* ctx, uint64_t group_id, uint64_
|
||||
}
|
||||
|
||||
uint8_t call_phone_status(struct UTUN_INSTANCE* inst) {
|
||||
if (!inst) return 0;
|
||||
if (!inst || inst->phone_status_hidden) return 0;
|
||||
if (inst->phone_state == 2 || call_busy(inst)) return TOPO_FLAG_PHONE_KNOWN | TOPO_FLAG_PHONE_BUSY;
|
||||
return inst->phone_state == 1 ? TOPO_FLAG_PHONE_KNOWN : 0;
|
||||
}
|
||||
@@ -231,11 +231,12 @@ static void call_publish_phone_status(struct UTUN_INSTANCE* inst) {
|
||||
}
|
||||
}
|
||||
|
||||
void call_set_phone_state(struct UTUN_INSTANCE* inst, int state) {
|
||||
void call_set_phone_state(struct UTUN_INSTANCE* inst, int state, int publish, int notify) {
|
||||
if (!inst || state < 0 || state > 2) { DEBUG_ERROR(DEBUG_CATEGORY_CALL, "invalid phone state=%d", state); return; }
|
||||
if (inst->phone_state == state) return;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "phone state old=%u new=%d", inst->phone_state, state);
|
||||
if (inst->phone_state == state && inst->phone_status_hidden == !publish && inst->phone_notify_enabled == !!notify) return;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "phone state old=%u new=%d publish=%d notify=%d", inst->phone_state, state, !!publish, !!notify);
|
||||
inst->phone_state = (uint8_t)state;
|
||||
inst->phone_status_hidden = !publish; inst->phone_notify_enabled = !!notify;
|
||||
call_publish_phone_status(inst);
|
||||
}
|
||||
|
||||
@@ -633,7 +634,7 @@ static void call_handle_invite(struct call_ctx* ctx, uint64_t from, uint64_t gro
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CALL, "%s: session alloc failed id=%016llx", CALL_ID, (unsigned long long)call_id);
|
||||
return;
|
||||
}
|
||||
s->state = ctx->inst->phone_state == 2 ? CALL_ST_WAIT_DECISION : CALL_ST_RINGING;
|
||||
s->state = ctx->inst->phone_notify_enabled && ctx->inst->phone_state == 2 ? CALL_ST_WAIT_DECISION : CALL_ST_RINGING;
|
||||
call_publish_phone_status(ctx->inst);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "%s: INVITE id=%016llx from=0x%016llx group=0x%016llx (declared group=0x%016llx)",
|
||||
CALL_ID, (unsigned long long)call_id, (unsigned long long)from,
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ int call_busy(struct UTUN_INSTANCE* inst);
|
||||
/* Продолжить исходящий вызов после предупреждения о телефонной занятости. Только uasync. */
|
||||
void call_continue(struct UTUN_INSTANCE* inst, uint64_t call_id);
|
||||
/* Живой статус ОС: 0=неизвестно, 1=свободен, 2=занят. Только uasync; публикует BGP при изменении. */
|
||||
void call_set_phone_state(struct UTUN_INSTANCE* inst, int state);
|
||||
void call_set_phone_state(struct UTUN_INSTANCE* inst, int state, int publish, int notify);
|
||||
/* Флаги BGP PHONE_KNOWN/BUSY с учётом собственного обычного звонка. Только uasync. */
|
||||
uint8_t call_phone_status(struct UTUN_INSTANCE* inst);
|
||||
|
||||
|
||||
@@ -262,6 +262,8 @@ struct UTUN_INSTANCE {
|
||||
uint8_t client_activity; // CLIENT_ACTIVITY_STANDBY/ACTIVE
|
||||
uint8_t client_activity_requested; // режим frontend; stream owners могут временно удерживать эффективный ACTIVE
|
||||
uint8_t phone_state; // 0=неизвестно, 1=свободен, 2=занят; живое состояние ОС, не сохраняется
|
||||
uint8_t phone_status_hidden; // не публиковать телефонную занятость в BGP
|
||||
uint8_t phone_notify_enabled; // предупреждать вызывающего о телефонной занятости
|
||||
struct utun_activity_cbk_entry* activity_cbks; // подписки на смену client_activity
|
||||
struct peer_sleep_cbk_entry* peer_sleep_cbks; // подписки на смену спячки пира (keepalive)
|
||||
|
||||
|
||||
Reference in new issue
Block a user