MMCall objects from CallAdded signal
Aleksander Morgado
aleksander at aleksander.es
Tue Jul 17 19:47:38 UTC 2018
Hey Bob,
I would totally suggest you play with this branch instead of master:
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/tree/aleksander/voice-fixes
In git master the implementation lacks several things in the voice
call management logic and some others are very tied to the original
implementation for Huawei devices. That new branch I'm pointing you to
contains a lot of fixes for a generic modem implementation, as well as
specific improvements for u-blox devices. I've tested the generic
implementation myself doing voice calls just some weeks ago.
> I'm trying to use voice calls with the libmm-glib API but having trouble
> figuring out how to get an MMCall object when a new call is added.
>
> When my application starts up, it lists existing calls using
> mm_modem_voice_list_calls(). This apparently gives me a list of MMCall
> objects, which is what I want.
>
Yes. mm_modem_voice_list_calls() returns the list of currently
existing calls. This just returns the list of existing call objects in
ModemManager, nothing else, so if your app starts along with MM on
boot you won't see any call object (they're not "loaded" or "stored"
anywhere). That API was designed to be close to what we do with
Messaging/SMS, where it makes more sense (as SMS messages are stored
somewhere).
> I also want to set a signal on something that will give me an MMCall
> object when a new call is created. There is the "call-added" signal on
> the MmGdbusModemVoice interface, which MMModemVoice implements.
> However, this signal only provides a D-Bus object path as an argument
> and I can't find a way to create an MMCall object from a D-Bus object path.
>
Yes, for "watching" new calls being added, you can connect to the
"call-added" signal in the MMModemVoice interface-specific object.
Once you have the path to the call object, you can list existing calls
with mm_modem_voice_list_calls() and get a MMCall when the path
matches. I see this is not ideal indeed, there should be a
"mm_call_new()" method where you can give the path of the DBus object,
as that is something you already have, or even better a more specific
signal that returns a MMCall instead of the path. Totally open to
suggestions here.
That approach above is what we do in mmcli for operations on call
objects, we end up listing all call objects in the modem and match by
path, see e.g.:
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/blob/master/cli/mmcli-common.c#L1261
> I've looked for any code that uses the API to deal with added calls but
> I can't find anything. The generated libmm-glib objects are less than
> clear.
>
They are a bit unclear in that regard, I agree.
> Can anyone tell me whether there is any way to use the API to get MMCall
> objects for added calls?
>
Right now mm_modem_voice_list_calls() and match by path is the only
way. We do need to extend the API, definitely. Could be a quick change
actually.
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list