Externnotify Script Not Running

Home » Asterisk Users » Externnotify Script Not Running
Asterisk Users 8 Comments

Hi all,

I’m trying to build a custom voicemail delivery system using externnotify in voicemail.conf. But, the configured script doesn’t seem to run.

I have:

externnotify=/home/phones/commands/deliver_vm.pl ${VM_NAME} ${VM_DUR} $
{VM_MSGNUM} ${VM_MAILBOX} ${VM_CALLERID} ${VM_DATE}

The deliver_vm.pl has read and execute permissions.

Here is the file I have:

===============================================================
#!/usr/bin/perl

$a = join(“\t”, @ARGV);
open FILE, “>>/tmp/test.txt”;
print FILE “$a\n”;
close FILE;
===============================================================

After I leave a voicemail message, I expect to find something in /tmp/test.txt, but I don’t.

What am I missing?

Thanks in advance.

Mike.

8 thoughts on - Externnotify Script Not Running

  • Thanks for getting back to me. The system in question is old enough to predate systemd, but I did move the output file to /home/phones/ directory just to be sure. Same results. BTW, the program does what I expect when it is run by hand.

    Any other ideas?

    Mike.

  • Hello,

    maybe selinux could be the cause?

    Marek

    Sent with ProtonMail secure email.

    ——- Original Message ——-

  • No, this machine doesn’t have selinus installed/configured/enforced.

    Is there a debug setting I could use to debug this? I didn’t see anything in the logs.

    Perhaps there is a working configuration that someone would share?

    Thanks again,

    Mike.

  • Can I suggest you eliminate a few obvious factors…

    Like 1. try a bash script first instead of perl, 2. Have the bash script just issue a “logger’ command

    If that works go back to perl which does the same. If that works, change you perl script to dump all vars to a file..etc.

    Also, check your script for nonprintable characters. Does the script run from the command line? (if you feed it vars)

    —–Original Message—–
    From: asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] —

  • These were all good ideas. I changed my script to a bash script called deliver_vm.sh:

    ======================================================
    #!/bin/bash

    echo testme >> /home/phones/test.txt
    ======================================================

    The permissions are correct:

    # ls -la commands/deliver_vm.*
    -rwxr-xr-x 1 root root 254 Mar 16 21:12 commands/deliver_vm.pl
    -rwxrwxrwx 1 root root 50 Mar 17 14:17 commands/deliver_vm.sh

    It does run from the command line, but still not from Asterisk.

    It feels like a configuration issue in Asterisk. Here is what I have:

    externnotify=/home/phones/commands/deliver_vm.sh ${VM_NAME} ${VM_DUR} $
    {VM_MSGNUM} ${VM_MAILBOX} ${VM_CALLERID} ${VM_DATE}

    After I made the change, I did:

    module reload app_voicemail.so

    Anything else I can check/do?

    Thanks again,

    Mike.

  • Unless someone else chimes in (who knows for sure)…

    I wonder if Asterisk restricts location of file it will run. Try moving to /var/lib/asterisk as a test and see if it executes

    Next I would start to wonder about the other obvious stuff…very hard to see if you have been looking at it for hours. Try 777 permission on the file and perhaps up the path leading to the file. (just to experiment)

    Try complete service restart of Asterisk

    …and after that I’m out of helpful ideas. You may have to retrace your steps for something you missed, since this all seems pretty straight forward. (I haven’t tryied, but if verbose it up on the CLI will you see a message/error when ast tries to run your scrip)

    —–Original Message—–
    From: asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] —

  • Well, I didn’t get it working, but I was able to work around this.

    I have an agi script, hangup.agi, assoicated with the h extension.

    In that script, I make a call to system() that runs the script I wanted to run for vm delivery.

    This works for me.

    Thanks for your time.

    Mike.