Re: Telephone API question - answering a call.

2010-02-06 Thread Edward Page
On Wed, Jan 27, 2010 at 3:52 AM,   wrote:
> On 27 Jan 2010, Dave Neary wrote:
>>Matan Ziv-Av wrote:
>>> how do I answer an incoming call from a C program (or command line, or a
>>> python program, for that matter)?
> btw, I'd recommend using Telepathy for calls and messaging.
> CSD is cellular specific, while with using Telepathy you can cover
> both cellular and VoIP calls in your application. To start:
>
> http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Architecture/RTCOM
> http://telepathy.freedesktop.org/wiki/
>
> Of course, some apps may still want to use CSD directly (for
> whatever reasons), but one should be aware it's an internal
> platform API in Maemo5 that may e.g. be refactored at some point.
> Not necessarily a problem for all applications, but just so you
> folks know...

I previously posted the theory in how to answer a call.  I've now got
this codified ... just not working

git clone https://vcs.maemo.org/git/theonering
theonering/hand_tests/dbus_signals.py
or
https://garage.maemo.org/plugins/ggit/browse.php/?p=theonering;a=blob;f=hand_tests/dbus_signals.py;h=d80ba2f3c2c2d4518dab2252e535a2b4d12e76b7;hb=19d650012308b89c7e15135fb849c6ca9f02ce99

This code
1. Listens on DBus for new channels (NewChannelSignaller)
2. Creates telepathy-python objects out of the new channel and its
connection (NewChannelSignaller)
3. Filters out all channels except StreamedMedia (Manager)
4. Requests various data needed for Step 5 (AutoAcceptCall)
5. Judge whether it is an inbound or outbound call (AutoAcceptCall and Manager)
6. Add all the pending users to the call  (AutoAcceptCall and Manager)

Step 6 should be what answers the call according to
http://telepathy.freedesktop.org/spec/org.freedesktop.Telepathy.Channel.Type.StreamedMedia.html
I've played with dbus-monitor.  All 6 steps execute correctly, it just
doesn't cause anything to happen.  This was tested with SIP calls on
Empathy 2.26.

I'm probably going to take another break from working on this.  What
I've got working so far can help me resolve one issue (poll for new GV
voicemails after the user rejects/ignores a call) but not another
(auto-accept GV callbacks).  I don't know if this is still relevant
for anyone but I thought I'd at least share.

Ed Page
(epage)
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Telephone API question - answering a call.

2010-01-27 Thread Edward Page
This is something I'm also very interested in.  With The One Ring (a
GV plugin for RTComm) there is a usability issue that could be solved
by auto-pick up of calls.  Unfortunately I'm busy with lower level
details at the moment and don't have the time to look into it.

I'm unsure how much experience you have with telepathy but I thought
I'd write down some theory and suggestions to get you on the right
track.

On an incoming call, the "Connection Manager" (Sofia == SIP, Spirit ==
Skype, can't remember the name of GSM's) creates a DBus object called
a StreamedMedia channel.  This channel also implements an interface
for Group which allows multiple contacts (yourself being one of them)
to be associated with it with waiting lists for being accepted into
the channel.

See
http://telepathy.freedesktop.org/spec/
http://telepathy.freedesktop.org/spec/org.freedesktop.Telepathy.Channel.html
http://telepathy.freedesktop.org/spec/org.freedesktop.Telepathy.Channel.Type.StreamedMedia.html
http://telepathy.freedesktop.org/spec/org.freedesktop.Telepathy.Channel.Interface.Group.html

It seems they are drafting a new channel type and interfaces for this,
so I don't know how long this will be relevant (at least for Maemo 5 I
would guess)
http://telepathy.freedesktop.org/spec/org.freedesktop.Telepathy.Channel.Type.Call.DRAFT.html

