Prevent a caller from looping indefinately

Hi,

Here is part of my dialplan what I am trying to do if the caller enter 3 time wrong conference # to hangup

[conference]
exten => s,1,NoOp(** Entering ABC Conferencing)
exten => s,n,Wait()
exten => s,n,Set(TRIES=0)
exten => s,n,Background(/welcome)
exten => s,n(enterid),Read(CONFID,/confn,6,2)
exten => s,n,GotoIf($[ 0${CONFID} < 100000 ]?noentry)
exten => s,n,Goto(conference,${CONFID},1)
exten => s,n,NoOp(*************NEXTLINE)
exten => s,n(noentry),Playback(/goodbye)
exten => s,n,Hangup()

#include includes/conferences.conf

exten => i,1,Playback(/invalid)
;exten => i,n,Goto(conference,s,1)
;exten => i,n,Set(TRIES=0)
exten => i,n,Set(TRIES=$[${TRIES}+1])
exten => i,n,GoToIf($[${TRIES}>2]?disconnect)
exten => i,n,Goto(conference,s,1)
exten => i,n(disconnect),Playback(/goodbye)
exten => i,n,Hangup()

exten => t,1,Playback(blue-eyed-polar-bear)
exten => t,n,Hangup()

what is wrong with my dialplan???

-tony

exten => s,n,Set(TRIES=0)

is in the loop!

thanks for the reply I also had it here still just loops without disconnection after three tries:

exten => i,1,Playback(/invalid)
;exten => i,n,Goto(conference,s,1)
;exten => i,n,Set(TRIES=0)
exten => i,n,Set(TRIES=$[${TRIES}+1])
exten => i,n,GoToIf($[${TRIES}>2]?disconnect)
exten => i,n,Goto(conference,s,1)
exten => i,n(disconnect),Playback(/goodbye)
exten => i,n,Hangup()

exten => t,1,Playback(blue-eyed-polar-bear)
exten => t,n,Hangup()

I see no difference!

The minimum change to make it work would be:

