Open Source Telephony
 help / color / mirror / Atom feed
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH v2 2/2] voicecall: add ATD> support for HFP emulator
Date: Tue, 21 Jun 2011 18:48:34 +0200	[thread overview]
Message-ID: <1308674914-13037-3-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1308674914-13037-1-git-send-email-frederic.danis@linux.intel.com>

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

---
 src/voicecall.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 1f0d3b8..2eb32a6 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -3084,6 +3084,7 @@ static void emulator_atd_cb(struct ofono_emulator *em,
 			struct ofono_emulator_request *req, void *userdata)
 {
 	struct ofono_voicecall *vc = userdata;
+	struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
 	const char *str;
 	size_t len;
 	char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1];
@@ -3102,10 +3103,33 @@ static void emulator_atd_cb(struct ofono_emulator *em,
 				str[len - 1] != ';')
 			goto fail;
 
-		strncpy(number, str, len - 1);
-		number[len - 1] = '\0';
+		if (len == 3 && str[0] == '>' && str[1] == '1') {
+			struct ofono_atom *mw_atom;
+			struct ofono_message_waiting *mw;
+			const struct ofono_phone_number *ph;
+			const char *num;
 
-		emulator_dial(em, vc, number);
+			mw_atom = __ofono_modem_find_atom(modem,
+					OFONO_ATOM_TYPE_MESSAGE_WAITING);
+
+			if (mw_atom == NULL)
+				goto fail;
+
+			mw = __ofono_atom_get_data(mw_atom);
+			ph = __ofono_message_waiting_get_mbdn(mw, 0);
+
+			if (ph == NULL)
+				goto fail;
+
+			num = phone_number_to_string(ph);
+
+			emulator_dial(em, vc, num);
+		} else {
+			strncpy(number, str, len - 1);
+			number[len - 1] = '\0';
+
+			emulator_dial(em, vc, number);
+		}
 		break;
 
 	default:
-- 
1.7.1


  parent reply	other threads:[~2011-06-21 16:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21 16:48 [PATCH v2 0/2] Add ATD>1; support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-06-21 16:48 ` [PATCH v2 1/2] message-waiting: API to retrieve voicemail number =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-06-21 16:48 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis [this message]
2011-06-21 17:09 ` [PATCH v2 0/2] Add ATD>1; support for HFP emulator Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308674914-13037-3-git-send-email-frederic.danis@linux.intel.com \
    --to=frederic.danis@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox