[Asterisk-Dev] PATCH - Adds a set'able text string for each channel

Adam Goryachev mailinglists at websitemanagers.com.au
Wed May 19 22:17:47 MST 2004


On Thu, 2004-05-20 at 13:36, Adam Goryachev wrote:
> On Wed, 2004-05-19 at 02:37, James Golovich wrote:
> > On Tue, 18 May 2004, Adam Goryachev wrote:
> > > OK, basically the patch allows the manager api to set a "string" on a
> > > specific channel. This string is kept with the channel until the channel
> > > is destroyed/hungup. So, it is kept through parking, transfers, etc. (At
> > > least, I assume this is so... haven't really tested it that much yet).
> > > 
> > > It also adds a new event to tell everyone else listening on manager
> > > interfaces that the text has been set for that channel.
> > > 
> > > This is used to store 'bits' of data with a channel within asterisk
> > > without needing to use a seperate sql db.
> > > 
> > 
> > I really don't see a reason to bloat the ast_channel struct with this.
> > Why don't you simply use a channel variable to store your arbitrary info
> > in?  There might not be an easy way to set channel variable with manager
> > interface currently, but it should be easy to implement
> 
> Hmmm, this is an interesting idea... It would allow setting of the text
> from the dialplan as well.  I suppose the main question is whether the
> variables are indeed specific to that channel, or if they are global? I
> don't want them 'stepping' on each other...
> 
> It sounds like what I want to do is simply use the same manager
> interface like this:
> Action: Setvar
> Channel: Zap/1-1
> Variable: mytext
> Value: blahblah
> 
> This would be the same as:
> Setvar(mytext=blahblah)
> when channel zap/1-1 was still running through the dialplan.
> 

Well, actually, that was really easy to implement.

The question now is, how to implement/allow the manager interface to
retrieve channel variables?

In the dialplan they are accessed as ${foo} but in the manager API I
suppose we need something more like:
Action: Getvar
Channel: Zap/1-1
Variable: blahblah

or should it be Action: Readvar ?

What about setting/reading global vars?
Perhaps:
Action: Getvar
Channel: Global
Variable: blahblah

I can probably easily implement this stuff, and make a diff, but I would
really like to get some feedback from other people (especially as
regards the Action etc commands being in/out put).

Also, currently I am sending an event for each setvar. This basically
broadcasts the variable name + value to other manager 'listeners'.

Should this be 'standard' practice, or is this somewhat unusual to be
sending events for something that doesn't really affect a channel.

Perhaps this:

Action: Setvar
Channel: Zap/1-1
Variable: mytext
Value: blahblah
Event: 1

Which by default is 0 don't broadcast, or can be specified as 0 (don't
send event) or 1 (send event).

Again, I would appreciate feedback/suggestions, or being told to just
stop bugging everyone because none of it will ever be useful for anyone
else (or a more appropriate place/person to bug).

Regards,
Adam





More information about the asterisk-dev mailing list