Question

Hii I am making a call from Manager AMI and in my dialPlan the caller will be connected to AGI.I want to send a variable var from AMI to AGI through channel variables

originateAction.setChannel("SIP/1000abc");
originateAction.setContext("outgoing-call");
originateAction.setExten("100"); 
originateAction.setVariable("var", "Say to the user that he sucks");

I tried all possible combination of outbound call but none of them working

[outgoing-call]
exten=>100,1,AGI(agi://127.0.0.1/hello.agi?user=${var})

[outgoing-call]
exten=>100,1,AGI(agi://127.0.0.1/hello.agi?var=${var})

[outgoing-call]
exten=>100,1,AGI(agi://127.0.0.1/hello.agi,${var})

AGI

public void service(AgiRequest request, AgiChannel channel)
            throws AgiException
    {
        answer();
        System.out.println("Inside");
        String a=request.getParameter("var");
       // String b=request.getParameter("user");
        String c=channel.getVariable("var");
       // String d=channel.getVariable("user");
        System.out.println(a+"\n"+b+"\n"+c+"\n"+d+"\n");
        hangup();
     }

Output is null all the time.

Was it helpful?

Solution

The right way to pass argument to AGI in your dial plan is:

exten=>_0.,n,AGI(CALLyourAGI,${VARIABLE})

Before calling your AGI you can display in your CLI if the variable was really setted:

[outgoing-call]

exten=>100,1,NoOP(My Variable content ${var})
exten=>100,n,AGI(agi://127.0.0.1/hello.agi,${var})

Do not forget to set verbose in the CLI

ast*CLI> core set verbose 9999

Make a call and keep your eyes on it

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top