[asterisk-users] perform tasks outside a dial-plan (not during acall)

Danny Nicholas danny at debsinc.com
Fri Jul 30 08:33:55 CDT 2010


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 


More information about the asterisk-users mailing list