System() Dialplan Application Problem

I’m having some trouble with the System() dialplan application, when attempting to execute an Asterisk command.

I want to simply get the SLA from a queue, so I have the following.

System(asterisk -rx 'show queue theQueue' | string -a | grep SL: | cut -d' ' -f18 | cut -d: -f2 > /tmp/${UNIQUEID}-sla)

This puts the current SLA into a file in the /tmp directory, which will get read by the ReadFile() application.

The above works from the command line, but doesn’t from within the dialplan. No errors are thrown up, it just doesn’t output anything.

Any ideas?

Hi best option with this is to write the “command” as a script and call the script from the System command, Also make sure that it will run when logged in as the user that Asterisk is running as, more than likely asterisk. so su asterisk then run the command

Ian

Thanks for the reply.

I placed this in to a script, and the script is executable by the user Asterisk is running as.

However, it still doesn’t work. Seems it is down to the format of the speech marks and/or single quotes. I cannot seem to get the right combination to work within the System() application.

From the OS CLI, it works fine.

Just to report back, I had this in a script and it’s working find - stripped everything out and started again (just this dialplan by the way, not the whole OS and/or Asterisk).

The only thing I can think that went wrong was the ‘string -a’ should have been ‘strings -a’.

Hi

Having read what you were using the scrip for, you may be better actually working out the Service level your self from answered lost and the ring time as i have found the service level returned in the queue log to be a little bit generous. Asternic do a nice script that stores the queue login a mysql database.

Ian

[quote=“loopy66”][u][size=85]I’m having some trouble with the System() dialplan application, when attempting to execute an Asterisk command, starting with a group of Denver phone systems I am rolling out into production.
I want to simply get the SLA from a queue, so I have the following.

System(asterisk -rx 'show queue theQueue' | string -a | grep SL: | cut -d' ' -f18 | cut -d: -f2 > /tmp/${UNIQUEID}-sla)

This puts the current SLA into a file in the /tmp directory, which will get read by the ReadFile() application.
The above works from the command line, but doesn’t from within the dialplan. No errors are thrown up, it just doesn’t output anything.
Any ideas?[/size][/u][/quote]

Loopy, were you able to confirm this as the absolute answer? I can reproduce this but would really like to know why. :smile:

[quote=“ianplain”][size=85]Hi
Having read what you were using the scrip for, you may be better actually working out the Service level your self from answered lost and the ring time as i have found the service level returned in the queue log to be a little bit generous. Asternic do a nice script that stores the queue login a mysql database.
Ian[/size]
[/quote]

Has anyone put this into a working model? Do you know if this will also work from an online/hosted mysql database? Also, has anyone thought about going about SLA by using xml services for one touch parks, labeling the parking spaces as “lines” for the customers sake, and using hinting to monitor them?

Thanks!

Hi dear best option with this is to write the “command” as a script and call the script from the System command, Also make sure that it will run when logged in as the user that Asterisk is running as, more than likely asterisk…!!! :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: