$host = '127.0.0.1';
$db = 'test';
$user = 'root';
$pass = '';
$charset = 'utf8';
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
$pdo = new PDO($dsn, $user, $pass, $opt)
$stmt = $pdo->prepare("SELECT last_name FROM first_table WHERE name=?");
$stmt->execute([$name]);
$last_name = $stmt->fetchColumn();
exten => s,1, GotoIfTime(8:00-20:00,mon-fri,*,*?ivr-main,s,1)
exten => s,n, GotoIfTime(8:00-17:00,sat,*,*?ivr-main,s,1)
exten => s,n, GotoIfTime(10:00-15:00,sun,*,*?ivr-main,s,1)
exten => s,n, Playback(nonworkinghours)
exten => s,n,Goto(autoanswer,s,1)
exten => s,n, HangUp()
TOTALSOUNDS = 20
CURRENTSOUND = 1
[context]
exten => _X.,1,GotoIf($[${CURRENTSOUND} <= ${TOTALSOUNDS}]?sound-plus)
exten => _X.,n,Set(GLOBAL(CURRENTSOUND)=1)
exten => _X.,n(sound-plus),Set(GLOBAL(CURRENTSOUND)=$[${CURRENTSOUND}+1])
exten => _X.,n,Playback(${CURRENTSOUND})
exten => _X.,n,Hangup()