Skip to contentSkip to conversation

Add support for modem handled setup call proactive command

PATCH In review Jeevaka Badrappan 2 participants 16 messages Jul 15, 2011

lore
Share & tools
lore
#0 lore raw

cover Add support for modem handled setup call proactive command

Hi,

This patch set fixes the review comments and also fixes some of the corner cases.

If the modem is able to setup the call, then the alpha id will be freed when the
initiated call ends.

If the modem is not able to setup the call due to some reason, then the memory
allocated for alpha id and dial request are freed when the command end/session end is received.

Thanks and Regards,
Jeevaka

Jeevaka Badrappan (4):
include: Add driver api for user confirmation
voicecall: api for set/clear alpha and icon id
stk: Handle set up call in handled_notify
ifxmodem: add support for user_confirmation in stk

 drivers/ifxmodem/stk.c |   11 ++++
 include/stk.h          |    1 +
 src/ofono.h            |    6 ++
 src/stk.c              |  122 ++++++++++++++++++++++++++++++++++++++++++++++-
 src/voicecall.c        |   76 ++++++++++++++++++++++++++++++
 5 files changed, 213 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/4 include: Add driver api for user confirmation

---
 include/stk.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/stk.h +1 -0
index c276c84..60636b5 100644
@@ -47,6 +47,7 @@ struct ofono_stk_driver {
 	void (*terminal_response)(struct ofono_stk *stk,
 					int length, const unsigned char *resp,
 					ofono_stk_generic_cb_t cb, void *data);
+	void (*user_confirmation)(struct ofono_stk *stk, ofono_bool_t confirm);
 };
 
 int ofono_stk_driver_register(const struct ofono_stk_driver *d);
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 1/4] include: Add driver api for user confirmation

Hi Jeevaka,

Quoted 4 lines · Jeevaka Badrappan
---
 include/stk.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis

#3 lore raw

PATCH 2/4 voicecall: api for set/clear alpha and icon id

In reply to Jeevaka Badrappan
---
 src/ofono.h     |    6 ++++
 src/voicecall.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 0 deletions(-)
src/ofono.h +6 -0
index 6524806..808a8f1 100644
@@ -266,6 +266,12 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc,
 				ofono_voicecall_dial_cb_t cb, void *user_data);
 void __ofono_voicecall_dial_cancel(struct ofono_voicecall *vc);
 
+void __ofono_voicecall_set_alpha_and_icon_id(struct ofono_voicecall *vc,
+						const char *addr, int addr_type,
+						const char *message,
+						unsigned char icon_id);
+void __ofono_voicecall_clear_alpha_and_icon_id(struct ofono_voicecall *vc);
+
 int __ofono_voicecall_tone_send(struct ofono_voicecall *vc,
 				const char *tone_str,
 				ofono_voicecall_tone_cb_t cb, void *user_data);
src/voicecall.c +76 -0

88 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#4 lore raw

Re: [PATCH 2/4] voicecall: api for set/clear alpha and icon id

Hi Jeevaka,

Quoted 30 lines · Jeevaka Badrappan
---
 src/ofono.h     |    6 ++++
 src/voicecall.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 0 deletions(-)
src/ofono.h +6 -0
index 6524806..808a8f1 100644
@@ -266,6 +266,12 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc,
 				ofono_voicecall_dial_cb_t cb, void *user_data);
 void __ofono_voicecall_dial_cancel(struct ofono_voicecall *vc);
 
+void __ofono_voicecall_set_alpha_and_icon_id(struct ofono_voicecall *vc,
+						const char *addr, int addr_type,
+						const char *message,
+						unsigned char icon_id);
+void __ofono_voicecall_clear_alpha_and_icon_id(struct ofono_voicecall *vc);
+
 int __ofono_voicecall_tone_send(struct ofono_voicecall *vc,
 				const char *tone_str,
 				ofono_voicecall_tone_cb_t cb, void *user_data);
src/voicecall.c +0 -0
index 3646951..33041a1 100644
@@ -2204,6 +2204,25 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,
 		goto error;
 	}
 

