All of lore.kernel.org
 help / color / mirror / Atom feed
* [ss-notify FYI 0/6]
@ 2011-01-28 17:38 Pekka.Pessi
  2011-01-28 17:38 ` [ss-notify FYI 1/6] ssn: include ssn codes in public API Pekka.Pessi
  0 siblings, 1 reply; 7+ messages in thread
From: Pekka.Pessi @ 2011-01-28 17:38 UTC (permalink / raw)
  To: ofono

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

Hi Andras,

Here are my ss-notify patches. Perhaps 1, 3 and 4 are useful as they
are.  The patch 2 should be augmented in order to include the call id in
the API, too.  The voicecall implementation has to be revised accordingly.
The patch 6 is strictly FYI.

--Pekka


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ss-notify FYI 1/6] ssn: include ssn codes in public API
  2011-01-28 17:38 [ss-notify FYI 0/6] Pekka.Pessi
@ 2011-01-28 17:38 ` Pekka.Pessi
  2011-01-28 17:38   ` [ss-notify FYI 2/6] ssn: add ssn code argument to ssn notify callbacks Pekka.Pessi
  0 siblings, 1 reply; 7+ messages in thread
From: Pekka.Pessi @ 2011-01-28 17:38 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

Include +CSSI and +CSSU codes in <include/ssn.h> and prefix them with
OFONO_.
---
 include/ssn.h |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/include/ssn.h b/include/ssn.h
index d640cad..9466a80 100644
--- a/include/ssn.h
+++ b/include/ssn.h
@@ -36,8 +36,34 @@ struct ofono_ssn_driver {
 	void (*remove)(struct ofono_ssn *ssn);
 };
 
-/* SSN notifications (CSSI and CSSU).  */
+/* TS 27.007 Supplementary service notifications +CSSN (CSSI and CSSU) */
+enum ofono_ssn_cssi {
+	OFONO_SS_MO_UNCONDITIONAL_FORWARDING	= 0,
+	OFONO_SS_MO_CONDITIONAL_FORWARDING	= 1,
+	OFONO_SS_MO_CALL_FORWARDED		= 2,
+	OFONO_SS_MO_CALL_WAITING		= 3,
+	OFONO_SS_MO_CUG_CALL			= 4,
+	OFONO_SS_MO_OUTGOING_BARRING		= 5,
+	OFONO_SS_MO_INCOMING_BARRING		= 6,
+	OFONO_SS_MO_CLIR_SUPPRESSION_REJECTED	= 7,
+	OFONO_SS_MO_CALL_DEFLECTED		= 8,
+};
+
+enum ofono_ssn_cssu {
+	OFONO_SS_MT_CALL_FORWARDED		= 0,
+	OFONO_SS_MT_CUG_CALL			= 1,
+	OFONO_SS_MT_VOICECALL_ON_HOLD		= 2,
+	OFONO_SS_MT_VOICECALL_RETRIEVED		= 3,
+	OFONO_SS_MT_MULTIPARTY_VOICECALL	= 4,
+	OFONO_SS_MT_VOICECALL_HOLD_RELEASED	= 5,
+	OFONO_SS_MT_FORWARD_CHECK_SS_MESSAGE	= 6,
+	OFONO_SS_MT_VOICECALL_IN_TRANSFER	= 7,
+	OFONO_SS_MT_VOICECALL_TRANSFERRED	= 8,
+	OFONO_SS_MT_CALL_DEFLECTED		= 9,
+};
+
 void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code, int index);
+
 void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code, int index,
 				const struct ofono_phone_number *number);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [ss-notify FYI 2/6] ssn: add ssn code argument to ssn notify callbacks
  2011-01-28 17:38 ` [ss-notify FYI 1/6] ssn: include ssn codes in public API Pekka.Pessi
@ 2011-01-28 17:38   ` Pekka.Pessi
  2011-01-28 17:38     ` [ss-notify FYI 3/6] isimodem/ssn: add common notifications Pekka.Pessi
  0 siblings, 1 reply; 7+ messages in thread
From: Pekka.Pessi @ 2011-01-28 17:38 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

Including the ssn code as an argument in notify callbacks allows
handling of multiple notifications in single function.
---
 src/ofono.h |    4 ++--
 src/ssn.c   |    8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/ofono.h b/src/ofono.h
