[asterisk-users] AGI script fails on IAX channels (from call file).

Tony Mountifield tony at softins.clara.co.uk
Sat Sep 15 12:15:53 CDT 2007


In article <46EC02A9.50309 at comcast.net>,
Jonas Arndt <jonas_arndt at comcast.net> wrote:
> Tony Mountifield wrote:
> > In article <46EAF68B.6070505 at comcast.net>,
> > Jonas Arndt <jonas_arndt at comcast.net> wrote:
> >   
> >> Call File
> >> =================== Call File ==========================
> >> channel: Local/3455 at internal
> >> maxretries: 3
> >> retrytime: 60
> >> waittime: 60
> >> callerid: "Test" <*66>
> >> application: AGI
> >> data: test.agi|670507
> >> ================= End Call File ========================
> >>     
> >
> > Instead of calling the application directly from the call file, make a
> > special extension for it, and call that extension instead:
> >
> > [foo]
> > exten => _X.,1,Answer(0.5)
> > exten => _X.,2,AGI(test.agi|${EXTEN})
> >
> > And then have the call file like this:
> >
> > Channel: Local/3455 at internal
> > Maxretries: 3
> > Retrytime: 60
> > Waittime: 60
> > CallerId: "Test" <*66>
> > Context: foo
> > Extension: 670507
> > Priority: 1
> >
> > The Answer line may or may not be necessary, but if you find it is, that
> > would explain why calling the AGI directly didn't work. In that case,
> > perhaps you could put the Answer within the AGI.
> 
> So the idea here is that the parameter, which I am calling the
> application with, will be dynamic. I am therefore struggling a bit with
> how your solution would work in the long run. It could be a good test
> though. Your Extension line in the call file (670507) will match that in
> the extensions.conf, right? What I have tried is

Yes, I figured that the 670507 part will be dynamic, which is why I used
a separate context [foo], with a wildcard extension _X., which will match
any extension of two or more digits. I then put the extension number into
the parameter list for the AGI.

So instead of generating "data: test.agi|12345" in the call file you
generate "extension: 12345" and that then finds its way through to the
AGI command.

> ================ Call File ========================
> channel: Local/3455 at internal
> Context: internal
> Extension: *66
> Priority: 1
> ================================================
> 
> Then in the extensions.con
> 
> ============= extensions.conf =====================
> exten => *66,1,Answer
> exten => *66,2,AGI(test.agi|670507)
> exten => *66,3,Hangup
> ================================================
> 
> This is also not an elegant solution as I have hard coded the parameter.
> However, it is just for test. As you can see I am also answering the
> channel here. I have exactly the same problem here. On SIP phones it
> work great and on IAX (iaxy) phones it fails. I can't get the AGI script
> to see the DTMF even if pushing the keys generates events in an iax2
> trace.

OK, this solution is technically the same as mine, concerning channel
handling, so if you are still not getting DTMF, that is a problem.

Please try adding a delay parameter to Answer, or a separate Wait line:

exten => _X.,1,Answer(0.5)

or:

exten => _X.,1,Answer
exten => _X.,n,Wait(0.5)

It might be that something in the channel is not finished setting up
before you call your AGI. I always have a small delay after answering.

> So:
> 
> ============================== Conclusions ================================
> IAX Phone => Dial Plan => AGI script                                    
>             "Works with DTFM"
> Call File => IAX Phone + AGI script                                  
>                    "Fails, not DTMF communication"
> Call File => IAX Phone + Extension in dial plan => AGI Script        
> "Fails, not DTMF communication"
> SIP => Work always
> ============================== Conclusions ================================
> 
> Unfortunately I am heading out for a week long Europe trip on Monday.
> I'll try to play with this a bit more on Sunday and see if I can make
> some progress.

OK, hope you have some success.

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list