]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip: Handle deferred SDP hold/unhold properly. 35/2535/2
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:14:29 +0000 (16:14 -0500)
commit967bb9eaf76e06f55d313761b82e7e19df2a838a
tree4350dbd29181aee0eddb05f7c3d4e26d9e6939d7
parent67390813852716db981be4e55357c1cf9d15b7df
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