Re-resolve the STUN address if a STUN poll fails for res_stun_monitor.
authorRichard Mudgett <rmudgett@digium.com>
Thu, 1 Dec 2011 21:19:41 +0000 (21:19 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 1 Dec 2011 21:19:41 +0000 (21:19 +0000)
commit83cd844b82ef1a415a53eb7fe4cc30aac30f2ee7
treef976db75213748797c69b8b9c50d0c8267c16a34
parent39424ebad29cde78d774318e7d53d3081b00f940
Re-resolve the STUN address if a STUN poll fails for res_stun_monitor.

The STUN socket must remain open between polls or the external address
seen by the STUN server is likely to change.  However, if the STUN request
poll fails then the STUN server address needs to be re-resolved and the
STUN socket needs to be closed and reopened.

* Re-resolve the STUN server address and create a new socket if the STUN
request poll fails.

* Fix ast_stun_request() return value consistency.

* Fix ast_stun_request() to check the received packet for expected message
type and transaction ID.

* Fix ast_stun_request() to read packets until timeout or an associated
response packet is found.  The stun_purge_socket() hack is no longer
required.

* Reduce ast_stun_request() error messages to debug output.

* No longer pass in the destination address to ast_stun_request() if the
socket is already bound or connected to the destination.

(closes issue ASTERISK-18327)
Reported by: Wolfram Joost
Tested by: rmudgett

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

Merged revisions 346700 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 346701 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346709 65c4cc65-6c06-0410-ace0-fbb531ad65f3
configs/res_stun_monitor.conf.sample
include/asterisk/stun.h
main/stun.c
res/res_stun_monitor.c