Simple authentication, but still not working!

This should be a very simple dialplan to pull a username (extension) and password (account code) from an AstDB and use the pair to authenticate, but I have been tried for 45 minutes and have had no success! Here it is:

ignorepat => 9
exten => _91NXXNXXXXXX,2,Set(PW=${DB(accounts/${CALLERIDNUM})})
exten => _91NXXNXXXXXX,3,Authenticate(${PW}|a)
exten => _91NXXNXXXXXX,3,Playback(beep)
exten => _91NXXNXXXXXX,5,Hangup

This should read accounts/101 as being 456789, beep, and hangup. All I get is invalid password. If I go to CLI and type database get accounts 101 I get 456789 back.

If I change the Authenticate(${PW}|a) line to:

exten => _91NXXNXXXXXX,3,SayDigits(${PW})

It reads my password. Why won’t authenticate accept my password?


What I am trying to do is, have a extension that an admin can call, enter another users extension followed by a 6 digit number to store as their account code into AstDB. If no one can figure out why this isn’t working, can you guide me on a different solution?