Skip to contentSkip to conversation

Handset voice dial signalling patch

PATCH Peter Zotov 2 participants 8 messages Jan 13, 2010 – Jan 15, 2010 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hello.

I wrote a patch (attached) that makes dummy telephony interface send a DBus signal (through org.bluez.TelephonyTest interface) every time a voice dialing is started. It may be useful when you have only this button on a handset (e.g. SonyEricsson HBH602 owned by me) and want to answer some VoIP client call with it.

Patch works both with BlueZ 4.60 and 4.57-1 built with dpkg-buildpackage.

I have an example Skype client that answers calls using this feature and Skype DBus API, and can post it if someone is interested in.

Signature · 1 line
  WBR, Peter Zotov
audio/headset.c +31 -0
diff -ur bluez-4.60.old/audio/headset.c bluez-4.60.new/audio/headset.c
@@ -157,6 +157,8 @@
 	gboolean inband_ring;
 	gboolean nrec;
 	gboolean nrec_req;
+	gboolean voice_dial;
+	gboolean voice_dial_req;
 
 	headset_state_t state;
 	struct pending_connect *pending;
@@ -1084,6 +1086,17 @@
 	return telephony_generic_rsp(telephony_device, err);
 }
 
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err)
+{
+	struct audio_device *device = telephony_device;
+	struct headset *hs = device->headset;
+
+	if (err == CME_ERROR_NONE)
+		hs->voice_dial = hs->voice_dial_req;
+
+	return telephony_generic_rsp(telephony_device, err);
+}
+
 int telephony_operator_selection_ind(int mode, const char *oper)
 {
 	if (!active_devices)
@@ -1132,6 +1145,23 @@
 	return 0;
 }
 
+static int voice_dial(struct audio_device *device, const char *buf)
+{
+	struct headset* hs = device->headset;
+
+	if (strlen(buf) < 9)
+		return -EINVAL;
+
+	if (buf[8] == '0')
+		hs->voice_dial_req = FALSE;
+	else
+		hs->voice_dial_req = TRUE;
+
+	telephony_voice_dial_req(device, hs->voice_dial_req);
+
+	return 0;
+}
+
 static struct event event_callbacks[] = {
 	{ "ATA", answer_call },
 	{ "ATD", dial_number },
@@ -1152,6 +1182,7 @@
 	{ "AT+CCWA", call_waiting_notify },
 	{ "AT+COPS", operator_selection },
 	{ "AT+NREC", nr_and_ec },
+	{ "AT+BVRA", voice_dial },
 	{ 0 }
 };
 
audio/telephony-dummy.c +19 -2
diff -ur bluez-4.60.old/audio/telephony-dummy.c bluez-4.60.new/audio/telephony-dummy.c
@@ -36,6 +36,8 @@
 #include "logging.h"
 #include "telephony.h"
 
+static DBusConnection *connection = NULL;
+
 static const char *chld_str = "0,1,1x,2,2x,3,4";
 static char *subscriber_number = NULL;
 static char *active_call_number = NULL;
@@ -205,6 +207,18 @@
 	telephony_nr_and_ec_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-dummy: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	g_dbus_emit_signal(connection, "/org/bluez/test",
+			"org.bluez.TelephonyTest", "VoiceDial",
+			DBUS_TYPE_INVALID);
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 void telephony_key_press_req(void *telephony_device, const char *keys)
 {
 	debug("telephony-dummy: got key press request for %s", keys);
@@ -389,7 +403,10 @@
 	{ }
 };
 
