2 thoughts on - Passcode

  • Again, the authenticate function can help you

    Leandro

    2013/5/20 Felix Vazquez

  • Hello Felix,

    I did it in this way:

    In the extensions.conf Create this two Macros:

    [macro-ask-pass]
    exten => s,1,Set(ORI=${MACRO_EXTEN})
    same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5
    seconds
    same => n,Set(TIMEOUT(response)) ; Set Response Timeout to 10 seconds
    same => n,Background(vm-password)
    same => n,WaitExten(5)

    [macro-verify-pass]
    exten => s,1,Set(GO=${ODBC_PASS(${MACRO_EXTEN:2},${ARG1},${ARG2})})
    same => n,Verbose(${GO})
    same => n,Verbose(${ORI})
    same => n,GotoIf($[${GO} = 0]?wrong:ok)
    same => n(wrong),Playback(vm-incorrect)
    same => n,Hangup()
    same => n(ok),Playback(auth-thankyou)

    Then in trunk ld I call the macro this way (all the passwords start with
    *1 (for example *1252525252, *1545288362):

    [trunkld]

    exten => _9X1NXXXXXXXXX,1,Macro(ask-pass)
    exten => _*1.,1,Macro(verify-pass,restricted,unlimited)
    same => n,Set(FILENAME=g
    ${CALLERID(all)}-${EXTEN}-${STRFTIME(${EPOCH},GMT+5,%C%y%m%d%H%
    M)}-${UNIQUEID})
    same => n,Macro(dundi-e164,${ORI:1})
    same => n,MixMonitor(${MONDIR}${FILENAME}.wav,b)
    same => n,Dial(${GLOBAL(TRUNK)}/${ORI:${GLOBAL(TRUNKMSD)}})
    same => n,StopMixMonitor()

    In the func_odbc.conf
    [PASS]
    dsn=asterisk readsql=select count(*) from ast_passwd where passwd ‘${SQL_ESC(${ARG1})}’ and user_profile in
    (‘${SQL_ESC(${ARG2})}’,’${SQL_ESC(${ARG3})}’)

    I do not know if this is the better way to achieve this but this works, and ask password every time some one call to long distance number.

    I hope this helps.

    Regards, Sergio Basurto