תגובה: כמה פיתוחים דרך API
סקריפט להקליט את שם המקליט וכשהמאזין מקיש מקש מסויים המערכת תשמיע את הקלטת המקליט
1. ניהול הקלטת השם
הקלטת השם:
<?php
$url = "https://www.call2all.co.il/ym/api/" ;
$pass = $_GET['ApiW'] ?? $_GET['pass'] ;
$phone= $_GET['ApiPhone'];
$record =$_GET['record'];
$apiExt =$_GET['ApiExtension'] ;
$token = "token={$_GET['ApiDID']}:{$pass}" ;
$record_menu = $_GET['record_menu'];
$name_menu = $_GET['name_menu'];
if($record==""){
$delete = json_decode(file_get_contents("{$url}FileAction?{$token}&action=delete&what=ivr2:recordedName/{$phone}.wav"), true);
exit("read=m-1012=record,,record,/recordedName,".$phone.",no,yes");
}
switch ($record_menu) {
case 1:
record_menu_play:
exit("id_list_message=f-/recordedName/{$phone}&read=m-1009=record_menu,,1,1,,NO,,,,1234,,,,,no");
break;
case 2:
record_menu_save_and_return:
exit("id_list_message=m-1452&go_to_folder=..");
break;
case 3:
record_menu_rerecord:
$delete = json_decode(file_get_contents("{$url}FileAction?{$token}&action=delete&what=ivr2:recordedName/{$phone}.wav"), true);
exit("go_to_folder=.");
break;
case 4:
record_menu_cancel_and_goto_previous_menu:
$delete = json_decode(file_get_contents("{$url}FileAction?{$token}&action=delete&what=ivr2:recordedName/{$phone}.wav"), true);
exit("go_to_folder=..");
break;
default:
exit("read=m-1009=record_menu,,1,1,,NO,,,,1234,,,,,no");
}
לשמוע את הקלטת שם (של המתחבר - המאזין):
<?php
$phone= $_GET['ApiPhone'];
exit("id_list_message=f-/recordedName/{$phone}");
מחיקת השם (ובמקומה - המערכת תשמיע מספר הטל שלו):
<?php
$url = "https://www.call2all.co.il/ym/api/" ;
$phone= $_GET['ApiPhone'];
$pass = $_GET['ApiW'] ?? $_GET['pass'];
$token = "token={$_GET['ApiDID']}:{$pass}" ;
switch ($_GET['confdel']) {
case 1:
$delete = json_decode(file_get_contents("{$url}FileAction?{$token}&action=delete&what=ivr2:recordedName/{$phone}.wav"), true);
if($delete['responseStatus'] =="OK"){
exit("id_list_message=m-1382&");
}exit("go_to_folder=..");
break;
case 2:
exit("go_to_folder=..");
break;
default:
exit("read=m-1381=confdel,,1,1,,NO,,,,12,,,,,no");
}
2. מקש באמצע שמיעת קובץ שמע בה המערכת תשמיע הקלטת שם של המקליט (ובמידה שעדיין אין הקלטה - תשמיע מספר הטל:
<?PHP
$line = $_GET['ApiDID'];
$ext = $_GET['what'];
$PlayStop=$_GET['PlayStop'];
$file1 = $ext;
$file1 = strrev($file1);
$file1 = strstr($file1,"/",true);
$file1 = strrev($file1);
$file1 = strstr($file1,".",true);
$filetxt= $ext;
$filetxt = strstr($filetxt,".",true);
$filetxt = $filetxt.".txt";
$backToListen = "go_to_folder_and_play=/".$_GET['ApiExtension'].",{$file1},".trim($PlayStop);
$goToListen = "go_to_folder_and_play=/".$_GET['ApiExtension'].",{$file1}" ;
$pass = $_GET['ApiW'] ?? $_GET['pass'];
$token = $line.":".$pass;
$what = $ext;
get_creator:
$txtCreator = json_decode(file_get_contents("https://www.call2all.co.il/ym/api/GetTextFile?token={$token}&what={$filetxt}"), true);
$phoneNo = strpos($txtCreator['contents'],"Phone-");
$phoneNo = $phoneNo + 6 ;
$phoneNo = substr($txtCreator['contents'],$phoneNo,11);
if_not_creater:
$type = "d-";
$check = json_decode(file_get_contents("https://www.call2all.co.il/ym/api/CheckIfFileExists?token={$token}&path=ivr2:recordedName/{$phoneNo}.wav"),true) ;
if($check["fileExists"]){
$type ="f-/recordedName/";
}
exit("id_list_message=m-1166.{$type}{$phoneNo}.m-1166&{$backToListen}");
הרי שלכם לפניכם ועשה עמהם מה שתרצה