In my repo I have a hand test which gives examples on how to be a
client, to be the one making calls
https://garage.maemo.org/plugins/ggit/browse.php/?p=theonering;a=blob;f=hand_tests/generic.py;h=3d83a79e7d1630b1fc38b47490bb7c0abd1ac918;hb=bc1000e7265476c358100a19fe554ff2a1a00d315e2e

My guess is you would need to monitor for the NewChannel signal from
the Connection
http://telepathy.freedesktop.org/spec/org.freedesktop.Telepathy.Connection.html

This will give you notification of dbus objects including their object
path and their channel type (if Streamed Media).  For your to
programmatically determine who initiated the call and to pick up, I
recommend this part of the Streamed Media spec

"""
Incoming calls should be signalled as TargetHandleType  = Contact,
TargetHandle  set to the remote contact, with the local user in
LocalPendingMembers; to accept the call, AddMembers  can be used to
move the local user to the group's members.

When the local user accepts an incoming call, the connection manager
SHOULD change the direction of any streams with pending local send to
be sending, without altering whether those streams are receiving.

This matches existing practice, and means that a client can answer
incoming calls and get an unmuted microphone/activated webcam without
having to take additional action to accept the stream directions.
"""

I hope this at least gets you in the right direction if you weren't
there already.
Ed Page
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Telephone API question - answering a call.

2010-01-27 Thread daniel wilms

ext Anderson Lizardo wrote:

While at it:

* The link above is not under the "Python" category, and is not linked
from the Upper "DBus" page.
* The title is incorrect (fremantle vs. freemantle)

Ok, I know "it's a wiki" motto :), but I want to ask first: isn't
better to move this content to a Python specific location, e.g.
http://wiki.maemo.org/PyMaemo ?
  
+1, as it contains no further description and as it is more an example 
than a proper part of the developer documentation, I would as well go 
for a Python specific location like PyMaemo.


Daniel
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Telephone API question - answering a call.

2010-01-27 Thread Anderson Lizardo
Hi,

On Wed, Jan 27, 2010 at 5:07 AM, Dave Neary  wrote:
> You can see a Python example for listening to a DBus signal with Python
> here:
>
> http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/DBus/DBus_in_Freemantle

While at it:

* The link above is not under the "Python" category, and is not linked
from the Upper "DBus" page.
* The title is incorrect (fremantle vs. freemantle)

Ok, I know "it's a wiki" motto :), but I want to ask first: isn't
better to move this content to a Python specific location, e.g.
http://wiki.maemo.org/PyMaemo ?

Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Telephone API question - answering a call.

2010-01-27 Thread Johan Hedberg
Hi,

On Wed, Jan 27, 2010, Dave Neary wrote:
> This page:
> https://garage.maemo.org/plugins/wiki/index.php?com.nokia.csd.Call&id=1106&type=g
> 
> has a link to this file at the top:
> http://www.bleb.org/software/maemo/telephony-maemo.c

I'm not sure which version of the BlueZ maemo telephony driver has been
copied to that location, but it's better to refer to the very latest
version in BlueZ git as the file has seen many bug fixes during its
lifetime:

http://git.kernel.org/?p=bluetooth/bluez.git;a=blob_plain;f=audio/telephony-maemo.c;hb=HEAD

However, the answer_call function that was quoted is at least still the
same.

Johan
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Telephone API question - answering a call.

2010-01-27 Thread Dave Neary
Hi,

Matan Ziv-Av wrote:
> On Wed, 27 Jan 2010, Dave Neary wrote:
>> And here:
>> https://garage.maemo.org/plugins/wiki/index.php?CSD%20programming%20information&id=1106&type=g
> 
> This does not include answering a call.

I didn't realise you needed any more than this.

This page:
https://garage.maemo.org/plugins/wiki/index.php?com.nokia.csd.Call&id=1106&type=g

has a link to this file at the top:
http://www.bleb.org/software/maemo/telephony-maemo.c

which contains this code snippet:

