### Description
In some calls I'm getting a 500 error on invite message reponse without reason message. Some times it works well and others the 500 error arises with the same code and situation.
#### Log Messages
``` Jan 11 13:48:47 kamailio-alone /usr/sbin/kamailio[21953]: DEBUG: <core> [parser/msg_parser.c:616]: parse_msg(): SIP Reply (status): Jan 11 13:48:47 kamailio-alone /usr/sbin/kamailio[21953]: DEBUG: <core> [parser/msg_parser.c:618]: parse_msg(): version: <SIP/2.0> Jan 11 13:48:47 kamailio-alone /usr/sbin/kamailio[21953]: DEBUG: <core> [parser/msg_parser.c:620]: parse_msg(): status: <500> Jan 11 13:48:47 kamailio-alone /usr/sbin/kamailio[21953]: DEBUG: <core> [parser/msg_parser.c:622]: parse_msg(): reason: <>
DEBUG: <core> [msg_translator.c:2246]: generate_res_buf_from_sip_res(): copied size: orig:130, new: 14, rest: 420 msg=#012SIP/2.0 500 #015#012Via: SIP/2.0/UDP 37.133.221.218:9773;rport=9773;received=37.133.221.218;branch=z9hG4bKPj8d748325-ecc1-40dd-9f19-0edbe38f46a0#015#012Record-Route: sip:146.185.142.19:9773;lr#015#012Call-ID: 36fa4c8e-2e61-4b24-a775-584b2616b889#015#012From: sip:+34639446862@146.185.142.19;tag=179c6cb5-593e-4442-8596-1f40def7b336#015#012To: sip:+34696501510@146.185.142.19;tag=206c2f8e-2b61-4c51-af6b-7332e1830952#015#012CSeq: 9763 INVITE#015#012Content-Length: 0
```
#### SIP Traffic
``` U 2018/01/11 13:55:40.134061 37.133.221.218:9773 -> 146.185.142.19:9773 INVITE sip:+34696501510@146.185.142.19:9773 SIP/2.0. Via: SIP/2.0/UDP 37.133.221.218:9773;rport;branch=z9hG4bKPj042d70a5-e935-4129-90d2-29ba7679fdc3. Max-Forwards: 70. From: sip:+34639446862@146.185.142.19;tag=bc792be2-981c-45b9-9d59-cd46951d60cd. To: sip:+34696501510@146.185.142.19. Contact: sip:+34639446862@37.133.221.218:9773;ob. Call-ID: 0cbfc14f-69bb-4390-887a-ed9f673c58bc. CSeq: 25548 INVITE. Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS. Supported: replaces, 100rel, timer, norefersub. Session-Expires: 1800. Min-SE: 90. Content-Type: application/sdp. Content-Length: 476. . v=0. o=- 3724667739 3724667739 IN IP4 192.168.1.141. s=pjmedia. b=AS:84. t=0 0. a=X-nat:0. m=audio 4000 RTP/AVP 98 97 99 104 3 0 8 9 96. c=IN IP4 192.168.1.141. b=TIAS:64000. a=rtcp:4001 IN IP4 192.168.1.141. a=sendrecv. a=rtpmap:98 speex/16000. a=rtpmap:97 speex/8000. a=rtpmap:99 speex/32000. a=rtpmap:104 iLBC/8000. a=fmtp:104 mode=30. a=rtpmap:3 GSM/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:9 G722/8000. a=rtpmap:96 telephone-event/8000. a=fmtp:96 0-16.
U 2018/01/11 13:55:40.143355 146.185.142.19:9773 -> 37.133.221.218:9773 SIP/2.0 100 trying -- your call is important to us. Via: SIP/2.0/UDP 37.133.221.218:9773;rport=9773;branch=z9hG4bKPj042d70a5-e935-4129-90d2-29ba7679fdc3;received=37.133.221.218. From: sip:+34639446862@146.185.142.19;tag=bc792be2-981c-45b9-9d59-cd46951d60cd. To: sip:+34696501510@146.185.142.19. Call-ID: 0cbfc14f-69bb-4390-887a-ed9f673c58bc. CSeq: 25548 INVITE. Server: kamailio (4.3.4 (x86_64/linux)). Content-Length: 0. .
U 2018/01/11 13:55:40.144092 146.185.142.19:9773 -> 37.133.221.218:1353 INVITE sip:+34696501510@37.133.221.218:1353;ob SIP/2.0. Record-Route: sip:146.185.142.19:9773;lr. Via: SIP/2.0/UDP 146.185.142.19:9773;branch=z9hG4bK6df7.9f8cf260e72edcb1fae300fb37edaa58.0. Via: SIP/2.0/UDP 37.133.221.218:9773;received=37.133.221.218;rport=9773;branch=z9hG4bKPj042d70a5-e935-4129-90d2-29ba7679fdc3. Max-Forwards: 69. From: sip:+34639446862@146.185.142.19;tag=bc792be2-981c-45b9-9d59-cd46951d60cd. To: sip:+34696501510@146.185.142.19. Contact: sip:+34639446862@37.133.221.218:9773;ob. Call-ID: 0cbfc14f-69bb-4390-887a-ed9f673c58bc. CSeq: 25548 INVITE. Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS. Supported: replaces, 100rel, timer, norefersub. Session-Expires: 1800. Min-SE: 90. Content-Type: application/sdp. Content-Length: 476. . v=0. o=- 3724667739 3724667739 IN IP4 192.168.1.141. s=pjmedia. b=AS:84. t=0 0. a=X-nat:0. m=audio 4000 RTP/AVP 98 97 99 104 3 0 8 9 96. c=IN IP4 192.168.1.141. b=TIAS:64000. a=rtcp:4001 IN IP4 192.168.1.141. a=sendrecv. a=rtpmap:98 speex/16000. a=rtpmap:97 speex/8000. a=rtpmap:99 speex/32000. a=rtpmap:104 iLBC/8000. a=fmtp:104 mode=30. a=rtpmap:3 GSM/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:9 G722/8000. a=rtpmap:96 telephone-event/8000. a=fmtp:96 0-16.
U 2018/01/11 13:55:40.459709 37.133.221.218:1353 -> 146.185.142.19:9773 SIP/2.0 100 Trying. Via: SIP/2.0/UDP 146.185.142.19:9773;received=146.185.142.19;branch=z9hG4bK6df7.9f8cf260e72edcb1fae300fb37edaa58.0. Via: SIP/2.0/UDP 37.133.221.218:9773;rport=9773;received=37.133.221.218;branch=z9hG4bKPj042d70a5-e935-4129-90d2-29ba7679fdc3. Record-Route: sip:146.185.142.19:9773;lr. Call-ID: 0cbfc14f-69bb-4390-887a-ed9f673c58bc. From: sip:+34639446862@146.185.142.19;tag=bc792be2-981c-45b9-9d59-cd46951d60cd. To: sip:+34696501510@146.185.142.19. CSeq: 25548 INVITE. Content-Length: 0. .
U 2018/01/11 13:55:40.459844 37.133.221.218:1353 -> 146.185.142.19:9773 SIP/2.0 500 . Via: SIP/2.0/UDP 146.185.142.19:9773;received=146.185.142.19;branch=z9hG4bK6df7.9f8cf260e72edcb1fae300fb37edaa58.0. Via: SIP/2.0/UDP 37.133.221.218:9773;rport=9773;received=37.133.221.218;branch=z9hG4bKPj042d70a5-e935-4129-90d2-29ba7679fdc3. Record-Route: sip:146.185.142.19:9773;lr. Call-ID: 0cbfc14f-69bb-4390-887a-ed9f673c58bc. From: sip:+34639446862@146.185.142.19;tag=bc792be2-981c-45b9-9d59-cd46951d60cd. To: sip:+34696501510@146.185.142.19;tag=fe966b81-31e8-484a-9cce-625f31915529. CSeq: 25548 INVITE. Content-Length: 0. .
U 2018/01/11 13:55:40.463028 146.185.142.19:9773 -> 37.133.221.218:1353 ACK sip:+34696501510@37.133.221.218:1353;ob SIP/2.0. Via: SIP/2.0/UDP 146.185.142.19:9773;branch=z9hG4bK6df7.9f8cf260e72edcb1fae300fb37edaa58.0. Max-Forwards: 69. From: sip:+34639446862@146.185.142.19;tag=bc792be2-981c-45b9-9d59-cd46951d60cd. To: sip:+34696501510@146.185.142.19;tag=fe966b81-31e8-484a-9cce-625f31915529. Call-ID: 0cbfc14f-69bb-4390-887a-ed9f673c58bc. CSeq: 25548 ACK. Content-Length: 0. .
```
### Possible Solutions
<!-- If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix. -->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 4.4.6 (x86_64/linux) becbde flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: becbde compiled on 08:18:45 Jul 3 2017 with gcc 5.4.0
```