-static DBusConnection *connection = NULL;
+static GDBusSignalTable dummy_signals[] = {
+	{ "VoiceDial",	"" },
+	{ }
+};
 
 int telephony_init(void)
 {
@@ -401,7 +418,7 @@
 
 	g_dbus_register_interface(connection, "/org/bluez/test",
 					"org.bluez.TelephonyTest",
-					dummy_methods, NULL,
+					dummy_methods, dummy_signals,
 					NULL, NULL, NULL);
 
 	telephony_ready_ind(features, dummy_indicators, response_and_hold,
audio/telephony.h +2 -0
diff -ur bluez-4.60.old/audio/telephony.h bluez-4.60.new/audio/telephony.h
@@ -155,6 +155,7 @@
 void telephony_operator_selection_req(void *telephony_device);
 void telephony_call_hold_req(void *telephony_device, const char *cmd);
 void telephony_nr_and_ec_req(void *telephony_device, gboolean enable);
+void telephony_voice_dial_req(void *telephony_device, gboolean enable);
 void telephony_key_press_req(void *telephony_device, const char *keys);
 
 /* AG responses to HF requests. These are implemented by headset.c */
@@ -170,6 +171,7 @@
 int telephony_operator_selection_rsp(void *telephony_device, cme_error_t err);
 int telephony_call_hold_rsp(void *telephony_device, cme_error_t err);
 int telephony_nr_and_ec_rsp(void *telephony_device, cme_error_t err);
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err);
 int telephony_key_press_rsp(void *telephony_device, cme_error_t err);
 
 /* Event indications by AG. These are implemented by headset.c */
#1 lore raw

Hi,

Quoted 5 lines · Peter Zotov

I wrote a patch (attached) that makes dummy telephony interface send a DBus signal (through org.bluez.TelephonyTest interface) every time a voice dialing is started. It may be useful when you have only this button on a handset (e.g. SonyEricsson HBH602 owned by me) and want to answer some VoIP client call with it.

It sounds to me like you're working around another problem. I suspect the issue you're facing is that you don't have a telephony driver that'd keep the headset up-to-date with the current call state, so when you want to answer a call the headset doesn't generate the right AT command (ATA) since it doesn't know that there's an incoming call (instead, the only command it manages to generate is the voice recognition one since that's the default behaviour when the headset thinks that there are no active or pending calls).

Quoted 1 line

From the perspective of adding voice recognition support the patch is a

step in the right direction, but it seems that's not the right way to solve your issue (of answering incoming calls). You'd also need to add the new telephony functions to the other drivers since they would fail to build right now with the patch.

Johan

#2 lore raw
Quoted 8 lines · Johan Hedberg

It sounds to me like you're working around another problem. I suspect the issue you're facing is that you don't have a telephony driver that'd keep the headset up-to-date with the current call state, so when you want to answer a call the headset doesn't generate the right AT command (ATA) since it doesn't know that there's an incoming call (instead, the only command it manages to generate is the voice recognition one since that's the default behaviour when the headset thinks that there are no active or pending calls).

Not exactly. All the code I included to BlueZ is implementing voice dialing, perhaps partially; but the interface it exports to outside world is misused by VoIP answering emulator because it would be probably too hard to emulate all the conversation that is usually occuring between HS and AG when there is a real call just to make it reply ATA to VoIP proxy. Maybe it's the wrong approach, but it is good enough for task.

Quoted 5 lines

From the perspective of adding voice recognition support the patch is a step in the right direction, but it seems that's not the right way to solve your issue (of answering incoming calls). You'd also need to add the new telephony functions to the other drivers since they would fail to build right now with the patch.

Fixed, new variant is attached.

Signature · 1 line
  WBR, Peter Zotov
audio/headset.c +31 -0
diff -ur bluez-4.60.old/audio/headset.c bluez-4.60.new/audio/headset.c
@@ -157,6 +157,8 @@
 	gboolean inband_ring;
 	gboolean nrec;
 	gboolean nrec_req;
+	gboolean voice_dial;
+	gboolean voice_dial_req;
 
 	headset_state_t state;
 	struct pending_connect *pending;
