mirror of git://git.sysmocom.de/ofono
voicecall: expand synthesize_outgoing_call
synthethize_outgoing_call was only used once from dial_handle_result. So move all the logic of registering the call to D-Bus and adding it to the voicecalls list to that function. This will allow synthethize_outgoing_call to be used from other callbacks where the dial callback is guaranteed to return before any call state notifications, e.g. in the case of +BLDN.
This commit is contained in:
parent
b26abc8f78
commit
3b951d20f4
|
@ -1354,15 +1354,16 @@ static ofono_bool_t clir_string_to_clir(const char *clirstr,
|
|||
}
|
||||
}
|
||||
|
||||
static struct ofono_call *synthesize_outgoing_call(struct ofono_voicecall *vc,
|
||||
static struct voicecall *synthesize_outgoing_call(struct ofono_voicecall *vc,
|
||||
const char *number)
|
||||
{
|
||||
struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
|
||||
struct ofono_call *call;
|
||||
struct voicecall *v;
|
||||
|
||||
call = g_try_new0(struct ofono_call, 1);
|
||||
if (call == NULL)
|
||||
return call;
|
||||
return NULL;
|
||||
|
||||
call->id = __ofono_modem_callid_next(modem);
|
||||
|
||||
|
@ -1381,7 +1382,20 @@ static struct ofono_call *synthesize_outgoing_call(struct ofono_voicecall *vc,
|
|||
call->status = CALL_STATUS_DIALING;
|
||||
call->clip_validity = CLIP_VALIDITY_VALID;
|
||||
|
||||
return call;
|
||||
v = voicecall_create(vc, call);
|
||||
if (v == NULL) {
|
||||
g_free(call);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v->detect_time = time(NULL);
|
||||
|
||||
DBG("Registering new call: %d", call->id);
|
||||
voicecall_dbus_register(v);
|
||||
|
||||
vc->call_list = g_slist_insert_sorted(vc->call_list, v, call_compare);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static struct voicecall *dial_handle_result(struct ofono_voicecall *vc,
|
||||
|
@ -1391,7 +1405,6 @@ static struct voicecall *dial_handle_result(struct ofono_voicecall *vc,
|
|||
{
|
||||
GSList *l;
|
||||
struct voicecall *v;
|
||||
struct ofono_call *call;
|
||||
|
||||
*need_to_emit = FALSE;
|
||||
|
||||
|
@ -1424,22 +1437,10 @@ static struct voicecall *dial_handle_result(struct ofono_voicecall *vc,
|
|||
goto handled;
|
||||
}
|
||||
|
||||
call = synthesize_outgoing_call(vc, number);
|
||||
if (call == NULL)
|
||||
v = synthesize_outgoing_call(vc, number);
|
||||
if (!v)
|
||||
return NULL;
|
||||
|
||||
v = voicecall_create(vc, call);
|
||||
if (v == NULL)
|
||||
return NULL;
|
||||
|
||||
v->detect_time = time(NULL);
|
||||
|
||||
DBG("Registering new call: %d", call->id);
|
||||
voicecall_dbus_register(v);
|
||||
|
||||
vc->call_list = g_slist_insert_sorted(vc->call_list, v,
|
||||
call_compare);
|
||||
|
||||
*need_to_emit = TRUE;
|
||||
|
||||
handled:
|
||||
|
|
Loading…
Reference in New Issue