Thread (12 messages) flat view 12 messages, 2 authors, 2011-01-06
STALE5694d

[PATCH 01/10] telephony-ofono: notify alerting calls when headset connects

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2011-01-05 15:59:38
Subsystem: the rest · Maintainer: Linus Torvalds

From: Luiz Augusto von Dentz <redacted>

---
 audio/telephony-ofono.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
index 00c3f6e..babf38f 100644
--- a/audio/telephony-ofono.c
+++ b/audio/telephony-ofono.c
@@ -128,9 +128,32 @@ static struct voice_call *find_vc_with_status(int status)
 	return NULL;
 }
 
+static int number_type(const char *number)
+{
+	if (number == NULL)
+		return NUMBER_TYPE_TELEPHONY;
+
+	if (number[0] == '+' || strncmp(number, "00", 2) == 0)
+		return NUMBER_TYPE_INTERNATIONAL;
+
+	return NUMBER_TYPE_TELEPHONY;
+}
+
 void telephony_device_connected(void *telephony_device)
 {
+	struct voice_call *coming;
+
 	DBG("telephony-ofono: device %p connected", telephony_device);
+
+	coming = find_vc_with_status(CALL_STATUS_ALERTING);
+	if (coming) {
+		if (find_vc_with_status(CALL_STATUS_ACTIVE))
+			telephony_call_waiting_ind(coming->number,
+						number_type(coming->number));
+		else
+			telephony_incoming_call_ind(coming->number,
+						number_type(coming->number));
+	}
 }
 
 void telephony_device_disconnected(void *telephony_device)
-- 
1.7.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help