Re: [PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-15 Thread Denis Kenzior
Hi Jeevaka,

On 07/15/2011 11:45 AM, jeevaka.badrap...@linux.intel.com wrote:
> Hi Denis,
> 
>>> +static void proactive_command_handled_end(struct ofono_stk *stk)
>>> +{
>>> +   stk->modem_handled_cmd = FALSE;
>>> +
>>> +   if (stk->pending_cmd == NULL)
>>> +   return;
>>> +
>>> +   switch(stk->pending_cmd->type) {
>>> +   case STK_COMMAND_TYPE_SETUP_CALL:
>>> +   {
>>> +   struct ofono_voicecall *vc = NULL;
>>> +   struct ofono_atom *vc_atom;
>>> +
>>> +   vc_atom = __ofono_modem_find_atom(
>>> +   __ofono_atom_get_modem(stk->atom),
>>> +   OFONO_ATOM_TYPE_VOICECALL);
>>> +   if (vc_atom)
>>> +   vc = __ofono_atom_get_data(vc_atom);
>>> +
>>> +   if (vc != NULL)
>>> +   __ofono_voicecall_clear_alpha_and_icon_id(vc);
>>> +
>>> +   break;
>>> +   }
>>> +
>>> +   default:
>>> +   break;
>>> +   }
>>> +}
>>> +
>>
>> So I'm still not sure this part is actually needed.  Once the user has
>> acknowledged the call, there is no way for us to cancel it until the
>> call is notified to the voicecall driver.  So unless the modem is drunk,
>> I don't really see the need to cover this case.
>>
>> Once the call is notified to voicecall driver, then the need for
>> clearing alpha/icon id disappears.  The voicecall driver will do this
>> automatically based on the ofono_voicecall_disconnected notification.
>>
>> What do you guys think?
> 
> As pointed in other mail thred, trying to cover the following case:
> 
> 1. oFono core is informed of the modem handled setup call and requests
> user confirmation
> 2. User confirms the call
> 3. User confirmation sent to modem.
> 4. Due to some reason, modem is not able to setup the call. So, basically
> oFono core is not notified of any call status notifications
> 5. Modem sends the terminal response to SAT and notifies oFono core of the
> command/session completion
> 
> Basically, if the modem due to some reason fails to initiate/setup the
> call and call status notifications not sent to the voice call driver side.
> This case, we will be left with dial_req, message and icon id set but not
> freed.
> 

OK I see now.  In theory we could do some basic sanity checks (e.g.
modem is online, etc) to alleviate this, but your proposal is probably
safer even if more complicated.

Also, you probably can formalize proactive_command_handled_end and not
call stk_unset_alpha_id unnecessarily in the case of modem-handled Set
Up Call.

And I'm still not sure about modem_handled_cmd variable.  Can't you set
cancel_cmd to proactive_command_handled_end?

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-15 Thread jeevaka . badrappan
Hi Denis,

>> +static void proactive_command_handled_end(struct ofono_stk *stk)
>> +{
>> +stk->modem_handled_cmd = FALSE;
>> +
>> +if (stk->pending_cmd == NULL)
>> +return;
>> +
>> +switch(stk->pending_cmd->type) {
>> +case STK_COMMAND_TYPE_SETUP_CALL:
>> +{
>> +struct ofono_voicecall *vc = NULL;
>> +struct ofono_atom *vc_atom;
>> +
>> +vc_atom = __ofono_modem_find_atom(
>> +__ofono_atom_get_modem(stk->atom),
>> +OFONO_ATOM_TYPE_VOICECALL);
>> +if (vc_atom)
>> +vc = __ofono_atom_get_data(vc_atom);
>> +
>> +if (vc != NULL)
>> +__ofono_voicecall_clear_alpha_and_icon_id(vc);
>> +
>> +break;
>> +}
>> +
>> +default:
>> +break;
>> +}
>> +}
>> +
>
> So I'm still not sure this part is actually needed.  Once the user has
> acknowledged the call, there is no way for us to cancel it until the
> call is notified to the voicecall driver.  So unless the modem is drunk,
> I don't really see the need to cover this case.
>
> Once the call is notified to voicecall driver, then the need for
> clearing alpha/icon id disappears.  The voicecall driver will do this
> automatically based on the ofono_voicecall_disconnected notification.
>
> What do you guys think?

As pointed in other mail thred, trying to cover the following case:

1. oFono core is informed of the modem handled setup call and requests
user confirmation
2. User confirms the call
3. User confirmation sent to modem.
4. Due to some reason, modem is not able to setup the call. So, basically
oFono core is not notified of any call status notifications
5. Modem sends the terminal response to SAT and notifies oFono core of the
command/session completion

Basically, if the modem due to some reason fails to initiate/setup the
call and call status notifications not sent to the voice call driver side.
This case, we will be left with dial_req, message and icon id set but not
freed.

Regards,
Jeevaka
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-15 Thread Denis Kenzior
Hi Andrew, Jeevaka,



> +static void proactive_command_handled_end(struct ofono_stk *stk)
> +{
> + stk->modem_handled_cmd = FALSE;
> +
> + if (stk->pending_cmd == NULL)
> + return;
> +
> + switch(stk->pending_cmd->type) {
> + case STK_COMMAND_TYPE_SETUP_CALL:
> + {
> + struct ofono_voicecall *vc = NULL;
> + struct ofono_atom *vc_atom;
> +
> + vc_atom = __ofono_modem_find_atom(
> + __ofono_atom_get_modem(stk->atom),
> + OFONO_ATOM_TYPE_VOICECALL);
> + if (vc_atom)
> + vc = __ofono_atom_get_data(vc_atom);
> +
> + if (vc != NULL)
> + __ofono_voicecall_clear_alpha_and_icon_id(vc);
> +
> + break;
> + }
> +
> + default:
> + break;
> + }
> +}
> +

So I'm still not sure this part is actually needed.  Once the user has
acknowledged the call, there is no way for us to cancel it until the
call is notified to the voicecall driver.  So unless the modem is drunk,
I don't really see the need to cover this case.

Once the call is notified to voicecall driver, then the need for
clearing alpha/icon id disappears.  The voicecall driver will do this
automatically based on the ofono_voicecall_disconnected notification.

What do you guys think?

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-15 Thread Denis Kenzior
Hi Jeevaka,

On 07/15/2011 07:46 AM, jeevaka.badrap...@linux.intel.com wrote:
> Hi,
> 
>> @@ -529,7 +531,12 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
>>
>>  static void stk_alpha_id_unset(struct ofono_stk *stk)
>>  {
>> -stk_agent_request_cancel(stk->current_agent);
>> +/*
>> + * If there is no default agent, then current agent also will be NULL.
>> + * So, call request cancel only when there is a valid current agent.
>> + */
>> +if (stk->current_agent)
>> +stk_agent_request_cancel(stk->current_agent);
>>  }
>>
> 
> If needed, I can send this code change alone in a separate fix patch.
> 

It sounds like you were getting a crash with this one, so please send it
as a separate patch.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-15 Thread jeevaka . badrappan
Hi,

> @@ -529,7 +531,12 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
>
>  static void stk_alpha_id_unset(struct ofono_stk *stk)
>  {
> - stk_agent_request_cancel(stk->current_agent);
> + /*
> +  * If there is no default agent, then current agent also will be NULL.
> +  * So, call request cancel only when there is a valid current agent.
> +  */
> + if (stk->current_agent)
> + stk_agent_request_cancel(stk->current_agent);
>  }
>

If needed, I can send this code change alone in a separate fix patch.

Regards,
Jeevaka
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-15 Thread Jeevaka Badrappan
---
 src/stk.c |  122 +++-
 1 files changed, 119 insertions(+), 3 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 4df23b5..6cc3be3 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -77,6 +77,8 @@ struct ofono_stk {
struct timeval get_inkey_start_ts;
int dtmf_id;
 
+   gboolean modem_handled_cmd;
+
__ofono_sms_sim_download_cb_t sms_pp_cb;
void *sms_pp_userdata;
 };
@@ -529,7 +531,12 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
 
 static void stk_alpha_id_unset(struct ofono_stk *stk)
 {
-   stk_agent_request_cancel(stk->current_agent);
+   /*
+* If there is no default agent, then current agent also will be NULL.
+* So, call request cancel only when there is a valid current agent.
+*/
+   if (stk->current_agent)
+   stk_agent_request_cancel(stk->current_agent);
 }
 
 static int duration_to_msecs(const struct stk_duration *duration)
@@ -1785,6 +1792,47 @@ static void confirm_call_cb(enum stk_agent_result 
result, gboolean confirm,
stk_command_cb(&error, stk);
 }
 
+static void confirm_handled_call_cb(enum stk_agent_result result,
+   gboolean confirm, void *user_data)
+{
+   struct ofono_stk *stk = user_data;
+   const struct stk_command_setup_call *sc =
+   &stk->pending_cmd->setup_call;
+   struct ofono_voicecall *vc = NULL;
+   struct ofono_atom *vc_atom;
+
+   if (stk->driver->user_confirmation == NULL)
+   goto out;
+
+   if (result != STK_AGENT_RESULT_OK) {
+   stk->driver->user_confirmation(stk, FALSE);
+   goto out;
+   }
+
+   stk->driver->user_confirmation(stk, confirm);
+
+   vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
+   OFONO_ATOM_TYPE_VOICECALL);
+   if (vc_atom)
+   vc = __ofono_atom_get_data(vc_atom);
+
+   if (vc == NULL)
+   goto out;
+
+   __ofono_voicecall_set_alpha_and_icon_id(vc, sc->addr.number,
+   sc->addr.ton_npi,
+   sc->alpha_id_call_setup,
+   sc->icon_id_call_setup.id);
+
+   stk->modem_handled_cmd = TRUE;
+
+   return;
+
+out:
+   stk_command_free(stk->pending_cmd);
+   stk->pending_cmd = NULL;
+}
+
 static gboolean handle_command_set_up_call(const struct stk_command *cmd,
struct stk_response *rsp,
struct ofono_stk *stk)
@@ -2601,8 +2649,75 @@ static gboolean handle_command_launch_browser(const 
struct stk_command *cmd,
return FALSE;
 }
 
