AGI problem

hi, i use asterisk-1.4.18 on CentOS 4.3 and i installed asterisk-perl.
here is my context in extensions.conf

exten => 100,1,SayDigits(123)
exten => 100,2,AGI(xxxx.agi)

if xxxx is “agi-test.agi” file in “/var/lib/asterisk/agi-bin” directory, it run well. But when xxxx is my file “test.agi” (i copy all the content of “agi-test.agi” file into this file), i got error :

    -- Executing [100@from-sip:1] SayDigits("SIP/101-093dbfa0", "123") in new stack
    -- <SIP/101-093dbfa0> Playing 'digits/1' (language 'en')
    -- <SIP/101-093dbfa0> Playing 'digits/2' (language 'en')
    -- <SIP/101-093dbfa0> Playing 'digits/3' (language 'en')
    -- Executing [100@from-sip:2] AGI("SIP/101-093dbfa0", "test1.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/test1.agi
  ==  test1.agi: Failed to execute '/var/lib/asterisk/agi-bin/test1.agi': No such file or directory
    -- AGI Script test1.agi completed, returning 0
  == Auto fallthrough, channel 'SIP/101-093dbfa0' status is 'UNKNOWN'

I gave the permission 755 on test1.agi file, and it is located in “/var/lib/asterisk/agi-bin” directory. I have searched google but cannot find solution to my problem.
Please help me.
thank you.

Asterisk tried to execute test1.agi not test.agi…


Marco Bruni

Hi, i’m sorry. Because I edited my file many times.
My English is bad so i don’t know how to express my problem.

My extensions file :

exten => 1000,1,Saydigits(123)
exten => 1000,n,Wait(1)
exten => 1000,n,AGI(test.agi)

I copy all content of /var/lib/asterisk/agi-bin/agi-test.agi file into my test.agi file and upload into /var/lib/asterisk/agi-bin/ directory and make it has all permission to run (777)

Here is result :

Verbosity is at least 3
    -- Executing [1000@from-sip:1] SayDigits("SIP/101-09661dd0", "123") in new stack
    -- <SIP/101-09661dd0> Playing 'digits/1' (language 'en')
    -- <SIP/101-09661dd0> Playing 'digits/2' (language 'en')
    -- <SIP/101-09661dd0> Playing 'digits/3' (language 'en')
    -- Executing [1000@from-sip:2] Wait("SIP/101-09661dd0", "1") in new stack
    -- Executing [1000@from-sip:3] AGI("SIP/101-09661dd0", "test.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/test.agi
AGI Tx >> agi_request: test.agi
AGI Tx >> agi_channel: SIP/101-09661dd0
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1252915123.10
AGI Tx >> agi_callerid: 101
AGI Tx >> agi_calleridname: 101
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 1000
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: from-sip
AGI Tx >> agi_extension: 1000
AGI Tx >> agi_priority: 3
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode: 
AGI Tx >> 
AGI Rx << verbose "Failed to execute '/var/lib/asterisk/agi-bin/test.agi': No such file or directory" 2
  ==  test.agi: Failed to execute '/var/lib/asterisk/agi-bin/test.agi': No such file or directory
AGI Tx >> 200 result=1
    -- AGI Script test.agi completed, returning 0
  == Auto fallthrough, channel 'SIP/101-09661dd0' status is 'UNKNOWN'

I don’t know why this errors.
help me, please.

Hi, i don’t know how asterisk read .agi file but i use vi command to write my code (and give 755 permission). it’s work fine.
Perior, I use notepad to write my code, and then use SSH Client upload my file to /var/lib/asterisk/agi-bin/ directory. Maybe the feed line in windows cause this problem.
Hope that someone meet this problem can check out in his situation.


Please can you post the output of

ll /var/lib/asterisk/agi-bin/


Hi, here you are :

[root@localhost /]# ll /var/lib/asterisk/agi-bin/ 
total 240
-rwxr-xr-x  1 root root   1742 Sep 14 14:09 agi-test.agi
-rwxr-xr-x  1 root root  89627 Sep 14 14:09 eagi-sphinx-test
-rwxr-xr-x  1 root root 116192 Sep 14 14:09 eagi-test
-rwxr-xr-x  1 root root  14530 Sep 14 14:09 jukebox.agi
-rwxr-xr-x  1 root root    782 Sep 15  2009 test1.agi
-rwxr-xr-x  1 root root    332 Sep 15 14:50 test.agi
[root@localhost /]# 

Here is extensions.conf :

exten => 1000,1,Set(dem = 0)
exten => 1000,2,Set(path=xxxxxxxxx)
exten => 1000,3,Set(step=7)
exten => 1000,4,Set(ext=1000)
exten => 1000,5,Set(cont=from-sip)
exten => 1000,6,AGI(test1.agi)

test1 file has the content of agi-test.agi file.
When i copy content from agi-test.agi into notepad, it has no feedline.
When i copy to notepad plus ( it has feedline. And that causes the problem.

What is the exact first line of the script.