summaryrefslogtreecommitdiffstats
path: root/src/ussd.c
diff options
context:
space:
mode:
authorAki Niemi <aki.niemi@nokia.com>2010-02-09 23:19:11 +0200
committerAki Niemi <aki.niemi@nokia.com>2010-02-09 23:19:11 +0200
commit02acd8441d3008e0f1c6a587fa609a72b46074f8 (patch)
tree718916ee8c76772a5c4ee560159b2236577d08ca /src/ussd.c
parentd12e1a8b9ec779ccc07a89ae83cf54a7ac51cfd4 (diff)
downloadofono-02acd8441d3008e0f1c6a587fa609a72b46074f8.tar.bz2
Enable USSD_STATE_USER_ACTION
If the network requests user action in the response to an MO USSD, we cannot immediately return to USSD_STATE_USER_IDLE. Instead, USSD_STATE_USER_ACTION is entered. Note that it is left up to the driver to notify() when the USSD transaction is closed by the network due to inactivity. Another way to return to USSD_STATE_IDLE is for the user to cancel() the transaction.
Diffstat (limited to 'src/ussd.c')
-rw-r--r--src/ussd.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/ussd.c b/src/ussd.c
index e5b53ffe..4221dfa6 100644
--- a/src/ussd.c
+++ b/src/ussd.c
@@ -285,22 +285,26 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, const char *str)
if (status == OFONO_USSD_STATUS_NOT_SUPPORTED) {
ussd->state = USSD_STATE_IDLE;
+
+ if (!ussd->pending)
+ return;
+
reply = __ofono_error_not_supported(ussd->pending);
goto out;
}
if (status == OFONO_USSD_STATUS_TIMED_OUT) {
ussd->state = USSD_STATE_IDLE;
+
+ if (!ussd->pending)
+ return;
+
reply = __ofono_error_timed_out(ussd->pending);
goto out;
}
/* TODO: Rework this in the Agent framework */
if (ussd->state == USSD_STATE_ACTIVE) {
- if (status == OFONO_USSD_STATUS_ACTION_REQUIRED) {
- ofono_error("Unable to handle action required ussd");
- return;
- }
reply = dbus_message_new_method_return(ussd->pending);
@@ -320,7 +324,11 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, const char *str)
dbus_message_iter_close_container(&iter, &variant);
- ussd->state = USSD_STATE_IDLE;
+ if (status == OFONO_USSD_STATUS_ACTION_REQUIRED)
+ ussd->state = USSD_STATE_USER_ACTION;
+ else
+ ussd->state = USSD_STATE_IDLE;
+
} else {
ofono_error("Received an unsolicited USSD, ignoring for now...");
DBG("USSD is: status: %d, %s", status, str);