[Asterisk-Users] AGI problem

Ing. Angel Gomez Garcia angom at telnor.net
Fri Sep 19 00:41:18 MST 2003


    Hi.

    I have the next configuration... I dial from my analog phone in the 
TDM400P to extension 102, and the second agi works about 1 out of 10 
times, the other nine it gives me these error on the asterisk console:

    -- Starting simple switch on 'Zap/2-1'
    -- Executing Macro("Zap/2-1", "receivecall") in new stack
    -- Executing AGI("Zap/2-1", "receivecall.tcl") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/receivecall.tcl
    -- AGI Script receivecall.tcl completed, returning 0
    -- Executing Macro("Zap/2-1", "followme|s|92624663") in new stack
    -- Executing AGI("Zap/2-1", "followme.tcl") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/followme.tcl
  == Spawn extension (macro-followme, s, 1) exited non-zero on 'Zap/2-1' 
in macro 'followme'
  == Spawn extension (macro-receivecall, s, 2) exited non-zero on 
'Zap/2-1' in macro 'receivecall'
  == Spawn extension (home, 102, 1) exited non-zero on 'Zap/2-1'
    -- Hungup 'Zap/2-1'

and these in /var/log/asterisk/messages:

Sep 19 00:31:08 WARNING[458770]: File app_agi.c, Line 1277 (run_agi): No 
channel, no fd?

    Any idea on what might be wrong ? I have tested these way of doing a 
follow me routine on 3 different asterisk boxes, with different setups 
and i got the same result on all of them. The AGI's are suppoused to do 
a more complex task, like search in a database for a followme 
enabled/disable and the number to wich forward the call, etc. but, just 
for testing purposes, these is giving the same error.

    Thank's.

===============================================
    1) 1 X100P.
    2) 1 TDM400P with 1 fxs.

-----------------
zaptel.conf
-----------------
fxsks=1
fxoks=2
loadzone = us
defaultzone=us

-------------------
zapata.conf
-------------------
[channels]
usecallerid=yes
hidecallerid=no
musiconhold=default
callwaiting=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
echocancel=yes
echocancelwhenbridged=no
rxgain=0.1
txgain=0.0
group=1
immediate=no
callerid=asreceived
context=bell
signalling=fxs_ks
channel=1
musiconhold=default
callerid="Telefono de Estudio"<100>
context=home
signalling=fxo_ks
channel=2

--------------------------------
extensions.conf
--------------------------------
[general]
NContexto = home
NExten = s
NPrioridad = 1
NMacro = none
NPar1 = s
Npar2 = s
Extension = s
static=yes
writeprotect=no
[dialout]
exten => _9X.,1,StripMSD,1
exten => _X.,2,Dial,Zap/1/BYEXTENSION
exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
exten => 500,2,Dial(IAX2/guest at misery.digium.com/s at default)     ; Call 
the Asterisk demo
exten => 500,3,Playback(demo-nogo)      ; Couldn't connect to the demo site
[bell]
include => mailboxes
exten => s,1,setmusiconhold,default
exten => s,2,responsetimeout,20
exten => s,3,Dial,Zap/2&SIP/angel&SIP/danny|15|tTm
exten => s,4,BackGround,thanks
exten => s,104,BackGround,thanksbusy
exten => i,1,hangup
[mailboxes]
exten => 100,1,Voicemail,100
exten => 100,2,Hangup
exten => 101,1,Voicemail,101
exten => 101,2,Voicemail,
exten => 102,1,Voicemail,102
exten => 102,2,Voicemail,
exten => 103,1,Voicemail,103
exten => 103,2,Voicemail,
[home]
ignorepat => 9
include => dialout
include => parkedcalls
exten => 004,1,Echo()
exten => 004,2,Hangup()
exten => 005,1,Meetme()
exten => 005,2,Hangup()
exten => 008,1,VoicemailMain
exten => 008,2,Hangup
exten => 007,1,Record,thanks:gsm
exten => 007,2,Wait,1
exten => 007,3,Playback,thanks
exten => 009,1,MusicOnHold(random)
exten => 100,1,setmusiconhold,default
exten => 100,2,Dial,Zap/2|20|tTm
exten => 100,3,Congestion
exten => 100,4,Hangup()
exten => 101,1,Dial,SIP/danny|20|tTm
exten => 101,2,Congestion
exten => 102,1,Macro(receivecall)

[macro-receivecall]
exten => s,1,agi(receivecall.tcl)
exten => s,2,macro(${NMacro}|${NPar1}|${NPar2})

[macro-followme]
exten => s,1,agi(followme.tcl)
exten => s,2,noop
exten => s,3,goto(${NContexto}|${NExten}|1)

-------------------------
receivecall.tcl
-------------------------
#!/usr/bin/tclsh
source /var/lib/asterisk/agi-bin/agilib.tcl
parametros
puts stdout "SET VARIABLE Extension $agi(extension)"
gets stdin  linea
puts stdout "SET VARIABLE NMacro followme"
gets stdin  linea
puts stdout "SET VARIABLE NPar1 $agi(extension)"
gets stdin  linea
puts stdout "SET VARIABLE NPar2 92624663"
gets stdin  linea
exit 0

--------------------------
followme.tcl
--------------------------
#!/usr/bin/tclsh
source /var/lib/asterisk/agi-bin/agilib.tcl
parametros
puts stdout "VERBOSE \"mensaje 1\" 1"
gets stdin  linea
puts stdout "SET VARIABLE NContexto dialout"
gets stdin  linea
puts stdout "VERBOSE \"mensaje 2\" 1"
gets stdin  linea
puts stdout "SET VARIABLE NExten 96388210"
gets stdin  linea
puts stdout "VERBOSE \"mensaje 3\" 1"
gets stdin  linea
exit 0

--------------------------
agilib.tcl
----------------------
proc parametros {} {

        global agi

        set linea [gets stdin]
        while { [string length $linea] > 0 } {
                set subindice [string first ":" $linea]
                if { $subindice > 0 } {
                        set agi([string range $linea 4 [expr 
$subindice-1]]) \
                                [string trimleft [string range $linea \
                                        [expr $subindice+1] \
                                        [string length $linea]]]
                }
                set linea [gets stdin]
        }
}

==============================================================




More information about the asterisk-users mailing list