huawei: handle voice call state changes
This commit is contained in:

committed by
Aleksander Morgado

parent
5a281dbd34
commit
55ae2c7f2f
@@ -2871,10 +2871,10 @@ huawei_voice_origination (MMPortSerialAt *port,
|
|||||||
if (!mm_get_uint_from_match_info (match_info, 2, &call_type))
|
if (!mm_get_uint_from_match_info (match_info, 2, &call_type))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mm_dbg ("[%s:%d][^ORIG] Origination call id '%u' of type '%u'", __func__, __LINE__, call_x, call_type);
|
mm_dbg ("[%s:%d][^ORIG] Origination call id '%u' of type '%u'", __func__, __LINE__, call_x, call_type); //Entrambi
|
||||||
|
|
||||||
//TODO: Handle this event
|
//TODO: Handle multiple calls
|
||||||
//mm_iface_modem_voice_xxx (MM_IFACE_MODEM (self), ...);
|
//mm_iface_modem_voice_set_call_id(MM_IFACE_MODEM_VOICE(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2889,8 +2889,7 @@ huawei_voice_ringback_tone (MMPortSerialAt *port,
|
|||||||
|
|
||||||
mm_dbg ("[%s:%d][^CONF] Ringback tone from call id '%u'", __func__, __LINE__, call_x);
|
mm_dbg ("[%s:%d][^CONF] Ringback tone from call id '%u'", __func__, __LINE__, call_x);
|
||||||
|
|
||||||
//TODO: Handle this event
|
mm_iface_modem_voice_call_dialing_to_ringing(MM_IFACE_MODEM_VOICE(self));
|
||||||
//mm_iface_modem_voice_xxx (MM_IFACE_MODEM (self), ...);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2909,8 +2908,7 @@ huawei_voice_call_connection (MMPortSerialAt *port,
|
|||||||
|
|
||||||
mm_dbg ("[%s:%d][^CONN] Call id '%u' of type '%u' connected", __func__, __LINE__, call_x, call_type);
|
mm_dbg ("[%s:%d][^CONN] Call id '%u' of type '%u' connected", __func__, __LINE__, call_x, call_type);
|
||||||
|
|
||||||
//TODO: Handle this event
|
mm_iface_modem_voice_call_ringing_to_active(MM_IFACE_MODEM_VOICE(self));
|
||||||
//mm_iface_modem_voice_xxx (MM_IFACE_MODEM (self), ...);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2937,8 +2935,7 @@ huawei_voice_call_end (MMPortSerialAt *port,
|
|||||||
|
|
||||||
mm_dbg ("[%s:%d][^CEND] Call '%u' terminated with status '%u' and cause '%u'. Duration of call '%d'", __func__, __LINE__, call_x, end_status, cc_cause, duration);
|
mm_dbg ("[%s:%d][^CEND] Call '%u' terminated with status '%u' and cause '%u'. Duration of call '%d'", __func__, __LINE__, call_x, end_status, cc_cause, duration);
|
||||||
|
|
||||||
//TODO: Handle this event
|
mm_iface_modem_voice_network_hangup(MM_IFACE_MODEM_VOICE(self));
|
||||||
//mm_iface_modem_voice_xxx (MM_IFACE_MODEM (self), ...);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -114,6 +114,58 @@ MMBaseCall* mm_call_list_get_new_incoming(MMCallList *self)
|
|||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MMBaseCall* mm_call_list_get_first_ringing_call(MMCallList *self)
|
||||||
|
{
|
||||||
|
MMBaseCall *call = NULL;
|
||||||
|
GList *l;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) {
|
||||||
|
|
||||||
|
MMCallState state;
|
||||||
|
|
||||||
|
g_object_get (MM_BASE_CALL (l->data),
|
||||||
|
"state" , &state,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if( state == MM_CALL_STATE_RINGING_IN ||
|
||||||
|
state == MM_CALL_STATE_RINGING_OUT ) {
|
||||||
|
|
||||||
|
call = MM_BASE_CALL (l->data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
|
||||||
|
MMBaseCall* mm_call_list_get_first_outgoing_dialing_call(MMCallList *self)
|
||||||
|
{
|
||||||
|
MMBaseCall *call = NULL;
|
||||||
|
GList *l;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) {
|
||||||
|
|
||||||
|
MMCallState state;
|
||||||
|
MMCallDirection direct;
|
||||||
|
|
||||||
|
g_object_get (MM_BASE_CALL (l->data),
|
||||||
|
"state" , &state,
|
||||||
|
"direction" , &direct,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if( direct == MM_CALL_DIRECTION_OUTGOING &&
|
||||||
|
state == MM_CALL_STATE_DIALING ) {
|
||||||
|
|
||||||
|
call = MM_BASE_CALL (l->data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return call;
|
||||||
|
}
|
||||||
|
|
||||||
MMBaseCall* mm_call_list_get_first_non_terminated_call(MMCallList *self)
|
MMBaseCall* mm_call_list_get_first_non_terminated_call(MMCallList *self)
|
||||||
{
|
{
|
||||||
MMBaseCall *call = NULL;
|
MMBaseCall *call = NULL;
|
||||||
@@ -123,13 +175,9 @@ MMBaseCall* mm_call_list_get_first_non_terminated_call(MMCallList *self)
|
|||||||
for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) {
|
for (i = 0, l = self->priv->list; l && !call; l = g_list_next (l)) {
|
||||||
|
|
||||||
MMCallState state;
|
MMCallState state;
|
||||||
MMCallStateReason reason;
|
|
||||||
MMCallDirection direct;
|
|
||||||
|
|
||||||
g_object_get (MM_BASE_CALL (l->data),
|
g_object_get (MM_BASE_CALL (l->data),
|
||||||
"state" , &state,
|
"state" , &state,
|
||||||
"state-reason", &reason,
|
|
||||||
"direction" , &direct,
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if( state != MM_CALL_STATE_TERMINATED ) {
|
if( state != MM_CALL_STATE_TERMINATED ) {
|
||||||
|
@@ -73,6 +73,8 @@ gboolean mm_call_list_delete_call_finish (MMCallList *self,
|
|||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
MMBaseCall* mm_call_list_get_new_incoming (MMCallList *self);
|
MMBaseCall* mm_call_list_get_new_incoming (MMCallList *self);
|
||||||
|
MMBaseCall* mm_call_list_get_first_ringing_call (MMCallList *self);
|
||||||
|
MMBaseCall* mm_call_list_get_first_outgoing_dialing_call(MMCallList *self);
|
||||||
MMBaseCall* mm_call_list_get_first_non_terminated_call (MMCallList *self);
|
MMBaseCall* mm_call_list_get_first_non_terminated_call (MMCallList *self);
|
||||||
|
|
||||||
#endif /* MM_CALL_LIST_H */
|
#endif /* MM_CALL_LIST_H */
|
||||||
|
@@ -118,6 +118,56 @@ gboolean mm_iface_modem_voice_update_incoming_call_number (MMIfaceModemVoice *se
|
|||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean mm_iface_modem_voice_call_dialing_to_ringing(MMIfaceModemVoice *self)
|
||||||
|
{
|
||||||
|
gboolean updated = FALSE;
|
||||||
|
MMBaseCall *call = NULL;
|
||||||
|
MMCallList *list = NULL;
|
||||||
|
|
||||||
|
g_object_get (MM_BASE_MODEM (self),
|
||||||
|
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if( list ) {
|
||||||
|
|
||||||
|
call = mm_call_list_get_first_outgoing_dialing_call(list);
|
||||||
|
if( call ) {
|
||||||
|
mm_base_call_change_state(call, MM_CALL_STATE_RINGING_OUT, MM_CALL_STATE_REASON_OUTGOING_STARTED);
|
||||||
|
|
||||||
|
updated = TRUE;
|
||||||
|
} else {
|
||||||
|
mm_dbg("[%s:%d] Incoming call does not exist yet", __func__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean mm_iface_modem_voice_call_ringing_to_active(MMIfaceModemVoice *self)
|
||||||
|
{
|
||||||
|
gboolean updated = FALSE;
|
||||||
|
MMBaseCall *call = NULL;
|
||||||
|
MMCallList *list = NULL;
|
||||||
|
|
||||||
|
g_object_get (MM_BASE_MODEM (self),
|
||||||
|
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if( list ) {
|
||||||
|
|
||||||
|
call = mm_call_list_get_first_ringing_call(list);
|
||||||
|
if( call ) {
|
||||||
|
mm_base_call_change_state(call, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
|
||||||
|
|
||||||
|
updated = TRUE;
|
||||||
|
} else {
|
||||||
|
mm_dbg("[%s:%d] Incoming call does not exist yet", __func__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self)
|
gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self)
|
||||||
{
|
{
|
||||||
gboolean updated = FALSE;
|
gboolean updated = FALSE;
|
||||||
@@ -132,17 +182,9 @@ gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self)
|
|||||||
|
|
||||||
call = mm_call_list_get_first_non_terminated_call(list);
|
call = mm_call_list_get_first_non_terminated_call(list);
|
||||||
if( call ) {
|
if( call ) {
|
||||||
//BASCETTA:TODO: Hang this call!
|
mm_base_call_change_state(call, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_TERMINATED);
|
||||||
g_object_set (call,
|
|
||||||
"state", MM_CALL_STATE_TERMINATED,
|
|
||||||
"state-reason", MM_CALL_STATE_REASON_TERMINATED,
|
|
||||||
NULL);
|
|
||||||
mm_gdbus_call_set_state(MM_GDBUS_CALL (call), MM_CALL_STATE_TERMINATED);
|
|
||||||
mm_gdbus_call_set_state_reason(MM_GDBUS_CALL (call), MM_CALL_STATE_REASON_TERMINATED);
|
|
||||||
updated = TRUE;
|
updated = TRUE;
|
||||||
|
|
||||||
//BASCETTA:TODO: I have to signal state change...
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mm_dbg("[%s:%d] Incoming call does not exist yet", __func__, __LINE__);
|
mm_dbg("[%s:%d] Incoming call does not exist yet", __func__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@@ -123,6 +123,8 @@ gboolean mm_iface_modem_voice_update_incoming_call_number (MMIfaceModemVoi
|
|||||||
gchar *number,
|
gchar *number,
|
||||||
guint type,
|
guint type,
|
||||||
guint validity);
|
guint validity);
|
||||||
|
gboolean mm_iface_modem_voice_call_dialing_to_ringing (MMIfaceModemVoice *self);
|
||||||
|
gboolean mm_iface_modem_voice_call_ringing_to_active (MMIfaceModemVoice *self);
|
||||||
gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self);
|
gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self);
|
||||||
|
|
||||||
/* Look for a new valid multipart reference */
|
/* Look for a new valid multipart reference */
|
||||||
|
Reference in New Issue
Block a user