index df20103..e8c24a9 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -313,8 +313,8 @@ int __ofono_sms_sim_download(struct ofono_stk *stk, const struct sms *msg,
 
 #include <ofono/ssn.h>
 
-typedef void (*ofono_ssn_mo_notify_cb)(int index, void *user);
-typedef void (*ofono_ssn_mt_notify_cb)(int index,
+typedef void (*ofono_ssn_mo_notify_cb)(int index, int mo_code, void *user);
+typedef void (*ofono_ssn_mt_notify_cb)(int index, int mt_code,
 					const struct ofono_phone_number *ph,
 					void *user);
 
diff --git a/src/ssn.c b/src/ssn.c
index 64c94b7..00da3a6 100644
--- a/src/ssn.c
+++ b/src/ssn.c
@@ -118,12 +118,14 @@ void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code1, int index)
 	GSList *l;
 	ofono_ssn_mo_notify_cb notify;
 
+	DBG("ssn %p, code %u, index %u", (void *)ssn, code1, index);
+
 	for (l = ssn->mo_handler_list->items; l; l = l->next) {
 		h = l->data;
 		notify = h->item.notify;
 
 		if (h->code == code1)
-			notify(index, h->item.notify_data);
+			notify(index, code1, h->item.notify_data);
 	}
 }
 
@@ -134,12 +136,14 @@ void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code2, int index,
 	GSList *l;
 	ofono_ssn_mt_notify_cb notify;
 
