How to add custom script

Discussion in 'General' started by lol24h, Oct 5, 2010.

  1. lol24h

    Joined:
    Jul 16, 2010
    Messages:
    12
    Likes Received:
    0
    I have no clue how to add custom script when taking a call.
    I assume, everything is configure, I just want to add one action , like running custom per script . I added that to extension_custom.conf, bu it doesn't work, nothing is shown in logs related to that script like "Launched AGI" etc.

    This was added to extension_custom.conf

    [from-internal-additional-custom]
    exten => 111,2,AGI(/home/mastier/call-notify.pl|${CALLERID(name)}|${CALLERID(number)})
     
  2. saugortgarcia

    Joined:
    Sep 11, 2009
    Messages:
    9
    Likes Received:
    0
    Hi,

    Did you include your context? Check the 10 first lines of extensions_custom.conf, so you can see what I mean.

    Also, I not sure if you need to do some changes to your file:
    exten => 111,2,AGI(/home/mastier/call-notify.pl|${CALLERID(name)}|${CALLERID(number)})

    should be:
    exten => 111,2,AGI(call-notify.pl,${CALLERID(name)},${CALLERID(number)})

    because in /var/lib/asterisk/agi-bin is where asterisk look the scripts, also you will to give execution permisions to your script, chmod 755
     
  3. lol24h

    Joined:
    Jul 16, 2010
    Messages:
    12
    Likes Received:
    0
    I fixed that but it doesn't seem to work

    My simple script:
    Code:
    
    #!/usr/bin/perl
    use Asterisk::AGI;
    
    print "It WOOORXXX","\n";
    
    open FILE,'>>', "/root/test.txt" or die "Can't open file: $!";
    print FILE $ARGV[1];
    print FILE "\n";
    close FILE;
    
    root@kalmar /root 0# ls -la /var/lib/asterisk/agi-bin/call-notify.pl
    -rwxr-xr-x 1 asterisk asterisk 177 pa? 6 13:06 /var/lib/asterisk/agi-bin/call-notify.pl

    root@kalmar /root 0# ls -la /root/test.txt
    -rw-rw-rw- 1 asterisk asterisk 22 pa? 6 12:59 /root/test.txt
     

Share This Page