@@ -1084,6 +1086,17 @@
 	return telephony_generic_rsp(telephony_device, err);
 }
 
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err)
+{
+	struct audio_device *device = telephony_device;
+	struct headset *hs = device->headset;
+
+	if (err == CME_ERROR_NONE)
+		hs->voice_dial = hs->voice_dial_req;
+
+	return telephony_generic_rsp(telephony_device, err);
+}
+
 int telephony_operator_selection_ind(int mode, const char *oper)
 {
 	if (!active_devices)
@@ -1132,6 +1145,23 @@
 	return 0;
 }
 
+static int voice_dial(struct audio_device *device, const char *buf)
+{
+	struct headset* hs = device->headset;
+
+	if (strlen(buf) < 9)
+		return -EINVAL;
+
+	if (buf[8] == '0')
+		hs->voice_dial_req = FALSE;
+	else
+		hs->voice_dial_req = TRUE;
+
+	telephony_voice_dial_req(device, hs->voice_dial_req);
+
+	return 0;
+}
+
 static struct event event_callbacks[] = {
 	{ "ATA", answer_call },
 	{ "ATD", dial_number },
@@ -1152,6 +1182,7 @@
 	{ "AT+CCWA", call_waiting_notify },
 	{ "AT+COPS", operator_selection },
 	{ "AT+NREC", nr_and_ec },
+	{ "AT+BVRA", voice_dial },
 	{ 0 }
 };
 
audio/telephony-dummy.c +19 -2
diff -ur bluez-4.60.old/audio/telephony-dummy.c bluez-4.60.new/audio/telephony-dummy.c
@@ -36,6 +36,8 @@
 #include "logging.h"
 #include "telephony.h"
 
+static DBusConnection *connection = NULL;
+
 static const char *chld_str = "0,1,1x,2,2x,3,4";
 static char *subscriber_number = NULL;
 static char *active_call_number = NULL;
@@ -205,6 +207,18 @@
 	telephony_nr_and_ec_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-dummy: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	g_dbus_emit_signal(connection, "/org/bluez/test",
+			"org.bluez.TelephonyTest", "VoiceDial",
+			DBUS_TYPE_INVALID);
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 void telephony_key_press_req(void *telephony_device, const char *keys)
 {
 	debug("telephony-dummy: got key press request for %s", keys);
@@ -389,7 +403,10 @@
 	{ }
 };
 
