A J Stiles
2010-Dec-21 10:49 UTC
[asterisk-users] SOLVED: Re: Setting `userfield` from within a callfile
On Monday 20 Dec 2010, Olivier wrote:> 2010/12/20 A J Stiles <asterisk_list at earthshod.co.uk> > > > Our current Asterisk 1.6.2.9 setup includes a CGI auto-dial application > > (written by someone else before me) which sets up calls by creating > > files of > > the general form > > > > Channel: SIP/$INSIDE_NUMBER > > 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 > http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out), 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 command ... ,Set(CDR(userfield)=${uid}) and it all Just Works Beautifully. Thanks again, everyone. Asterisk truly is a wonderful piece of software. -- AJS
Tilghman Lesher
2010-Dec-21 22:12 UTC
[asterisk-users] SOLVED: Re: Setting `userfield` from within a callfile
On Tuesday 21 December 2010 04:49:42 A J Stiles wrote:> On Monday 20 Dec 2010, Olivier wrote: > > 2010/12/20 A J Stiles <asterisk_list at earthshod.co.uk> > > > > > Our current Asterisk 1.6.2.9 setup includes a CGI auto-dial > > > application (written by someone else before me) which sets up > > > calls by creating files of > > > the general form > > > > > > Channel: SIP/$INSIDE_NUMBER > > > 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 > > http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out), 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 command > ... ,Set(CDR(userfield)=${uid}) > > and it all Just Works Beautifully.You shouldn't need to. You should be able to just do: Set: CDR(userfield)=$UID in your spoolfile and it should work from there. -- Tilghman