STE-driver: Terminating voice call in state DIALING/ALERTING.
RFC 1/1 STE-driver: Terminating voice call in state DIALING/ALERTING.
From: Sjur Brændeland <[email protected]>
This patch splits the callback hangup into hangup_all and hangup_active.
---
Hi Denis,
I'm picking up a really old thread here...
Quoted 15 lines
Quoted 5 lines · Denis Kenzior
Quoted 5 lines
Quoted 4 lines
c) If you have an call on hold and initiate a new call, but want to terminate the newly initiated call (DIALING), then this call cannot be terminated with CHLD=1X, but you would have to use ATH (or possible CHUP).
Quoted 8 lines
Quoted 3 lines
Yes, so this is the case that we do need to take care of in the core. Most
modems let us get away with sendingrelease_specificup to this point.For the STE modem, calls in state DIALING and ALERTING will have to be
terminated with ATH or AT+CHUP, AT+CHLD=1x does not work. This means that the current implementation, usingrelease_specific(and thus AT+CHLD=1x) will not work.
Quoted 9 lines
Yep, so please critique my earlier suggestion of splitting up hangup into two methods:
hangup_allandhangup_active. Modem drivers will need to provide one or the other or both.
The core can then use thehangup_active(if available) in those cases whererelease_specificmight not work. The condition forhangup_activewill be that it does not affect held or waiting calls. For ST-E thehangup_activeimplementation will simply be +CHUP. For modems that do not have this available we will fall back torelease_specificand assume that on those CHLD=1X or equivalent can affect dialing/alerting calls.
If I understand you correctly STE driver should implement hangup_active using +CUP. Core should then use hangup_active on calls in state DIALING and ALERTING - Yes, I think this would work.
Quoted 7 lines
hangup_allcan also be used for cases where we looprelease_specificover all active/dialing/alerting/held/incoming calls. For ST-E thehangup_allimplementation might be +CHUP;CHLD=1n;...;+CHLD=1m where n, m, etc are ids of the HELD calls. We should not hangup waiting calls to be compliant with section 6.5.5.1 of 3GPP 22.030:
"Entering END -Releases the subscriber from all calls
(except a possible waiting call)."
I guess the stedriver will not implement the hangup_all because the STE modem does not have an AT command for terminating all calls. (I assume you don't want the driver to iterate over calls constructing a command like:
"+CHUP;CHLD=1n;...;+CHLD=1m").
I've probably not understood your proposal fully, but I have tried to put together some code based on it. Please have a look and check if you had something like this in mind.
However, I think we can solve this even simpler if we just call hangup for any ALERTING/DIALING call..
Regards
Sjur
drivers/stemodem/voicecall.c +2 -2
@@ -260,7 +260,7 @@ static void ste_answer(struct ofono_voicecall *vc,ste_template ("ATA" , vc, ste_generic_cb,0 , cb, data); } -static void ste_hangup (struct ofono_voicecall *vc, +static void ste_hangup_active (struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data) {ste_template ("AT+CHUP" , vc, ste_generic_cb,0x3f , cb, data);
@@ -569,7 +569,7 @@ static struct ofono_voicecall_driver driver = { .remove = ste_voicecall_remove, .dial = ste_dial, .answer = ste_answer, - .hangup = ste_hangup, + .hangup_active = ste_hangup_active, .hold_all_active = ste_hold_all_active, .release_all_held = ste_release_all_held, .set_udub = ste_set_udub,
include/voicecall.h +5 -1
@@ -67,7 +67,11 @@ struct ofono_voicecall_driver { ofono_voicecall_cb_t cb, void *data);void (*answer)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data); -void (*hangup)(struct ofono_voicecall *vc, +void (*hangup_all)(struct ofono_voicecall *vc, +ofono_voicecall_cb_t cb,void *data); +/* HACK: for temporary backwards compability */ +#define hangup_active hangup +void (*hangup_active)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);void (*hold_all_active)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);
src/voicecall.c +28 -8
@@ -264,12 +264,12 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,/* According to various specs, other than 27.007, +CHUP is used * to reject an incoming call */ -if (call->status ==CALL_STATUS_INCOMING ) { +if (vc->driver->hangup_active && call->status ==CALL_STATUS_INCOMING ) {if (vc->driver->hangup ==NULL )return __ofono_error_not_implemented (msg); vc->pending =dbus_message_ref (msg); - vc->driver->hangup (vc, generic_callback, vc); + vc->driver->hangup_active (vc, generic_callback, vc);return NULL ; }
@@ -286,12 +286,12 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn, num_calls =g_slist_length (vc->call_list); -if (num_calls ==1 && vc->driver->hangup && +if (vc->driver->hangup_active && num_calls ==1 && vc->driver->hangup && (call->status ==CALL_STATUS_ACTIVE || call->status ==CALL_STATUS_DIALING || call->status ==CALL_STATUS_ALERTING )) { vc->pending =dbus_message_ref (msg); - vc->driver->hangup (vc, generic_callback, vc); + vc->driver->hangup_active (vc, generic_callback, vc);return NULL ; }
@@ -304,6 +304,16 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,return NULL ; } +if (vc->driver->hangup_active !=NULL && + (call->status ==CALL_STATUS_ALERTING || + call->status ==CALL_STATUS_DIALING )) { + + vc->pending =dbus_message_ref (msg); + vc->driver->hangup_active (vc, generic_callback, vc); + +return NULL ; + } +if (vc->driver->release_specific ==NULL )return __ofono_error_not_implemented (msg);
@@ -762,7 +772,14 @@ static void voicecalls_release_next(struct ofono_voicecall *vc) vc->release_list =g_slist_remove (vc->release_list, call); - vc->driver->release_specific (vc, call->call->id, +if (vc->driver->hangup_active !=NULL && + (call->call->status ==CALL_STATUS_ALERTING || + call->call->status ==CALL_STATUS_DIALING || + call->call->status ==CALL_STATUS_INCOMING )) + + vc->driver->hangup_active (vc, multirelease_callback, vc); +else + vc->driver->release_specific (vc, call->call->id, multirelease_callback, vc); }
@@ -1131,9 +1148,12 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn, vc->pending =dbus_message_ref (msg); -voicecalls_release_queue (vc, vc->call_list); -voicecalls_release_next (vc); - +if (vc->driver->hangup_all !=NULL ) + vc->driver->hangup_all (vc, generic_callback, vc); +else { +voicecalls_release_queue (vc, vc->call_list); +voicecalls_release_next (vc); + }return NULL ; }
Signature · 1 line
1.6.3.3
Hi Sjur,
Quoted 7 lines · Sjur Brændeland
From: Sjur Brændeland <[email protected]>
This patch splits the callback hangup into
hangup_allandhangup_active.---
Hi Denis,
I'm picking up a really old thread here...
Yes a really old thread ;)
Quoted 43 lines
Quoted 16 lines
Quoted 5 lines · Denis Kenzior
Quoted 5 lines
Quoted 4 lines
c) If you have an call on hold and initiate a new call, but want to terminate the newly initiated call (DIALING), then this call cannot be terminated with CHLD=1X, but you would have to use ATH (or possible CHUP).
Quoted 8 lines
Quoted 3 lines
Yes, so this is the case that we do need to take care of in the core. Most
modems let us get away with sendingrelease_specificup to this point.For the STE modem, calls in state DIALING and ALERTING will have to be
terminated with ATH or AT+CHUP, AT+CHLD=1x does not work. This means that the current implementation, usingrelease_specific(and thus AT+CHLD=1x) will not work.Quoted 9 lines
Yep, so please critique my earlier suggestion of splitting up hangup into two methods:
hangup_allandhangup_active. Modem drivers will need to provide one or the other or both.
The core can then use thehangup_active(if available) in those cases whererelease_specificmight not work. The condition forhangup_activewill be that it does not affect held or waiting calls. For ST-E thehangup_activeimplementation will simply be +CHUP. For modems that do not have this available we will fall back torelease_specificand assume that on those CHLD=1X or equivalent can affect dialing/alerting calls.If I understand you correctly STE driver should implement
hangup_activeusing +CUP. Core should then usehangup_activeon calls in state DIALING and ALERTING - Yes, I think this would work.Quoted 7 lines
hangup_allcan also be used for cases where we looprelease_specificover all active/dialing/alerting/held/incoming calls. For ST-E thehangup_allimplementation might be +CHUP;CHLD=1n;...;+CHLD=1m where n, m, etc are ids of the HELD calls. We should not hangup waiting calls to be compliant with section 6.5.5.1 of 3GPP 22.030:
"Entering END -Releases the subscriber from all calls
(except a possible waiting call)."I guess the stedriver will not implement the
hangup_allbecause the STE modem does not have an AT command for terminating all calls. (I assume you don't want the driver to iterate over calls constructing a command like:
"+CHUP;CHLD=1n;...;+CHLD=1m").
Quoted 6 lines
I've probably not understood your proposal fully, but I have tried to put together some code based on it. Please have a look and check if you had something like this in mind.
However, I think we can solve this even simpler if we just call hangup for any ALERTING/DIALING call..
This is a real gray area. On some devices this will work, on others it might have un-intentional consequences. At least on the calypso, sending CHUP/ATH will terminate all calls not in the WAITING state.
Quoted 48 lines
Regards
Sjurdrivers/stemodem/voicecall.c +2
-2@@ -260,7 +260,7 @@ static void ste_answer(struct ofono_voicecall *vc,ste_template ("ATA" , vc, ste_generic_cb,0 , cb, data); } -static void ste_hangup (struct ofono_voicecall *vc, +static void ste_hangup_active (struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data) {ste_template ("AT+CHUP" , vc, ste_generic_cb,0x3f , cb, data);@@ -569,7 +569,7 @@ static struct ofono_voicecall_driver driver = { .remove = ste_voicecall_remove, .dial = ste_dial, .answer = ste_answer, - .hangup = ste_hangup, + .hangup_active = ste_hangup_active, .hold_all_active = ste_hold_all_active, .release_all_held = ste_release_all_held, .set_udub = ste_set_udub,include/voicecall.h +5
-1@@ -67,7 +67,11 @@ struct ofono_voicecall_driver { ofono_voicecall_cb_t cb, void *data);void (*answer)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data); -void (*hangup)(struct ofono_voicecall *vc, +void (*hangup_all)(struct ofono_voicecall *vc, +ofono_voicecall_cb_t cb,void *data); +/* HACK: for temporary backwards compability */ +#define hangup_active hangup +void (*hangup_active)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);void (*hold_all_active)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);src/voicecall.c +0
-0
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 267
Quoted 5 lines
src/voicecall.c +1
-1@@ -264,12 +264,12 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,/* According to various specs, other than 27.007, +CHUP is used * to reject an incoming call */ -if (call->status ==CALL_STATUS_INCOMING ) { +if (vc->driver->hangup_active && call->status ==CALL_STATUS_INCOMING ) {
You're breaking the logic somewhat here. If the call is INCOMING, we shouldn't skip the rest of the block if hangup_active is not implemented.
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 275
Quoted 9 lines
src/voicecall.c +1
-1if (vc->driver->hangup ==NULL )return __ofono_error_not_implemented (msg); vc->pending =dbus_message_ref (msg); - vc->driver->hangup (vc, generic_callback, vc); + vc->driver->hangup_active (vc, generic_callback, vc);return NULL ; }
Here we need to check whether hangup_active or hangup_all are implemented. If both are, then prefer hangup_all. This would make it easier to keep compatibility with current drivers.
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 289
Quoted 6 lines
src/voicecall.c +1
-1@@ -286,12 +286,12 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn, num_calls =g_slist_length (vc->call_list); - if (num_calls == 1 && vc->driver->hangup && + if (vc->driver->hangup_active && num_calls == 1 && vc->driver->hangup &&
This should probably be a condition something like:
if (num_calls == 1 && (vc->driver->hangup || vc->driver->hangup_active)
...
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 294
Quoted 6 lines
src/voicecall.c +1
-1(call->status == CALL_STATUS_ACTIVE || call->status == CALL_STATUS_DIALING || call->status == CALL_STATUS_ALERTING)) { vc->pending =dbus_message_ref (msg); - vc->driver->hangup (vc, generic_callback, vc); + vc->driver->hangup_active (vc, generic_callback, vc);
And again prefer hangup_all over hangup_active to keep compatibility with old drivers.
Quoted 7 lines
src/voicecall.c +0
-0return NULL ; }@@ -304,6 +304,16 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,return NULL ; }
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 316
Quoted 10 lines
src/voicecall.c +10
-0+if (vc->driver->hangup_active !=NULL && + (call->status ==CALL_STATUS_ALERTING || + call->status ==CALL_STATUS_DIALING )) { + + vc->pending =dbus_message_ref (msg); + vc->driver->hangup_active (vc, generic_callback, vc); + +return NULL ; + } +
This seems reasonable
src/voicecall.c static void voicecalls_release_next(struct ofono_voicecall *vc) · line 778
Quoted 12 lines
src/voicecall.c +4
-1if (vc->driver->release_specific ==NULL )return __ofono_error_not_implemented (msg);@@ -762,7 +772,14 @@ static void voicecalls_release_next(struct ofono_voicecall *vc) vc->release_list =g_slist_remove (vc->release_list, call); - vc->driver->release_specific(vc, call->call->id, +if (vc->driver->hangup_active !=NULL && + (call->call->status ==CALL_STATUS_ALERTING || + call->call->status ==CALL_STATUS_DIALING || + call->call->status ==CALL_STATUS_INCOMING ))
This reminds me that we should treat INCOMING calls in HangupAll specially. It should not be handled here. HangupAll should also skip waiting calls.
Quoted 10 lines
src/voicecall.c +4
-0+ + vc->driver->hangup_active (vc, multirelease_callback, vc); + else + vc->driver->release_specific(vc, call->call->id,multirelease_callback ,vc ); }@@ -1131,9 +1148,12 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn, vc->pending =dbus_message_ref (msg);
src/voicecall.c static DBusMessage *manager_hangup_all(DBusConnection *conn, · line 1156
Quoted 10 lines
src/voicecall.c +6
-3-voicecalls_release_queue (vc, vc->call_list); -voicecalls_release_next (vc); - +if (vc->driver->hangup_all !=NULL ) + vc->driver->hangup_all (vc, generic_callback, vc); +else { +voicecalls_release_queue (vc, vc->call_list); +voicecalls_release_next (vc); + }
This looks reasonable.
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 306
Quoted 3 lines
src/voicecall.c +0
-0return NULL ; }
Regards,
-Denis
Hi Denis,
Quoted 2 lines · Denis Kenzior
Quoted 1 line
I'm picking up a really old thread here...
Yes a really old thread ;)
Better late than never, right? :-)
...
Quoted 5 lines
Quoted 2 lines
However, I think we can solve this even simpler if we just call hangup for any ALERTING/DIALING call..
This is a real gray area. On some devices this will work, on others it might have un-intentional consequences. At least on the calypso, sending CHUP/ATH will terminate all calls not in the WAITING state.
Ok, so we should go forward with this proposal then. I'll try to send a new RFC within the next couple of days.
My initial intention here was not to submit patches
on src/voicecall.c, but to make sure I understood your proposal properly. Let me know how you think we should go forward with this, as this impacts all drivers/*/voicecall.c
Quoted 13 lines
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 267
Quoted 2 lines
src/voicecall.c +1
-1-if (call->status ==CALL_STATUS_INCOMING ) { +if (vc->driver->hangup_active && call->status ==CALL_STATUS_INCOMING ) {You're breaking the logic somewhat here. If the call is INCOMING, we shouldn't skip the rest of the block if
hangup_activeis not implemented.Quoted 7 lines
if (vc->driver->hangup == NULL) return __ofono_error_not_implemented(msg); vc->pending = dbus_message_ref(msg);(quoted diff) +1
-1- vc->driver->hangup(vc, generic_callback, vc); + vc->driver->hangup_active(vc, generic_callback, vc);
Quoted 6 lines
Quoted 2 lines
return NULL; }Here we need to check whether
hangup_activeorhangup_allare implemented. If both are, then preferhangup_all. This would make it easier to keep compatibility with current drivers.
Did you have something like this in mind then:
if (call->status == CALL_STATUS_INCOMING) {
vc->pending = dbus_message_ref(msg);
if (vc->driver->hangup_all)
vc->driver->hangup_all(vc, generic_callback, vc);
else if (vc->driver->hangup_active)
vc->driver->hangup_active(vc, generic_callback, vc);
else
return __ofono_error_not_implemented(msg);
return NULL;
}Should we do not_implemented here or did you intend the drivers to be allowed to not implement hangup_active nor hangup_all, and fall through to release_specific?
Quoted 13 lines
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 289
Quoted 7 lines
src/voicecall.c +1
-1@@ -286,12 +286,12 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn, num_calls =g_slist_length (vc->call_list); - if (num_calls == 1 && vc->driver->hangup && + if (vc->driver->hangup_active && num_calls == 1 && vc->driver->hangup &&This should probably be a condition something like:
if (
num_calls== 1 && (vc->driver->hangup||vc->driver->hangup_active)
...
Quoted 9 lines
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 294
Quoted 6 lines
src/voicecall.c +1
-1(call->status ==CALL_STATUS_ACTIVE || call->status ==CALL_STATUS_DIALING || call->status == CALL_STATUS_ALERTING)) { vc->pending = dbus_message_ref(msg); - vc->driver->hangup (vc, generic_callback, vc); + vc->driver->hangup_active (vc, generic_callback, vc);And again prefer
hangup_alloverhangup_activeto keep compatibility with old drivers.
Something like this then:
if (num_calls == 1 && (vc->driver->hangup_all || vc->driver->hangup_active) &&
(call->status == CALL_STATUS_ACTIVE ||
call->status == CALL_STATUS_DIALING ||
call->status == CALL_STATUS_ALERTING)) {
vc->pending = dbus_message_ref(msg);
if (vc->driver->hangup_all)
vc->driver->hangup_all(vc, generic_callback, vc);
else if (vc->driver->hangup_active)
vc->driver->hangup_active(vc, generic_callback, vc);
else
return __ofono_error_not_implemented(msg);Quoted 2 lines
This reminds me that we should treat INCOMING calls in HangupAll specially. It should not be handled here.
What did you have in mind?
Quoted 1 line
HangupAll should also skip waiting calls.
voicecalls_release_queue and voicecalls_release_next are used for multiparty_hangup as well, I assume you want the same behaviour for multi-party so that we can do these changes in voicecalls_release_queue, right?
Regards
Sjur
Hi Sjur,
Quoted 8 lines · Sjur Brændeland
Hi Denis,
Quoted 2 lines · Denis Kenzior
Quoted 1 line
I'm picking up a really old thread here...
Yes a really old thread ;)
Better late than never, right? :-)
...
Definitely :) I'm very glad you brought this back up.
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
However, I think we can solve this even simpler if we just call hangup for any ALERTING/DIALING call..
This is a real gray area. On some devices this will work, on others it might have un-intentional consequences. At least on the calypso, sending CHUP/ATH will terminate all calls not in the WAITING state.
Quoted 8 lines
Ok, so we should go forward with this proposal then. I'll try to send a new RFC within the next couple of days.
My initial intention here was not to submit patches
onsrc/voicecall.c, but to make sure I understood your proposal properly. Let me know how you think we should go forward with this, as this impacts alldrivers/*/voicecall.c
Yes, I think this definitely makes sense. There might be some other modems we don't cover properly (some don't allow HELD calls to be terminated using CHLD=1X), but we cross that bridge when we come to it.
Quoted 34 lines
Quoted 13 lines
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 267
Quoted 2 lines
src/voicecall.c +1
-1-if (call->status ==CALL_STATUS_INCOMING ) { +if (vc->driver->hangup_active && call->status ==CALL_STATUS_INCOMING ) {You're breaking the logic somewhat here. If the call is INCOMING, we shouldn't skip the rest of the block if
hangup_activeis not implemented.Quoted 7 lines
if (vc->driver->hangup == NULL) return __ofono_error_not_implemented(msg); vc->pending = dbus_message_ref(msg);(quoted diff) +1
-1- vc->driver->hangup(vc, generic_callback, vc); + vc->driver->hangup_active(vc, generic_callback, vc);Quoted 6 lines
Quoted 2 lines
return NULL; }Here we need to check whether
hangup_activeorhangup_allare implemented. If both are, then preferhangup_all. This would make it easier to keep compatibility with current drivers.Did you have something like this in mind then:
if (call->status == CALL_STATUS_INCOMING) { vc->pending = dbus_message_ref(msg); if (vc->driver->hangup_all) vc->driver->hangup_all(vc, generic_callback, vc); else if (vc->driver->hangup_active) vc->driver->hangup_active(vc, generic_callback, vc); else return __ofono_error_not_implemented(msg); return NULL; }
Quoted 3 lines
Should we do
not_implementedhere or did you intend the drivers to be allowed to not implementhangup_activenorhangup_all, and fall through torelease_specific?
I think doing not_implemented here is a good idea. However, you should not take the ref of the message if you're returning not_implemented. Something like this would be better:
if (call->status == CALL_STATUS_INCOMING) {
if (vc->driver->hangup_all == NULL &&
vc->driver->hangup_active == NULL)
return __ofono_error_not_implemented(msg);
vc->pending = dbus_message_ref(msg);
if (vc->driver->hangup_all)
....
else
....
return NULL;
}Quoted 27 lines
Quoted 14 lines
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 289
Quoted 8 lines
src/voicecall.c +1
-1@@ -286,12 +286,12 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn, num_calls =g_slist_length (vc->call_list); - if (num_calls == 1 && vc->driver->hangup && + if (vc->driver->hangup_active && num_calls == 1 && vc->driver->hangup &&This should probably be a condition something like:
if (
num_calls== 1 && (vc->driver->hangup||vc->driver->hangup_active)
...Quoted 9 lines
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 294
Quoted 6 lines
src/voicecall.c +1
-1(call->status ==CALL_STATUS_ACTIVE || call->status ==CALL_STATUS_DIALING || call->status == CALL_STATUS_ALERTING)) { vc->pending = dbus_message_ref(msg); - vc->driver->hangup (vc, generic_callback, vc); + vc->driver->hangup_active (vc, generic_callback, vc);And again prefer
hangup_alloverhangup_activeto keep compatibility with old drivers.Something like this then:
if (num_calls== 1 && (vc->driver->hangup_all||vc->driver->hangup_active) &&
Quoted 11 lines
(call->status == CALL_STATUS_ACTIVE ||
call->status == CALL_STATUS_DIALING ||
call->status == CALL_STATUS_ALERTING)) {
vc->pending = dbus_message_ref(msg);
if (vc->driver->hangup_all)
vc->driver->hangup_all(vc, generic_callback, vc);
else if (vc->driver->hangup_active)
vc->driver->hangup_active(vc, generic_callback, vc);
else
return __ofono_error_not_implemented(msg);Yep, but see the comment about dbus_message_ref above.
Quoted 4 lines
Quoted 2 lines
This reminds me that we should treat INCOMING calls in HangupAll specially. It should not be handled here.
What did you have in mind?
I'm thinking of simply checking if there is an INCOMING call. If so, it is assumed to be a single call and using hangup_all / hangup_active is sufficient. This would also be more consistent with voicecall_hangup implementation above.
Quoted 6 lines
Quoted 2 lines
HangupAll should also skip waiting calls.
voicecalls_release_queueandvoicecalls_release_nextare used formultiparty_hangupas well, I assume you want the same behaviour for multi-party so that we can do these changes invoicecalls_release_queue, right?
Correct, however multiparty calls cannot be in the WAITING state. Essentially we can just skip these by not queuing them on the release list.
Quoted 3 lines
Regards
Sjur
Regards,
-Denis
RFC v2 1/1 STE-driver: Terminating voice call in state DIALING/ALERTING.
From: Sjur Brændeland <[email protected]>
This patch fixes problem with terminating calls in state DIALING/ALERTING for STE-modem. The main change is that voicecall-callback function hangup is split into the functions hangup_all and hangup_active.
CHANGES:include/voicecall.h:
o hangup is replaced with hangup_active and hangup_all.
o As a tmp hack to provide backwards portability the previous hangup is defined to hangup_all
drivers/atmodem/voicecall.c:
o hangup_all uses ATH
o hangup_active uses CHUP
drivers/stemodem/voicecall.c:
o hangup_active uses CHUP while hangup_all is not implemented.
src/voicecall.c:
o In cases where hangup previously was used, hangup_all is used if implemented otherwise hangup_active is used.
o Call in state DIALING/ALERTING is released with hangup_active if implemented.
o manager_hangup_all will no longer release calls in state waiting.
o manager_hangup_all will simply call hangup_all if implemented.
o manager_hangup_all will release calls in state ALERTING/DIALING/INCOMING using hangup_active otherwise release_specific.
--- drivers/atmodem/voicecall.c | 14 ++++++-- drivers/stemodem/voicecall.c | 4 +- include/voicecall.h | 6 +++- src/voicecall.c | 76 +++++++++++++++++++++++++++++++++-------- 4 files changed, 79 insertions(+), 21 deletions(-)
drivers/atmodem/voicecall.c +11 -3
@@ -406,10 +406,17 @@ static void at_answer(struct ofono_voicecall *vc,at_template ("ATA" , vc, generic_cb,0 , cb, data); } -static void at_hangup (struct ofono_voicecall *vc, +static void at_hangup_all (struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data) { -/* Hangup all calls */ +/* Hangup all calls, except waiting */ +at_template ("ATH" , vc, generic_cb,0x3f , cb, data); +} + +static void at_hangup_active (struct ofono_voicecall *vc, +ofono_voicecall_cb_t cb,void *data) +{ +/* Hangup currently active call */ at_template ("AT+CHUP" , vc, generic_cb,0x3f , cb, data); }
@@ -874,7 +881,8 @@ static struct ofono_voicecall_driver driver = { .remove = at_voicecall_remove, .dial = at_dial, .answer = at_answer, - .hangup = at_hangup, + .hangup_active = at_hangup_active, + .hangup_all = at_hangup_all, .hold_all_active = at_hold_all_active, .release_all_held = at_release_all_held, .set_udub = at_set_udub,
drivers/stemodem/voicecall.c +2 -2
@@ -260,7 +260,7 @@ static void ste_answer(struct ofono_voicecall *vc,ste_template ("ATA" , vc, ste_generic_cb,0 , cb, data); } -static void ste_hangup (struct ofono_voicecall *vc, +static void ste_hangup_active (struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data) {ste_template ("AT+CHUP" , vc, ste_generic_cb,0x3f , cb, data);
@@ -569,7 +569,7 @@ static struct ofono_voicecall_driver driver = { .remove = ste_voicecall_remove, .dial = ste_dial, .answer = ste_answer, - .hangup = ste_hangup, + .hangup_active = ste_hangup_active, .hold_all_active = ste_hold_all_active, .release_all_held = ste_release_all_held, .set_udub = ste_set_udub,
include/voicecall.h +5 -1
@@ -67,7 +67,11 @@ struct ofono_voicecall_driver { ofono_voicecall_cb_t cb, void *data);void (*answer)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data); -void (*hangup)(struct ofono_voicecall *vc, +/* HACK: for temporary backwards compatibility */ +#define hangup_all hangup +void (*hangup_all)(struct ofono_voicecall *vc, +ofono_voicecall_cb_t cb,void *data); +void (*hangup_active)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);void (*hold_all_active)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);
src/voicecall.c +61 -15
137 lines not on this page · raw message
Signature · 1 line
1.6.3.3
Hi Sjur,
Quoted 45 lines · Sjur Brændeland
From: Sjur Brændeland <[email protected]>
This patch fixes problem with terminating calls in state DIALING/ALERTING for STE-modem. The main change is that voicecall-callback function hangup is split into the functions
hangup_allandhangup_active.CHANGES:
include/voicecall.h:
o hangup is replaced withhangup_activeandhangup_all.
o As a tmp hack to provide backwards portability the previous hangup is defined tohangup_all
drivers/atmodem/voicecall.c:
ohangup_alluses ATH
ohangup_activeuses CHUP
drivers/stemodem/voicecall.c:
ohangup_activeuses CHUP whilehangup_allis not implemented.
src/voicecall.c:
o In cases where hangup previously was used,hangup_allis used if implemented otherwisehangup_activeis used.
o Call in state DIALING/ALERTING is released withhangup_activeif implemented.
omanager_hangup_allwill no longer release calls in state waiting.
omanager_hangup_allwill simply callhangup_allif implemented.
omanager_hangup_allwill release calls in state ALERTING/DIALING/INCOMING usinghangup_activeotherwiserelease_specific.--- drivers/atmodem/voicecall.c | 14 ++++++-- drivers/stemodem/voicecall.c | 4 +- include/voicecall.h | 6 +++- src/voicecall.c | 76 +++++++++++++++++++++++++++++++++-------- 4 files changed, 79 insertions(+), 21 deletions(-)drivers/atmodem/voicecall.c +1
-1@@ -406,10 +406,17 @@ static void at_answer(struct ofono_voicecall *vc,at_template ("ATA" , vc, generic_cb,0 , cb, data); } -static void at_hangup (struct ofono_voicecall *vc, +static void at_hangup_all (struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data)
drivers/atmodem/voicecall.c static void at_answer(struct ofono_voicecall *vc, · line 419
Quoted 10 lines
drivers/atmodem/voicecall.c +8
-1{ -/* Hangup all calls */ +/* Hangup all calls, except waiting */ +at_template ("ATH" , vc, generic_cb,0x3f , cb, data); +} + +static void at_hangup_active (struct ofono_voicecall *vc, +ofono_voicecall_cb_t cb,void *data) +{ +/* Hangup currently active call */
It might be safer to only implement hangup_active in the generic driver.
However, since this driver is only for testing anyway, the change is fine.
Quoted 40 lines
drivers/atmodem/voicecall.c +2
-1at_template ("AT+CHUP" , vc, generic_cb,0x3f , cb, data); }@@ -874,7 +881,8 @@ static struct ofono_voicecall_driver driver = { .remove = at_voicecall_remove, .dial = at_dial, .answer = at_answer, - .hangup = at_hangup, + .hangup_active = at_hangup_active, + .hangup_all = at_hangup_all, .hold_all_active = at_hold_all_active, .release_all_held = at_release_all_held, .set_udub = at_set_udub,drivers/stemodem/voicecall.c +2
-2@@ -260,7 +260,7 @@ static void ste_answer(struct ofono_voicecall *vc,ste_template ("ATA" , vc, ste_generic_cb,0 , cb, data); } -static void ste_hangup (struct ofono_voicecall *vc, +static void ste_hangup_active (struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data) {ste_template ("AT+CHUP" , vc, ste_generic_cb,0x3f , cb, data);@@ -569,7 +569,7 @@ static struct ofono_voicecall_driver driver = { .remove = ste_voicecall_remove, .dial = ste_dial, .answer = ste_answer, - .hangup = ste_hangup, + .hangup_active = ste_hangup_active, .hold_all_active = ste_hold_all_active, .release_all_held = ste_release_all_held, .set_udub = ste_set_udub,include/voicecall.h +0
-0
include/voicecall.h struct ofono_voicecall_driver { · line 74
Quoted 9 lines
include/voicecall.h +5
-1@@ -67,7 +67,11 @@ struct ofono_voicecall_driver { ofono_voicecall_cb_t cb, void *data);void (*answer)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data); - void (*hangup)(struct ofono_voicecall *vc, +/* HACK: for temporary backwards compatibility */ +#define hangup_all hangup +void (*hangup_all)(struct ofono_voicecall *vc, +ofono_voicecall_cb_t cb,void *data); + void (*hangup_active)(struct ofono_voicecall *vc,
We'll need to figure out how to migrate to the new driver API a bit more sanely.
Quoted 18 lines
include/voicecall.h +0
-0ofono_voicecall_cb_t cb, void *data);void (*hold_all_active)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);src/voicecall.c +2
-4@@ -261,15 +261,18 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,if (vc->pending)return __ofono_error_busy (msg); -/* According to various specs, other than 27.007, +CHUP is used -* to reject an incoming call -*/ if (call->status ==CALL_STATUS_INCOMING ) { -if (vc->driver->hangup ==NULL ) + + if (vc->driver->hangup_all == NULL &&
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 275
Quoted 10 lines
src/voicecall.c +6
-1+ vc->driver->hangup_active == NULL)return __ofono_error_not_implemented (msg); vc->pending =dbus_message_ref (msg); - vc->driver->hangup (vc, generic_callback, vc); + +if (vc->driver->hangup_all) + vc->driver->hangup_all (vc, generic_callback, vc); +else + vc->driver->hangup_active (vc, generic_callback, vc);
Looks good.
Quoted 4 lines
src/voicecall.c +0
-0return NULL ; }
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 297
Quoted 10 lines
src/voicecall.c +3
-1@@ -286,12 +289,19 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn, num_calls =g_slist_length (vc->call_list); -if (num_calls ==1 && vc->driver->hangup && +if (num_calls ==1 && + (vc->driver->hangup_all !=NULL || + vc->driver->hangup_active !=NULL ) && (call->status ==CALL_STATUS_ACTIVE || call->status ==CALL_STATUS_DIALING || call->status ==CALL_STATUS_ALERTING )) {
This if statement is getting a little out of hand, but I can take care of style issues later.
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 298
Quoted 1 line
src/voicecall.c +1
-0+
Don't need the empty line here.
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 275
Quoted 7 lines
src/voicecall.c +5
-1vc->pending =dbus_message_ref (msg); - vc->driver->hangup (vc, generic_callback, vc); + +if (vc->driver->hangup_all) + vc->driver->hangup_all (vc, generic_callback, vc); +else + vc->driver->hangup_active (vc, generic_callback, vc);
Looks good.
Quoted 6 lines
src/voicecall.c +0
-0return NULL ; }@@ -304,6 +314,15 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,return NULL ; }
src/voicecall.c static DBusMessage *voicecall_hangup(DBusConnection *conn, · line 325
Quoted 10 lines
src/voicecall.c +9
-0+if (vc->driver->hangup_active !=NULL && + (call->status ==CALL_STATUS_ALERTING || + call->status ==CALL_STATUS_DIALING )) { + vc->pending =dbus_message_ref (msg); + vc->driver->hangup_active (vc, generic_callback, vc); + +return NULL ; + } +
Looks good.
Quoted 11 lines
src/voicecall.c +1
-0if (vc->driver->release_specific ==NULL )return __ofono_error_not_implemented (msg);@@ -743,12 +762,18 @@ static void emit_multiparty_call_list_changed(struct ofono_voicecall *vc)static void voicecalls_release_queue (struct ofono_voicecall *vc,GSList *calls) {GSList *l; +struct voicecall *call;g_slist_free (vc->release_list); vc->release_list =NULL ;
src/voicecall.c static void emit_multiparty_call_list_changed(struct ofono_voicecall *vc) · line 776
Quoted 10 lines
src/voicecall.c +7
-2-for (l = calls; l; l = l->next) - vc->release_list =g_slist_prepend (vc->release_list, l->data); +for (l = calls; l; l = l->next) { + call = l->data; + +if (call->call->status !=CALL_STATUS_WAITING ) + vc->release_list = +g_slist_prepend (vc->release_list, call); + }
Actually I prefer this to be done in manager_hangup_all. This function is used by the multiparty release path which can never include waiting calls.
Quoted 7 lines
src/voicecall.c +0
-0}static void voicecalls_release_next (struct ofono_voicecall *vc)@@ -762,7 +787,14 @@ static void voicecalls_release_next(struct ofono_voicecall *vc) vc->release_list =g_slist_remove (vc->release_list, call);
src/voicecall.c static void voicecalls_release_next(struct ofono_voicecall *vc) · line 798
Quoted 10 lines
src/voicecall.c +8
-1- vc->driver->release_specific (vc, call->call->id, +if (vc->driver->hangup_active !=NULL && + (call->call->status ==CALL_STATUS_ALERTING || + call->call->status ==CALL_STATUS_DIALING || + call->call->status ==CALL_STATUS_INCOMING )) + + vc->driver->hangup_active (vc, multirelease_callback, vc); +else + vc->driver->release_specific (vc, call->call->id, multirelease_callback, vc);
Looks good.
src/voicecall.c static DBusMessage *manager_hangup_all(DBusConnection *conn, · line 1157
Quoted 11 lines
src/voicecall.c +3
-1}@@ -1119,7 +1151,9 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn,if (vc->pending)return __ofono_error_busy (msg); -if (!vc->driver->release_specific) +if (vc->driver->hangup_all ==NULL && + (vc->driver->release_specific ==NULL || + vc->driver->hangup_active ==NULL ))return __ofono_error_not_implemented (msg);
Looks good.
Quoted 5 lines
src/voicecall.c +0
-0if (vc->call_list ==NULL ) {@@ -1131,9 +1165,17 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn, vc->pending =dbus_message_ref (msg);
src/voicecall.c static DBusMessage *manager_hangup_all(DBusConnection *conn, · line 1174
Quoted 10 lines
src/voicecall.c +6
-2-voicecalls_release_queue (vc, vc->call_list); -voicecalls_release_next (vc); +if (vc->driver->hangup_all !=NULL ) + vc->driver->hangup_all (vc, generic_callback, vc); +/* In case of INCOMING call, assume we only have this one call */ +else if (voicecalls_have_incoming (vc) && + vc->driver->hangup_active !=NULL ) + vc->driver->hangup_active (vc, generic_callback, vc);
Now that I think about it, the else if clause is not needed. You take care of incoming calls with hangup_active in voicecalls_release_next. Right?
Quoted 9 lines
src/voicecall.c +4
-0+else { +voicecalls_release_queue (vc, vc->call_list); +voicecalls_release_next (vc); + }return NULL ; }@@ -1370,8 +1412,12 @@ static DBusMessage *multiparty_hangup(DBusConnection *conn,
src/voicecall.c static DBusMessage *multiparty_hangup(DBusConnection *conn, · line 1420
Quoted 10 lines
src/voicecall.c +6
-2/* Fall back to the old-fashioned way */ vc->flags |=VOICECALLS_FLAG_MULTI_RELEASE ; -voicecalls_release_queue (vc, vc->multiparty_list); -voicecalls_release_next (vc); +if (vc->driver->hangup_all !=NULL ) + vc->driver->hangup_all (vc, generic_callback, vc); +else { +voicecalls_release_queue (vc, vc->call_list); +voicecalls_release_next (vc); + }
This doesn't look right. If we get to this part then we either have waiting + active, waiting + held, waiting + active + held or active + held. Calling hangup_all would be all right for the first two cases, but not the other two.
For multiparty we need to fall back to release_specific. The original code was fine.
src/voicecall.c static DBusMessage *multiparty_hangup(DBusConnection *conn, · line 1423
Quoted 3 lines
src/voicecall.c +0
-0out:return NULL ;
Regards,
-Denis
Hi Denis.
...
Quoted 7 lines
drivers/atmodem/voicecall.c static void at_answer(struct ofono_voicecall *vc, · line 419
Quoted 4 lines
drivers/atmodem/voicecall.c +4
-0+static void at_hangup_active (struct ofono_voicecall *vc, + ofono_voicecall_cb_t cb, void *data) +{ + /* Hangup currently active call */It might be safer to only implement
hangup_activein the generic driver. However, since this driver is only for testing anyway, the change is fine.
Ok, I might change that then.
...
Quoted 8 lines
include/voicecall.h struct ofono_voicecall_driver { · line 74
Quoted 5 lines
include/voicecall.h +5
-0+/* HACK: for temporary backwards compatibility */ +#define hangup_all hangup + void (*hangup_all)(struct ofono_voicecall *vc, + ofono_voicecall_cb_t cb, void *data); + void (*hangup_active)(struct ofono_voicecall *vc,We'll need to figure out how to migrate to the new driver API a bit more sanely.
Should we s/hangup/hangup_active in all drivers and skip this hack then? Or did you have something else in mind?
....
Quoted 18 lines
static void
voicecalls_release_queue(struct ofono_voicecall *vc, GSList *calls)Quoted 7 lines
{
GSList *l;
+ struct voicecall *call;
g_slist_free(vc->release_list);
vc->release_list= NULL;Quoted 9 lines
- for (l = calls; l; l =
l->next)
-vc->release_list=g_slist_prepend(vc->release_list, l->data);
+ for (l = calls; l; l =l->next) {
+ call =l->data;
+
+ if (call->call->status!=CALL_STATUS_WAITING)
+vc->release_list=
+g_slist_prepend(vc->release_list, call);
+ }
Quoted 3 lines
Actually I prefer this to be done in
manager_hangup_all. This function is used by the multiparty release path which can never include waiting calls.
OK, I'll look into that.
...
Quoted 9 lines
Quoted 9 lines
src/voicecall.c +2
-2@@ -1131,9 +1165,17 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn, vc->pending = dbus_message_ref(msg); - voicecalls_release_queue(vc, vc->call_list); - voicecalls_release_next(vc); + if (vc->driver->hangup_all != NULL) + vc->driver->hangup_all(vc, generic_callback, vc);
Quoted 8 lines
src/voicecall.c static DBusMessage *manager_hangup_all(DBusConnection *conn, · line 1174
Quoted 4 lines
src/voicecall.c +4
-0+ /* In case of INCOMING call, assume we only have this one call */ + else if (voicecalls_have_incoming(vc) && + vc->driver->hangup_active != NULL) + vc->driver->hangup_active(vc, generic_callback, vc);Now that I think about it, the else if clause is not needed. You take care of incoming calls with
hangup_activeinvoicecalls_release_next. Right?
Yes, agree.
...
Quoted 18 lines
src/voicecall.c static DBusMessage *multiparty_hangup(DBusConnection *conn, · line 1420
Quoted 12 lines
src/voicecall.c +6
-2@@ -1370,8 +1412,12 @@ static DBusMessage *multiparty_hangup(DBusConnection *conn, /* Fall back to the old-fashioned way */ vc->flags |= VOICECALLS_FLAG_MULTI_RELEASE; - voicecalls_release_queue(vc, vc->multiparty_list); - voicecalls_release_next(vc); + if (vc->driver->hangup_all != NULL) + vc->driver->hangup_all(vc, generic_callback, vc); + else { + voicecalls_release_queue(vc, vc->call_list); + voicecalls_release_next(vc); + }This doesn't look right. If we get to this part then we either have waiting + active, waiting + held, waiting + active + held or active + held. Calling
hangup_allwould be all right for the first two cases, but not the other two.
Quoted 2 lines
For multiparty we need to fall back to
release_specific. The original code was fine.
OK, I'll revert this.
How do we proceede with this change. I am very happy if you carry on from here, or would you like me to to submit a patch-set with these changes, including s/hangup/hangup_active in drivers/*/voicecall.c?
Regards
Sjur
Hi Sjur,
Quoted 11 lines
Quoted 8 lines
include/voicecall.h struct ofono_voicecall_driver { · line 74
Quoted 5 lines
include/voicecall.h +5
-0+/* HACK: for temporary backwards compatibility */ +#define hangup_all hangup +void (*hangup_all)(struct ofono_voicecall *vc, +ofono_voicecall_cb_t cb,void *data); + void (*hangup_active)(struct ofono_voicecall *vc,We'll need to figure out how to migrate to the new driver API a bit more sanely.
Should we s/hangup/hangup_active in all drivers and skip this hack then? Or did you have something else in mind?
That sounds good. Break this up into two patches, one renaming hangup to hangup_active and the second one introducing hangup_all.
Quoted 4 lines
How do we proceede with this change. I am very happy if you carry on from here, or would you like me to to submit a patch-set with these changes, including s/hangup/hangup_active in
drivers/*/voicecall.c?
Go ahead and re-submit the fixed up patch set and I will take care of the rest.
Regards,
-Denis