Open Source Telephony
 help / color / mirror / Atom feed
* [PATCHv3] isi: fix hangup_active and set_udub methods
@ 2010-10-20 17:08 Pekka.Pessi
  2010-10-20 17:56 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Pekka.Pessi @ 2010-10-20 17:08 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3212 bytes --]

From: Pekka Pessi <Pekka.Pessi@nokia.com>

The concept of "active" call seems to be overloaded.
---
 drivers/isimodem/voicecall.c |   60 +++++++++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index 82f7eef..c3365f6 100644
--- a/drivers/isimodem/voicecall.c
+++ b/drivers/isimodem/voicecall.c
@@ -902,9 +902,9 @@ static int isi_call_status_to_clcc(struct isi_call const *call)
 		return 4;
 	case CALL_STATUS_PROCEEDING:
 		if ((call->mode_info & CALL_MODE_ORIGINATOR))
-			return 4;
+			return 4; /* MT */
 		else
-			return 2;
+			return 2; /* MO */
 	case CALL_STATUS_MO_ALERTING:
 		return 3;
 	case CALL_STATUS_MT_ALERTING:
@@ -986,10 +986,37 @@ static void isi_answer(struct ofono_voicecall *ovc,
 	isi_call_answer_req(ovc, CALL_ID_ALL, cb, data);
 }
 
-static void isi_hangup_active(struct ofono_voicecall *ovc,
+static void isi_hangup_current(struct ofono_voicecall *ovc,
 			ofono_voicecall_cb_t cb, void *data)
 {
-	isi_call_release_req(ovc, CALL_ID_ACTIVE, CALL_CAUSE_TYPE_CLIENT,
+	/*
+	 * Hangup call(s) that are not held or waiting:
+	 * active calls or calls in progress.
+	 */
+	struct isi_voicecall *ivc = ofono_voicecall_get_data(ovc);
+	int id = 0;
+
+	for (id = 1; id <= 7; id++) {
+		if (ivc->calls[id].call_id & CALL_ID_WAITING)
+			continue;
+		if (ivc->calls[id].call_id & CALL_ID_HOLD)
+			continue;
+
+		switch (ivc->calls[id].status) {
+		case CALL_STATUS_CREATE:
+		case CALL_STATUS_COMING:
+		case CALL_STATUS_PROCEEDING:
+		case CALL_STATUS_MO_ALERTING:
+		case CALL_STATUS_MT_ALERTING:
+		case CALL_STATUS_ANSWERED:
+			goto release_by_id;
+		}
+	}
+
+	id = CALL_ID_ACTIVE;
+
+release_by_id:
+	isi_call_release_req(ovc, id, CALL_CAUSE_TYPE_CLIENT,
 				CALL_CAUSE_RELEASE_BY_USER, cb, data);
 }
 
@@ -1004,25 +1031,10 @@ static void isi_release_all_held(struct ofono_voicecall *ovc,
 static void isi_set_udub(struct ofono_voicecall *ovc,
 				ofono_voicecall_cb_t cb, void *data)
 {
-	/* AT+CHLD=0 (w/ incoming calls) */
-	struct isi_voicecall *ivc = ofono_voicecall_get_data(ovc);
-	int id = 0;
-
-	for (id = 1; id <= 7; id++) {
-		if (ivc->calls[id].status == CALL_STATUS_WAITING)
-			break;
-		if (ivc->calls[id].status == CALL_STATUS_MT_ALERTING)
-			break;
-		if (ivc->calls[id].status == CALL_STATUS_COMING)
-			break;
-	}
-
-	if (id <= 7)
-		isi_call_release_req(ovc, id, CALL_CAUSE_TYPE_CLIENT,
-					CALL_CAUSE_BUSY_USER_REQUEST,
-					cb, data);
-	else
-		CALLBACK_WITH_FAILURE(cb, data);
+	/* Release waiting calls */
+	isi_call_release_req(ovc, CALL_ID_WAITING,
+		CALL_CAUSE_TYPE_CLIENT, CALL_CAUSE_BUSY_USER_REQUEST,
+		cb, data);
 }
 
 static void isi_retrieve(struct ofono_voicecall *ovc,
@@ -1317,7 +1329,7 @@ static struct ofono_voicecall_driver driver = {
 	.remove			= isi_voicecall_remove,
 	.dial			= isi_dial,
 	.answer			= isi_answer,
-	.hangup_active		= isi_hangup_active,
+	.hangup_active		= isi_hangup_current,
 	.hold_all_active	= isi_hold_all_active,
 	.release_all_held	= isi_release_all_held,
 	.set_udub		= isi_set_udub,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHv3] isi: fix hangup_active and set_udub methods
  2010-10-20 17:08 [PATCHv3] isi: fix hangup_active and set_udub methods Pekka.Pessi
@ 2010-10-20 17:56 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2010-10-20 17:56 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

Hi Pekka,

On 10/20/2010 12:08 PM, Pekka.Pessi(a)nokia.com wrote:
> From: Pekka Pessi <Pekka.Pessi@nokia.com>
> 
> The concept of "active" call seems to be overloaded.
> ---
>  drivers/isimodem/voicecall.c |   60 +++++++++++++++++++++++++----------------
>  1 files changed, 36 insertions(+), 24 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-20 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 17:08 [PATCHv3] isi: fix hangup_active and set_udub methods Pekka.Pessi
2010-10-20 17:56 ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox