Send DTMF in AGI

Hello,
i will be gracefull if someone could help me to solve this problem.
I need to do this sequence:

  1. -> answer to a SIP trunk
  2. <- send dtmf digits to the trunk
  3. -> immediately receive a dtmf string from the trunk

well, i call an AGI script from the inbound route, i can answer but via AGI i’m not able to send a dtmf tone, i try this:

  1. $agi->exec("SendDTMF","5");	    it no works return an error
    
  2. $agi->exec("Dial",$channel."|5|cD(w5)");  no works
    

the only way to send a dtmf digit was through Manager API and then receive the DTMF with AGI Read
(
$res=$ast->playDTMF(“5”,$channel);
$agi->exec(“Read”, “myvar||20|‘skip’|1|2”);
$myvar = $agi->get_variable(myvar);
)
the problem is that i need to receive very soon the answer from the trunk and in this way i have a latence time of few seconds before asterisk is able to receive digits.

I’m also tryng to simulate in dialplan the procedure but it doesnt work
exten => 8199,1,Ringing()
exten => 8199,n,wait(1)
exten => 8199,n,Answer()
exten => 8199,n,SendDTMF(5) // doesnt send the tone
exten => 8199,n,Read(myvar,1,2) // wait the timeout much more than 2 seconds??why?
exten => 8199,n,Hangup

someone can help me?? i’m going crazy!!! thanks

Solved … my fault
the error was in Case sensitive of command

$agi->exec(“SendDTMF”,“5”) is not correct cause is

$agi->exec(“SENDDTMF”,“5”) and it works…