I am trying to setup call forwarding on my Asterisk PBX. Unfortunately I have not found a pre-programed solution that works for me so I decided to create my own solution.
Unfortunatly my solution revolves around an if statement, and I cant seem to get them working in Asterisk.
Can anyone tell me what language to base my code off of, or look at my current code and tell me where I went wrong.
Here is my code:
exten = s,1,Set(ZERO=0)
exten = s,2,SayDigits(${ZERO})
if (${DB(CFWD/${CID})} != ${ZERO}) {
exten = s,3,SayDigits(99)
} else {
exten = s,3,SayDigits(${DB(CFWD/${CID})})
}
exten = s,4,SayDigits(00)
exten = s,5,SayDigits(${DB(CFWD/${CID})})
It sets the Variable ZERO to 0, and then I check to make sure that the variable ZERO is set.
After that if does an if statement to check to see if the DB variable CFWD/CID where CID is equal to what extension I am calling from. That variable is set before, and it works just fine, as tested with my SayDigits command.
Now no matter what I do (I have tried =, ==, !=, >, < ect) it will always play the first section exten = s,3,SayDigits(99);, but never the second one.
Does anyone have any ideas?