mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-08 04:45:31 +00:00
mm: call: Check call direction when mapping waiting state
MM_CALL_STATE_WAITING may also be used on outgoing calls, so we need to check the call direction. Fixes #465
This commit is contained in:
parent
a4c4687208
commit
4b99660e3f
1 changed files with 13 additions and 3 deletions
|
@ -128,7 +128,6 @@ static const struct CallsMMCallStateMap STATE_MAP[] = {
|
||||||
row (RINGING_IN, INCOMING),
|
row (RINGING_IN, INCOMING),
|
||||||
row (ACTIVE, ACTIVE),
|
row (ACTIVE, ACTIVE),
|
||||||
row (HELD, HELD),
|
row (HELD, HELD),
|
||||||
row (WAITING, INCOMING),
|
|
||||||
row (TERMINATED, DISCONNECTED),
|
row (TERMINATED, DISCONNECTED),
|
||||||
|
|
||||||
#undef row
|
#undef row
|
||||||
|
@ -146,6 +145,7 @@ state_changed_cb (CallsMMCall *self,
|
||||||
const struct CallsMMCallStateReasonMap *reason_map_row;
|
const struct CallsMMCallStateReasonMap *reason_map_row;
|
||||||
const char *state_str = "state unmatched";
|
const char *state_str = "state unmatched";
|
||||||
const char *reason_str = "reason unmatched";
|
const char *reason_str = "reason unmatched";
|
||||||
|
CallsCallState call_state = CALLS_CALL_STATE_UNKNOWN;
|
||||||
|
|
||||||
if (new_state == MM_CALL_STATE_TERMINATED)
|
if (new_state == MM_CALL_STATE_TERMINATED)
|
||||||
set_disconnect_reason (self, reason);
|
set_disconnect_reason (self, reason);
|
||||||
|
@ -154,10 +154,20 @@ state_changed_cb (CallsMMCall *self,
|
||||||
for (state_map_row = STATE_MAP; state_map_row->mm != -1; state_map_row++) {
|
for (state_map_row = STATE_MAP; state_map_row->mm != -1; state_map_row++) {
|
||||||
if (state_map_row->mm == new_state) {
|
if (state_map_row->mm == new_state) {
|
||||||
state_str = state_map_row->desc;
|
state_str = state_map_row->desc;
|
||||||
|
call_state = state_map_row->calls;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_assert_cmpint (state_map_row->mm, !=, -1);
|
|
||||||
|
if (state_map_row->mm == -1 &&
|
||||||
|
new_state == MM_CALL_STATE_WAITING) {
|
||||||
|
MMCallDirection direction = mm_call_get_direction(self->mm_call);
|
||||||
|
gboolean outgoing = direction == MM_CALL_DIRECTION_OUTGOING;
|
||||||
|
|
||||||
|
call_state = outgoing ? CALLS_CALL_STATE_ALERTING : CALLS_CALL_STATE_INCOMING;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_assert_cmpint (call_state, !=, CALLS_CALL_STATE_UNKNOWN);
|
||||||
|
|
||||||
for (reason_map_row = STATE_REASON_MAP; reason_map_row->value != -1; reason_map_row++) {
|
for (reason_map_row = STATE_REASON_MAP; reason_map_row->value != -1; reason_map_row++) {
|
||||||
if (reason_map_row->value == reason) {
|
if (reason_map_row->value == reason) {
|
||||||
|
@ -171,7 +181,7 @@ state_changed_cb (CallsMMCall *self,
|
||||||
mm_call_get_path (self->mm_call),
|
mm_call_get_path (self->mm_call),
|
||||||
state_str,
|
state_str,
|
||||||
reason_str);
|
reason_str);
|
||||||
calls_call_set_state (CALLS_CALL (self), state_map_row->calls);
|
calls_call_set_state (CALLS_CALL (self), call_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue