Setting `userfield` from within a callfile

Home » Asterisk Users » Setting `userfield` from within a callfile
Asterisk Users No Comments

On Monday 20 Dec 2010, Olivier wrote:
> 2010/12/20 A J Stiles
> > Our current Asterisk setup includes a CGI auto-dial application
> > (written by someone else before me) which sets up calls by creating
> > files of
> > the general form
> >
> > Context: $CONTEXT
> > Extension: $OUTSIDE_NUMBER
> > Priority: 1
> > CallerId: $INSIDE_NUMBER
> >
> > in /var/spool/asterisk/outgoing/ .
> >
> > It works very well. However, it would be nice to be able to attach an
> > additional piece of information along with the call record There is a
> > userfield in the SQL database, which is a VARCHAR(255) and would be
> > plenty for what we need. Is there a way to set the userfield of the CDR
> > database from within such a callfile?
> Yes, adding a Set field in your call file (see
>, you’ll be able
> to pass everything you need to your dialplan, and then, from there, write
> everything you need to your CDR.

I’ve got it working now! Thanks Olivier and Tilghman.

Now, for the benefit of anyone who may be searching the archives of this
mailing list at some point in the future, here’s what I did.

I have modified the callfile-generating CGI script to added an extra line to
the callfile, something like;

Set: uid=$UID

and made sure that the calls it places are in a context of their own. In my
extensions.conf, I then have as part of that context, a line ending with the
… ,Set(CDR(userfield)=${uid})

and it all Just Works Beautifully.

Thanks again, everyone. Asterisk truly is a wonderful piece of software.