When I run manually on the command line the call is processed without an error. But when I schedule it using crontab
/home/myfolder/scripts/test.sh
I get this error on asterisk
[Jul 26 08:15:01] WARNING[2100]: pbx_spool.c:290 parse_line: Unknown keyword ‘-e Channel’ at line 1 of /var/spool/asterisk/outgoing/test.call
[Jul 26 08:15:01] WARNING[2100]: pbx_spool.c:327 apply_outgoing: At least one of app or extension must be specified, along with tech and dest in file /var/spool/asterisk/outgoing/test.call
[Jul 26 08:15:01] WARNING[2100]: pbx_spool.c:517 scan_service: Invalid file contents in /var/spool/asterisk/outgoing/test.call, deleting
I haven’t never been a fan of call files, but assuming you don’t want to use all the option you have with the call file, and is just originate a call every 1 minute. You can schedule the same task with
Hi @ambiorixg12 Thanks for the reply,
Actually, test.call file is just part of a bigger sh file created. What I’m trying to do is have my linux server read a MySQL table for newly inserted columns every minute then if it found a new entry, it will execute some scripts off that MySQL table then have it create a call file to be executed by asterisk based on the touch date and time.
@ambiorixg12 Yes, what I currently don’t understand is when I manually execute the sh file in the command line is creates the call file correctly, But when it is configured to run via crontab, ‘-e’ is added before the ‘Channel: SIP/207’ line
Well the The ‘ -e ‘ option in Linux acts as interpretation of escaped characters that are backslashed. But looks here all after the echo command is added
As a workaround you can try adding the call files parameters on more than one echo to avoid the e option.
Please wrap code and console snippets in ‘preformatted text’ tags so the forum does not mung your post by eating significant characters, change quotes to ‘smart quotes’ etc.
‘sh’ does not understand ‘-e.’
If you break your single echo into multiple statements it will be easier to debug and maintain.
If you create your call file in /tmp/ and /tmp/ is not on the same file system as your outgoing spool directory, you introduce the possibility of a race condition where Asterisk could process a partial file. One way to eliminate it would be to create a ‘tmp’ directory in the outgoing spool directory and then ‘mv’ the file to the outgoing spool directory.
If you enable ‘archive’ you can look at the call file after processing. It will be in the ‘outgoing_done’ directory. This also helps when things don’t work.
The simplicity of a single command has appeal, certainly for debugging or hacking out a quick test, but call files seem more ‘featureful.’ With the originate command, can you:
Specify the caller ID?
Specify retries?
Specify the priority?
Set variables?
I know you could specify a local channel and handle this kind of stuff there, but sometimes you need to change these things on a call-by-call basis.
I was asking about the CLI originate command that you proposed, not the originate() application. The originate() application appears to be much more featureful than the CLI command.
As of Asterisk 18.4, #1 and #4 are now possible with the Originate application.
I’ve now converted 90%+ of my call files to Originate, only ones left are things that are for the future or with retries.