src/voicecall.c void ofono_voicecall_notify(struct ofono_voicecall *vc, · line 2216

Quoted 10 lines
src/voicecall.c +10 -0
+	if (vc->dial_req) {
+		v->message = vc->dial_req->message;
+		v->icon_id = vc->dial_req->icon_id;
+
+		vc->dial_req->message = NULL;
+		vc->dial_req->call = v;
+
+		newcall->phone_number.type = vc->dial_req->ph.type;
+		strncpy(newcall->phone_number.number, vc->dial_req->ph.number,
+									20);

Do you really want to do this? I suspect we should override the phone number information only if the CLIP validity is not valid.

src/voicecall.c void ofono_voicecall_notify(struct ofono_voicecall *vc, · line 2225

Quoted 9 lines
src/voicecall.c +9 -0
+
+		/*
+		 * TS 102 223 Section 6.4.13: The terminal shall not store
+		 * in the UICC the call set-up details (called party number
+		 * and associated parameters)
+		 */
+		v->untracked = TRUE;
+	}
+

This looks fine, but there's a very subtle thing going on which breaks one particular case. Some background, voicecall driver is free to notify the call before returning from the atd callback, or vice versa.

So e.g.

#1
driver->dial(.., cb, data);
ofono_voicecall_notify()
cb(data);

or

#2
driver->dial(..., cb, data);
cb(data);
ofono_voicecall_notify()

In the case that oFono generates the Set Up Call Request and assuming driver behavior #1, you end up performing some steps twice. Perhaps we should set a flag in vc->flags to indicate that the call setup is being initiated by the modem, and only trigger this path if this flag is set.

e.g.

if (vc->flags & OFONO_VOICECALL_FLAG_STK_MODEM_CALLSETUP) {
	...
}

This flag should be set by set_alpha_and_icon_id

Quoted 20 lines
src/voicecall.c +13 -0
 	v->detect_time = time(NULL);
 
 	if (!voicecall_dbus_register(v)) {
@@ -3659,6 +3678,63 @@ void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id)
 	}
 }
 
+void __ofono_voicecall_set_alpha_and_icon_id(struct ofono_voicecall *vc,
+						const char *addr, int addr_type,
+						const char *message,
+						unsigned char icon_id)
+{
+	struct dial_request *req;
+	const char *number;
+
+	req = g_new0(struct dial_request, 1);
+
+	req->message = g_strdup(message);
+	req->icon_id = icon_id;
+

src/voicecall.c void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id) · line 3703

Quoted 10 lines
src/voicecall.c +10 -0
+	req->ph.type = addr_type;
+	strncpy(req->ph.number, addr, 20);
+
+	number = phone_number_to_string(&req->ph);
+
+	if (!strcmp(number, "112")) {
+		struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+
+		__ofono_modem_inc_emergency_mode(modem);
+	}

I think we should do this step in the block of code in ofono_voicecall_notify dealing with modem callsetup. See below for more:

Quoted 16 lines
src/voicecall.c +16 -0
+
+	vc->dial_req = req;
+}
+
+void __ofono_voicecall_clear_alpha_and_icon_id(struct ofono_voicecall *vc)
+{
+	const char *number;
+
+	if (vc->dial_req == NULL)
+		return;
+
+	number = phone_number_to_string(&vc->dial_req->ph);
+
+	/*
+	 * Incase the modem fails to setup the call and if there is no call
+	 * created, then the emergency mode has to be cleared.

src/voicecall.c void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id) · line 3729

Quoted 10 lines
src/voicecall.c +10 -0
+	 */
+	if (!strcmp(number, "112")) {
+		if (voicecalls_num_active(vc) == 0 &&
+				voicecalls_num_connecting(vc) == 0) {
+			struct ofono_modem *modem =
+					__ofono_atom_get_modem(vc->atom);
+
+			__ofono_modem_dec_emergency_mode(modem);
+		}
+	}

I'm guessing what you're trying to take care of here is the case that the set up call might have been canceled before the call was notified, right?

Wouldn't it be better to do:

if (vc->dial_req->call == NULL)

	...

?

However, in the end I think it is simpler to only initiate the emergency mode when we have the call, and let it be deactivated by the disconnect notification. Then this function becomes way simpler.

src/voicecall.c void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id) · line 3737

Quoted 8 lines
src/voicecall.c +8 -0
+
+	g_free(vc->dial_req->message);
+	vc->dial_req->message = NULL;
+
+	g_free(vc->dial_req);
+	vc->dial_req = NULL;
+}
+

However, I'm actually questioning the need for this function since the cancellation can only be accomplished by hanging up the call before it is active, in which case the modem will take care of sending the appropriate terminal response.

src/voicecall.c void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id) · line 3740

Quoted 3 lines
src/voicecall.c +0 -0
 static void ssn_mt_forwarded_notify(struct ofono_voicecall *vc,
 					unsigned int id, int code,
 					const struct ofono_phone_number *ph)

Regards,
-Denis

#5 lore raw

Re: [PATCH 2/4] voicecall: api for set/clear alpha and icon id

Hi Denis,

Quoted 15 lines

src/voicecall.c void ofono_voicecall_notify(struct ofono_voicecall *vc, · line 2216

Quoted 12 lines
src/voicecall.c +10 -0
 	}
 
