Harel Cohen
2010-Jul-30 13:17 UTC
[asterisk-users] perform tasks outside a dial-plan (not during a call)
Hi all, Can the Asterisk do ?things? not during a call? For example I would like to change my dial plan during certain hours\dates or I would like to check some information in the astdb (e.g. counters of al sort) and handle it as required and so on. All of this is not call-related therefore I don?t know if I can somehow do it using the dial-plan applications\functions. I know I can do chron jobs on the Linux level but for maintenance and readability I would prefer to do these tasks from within the Asterisk. Is it possible to configure the Asterisk to perform routine tasks on certain times or certain intervals? Thanks, Harel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100730/557169b7/attachment.htm
Gareth Blades
2010-Jul-30 13:30 UTC
[asterisk-users] perform tasks outside a dial-plan (not during a call)
Harel Cohen wrote:> Hi all, > > Can the Asterisk do ?things? not during a call? For example I would like > to change my dial plan during certain hours\dates or I would like to > check some information in the astdb (e.g. counters of al sort) and > handle it as required and so on. All of this is not call-related > therefore I don?t know if I can somehow do it using the dial-plan > applications\functions. I know I can do chron jobs on the Linux level > but for maintenance and readability I would prefer to do these tasks > from within the Asterisk. > > Is it possible to configure the Asterisk to perform routine tasks on > certain times or certain intervals? > > Thanks, > > Harel >It would depend on exactly what you wanted to do. If you wanted to change the dialplan then you would normally just call an AGI program and have that do diffeent things depending on the time of the day. If you wanted to check 'counters' then you would normally not store them in the built in internal database but store them in a sql database instead which can be monitored via an external program via a cron job. If you want asterisk to do things at particular times then you would generally have a program which connects to the asterisk manager interface and isue commands when required.
Danny Nicholas
2010-Jul-30 13:33 UTC
[asterisk-users] perform tasks outside a dial-plan (not during acall)
From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Harel Cohen Subject: [asterisk-users] perform tasks outside a dial-plan (not during acall) Can the Asterisk do "things" not during a call? For example I would like to change my dial plan during certain hours\dates or I would like to check some information in the astdb (e.g. counters of al sort) and handle it as required and so on. All of this is not call-related therefore I don't know if I can somehow do it using the dial-plan applications\functions. I know I can do chron jobs on the Linux level but for maintenance and readability I would prefer to do these tasks from within the Asterisk. Is it possible to configure the Asterisk to perform routine tasks on certain times or certain intervals? By definition, all dial-plan actions/functions have to be done from within a "call". This does not mean that you have to actually make a call at 3 in the morning. You can set up contexts to do these functions and use "Local" calls from AMI or cron to perform these functions. Let's use a simple example from your post: I want to see the Asterisk DB keys at a given point in time. In cron I could set up '15 4 * * * /usr/sbin/asterisk -rx "database show" ' to show me what the database contained at 4:15 am each day. But I don't get up until 6 and I want this in a file to look at later. So I make an AGI to do this instead. [dialplan-snapshot] Exten => s,1,answer Exten => s,n,AGI(snapshot.agi) Exten => s,n,hangup Now in cron I do this instead 15 4 * * * /usr/sbin/asterisk -rx "dial local at dialplan-snapshot" And Asterisk runs this context obediently just like I had woke up and dialled to this point. This may not be 100% correct due to mail-reformatting or guy at keyboard, but the concepts have been discussed in this list this month. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100730/f1526717/attachment-0001.htm