From: Timo Mueller <[email protected]>

Currently the list of current calls is requested right after an
outgoing callsetup has been reported by the AG device. If the AG
device updates the list after reporting the callsetup the +CLCC
response may not contain the new call and it is not registered
with oFono.

In this case AT+CLCC should be requested again once after a small
delay.

AT sequence that exhibited the failure (AG device was a Nokia N9
placing an outgoing call)

< \r\n+CIEV: 5,2\r\n
> AT+CLCC\r
< \r\nOK\r\n
< \r\n+VGS=7\r\n
< \r\n+VGM=7\r\n
< \r\n+CIEV: 5,3\r\n
< \r\n+CIEV: 4,1\r\n
< \r\n+CIEV: 5,0\r\n
---
 drivers/hfpmodem/voicecall.c | 50 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 45 insertions(+), 5 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index b7a9ec5..6f1434d 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -217,11 +217,10 @@ static void release_with_status(struct ofono_voicecall 
*vc, int status)
        }
 }
 
-static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
+static void handle_clcc_response(gboolean ok, GSList *calls, gpointer 
user_data)
 {
        struct ofono_voicecall *vc = user_data;
        struct voicecall_data *vd = ofono_voicecall_get_data(vc);
-       GSList *calls;
        GSList *n, *o;
        struct ofono_call *nc, *oc;
        unsigned int num_active = 0;
@@ -231,8 +230,6 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
        if (!ok)
                return;
 
-       calls = at_util_parse_clcc(result);
-
        n = calls;
        o = vd->calls;
 
@@ -309,6 +306,43 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
                                                        vc);
 }
 
+static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+       GSList *calls;
+
+       if (!ok)
+               return;
+
+       calls = at_util_parse_clcc(result);
+
+       handle_clcc_response(ok, calls, user_data);
+}
+
+static void clcc_poll_dialing_cb(gboolean ok, GAtResult *result,
+                       gpointer user_data)
+{
+       struct ofono_voicecall *vc = user_data;
+       struct voicecall_data *vd = ofono_voicecall_get_data(vc);
+       GSList *calls, *dialing;
+
+       if (!ok)
+               return;
+
+       calls = at_util_parse_clcc(result);
+       dialing = find_dialing(calls);
+
+       if (dialing == NULL) {
+               if (vd->clcc_source)
+                       g_source_remove(vd->clcc_source);
+
+               vd->clcc_source = g_timeout_add(POLL_CLCC_DELAY,
+                                                                               
                poll_clcc, vc);
+               return;
+       }
+
+       handle_clcc_response(ok, calls, user_data);
+}
+
 static gboolean poll_clcc(gpointer user_data)
 {
        struct ofono_voicecall *vc = user_data;
@@ -990,8 +1024,14 @@ static void ciev_callsetup_notify(struct ofono_voicecall 
*vc,
                 * from HF: query and sync the phone number.
                 * from AG: query and create call.
                 */
-               g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
+               if (needs_callheld_clcc_quirk(vd->vendor)) {
+                       g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
+                               clcc_poll_dialing_cb, vc, NULL);
+               } else {
+                       g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
                                clcc_poll_cb, vc, NULL);
+               }
+
                break;
 
        case 3:
-- 
1.7.11.7

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

Reply via email to