voicecall: fix callheld indicator for PTS
PATCH 1/1 voicecall: fix callheld indicator for PTS
Fix PTS test TP/TWC/BV-03-I [Call Waiting- Hold Active/Retrieve Waiting Call or Held].
PTS test fails after receiving intermediate update of callheld indicator with value 0 (no held call) before it receives update to value 1 (active and held calls). This is due to the non-atomic update of calls status after call swap (moving first call to active state before moving second one to hold state).
HFP 1.5 spec specifies that an update of callheld indicator to 1 should be sent after AT+CHLD=2 command.
As oFono emulator sends +CIEV only if the indicator value changes, we need to use an intermediate state for callheld indicator (2, all calls on hold).
So, in case of multiple active calls, or an active call with an active mutiparty call, force update of callheld indicator to 2.
--- src/voicecall.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
src/voicecall.c +14 -4
@@ -733,7 +733,8 @@ static void emulator_callheld_status_cb(struct ofono_atom *atom, void *data)static void notify_emulator_call_status (struct ofono_voicecall *vc) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); -gboolean call = FALSE; +unsigned int non_mpty =0 ; +gboolean multiparty = FALSE;gboolean held = FALSE;gboolean incoming = FALSE;gboolean dialing = FALSE;
@@ -750,7 +751,12 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc)switch (v->call->status) {case CALL_STATUS_ACTIVE : - call = TRUE; +if (g_slist_find_custom (vc->multiparty_list, +GINT_TO_POINTER (v->call->id), + call_compare_by_id)) + multiparty = TRUE; +else + non_mpty++;break ;case CALL_STATUS_HELD :
@@ -775,7 +781,8 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc) } } - data.status = call || held ?OFONO_EMULATOR_CALL_ACTIVE : + data.status = non_mpty || multiparty || held ? +OFONO_EMULATOR_CALL_ACTIVE :OFONO_EMULATOR_CALL_INACTIVE ; __ofono_modem_foreach_registered_atom(modem,
@@ -799,8 +806,11 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc) &data);if (held) - data.status = call ?OFONO_EMULATOR_CALLHELD_MULTIPLE : + data.status = (non_mpty || multiparty) ? +OFONO_EMULATOR_CALLHELD_MULTIPLE :OFONO_EMULATOR_CALLHELD_ON_HOLD ; +else if (non_mpty >1 || (non_mpty && multiparty)) + data.status =OFONO_EMULATOR_CALLHELD_ON_HOLD ;else data.status =OFONO_EMULATOR_CALLHELD_NONE ;
Signature · 1 line
1.7.1
Hi Frédéric,
Quoted 8 lines · Frédéric Danis
Fix PTS test TP/TWC/BV-03-I [Call Waiting- Hold Active/Retrieve Waiting Call or Held].
PTS test fails after receiving intermediate update of callheld indicator with value 0 (no held call) before it receives update to value 1 (active and held calls). This is due to the non-atomic update of calls status after call swap (moving first call to active state before moving second one to hold state).
Which scenario fails exactly?
- <1-N> Active + Waiting -> Active + Held
- <1-N> Active + 1 Held -> 1 Active + <1-N> Held
- 1 Active + <1-N> Held -> <1-N> Active + 1 Held
Also note that you can't really count on the order of the updates, these are completely up to the implementation.
Quoted 29 lines
HFP 1.5 spec specifies that an update of callheld indicator to 1 should be sent after AT+CHLD=2 command.
As oFono emulator sends +CIEV only if the indicator value changes, we need to use an intermediate state for callheld indicator (2, all calls on hold).So, in case of multiple active calls, or an active call with an active mutiparty call, force update of callheld indicator to 2.
--- src/voicecall.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)src/voicecall.c +2
-1@@ -733,7 +733,8 @@ static void emulator_callheld_status_cb(struct ofono_atom *atom, void *data)static void notify_emulator_call_status (struct ofono_voicecall *vc) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); -gboolean call = FALSE; +unsigned int non_mpty =0 ; +gboolean multiparty = FALSE;gboolean held = FALSE;gboolean incoming = FALSE;gboolean dialing = FALSE;@@ -750,7 +751,12 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc)
src/voicecall.c static void notify_emulator_call_status(struct ofono_voicecall *vc) · line 760
Quoted 10 lines
src/voicecall.c +6
-1switch (v->call->status) {case CALL_STATUS_ACTIVE : - call = TRUE; +if (g_slist_find_custom (vc->multiparty_list, +GINT_TO_POINTER (v->call->id), + call_compare_by_id)) + multiparty = TRUE; +else + non_mpty++;break ;
What is this trying to achieve? You cannot have multiple calls in active / held state unless they are part of the mpty. So if you have 3 active calls, all 3 must be on the mpty list.
Quoted 15 lines
src/voicecall.c +2
-1case CALL_STATUS_HELD :@@ -775,7 +781,8 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc) } } - data.status = call || held ?OFONO_EMULATOR_CALL_ACTIVE : + data.status = non_mpty || multiparty || held ? +OFONO_EMULATOR_CALL_ACTIVE :OFONO_EMULATOR_CALL_INACTIVE ; __ofono_modem_foreach_registered_atom(modem,@@ -799,8 +806,11 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc) &data);
src/voicecall.c static void notify_emulator_call_status(struct ofono_voicecall *vc) · line 816
Quoted 10 lines
src/voicecall.c +4
-1if (held) - data.status = call ?OFONO_EMULATOR_CALLHELD_MULTIPLE : + data.status = (non_mpty || multiparty) ? +OFONO_EMULATOR_CALLHELD_MULTIPLE :OFONO_EMULATOR_CALLHELD_ON_HOLD ; +else if (non_mpty >1 || (non_mpty && multiparty)) + data.status =OFONO_EMULATOR_CALLHELD_ON_HOLD ;else data.status =OFONO_EMULATOR_CALLHELD_NONE ;
I think a different approach is needed. One idea off the top of my
head: Can we mark calls which we foresee being as part of the transaction and only send the status updates once all of them have entered the desired state.
Regards,
-Denis
Hello Denis,
Quoted 12 lines · Denis Kenzior
Hi Frédéric,
Quoted 8 lines · Frédéric Danis
Fix PTS test TP/TWC/BV-03-I [Call Waiting- Hold Active/Retrieve Waiting Call or Held].
PTS test fails after receiving intermediate update of callheld indicator with value 0 (no held call) before it receives update to value 1 (active and held calls). This is due to the non-atomic update of calls status after call swap (moving first call to active state before moving second one to hold state).
Quoted 8 lines
Which scenario fails exactly?
-<1-N> Active + Waiting -> Active + Held -<1-N> Active + 1 Held -> 1 Active +<1-N> Held
- 1 Active +<1-N> Held -> <1-N> Active + 1 HeldAlso note that you can't really count on the order of the updates, these are completely up to the implementation.
This test fails for (tested with phonesim) :
- 1st call held + 2nd call active -> 1st call active + 2nd call held
I understand that order of update for calls will be implementation dependent, this problem occurs when 1st call to be updated was held and become active.
Quoted 29 lines
Quoted 29 lines
HFP 1.5 spec specifies that an update of callheld indicator to 1 should be sent after AT+CHLD=2 command.
As oFono emulator sends +CIEV only if the indicator value changes, we need to use an intermediate state for callheld indicator (2, all calls on hold).So, in case of multiple active calls, or an active call with an active mutiparty call, force update of callheld indicator to 2.
--- src/voicecall.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)src/voicecall.c +2
-1@@ -733,7 +733,8 @@ static void emulator_callheld_status_cb(struct ofono_atom *atom, void *data)static void notify_emulator_call_status (struct ofono_voicecall *vc) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); -gboolean call = FALSE; +unsigned int non_mpty =0 ; +gboolean multiparty = FALSE;gboolean held = FALSE;gboolean incoming = FALSE;gboolean dialing = FALSE;@@ -750,7 +751,12 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc)
Quoted 15 lines
src/voicecall.c static void notify_emulator_call_status(struct ofono_voicecall *vc) · line 760
Quoted 10 lines
src/voicecall.c +6
-1switch (v->call->status) {case CALL_STATUS_ACTIVE : - call = TRUE; +if (g_slist_find_custom (vc->multiparty_list, +GINT_TO_POINTER (v->call->id), + call_compare_by_id)) + multiparty = TRUE; +else + non_mpty++;break ;What is this trying to achieve? You cannot have multiple calls in active / held state unless they are part of the mpty. So if you have 3 active calls, all 3 must be on the mpty list.
As calls status are updated separately, you can have multiple active calls (for a short time) which are not part of a multi-party list :
- 1st call held + 2nd call active (callheld indicator = 1)
-> 1st call active + 2nd call active (intermediate state,
callheld indicator = 0)
-> 1st call active + 2nd call held (callheld indicator = 1)Quoted 15 lines
Quoted 15 lines
src/voicecall.c +2
-1case CALL_STATUS_HELD :@@ -775,7 +781,8 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc) } } - data.status = call || held ?OFONO_EMULATOR_CALL_ACTIVE : + data.status = non_mpty || multiparty || held ? +OFONO_EMULATOR_CALL_ACTIVE :OFONO_EMULATOR_CALL_INACTIVE ; __ofono_modem_foreach_registered_atom(modem,@@ -799,8 +806,11 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc) &data);
Quoted 16 lines
src/voicecall.c static void notify_emulator_call_status(struct ofono_voicecall *vc) · line 816
Quoted 10 lines
src/voicecall.c +4
-1if (held) - data.status = call ?OFONO_EMULATOR_CALLHELD_MULTIPLE : + data.status = (non_mpty || multiparty) ? +OFONO_EMULATOR_CALLHELD_MULTIPLE :OFONO_EMULATOR_CALLHELD_ON_HOLD ; +else if (non_mpty>1 || (non_mpty&& multiparty)) + data.status =OFONO_EMULATOR_CALLHELD_ON_HOLD ;else data.status =OFONO_EMULATOR_CALLHELD_NONE ;I think a different approach is needed. One idea off the top of my
head: Can we mark calls which we foresee being as part of the transaction and only send the status updates once all of them have entered the desired state.
I agree with you this should be the best way, but:
- currently in voicecall atom during call swap, and as far as I understand, the calls are updated separately from the modem driver and there is no way to know when this update ends.
I do not found a way to perform this with certainty that it will not break actual behavior (regarding DBus), This is why I proposed this hack, limited to emulator related code.
- currently HFP indicators are only sent when their value changes, we need to move through an intermediate state (callheld = 2), or add/change API to be able to force the sending of the indicator.
Quoted 2 lines
Regards,
-Denis
Regards
Fred
Signature · 2 lines
Frederic Danis Open Source Technology Centre frederic.danis(a)intel.com Intel Corporation
Hi Frederic,
Quoted 79 lines · Frederic Danis
Hello Denis,
Quoted 12 lines · Denis Kenzior
Hi Frédéric,
Quoted 8 lines · Frédéric Danis
Fix PTS test TP/TWC/BV-03-I [Call Waiting- Hold Active/Retrieve Waiting Call or Held].
PTS test fails after receiving intermediate update of callheld indicator with value 0 (no held call) before it receives update to value 1 (active and held calls). This is due to the non-atomic update of calls status after call swap (moving first call to active state before moving second one to hold state).
Quoted 8 lines
Which scenario fails exactly?
-<1-N> Active + Waiting -> Active + Held -<1-N> Active + 1 Held -> 1 Active +<1-N> Held
- 1 Active +<1-N> Held -> <1-N> Active + 1 HeldAlso note that you can't really count on the order of the updates, these are completely up to the implementation.
This test fails for (tested with phonesim) :
- 1st call held + 2nd call active -> 1st call active + 2nd call heldI understand that order of update for calls will be implementation dependent, this problem occurs when 1st call to be updated was held and become active.
Quoted 32 lines
Quoted 32 lines
HFP 1.5 spec specifies that an update of callheld indicator to 1 should be sent after AT+CHLD=2 command.
As oFono emulator sends +CIEV only if the indicator value changes, we need to use an intermediate state for callheld indicator (2, all calls on
hold).So, in case of multiple active calls, or an active call with an active mutiparty call, force update of callheld indicator to 2.
--- src/voicecall.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)src/voicecall.c +2
-1@@ -733,7 +733,8 @@ static void emulator_callheld_status_cb(struct ofono_atom *atom, void *data)static void notify_emulator_call_status (struct ofono_voicecall *vc) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); -gboolean call = FALSE; +unsigned int non_mpty =0 ; +gboolean multiparty = FALSE;gboolean held = FALSE;gboolean incoming = FALSE;gboolean dialing = FALSE;src/voicecall.c +0
-0@@ -750,7 +751,12 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc)Quoted 15 lines
src/voicecall.c static void notify_emulator_call_status(struct ofono_voicecall *vc) · line 760
Quoted 10 lines
src/voicecall.c +6
-1switch (v->call->status) {case CALL_STATUS_ACTIVE : - call = TRUE; +if (g_slist_find_custom (vc->multiparty_list, +GINT_TO_POINTER (v->call->id), + call_compare_by_id)) + multiparty = TRUE; +else + non_mpty++;break ;What is this trying to achieve? You cannot have multiple calls in active / held state unless they are part of the mpty. So if you have 3 active calls, all 3 must be on the mpty list.
Quoted 8 lines
As calls status are updated separately, you can have multiple active calls (for a short time) which are not part of a multi-party list :
- 1st call held + 2nd call active (callheld indicator = 1)
-> 1st call active + 2nd call active (intermediate state, callheld indicator = 0) -> 1st call active + 2nd call held (callheld indicator = 1)
I still don't see how this helps you if the active call is transitioned first.
So call A held + call B active (call = 1, callheld = 1) call B -> held (call = 0, callheld = 2)
call A -> active (call = 1, callheld = 1)
This scenario is also wrong...
Quoted 34 lines
Quoted 17 lines
Quoted 17 lines
src/voicecall.c +2
-1case CALL_STATUS_HELD :@@ -775,7 +781,8 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc) } } - data.status = call || held ?OFONO_EMULATOR_CALL_ACTIVE : + data.status = non_mpty || multiparty || held ? +OFONO_EMULATOR_CALL_ACTIVE :OFONO_EMULATOR_CALL_INACTIVE ;__ofono_modem_foreach_registered_atom(modem,
src/voicecall.c +0
-0@@ -799,8 +806,11 @@ static void notify_emulator_call_status(struct ofono_voicecall *vc) &data);Quoted 16 lines
src/voicecall.c static void notify_emulator_call_status(struct ofono_voicecall *vc) · line 815
Quoted 10 lines
src/voicecall.c +4
-1if (held) - data.status = call ?OFONO_EMULATOR_CALLHELD_MULTIPLE : + data.status = (non_mpty || multiparty) ? +OFONO_EMULATOR_CALLHELD_MULTIPLE :OFONO_EMULATOR_CALLHELD_ON_HOLD ; +else if (non_mpty>1 || (non_mpty&& multiparty)) + data.status =OFONO_EMULATOR_CALLHELD_ON_HOLD ;else data.status =OFONO_EMULATOR_CALLHELD_NONE ;I think a different approach is needed. One idea off the top of my
head: Can we mark calls which we foresee being as part of the transaction and only send the status updates once all of them have entered the desired state.
Quoted 9 lines
I agree with you this should be the best way, but:
- currently in voicecall atom during call swap, and as far as I understand, the calls are updated separately from the modem driver and there is no way to know when this update ends.
I do not found a way to perform this with certainty that it will not break actual behavior (regarding DBus), This is why I proposed this hack, limited to emulator related code.
Not sure I'm following, what do you mean updated separately from the modem driver? The modem driver can be stateless, but it is the first to know of the state switch.
Quoted 3 lines
- currently HFP indicators are only sent when their value changes, we need to move through an intermediate state (callheld = 2), or add/change API to be able to force the sending of the indicator.
Again, not really sure how this will help you... Lets discuss on IRC if needed.
Regards,
-Denis