Fix cleaning up HFP state after calling telephony_exit

HFP state variables in telephony.h need to be reset when telephony_exit
is called. This is even more important now that telephony_init/exit get
called simply by toggling the adapter powered state.
diff --git a/audio/headset.c b/audio/headset.c
index aaf7039..00db2ff 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -2802,6 +2802,18 @@
 	return 0;
 }
 
+int telephony_deinit(void)
+{
+	memset(&ag, 0, sizeof(ag));
+
+	ag.er_mode = 3;
+	ag.rh = BTRH_NOT_SUPPORTED;
+
+	DBG("Telephony deinitialized");
+
+	return 0;
+}
+
 int telephony_list_current_call_ind(int idx, int dir, int status, int mode,
 					int mprty, const char *number,
 					int type)
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 4f77488..1f89079 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -428,4 +428,6 @@
 						TELEPHONY_DUMMY_IFACE);
 	dbus_connection_unref(connection);
 	connection = NULL;
+
+	telephony_deinit();
 }
diff --git a/audio/telephony-maemo5.c b/audio/telephony-maemo5.c
index c72e39b..350df9e 100644
--- a/audio/telephony-maemo5.c
+++ b/audio/telephony-maemo5.c
@@ -2099,4 +2099,6 @@
 
 	dbus_connection_unref(connection);
 	connection = NULL;
+
+	telephony_deinit();
 }
diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 1e030d6..0c99c34 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -2028,4 +2028,6 @@
 
 	dbus_connection_unref(connection);
 	connection = NULL;
+
+	telephony_deinit();
 }
diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
index 7cc3a8f..00c3f6e 100644
--- a/audio/telephony-ofono.c
+++ b/audio/telephony-ofono.c
@@ -1108,4 +1108,6 @@
 
 	dbus_connection_unref(connection);
 	connection = NULL;
+
+	telephony_deinit();
 }
diff --git a/audio/telephony.h b/audio/telephony.h
index 7d137be..73b390c 100644
--- a/audio/telephony.h
+++ b/audio/telephony.h
@@ -188,6 +188,7 @@
 int telephony_calling_stopped_ind(void);
 int telephony_ready_ind(uint32_t features, const struct indicator *indicators,
 			int rh, const char *chld);
+int telephony_deinit(void);
 int telephony_list_current_call_ind(int idx, int dir, int status, int mode,
 					int mprty, const char *number,
 					int type);