$cd = new CollectDtmf(); //initiate new collect dtmf object $cd->setMaxDigits(10); $cd->setTermChar('#'); $cd->addPlayText("Please enter number to send message end with hash!"); $r->addCollectDtmf($cd); $_SESSION['next_goto'] = 'phonemenu'; } } else { if ($_REQUEST['event'] == 'Record' && $_SESSION['next_goto'] == 'Record_Status') { //recorded file will be come as url in data param //print parameter data value $r->addPlayText('your recorded audio is '); $_SESSION['record_url'] = $_REQUEST['data']; error_log($_SESSION['record_url']); $r->addPlayAudio($_SESSION['record_url']); $r->addPlayText('Thanks you for calling, we will deliver your message'); } else { if ($_REQUEST['event'] == 'Dial' && $_SESSION['next_goto'] == 'Dial1_Status') { //dial url will come data param //if dial record false then data value will be -1 or null //dial status will come in status (answered/not_answered) param //print parameter data and status params value $_SESSION['dial_record_url'] = $_REQUEST['data']; $_SESSION['dial_status'] = $_REQUEST['status']; $_SESSION['dial_callduration'] = $_REQUEST['callduration']; if ($_REQUEST['status'] == 'not_answered') { //if you would like dial another number, if first call not answered, // $r->addHangup(); } else { $r->addPlayAudio($_SESSION['record_url']);