Re: [asterisk-users] make func_realtime work like app_realtime (1.6)

2008-10-09 Thread Tilghman Lesher
On Wednesday 08 October 2008 22:05:14 Rob Hillis wrote:
 Tilghman Lesher wrote:
  On Wednesday 08 October 2008 13:22:25 Rob Hillis wrote:
  Wesley Haut wrote:
  Yell at me if you will, but I hate func_realtime - it's not very
  usable nor is it change-friendly (update your database and your
  dialplan completely breaks).
 
  I agree completely.  As it stands, the REALTIME() function is nearly
  completely useless.  If Asterisk had better string manipulation
  functionality, it would be /marginally/ better, though still not much
  good.
 
  A far better approach would be to allow you to specify the specific
  field you want to retrieve - the same way that you do for a write.
  /That/ would make the function many times more useful than it currently
  is.
 
  What if I made it work with the HASH() dialplan function, similar to how
  func_odbc works?  Keys are column names, values are the associated field
  value

 I can't say I'm familiar with this method, but a quick look at core
 show function HASH would seem to indicate that it would be much better
 than what we have at the moment.  However, for those occasions where you
 only want to pull one variable out of realtime, I'd still like to have
 the option of specifying one field name to retrieve.

 Possibly the most useful method would be to return the single field if a
 field name was specified, otherwise return the array with all values in
 it.  That would allow people to pick the method most suitable for them.

Test away!  The method for retrieving a single field is called REALTIME_FIELD,
and the method for retrieving all values into a hash is called REALTIME_HASH.

http://bugs.digium.com/view.php?id=13651

-- 
Tilghman

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] make func_realtime work like app_realtime (1.6)

2008-10-08 Thread Wesley Haut
Yell at me if you will, but I hate func_realtime - it's not very usable nor
is it change-friendly (update your database and your dialplan completely
breaks).

I'm getting a new 1.6 box built out and working, and wanted to emulate the
functionality of APP_realtime somehow, so I started digging around in the
func_realtime source - here's what I came up with:

For 1.6.0, look at line 86 of func_realtime.c

ast_str_append(out, 0, %s%s%s%s, var-name, args.delim2, var-value, args
.delim1);

I simply changed this to:

pbx_builtin_setvar_helper(chan, var-name, var-value);

Now when I call the realtime function, I get the channel variables populated
instead of having to parse that godawful string to get at my data.

Again, yell at me if you will, but even Mark Spencer commented on how
func_realtime wasn't all that great, but nobody seems to have done anything
about it.

BTW - I don't code in C at all - this was just a bunch of searching and a
lucky guess...
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2008 - September 22 - 25 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] make func_realtime work like app_realtime (1.6)

2008-10-08 Thread Rob Hillis
Wesley Haut wrote:
 Yell at me if you will, but I hate func_realtime - it's not very 
 usable nor is it change-friendly (update your database and your 
 dialplan completely breaks).

I agree completely.  As it stands, the REALTIME() function is nearly 
completely useless.  If Asterisk had better string manipulation 
functionality, it would be /marginally/ better, though still not much good.

A far better approach would be to allow you to specify the specific 
field you want to retrieve - the same way that you do for a write.  
/That/ would make the function many times more useful than it currently is.

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] make func_realtime work like app_realtime (1.6)

2008-10-08 Thread Tilghman Lesher
On Wednesday 08 October 2008 13:22:25 Rob Hillis wrote:
 Wesley Haut wrote:
  Yell at me if you will, but I hate func_realtime - it's not very
  usable nor is it change-friendly (update your database and your
  dialplan completely breaks).

 I agree completely.  As it stands, the REALTIME() function is nearly
 completely useless.  If Asterisk had better string manipulation
 functionality, it would be /marginally/ better, though still not much good.

 A far better approach would be to allow you to specify the specific
 field you want to retrieve - the same way that you do for a write.
 /That/ would make the function many times more useful than it currently is.

What if I made it work with the HASH() dialplan function, similar to how
func_odbc works?  Keys are column names, values are the associated field
value.

-- 
Tilghman

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] make func_realtime work like app_realtime (1.6)

2008-10-08 Thread BJ Weschke
Tilghman Lesher wrote:
 On Wednesday 08 October 2008 13:22:25 Rob Hillis wrote:
   
 Wesley Haut wrote:
 
 Yell at me if you will, but I hate func_realtime - it's not very
 usable nor is it change-friendly (update your database and your
 dialplan completely breaks).
   
 I agree completely.  As it stands, the REALTIME() function is nearly
 completely useless.  If Asterisk had better string manipulation
 functionality, it would be /marginally/ better, though still not much good.

 A far better approach would be to allow you to specify the specific
 field you want to retrieve - the same way that you do for a write.
 /That/ would make the function many times more useful than it currently is.
 

 What if I made it work with the HASH() dialplan function, similar to how
 func_odbc works?  Keys are column names, values are the associated field
 value.

   
 +1 to that Tilghman. HASH() wasn't there at the time that we originally 
put func_realtime together, but it would certainly make it more usable.


-- 
--
Bird's The Word Technologies, Inc.
http://www.btwtech.com/




___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] make func_realtime work like app_realtime (1.6)

2008-10-08 Thread Rob Hillis
Tilghman Lesher wrote:
 On Wednesday 08 October 2008 13:22:25 Rob Hillis wrote:
   
 Wesley Haut wrote:
 
 Yell at me if you will, but I hate func_realtime - it's not very
 usable nor is it change-friendly (update your database and your
 dialplan completely breaks).
   
 I agree completely.  As it stands, the REALTIME() function is nearly
 completely useless.  If Asterisk had better string manipulation
 functionality, it would be /marginally/ better, though still not much good.

 A far better approach would be to allow you to specify the specific
 field you want to retrieve - the same way that you do for a write.
 /That/ would make the function many times more useful than it currently is.
 

 What if I made it work with the HASH() dialplan function, similar to how
 func_odbc works?  Keys are column names, values are the associated field
 value

I can't say I'm familiar with this method, but a quick look at core 
show function HASH would seem to indicate that it would be much better 
than what we have at the moment.  However, for those occasions where you 
only want to pull one variable out of realtime, I'd still like to have 
the option of specifying one field name to retrieve.

Possibly the most useful method would be to return the single field if a 
field name was specified, otherwise return the array with all values in 
it.  That would allow people to pick the method most suitable for them.


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users