Authentication for each agent through accountcode

Hello,

I am using aah v2.0.

I am planning to put passwords in each extensions so that when ever they dial they are asked for the passwords (i m using accountcode as passwords).

If an extension does not have accoutcode or it is blank, the call will not go through. It should say user busy or something appropriate.

I have managed the first part . i.e. it is asking for the password but the other part, i have no idea how to implement it. The calls from extensions with no accountcode are also passing through which actually should be rejected.

There is the macro-dialout i m using:
[macro-dialout-trunk]
exten => s,1,GotoIf($[foo${ACCOUNTCODE} = foo]?3:2))
exten => s,2,Authenticate(${ACCOUNTCODE})
exten => s,3,Macro(user-callerid)
exten => s,4,Macro(record-enable,${CALLERIDNUM},OUT)
exten => s,5,Macro(outbound-callerid,${ARG1})
exten => s,6,SetGroup(OUT_${ARG1})
exten => s,7,CheckGroup(${OUTMAXCHANS_${ARG1}})
; if we’ve used up the max channels, continue at (n+101)
exten => s,8,SetVar(DIAL_NUMBER=${ARG2})
exten => s,9,SetVar(DIAL_TRUNK=${ARG1})
exten => s,10,AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
exten => s,11,SetVar(OUTNUM=${OUTPREFIX_${ARG1}}${DIAL_NUMBER}) ; OUTNUM is the final dial number
exten => s,12,Cut(custom=OUT_${ARG1},:,1) ; Custom trunks are prefixed with "AMP:"
exten => s,13,GotoIf($[${custom} = AMP]?16)
exten => s,14,Dial(${OUT_${ARG1}}/${OUTNUM}) ; Regular Trunk Dial
exten => s,15,Goto(s-${DIALSTATUS},1)

Can somebody help please.

Thanks in advance.

GotoIf($[${ACCOUNTCODE}=""]?somewhere)?

(very tried atm so that may be bad syntax)

Thnx Ironhelix…that will solve the purpose…but can u plz suggest whether the one below will work or not…

[macro-dialout-trunk]
exten => s,1,GotoIf($[foo${ACCOUNTCODE} = foo]?201:2)) ;
exten => s,2,Authenticate(${ACCOUNTCODE})
exten => s,3,Macro(user-callerid)
exten => s,4,Macro(record-enable,${CALLERIDNUM},OUT)
exten => s,5,Macro(outbound-callerid,${ARG1})
exten => s,6,SetGroup(OUT_${ARG1})
exten => s,7,CheckGroup(${OUTMAXCHANS_${ARG1}})
; if we’ve used up the max channels, continue at (n+101)
exten => s,8,SetVar(DIAL_NUMBER=${ARG2})
exten => s,9,SetVar(DIAL_TRUNK=${ARG1})
exten => s,10,AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
exten => s,11,SetVar(OUTNUM=${OUTPREFIX_${ARG1}}${DIAL_NUMBER}) ; OUTNUM is the final dial number
exten => s,12,Cut(custom=OUT_${ARG1},:,1) ; Custom trunks are prefixed with "AMP:"
exten => s,13,GotoIf($[${custom} = AMP]?16)
exten => s,14,Dial(${OUT_${ARG1}}/${OUTNUM}) ; Regular Trunk Dial
exten => s,15,Goto(s-${DIALSTATUS},1)
exten => s,201,Playback(vm-goodbye)
exten => s,202,Hangup

There is one addition required.

  1. If the accountcode is 111 then the extn can dial local calls only.

  2. If accountcode is blank means extn cannot dial any number. (Solved in above code)

  3. If the accountcode is provided by the extn they can dial anywhere. (Solved in above code)

The outbound routing context is as below:

[outrt-TEST]
include => outrt-TEST-custom
exten => _1234.,1,Macro(dialout-trunk,17,${EXTEN:4},)
exten => _1234.,2,Macro(outisbusy) ; No available circuits

Thanks in advance

hi

exten => 514,1,Answer ; Answer the line exten => 514,n,Read(acc_code,access-code,4) exten => 514,n,set(passkey=${DB(auth_user/${acc_code})}) exten => 514,n,Authenticate(${passkey}) exten => 514,n,set(db_context=${DB(acc_cont/${acc_code})}) exten => 514,n,SetAccount(${acc_code}) exten => 514,n,DISA(no-password|${db_context})

The above may do what you want, it uses a couple of linked astdb entries.

ie
auth_user = 1234 passkey = 1234
acc_code = 1234 db_context = internal/long distance etc

thank you so much.

I will try the code and post the results.

Thanks again.

[quote=“shahidr100”]Hello,

I am using aah v2.0.

I am planning to put passwords in each extensions so that when ever they dial they are asked for the passwords (i m using accountcode as passwords).

.[/quote]

Please reduce my ignorance.

what is aah v2.0 ?

asterisk@home version 2. AKA trixbox before they renamed.

and to get 111 to only dial local, put another GotoIf($[${ACCOUNTCODE}=111]?aprioritythatcanonlydiallocal)

Hard to keep up with what all the abbreviations are referring to.

Thx