[Asterisk-Users] OT - C structure question

Asterisk asterisk at dotr.com
Thu Feb 24 09:41:45 MST 2005


I hae tried searching the web for the answer, but, man is there a lot of 
    pages ... :(

in the language I develop in, if I have a structure I can dynamically 
refer to the contents of a field of the structure like so:

MESSAGE SomeStructure:Field(SomeFieldName):Value

where SomeFieldName is either a quoted constant or a variable expressions

In "C", I beleive that you can refer to the contents of a "field" in a 
"structure" like so:

chan->context or
chan->exten

Is is possible to refer to these fields like

chan->(variable) where variable is either "context" or "exten" or an 
expression that resolves to a valid fieldname of the structure ?

My reason for asking is that I want to create an application that would 
take a channel and a field name and return the value of the field.

for example

GetChannelData("context")
GetChannelData("exten")

and I didn't want to have to declare a massive case statement, and have 
to modify the app everytime some new fields were added to the structure.

I know that some of these variables are already exposed, but was wanting 
to get some other values.

Julian





More information about the asterisk-users mailing list