From 02acd8441d3008e0f1c6a587fa609a72b46074f8 Mon Sep 17 00:00:00 2001 From: Aki Niemi Date: Tue, 9 Feb 2010 23:19:11 +0200 Subject: [PATCH] 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. --- src/ussd.c | 18 +++++++++++++----- 1 file 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);