Nilesh Londhe
2006-Aug-30 20:07 UTC
[asterisk-users] How to run a batch file on the asterisk CLI
On the asterisk CLI, is there a way to invoke a sequence of CLI commands ala a batch job for the CLI to execute? Here is what I am trying to do on the CLI...and I am looking to automate this via a batch process. [root@asterisk ~]# asterisk -r ========================================================================Connected to Asterisk 1.2.10 currently running on asterisk (pid = 3042) Verbosity is at least 3 asterisk*CLI> database put cidname 18005551212 "Char String" asterisk*CLI> database put cidname 18005551213 "another char string" asterisk*CLI> database put cidname 18005551214 "Char String" ... ... asterisk*CLI> database put cidname 18005551215 "another char string" asterisk*CLI> database put cidname 18005551216 "another char string" asterisk*CLI> database put cidname 18005551217 "another char string" ... ... asterisk*CLI> database put cidname 18005551218 "another char string" asterisk*CLI> database put cidname 18005551219 "another char string" asterisk*CLI> database put cidname 18005551210 "another char string" asterisk*CLI> database put cidname 18005551211 "another char string" -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060830/6b3b99b8/attachment.htm
William Piper
2006-Aug-30 21:14 UTC
[asterisk-users] How to run a batch file on the asterisk CLI
Sounds like you need to invoke the asterisk -rx comand or do it via the manager api. I personally prefer doing it via php. You could write a php script like the following: shell_exec("/usr/sbin/asterisk -rx 'database put cidname 18005551212 Char String'"); bp On 8/30/06, Nilesh Londhe <lvnilesh@gmail.com> wrote:> > On the asterisk CLI, is there a way to invoke a sequence of CLI commands > ala a batch job for the CLI to execute? > > Here is what I am trying to do on the CLI...and I am looking to automate > this via a batch process. > > [root@asterisk ~]# asterisk -r > ========================================================================> Connected to Asterisk 1.2.10 currently running on asterisk (pid = 3042) > Verbosity is at least 3 > asterisk*CLI> database put cidname 18005551212 "Char String" > asterisk*CLI> database put cidname 18005551213 "another char string" > asterisk*CLI> database put cidname 18005551214 "Char String" > ... > ... > asterisk*CLI> database put cidname 18005551215 "another char string" > asterisk*CLI> database put cidname 18005551216 "another char string" > asterisk*CLI> database put cidname 18005551217 "another char string" > ... ... > asterisk*CLI> database put cidname 18005551218 "another char string" > asterisk*CLI> database put cidname 18005551219 "another char string" > asterisk*CLI> database put cidname 18005551210 "another char string" > asterisk*CLI> database put cidname 18005551211 "another char string" > > > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com <http://easynews.com/>-- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060830/df5f91f1/attachment.htm
Steve Edwards
2006-Aug-30 21:15 UTC
[asterisk-users] How to run a batch file on the asterisk CLI
If you meant "can Asterisk read a series of commands from a file" the answer is no, but something like the following may do: cat batch-file\ | awk '{printf "/usr/sbin/asterisk -r -x \"%s\"\n", $0}'\ | sh If you meant "can Asterisk be controlled from a batch job" the above may do if put into a file and executed using the "at" or "batch" commands. On Wed, 30 Aug 2006, Nilesh Londhe wrote:> On the asterisk CLI, is there a way to invoke a sequence of CLI commands ala > a batch job for the CLI to execute? > > Here is what I am trying to do on the CLI...and I am looking to automate > this via a batch process. > > [root@asterisk ~]# asterisk -r > ========================================================================> Connected to Asterisk 1.2.10 currently running on asterisk (pid = 3042) > Verbosity is at least 3 > asterisk*CLI> database put cidname 18005551212 "Char String" > asterisk*CLI> database put cidname 18005551213 "another char string" > asterisk*CLI> database put cidname 18005551214 "Char String" > ... > ... > asterisk*CLI> database put cidname 18005551215 "another char string" > asterisk*CLI> database put cidname 18005551216 "another char string" > asterisk*CLI> database put cidname 18005551217 "another char string" > ... ... > asterisk*CLI> database put cidname 18005551218 "another char string" > asterisk*CLI> database put cidname 18005551219 "another char string" > asterisk*CLI> database put cidname 18005551210 "another char string" > asterisk*CLI> database put cidname 18005551211 "another char string" >Thanks in advance, ------------------------------------------------------------------------ Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000