---
 drivers/ifxmodem/voicecall.c |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index d43e6f9..7401337 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -81,7 +81,8 @@ static int class_to_call_type(int cls)
 
 static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
                                        int direction, int status,
-                                       const char *num, int num_type, int clip)
+                                       const char *num, int num_type, int clip,
+                                       gboolean tty)
 {
        struct voicecall_data *d = ofono_voicecall_get_data(vc);
        struct ofono_call *call;
@@ -95,6 +96,7 @@ static struct ofono_call *create_call(struct ofono_voicecall 
*vc, int type,
        call->type = type;
        call->direction = direction;
        call->status = status;
+       call->tty = tty;
 
        if (clip != 2) {
                strncpy(call->phone_number.number, num,
@@ -280,7 +282,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer 
user_data)
        }
 
        /* Generate a voice call that was just dialed, we guess the ID */
-       call = create_call(vc, 0, 0, 2, num, type, validity);
+       call = create_call(vc, 0, 0, 2, num, type, validity, FALSE);
        if (call == NULL) {
                ofono_error("Unable to malloc, call tracking will fail!");
                return;
@@ -546,6 +548,7 @@ static void cring_notify(GAtResult *result, gpointer 
user_data)
        GAtResultIter iter;
        const char *line;
        int type;
+       gboolean tty = FALSE;
 
        /* Handle the following situation:
         * Active Call + Waiting Call.  Active Call is Released.  The Waiting
@@ -575,11 +578,14 @@ static void cring_notify(GAtResult *result, gpointer 
user_data)
        /* Ignore everything that is not voice for now */
        if (!strcasecmp(line, "VOICE"))
                type = 0;
-       else
+       else if (!strcasecmp(line, "CTM")) {
+               type = 0;
+               tty = TRUE;
+       } else
                type = 9;
 
        /* Generate an incoming call */
-       create_call(vc, type, 1, 4, NULL, 128, 2);
+       create_call(vc, type, 1, 4, NULL, 128, 2, tty);
 
        /* Assume the CLIP always arrives, and we signal the call there */
        DBG("cring_notify");
@@ -682,7 +688,7 @@ static void ccwa_notify(GAtResult *result, gpointer 
user_data)
        DBG("ccwa_notify: %s %d %d %d", num, num_type, cls, validity);
 
        call = create_call(vc, class_to_call_type(cls), 1, 5,
-                               num, num_type, validity);
+                               num, num_type, validity, FALSE);
        if (call == NULL) {
                ofono_error("Unable to malloc. Call management is fubar");
                return;
@@ -692,6 +698,25 @@ static void ccwa_notify(GAtResult *result, gpointer 
user_data)
                ofono_voicecall_notify(vc, call);
 }
 
+static void ctm_notify(GAtResult *result, gpointer user_data)
+{
+       struct ofono_voicecall *vc = user_data;
+       struct voicecall_data *vd = ofono_voicecall_get_data(vc);
+       GSList *l;
+       struct ofono_call *call;
+
+       l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(0),
+                               at_util_call_compare_by_status);
+       if (l == NULL) {
+               ofono_error("CTM for unknown call");
+               return;
+       }
+
+       call = l->data;
+
+       ofono_voicecall_tty_notify(vc, call);
+}
+
 static void ifx_voicecall_initialized(gboolean ok, GAtResult *result,
                                        gpointer user_data)
 {
@@ -706,6 +731,7 @@ static void ifx_voicecall_initialized(gboolean ok, 
GAtResult *result,
        g_at_chat_register(vd->chat, "+XEM:", xem_notify, FALSE, vc, NULL);
        g_at_chat_register(vd->chat, "+XCALLSTAT:", xcallstat_notify,
                                                        FALSE, vc, NULL);
+       g_at_chat_register(vd->chat, "CTM CALL", ctm_notify, FALSE, vc, NULL);
 
        ofono_voicecall_register(vc);
 }
-- 
1.7.0.4

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

Reply via email to