i have some problem. i need to retry dial when user hangups the phone not listening the speech.
how can i set up this on asterisk? this is the config of auto dialer and i need to set up retry dial when user hangups the phone not listening speech
i have this config:
[bird_org]
exten => 1,1,MYSQL(Connect connid ${bird_host} ${bird_user} ${bird_ps} ${bird_database})
exten => 1,2,MYSQL(Query resultid ${connid} update\ monitor\ set\ state=1\ where\ id=${n_record})
exten => 1,3,MYSQL(Disconnect ${connid})
exten => 1,4,answer()
exten => 1,5,Playback(/sounds/org)
;exten => 1,5,Playback(/sounds/org_11809)
exten => 1,6,Verbose(1|CALL FROM BIRD ORG >>> OK)
exten => 1,7,hangup
exten => failed,1,MYSQL(Connect connid ${bird_host} ${bird_user} ${bird_ps} ${bird_database})
exten => failed,2,MYSQL(Query resultid ${connid} update\ monitor\ set\ state=2\ where\ id=${n_record})
exten => failed,3,MYSQL(Disconnect ${connid})
exten => t,1,hangup
exten => i,1,hangup
exten => h,1,hangup
exten => T,1,hangup
@ $db=mysql_pconnect($current_host,$current_un,$current_ps);
mysql_select_db($current_database);
//clear monitor incoming and global cdr tables
$query=“select * from bird_settings limit 1”;
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
if ($num_results > 0){
$row = mysql_fetch_array($result);
$dial_context= stripslashes($row[“dial_context”]);
$default_a_num = stripslashes($row[“a_number”]);
$sleep_time= (integer)stripslashes($row[“sleep_time”]);
$wait_time = (integer)stripslashes($row[“wait_time”]);
$work = (integer)stripslashes($row[“work”]);
$start_time = (integer)stripslashes($row[“start_hour”]);
$stop_time = (integer)stripslashes($row[“stop_hour”]);
$ch_limit= (integer)stripslashes($row[“number_of_channels”]);
} else {
$dial_context=“bird_org”;
$default_a_num = “09”;
$sleep_time=10;
$wait_time=15;
$work = 0;
$start_time = 10;
$stop_time = 19;
$ch_limit = 2;
// preparate output strings for create call file
$lari=(int)$amount;
$tetri = (int)(($amount - $lari)* 100);
if($lari <= 0) {$lari=’’;}else{$lari=(string)$lari;}
if($tetri <= 0) {$tetri=’’;}else{$tetri=(string)$tetri;}
$out[0] = “CallerID: “.$default_a_num.” <”.$default_a_num.">";
$out[1] = “Channel: DAHDI/g1/”.$b_num;
$out[2] = “Account: “.(string)$id;
$out[3] = “SetVar: bird_host=”.(string)$current_host;
$out[4] = “SetVar: bird_user=”.(string)$current_un;
$out[5] = “SetVar: bird_ps=”.(string)$current_ps;
$out[6] = “SetVar: bird_database=”.(string)$current_database;
$out[7] = “SetVar: curr_attempt=”.(string)$attempt;
$out[8] = “SetVar: lari=”.$lari;
$out[9] = “SetVar: tetri=”.$tetri;
$out[10] = “SetVar: n_record=”.(string)$id;
$out[11] = “Retries: 3”;
$out[12] = “RetryTime: 60”;
$out[13] = “WaitTime: “.(string)$wait_time;
$out[14] = “Context: “.$dial_context;
$out[15] = “Extension: 1”;
$out[16] = “Priority: 1”;
// write call block for execution
$fp=fopen(”/var/spool/asterisk/outgoing/”.$i.time().“a.call”,“w”);
// $fp=fopen(”/tmp/”.$i.”.call”,“w”);
for ($j=0; $j <= 16; $j++){
fputs($fp,$out[$j]."\r\n");
}
fclose($fp);
}
mysql_free_result($result);
mysql_close($db);
// end check tables