media: do not send invite response prematurely
commit9f22fcf080c77bb5575034b3dbd87da6cab6e33d
authorJakub Adam <jakub.adam@ktknet.cz>
Thu, 21 Oct 2010 21:21:28 +0000 (21 23:21 +0200)
committerJakub Adam <jakub.adam@ktknet.cz>
Thu, 21 Oct 2010 21:24:42 +0000 (21 23:24 +0200)
tree97085386cc8af53bc4059aab38def9ddc2827e29
parent81db9caf5a96ed34f4263775b36bd45e2c17e8aa
media: do not send invite response prematurely

Previous code relied on assumption that on incoming call, local codecs
will be prepared before user starts the call by pressing 'Accept' button,
which is not always true. In such situation list of all available codecs
was sent in invite response, including those unsupported by remote
side. Call was then aborted because of unsupported media.

Let client send invite response only after both conditions are met -
codecs prepared and call accepted by user, regardless which of the
events comes first.

New code uncovered that PurpleMedia should not be unreferenced
in sipe_backend_media_free() as purple does this internally in
purple_media_end() function which is also called on call hangup.
src/api/sipe-backend.h
src/core/sipe-media.c
src/purple/purple-media.c