<p>Have you tested that session->ip_addr.len>0? Can you print the str value for session->ip_addr and see if it is a valid IP?</p>
<p>Then it would be better to use str2ipx(), because it tries internally both ipv4/6.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2045?email_source=notifications&email_token=ABO7UZJWK7JVKRDI7N45JETQGORKBA5CNFSM4IPMS3X2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5D4M5A#issuecomment-524797556">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZNAPOTYPWTW3B63T5TQGORKBANCNFSM4IPMS3XQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZONVTJQVUNUZT5VX6DQGORKBA5CNFSM4IPMS3X2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5D4M5A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2045?email_source=notifications\u0026email_token=ABO7UZJWK7JVKRDI7N45JETQGORKBA5CNFSM4IPMS3X2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5D4M5A#issuecomment-524797556",
"url": "https://github.com/kamailio/kamailio/pull/2045?email_source=notifications\u0026email_token=ABO7UZJWK7JVKRDI7N45JETQGORKBA5CNFSM4IPMS3X2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5D4M5A#issuecomment-524797556",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>