[Asterisk-Users] after hours - is this logic ok ?
Lance Arbuckle
asterisk at arbuckle.org
Thu Jan 1 11:45:36 MST 2004
Tilghman Lesher wrote:
>
> I'm curious as to why you're going the extra step to put a value into
> the database. Why not just set a channel variable and check that value?
>
> [day]
> exten => s,2,SetVar(daytime=1)
>
> [night]
> exten => s,2,SetVar(daytime=0)
>
> [macro-stdexten]
> exten => s,10,GotoIf($[${daytime}]?11:111)
>
> Using a variable is nice, because all channels get their own variable
> space, so there's no chance of collisions between different calls, and
> the variable is automatically trashed when the channel is hungup.
>
> -Tilghman
Hi Tilghman
thanks for your response.
I stuck the value in the database because I haven't a clue as to what
I'm doing :-) In all my reading I didn't see anything that talked about
variables having their own private per channel sandbox in which to
play. I just figured since * had a DB, I'd use it :) It's exactly this
type of thing that I'm finding frustrating while trying to learn
Asterisk. I'll spend hours reading about something ( in this case I
read a bunch about setvar and the DB commands ) but at the end of all
that reading all I could show for it was two methods of accomplishing a
task, but I din't know which way (if any) was the best or most
appropriate way. I feel like I'm handicapped in learning Asterisk by my
lack of not knowing a programming language. I have a sneaky feeling
that a lot of the answers to my questions would be obvious to someone
with C/C++ experience.
So, here's another question... How does someone with no programming
experience, effectively learn the proper way to do things in Asterisk ?
For example, if I want to implement feature xyz, currently I go googling
and read, read, read. I may come up with two or three sample contexts
that accomplish the same thing via different means. All I can do now is
pick one of the examples and modify to my needs without any regard to
the pros and cons of each example. Now, I *try* to post intelligently
phrased questions to this list but after seeing some of the threads the
past few days, I'm hesitant to post the "how do I implement this?"
questions for fear of being flamed to death :( or getting the standard
"Google is your friend" responses. What would be a great help to me and
possible other beginners, is whenever a question is asked of the list,
responses include a brief explanation of the "why" for the particular
answer. Or, if there is another resource that talks in generalities
about how to do thing in Asterisk, please, I beg the list, to tell me
where it is :)
Happy New Year !!
--
.~.
/V\ Lance "I'm always looking for clue's" Arbuckle
// \\
/( )\
^'~'^
More information about the asterisk-users
mailing list