Need help

hi guys,

this is my code

$lang = $agi->get_variable('LANGUAGE()');
$language = $lang['data'];
$goto = "main-ivr-selection-$language";
$A2B -> debug( VERBOSE | WRITELOG, $agi, __FILE__, __LINE__, "REG4: PIN ALREADY CREATED. GOTO -> $goto");

the problem that im facing is the ivr skips line 1 and 2. as the result, $language variable didn’t get required variable.

anybody can explain how come line 1 and 2 didn’t execute??

thanks in advance.


nobody can help me?

1.  for($i=0; $i<2; $i++){
2.    $agi->stream_file('hello'); //no hello in 1st loop
3.    $res_dtmf = $agi->get_data('please-enter-first-three-letters', 5000, 1); //no prompt in 1st loop and -1 was returned 
4.    $userSelection = $res_dtmf['result'];
5.    $A2B -> debug( VERBOSE | WRITELOG, $agi, __FILE__, __LINE__, "REG1: USER SELECTED[$userSelection]");
6.  }

i tried this and surprisingly, in the first loop the ivr didn’t execute line (1) and line (2). $userSelection carried value = -1 which i dont know from where it comes. In the second loop, it executed the code line by line perfectly. It’s weird.

please help me.

What are you using for your agi ?

To import a variable I use:

$call_unique_id = $agi->get_variable(call_unique_id);
$call_unique_id = $call_unique_id[data];

(where call_unique_id is the variable that set in the dialplan).

To set a variable that I can use it back in the asterisk dial plan I use:

 $agi->agi_exec("SET VARIABLE VARNAME UNK")

where VARNAME is the variable that I am setting and the value for it is UNK.

Use this method


I think is it’s better, imho :smile:


Marco Bruni