+	if (vc->dial_req) {
+		v->message = vc->dial_req->message;
+		v->icon_id = vc->dial_req->icon_id;
+
+		vc->dial_req->message = NULL;
+		vc->dial_req->call = v;
+
+		newcall->phone_number.type = vc->dial_req->ph.type;
+		strncpy(newcall->phone_number.number, vc->dial_req->ph.number,
+									20);

Do you really want to do this? I suspect we should override the phone number information only if the CLIP validity is not valid.

Agreed.

Quoted 29 lines

src/voicecall.c void ofono_voicecall_notify(struct ofono_voicecall *vc, · line 2225

Quoted 10 lines
src/voicecall.c +9 -0
+
+		/*
+		 * TS 102 223 Section 6.4.13: The terminal shall not store
+		 * in the UICC the call set-up details (called party number
+		 * and associated parameters)
+		 */
+		v->untracked = TRUE;
+	}
+

This looks fine, but there's a very subtle thing going on which breaks one particular case. Some background, voicecall driver is free to notify the call before returning from the atd callback, or vice versa.

So e.g.

#1
driver->dial(.., cb, data);
ofono_voicecall_notify()
cb(data);

or

#2
driver->dial(..., cb, data);
cb(data);
ofono_voicecall_notify()

Quoted 5 lines

In the case that oFono generates the Set Up Call Request and assuming driver behavior #1, you end up performing some steps twice. Perhaps we should set a flag in vc->flags to indicate that the call setup is being initiated by the modem, and only trigger this path if this flag is set.

I haven't seen the case where the call status is notified before dial callback. But agreed, we will end up in steps twice in this case. Proposed change is fine with me. Will be incorporated in the next version.

Quoted 39 lines
Quoted 13 lines

+void __ofono_voicecall_clear_alpha_and_icon_id(struct ofono_voicecall *vc)

src/voicecall.c +11 -0
+{
+	const char *number;
+
+	if (vc->dial_req == NULL)
+		return;
+
+	number = phone_number_to_string(&vc->dial_req->ph);
+
+	/*
+	 * Incase the modem fails to setup the call and if there is no call
+	 * created, then the emergency mode has to be cleared.

src/voicecall.c void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id) · line 3729

Quoted 10 lines
src/voicecall.c +10 -0
+	 */
+	if (!strcmp(number, "112")) {
+		if (voicecalls_num_active(vc) == 0 &&
+				voicecalls_num_connecting(vc) == 0) {
+			struct ofono_modem *modem =
+					__ofono_atom_get_modem(vc->atom);
+
+			__ofono_modem_dec_emergency_mode(modem);
+		}
+	}

I'm guessing what you're trying to take care of here is the case that the set up call might have been canceled before the call was notified, right?

Wouldn't it be better to do:

if (vc->dial_req->call == NULL)

	...

?

However, in the end I think it is simpler to only initiate the emergency mode when we have the call, and let it be deactivated by the disconnect notification. Then this function becomes way simpler.

Quoted 13 lines

src/voicecall.c void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id) · line 3737

Quoted 8 lines
src/voicecall.c +8 -0
+
+	g_free(vc->dial_req->message);
+	vc->dial_req->message = NULL;
+
+	g_free(vc->dial_req);
+	vc->dial_req = NULL;
+}
+

However, I'm actually questioning the need for this function since the cancellation can only be accomplished by hanging up the call before it is active, in which case the modem will take care of sending the appropriate terminal response.

Here, I'm 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

Regards,
Jeevaka

#6 lore raw

Re: [PATCH 2/4] voicecall: api for set/clear alpha and icon id

In reply to Denis Kenzior

Hi Denis,

Quoted 11 lines

src/voicecall.c void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id) · line 3703

Quoted 8 lines
src/voicecall.c +8 -0
+
+	number = phone_number_to_string(&req->ph);
+
+	if (!strcmp(number, "112")) {
+		struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+
+		__ofono_modem_inc_emergency_mode(modem);
+	}

I think we should do this step in the block of code in ofono_voicecall_notify dealing with modem callsetup. See below for more:

Emergency mode for all other dial(user initiated, ofono handled setup call) has been activated before we issue dial request to modem. Also I believe its better to activate it here rather than in ofono_voicecall_notify.

Regards,
Jeevaka

#7 lore raw

Re: [PATCH 2/4] voicecall: api for set/clear alpha and icon id

Hi Jeevaka,

Quoted 14 lines · jeevaka.badrappan(a)linux.intel.com

Hi Denis,

Quoted 11 lines

src/voicecall.c void __ofono_voicecall_tone_cancel(struct ofono_voicecall *vc, int id) · line 3703

Quoted 8 lines
src/voicecall.c +8 -0
+
+	number = phone_number_to_string(&req->ph);
+
+	if (!strcmp(number, "112")) {
+		struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+
+		__ofono_modem_inc_emergency_mode(modem);
+	}