+static void handle_setup_call_confirmation_req(struct stk_command *cmd,
+   struct ofono_stk *stk)
+{
+   const struct stk_command_setup_call *sc = &cmd->setup_call;
+   int err;
+   char *alpha_id = dbus_apply_text_attributes(
+   sc->alpha_id_usr_cfm ?
+   sc->alpha_id_usr_cfm : "",
+   &sc->text_attr_usr_cfm);
+   if (alpha_id == NULL)
+   goto out;
+
+   err = stk_agent_confirm_call(stk->current_agent, alpha_id,
+   &sc->icon_id_usr_cfm,
+   confirm_handled_call_cb,
+   stk, NULL,
+   stk->timeout * 1000);
+   g_free(alpha_id);
+
+   if (err < 0)
+   goto out;
+
+   stk->pending_cmd = cmd;
+   stk->cancel_cmd = stk_request_cancel;
+
+   return;
+
+out:
+   if (stk->driver->user_confirmation)
+   stk->driver->user_confirmation(stk, FALSE);
+
+   stk_command_free(cmd);
+}
+
+static void proactive_command_handled_end(struct ofono_stk *stk)
+{
+   stk->modem_handled_cmd = FALSE;
+
+   if (stk->pending_cmd == NULL)
+   return;
+
+   switch(stk->pending_cmd->type) {
+   case STK_COMMAND_TYPE_SETUP_CALL:
+   {
+   struct ofono_voicecall *vc = NULL;
+   struct ofono_atom *vc_atom;
+
+   vc_atom = __ofono_modem_find_atom(
+   __ofono_atom_get_modem(stk->atom),
+   OFONO_ATOM_TYPE_VOICECALL);
+   if (vc_atom)
+   vc = __ofono_atom_get_data(vc_atom);
+
+   if (vc != NULL)
+   __ofono_voicecall_clear_alpha_and_icon_id(vc);
+
+   break;
+   }
+
+   default:
+   break;
+   }
+}
+
 static void stk_proactive_command_cancel(struct ofono_stk *stk)
 {
+   if (stk->modem_handled_cmd == TRUE)
+ 

Re: [PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-06 Thread Denis Kenzior
Hi Jeevaka,

On 07/06/2011 05:06 AM, Jeevaka Badrappan wrote:
> ---
>  src/stk.c |  108 +++-
>  1 files changed, 106 insertions(+), 2 deletions(-)
> 
> diff --git a/src/stk.c b/src/stk.c
> index 9575f0e..26faa11 100644
> --- a/src/stk.c
> +++ b/src/stk.c
> @@ -77,6 +77,8 @@ struct ofono_stk {
>   struct timeval get_inkey_start_ts;
>   int dtmf_id;
>  
> + gboolean modem_handled_cmd;
> +
>   __ofono_sms_sim_download_cb_t sms_pp_cb;
>   void *sms_pp_userdata;
>  };
> @@ -1785,6 +1787,44 @@ static void confirm_call_cb(enum stk_agent_result 
> result, gboolean confirm,
>   stk_command_cb(&error, stk);
>  }
>  
> +static void confirm_handled_call_cb(enum stk_agent_result result,
> + gboolean confirm, void *user_data)
> +{
> + struct ofono_stk *stk = user_data;
> + const struct stk_command_setup_call *sc =
> + &stk->pending_cmd->setup_call;
> + struct ofono_voicecall *vc = NULL;
> + struct ofono_atom *vc_atom;
> +
> + if (stk->driver->user_confirmation == NULL)
> + goto out;

This situation is quite funny, I'd almost rather crash here, but fair
enough.

> +
> + if (result != STK_AGENT_RESULT_OK) {
> + stk->driver->user_confirmation(stk, FALSE);
> + goto out;
> + }
> +
> + stk->driver->user_confirmation(stk, confirm);
> +
> + vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
> + OFONO_ATOM_TYPE_VOICECALL);
> + if (vc_atom)
> + vc = __ofono_atom_get_data(vc_atom);
> +
> + if (vc == NULL)
> + goto out;
> +
> + __ofono_voicecall_set_alpha_and_icon_id(vc, sc->alpha_id_call_setup,
> + sc->icon_id_call_setup.id);
> +
> + stk->modem_handled_cmd = TRUE;
> +
> + return;

Please insert a newline here

> +out:
> + stk_command_free(stk->pending_cmd);
> + stk->pending_cmd = NULL;
> +}
> +
>  static gboolean handle_command_set_up_call(const struct stk_command *cmd,
>   struct stk_response *rsp,
>   struct ofono_stk *stk)
> @@ -2601,6 +2641,40 @@ static gboolean handle_command_launch_browser(const 
> struct stk_command *cmd,
>   return FALSE;
>  }
>  
> +static void handle_setup_call_confirmation_req(struct stk_command *cmd,
> + struct ofono_stk *stk)
> +{
> + const struct stk_command_setup_call *sc = &cmd->setup_call;
> + int err;
> + char *alpha_id = dbus_apply_text_attributes(
> + sc->alpha_id_usr_cfm ?
> + sc->alpha_id_usr_cfm : "",
> + &sc->text_attr_usr_cfm);
> + if (alpha_id == NULL)
> + goto out;
> +
> + err = stk_agent_confirm_call(stk->current_agent, alpha_id,
> + &sc->icon_id_usr_cfm,
> + confirm_handled_call_cb,
> + stk, NULL,
> + stk->timeout * 1000);
> + g_free(alpha_id);
> +
> + if (err < 0)
> + goto out;
> +
> + stk->pending_cmd = cmd;
> + stk->cancel_cmd = stk_request_cancel;
> +
> + return;
> +
> +out:
> + if (stk->driver->user_confirmation)
> + stk->driver->user_confirmation(stk, FALSE);
> +
> + stk_command_free(cmd);
> +}
> +
>  static void stk_proactive_command_cancel(struct ofono_stk *stk)
>  {
>   if (stk->immediate_response)
> @@ -2615,8 +2689,38 @@ static void stk_proactive_command_cancel(struct 
> ofono_stk *stk)
>   }
>  }
>  
> +static void proactive_session_end_handled_cmd(struct ofono_stk *stk)
> +{
> + stk->modem_handled_cmd = FALSE;
> +
> + switch(stk->pending_cmd->type) {
> + case STK_COMMAND_TYPE_SETUP_CALL:
> + {
> + struct ofono_voicecall *vc = NULL;
> + struct ofono_atom *vc_atom;
> +
> + vc_atom = __ofono_modem_find_atom(
> + __ofono_atom_get_modem(stk->atom),
> + OFONO_ATOM_TYPE_VOICECALL);
> + if (vc_atom)
> + vc = __ofono_atom_get_data(vc_atom);
> +
> + if (vc != NULL)
> + __ofono_voicecall_clear_alpha_and_icon_id(vc);
> +
> + break;
> + }
> +
> + default:
> + break;
> + }
> +}
> +
>  void ofono_stk_proactive_session_end_notify(struct ofono_stk *stk)
>  {
> + if (stk->modem_handled_cmd == TRUE)
> + proactive_session_end_handled_cmd(stk);
> +

Are we getting information on the terminal responses sent by the modem
for these?  I'd rather handle this sort of stuff by parsing the terminal
response than 

Re: [PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-06 Thread Andrzej Zaborowski
Hi Jeevaka,

On 6 July 2011 12:06, Jeevaka Badrappan
 wrote:
> ---
>  src/stk.c |  108 +++-
>  1 files changed, 106 insertions(+), 2 deletions(-)
>
> diff --git a/src/stk.c b/src/stk.c
> index 9575f0e..26faa11 100644
> --- a/src/stk.c
> +++ b/src/stk.c
> @@ -77,6 +77,8 @@ struct ofono_stk {
>        struct timeval get_inkey_start_ts;
>        int dtmf_id;
>
> +       gboolean modem_handled_cmd;
> +
>        __ofono_sms_sim_download_cb_t sms_pp_cb;
>        void *sms_pp_userdata;
>  };
> @@ -1785,6 +1787,44 @@ static void confirm_call_cb(enum stk_agent_result 
> result, gboolean confirm,
>                stk_command_cb(&error, stk);
>  }
>
> +static void confirm_handled_call_cb(enum stk_agent_result result,
> +                                       gboolean confirm, void *user_data)
> +{
> +       struct ofono_stk *stk = user_data;
> +       const struct stk_command_setup_call *sc =
> +                                       &stk->pending_cmd->setup_call;
> +       struct ofono_voicecall *vc = NULL;
> +       struct ofono_atom *vc_atom;
> +
> +       if (stk->driver->user_confirmation == NULL)
> +               goto out;
> +
> +       if (result != STK_AGENT_RESULT_OK) {
> +               stk->driver->user_confirmation(stk, FALSE);
> +               goto out;
> +       }
> +
> +       stk->driver->user_confirmation(stk, confirm);
> +
> +       vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
> +                                               OFONO_ATOM_TYPE_VOICECALL);
> +       if (vc_atom)
> +               vc = __ofono_atom_get_data(vc_atom);
> +
> +       if (vc == NULL)
> +               goto out;
> +
> +       __ofono_voicecall_set_alpha_and_icon_id(vc, sc->alpha_id_call_setup,
> +                                               sc->icon_id_call_setup.id);
> +
> +       stk->modem_handled_cmd = TRUE;
> +
> +       return;
> +out:
> +       stk_command_free(stk->pending_cmd);
> +       stk->pending_cmd = NULL;
> +}
> +
>  static gboolean handle_command_set_up_call(const struct stk_command *cmd,
>                                                struct stk_response *rsp,
>                                                struct ofono_stk *stk)
> @@ -2601,6 +2641,40 @@ static gboolean handle_command_launch_browser(const 
> struct stk_command *cmd,
>        return FALSE;
>  }
>
> +static void handle_setup_call_confirmation_req(struct stk_command *cmd,
> +                                               struct ofono_stk *stk)
> +{
> +       const struct stk_command_setup_call *sc = &cmd->setup_call;
> +       int err;
> +       char *alpha_id = dbus_apply_text_attributes(
> +                                       sc->alpha_id_usr_cfm ?
> +                                       sc->alpha_id_usr_cfm : "",
> +                                       &sc->text_attr_usr_cfm);
> +       if (alpha_id == NULL)
> +               goto out;
> +
> +       err = stk_agent_confirm_call(stk->current_agent, alpha_id,
> +                                       &sc->icon_id_usr_cfm,
> +                                       confirm_handled_call_cb,
> +                                       stk, NULL,
> +                                       stk->timeout * 1000);
> +       g_free(alpha_id);
> +
> +       if (err < 0)
> +               goto out;
> +
> +       stk->pending_cmd = cmd;
> +       stk->cancel_cmd = stk_request_cancel;
> +
> +       return;
> +
> +out:
> +       if (stk->driver->user_confirmation)
> +               stk->driver->user_confirmation(stk, FALSE);
> +
> +       stk_command_free(cmd);
> +}
> +
>  static void stk_proactive_command_cancel(struct ofono_stk *stk)
>  {
>        if (stk->immediate_response)
> @@ -2615,8 +2689,38 @@ static void stk_proactive_command_cancel(struct 
> ofono_stk *stk)
>        }
>  }
>
> +static void proactive_session_end_handled_cmd(struct ofono_stk *stk)
> +{
> +       stk->modem_handled_cmd = FALSE;
> +
> +       switch(stk->pending_cmd->type) {
> +       case STK_COMMAND_TYPE_SETUP_CALL:
> +       {
> +               struct ofono_voicecall *vc = NULL;
> +               struct ofono_atom *vc_atom;
> +
> +               vc_atom = __ofono_modem_find_atom(
> +                                       __ofono_atom_get_modem(stk->atom),
> +                                       OFONO_ATOM_TYPE_VOICECALL);
> +               if (vc_atom)
> +                       vc = __ofono_atom_get_data(vc_atom);
> +
> +               if (vc != NULL)
> +                       __ofono_voicecall_clear_alpha_and_icon_id(vc);
> +
> +               break;

This part seems fragile.  A new command may arrive and the alpha id
and icon id won't be cleared.  Additionally modem_handled_cmd is not
reset when the pending_cmd is cancelled so it may affect a future
command.  Maybe voicecall.c should automatically clear the alpha &
icon id after the first new call?

Best regards
___
ofono mailing list
ofono@ofon

[PATCH 3/4] stk: Handle set up call in handled_notify

2011-07-06 Thread Jeevaka Badrappan
---
 src/stk.c |  108 +++-
 1 files changed, 106 insertions(+), 2 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 9575f0e..26faa11 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -77,6 +77,8 @@ struct ofono_stk {
struct timeval get_inkey_start_ts;
int dtmf_id;
 
+   gboolean modem_handled_cmd;
+
__ofono_sms_sim_download_cb_t sms_pp_cb;
void *sms_pp_userdata;
 };
@@ -1785,6 +1787,44 @@ static void confirm_call_cb(enum stk_agent_result 
result, gboolean confirm,
stk_command_cb(&error, stk);
 }
 
+static void confirm_handled_call_cb(enum stk_agent_result result,
+   gboolean confirm, void *user_data)
+{
+   struct ofono_stk *stk = user_data;
+   const struct stk_command_setup_call *sc =
+   &stk->pending_cmd->setup_call;
+   struct ofono_voicecall *vc = NULL;
+   struct ofono_atom *vc_atom;
+
+   if (stk->driver->user_confirmation == NULL)
+   goto out;
+
+   if (result != STK_AGENT_RESULT_OK) {
+   stk->driver->user_confirmation(stk, FALSE);
+   goto out;
+   }
+
+   stk->driver->user_confirmation(stk, confirm);
+
+   vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
+   OFONO_ATOM_TYPE_VOICECALL);
+   if (vc_atom)
+   vc = __ofono_atom_get_data(vc_atom);
+
+   if (vc == NULL)
+   goto out;
+
+   __ofono_voicecall_set_alpha_and_icon_id(vc, sc->alpha_id_call_setup,
+   sc->icon_id_call_setup.id);
+
+   stk->modem_handled_cmd = TRUE;
+
+   return;
+out:
+   stk_command_free(stk->pending_cmd);
+   stk->pending_cmd = NULL;
+}
+
 static gboolean handle_command_set_up_call(const struct stk_command *cmd,
struct stk_response *rsp,
struct ofono_stk *stk)
@@ -2601,6 +2641,40 @@ static gboolean handle_command_launch_browser(const 
struct stk_command *cmd,
return FALSE;
 }
 
+static void handle_setup_call_confirmation_req(struct stk_command *cmd,
+   struct ofono_stk *stk)
+{
+   const struct stk_command_setup_call *sc = &cmd->setup_call;
+   int err;
+   char *alpha_id = dbus_apply_text_attributes(
+   sc->alpha_id_usr_cfm ?
+   sc->alpha_id_usr_cfm : "",
+   &sc->text_attr_usr_cfm);
+   if (alpha_id == NULL)
+   goto out;
+
+   err = stk_agent_confirm_call(stk->current_agent, alpha_id,
+   &sc->icon_id_usr_cfm,
+   confirm_handled_call_cb,
+   stk, NULL,
+   stk->timeout * 1000);
+   g_free(alpha_id);
+
+   if (err < 0)
+   goto out;
+
+   stk->pending_cmd = cmd;
+   stk->cancel_cmd = stk_request_cancel;
+
+   return;
+
+out:
+   if (stk->driver->user_confirmation)
+   stk->driver->user_confirmation(stk, FALSE);
+
+   stk_command_free(cmd);
+}
+
 static void stk_proactive_command_cancel(struct ofono_stk *stk)
 {
if (stk->immediate_response)
@@ -2615,8 +2689,38 @@ static void stk_proactive_command_cancel(struct 
ofono_stk *stk)
}
 }
 
+static void proactive_session_end_handled_cmd(struct ofono_stk *stk)
+{
+   stk->modem_handled_cmd = FALSE;
+
+   switch(stk->pending_cmd->type) {
+   case STK_COMMAND_TYPE_SETUP_CALL:
+   {
+   struct ofono_voicecall *vc = NULL;
+   struct ofono_atom *vc_atom;
+
+   vc_atom = __ofono_modem_find_atom(
+   __ofono_atom_get_modem(stk->atom),
+   OFONO_ATOM_TYPE_VOICECALL);
+   if (vc_atom)
+   vc = __ofono_atom_get_data(vc_atom);
+
+   if (vc != NULL)
+   __ofono_voicecall_clear_alpha_and_icon_id(vc);
+
+   break;
+   }
+
+   default:
+   break;
+   }
+}
+
 void ofono_stk_proactive_session_end_notify(struct ofono_stk *stk)
 {
+   if (stk->modem_handled_cmd == TRUE)
+   proactive_session_end_handled_cmd(stk);
+
/* Wait until we receive the next command */
if (stk->immediate_response)
return;
@@ -2858,8 +2962,8 @@ void ofono_stk_proactive_command_handled_notify(struct 
ofono_stk *stk,
break;
 
case STK_COMMAND_TYPE_SETUP_CALL:
-   /* TODO */
-   break;
+   handle_setup_call_confirmation_req(cmd, stk);
+   return;
 
case STK_COMMAND_TYPE_SEND_USSD: