[asterisk-bugs] [Asterisk 0016905]: system() dialplan function does not work
Asterisk Bug Tracker
noreply at bugs.digium.com
Mon Mar 1 18:43:23 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-03-01 18:43 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.
======================================================================
----------------------------------------------------------------------
(0118728) ip-rob (reporter) - 2010-03-01 18:43
https://issues.asterisk.org/view.php?id=16905#c118728
----------------------------------------------------------------------
Additional testing has shown the following:
- ExecIf does not always have an issue. Running my previous temp.sh
scripts work ok.
- The dialplan below will not work. The problem is clearly with the
ExecIf since the exact same command will work with a direct System function
call. But when ExecIf is added, it does not work.
- The condition has been verified to be true.
[ext-fax]
include => ext-fax-custom
exten => s,1,Macro(user-callerid,)
exten => s,n,Noop(Receiving Fax for: ${FAX_RX_EMAIL} , From:
${CALLERID(all)})
exten => s,n(receivefax),ReceiveFAX(${ASTSPOOLDIR}/fax/${UNIQUEID}.tif)
exten => h,1,GotoIf($["${FAXSTATUS:0:6}" = "FAILED"]?failed)
exten => h,n(process),ExecIf($["${FAX_RX_EMAIL}" !=
""]?system(${ASTVARLIBDIR}/bin/fax-process.pl --to ${FAX_RX_EMAIL} --from
"myfax at freepbx.org" --dest "${FROM_DID}" --subject "New fax from
${URIENCODE(${CALLERID(name)})} ${URIENCODE(<${CALLERID(number)}>)}"
--attachment fax_${URIENCODE(${CALLERID(number)})}.pdf --type
application/pdf --file ${ASTSPOOLDIR}/fax/${UNIQUEID}.tif))
exten => h,n(end),Macro(hangupcall,)
exten => h,process+101(failed),Noop(FAX ${FAXSTATUS} for: ${FAX_RX_EMAIL}
, From: ${CALLERID(all)})
exten => h,n,Macro(hangupcall,)
FreePBX has worked around the problem by changing from ExecIf to GotoIf.
Several FreePBX users have the same issue on 1.6.2.
See
http://www.freepbx.org/forum/freepbx/users/fax-process-pl-not-executing-under-1-6-2-2#comment-24434
and
http://www.freepbx.org/trac/ticket/4096
Issue History
Date Modified Username Field Change
======================================================================
2010-03-01 18:43 ip-rob Note Added: 0118728
2010-03-01 18:43 ip-rob Status closed => new
2010-03-01 18:43 ip-rob Resolution unable to reproduce =>
reopened
======================================================================
More information about the asterisk-bugs
mailing list