doc: Play Tone command proposed d-bus API.
PATCH 1/1 doc: Play Tone command proposed d-bus API.
This is a version with the tone identified by a string based on irc discussion, I leave the decision to you about which version to use.
--- doc/stk-api.txt | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
doc/stk-api.txt +32 -0
@@ -200,6 +200,38 @@ Methods byte RequestSelection(string title, byte icon_id, Possible Errors: [service].Error.SimToolkit.EndSession + void PlayTone(string tone, boolean loop, + string text, byte icon_id) + + Tells the agent to play an audio tone. A repeatable + tone is played for the duration of the method call + (until it is cancelled), otherwise it is played once + and the method should return. The text parameter + contains an optional text to be displayed to the + user. The following tones are defined: + "dial tone" + "busy" + "congestion" + "radio path acknowledge" + "radio path not available" + "error" + "call waiting" + "ringing tone" + "general beep" + "positive acknowledgement" + "negative acknowledgement" + "user ringing tone" + "user sms alert" + "critical" (high priority) + "vibrate" + "happy" + "sad" + "urgent action" + "question" + "message received" + + Possible Errors: [service].Error.SimToolkit.EndSession + void Cancel() Asks the agent to cancel any ongoing operation in
Signature · 1 line
1.7.1.86.g0e460.dirty
RFC PATCH 1/2 voicecall: __ofono_voicecall_send_tone internal api.
This provides a way for other atoms to send DTMF tones during a call.
--- src/ofono.h | 6 +++ src/voicecall.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 0 deletions(-)
src/ofono.h +6 -0
@@ -182,6 +182,7 @@ enum ofono_voicecall_interaction { };typedef void (*ofono_voicecall_dial_cb_t )(struct ofono_call *call,void *data); +typedef void (*ofono_voicecall_tone_cb_t )(int error,void *data);ofono_bool_t __ofono_voicecall_is_busy (struct ofono_voicecall *vc,enum ofono_voicecall_interaction type);
@@ -193,6 +194,11 @@ 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); +int __ofono_voicecall_send_tone (struct ofono_voicecall *vc, +const char *tone_str, +ofono_voicecall_tone_cb_t cb,void *user_data); +void __ofono_voicecall_tone_cancel (struct ofono_voicecall *vc); +#include <ofono/sms.h> struct sms ;
src/voicecall.c +136 -0
175 lines not on this page · raw message
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 2/2 stk: Handle the Send DTMF proactive command.
In reply to Andrzej Zaborowski--- src/stk.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 135 insertions(+), 1 deletions(-)
src/stk.c +135 -1
@@ -434,8 +434,12 @@ static void default_agent_notify(gpointer user_data) {struct ofono_stk *stk = user_data; -if (stk->current_agent == stk->default_agent && stk->respond_on_exit) +if (stk->current_agent == stk->default_agent && stk->respond_on_exit) { +if (stk->pending_cmd) + stk->cancel_cmd (stk); +send_simple_response (stk,STK_RESULT_TYPE_USER_TERMINATED ); + } stk->default_agent =NULL ; stk->current_agent = stk->session_agent;
@@ -449,6 +453,9 @@ static void session_agent_notify(gpointer user_data)DBG ("Session Agent removed" );if (stk->current_agent == stk->session_agent && stk->respond_on_exit) { +if (stk->pending_cmd) + stk->cancel_cmd (stk); +DBG ("Sending Terminate response for session agent" );send_simple_response (stk,STK_RESULT_TYPE_USER_TERMINATED ); }
@@ -1590,6 +1597,128 @@ static gboolean handle_command_set_up_call(const struct stk_command *cmd,return FALSE; } +static void send_dtmf_cancel (struct ofono_stk *stk) +{ +struct ofono_voicecall *vc; +struct ofono_atom *vc_atom; + + stk->respond_on_exit = FALSE; + +if (stk->pending_cmd->send_dtmf.alpha_id && + stk->pending_cmd->send_dtmf.alpha_id[0 ]) +stk_alpha_id_unset (stk); + + vc_atom =__ofono_modem_find_atom (__ofono_atom_get_modem (stk->atom), +OFONO_ATOM_TYPE_VOICECALL ); +if (!vc_atom) +return ; + + vc =__ofono_atom_get_data (vc_atom); +if (vc) +__ofono_voicecall_tone_cancel (vc); +} + +static void dtmf_sent_cb (int err,void *user_data) +{ +struct ofono_stk *stk = user_data; + + stk->respond_on_exit = FALSE; + +if (stk->pending_cmd->send_dtmf.alpha_id && + stk->pending_cmd->send_dtmf.alpha_id[0 ]) +stk_alpha_id_unset (stk); + +if (err == -ENOENT ) { +struct stk_response rsp; +static unsigned char not_in_speech_call_result[] = {0x07 }; +static struct ofono_error error = + { .type =OFONO_ERROR_TYPE_FAILURE }; + +memset (&rsp,0 ,sizeof (rsp)); + + rsp.result.type =STK_RESULT_TYPE_TERMINAL_BUSY ; + rsp.result.additional_len =sizeof (not_in_speech_call_result); + rsp.result.additional = not_in_speech_call_result; + +if (stk_respond (stk, &rsp, stk_command_cb)) +stk_command_cb (&error, stk); + +return ; + } + +if (err == -EINVAL ) { +send_simple_response (stk,STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD ); +return ; + } + +if (err ==0 ) +send_simple_response (stk,STK_RESULT_TYPE_SUCCESS ); +else +send_simple_response (stk,STK_RESULT_TYPE_NOT_CAPABLE ); +} + +static gboolean handle_command_send_dtmf (const struct stk_command *cmd, +struct stk_response *rsp, +struct ofono_stk *stk) +{ +static unsigned char not_in_speech_call_result[] = {0x07 }; +struct ofono_voicecall *vc =NULL ; +struct ofono_atom *vc_atom; +int err; + + 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) { + rsp->result.type =STK_RESULT_TYPE_NOT_CAPABLE ; +return TRUE; + } + + err =__ofono_voicecall_send_tone (vc, cmd->send_dtmf.dtmf, + dtmf_sent_cb, stk); + +if (err == -EBUSY ) { + rsp->result.type =STK_RESULT_TYPE_TERMINAL_BUSY ; +return TRUE; + } + +if (err == -ENOSYS ) { + rsp->result.type =STK_RESULT_TYPE_NOT_CAPABLE ; +return TRUE; + } + +if (err == -ENOENT ) { + rsp->result.type =STK_RESULT_TYPE_TERMINAL_BUSY ; + rsp->result.additional_len =sizeof (not_in_speech_call_result); + rsp->result.additional = not_in_speech_call_result; +return TRUE; + } + +if (err <0 ) { +/* +* We most likely got an out of memory error, tell SIM +* to retry +*/ + rsp->result.type =STK_RESULT_TYPE_TERMINAL_BUSY ; +return TRUE; + } + +if (cmd->send_dtmf.alpha_id && cmd->send_dtmf.alpha_id[0 ]) +stk_alpha_id_set (stk, cmd->send_dtmf.alpha_id); + +/* +* Note that we don't strictly require an agent to be connected, +* but to comply with 6.4.24 we need to send a End Session when +* the user decides so. +*/ + stk->respond_on_exit = TRUE; + stk->cancel_cmd = send_dtmf_cancel; + +return FALSE; +} +static void stk_proactive_command_cancel (struct ofono_stk *stk) {if (stk->immediate_response)
@@ -1741,6 +1870,11 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk, &rsp, stk);break ; +case STK_COMMAND_TYPE_SEND_DTMF : + respond =handle_command_send_dtmf (stk->pending_cmd, + &rsp, stk); +break ; +default : rsp.result.type =STK_RESULT_TYPE_COMMAND_NOT_UNDERSTOOD ;break ;
Signature · 1 line
1.7.1.86.g0e460.dirty
PATCH 1/1 Fix sending User Cancel response to Set Up Call.
In reply to Andrzej ZaborowskiOne of the clean-up commits changed the semantics of the dial request callback's parameter (NULL if call setup failed, non-NULL if success or user cancelled).
--- src/stk.c | 2 +- src/voicecall.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletions(-)
src/stk.c +1 -1
@@ -1419,7 +1419,7 @@ static void call_setup_connected(struct ofono_call *call, void *data)static struct ofono_error error = { .type =OFONO_ERROR_TYPE_FAILURE };static unsigned char facility_rejected_result[] = {0x9d }; -if (!call) { +if (!call || call->status ==CALL_STATUS_DISCONNECTED ) {memset (&rsp,0 ,sizeof (rsp)); rsp.result.type =STK_RESULT_TYPE_NETWORK_UNAVAILABLE ;
src/voicecall.c +14 -0
@@ -361,6 +361,16 @@ static DBusMessage *voicecall_deflect(DBusConnection *conn,return NULL ; } +static void dial_request_user_cancel (struct ofono_voicecall *vc, +struct voicecall *call) +{ +if (!vc->dial_req) +return ; + +if (!call || call == vc->dial_req->call) +dial_request_finish (vc->dial_req->call->vc, TRUE); +} +static DBusMessage *voicecall_hangup (DBusConnection *conn,DBusMessage *msg,void *data) {
@@ -372,6 +382,8 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,if (vc->pending)return __ofono_error_busy (msg); +dial_request_user_cancel (vc, v); +switch (call->status) {case CALL_STATUS_DISCONNECTED :return __ofono_error_failed (msg);
@@ -1278,6 +1290,8 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn,return reply; } +dial_request_user_cancel (vc,NULL ); + vc->flags |=VOICECALLS_FLAG_MULTI_RELEASE ; vc->pending =dbus_message_ref (msg);
Signature · 1 line
1.7.1.86.g0e460.dirty
Re: [PATCH] Fix sending User Cancel response to Set Up Call.
Hi Andrew,
Quoted 13 lines · Andrzej Zaborowski
One of the clean-up commits changed the semantics of the dial request callback's parameter (NULL if call setup failed, non-NULL if success or user cancelled).
--- src/stk.c | 2 +- src/voicecall.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletions(-)src/stk.c +0
-0
src/stk.c static void call_setup_connected(struct ofono_call *call, void *data) · line 1422
Quoted 5 lines
src/stk.c +1
-1@@ -1419,7 +1419,7 @@ static void call_setup_connected(struct ofono_call *call, void *data)static struct ofono_error error = { .type =OFONO_ERROR_TYPE_FAILURE };static unsigned char facility_rejected_result[] = {0x9d }; -if (!call) { +if (!call || call->status ==CALL_STATUS_DISCONNECTED ) {
If the call has been disconnected by the user, shouldn't we be sending USER_CANCEL? At least that is what the old behavior implies.
Quoted 25 lines
src/stk.c +0
-0memset (&rsp,0 ,sizeof (rsp)); rsp.result.type =STK_RESULT_TYPE_NETWORK_UNAVAILABLE ;src/voicecall.c +10
-0@@ -361,6 +361,16 @@ static DBusMessage *voicecall_deflect(DBusConnection *conn,return NULL ; } +static void dial_request_user_cancel (struct ofono_voicecall *vc, +struct voicecall *call) +{ +if (!vc->dial_req) +return ; + +if (!call || call == vc->dial_req->call) +dial_request_finish (vc->dial_req->call->vc, TRUE); +} +static DBusMessage *voicecall_hangup (DBusConnection *conn,DBusMessage *msg,void *data) {
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 386
Quoted 5 lines
src/voicecall.c +2
-0@@ -372,6 +382,8 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,if (vc->pending)return __ofono_error_busy (msg); +dial_request_user_cancel (vc, v); +
I don't see the need for this part, don't we already take care of this in voicecall_set_call_status?
src/voicecall.c static DBusMessage *manager_hangup_all(DBusConnection *conn, · line 1294
Quoted 9 lines
src/voicecall.c +2
-0switch (call->status) {case CALL_STATUS_DISCONNECTED :return __ofono_error_failed (msg);@@ -1278,6 +1290,8 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn,return reply; } +dial_request_user_cancel (vc,NULL ); +
Same as above...
src/voicecall.c static DBusMessage *manager_hangup_all(DBusConnection *conn, · line 1297
Quoted 3 lines
src/voicecall.c +0
-0vc->flags |=VOICECALLS_FLAG_MULTI_RELEASE ; vc->pending =dbus_message_ref (msg);
Regards,
-Denis
Re: [PATCH] Fix sending User Cancel response to Set Up Call.
Quoted 19 lines · Denis Kenzior
Hi Andrew,
Quoted 16 lines · Andrzej Zaborowski
One of the clean-up commits changed the semantics of the dial request callback's parameter (NULL if call setup failed, non-NULL if success or user cancelled).
---
src/stk.c | 2 +-
src/voicecall.c | 14 ++++++++++++++2 files changed, 15 insertions(+), 1 deletions(-)src/stk.c +0
-0@@ -1419,7 +1419,7 @@ static void call_setup_connected(struct ofono_call *call, void *data) static struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE }; static unsigned char facility_rejected_result[] = { 0x9d };
Quoted 5 lines
src/stk.c static void call_setup_connected(struct ofono_call *call, void *data) · line 1422
Quoted 2 lines
src/stk.c +1
-1- if (!call) { + if (!call || call->status == CALL_STATUS_DISCONNECTED) {If the call has been disconnected by the user, shouldn't we be sending
USER_CANCEL? At least that is what the old behavior implies.
In that case yes, but if it's disconnected because connecting failed, then we report this to the card.
I noticed that http://git.kernel.org/?p=network/ofono/ofono.git;a=commitdiff;h=ed562ba2b04b56b9a688d40906bb783027c4a1e6
changed the behaviour slightly (but the old behaviour was probably
wrong too).
Quoted 29 lines
Quoted 29 lines
src/stk.c +0
-0memset(&rsp, 0, sizeof(rsp)); rsp.result.type = STK_RESULT_TYPE_NETWORK_UNAVAILABLE;src/voicecall.c +10
-0@@ -361,6 +361,16 @@ static DBusMessage *voicecall_deflect(DBusConnection *conn, return NULL; } +static void dial_request_user_cancel (struct ofono_voicecall *vc, + struct voicecall *call) +{ + if (!vc->dial_req) + return; + + if (!call || call == vc->dial_req->call) + dial_request_finish(vc->dial_req->call->vc, TRUE); +} + static DBusMessage *voicecall_hangup(DBusConnection *conn, DBusMessage *msg, void *data) {@@ -372,6 +382,8 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn, if (vc->pending) return __ofono_error_busy(msg);
Quoted 5 lines
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 386
Quoted 2 lines
src/voicecall.c +2
-0+ dial_request_user_cancel(vc, v); +I don't see the need for this part, don't we already take care of this in
voicecall_set_call_status?
At that point we can't tell where it was a network error / busy signal / etc, or the user cancelled the call (which has a different result value sent to sim).
Quoted 15 lines
src/voicecall.c static DBusMessage *manager_hangup_all(DBusConnection *conn, · line 1294
Quoted 10 lines
src/voicecall.c +0
-0switch (call->status) {case
CALL_STATUS_DISCONNECTED:
return__ofono_error_failed(msg);src/voicecall.c +2
-0@@ -1278,6 +1290,8 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn, return reply; } + dial_request_user_cancel(vc, NULL); +Same as above...
Quoted 2 lines
src/voicecall.c +0
-0vc->flags |= VOICECALLS_FLAG_MULTI_RELEASE;
Quoted 9 lines
src/voicecall.c static DBusMessage *manager_hangup_all(DBusConnection *conn, · line 1297
Quoted 1 line
src/voicecall.c +0
-0vc->pending = dbus_message_ref(msg);Regards,
-Denis
_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono
Regards,
Andrew
Re: [PATCH] Fix sending User Cancel response to Set Up Call.
In reply to Andrzej ZaborowskiHi Andrew,
Quoted 3 lines · Andrzej Zaborowski
One of the clean-up commits changed the semantics of the dial request callback's parameter (NULL if call setup failed, non-NULL if success or user cancelled).
Patch has been applied, thanks.
Regards,
-Denis
Hi Andrew,
Quoted 13 lines
This is a version with the tone identified by a string based on irc discussion, I leave the decision to you about which version to use.
--- doc/stk-api.txt | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)doc/stk-api.txt +0
-0@@ -200,6 +200,38 @@ Methods byte RequestSelection(string title, byte icon_id, Possible Errors: [service].Error.SimToolkit.EndSession
doc/stk-api.txt Methods byte RequestSelection(string title, byte icon_id, · line 211
Quoted 10 lines
doc/stk-api.txt +9
-0+ void PlayTone(string tone, boolean loop, + string text, byte icon_id) + + Tells the agent to play an audio tone. A repeatable + tone is played for the duration of the method call + (until it is cancelled), otherwise it is played once + and the method should return. The text parameter + contains an optional text to be displayed to the + user. The following tones are defined:
string sounds here more than reasonable. For the looping part we have to clarify when to return from this method. For non repeating tones it is pretty clear. It should return when playing the tone finished. For the repeating one we can return right away, or after the first iteration has played. That needs to be properly described in what to expect from the agent.
Also has PlayTone and PlayLoop method calls considered to have a clearer semantic separation?
Quoted 10 lines
doc/stk-api.txt +10
-0+ "dial tone" + "busy" + "congestion" + "radio path acknowledge" + "radio path not available" + "error" + "call waiting" + "ringing tone" + "general beep" + "positive acknowledgement"
doc/stk-api.txt Methods byte RequestSelection(string title, byte icon_id, · line 231
Quoted 10 lines
doc/stk-api.txt +10
-0+ "negative acknowledgement" + "user ringing tone" + "user sms alert" + "critical" (high priority) + "vibrate" + "happy" + "sad" + "urgent action" + "question" + "message received"
I prefer to have them as "call-waiting" with a - in between. Space are sort of a bad idea for constant type strings. And we do similar things for "cs-preferred" etc. But essentially I agree that strings are way better.
Can we also fix the typo in acknowledgment ;)
The alternate text string comes from the SIM Toolkit, right?
Regards
Marcel
Hi,
Quoted 7 lines · Marcel Holtmann
Quoted 6 lines
+ Tells the agent to play an audio tone. A repeatable
+ tone is played for the duration of the method call
+ (until it is cancelled), otherwise it is played once
+ and the method should return. The text parameter
+ contains an optional text to be displayed to the
+ user. The following tones are defined:
Quoted 6 lines
string sounds here more than reasonable. For the looping part we have to clarify when to return from this method. For non repeating tones it is pretty clear. It should return when playing the tone finished. For the repeating one we can return right away, or after the first iteration has played. That needs to be properly described in what to expect from the agent.
My idea is for it to wait until the call is cancelled, and not return.
Otherwise we'll have to send the duration in a 0.1s units.
Quoted 3 lines
Also has PlayTone and PlayLoop method calls considered to have a clearer semantic separation?
That's a good idea, I'll change it to use the separate methods unless someone objects.
Quoted 22 lines
Quoted 13 lines
+ "dial tone"
+ "busy"
+ "congestion"
+ "radio path acknowledge"
+ "radio path not available"
+ "error"
+ "call waiting"
+ "ringing tone"
+ "general beep"
+ "positive acknowledgement"
+ "negative acknowledgement"
+ "user ringing tone"Quoted 8 lines
+ "user sms alert"
+ "critical" (high priority)
+ "vibrate"
+ "happy"
+ "sad"
+ "urgent action"
+ "question"
+ "message received"
Quoted 3 lines
I prefer to have them as "call-waiting" with a - in between. Space are sort of a bad idea for constant type strings. And we do similar things for "cs-preferred" etc.
Ok.
Quoted 1 line
Can we also fix the typo in acknowledgment ;)
I think I copied it from the spec (I'll check), the interwebs claims both forms are correct :)
Quoted 1 line
The alternate text string comes from the SIM Toolkit, right?
Yes, it's actually the AlphaId / Icon to be displayed *while* playing, not instead.
Regards,
Andrew