[asterisk-bugs] [Asterisk 0016905]: system() dialplan function does not work
Asterisk Bug Tracker
noreply at bugs.digium.com
Sun Feb 28 19:19:25 CST 2010
The following issue has been UPDATED.
======================================================================
https://issues.asterisk.org/view.php?id=16905
======================================================================
Reported By: ip-rob
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 16905
Category: Applications/app_system
Reproducibility: always
Severity: major
Priority: normal
Status: new
Asterisk Version: 1.6.2.4
JIRA:
Regression: No
Reviewboard Link:
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Request Review:
======================================================================
Date Submitted: 2010-02-25 14:51 CST
Last Modified: 2010-02-28 19:19 CST
======================================================================
Summary: system() dialplan function does not work
Description:
You can put any script passed as an argument to the system() command in a
dialplan and it will not execute. In my example, I created the following
script:
#!/bin/bash
ls -l /tmp > /usr/src/temp.txt
in file /usr/src/temp.sh. temp.sh is 755 so any user can execute it. In
the dialplan I put a simple call to system using this dialplan
exten => 101,1,Set(__FROM_DID=${EXTEN})
exten => 101,n,system(/usr/src/temp.sh)
The asterisk log shows
[Feb 25 15:12:11] VERBOSE[23375] pbx.c: -- Executing
[101 at from-trunk:1] ^[[1;36mSet^[[0m("^[[1;35mSIP/DefaultOut-00000006^[[0m",
"^[[1;35m__FROM_DID=[Feb 25 15:12:11] VERBOSE[23375] pbx.c: --
Executing [101 at from-trunk:2]
^[[1;36mSystem^[[0m("^[[1;35mSIP/DefaultOut-00000006^[[0m",
"^[[1;35m/usr/src/temp.sh^[[0m") in new stack
The script does not execute as there is no output file /usr/src/temp.txt.
Executing the command from the asterisk command line as
"!/usr/src/temp.sh" DOES work without issue.
======================================================================
----------------------------------------------------------------------
(0118665) ip-rob (reporter) - 2010-02-28 19:19
https://issues.asterisk.org/view.php?id=16905#c118665
----------------------------------------------------------------------
I was able to reproduce the problem I am having and it is more specific to
ExecIf and the system command. Here are the dialplan lines and the
resulting log. The first system() command runs fine and the email
generated by the fax-process.pl is received. The second with an ExecIf
does not even though the conditions are true. The commands are identical.
exten => 9999,n,Set(FAX_RX_EMAIL=test at test.com)
exten => 9999,n(process),system(${ASTVARLIBDIR}/bin/fax-process.pl --to
${FAX_RX_EMAIL} --from "testfax at testfax.com" --dest "${FROM_DID}" --subject
"New fax from Test 1" --attachment fax_testnum.pdf --type application/pdf
--file /var/spool/asterisk/fax/1266605097.367.tif)
exten => 9999,n(process),ExecIf($["${FAX_RX_EMAIL}" !=
""]?system(${ASTVARLIBDIR}/bin/fax-process.pl --to ${FAX_RX_EMAIL} --from
"testfax at testfax.com" --dest "${FROM_DID}" --subject "New fax from Test 2"
--attachment fax_testnum.pdf --type application/pdf --file
/var/spool/asterisk/fax/1266605097.367.tif))
Resulting log
[Feb 28 18:55:06] VERBOSE[10689] pbx.c: -- Executing
[9999 at from-trunk:3]
^[[1;36mSystem^[[0m("^[[1;35mSIP/DefaultOut-0000005a^[[0m",
"^[[1;35m/var/lib/asterisk/bin/fax-process.pl --to myemail --from
"testfax at testfax.com" --dest "9999" --subject "New fax from Test 1"
--attachment fax_testnum.pdf --type application/pdf --file
/var/spool/asterisk/fax/1266605097.367.tif^[[0m") in new stack
[Feb 28 18:55:07] VERBOSE[10689] pbx.c: -- Executing
[9999 at from-trunk:4]
^[[1;36mExecIf^[[0m("^[[1;35mSIP/DefaultOut-0000005a^[[0m",
"^[[1;35m1?system(/var/lib/asterisk/bin/fax-process.pl --to myemail --from
"testfax at testfax.com" --dest "9999" --subject "New fax from Test 2"
--attachment fax_testnum.pdf --type application/pdf --file
/var/spool/asterisk/fax/1266605097.367.tif)^[[0m") in new stack
Issue History
Date Modified Username Field Change
======================================================================
2010-02-28 19:19 ip-rob Note Added: 0118665
2010-02-28 19:19 ip-rob Status closed => new
2010-02-28 19:19 ip-rob Resolution no change required =>
reopened
======================================================================
More information about the asterisk-bugs
mailing list