Fix HFP response and hold (AT+BTRH) command response

Since no telephony driver supports this command at the moment the
correct behavior is to always return an error. Therefore, a new
"not supported" value is needed for the respective state variable.
diff --git a/audio/headset.c b/audio/headset.c
index 3d584e0..97ae4fd 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -84,7 +84,7 @@
 	.features = 0,
 	.er_mode = 3,
 	.er_ind = 0,
-	.rh = -1,
+	.rh = BTRH_NOT_SUPPORTED,
 	.number = NULL,
 	.number_type = 0,
 	.ring_timer = 0,
@@ -892,6 +892,9 @@
 	if (strlen(buf) < 8)
 		return -EINVAL;
 
+	if (ag.rh == BTRH_NOT_SUPPORTED)
+		return telephony_generic_rsp(device, CME_ERROR_NOT_SUPPORTED);
+
 	if (buf[7] == '=') {
 		telephony_response_and_hold_req(device, atoi(&buf[8]) < 0);
 		return 0;
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index c02cea2..4f77488 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -50,14 +50,6 @@
 
 static gboolean events_enabled = FALSE;
 
-/* Response and hold state
- * -1 = none
- *  0 = incoming call is put on hold in the AG
- *  1 = held incoming call is accepted in the AG
- *  2 = held incoming call is rejected in the AG
- */
-static int response_and_hold = -1;
-
 static struct indicator dummy_indicators[] =
 {
 	{ "battchg",	"0-5",	5,	TRUE },
@@ -90,11 +82,8 @@
 
 void telephony_response_and_hold_req(void *telephony_device, int rh)
 {
-	response_and_hold = rh;
-
-	telephony_response_and_hold_ind(response_and_hold);
-
-	telephony_response_and_hold_rsp(telephony_device, CME_ERROR_NONE);
+	telephony_response_and_hold_rsp(telephony_device,
+						CME_ERROR_NOT_SUPPORTED);
 }
 
 void telephony_last_dialed_number_req(void *telephony_device)
@@ -425,8 +414,8 @@
 		return -1;
 	}
 
-	telephony_ready_ind(features, dummy_indicators, response_and_hold,
-				chld_str);
+	telephony_ready_ind(features, dummy_indicators, BTRH_NOT_SUPPORTED,
+								chld_str);
 
 	return 0;
 }
diff --git a/audio/telephony-maemo5.c b/audio/telephony-maemo5.c
index 6ee57c7..c72e39b 100644
--- a/audio/telephony-maemo5.c
+++ b/audio/telephony-maemo5.c
@@ -210,14 +210,6 @@
 /* Supported set of call hold operations */
 static const char *chld_str = "0,1,1x,2,2x,3,4";
 
-/* Response and hold state
- * -1 = none
- *  0 = incoming call is put on hold in the AG
- *  1 = held incoming call is accepted in the AG
- *  2 = held incoming call is rejected in the AG
- */
-static int response_and_hold = -1;
-
 static char *last_dialed_number = NULL;
 
 /* Timer for tracking call creation requests */
@@ -517,11 +509,8 @@
 
 void telephony_response_and_hold_req(void *telephony_device, int rh)
 {
-	response_and_hold = rh;
-
-	telephony_response_and_hold_ind(response_and_hold);
-
-	telephony_response_and_hold_rsp(telephony_device, CME_ERROR_NONE);
+	telephony_response_and_hold_rsp(telephony_device,
+						CME_ERROR_NOT_SUPPORTED);
 }
 
 void telephony_last_dialed_number_req(void *telephony_device)
@@ -2086,7 +2075,7 @@
 	DBG("telephony-maemo registering %s interface on path %s",
 			TELEPHONY_MAEMO_INTERFACE, TELEPHONY_MAEMO_PATH);
 
