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

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

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

---
 include/voicecall.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/voicecall.h b/include/voicecall.h
index 2356fcf..f07d52b 100644
--- a/include/voicecall.h
+++ b/include/voicecall.h
@@ -67,6 +67,7 @@ struct ofono_voicecall_driver {
 			ofono_voicecall_cb_t cb, void *data);
 	void (*answer)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
+	/* Release active, alerting, dialing, or incoming calls */
 	void (*hangup_active)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
 	void (*hangup_all)(struct ofono_voicecall *vc,
@@ -75,8 +76,13 @@ struct ofono_voicecall_driver {
 			ofono_voicecall_cb_t cb, void *data);
 	void (*release_all_held)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
+	/* Release waiting calls */
 	void (*set_udub)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
+	/*
+	 * Release active, alerting, dialing, or incoming calls
+	 * and answer the waiting call.
+	 */
 	void (*release_all_active)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
 	void (*release_specific)(struct ofono_voicecall *vc, int id,
-- 
1.7.1


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

* [PATCHv2 2/2] isi: fix hangup_active and set_udub methods
  2010-10-20 17:00 [PATCHv2 1/2] voicecall: document voicecall driver methods Pekka.Pessi
@ 2010-10-20 17:00 ` Pekka.Pessi
  2010-10-20 17:55 ` [PATCHv2 1/2] voicecall: document voicecall driver methods Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Pekka.Pessi @ 2010-10-20 17:00 UTC (permalink / raw)
  To: ofono

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

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

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

diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index 82f7eef..a14a65c 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,12 @@ 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) */
+	/* Release waiting 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);
+	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 +1331,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] 3+ messages in thread

* Re: [PATCHv2 1/2] voicecall: document voicecall driver methods
  2010-10-20 17:00 [PATCHv2 1/2] voicecall: document voicecall driver methods Pekka.Pessi
  2010-10-20 17:00 ` [PATCHv2 2/2] isi: fix hangup_active and set_udub methods Pekka.Pessi
@ 2010-10-20 17:55 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2010-10-20 17:55 UTC (permalink / raw)
  To: ofono

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

Hi Pekka,

> +	/*
> +	 * Release active, alerting, dialing, or incoming calls
> +	 * and answer the waiting call.
> +	 */

This actually only affects active calls.  On AT modems you cannot have
waiting calls when dialing / alerting.  Dialing / Alerting / Incoming
are also never affected by any CHLD commands.

I pushed my own patch with the updated documentation.  Let me know if I
missed something.

Regards,
-Denis

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 17:00 [PATCHv2 1/2] voicecall: document voicecall driver methods Pekka.Pessi
2010-10-20 17:00 ` [PATCHv2 2/2] isi: fix hangup_active and set_udub methods Pekka.Pessi
2010-10-20 17:55 ` [PATCHv2 1/2] voicecall: document voicecall driver methods Denis Kenzior

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