exten => i,n,Goto(conference,s,[color=#FF0000]4)[/color]

thank David for the reply however this is still not working for me.

exten => i,1,Playback(/invalid) ----say invalid number
exten => i,n,Set(TRIES=0) -----try 0 time
exten => i,n,Set(TRIES=$[${TRIES}+1]) -----add 1 to try
exten => i,n,GoToIf($[${TRIES}>2]?disconnect)------ if more than 2 go to disconnect
exten => i,n,Goto(conference,s,1) ----
exten => i,n(disconnect),Playback(/goodbye)
exten => i,n,Hangup()

What do I have to do so it will allow the caller to try only three times and if have not entered the correct conf. # disconnect the caller.

Please someone help me this is getting to real frustrating.

thanks in advance…

Change the code as indicated. Your latest code does not have the change I said was necessary, but it does have a line that should be commented out but is no longer commented out!

exten => i,1,Playback(/invalid)
;exten => i,n,Set(TRIES=0) ----------------if this is what you are referring
exten => i,n,Set(TRIES=$[${TRIES}+1])
exten => i,n,GoToIf($[${TRIES}>2]?disconnect)
exten => i,n,Goto(conference,s,4) -----------------------and making this change
exten => i,n(disconnect),Playback(/goodbye)
exten => i,n,Hangup()

If the above code is what you are talking about I tried it after the invalid number is entered just goes to goodby…
here is the output from cli

Invalid extension ‘66’ in context ‘conference’ on SIP/xxxxxxxx_in-0000008b
== CDR updated on SIP/xxxxxxxx_in-0000008b
– Executing [i@conference:1] Playback(“SIP/xxxxxxxx_in-0000008b”, “/invalid”) in new stack
– <SIP/xxxxxxxx_in-0000008b> Playing ‘/invalid.slin’ (language ‘en’)
[2012-10-04 08:08:29] WARNING[3670]: ast_expr2.fl:468 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected ‘+’, expecting $end; Input:
1
^
[2012-10-04 08:08:29] WARNING[3670]: ast_expr2.fl:472 ast_yyerror: If you have questions, please refer to wiki.asterisk.org/wiki/display/ … +Variables
– Executing [i@conference:2] Set(“SIP/xxxxxxxx_in-0000008b”, “TRIES=”) in new stack
[2012-10-04 08:08:29] WARNING[3670]: ast_expr2.fl:468 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected ‘>’, expecting $end; Input:

2
^
[2012-10-04 08:08:29] WARNING[3670]: ast_expr2.fl:472 ast_yyerror: If you have questions, please refer to wiki.asterisk.org/wiki/display/ … +Variables
– Executing [i@conference:3] GotoIf(“SIP/xxxxxxxx_in-0000008b”, “?:disconnect”) in new stack
– Goto (conference,i,5)
– Executing [i@conference:5] Playback(“SIP/xxxxxxxx_in-0000008b”, “/3”) in new stack
– <SIP/xxxxxxxx_in-0000008b> Playing ‘/3.slin’ (language ‘en’)
– Executing [i@conference:6] Hangup(“SIP/xxxxxxxx_in-0000008b”, “”) in new stack
== Spawn extension (conference, i, 6) exited non-zero on ‘SIP/xxxxxxxx_in-0000008b’

and one other issue

exten => i,n,Goto(conference,s,4)

there is no context [conference] s,4

[conference]
exten => s,1,NoOp(** Entering ABC Conferencing)
exten => s,n,Wait()
exten => s,n,Set(TRIES=0)
exten => s,n,Background(/welcome)
exten => s,n(enterid),Read(CONFID,/confn,6,2)
exten => s,n,GotoIf($[ 0${CONFID} < 100000 ]?noentry)
exten => s,n,Goto(conference,${CONFID},1)
exten => s,n,NoOp(*************NEXTLINE)
exten => s,n(noentry),Playback(/goodbye)
exten => s,n,Hangup()

This is conference,s,4:

exten => s,n,Background(/welcome)

TRIES seems to be set to an empty string. I don’t know why. Maybe the complete CLI log would make it clear.

== Using SIP RTP CoS mark 5
– Executing [1111111111@cbmin:1] GotoIfTime(“SIP/xxxxxxxx_in-00000090”, “08:00-17:00,mon-fri,,?cbmin,s,1”) in new stack
– Goto (cbmin,s,1)
– Executing [s@cbmin:1] Read(“SIP/xxxxxxxx_in-00000090”, “digito,/abc,1,10”) in new stack
– Accepting a maximum of 1 digits.
– <SIP/xxxxxxxx_in-00000090> Playing ‘/abc.slin’ (language ‘en’)
– User entered ‘8’
– Executing [s@cbmin:2] NoOp(“SIP/xxxxxxxx_in-00000090”, “8”) in new stack
– Executing [s@cbmin:3] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?sales”) in new stack
– Executing [s@cbmin:4] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?custser”) in new stack
– Executing [s@cbmin:5] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?techsup”) in new stack
– Executing [s@cbmin:6] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?dir”) in new stack
– Executing [s@cbmin:7] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?tony”) in new stack
– Executing [s@cbmin:8] GotoIf(“SIP/xxxxxxxx_in-00000090”, “1?conf”) in new stack
– Goto (cbmin,s,15)
– Executing [s@cbmin:15] Goto(“SIP/xxxxxxxx_in-00000090”, “conference,s,1”) in new stack
– Goto (conference,s,1)
– Executing [s@conference:1] NoOp(“SIP/xxxxxxxx_in-00000090”, “** Entering ABC Conferencing”) in new stack
– Executing [s@conference:2] Wait(“SIP/xxxxxxxx_in-00000090”, “”) in new stack
– Executing [s@conference:3] Set(“SIP/xxxxxxxx_in-00000090”, “TRIES=0”) in new stack
– Executing [s@conference:4] BackGround(“SIP/xxxxxxxx_in-00000090”, “/welcome”) in new stack
– <SIP/xxxxxxxx_in-00000090> Playing ‘/etc/asterisk/includes/welcome.slin’ (language ‘en’)
– Executing [s@conference:5] Read(“SIP/xxxxxxxx_in-00000090”, “CONFID,/confn,6,2”) in new stack
– Accepting a maximum of 6 digits.
– <SIP/xxxxxxxx_in-00000090> Playing ‘/confn.slin’ (language ‘en’)
– User entered ‘666666’
– Executing [s@conference:6] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?noentry”) in new stack
– Executing [s@conference:7] Goto(“SIP/xxxxxxxx_in-00000090”, “conference,666666,1”) in new stack
– Goto (conference,666666,1)
– Sent into invalid extension ‘666666’ in context ‘conference’ on SIP/xxxxxxxx_in-00000090
– Executing [i@conference:1] Playback(“SIP/xxxxxxxx_in-00000090”, “/invalid”) in new stack
– <SIP/xxxxxxxx_in-00000090> Playing ‘/invalid.slin’ (language ‘en’)
– Executing [i@conference:2] Set(“SIP/xxxxxxxx_in-00000090”, “TRIES=1”) in new stack
– Executing [i@conference:3] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?:disconnect”) in new stack
– Goto (conference,i,5)
– Executing [i@conference:5] Playback(“SIP/xxxxxxxx_in-00000090”, “/goodbye”) in new stack
– <SIP/xxxxxxxx_in-00000090> Playing ‘/3.slin’ (language ‘en’)
– Executing [i@conference:6] Hangup(“SIP/xxxxxxxx_in-00000090”, “”) in new stack
== Spawn extension (conference, i, 6) exited non-zero on ‘SIP/xxxxxxxx_in-00000090’

sorry my mistake when I did a reload i did not have

exten => i,n,Set(TRIES=0)

in the [conference] context

it is there now and as you can see it just drops the call when an invalid key is entered

== Using SIP RTP CoS mark 5
– Executing [1111111111@cbmin:1] GotoIfTime(“SIP/xxxxxxxx_in-00000090”, “08:00-17:00,mon-fri,,?cbmin,s,1”) in new stack
– Goto (cbmin,s,1)
– Executing [s@cbmin:1] Read(“SIP/xxxxxxxx_in-00000090”, “digito,/abc,1,10”) in new stack
– Accepting a maximum of 1 digits.
– <SIP/xxxxxxxx_in-00000090> Playing ‘/abc.slin’ (language ‘en’)
– User entered ‘8’
– Executing [s@cbmin:2] NoOp(“SIP/xxxxxxxx_in-00000090”, “8”) in new stack
– Executing [s@cbmin:3] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?sales”) in new stack
– Executing [s@cbmin:4] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?custser”) in new stack
– Executing [s@cbmin:5] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?techsup”) in new stack
– Executing [s@cbmin:6] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?dir”) in new stack
– Executing [s@cbmin:7] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?tony”) in new stack
– Executing [s@cbmin:8] GotoIf(“SIP/xxxxxxxx_in-00000090”, “1?conf”) in new stack
– Goto (cbmin,s,15)
– Executing [s@cbmin:15] Goto(“SIP/xxxxxxxx_in-00000090”, “conference,s,1”) in new stack
– Goto (conference,s,1)
– Executing [s@conference:1] NoOp(“SIP/xxxxxxxx_in-00000090”, “** Entering ABC Conferencing”) in new stack
– Executing [s@conference:2] Wait(“SIP/xxxxxxxx_in-00000090”, “”) in new stack
– Executing [s@conference:3] Set(“SIP/xxxxxxxx_in-00000090”, “TRIES=0”) in new stack
– Executing [s@conference:4] BackGround(“SIP/xxxxxxxx_in-00000090”, “/welcome”) in new stack
– <SIP/xxxxxxxx_in-00000090> Playing ‘/etc/asterisk/includes/welcome.slin’ (language ‘en’)
– Executing [s@conference:5] Read(“SIP/xxxxxxxx_in-00000090”, “CONFID,/confn,6,2”) in new stack
– Accepting a maximum of 6 digits.
– <SIP/xxxxxxxx_in-00000090> Playing ‘/confn.slin’ (language ‘en’)
– User entered ‘666666’
– Executing [s@conference:6] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?noentry”) in new stack
– Executing [s@conference:7] Goto(“SIP/xxxxxxxx_in-00000090”, “conference,666666,1”) in new stack
– Goto (conference,666666,1)
– Sent into invalid extension ‘666666’ in context ‘conference’ on SIP/xxxxxxxx_in-00000090
– Executing [i@conference:1] Playback(“SIP/xxxxxxxx_in-00000090”, “/invalid”) in new stack
– <SIP/xxxxxxxx_in-00000090> Playing ‘/invalid.slin’ (language ‘en’)
– Executing [i@conference:2] Set(“SIP/xxxxxxxx_in-00000090”, “TRIES=1”) in new stack
– Executing [i@conference:3] GotoIf(“SIP/xxxxxxxx_in-00000090”, “0?:disconnect”) in new stack
– Goto (conference,i,5)
– Executing [i@conference:5] Playback(“SIP/xxxxxxxx_in-00000090”, “/goodbye”) in new stack
– <SIP/xxxxxxxx_in-00000090> Playing ‘/3.slin’ (language ‘en’)
– Executing [i@conference:6] Hangup(“SIP/xxxxxxxx_in-00000090”, “”) in new stack
== Spawn extension (conference, i, 6) exited non-zero on ‘SIP/xxxxxxxx_in-00000090’

This is conference,s,4:

exten => s,n,Background(/welcome)

OK I understand now but not working…

You have added a : in a gotoif.

YOU are the MAN thank you so much IT IS WORKING thanks a million… :smiley:

[conference]
exten => s,1,NoOp(** Entering ABC Conferencing)
exten => s,n,Wait()
exten => s,n,Set(TRIES=0)
exten => s,n,Background(/welcome)
exten => s,n(enterid),Read(CONFID,/confn,6,2)
exten => s,n,GotoIf($[ 0${CONFID} < 100000 ]?noentry)
exten => s,n,Goto(conference,${CONFID},1)
exten => s,n,NoOp(*************NEXTLINE)
exten => s,n(noentry),Playback(/goodbye)
exten => s,n,Hangup()

#include includes/conferences.conf

exten => i,1,Playback(/invalid)
exten => i,n,Set(TRIES=$[${TRIES}+1])
exten => i,n,GoToIf($[${TRIES}>1]?disconnect)
exten => i,n,Goto(conference,s,4)
exten => i,n(disconnect),Playback(/goodbye)
exten => i,n,Hangup()

This works great but after the second try it is suppose to end with a goodbye announcement but the call just drops…

Why are your sounds in your root directory?

this is just a test unit I am building I will move them to an appropriate location.

actually David they are not the path is /home/ast/sounds… I see you saw /