[Asterisk-Users] Extended logic syntax

Walker Haddock whaddock at datacrest.com
Thu Oct 23 15:45:45 MST 2003


On Thu, Oct 23, 2003 at 07:54:17PM +0100, Muhammad Nasim wrote:
> 
> Hi. Can anyone help me with the following:
> 
> [globals]
> 
> OFFICEHOURS
OFFICEHOURS=100 ; default to incoming-officehours context
> 
> 
> ....................................
> [internal]
> 
> 
> exten => *80,2,SetGlobalVar(OFFICEHOURS=100)
> 
> 
> exten => *80,2,SetGlobalVar(OFFICEHOURS=200)
> 
> ....................................
> 
> [incoming]
> 
> exten => s,1,GotoIf($[${OFFICEHOURS} = 100}]?incoming-officehours:incoming-officehours-off
exten => s,1,GotoIf($[${OFFICEHOURS} = 100}]?incoming-officehours|s|1:incoming-officehours-off|s|1)

asterisk*CLI> show application Goto
asterisk*CLI>
  -= Info about application 'Goto' =-

[Synopsis]:
  Goto a particular priority, extension, or context

[Description]:
  Goto([[context|]extension|]priority):  Set the  priority to the specified
value, optionally setting the extension and optionally the context as well.
The extension BYEXTENSION is special in that it uses the current extension,
thus  permitting  you  to go to a different  context, without  specifying a
specific extension. Always returns 0, even if the given context, extension,
or priority is invalid.

Looks like the priority is a mandatory argument, then extension and last context.  I expect you'll need all three.
                                                                 ^
> 
> 
> 1. Am I using the right sytanx when I set the global variable OFFICEHOURS
yes
> 
> 2. Am I using the right syntax when I use the GotoIf, PRoblem is that the GotoIf conditions seems to evaluate to 0 no matter what OFFICEHOURS is set to. The CLI output is as follows:
See above.
> 
> Executing GotoIf("blabla", "0?incoming-officehours:incoming-officehours-off") in new stack. I am assuming the 0 means the conditional expression is evaluated to false i.e. 0

I expect the expression evaluated to "0" because OFFICEHOURS was not set.  So
Set Global to a default value as above.

-- 
********   DataCrest, Inc. -- Technically Superior   ******************
Walker Haddock                       http://www.datacrest.com
DataCrest, Inc.                    e-mail:  wh at datacrest.com
1634A Montgomery Hwy.    phone:  1-888-941-3282, 1-205-335-8589
Birmingham, AL 35216                  fax:  1-205-823-7838
***********************************************************************



More information about the asterisk-users mailing list