+	DBG("ssn %p, code %u, index %u", (void *)ssn, code2, index);
+
 	for (l = ssn->mt_handler_list->items; l; l = l->next) {
 		h = l->data;
 		notify = h->item.notify;
 
 		if (h->code == code2)
-			notify(index, ph, h->item.notify_data);
+			notify(index, code2, ph, h->item.notify_data);
 	}
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [ss-notify FYI 3/6] isimodem/ssn: add common notifications
  2011-01-28 17:38   ` [ss-notify FYI 2/6] ssn: add ssn code argument to ssn notify callbacks Pekka.Pessi
@ 2011-01-28 17:38     ` Pekka.Pessi
  2011-01-28 17:38       ` [ss-notify FYI 4/6] call-barring: remove CSSU notifications Pekka.Pessi
  0 siblings, 1 reply; 7+ messages in thread
From: Pekka.Pessi @ 2011-01-28 17:38 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

Add notifications on hold, retrieve, multiparty, call waiting, barrings,
and call forwarding.
---
 drivers/isimodem/call.h |   12 ++++
 drivers/isimodem/ssn.c  |  168 ++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 179 insertions(+), 1 deletions(-)

diff --git a/drivers/isimodem/call.h b/drivers/isimodem/call.h
index 05f05a5..c95fa69 100644
--- a/drivers/isimodem/call.h
+++ b/drivers/isimodem/call.h
@@ -402,6 +402,18 @@ enum {
 	CALL_DTMF_DISABLE_TONE_IND_SEND =	0x02,
 };
 
+enum {
+	CALL_GSM_SSI_CALL_IS_WAITING =		0x01,
+	CALL_GSM_SSI_MPTY =			0x02,
+	CALL_GSM_SSI_CLIR_SUPPR_REJ =		0x04,
+};
+
+enum {
+	CALL_GSM_SSN_INCOMING_IS_FWD =		0x01,
+	CALL_GSM_SSN_INCOMING_FWD =		0x02,
+	CALL_GSM_SSN_OUTGOING_FWD =		0x04,
+};
+
 #ifdef __cplusplus
 };
 #endif
diff --git a/drivers/isimodem/ssn.c b/drivers/isimodem/ssn.c
index 068e5e8..ad93962 100644
--- a/drivers/isimodem/ssn.c
+++ b/drivers/isimodem/ssn.c
@@ -30,20 +30,181 @@
 #include <errno.h>
 
 #include <glib.h>
+#include <arpa/inet.h>
 
 #include <gisi/client.h>
+#include <gisi/iter.h>
 
 #include <ofono/log.h>
 #include <ofono/modem.h>
 #include <ofono/ssn.h>
 
 #include "isimodem.h"
+#include "call.h"
 #include "ss.h"
 
 struct ssn_data {
 	GIsiClient *client;
 };
 
+static void isi_ssn_ss_code(struct ofono_ssn *ssn, int call_id,
+				uint16_t ss_code, uint8_t ss_notification)
+{
+	int cssi = -1;
+	int cssu = -1;
+	struct ofono_phone_number number = { };
+
+	DBG("ss_code=%u, ss_notification=0x%02x", ss_code, ss_notification);
+
+	/* ss-code is MMI code from 22.030 */
+	switch (ss_code) {
+	case SS_GSM_FORW_UNCONDITIONAL:
+	case SS_GSM_FORW_NO_REPLY:
+	case SS_GSM_FORW_NO_REACH:
+	case SS_GSM_FORW_BUSY:
+	case SS_GSM_ALL_COND_FORWARDINGS:
+		/* ss-notification is defined in 24.080:
+		 *
+		 * SS-Notification ::= OCTET STRING (SIZE (1))
+		 * -- Bit 8 7 6 5 4 00000 (Unused)
+		 * -- Bit 3 (CALL_GSM_SSN_OUTGOING_FWD)
+		 * -- Call is forwarded indication to A-subscriber
+		 * -- (calling subscriber)
+		 * -- 0 = No information content
+		 * -- 1 = Outgoing call has been forwarded to C
+		 *
+		 * -- Bit 2 (CALL_GSM_SSN_INCOMING_FWD)
+		 * -- Call is forwarded indication to B-subscriber
+		 * -- (forwarding subscriber)
+		 * -- 0 = No information content
+		 * -- 1 = Incoming call has been forwarded to C
+		 *
+		 * -- Bit 1 (CALL_GSM_SSN_INCOMING_IS_FWD)
+		 * -- Call is forwarded indication to C-subscriber
+		 * -- (forwarded-to subscriber)
+		 * -- 0 = No information content
+		 * -- 1 = Incoming call is a forwarded call
+		 */
+		if (ss_notification & CALL_GSM_SSN_OUTGOING_FWD)
+			cssi = OFONO_SS_MO_CALL_FORWARDED;
+		else if (ss_notification & CALL_GSM_SSN_INCOMING_IS_FWD)
+			cssu = OFONO_SS_MT_CALL_FORWARDED;
+		else if (ss_notification & CALL_GSM_SSN_INCOMING_FWD) {
+			if (ss_code == SS_GSM_FORW_UNCONDITIONAL)
+				cssi = OFONO_SS_MO_CONDITIONAL_FORWARDING;
+			else
+				cssi = OFONO_SS_MO_UNCONDITIONAL_FORWARDING;
+		}
+		break;
+
+	case SS_GSM_BARR_ALL_OUT:
+	case SS_GSM_OUTGOING_BARR_SERV:
+	case SS_GSM_BARR_OUT_INTER:
+	case SS_GSM_BARR_OUT_INTER_EXC_HOME:
+		cssi = OFONO_SS_MO_OUTGOING_BARRING;
+		break;
+
+	case SS_GSM_INCOMING_BARR_SERV:
+	case SS_GSM_BARR_ALL_IN:
+	case SS_GSM_BARR_ALL_IN_ROAM:
+		cssi = OFONO_SS_MO_INCOMING_BARRING;
+		break;
+
+	default:
+		return;
+	}
+
+
+	if (cssi != -1)
+		ofono_ssn_cssi_notify(ssn, cssi, call_id);
+
+	if (cssu != -1)
+		ofono_ssn_cssu_notify(ssn, cssu, call_id, &number);
+}
+
+static void isi_ssn_notify_indicator(struct ofono_ssn *ssn, int call_id,
+					GIsiSubBlockIter const *sb)
+{
+	uint8_t bits;
+	struct ofono_phone_number number = { };
+
+	DBG("");
+
+	if (!g_isi_sb_iter_get_byte(sb, &bits, 2))
+		return;
+
+	if (bits & CALL_GSM_SSI_CALL_IS_WAITING)
+		ofono_ssn_cssi_notify(ssn, OFONO_SS_MO_CALL_WAITING, call_id);
+
+	if (bits & CALL_GSM_SSI_MPTY)
+		/* call is connected to multiparty by remote end */
+		ofono_ssn_cssu_notify(ssn, OFONO_SS_MT_MULTIPARTY_VOICECALL,
+					call_id, &number);
+
+	if (bits & CALL_GSM_SSI_CLIR_SUPPR_REJ)
+		ofono_ssn_cssi_notify(ssn,
+			OFONO_SS_MO_CLIR_SUPPRESSION_REJECTED, call_id);
+}
+
+static void isi_ssn_hold_indicator(struct ofono_ssn *ssn, int call_id,
+					GIsiSubBlockIter const *sb)
+{
+	int code;
+	uint8_t hold;
+	struct ofono_phone_number number = { };
+
+	DBG("");
+
+	if (!g_isi_sb_iter_get_byte(sb, &hold, 2))
+		return;
+
+	if (hold)
+		code = OFONO_SS_MT_VOICECALL_ON_HOLD;
+	else
+		code = OFONO_SS_MT_VOICECALL_RETRIEVED;
+
+	ofono_ssn_cssu_notify(ssn, code, call_id, &number);
+}
+
+static void isi_ssn_ind(const GIsiMessage *msg, void *data)
+{
+	struct ofono_ssn *ssn = user;
+	int call_id;
+	uint16_t ss_code = 0;
+	uint8_t ss_notification = 0;
+	GIsiSubBlockIter sb[1];
+
+	if (!g_isi_msg_data_get_byte(msg, 0, &call_id) || call_id == 0)
+		return;
+
+	DBG("call_id %u, len = %zu", call_id, len);
+
+	for (g_isi_sb_iter_init(sb, msg, 2);
+			g_isi_sb_iter_is_valid(sb);
+			g_isi_sb_iter_next(sb)) {
+		switch (g_isi_sb_iter_get_id(sb)) {
+		case CALL_GSM_SS_CODE:
+			g_isi_sb_iter_get_word(sb, &ss_code, 2);
+			break;
+
+		case CALL_GSM_SS_NOTIFY:
+			g_isi_sb_iter_get_byte(sb, &ss_notification, 2);
+			break;
+
+		case CALL_GSM_SS_NOTIFY_INDICATOR:
+			isi_ssn_notify_indicator(ssn, call_id, sb);
+			break;
+
+		case CALL_GSM_SS_HOLD_INDICATOR:
+			isi_ssn_hold_indicator(ssn, call_id, sb);
+			break;
+		}
+	}
+
+	if (ss_code != 0)
+		isi_ssn_ss_code(ssn, call_id, ss_code, ss_notification);
+}
+
 static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
 				void *user)
 {
@@ -54,7 +215,7 @@ static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
 	if (sd == NULL)
 		return -ENOMEM;
 
-	sd->client = g_isi_client_create(modem, PN_SS);
+	sd->client = g_isi_client_create(modem, PN_CALL);
 	if (sd->client == NULL) {
 		g_free(sd);
 		return -ENOMEM;
@@ -62,6 +223,11 @@ static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
 
 	ofono_ssn_set_data(ssn, sd);
 
+	ofono_ssn_register(ssn);
+
+	g_isi_subscribe(data->client, CALL_GSM_NOTIFICATION_IND,
+			isi_ssn_ind, ssn);
+
 	return 0;
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [ss-notify FYI 4/6] call-barring: remove CSSU notifications
  2011-01-28 17:38     ` [ss-notify FYI 3/6] isimodem/ssn: add common notifications Pekka.Pessi