I think we should do this step in the block of code in ofono_voicecall_notify dealing with modem callsetup. See below for more:

Quoted 5 lines

Emergency mode for all other dial(user initiated, ofono handled setup call) has been activated before we issue dial request to modem. Also I believe its better to activate it here rather than in ofono_voicecall_notify.

This is debatable since the real world result on the IFX modem is that we activate emergency mode 15 ms earlier than we otherwise would, but might cause funny behavior out of our control (for example, if STK attempts an emergency call while offline, we just flip EmergencyMode to true & back and go nowhere)

However, in the end I'm fine doing it this way, you just need to make sure that the logic in clear_alpha_and_icon_id can handle this case.

Regards,
-Denis

#8 lore raw

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

In reply to Jeevaka Badrappan
---
 src/stk.c |  122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 119 insertions(+), 3 deletions(-)
src/stk.c +119 -3
index 4df23b5..6cc3be3 100644
@@ -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)
+		proactive_command_handled_end(stk);
+
 	if (stk->immediate_response)
 		stk_request_cancel(stk);
 
@@ -2821,6 +2936,7 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
 	 * responses here
 	 */
 	if (length > 0 && pdu[0] == 0x81) {
+		proactive_command_handled_end(stk);
 		stk_alpha_id_unset(stk);
 		return;
 	}
@@ -2858,8 +2974,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:
 		stk_alpha_id_set(stk, cmd->send_ussd.alpha_id,
Signature · 1 line
1.7.4.1
#9 lore raw

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

Hi,

src/stk.c static void stk_alpha_id_set(struct ofono_stk *stk, · line 541

Quoted 13 lines
src/stk.c +6 -1
@@ -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

#10 lore raw

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

Hi Jeevaka,

Quoted 4 lines · jeevaka.badrappan(a)linux.intel.com

Hi,

Quoted 2 lines
(quoted diff) +0 -0
@@ -529,7 +531,12 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
 
Quoted 14 lines

src/stk.c static void stk_alpha_id_set(struct ofono_stk *stk, · line 541

Quoted 11 lines
src/stk.c +6 -1
 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

#11 lore raw

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

In reply to Jeevaka Badrappan

Hi Andrew, Jeevaka,

<snip>

Quoted 20 lines
src/stk.c +20 -0
+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)

src/stk.c static gboolean handle_command_launch_browser(const struct stk_command *cmd, · line 2715

Quoted 10 lines
src/stk.c +10 -0
+			__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

#12 lore raw

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

Hi Denis,

Quoted 36 lines
Quoted 20 lines
src/stk.c +20 -0
+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)

src/stk.c static gboolean handle_command_launch_browser(const struct stk_command *cmd, · line 2715

Quoted 10 lines
src/stk.c +10 -0
+			__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.

Quoted 5 lines

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

#13 lore raw

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

Hi Jeevaka,

Quoted 55 lines · jeevaka.badrappan(a)linux.intel.com

Hi Denis,

Quoted 36 lines
Quoted 20 lines
src/stk.c +20 -0
+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)

src/stk.c static gboolean handle_command_launch_browser(const struct stk_command *cmd, · line 2715

Quoted 10 lines
src/stk.c +10 -0
+			__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.

Quoted 5 lines

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

Quoted 5 lines

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

#14 lore raw

PATCH 4/4 ifxmodem: add support for user_confirmation in stk

In reply to Jeevaka Badrappan
---
 drivers/ifxmodem/stk.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/ifxmodem/stk.c +11 -0
index f08cf47..d2082c4 100644
@@ -173,6 +173,16 @@ error:
 	CALLBACK_WITH_FAILURE(cb, data);
 }
 
+static void ifx_stk_user_confirmation(struct ofono_stk *stk, gboolean confirm)
+{
+	struct stk_data *sd = ofono_stk_get_data(stk);
+	char buf[20];
+
+	snprintf(buf, sizeof(buf), "AT+SATD=%i", confirm ? 1 : 0);
+
+	g_at_chat_send(sd->chat, buf, none_prefix, NULL, NULL, NULL);
+}
+
 static void sati_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_stk *stk = user_data;
@@ -303,6 +313,7 @@ static struct ofono_stk_driver driver = {
 	.remove			= ifx_stk_remove,
 	.envelope		= ifx_stk_envelope,
 	.terminal_response	= ifx_stk_terminal_response,
+	.user_confirmation	= ifx_stk_user_confirmation,
 };
 
 void ifx_stk_init(void)
Signature · 1 line
1.7.4.1
#15 lore raw

Re: [PATCH 4/4] ifxmodem: add support for user_confirmation in stk

Hi Jeevaka,

Quoted 4 lines · Jeevaka Badrappan
---
 drivers/ifxmodem/stk.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis