Similar to atmodem, We need schedule CLCC poll in the ring notify in
case AG doesn't send CLIP notification to us. If CLIP comes right
after RING, we cancel the CLCC poll.
---
 drivers/hfpmodem/voicecall.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 6b73e7c..dc9359a 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -40,6 +40,7 @@
 #include "hfpmodem.h"
 
 #define POLL_CLCC_INTERVAL 2000
+#define CLIP_INTERVAL 200
 
 static const char *none_prefix[] = { NULL };
 static const char *clcc_prefix[] = { "+CLCC:", NULL };
@@ -717,6 +718,12 @@ static void ring_notify(GAtResult *result, gpointer 
user_data)
 
        if (!call)
                ofono_error("Couldn't create call, call management is fubar!");
+
+       /* We don't know the number must wait for CLIP to arrive before
+        * announcing the call. So we schedule the clcc call. If the CLIP
+        * arrives earlier, we annouce the call there
+        */
+       vd->clcc_source = g_timeout_add(CLIP_INTERVAL, poll_clcc, vc);
 }
 
 static void clip_notify(GAtResult *result, gpointer user_data)
@@ -773,6 +780,14 @@ static void clip_notify(GAtResult *result, gpointer 
user_data)
        call->clip_validity = validity;
 
        ofono_voicecall_notify(vc, call);
+
+       /* We started a CLCC, but the CLIP arrived and the call number
+        * is known so we cancel the GSource
+        */
+       if (vd->clcc_source) {
+               g_source_remove(vd->clcc_source);
+               vd->clcc_source = 0;
+       }
 }
 
 static void ciev_call_notify(struct ofono_voicecall *vc,
-- 
1.6.5.2

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to