[asterisk-dev] Named lists: app submission

John Todd jtodd at loligo.com
Tue Aug 14 18:04:38 CDT 2007


My company has built app_list.c, which creates named arrays.  It's 
not the prettiest app in the world, but it does what we need it to 
do.  It's biggest fault right now is that it won't auto-destroy the 
lists when the channel exits, so anyone wanting to build a flag for 
that would be welcome to submit to me any patches.

Since the bugtracker is now deemed "off-limits" for submitting 
feature requests, I suppose that leaves only the list as a location 
for discussion of such things, though I don't quite know where to 
submit the code for archival review, as I don't want to publish it on 
our corporate website.  I suppose I'll put it on my website, eh?  The 
credit for writing this app goes to Ritesh Bansal at TalkPlus, and he 
has signed the disclaimer as well.

Anyway, it could probably suffer to be a function, but I don't know 
if the action features of the application would lend themselves to 
being split away from the setting/getting features.   And developing 
both a function and an app seems redundant.

So, here's the description.  Let me know if anyone thinks this might 
be a useful addition, and I'll put it in bugs.digium.com.  Otherwise, 
it will live on my web server.

http://www.loligo.com/asterisk/misc/apps/app_list.c

static char *descrip = "This application gives the user a name based 
list capabilities in the dialplan.\n"
  "This is useful in creating array-like list in the dialplan.\n"
  "The following commands are available\n"
  "    List(INIT|name|len|reinitialize|[var1|var2|...])\n"
  "      name is the name of the list in this channel. You can have many \n"
  "      lists with different names for the same channel.\n"
  "      len is the length of the list.\n"
  "      reinitialize has values of 0 and 1. If 1 then if the list exists\n"
  "      then it will be reinitailized. If 0 and the list exists then it\n"
  "		will return an error.\n"
  "      You can additionally pass up to 99 variables to be put in the list.\n"
  "    List(SET|name|index|[value])\n"
  "      index is the element you want to set and value is the value.\n"
  "      If value is not passed then the element value is set to NULL.\n"
  "    List(GET|name|index|variable)\n"
  "      index is the element you want to get and variable is the name of the\n"
  "      dialplan variable in which the value will be stored\n"
  "    List(LEN|name|variable)\n"
  "      Returns the length of the list in the variable.\n"
  "    List(SIZE|name|variable)\n"
  "      Returns size integer in the variable. Size is the number of elements\n"
  "      that are not null and have some value. These may not be contiguous\n"
  "      elements.\n"
  "    List(INSERT|name|index|value)\n"
  "      Insert a element with the value at index position. This 
increases the\n"
  "      length of the list by 1.\n"
  "    List(REMOVE|name|index|variable)\n"
  "      Remove a element at index position. This decreases the\n"
  "      length of the list by 1. The value removed is returned in variable.\n"
  "    List(DESTROY|name)\n"
  "      This frees up the memory and the list. This must be called before\n"
  "      exit of the dialplan for a call or the system will have a 
memory leak.\n"
  "    List(DUMP|name)\n"
  "      Dumps the list info using a LOG_NOTICE mechanism.\n"
  "\n";




JT



More information about the asterisk-dev mailing list