Dialplan assistance (Please help)

Hi Guys i am a newbie here i was wondering if someone can explain this to me:

;;set/unset/change pin
exten => **7277,1,set(PWISSET=${DB(pw/${CALLERID(num)})})
exten => **7277,n,noop(${PWISSET})
exten => **7277,n,gotoif($["${PWISSET}" = “”]?102:100)
exten => **7277,100,read(PININCHANGE|vm-password|4)
exten => **7277,101,gotoif($["${PININCHANGE}" = “${PWISSET}”]?102:10)
exten => **7277,102,read(NEWPWD|vm-newpassword|4)
exten => **7277,103,set(DB(pw/${CALLERID(num)})=${NEWPWD})
exten => **7277,104,playback(vm-passchanged)
exten => **7277,1054,hangup()
exten => **7277,10,Playback(vm-incorrect)
exten => **7277,11,goto(1)

exten => _080[0-1].,1,set(NEEDPW=${DB(pw/${CALLERID(num)})})
exten => _080[0-1].,n,noop(Caller ${CALLERID(num)})
exten => _080[0-1].,n,noop(Password ${NEEDPW})
exten => _080[0-1].,n,set(DST=${EXTEN})
exten => _080[0-1].,n,noop(Destination ${DST})
exten => _080[0-1].,n,gotoif($["${NEEDPW}" = “”]?102:100)
exten => _080[0-1].,100,read(PININ|vm-password|4)
exten => _080[0-1].,101,gotoif($["${PININ}" = “${NEEDPW}”]?${EXTEN},102:${EXTEN},10)
exten => _080[0-1].,102,dial(dahdi/g1/${EXTEN});;telkom toll free
exten => _080[0-1].,10,Playback(vm-incorrect)
exten => _080[0-1].,11,goto(100)

It looks like the *7277 extension sets a database variable to a PIN entered by the user while the pattern match uses that pin for authentication to dial out.

1 Like

Thank you John, where can i read more of this, sorry for the trouble but i need to know what is happening line by line :frowning:

hope it is not too much trouble

You should go through this http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/index.html and this https://wiki.asterisk.org/wiki/display/AST/Home to understand how Asterisk works.

Don’t take short-cuts to understand what someone else has developed as that could prove costly in a long run.
–Satish Barot

1.   exten => **7277,1,set(PWISSET=${DB(pw/${CALLERID(num)})})      ; Sets the variable PWISSET (Password_Is_Set?)
2.   exten => **7277,n,noop(${PWISSET})                             ; Debug, kinda print the var 
3.   exten => **7277,n,gotoif($["${PWISSET}" = ""]?102:100)         ; If the variable is empty, go to 102 (Enter new pass). If it is not, go to 100 (Ask for pass)
4.   exten => **7277,100,read(PININCHANGE|vm-password|4)            ; Var != "", Enter password
5.   exten => **7277,101,gotoif($["${PININCHANGE}" = "${PWISSET}"]?102:10) ; If password is entered correctly, allow to change it. Else, Playback wrong password
6.   exten => **7277,102,read(NEWPWD|vm-newpassword|4)                     ; Enter new password
7.   exten => **7277,103,set(DB(pw/${CALLERID(num)})=${NEWPWD})            ; save it on DB
8.   exten => **7277,104,playback(vm-passchanged)                          ; Playback "ok"
9.   exten => **7277,1054,hangup()                                         ; Endcall
10.  exten => **7277,10,Playback(vm-incorrect)                             ; If password wrong on '4' (101) we came here. Playback "incorrect"
11.  exten => **7277,11,goto(1)                                            ; Start over
______________________________________________________

1.   exten => _080[0-1].,1,set(NEEDPW=${DB(pw/${CALLERID(num)})})       ; Sets variable NEEDPW with PW from database for Caller ID
2.   exten => _080[0-1].,n,noop(Caller ${CALLERID(num)})                ; Debug
3.   exten => _080[0-1].,n,noop(Password ${NEEDPW})                     ; Debug
4.   exten => _080[0-1].,n,set(DST=${EXTEN})                            ; Saves call destination in Var 'DST'
5.   exten => _080[0-1].,n,noop(Destination ${DST})                     ; Debug
6.   exten => _080[0-1].,n,gotoif($["${NEEDPW}" = ""]?102:100)          ; If var NEEDPW is "", go to 102 (9) else go to 100 (7)
7.   exten => _080[0-1].,100,read(PININ|vm-password|4)                  ; Password is set. Enter it. Save it to var PININ
8.   exten => _080[0-1].,101,gotoif($["${PININ}" = "${NEEDPW}"]?${EXTEN},102:${EXTEN},10)  ; If entered password is correct, go to 102(8). Else go to 10(10)
9.   exten => _080[0-1].,102,dial(dahdi/g1/${EXTEN});;telkom toll free    ; Entered password OK or password = "". Dial and end call
10.  exten => _080[0-1].,10,Playback(vm-incorrect)                      ; Wrong password. PININ != NEEDPW. Playback 'Incorrect'
11.  exten => _080[0-1].,11,goto(100)                                   ; Ask for password again

Use the Wiki for more info about applications (‘Read’, ‘Playback’, ‘Dial’,‘NoOp’,‘Set’ are applications) and functions (e.g. CALLERID).

@HectorRoyo92, thank you thank you for your valued input, I will read up more and prosper :slight_smile::slight_smile::slight_smile::slight_smile:

Thank you @satish4asterisk