@ 2011-01-28 17:38       ` Pekka.Pessi
  2011-01-28 17:38         ` [ss-notify FYI 5/6] voicecall: watch mt ssn events Pekka.Pessi
  0 siblings, 1 reply; 7+ messages in thread
From: Pekka.Pessi @ 2011-01-28 17:38 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

The CSSU notifications are better handled within voicecall. They
indicate the reason why a call is rejected and augment the
DisconnectReason.

According to the 24.088 section 2.1, the SS notification for barring of
incoming calls is sent when callee has barred incoming calls.  This
notification corresponds to the +CSSI: 6 response.

The SS notification for barring of outgoing calls is sent because of
caller's barring services.  It is unclear if the notification could be
sent because of combination of callee's forwarding services and barring
services.

When testing notifications, I received the notifications already in the
ALERTING message, and a recorded announcement about barring services was
played while call was in alerting state.
---
 src/call-barring.c |   75 ----------------------------------------------------
 1 files changed, 0 insertions(+), 75 deletions(-)

diff --git a/src/call-barring.c b/src/call-barring.c
index bb15530..bc427fa 100644
--- a/src/call-barring.c
+++ b/src/call-barring.c
@@ -56,11 +56,7 @@ struct ofono_call_barring {
 	int ss_req_type;
 	int ss_req_cls;
 	int ss_req_lock;
-	struct ofono_ssn *ssn;
 	struct ofono_ussd *ussd;
-	unsigned int incoming_bar_watch;
-	unsigned int outgoing_bar_watch;
-	unsigned int ssn_watch;
 	unsigned int ussd_watch;
 	const struct ofono_call_barring_driver *driver;
 	void *driver_data;
@@ -987,41 +983,10 @@ static GDBusMethodTable cb_methods[] = {
 };
 
 static GDBusSignalTable cb_signals[] = {
-	{ "IncomingBarringInEffect",	"" },
-	{ "OutgoingBarringInEffect",	"" },
 	{ "PropertyChanged",		"sv" },
 	{ }
 };
 
-static void call_barring_incoming_enabled_notify(int idx, void *userdata)
-{
-	struct ofono_call_barring *cb = userdata;
-	DBusConnection *conn = ofono_dbus_get_connection();
-	const char *path = __ofono_atom_get_path(cb->atom);
-
-	g_dbus_emit_signal(conn, path, OFONO_CALL_BARRING_INTERFACE,
-			"IncomingBarringInEffect", DBUS_TYPE_INVALID);
-}
-
-static void call_barring_outgoing_enabled_notify(int idx, void *userdata)
-{
-	struct ofono_call_barring *cb = userdata;
-	DBusConnection *conn = ofono_dbus_get_connection();
-	const char *path = __ofono_atom_get_path(cb->atom);
-	DBusMessage *signal;
-
-	signal = dbus_message_new_signal(path, OFONO_CALL_BARRING_INTERFACE,
-						"OutgoingBarringInEffect");
-
-	if (signal == NULL) {
-		ofono_error("Unable to allocate new %s.OutgoingBarringInEffect"
-				" signal", OFONO_CALL_BARRING_INTERFACE);
-		return;
-	}
-
-	g_dbus_send_message(conn, signal);
-}
-
 int ofono_call_barring_driver_register(const struct ofono_call_barring_driver *d)
 {
 	DBG("driver: %p, name: %s", d, d->name);
@@ -1054,14 +1019,6 @@ static void call_barring_unregister(struct ofono_atom *atom)
 	if (cb->ussd)
 		cb_unregister_ss_controls(cb);
 
-	if (cb->incoming_bar_watch)
-		__ofono_ssn_mo_watch_remove(cb->ssn, cb->incoming_bar_watch);
-	if (cb->outgoing_bar_watch)
-		__ofono_ssn_mt_watch_remove(cb->ssn, cb->outgoing_bar_watch);
-
-	if (cb->ssn_watch)
-		__ofono_modem_remove_atom_watch(modem, cb->ssn_watch);
-
 	if (cb->ussd_watch)
 		__ofono_modem_remove_atom_watch(modem, cb->ussd_watch);
 }
@@ -1116,29 +1073,6 @@ struct ofono_call_barring *ofono_call_barring_create(struct ofono_modem *modem,
 	return cb;
 }
 
-static void ssn_watch(struct ofono_atom *atom,
-			enum ofono_atom_watch_condition cond, void *data)
-{
-	struct ofono_call_barring *cb = data;
-
-	if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
-		cb->ssn = NULL;
-		cb->incoming_bar_watch = 0;
-		cb->outgoing_bar_watch = 0;
-		return;
-	}
-
-	cb->ssn = __ofono_atom_get_data(atom);
-
-	cb->incoming_bar_watch =
-		__ofono_ssn_mo_watch_add(cb->ssn, SS_MO_INCOMING_BARRING,
-				call_barring_incoming_enabled_notify, cb, NULL);
-
-	cb->outgoing_bar_watch =
-		__ofono_ssn_mo_watch_add(cb->ssn, SS_MO_OUTGOING_BARRING,
-				call_barring_outgoing_enabled_notify, cb, NULL);
-}
-
 static void ussd_watch(struct ofono_atom *atom,
 			enum ofono_atom_watch_condition cond, void *data)
 {
@@ -1158,7 +1092,6 @@ void ofono_call_barring_register(struct ofono_call_barring *cb)
 	DBusConnection *conn = ofono_dbus_get_connection();
 	const char *path = __ofono_atom_get_path(cb->atom);
 	struct ofono_modem *modem = __ofono_atom_get_modem(cb->atom);
-	struct ofono_atom *ssn_atom;
 	struct ofono_atom *ussd_atom;
 
 	if (!g_dbus_register_interface(conn, path,
@@ -1173,14 +1106,6 @@ void ofono_call_barring_register(struct ofono_call_barring *cb)
 
 	ofono_modem_add_interface(modem, OFONO_CALL_BARRING_INTERFACE);
 
-	cb->ssn_watch = __ofono_modem_add_atom_watch(modem, OFONO_ATOM_TYPE_SSN,
-					ssn_watch, cb, NULL);
-
-	ssn_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SSN);
-
-	if (ssn_atom && __ofono_atom_get_registered(ssn_atom))
-		ssn_watch(ssn_atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, cb);
-
 	cb->ussd_watch = __ofono_modem_add_atom_watch(modem,
 					OFONO_ATOM_TYPE_USSD,
 					ussd_watch, cb, NULL);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [ss-notify FYI 5/6] voicecall: watch mt ssn events
  2011-01-28 17:38       ` [ss-notify FYI 4/6] call-barring: remove CSSU notifications Pekka.Pessi
@ 2011-01-28 17:38         ` Pekka.Pessi
  2011-01-28 17:38           ` [ss-notify FYI 6/6] Document notifications in voicecall-api.txt Pekka.Pessi
  0 siblings, 1 reply; 7+ messages in thread
From: Pekka.Pessi @ 2011-01-28 17:38 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

Watch supplementary service notifications from barring services, remote
party putting call on hold, retrieving or join call into a multiparty
conference.

The barring indications augment the DisconnectReason and they contain
additional information about the reason why a call is rejected or why it
is not connected.
---
 src/voicecall.c |  147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 147 insertions(+), 0 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 6246787..e176e02 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -52,6 +52,12 @@ struct ofono_voicecall {
 	struct ofono_sim *sim;
 	unsigned int sim_watch;
 	unsigned int sim_state_watch;
+	struct ofono_ssn *ssn;
+	unsigned int ssn_watch;
+	unsigned int ssn_hold_watch;
+	unsigned int ssn_retrieve_watch;
+	unsigned int ssn_mpty_watch;
+	unsigned int ssn_wait_watch;
 	const struct ofono_voicecall_driver *driver;
 	void *driver_data;
 	struct ofono_atom *atom;
@@ -69,6 +75,7 @@ struct voicecall {
 	uint8_t icon_id;
 	gboolean untracked;
 	gboolean dial_result_handled;
+	dbus_bool_t mt_hold;
 };
 
 struct dial_request {
@@ -399,6 +406,8 @@ static void append_voicecall_properties(struct voicecall *v,
 
 	ofono_dbus_dict_append(dict, "Multiparty", DBUS_TYPE_BOOLEAN, &mpty);
 
+	ofono_dbus_dict_append(dict, "OnHold", DBUS_TYPE_BOOLEAN, &v->mt_hold);
+
 	if (v->message)
 		ofono_dbus_dict_append(dict, "Information",
 						DBUS_TYPE_STRING, &v->message);
@@ -655,6 +664,19 @@ static const char *voicecall_build_path(struct ofono_voicecall *vc,
 	return path;
 }
 
+static struct voicecall *voicecall_by_id(struct ofono_voicecall *vc, int id)
+{
+	GSList *l;
+
+	l = g_slist_find_custom(vc->call_list, GUINT_TO_POINTER(id),
+				call_compare_by_id);
+	if (l == NULL)
+		return NULL;
+
+	return l->data;
+}
+
+
 static void voicecall_emit_disconnect_reason(struct voicecall *call,
 					enum ofono_disconnect_reason reason)
 {
@@ -2181,6 +2203,19 @@ static void voicecall_unregister(struct ofono_atom *atom)
 		vc->sim_watch = 0;
 	}
 
+	if (vc->ssn_watch) {
+		__ofono_modem_remove_atom_watch(modem, vc->ssn_watch);
+		vc->ssn_watch = 0;
+	}
+
+	if (vc->ssn) {
+		__ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_hold_watch);
+		__ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_retrieve_watch);
+		__ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mpty_watch);
+		__ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_wait_watch);
+		vc->ssn = NULL;
+	}
+
 	if (vc->dial_req)
 		dial_request_finish(vc);
 
@@ -2278,6 +2313,108 @@ struct ofono_voicecall *ofono_voicecall_create(struct ofono_modem *modem,
 	return vc;
 }
 
+static void ssn_mo_watch(int index, int mo_code, void *user)
+{
+	struct ofono_voicecall *vc = user;
+	struct voicecall *call;
+	DBusConnection *conn;
+	char const *path;
+	char const *member;
+
+	call = voicecall_by_id(vc, index);
+	if (call == NULL) {
+		ofono_error("Got MO SSN notify %u for unknown call", mo_code);
+		return;
+	}
+
+	conn = ofono_dbus_get_connection();
+	path = voicecall_build_path(vc, call->call);
+
+	switch (mo_code) {
+	case OFONO_SS_MO_CALL_WAITING:
+		member = "Waiting";
+		break;
+	case OFONO_SS_MO_INCOMING_BARRING:
+		member = "IncomingBarred";
+		break;
+	case OFONO_SS_MO_OUTGOING_BARRING:
+		member = "OutgoingBarred";
+		break;
+	default:
+		return;
+	}
+
+	g_dbus_emit_signal(conn, path, OFONO_VOICECALL_INTERFACE,
+				member, DBUS_TYPE_INVALID);
+}
+
+static void ssn_mt_watch(int index, int mt_code,
+				const struct ofono_phone_number *ph,
+				void *user)
+{
+	struct ofono_voicecall *vc = user;
+	struct voicecall *call;
+	DBusConnection *conn;
+	char const *path;
+	dbus_bool_t mt_hold;
+
+	call = voicecall_by_id(vc, index);
+	if (call == NULL) {
+		ofono_error("Got MT SSN notify %u for unknown call", mt_code);
+		return;
+	}
+
+	conn = ofono_dbus_get_connection();
+	path = voicecall_build_path(vc, call->call);
+
+	switch (mt_code) {
+	case OFONO_SS_MT_VOICECALL_ON_HOLD:
+		call->mt_hold = mt_hold = TRUE;
+		break;
+
+	case OFONO_SS_MT_VOICECALL_RETRIEVED:
+		call->mt_hold = mt_hold = FALSE;
+		break;
+
+	case OFONO_SS_MT_MULTIPARTY_VOICECALL:
+		g_dbus_emit_signal(conn, path, OFONO_VOICECALL_INTERFACE,
+					"JoinedMultiparty", DBUS_TYPE_INVALID);
+		return;
+
+	default:
+		return;
+	}
+
+	ofono_dbus_signal_property_changed(conn, path,
+				OFONO_VOICECALL_INTERFACE, "OnHold",
+				DBUS_TYPE_BOOLEAN, &mt_hold);
+}
+
+static void ssn_watch(struct ofono_atom *atom,
+			enum ofono_atom_watch_condition cond, void *data)
+{
+	struct ofono_voicecall *vc = data;
+
+	if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+		vc->ssn = NULL;
+		return;
+	}
+
+	vc->ssn =  __ofono_atom_get_data(atom);
+
+	vc->ssn_hold_watch = __ofono_ssn_mt_watch_add(vc->ssn,
+		OFONO_SS_MT_VOICECALL_ON_HOLD, ssn_mt_watch, vc, NULL);
+
+	vc->ssn_retrieve_watch = __ofono_ssn_mt_watch_add(vc->ssn,
+		OFONO_SS_MT_VOICECALL_RETRIEVED, ssn_mt_watch, vc, NULL);
+
+	vc->ssn_mpty_watch = __ofono_ssn_mt_watch_add(vc->ssn,
+		OFONO_SS_MT_MULTIPARTY_VOICECALL, ssn_mt_watch, vc, NULL);
+
+	vc->ssn_wait_watch = __ofono_ssn_mo_watch_add(vc->ssn,
+		OFONO_SS_MO_CALL_WAITING, ssn_mo_watch, vc, NULL);
+}
+
 static void sim_state_watch(enum ofono_sim_state new_state, void *user)
 {
 	struct ofono_voicecall *vc = user;
@@ -2338,6 +2475,7 @@ void ofono_voicecall_register(struct ofono_voicecall *vc)
 	struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
 	const char *path = __ofono_atom_get_path(vc->atom);
 	struct ofono_atom *sim_atom;
+	struct ofono_atom *ssn_atom;
 
 	if (!g_dbus_register_interface(conn, path,
 					OFONO_VOICECALL_MANAGER_INTERFACE,
@@ -2367,6 +2505,15 @@ void ofono_voicecall_register(struct ofono_voicecall *vc)
 	if (sim_atom && __ofono_atom_get_registered(sim_atom))
 		sim_watch(sim_atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, vc);
 
+	vc->ssn_watch = __ofono_modem_add_atom_watch(modem,
+						OFONO_ATOM_TYPE_SSN,
+						ssn_watch, vc, NULL);
+
+	ssn_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
+
+	if (ssn_atom && __ofono_atom_get_registered(ssn_atom))
+		ssn_watch(ssn_atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, vc);
+
 	__ofono_atom_register(vc->atom, voicecall_unregister);
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [ss-notify FYI 6/6] Document notifications in voicecall-api.txt.
  2011-01-28 17:38         ` [ss-notify FYI 5/6] voicecall: watch mt ssn events Pekka.Pessi
@ 2011-01-28 17:38           ` Pekka.Pessi
  0 siblings, 0 replies; 7+ messages in thread
From: Pekka.Pessi @ 2011-01-28 17:38 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 doc/voicecall-api.txt |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/doc/voicecall-api.txt b/doc/voicecall-api.txt
index 047b8cb..aae0867 100644
--- a/doc/voicecall-api.txt
+++ b/doc/voicecall-api.txt
@@ -56,6 +56,33 @@ Signals		PropertyChanged(string property, variant value)
 			Signal is emitted whenever a property has changed.
 			The new value is passed as the signal argument.
 
+		JoinedMultiparty()
+
+			Signal is emitted when remote party joins the
+			call into a multiparty conference.  Not that
+			there is no corresponding event when call is
+			split from the multiparty conference.
+
+		Waiting()
+
+			Signal is emitted when an outgoing call is waiting.
+
+		OutgoingBarred()
+
+			Signal is emitted when caller's outgoing barring
+			services prevent call from being connected.
+
+			This signal is usually emitted while an
+			announcement is played.
+
+		IngomingBarred()
+
+			Signal is emitted when callee's incoming barring
+			services prevent call from being connected.
+
+			This signal is usually emitted while an
+			announcement is played.
+
 		DisconnectReason(string reason)
 
 			This signal is emitted when the modem manager can
@@ -105,11 +132,16 @@ Properties	string LineIdentification [readonly]
 		boolean Multiparty [readonly]
 
 			Contains the indication if the voice call is part
-			of a multiparty call or not.
+			of a multiparty call set up by user or not.
 
 			Notifications if a call becomes part or leaves a
 			multipart call are sent.
 
+		boolean OnHold [readonly]
+
+			Contains the indication if the remote party has
+			put call on hold.
+
 		string State [readonly]
 
 			Contains the state of the current call.  The state
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-28 17:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 17:38 [ss-notify FYI 0/6] Pekka.Pessi
2011-01-28 17:38 ` [ss-notify FYI 1/6] ssn: include ssn codes in public API Pekka.Pessi
2011-01-28 17:38   ` [ss-notify FYI 2/6] ssn: add ssn code argument to ssn notify callbacks Pekka.Pessi
2011-01-28 17:38     ` [ss-notify FYI 3/6] isimodem/ssn: add common notifications Pekka.Pessi
2011-01-28 17:38       ` [ss-notify FYI 4/6] call-barring: remove CSSU notifications Pekka.Pessi
2011-01-28 17:38         ` [ss-notify FYI 5/6] voicecall: watch mt ssn events Pekka.Pessi
2011-01-28 17:38           ` [ss-notify FYI 6/6] Document notifications in voicecall-api.txt Pekka.Pessi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.