static int answer_call(struct csd_call *call)
{
DBusMessage *msg;

msg = dbus_message_new_method_call(CSD_CALL_BUS_NAME,
call->object_path,
CSD_CALL_INSTANCE,
"Answer");
if (!msg) {
error("Unable to allocate new D-Bus message");
return -ENOMEM;
}

g_dbus_send_message(connection, msg);

return 0;
}

and you get the csd_call object by listening for the "Coming" signal as
you can see from the code snippet which is linked to in this page, and
then searching for calls with the "COMING" status:

>> http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/DBus/DBus_in_Freemantle

Which I found out in about 15 minutes, reading the links I gave you.

Is this OK now?

Cheers,
Dave.

-- 
maemo.org docsmaster
Email: dne...@maemo.org
Jabber: bo...@jabber.org

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Telephone API question - answering a call.

2010-01-27 Thread Aki Niemi
ti, 2010-01-26 kello 19:12 +0100, ext Matan Ziv-Av kirjoitti:
> how do I answer an incoming call from a C program (or command line, or a 
> python program, for that matter)?

One option is to try using oFono. There are some examples using python
under test/ in:

http://git.kernel.org/?p=network/ofono/ofono.git;a=summary

Cheers,
Aki




___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Telephone API question - answering a call.

2010-01-27 Thread Kai.Vehmanen
Hi,

On 27 Jan 2010, Dave Neary wrote:
>Matan Ziv-Av wrote:
>> how do I answer an incoming call from a C program (or command line, or a
>> python program, for that matter)?
>
>The phone DBus API is documented here:
>http://wiki.maemo.org/Phone_control
[...]
>And here:
>https://garage.maemo.org/plugins/wiki/index.php?CSD%20programming%20information&id=1106&type=g

btw, I'd recommend using Telepathy for calls and messaging.
CSD is cellular specific, while with using Telepathy you can cover
both cellular and VoIP calls in your application. To start:

http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Architecture/RTCOM
http://telepathy.freedesktop.org/wiki/

Of course, some apps may still want to use CSD directly (for
whatever reasons), but one should be aware it's an internal
platform API in Maemo5 that may e.g. be refactored at some point. 
Not necessarily a problem for all applications, but just so you 
folks know...

PS As for Matan's original question, sorry, I don't know
   the current Telepathy interfaces well enough to give
   you more specific pointers.

br,
-- 
first.surn...@nokia.com (Kai Vehmanen)

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Telephone API question - answering a call.

2010-01-27 Thread Matan Ziv-Av

On Wed, 27 Jan 2010, Dave Neary wrote:


Hi Matan,

The phone DBus API is documented here:
http://wiki.maemo.org/Phone_control


This does not include answering a call.


And here:
https://garage.maemo.org/plugins/wiki/index.php?CSD%20programming%20information&id=1106&type=g


This does not include answering a call.


You can see a Python example for listening to a DBus signal with Python
here:

http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/DBus/DBus_in_Freemantle


This does not include answering a call.



--
Matan Ziv-Av. ma...@svgalib.org


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Telephone API question - answering a call.

2010-01-27 Thread Dave Neary
Hi Matan,

The phone DBus API is documented here:
http://wiki.maemo.org/Phone_control

And here:
https://garage.maemo.org/plugins/wiki/index.php?CSD%20programming%20information&id=1106&type=g

You can see a Python example for listening to a DBus signal with Python
here:

http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/DBus/DBus_in_Freemantle

Cheers,
Dave.

Matan Ziv-Av wrote:
> 
> Hello,
> 
> how do I answer an incoming call from a C program (or command line, or a
> python program, for that matter)?
> 
> 

-- 
maemo.org docsmaster
Email: dne...@maemo.org
Jabber: bo...@jabber.org

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Telephone API question - answering a call.

2010-01-26 Thread Matan Ziv-Av


Hello,

how do I answer an incoming call from a C program (or command line, or a 
python program, for that matter)?



--
Matan Ziv-Av. ma...@svgalib.org


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers