[SOLVED] Sip realtime - registration failed

Hello, I have got following problem: sip phone registers in asterisk, works for some time and then in cli error appears:

After “sip reload” sip phone registers again and begins to work.
sip debug shows following messages:

[code]<— SIP read from UDP:172.17.20.225:5062 —>
REGISTER sip:192.168.70.110 SIP/2.0
Via: SIP/2.0/UDP 172.17.20.225:5062;branch=z9hG4bK20867153
From: sip:1000@192.168.70.110;tag=760268524
To: sip:1000@192.168.70.110
Call-ID: 1544682574@172.17.20.225
CSeq: 1806 REGISTER
Contact: sip:1000@172.17.20.225:5062
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 70
User-Agent: Yealink SIP-T20P 9.60.14.17
Expires: 1800
Content-Length: 0

<------------->
— (12 headers 0 lines) —
Sending to 172.17.20.225:5062 (NAT)

<— Transmitting (NAT) to 172.17.20.225:5062 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.17.20.225:5062;branch=z9hG4bK20867153;received=172.17.20.225;rport=5062
From: sip:1000@192.168.70.110;tag=760268524
To: sip:1000@192.168.70.110;tag=as6abccf25
Call-ID: 1544682574@172.17.20.225
CSeq: 1806 REGISTER
Server: Asterisk PBX 1.8.20.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="301c2c86"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘1544682574@172.17.20.225’ in 32000 ms (Method: REGISTER)
[Oct 21 20:49:12] NOTICE[2167]: chan_sip.c:25575 handle_request_register: Registration from ‘sip:1000@192.168.70.110’ failed for ‘172.17.20.225:5062’ - No matching peer found
Scheduling destruction of SIP dialog ‘1544682574@172.17.20.225’ in 32000 ms (Method: REGISTER)
[/code]
My sip.conf:

[code][general]
; some network settings
bindaddr=192.168.70.110
bindport=5060
localnet=192.168.70.0/255.255.255.0
localnet=192.168.31.0/255.255.255.0
localnet=172.17.20.0/255.255.255.0

context=phones
; cache realtime asterisk
rtcachefriends=yes
rtupdate=yes
[/code]
Settings in mysql for phone:

************************** 1. row *************************** id: 10 name: 1000 ipaddr: 172.17.20.225 port: 5062 regseconds: 1382421332 defaultuser: 1000 fullcontact: sip:1000@172.17.20.225:5062 regserver: useragent: Yealink SIP-T20P 9.6 lastms: 0 host: dynamic type: NULL context: phones permit: NULL deny: NULL secret: NULL md5secret: NULL remotesecret: NULL transport: NULL dtmfmode: NULL directmedia: no nat: NULL callgroup: NULL pickupgroup: NULL language: NULL allow: NULL disallow: NULL insecure: NULL trustrpid: NULL progressinband: NULL promiscredir: NULL useclientcode: NULL accountcode: NULL setvar: NULL callerid: NULL amaflags: NULL callcounter: yes busylevel: NULL allowoverlap: NULL allowsubscribe: NULL videosupport: NULL maxcallbitrate: NULL rfc2833compensate: NULL mailbox: NULL session-timers: NULL session-expires: NULL session-minse: NULL session-refresher: NULL t38pt_usertpsource: NULL regexten: NULL fromdomain: NULL fromuser: NULL qualify: NULL defaultip: NULL rtptimeout: NULL rtpholdtimeout: NULL sendrpid: NULL outboundproxy: NULL callbackextension: NULL registertrying: NULL timert1: NULL timerb: NULL qualifyfreq: NULL constantssrc: NULL contactpermit: NULL contactdeny: NULL usereqphone: NULL textsupport: NULL faxdetect: NULL buggymwi: NULL auth: NULL fullname: NAME trunkname: NULL cid_number: 1000 callingpres: NULL mohinterpret: NULL mohsuggest: NULL parkinglot: NULL hasvoicemail: NULL subscribemwi: NULL vmexten: NULL autoframing: NULL rtpkeepalive: NULL call-limit: NULL g726nonstandard: NULL ignoresdpversion: NULL allowtransfer: NULL dynamic: NULL
Phone is not behind NAT

Guessing: try explicit;y setting type to peer.

Seems to me it helped, thank you.