]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip: Handle deferred SDP hold/unhold properly. 36/2536/1
authorMark Michelson <mmichelson@digium.com>
Tue, 5 Apr 2016 19:23:35 +0000 (14:23 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 5 Apr 2016 21:15:07 +0000 (16:15 -0500)
commit4b87a773dc926d07af160e8061dec6a2fdc30e3f
treeb14ea2311f1b72b8b268f9b6babb36323ed8a9f3
parentc29e2e3fb7b3b63bb76942ac75844070b7bff037
res_pjsip: Handle deferred SDP hold/unhold properly.

Some SIP devices indicate hold/unhold using deferred SDP reinvites. In
other words, they provide no SDP in the reinvite.

A typical transaction that starts hold might look something like this:

* Device sends reinvite with no SDP
* Asterisk sends 200 OK with SDP indicating sendrecv on streams.
* Device sends ACK with SDP indicating sendonly on streams.

At this point, PJMedia's SDP negotiator saves Asterisk's local state as
being recvonly.

Now, when the device attempts to unhold, it again uses a deferred SDP
reinvite, so we end up doing the following:

* Device sends reinvite with no SDP
* Asterisk sends 200 OK with SDP indicating recvonly on streams
* Device sends ACK with SDP indicating sendonly on streams

The problem here is that Asterisk offered recvonly, and by RFC 3264's
rules, if an offer is recvonly, the answer has to be sendonly. The
result is that the device is not taken off hold.

What is supposed to happen is that Asterisk should indicate sendrecv in
the 200 OK that it sends. This way, the device has the freedom to
indicate sendrecv if it wants the stream taken off hold, or it can
continue to respond with sendonly if the purpose of the reinvite was
something else (like a session timer refresher).

The fix here is to alter the SDP negotiator's state when we receive a
reinvite with no SDP. If the negotiator's state is currently in the
recvonly or inactive state, then we alter our local state to be
sendrecv. This way, we allow the device to indicate the stream state as
desired.

ASTERISK-25854 #close
Reported by Robert McGilvray

Change-Id: I7615737276165eef3a593038413d936247dcc6ed
res/res_pjsip_session.c