This patch adds second parameter for sip_msg_validate with resulting pvar returning error text.
Wouldn't it be better to extend the list of return codes for the sip_msg_validate() function to cover all the errors possible ( internal or SIP msg related ), instead of pushing this text message reason ? Guess that would be a more flexible approach, that would allow the script writer to easily check for the occurred errors.
This patch based on Bogdan's idea to make pv-variable. (Opensips mailing list, Feb 26).
Combined both approaches ( left in the reason phrase, and also added different return codes for each failure reason ).
Thanks for the patch.