This was a bug and it is fixed now: issues.asterisk.org/jira/browse/ASTERISK-24916
Thanks Asterisk team.