[asterisk-dev] AGI:async

Salvatore Franco s.franco at fast-auto.it
Wed Nov 23 02:24:03 CST 2016


Hi Daniel,
the Queue works well if I use a SIP Client (Zoiper) but if I try to answer using AMI i receive that error :(

ARI command ANSWER only works if I use it on a single channel, the queue is a strange application that cannot be in Stasis directly.
Is writing my own queue the only way to handle calls via http in queue?

Thanks

Regards
Salvatore
Franco





Da: asterisk-dev-bounces at lists.digium.com
A: "Asterisk Developers Mailing List" asterisk-dev at lists.digium.com
Cc: 
Data: Tue, 22 Nov 2016 12:33:38 -0500
Oggetto: Re: [asterisk-dev] AGI:async



  
    
  
  
    Hi,

      

      Unfortunately, I wish I had a simple queue to share but my
      implementation is quite complex due to how I control the call on a
      per-operation basis.  If you choose this route then perhaps you
      can use store your channel/queue name(s) within simple storage
      elements such as a stack, array, or even a hashtable (although the
      last may not be ideal for retrieving calls in order) and then use
      AMI to control the calls from there.  Sorry I can't be more
      helpful in providing you an example.

      

      I imagine Asterisk queue's work though, so perhaps it might be
      worth your while to pursue that approach a bit more (unfortunately
      I've never tried them, so I can't tell you how it's done!).  That
      being said, perhaps getting Asterisk Queue's going will require a
      more step-by-step approach to figure out why it's not working for
      you.  Here are my suggestions:

      

      Have you tried the exact dialplans in the examples within http://www.voip-info.org/wiki/view/Asterisk+cmd+Queue
      ?  i.e.: Have you been able to get Asterisk queue's working
      without AMI?  If not, that might be where to start and then add
      AMI in afterward..

      

      Another suggestion I have is to use the QueueAdd AMI command,
      rather then calling Queue within your dialplan.  If you have
      success on doing something like an Answer/Playback via AMI, then
      you will probably have no issues with the QueueAdd AMI command. 
      Please try that and maybe you'll have more luck.  Here's the API
      reference:
      http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+QueueAdd

      

      Hope this helps & good luck,

      

      Daniel

      

      

      On 11/22/2016 10:35 AM, Salvatore Franco wrote:

    
    
      
      

        Hi,

        Thanks for your suggestions. 

        The comma was an error in my email, not in my dialplan.

        Even if i use Answer command before Queue i received the same
        error back, so i think the best way is to have my own queue.

        Have you got any example of how to implement a simple queue that
        use the "fewestcalls" strategy?

        

        Best Regards

        

        Salvatore 

         

        

        
          
        

        Da:
            asterisk-dev-bounces at lists.digium.com
        A: "Asterisk Developers Mailing List"
            asterisk-dev at lists.digium.com
        Cc: 
        Data: Tue, 22 Nov 2016 10:04:58 -0500
        Oggetto: Re: [asterisk-dev] AGI:async
        

        Hi Salvatore,

          

          I don't have any experience with the "Queue" command, as I
          basically pass the call directly to agi:async and control the
          call every step of the way from my C program (where I've
          implemented my own queue/call tracking).

          

          However, here are my suggestions:

          

          1) Upon taking a quick look at http://www.voip-info.org/wiki/view/Asterisk+cmd+Queue,
          I think your "failed to add agi command to channel.." error
          may be since the call is not answered yet.  You'll notice on
          that web page that the dial plan calls "Answer" before Queue
          in example 1, and Playback (which itself internally answers
          the call to be able to then play the announcement) before
          Queue in example 3 (I'm skipping example 2, as it's a link to
          a German site and not directly on the page).  Please try one
          of those commands, before calling your Queue command, and I
          think you'll get better results.

          

          2) You are correct that AGI(agi:async) stops execution of the
          dialplan.  In your attempt to execute AGI(agi:async) before
          Queue, that's exactly what happened.  The call entered
          agi:async mode and from that point on you are supposed to
          issue commands to control the call from your AGI program.

          

          That's probably the reason you don't hear ringing on the
          phone, as (in your AGI call on priority 1 example) your
          inbound call never reached the "Queue" dialplan priority.

          

          3) This is a minor detail, but I'm not sure your syntax is
          correct.  Try removing the comma before the "n", so that you
          have the following in your dial plan: "same =>
          n,AGI(agi:async)"

          

          Hope this helps,

          

          Daniel

          

          

          

          On 11/22/2016 05:03 AM, Salvatore Franco wrote:

        
        
          Hi, 

            I'm trying to answer a call that is in Queue through AMI,
            launching AGI command ANSWER.

            I read about putting AGI(agi:async) in extensions.conf
            dialplan but if i set in this order:

            

            exten=> 1000,1,Queue(queuename)

            same=>        ,n,AGI(agi:async)

            

            and try to answer using AMI the response is : failed to add
            agi command to channel XXX queue.

            

            Else if i set the dial plan in this order:

             

             

            exten=>1000,1,AGI(agi:async)

            same=>       ,n,Queue(queuename)

            

             the phone doesn't ring and the command execute successful,
            but nothing happens. Isn't agi:async "really" async but
            stops execution of the dialplan?

            

            Any suggestions?

            

             

            Thanks

            

            Best Regards 

            

            Salvatore Franco
            

            
          
          

          
          

        
      
      

      
      

    
    

    

    -- 
Daniel McFarlane
Szeto Technologies Inc.
885 Ellingham Ave
Pointe Claire, Québec
Canada, H9R 5E8
tel: (514) 630-7878
fax: (514) 630-6394
http://www.szeto.ca

  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20161123/999fd2e9/attachment.html>


More information about the asterisk-dev mailing list