[asterisk-users] Using SetVar with System() is it possible?
Steve Edwards
asterisk.org at sedwards.com
Sat Jun 19 10:56:42 CDT 2010
On Sat, 19 Jun 2010, bruce bruce wrote:
> Is it possible to harvest the output of system into a SetVar(variable)?
>
> exten => s,n,SetVar(var=system(asterisk -rx "sip show channels" | grep
> -c "(ulaw)")
>
> ??? any problem with the syntax?
Really? Is posting questions showing you've made zero effort faster or
easier than reading the help text or just trying it?
) Your parentheses don't match.
) You didn't read the documentation that says system() returns FAILURE or
SUCCESS.
) You didn't notice that setvar() is deprecated.
) You didn't read the documentation that says set[var]() sets a name to a
value -- no mention of evaluating an application.
Wouldn't it faster for you to just try it? You might learn why it didn't
work?
The system() application is (IMO) a kludge. Sometimes it is the only way,
but usually it is just the lazy way to solve a problem in an unreliable
and inefficient way.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list