Sample Header Ad - 728x90

Asterisk pbx agi php script with imagick imaging on the fly not working

0 votes
1 answer
90 views
### Problem description: Generate an image with an ASTERISK AGI PHP script that is displayed on a phone (Yealnk) using imagick.
installed:php-imagick/oldstable,now 3.4.4+php8.0+3.4.
The AGI PHP script consists of two parts: 1 Generating an image containing caller information, such as telephone number and a corresponding passport photo based on the telephone number. 2 Send this image to the phone. ### What works in the PHP script? 2: Send an existing image to the phone. If I use an existing image, it is sent to the phone and displayed without any problems. ### What doesn't work in the PHP script: 1: No image is generated with imagick. In the Asterisk CLI I see that the script is executed with a 0, so no error messages. ---- If I start the script as root in /usr/share/asterisk/agi-bin then everything works fine. Imagick generates an image and it is neatly delivered to the phone:
php script.php 01234567
But as soon as the script calls imagick it stops working, like this: $foto = new Imagick("/path/to/image/image.png"); ### What have I tried: 1 Used other image generators: gdimage and gmagick, but they have the same problem. 2 chown 777 script.php 3 Check whether Asterisk is passing the correct variables (that works fine) with the AGI command 4 Start PHP script in the CLI as another user (su otheruser) imagick does not work either. Can anyone point me in the right direction as to why imagick isn't generating images from an AGI in Asterisk? UPDATE: Ok, I've made some progress. I suspect it is a read and write permission case. When I write to /tmp, the script does not stop and indeed an image is written to /tmp. Reading that picture still causes problems. I continue searching.
Asked by Edderpet (1 rep)
Sep 13, 2023, 08:49 AM
Last activity: Sep 13, 2023, 01:52 PM