It looks like the answer is yes.

http://crazytechthoughts.blogspot.ca/2011/12/call-external-program-from-mysql.html

From the page, here is code to execute a UDF library and call a shell. Clearly there would be a heavy penalty to launching a shell so you would want to carefully evaluate the frequency this is executed on your system.
|
DELIMITER @@|
|CREATE| |TRIGGER| |Test_Trigger |
|AFTER| |INSERT| |ON| |MyTable |
|FOR| |EACH ROW |
|BEGIN|
|||DECLARE| |cmd ||CHAR||(255);|
|||DECLARE| |result ||int||(10);|
|||SET| |cmd=CONCAT(||'sudo /home/sarbac/hello_world '||,||'Sarbajit'||);|
|||SET| |result = sys_exec(cmd);|
|END||;|
|@@|
|DELIMITER ;

|
-dbc

Message: 1
Date: Tue, 18 Sep 2012 15:41:46 -0400
From: Ahmed Munir <[email protected]>
Subject: [asterisk-users] Trigger Asterisk after data inserted in
        mysql
To: [email protected]
Message-ID:
        <CAGMN=JdbE5FdDSQXxZ9OrWXu3Pvgc-hj-EnPxUrG=rjhgsd...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi all,


I would like to know, is there a way to trigger Asterisk after data
inserted into mysql DB? Like here what I'm trying to do, when the new data
inserted into MySQL DB, it sends the request to Asterisk along with the new
data (that is inserted in DB) for making outbound call i.e. Realtime.

Currently I've set a cron job that execute my script every 30 seconds and
checks for a new data in DB. If new data is inserted in 30 seconds that
script will run and sends the data to Asterisk for making calls. (This is
the case which I'm thinking to avoid)

Please advise.


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to