-	telephony_ready_ind(features, maemo_indicators, response_and_hold,
+	telephony_ready_ind(features, maemo_indicators, BTRH_NOT_SUPPORTED,
 								chld_str);
 	if (send_method_call("org.freedesktop.Hal",
 				"/org/freedesktop/Hal/Manager",
diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 57f022d..1e030d6 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -171,14 +171,6 @@
 /* Supported set of call hold operations */
 static const char *chld_str = "0,1,1x,2,2x,3,4";
 
-/* Response and hold state
- * -1 = none
- *  0 = incoming call is put on hold in the AG
- *  1 = held incoming call is accepted in the AG
- *  2 = held incoming call is rejected in the AG
- */
-static int response_and_hold = -1;
-
 static char *last_dialed_number = NULL;
 
 /* Timer for tracking call creation requests */
@@ -479,11 +471,8 @@
 
 void telephony_response_and_hold_req(void *telephony_device, int rh)
 {
-	response_and_hold = rh;
-
-	telephony_response_and_hold_ind(response_and_hold);
-
-	telephony_response_and_hold_rsp(telephony_device, CME_ERROR_NONE);
+	telephony_response_and_hold_rsp(telephony_device,
+						CME_ERROR_NOT_SUPPORTED);
 }
 
 void telephony_last_dialed_number_req(void *telephony_device)
@@ -1992,7 +1981,7 @@
 	DBG("telephony-maemo6 registering %s interface on path %s",
 			TELEPHONY_MAEMO_INTERFACE, TELEPHONY_MAEMO_PATH);
 
-	telephony_ready_ind(features, maemo_indicators, response_and_hold,
+	telephony_ready_ind(features, maemo_indicators, BTRH_NOT_SUPPORTED,
 								chld_str);
 	if (send_method_call("org.freedesktop.Hal",
 				"/org/freedesktop/Hal/Manager",
diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
index 693207c..7cc3a8f 100644
--- a/audio/telephony-ofono.c
+++ b/audio/telephony-ofono.c
@@ -88,14 +88,6 @@
 
 static gboolean events_enabled = FALSE;
 
-/* Response and hold state
- * -1 = none
- *  0 = incoming call is put on hold in the AG
- *  1 = held incoming call is accepted in the AG
- *  2 = held incoming call is rejected in the AG
- */
-static int response_and_hold = -1;
-
 static struct indicator ofono_indicators[] =
 {
 	{ "battchg",	"0-5",	5,	TRUE },
@@ -156,11 +148,8 @@
 
 void telephony_response_and_hold_req(void *telephony_device, int rh)
 {
-	response_and_hold = rh;
-
-	telephony_response_and_hold_ind(response_and_hold);
-
-	telephony_response_and_hold_rsp(telephony_device, CME_ERROR_NONE);
+	telephony_response_and_hold_rsp(telephony_device,
+						CME_ERROR_NOT_SUPPORTED);
 }
 
 void telephony_last_dialed_number_req(void *telephony_device)
@@ -534,8 +523,8 @@
                 dbus_message_iter_next(&iter_entry);
         }
 
-	telephony_ready_ind(features, ofono_indicators,
-				response_and_hold, chld_str);
+	telephony_ready_ind(features, ofono_indicators, BTRH_NOT_SUPPORTED,
+								chld_str);
 
 done:
 	dbus_message_unref(reply);
diff --git a/audio/telephony.h b/audio/telephony.h
index 5343e8c..7d137be 100644
--- a/audio/telephony.h
+++ b/audio/telephony.h
@@ -26,6 +26,13 @@
 #include <errno.h>
 #include <glib.h>
 
+/* Response and hold values */
+#define BTRH_NOT_SUPPORTED	-2
+#define BTRH_NONE		-1
+#define BTRH_HOLD		0
+#define BTRH_ACCEPT		1
+#define BTRH_REJECT		2
+
 /* HFP feature bits */
 #define AG_FEATURE_THREE_WAY_CALLING		0x0001
 #define AG_FEATURE_EC_ANDOR_NR			0x0002