chan_sip: Honor Session-Expires in 200OK response when it's a RE-INVITE when asterisk is the refresher.

RFC 4028 Section 7.2
 "UACs MUST be prepared to receive a Session-Expires header field in a
 response, even if none were present in the request." 

What changed
  After ASTERISK-20787, inbound calls to asterisk with no Session-Expires in the INVITE are now are offered
  a Session-Expires (1800 asterisk default) in the response, with asterisk as the refresher.

Symptom:
  After 900 seconds (asterisk default refresher period 1800), asterisk RE-INVITEs the device, the device
   may respond with a much lower Session-Expires (180 in our case) value that it is now using.

  Asterisk ignores this response, as it's deemed both an INBOUND CALL, and a RE-INVITE.

  After 180 seconds the device times out and sends BYE (hangs up), asterisk is still working with the
  refresher period of 1800 as it ignored the 'Session Expires: 180' in the previous 200OK response.
 
Fix:
	handle_response_invite() when 200OK, remove check for outbound and reinvite.
  
(closes issue ASTERISK-21664)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

Review https://reviewboard.asterisk.org/r/2463/


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@387312 f38db490-d61c-443f-a65b-d21fe96a405b
chan_sip: Session-Expires: Set timer to correctly expire at (~2/3) of the interval when not the refresher

RFC 4028 Section 10
	if the side not performing refreshes does not receive a
	session refresh request before the session expiration, it SHOULD send
	a BYE to terminate the session, slightly before the session
	expiration.  The minimum of 32 seconds and one third of the session
	interval is RECOMMENDED.

Prior to this asterisk would refresh at 1/2 the Session-Expires interval,
or if the remote device was the refresher, asterisk would timeout at interval end.

Now, when not refresher, timeout as per RFC noted above.

(closes issue ASTERISK-21742)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

Review https://reviewboard.asterisk.org/r/2488/



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@387344 f38db490-d61c-443f-a65b-d21fe96a405b