-static DBusConnection *connection = NULL;
+static GDBusSignalTable dummy_signals[] = {
+	{ "VoiceDial",	"" },
+	{ }
+};
 
 int telephony_init(void)
 {
@@ -401,7 +418,7 @@
 
 	g_dbus_register_interface(connection, "/org/bluez/test",
 					"org.bluez.TelephonyTest",
-					dummy_methods, NULL,
+					dummy_methods, dummy_signals,
 					NULL, NULL, NULL);
 
 	telephony_ready_ind(features, dummy_indicators, response_and_hold,
audio/telephony.h +2 -0
diff -ur bluez-4.60.old/audio/telephony.h bluez-4.60.new/audio/telephony.h
@@ -155,6 +155,7 @@
 void telephony_operator_selection_req(void *telephony_device);
 void telephony_call_hold_req(void *telephony_device, const char *cmd);
 void telephony_nr_and_ec_req(void *telephony_device, gboolean enable);
+void telephony_voice_dial_req(void *telephony_device, gboolean enable);
 void telephony_key_press_req(void *telephony_device, const char *keys);
 
 /* AG responses to HF requests. These are implemented by headset.c */
@@ -170,6 +171,7 @@
 int telephony_operator_selection_rsp(void *telephony_device, cme_error_t err);
 int telephony_call_hold_rsp(void *telephony_device, cme_error_t err);
 int telephony_nr_and_ec_rsp(void *telephony_device, cme_error_t err);
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err);
 int telephony_key_press_rsp(void *telephony_device, cme_error_t err);
 
 /* Event indications by AG. These are implemented by headset.c */
audio/telephony-maemo.c +8 -0
diff -ur bluez-4.60.old/audio/telephony-maemo.c bluez-4.60.new/audio/telephony-maemo.c
@@ -887,6 +887,14 @@
 		telephony_key_press_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-maemo: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 static void handle_incoming_call(DBusMessage *msg)
 {
 	const char *number, *call_path;
audio/telephony-ofono.c +8 -0
diff -ur bluez-4.60.old/audio/telephony-ofono.c bluez-4.60.new/audio/telephony-ofono.c
@@ -387,6 +387,14 @@
 	telephony_key_press_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-ofono: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 static gboolean iter_get_basic_args(DBusMessageIter *iter,
 					int first_arg_type, ...)
 {
#3 lore raw

Hi Peter,

Quoted 9 lines · Peter Zotov
Quoted 8 lines · Johan Hedberg

It sounds to me like you're working around another problem. I suspect the issue you're facing is that you don't have a telephony driver that'd keep the headset up-to-date with the current call state, so when you want to answer a call the headset doesn't generate the right AT command (ATA) since it doesn't know that there's an incoming call (instead, the only command it manages to generate is the voice recognition one since that's the default behaviour when the headset thinks that there are no active or pending calls).

Quoted 7 lines

Not exactly. All the code I included to BlueZ is implementing voice dialing, perhaps partially; but the interface it exports to outside world is misused by VoIP answering emulator because it would be probably too hard to emulate all the conversation that is usually occuring between HS and AG when there is a real call just to make it reply ATA to VoIP proxy. Maybe it's the wrong approach, but it is good enough for task.

Fair enough. I just wanted to make sure that you realize what the core issue is. As long as the misuse of voice dialing isn't in the BlueZ code itself I have no objections ;)

audio/headset.c line 161

Quoted 2 lines
audio/headset.c +2 -0
+	gboolean voice_dial;
+	gboolean voice_dial_req;

I'm not so sure that it'll be useful to have this state info in headset.c. I suspect for the most part voice recognition will be a platform specific issue that can be taken care of by the telephony driver. So I'd leave out these new variables for now and add them later if it turns out that there's actually some use for them in headset.c.

After this change I think the patch could be pushed upstream.

Johan

#4 lore raw
Quoted 10 lines · Johan Hedberg

Review

Quoted 2 lines
(quoted diff) +2 -0
+	gboolean voice_dial;
+	gboolean voice_dial_req;

I'm not so sure that it'll be useful to have this state info in headset.c. I suspect for the most part voice recognition will be a platform specific issue that can be taken care of by the telephony driver. So I'd leave out these new variables for now and add them later if it turns out that there's actually some use for them in headset.c.

After this change I think the patch could be pushed upstream.

Fixed.

Signature · 1 line
  WBR, Peter Zotov
audio/headset.c +22 -0
diff -ur bluez-4.60.old/audio/headset.c bluez-4.60.new/audio/headset.c
@@ -1084,6 +1084,11 @@
 	return telephony_generic_rsp(telephony_device, err);
 }
 
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err)
+{
+	return telephony_generic_rsp(telephony_device, err);
+}
+
 int telephony_operator_selection_ind(int mode, const char *oper)
 {
 	if (!active_devices)
@@ -1132,6 +1137,22 @@
 	return 0;
 }
 
+static int voice_dial(struct audio_device *device, const char *buf)
+{
+	if (strlen(buf) < 9)
+		return -EINVAL;
+
+	gboolean start_dialing;
+	if (buf[8] == '0')
+		start_dialing = FALSE;
+	else
+		start_dialing = TRUE;
+
+	telephony_voice_dial_req(device, start_dialing);
+
+	return 0;
+}
+
 static struct event event_callbacks[] = {
 	{ "ATA", answer_call },
 	{ "ATD", dial_number },
@@ -1152,6 +1173,7 @@
 	{ "AT+CCWA", call_waiting_notify },
 	{ "AT+COPS", operator_selection },
 	{ "AT+NREC", nr_and_ec },
+	{ "AT+BVRA", voice_dial },
 	{ 0 }
 };
 
