2010-07-14 14:12:17

by Radoslaw Jablonski

[permalink] [raw]
Subject: [PATCH] Additional handling incoming call indication for HS

Some headsets expect incoming call indication before they can send ATA
command. In current implementation of telephony we do not send outband
notyfication about incoming call when call previously was in WAITING state.
And without that kind of notyfication BH-108 and BackBeat 903 headset cannot
send ATA command - user is unable to answer to that call from headset.

Added handling for that case in func handle_call_status(). When phone now is
in CSD_CALL_STATUS_MT_ALERTING and previously was in CSD_CALL_STATUS_WAITING
that means we need to send incoming call notyfication (it was not sent earlier
because new call was waiting for end of active call). This will send RING
commands to headset if it is needed.
---
audio/telephony-maemo6.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 046620c..6255c28 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -976,7 +976,7 @@ static void handle_create_requested(DBusMessage *msg)
static void handle_call_status(DBusMessage *msg, const char *call_path)
{
struct csd_call *call;
- dbus_uint32_t status, cause_type, cause;
+ dbus_uint32_t status, cause_type, cause, prev_status;
int callheld = telephony_get_indicator(maemo_indicators, "callheld");

if (!dbus_message_get_args(msg, NULL,
@@ -1000,10 +1000,11 @@ static void handle_call_status(DBusMessage *msg, const char *call_path)
return;
}

+ prev_status = call->status;
DBG("Call %s changed from %s to %s", call_path,
- call_status_str[call->status], call_status_str[status]);
+ call_status_str[prev_status], call_status_str[status]);

- if (call->status == (int) status) {
+ if (prev_status == (int) status) {
DBG("Ignoring CSD Call state change to existing state");
return;
}
@@ -1043,6 +1044,14 @@ static void handle_call_status(DBusMessage *msg, const char *call_path)
EV_CALLSETUP_ALERTING);
break;
case CSD_CALL_STATUS_MT_ALERTING:
+ /* Some headsets expect incoming call notification before they
+ * can send ATA command. When call changed status from waiting
+ * to alerting we need to send missing notification. Otherwise
+ * headsets like Nokia BH-108 or BackBeat 903 are unable to
+ * answer incoming call that was previously waiting. */
+ if(prev_status == CSD_CALL_STATUS_WAITING)
+ telephony_incoming_call_ind(call->number,
+ number_type(call->number));
break;
case CSD_CALL_STATUS_WAITING:
break;
--
1.7.0.4