IncomingJingleSession state and packet listening

Hi all,

Before all, a great thanks to developpers of the smack and smackxs API

I’'m working for adding jingle support to an IM software and I have the following problem :

When an user A call an user B

on the user B side, I accept the session (JingleSessionRequest.accept() )

After that, I see that the newly created IncomingJingleSession state’'s is null.

The session state’'s will switch to “accepting” only after a JingleSession.start().

But, if user A cancel his call between the accept() and the start() on the user B side,

user B will not receives any notification. No event will be triggered because the PacketListener

for the session are installed only in the “accepting” state in wich we go only after start().

It is then possible fot user B to start() a session which has been already terminate()d

by user A. I feel like this behaviour is some how inconsistant.

The scenario

A : createOutgoingJingleSession(B)

B: accept()

A : terminate() // on the B side, we receive a jingle iq with “session-terminate” , but this isn’'t processed by Jingle

B: start() // B IncomingJingleSession’'s will switch from “null” to “accepting” to “pending”

and will indefinitly stay in “pending” state. The PacketListener is now installed, but it is

too late because we have lost “session-terminated”.

I am not sure that it is really a “bug”, perhaps I’'m wrong. But I have found a way to solve this :

switch the IncomingJingleSession state’'s to “accepting” and do an updatePacketListener()

after the call to accept() rather than start().

I have done that change my moving 2 lines of code in IncomingJingleSession and tested. After that, It’'s seems

to work well now.

the small diff betwen the old and the new file

132a133,136

> // Establish the default state

> setState(accepting);

>

> updatePacketListener();

158,161d161

< // Establish the default state

< setState(accepting);

<

< updatePacketListener();

If someone have understood something (I hope my english is comprehensible),

I will happy to know what your thinking about it.

regards.