audio/telephony-dummy.c +19 -2
diff -ur bluez-4.60.old/audio/telephony-dummy.c bluez-4.60.new/audio/telephony-dummy.c
@@ -36,6 +36,8 @@
 #include "logging.h"
 #include "telephony.h"
 
+static DBusConnection *connection = NULL;
+
 static const char *chld_str = "0,1,1x,2,2x,3,4";
 static char *subscriber_number = NULL;
 static char *active_call_number = NULL;
@@ -205,6 +207,18 @@
 	telephony_nr_and_ec_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-dummy: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	g_dbus_emit_signal(connection, "/org/bluez/test",
+			"org.bluez.TelephonyTest", "VoiceDial",
+			DBUS_TYPE_INVALID);
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 void telephony_key_press_req(void *telephony_device, const char *keys)
 {
 	debug("telephony-dummy: got key press request for %s", keys);
@@ -389,7 +403,10 @@
 	{ }
 };
 
-static DBusConnection *connection = NULL;
+static GDBusSignalTable dummy_signals[] = {
+	{ "VoiceDial",	"" },
+	{ }
+};
 
 int telephony_init(void)
 {
@@ -401,7 +418,7 @@
 
 	g_dbus_register_interface(connection, "/org/bluez/test",
 					"org.bluez.TelephonyTest",
-					dummy_methods, NULL,
+					dummy_methods, dummy_signals,
 					NULL, NULL, NULL);
 
 	telephony_ready_ind(features, dummy_indicators, response_and_hold,
audio/telephony.h +2 -0
diff -ur bluez-4.60.old/audio/telephony.h bluez-4.60.new/audio/telephony.h
@@ -155,6 +155,7 @@
 void telephony_operator_selection_req(void *telephony_device);
 void telephony_call_hold_req(void *telephony_device, const char *cmd);
 void telephony_nr_and_ec_req(void *telephony_device, gboolean enable);
+void telephony_voice_dial_req(void *telephony_device, gboolean enable);
 void telephony_key_press_req(void *telephony_device, const char *keys);
 
 /* AG responses to HF requests. These are implemented by headset.c */
@@ -170,6 +171,7 @@
 int telephony_operator_selection_rsp(void *telephony_device, cme_error_t err);
 int telephony_call_hold_rsp(void *telephony_device, cme_error_t err);
 int telephony_nr_and_ec_rsp(void *telephony_device, cme_error_t err);
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err);
 int telephony_key_press_rsp(void *telephony_device, cme_error_t err);
 
 /* Event indications by AG. These are implemented by headset.c */
audio/telephony-maemo.c +8 -0
diff -ur bluez-4.60.old/audio/telephony-maemo.c bluez-4.60.new/audio/telephony-maemo.c
@@ -887,6 +887,14 @@
 		telephony_key_press_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-maemo: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 static void handle_incoming_call(DBusMessage *msg)
 {
 	const char *number, *call_path;
audio/telephony-ofono.c +8 -0
diff -ur bluez-4.60.old/audio/telephony-ofono.c bluez-4.60.new/audio/telephony-ofono.c
@@ -387,6 +387,14 @@
 	telephony_key_press_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-ofono: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 static gboolean iter_get_basic_args(DBusMessageIter *iter,
 					int first_arg_type, ...)
 {
#5 lore raw

Hi,

Quoted 10 lines · Peter Zotov
Quoted 9 lines · Johan Hedberg

Review

Quoted 2 lines
(quoted diff) +2 -0
+	gboolean voice_dial;
+	gboolean voice_dial_req;

I'm not so sure that it'll be useful to have this state info in headset.c. I suspect for the most part voice recognition will be a platform specific issue that can be taken care of by the telephony driver. So I'd leave out these new variables for now and add them later if it turns out that there's actually some use for them in headset.c.

Quoted 2 lines
Quoted 1 line

After this change I think the patch could be pushed upstream.

Fixed.

Thanks, however there are still a couple of things that I noticed (sorry for not spotting them earlier). Once the issues in the code are fixed, please create a patch that's appliable using git am, i.e. commit to your own tree (with an appropriate commit message) and prepare a patch file with git format-patch.

audio/headset.c line 1145

Quoted 6 lines
audio/headset.c +6 -0
+static int voice_dial(struct audio_device *device, const char *buf)
+{
+	if (strlen(buf) < 9)
+		return -EINVAL;
+
+	gboolean start_dialing;

No variable declarations after code in the same scope. Please check your patch with the configure script options used by bootstrap-configure and you'll get something like the following with your patch:

audio/headset.c: In function ‘voice_dial’:
audio/headset.c:1145: error: ISO C90 forbids mixed declarations and code

audio/telephony-dummy.c line 220

Quoted 11 lines
audio/telephony-dummy.c +11 -0
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-dummy: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	g_dbus_emit_signal(connection, "/org/bluez/test",
+			"org.bluez.TelephonyTest", "VoiceDial",
+			DBUS_TYPE_INVALID);
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}

Why return ERROR_NOT_SUPPORTED instead of ERROR_NONE here? After all, you did successfully process the command (i.e. send the signal).

Johan

#6 lore raw
Quoted 5 lines · Johan Hedberg

Thanks, however there are still a couple of things that I noticed (sorry for not spotting them earlier). Once the issues in the code are fixed, please create a patch that's appliable using git am, i.e. commit to your own tree (with an appropriate commit message) and prepare a patch file with git format-patch.

I fixed everything and created a patch with git format-patch. Probably the resulting file is intended to send as a email directly, but I don't know how to do this with Thunderbird, so it is attached.

Signature · 1 line
  WBR, Peter Zotov
Quoted 1 line

From 08379e8dc72650452f62a5c112c0d32afe9db1e6 Mon Sep 17 00:00:00 2001

From: Peter Zotov <[email protected]>
Date: Thu, 14 Jan 2010 23:29:59 +0300
Subject: [PATCH] Add preliminary voice dialling support for HSP

---
 audio/headset.c         |   23 +++++++++++++++++++++++
 audio/telephony-dummy.c |   21 +++++++++++++++++++--
 audio/telephony-maemo.c |    8 ++++++++
 audio/telephony-ofono.c |    8 ++++++++
 audio/telephony.h       |    2 ++
 5 files changed, 60 insertions(+), 2 deletions(-)
audio/headset.c +23 -0
index 765ddb0..bdd26e6 100644
@@ -1084,6 +1084,11 @@ int telephony_nr_and_ec_rsp(void *telephony_device, cme_error_t err)
 	return telephony_generic_rsp(telephony_device, err);
 }
 
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err)
+{
+	return telephony_generic_rsp(telephony_device, err);
+}
+
 int telephony_operator_selection_ind(int mode, const char *oper)
 {
 	if (!active_devices)
@@ -1132,6 +1137,23 @@ static int nr_and_ec(struct audio_device *device, const char *buf)
 	return 0;
 }
 
+static int voice_dial(struct audio_device *device, const char *buf)
+{
+	gboolean start_dialing;
+
+	if (strlen(buf) < 9)
+		return -EINVAL;
+
+	if (buf[8] == '0')
+		start_dialing = FALSE;
+	else
+		start_dialing = TRUE;
+
+	telephony_voice_dial_req(device, start_dialing);
+
+	return 0;
+}
+
 static struct event event_callbacks[] = {
 	{ "ATA", answer_call },
 	{ "ATD", dial_number },
@@ -1152,6 +1174,7 @@ static struct event event_callbacks[] = {
 	{ "AT+CCWA", call_waiting_notify },
 	{ "AT+COPS", operator_selection },
 	{ "AT+NREC", nr_and_ec },
+	{ "AT+BVRA", voice_dial },
 	{ 0 }
 };
 
audio/telephony-dummy.c +19 -2
index 5478d03..2409a49 100644
@@ -36,6 +36,8 @@
 #include "logging.h"
 #include "telephony.h"
 
+static DBusConnection *connection = NULL;
+
 static const char *chld_str = "0,1,1x,2,2x,3,4";
 static char *subscriber_number = NULL;
 static char *active_call_number = NULL;
@@ -205,6 +207,18 @@ void telephony_nr_and_ec_req(void *telephony_device, gboolean enable)
 	telephony_nr_and_ec_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-dummy: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	g_dbus_emit_signal(connection, "/org/bluez/test",
+			"org.bluez.TelephonyTest", "VoiceDial",
+			DBUS_TYPE_INVALID);
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NONE);
+}
+
 void telephony_key_press_req(void *telephony_device, const char *keys)
 {
 	debug("telephony-dummy: got key press request for %s", keys);
@@ -389,7 +403,10 @@ static GDBusMethodTable dummy_methods[] = {
 	{ }
 };
 
-static DBusConnection *connection = NULL;
+static GDBusSignalTable dummy_signals[] = {
+	{ "VoiceDial",	"" },
+	{ }
+};
 
 int telephony_init(void)
 {
@@ -401,7 +418,7 @@ int telephony_init(void)
 
 	g_dbus_register_interface(connection, "/org/bluez/test",
 					"org.bluez.TelephonyTest",
-					dummy_methods, NULL,
+					dummy_methods, dummy_signals,
 					NULL, NULL, NULL);
 
 	telephony_ready_ind(features, dummy_indicators, response_and_hold,
audio/telephony-maemo.c +8 -0
index f8da349..98f4409 100644
@@ -887,6 +887,14 @@ void telephony_key_press_req(void *telephony_device, const char *keys)
 		telephony_key_press_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-maemo: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 static void handle_incoming_call(DBusMessage *msg)
 {
 	const char *number, *call_path;
audio/telephony-ofono.c +8 -0
index 2778cfc..3df76c3 100644
@@ -387,6 +387,14 @@ void telephony_key_press_req(void *telephony_device, const char *keys)
 	telephony_key_press_rsp(telephony_device, CME_ERROR_NONE);
 }
 
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+	debug("telephony-ofono: got %s voice dial request",
+			enable ? "enable" : "disable");
+
+	telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
 static gboolean iter_get_basic_args(DBusMessageIter *iter,
 					int first_arg_type, ...)
 {
audio/telephony.h +2 -0
index da39751..0bc4769 100644
@@ -155,6 +155,7 @@ void telephony_list_current_calls_req(void *telephony_device);
 void telephony_operator_selection_req(void *telephony_device);
 void telephony_call_hold_req(void *telephony_device, const char *cmd);
 void telephony_nr_and_ec_req(void *telephony_device, gboolean enable);
+void telephony_voice_dial_req(void *telephony_device, gboolean enable);
 void telephony_key_press_req(void *telephony_device, const char *keys);
 
 /* AG responses to HF requests. These are implemented by headset.c */
@@ -170,6 +171,7 @@ int telephony_list_current_calls_rsp(void *telephony_device, cme_error_t err);
 int telephony_operator_selection_rsp(void *telephony_device, cme_error_t err);
 int telephony_call_hold_rsp(void *telephony_device, cme_error_t err);
 int telephony_nr_and_ec_rsp(void *telephony_device, cme_error_t err);
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err);
 int telephony_key_press_rsp(void *telephony_device, cme_error_t err);
 
 /* Event indications by AG. These are implemented by headset.c */
Signature · 1 line
1.6.3.3
#7 lore raw

Hi Peter,

Quoted 3 lines · Peter Zotov

I fixed everything and created a patch with git format-patch. Probably the resulting file is intended to send as a email directly, but I don't know how to do this with Thunderbird, so it is attached.

An attachment is fine, thanks. The patch is now pushed upstream with one more minor modification: I changed "start_dialing" to "enable" in headset.c to be consistent with what it's called in the drivers.

Johan