• הרשמה
    • התחברות
    • חיפוש
    • דף הבית
    • אינדקס קישורים
    • פוסטים אחרונים
    • קבלת התראות מהדפדפן
    • משתמשים
    • חיפוש בהגדרות המתקדמות
    • חיפוש גוגל בפורום
    • ניהול המערכת
    • ניהול המערכת - שרת private

    קוד להודעה אישית במהלך האזנה - מישהו מוכן להעלות לשרת שלו?

    פורום מפתחים API
    6
    45
    787
    טוען פוסטים נוספים
    • מהישן לחדש
    • מהחדש לישן
    • הכי הרבה הצבעות
    תגובה
    • הגיבו כנושא
    התחברו בכדי לפרסם תגובה
    נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
    • C
      CUBASE נערך לאחרונה על ידי

      כתבתי קוד להשארת הודעה אישית למקליט ההודעה במהלך האזנה להודעה שלו,

      מישהו מוכן להעלות את הקובץ לשרת שלו?

      PlayfilePersonalMessage.php

      תגובה 1 תגובה אחרונה תגובה ציטוט 1
      • C
        CUBASE נערך לאחרונה על ידי CUBASE

        @ivrפון @Liy @WIZNITZ @amp-Software-0

        תגובה 1 תגובה אחרונה תגובה ציטוט 0
        • C
          CUBASE נערך לאחרונה על ידי

          אין מישהו שמוכן לעשות טובה עם הציבור?

          A תגובה 1 תגובה אחרונה תגובה ציטוט 0
          • הוזכר על-ידי  C CUBASE 
          • A
            amp Software 0 @CUBASE נערך לאחרונה על ידי

            @CUBASE
            https://utilitiesphone.com/PlayfilePersonalMessage/PlayfilePersonalMessage.php
            בלי התחייבות לאחסון כלל!

            C 2 תגובות תגובה אחרונה תגובה ציטוט 2
            • C
              CUBASE @amp Software 0 נערך לאחרונה על ידי

              @amp-Software-0 אלוףףף!!

              תגובה 1 תגובה אחרונה תגובה ציטוט 0
              • C
                CUBASE @amp Software 0 נערך לאחרונה על ידי CUBASE

                @amp-Software-0 היתה טעות בקוד, יש מצב אתה מעלה שוב?

                PlayfilePersonalMessage.php

                תגובה 1 תגובה אחרונה תגובה ציטוט 0
                • C
                  CUBASE נערך לאחרונה על ידי CUBASE

                  @amp-Software-0 יש מצב?

                  A תגובה 1 תגובה אחרונה תגובה ציטוט 0
                  • A
                    amp Software 0 @CUBASE נערך לאחרונה על ידי amp Software 0

                    @CUBASE
                    העלתי

                    יש לך שם שגיאה, ככה"נ מחמת שימוש בתוסף בעורך הקוד
                    b90f8f90-c2a7-4066-85e3-9b0b73e3d2bf-image.png
                    תיקנתי את זה

                    C תגובה 1 תגובה אחרונה תגובה ציטוט 0
                    • C
                      CUBASE @amp Software 0 נערך לאחרונה על ידי

                      @amp-Software-0 👍

                      באמת זה היה איזה תוסף

                      באיזה תוספים אתה משתמש ל-PHP?
                      התקנתי כמה תוספים ואין לי מושג מה באמת מסייע...

                      A תגובה 1 תגובה אחרונה תגובה ציטוט 0
                      • A
                        amp Software 0 @CUBASE נערך לאחרונה על ידי

                        @CUBASE
                        PHP Intelephense
                        ו PHP debug
                        באמת לא מומלץ להתקין הרבה תוספים, זה רק מסבך

                        C תגובה 1 תגובה אחרונה תגובה ציטוט 0
                        • C
                          CUBASE @amp Software 0 נערך לאחרונה על ידי

                          @amp-Software-0

                          PHP Debug בפיתוח של Xdebug

                          PHP Intelephense בפיתוח של Ben Mewburn

                          התוספים האלו?

                          A תגובה 1 תגובה אחרונה תגובה ציטוט 0
                          • A
                            amp Software 0 @CUBASE נערך לאחרונה על ידי

                            @CUBASE
                            כן,
                            PHP Debug זה בעיקר בשביל דיבוג עם Xdebug, זה לא נצרך לפיתוח עצמו

                            C תגובה 1 תגובה אחרונה תגובה ציטוט 0
                            • C
                              CUBASE @amp Software 0 נערך לאחרונה על ידי CUBASE

                              @amp-Software-0 אויש, סליחה שאני משגע אותך...

                              עוד באג מעצבן, ב-read כתבתי Record במקום record

                              הקוד בספויילר (אני מניח שיותר קל לשנות מאשר למחוק ולהעלות שוב)

                              <?php
                              
                              // קבועים להודעות
                              const MsgRecordInstructions = "m-1012";
                              const MsgMenuRecordInstructions = "m-1009";
                              const MsgBranchConfigError = "m-1120";
                              const MsgRecordSaved = "m-1452";
                              const MsgRecordCanceled = "m-1306";
                              const MsgContinueRecording = "m-2196";
                              const MsgNoPhone = "m-1494";
                              const MsgERROR = "m-1080";
                              
                              // פונקציה ליצירת פקודת read
                              function CreateReadCommand(string $Message, array $Values): string {
                                  $FormattedValues = implode(",", $Values);
                                  return "read={$Message}={$FormattedValues}";
                              }
                              
                              // פונקציות נוספות
                              
                              function record_play(string $RecordPath): string {
                                  return "id_list_message=f-{$RecordPath}&" . MenuRecord();
                              }
                              
                              function record_ok(string $token, string $RecordPath, string $GetPhone, string $GoToFolderAndPlay, string $ymApi): string {
                                  $folderMove = isset($_GET["folder_move"]) ? $_GET["folder_move"] : "/personalMessages";
                                  $encodedWhat = urlencode("ivr2:{$RecordPath}");
                                  $encodedTarget = urlencode("ivr2:{$folderMove}/Phone/{$GetPhone}");
                                  $url = "{$ymApi}FileAction?token=" . urlencode($token) . "&action=move&what={$encodedWhat}&target={$encodedTarget}";
                                  file_get_contents($url);
                                  return "id_list_message=" . MsgRecordSaved . "&go_to_folder_and_play={$GoToFolderAndPlay}";
                              }
                              
                              function record_again(string $hangupInsertFile): string {
                                  return RecordFunc($hangupInsertFile);
                              }
                              
                              function record_cancel(string $token, string $RecordPath, string $GoToFolderAndPlay, string $ymApi): string {
                                  $encodedWhat = urlencode("ivr2:{$RecordPath}");
                                  $url = "{$ymApi}FileAction?token=" . urlencode($token) . "&action=delete&what={$encodedWhat}";
                                  file_get_contents($url);
                                  return "id_list_message=" . MsgRecordCanceled . "&go_to_folder_and_play={$GoToFolderAndPlay}";
                              }
                              
                              function continue_recording(string $hangupInsertFile): string {
                                  $recordValuesContinue = [
                                      "Record", "", "record", "/ApiTempFiles", "", "no", $hangupInsertFile, "yes" // החלפת null במחרוזת ריקה
                                  ];
                                  return CreateReadCommand(MsgContinueRecording, $recordValuesContinue);
                              }
                              
                              // מערך פונקציות
                              $recordFunctions = [
                                  "1" => "record_play",
                                  "2" => "record_ok",
                                  "3" => "record_again",
                                  "4" => "record_cancel",
                                  "5" => "continue_recording",
                              ];
                              
                              function RecordFunc(string $hangupInsertFile): string {
                                  $recordValues = [
                                      "Record", "", "record", "/ApiTempFiles", "", "no", $hangupInsertFile, // החלפת null במחרוזת ריקה
                                  ];
                                  return CreateReadCommand(MsgRecordInstructions, $recordValues);
                              }
                              
                              function MenuRecord (): string {
                                  $menuRecordValues = [
                                      "MenuRecord", "", "1", "", "", "NO", "", "", "", "", "", "", "", "", "no", // החלפת null במחרוזת ריקה
                                  ];
                                  return CreateReadCommand(MsgMenuRecordInstructions, $menuRecordValues);
                              }
                              
                              function RunTzintuk(string $token, string $GetPhone, string $ymApi): string {
                                  $callerId = isset($_GET["tzintuk_your_id"]) ? $_GET["tzintuk_your_id"] : null;
                                  $TzintukTimeOut = isset($_GET["tzintuk_timeout"]) ? $_GET["tzintuk_timeout"] : null;
                                  $url = "{$ymApi}RunTzintuk?token=" . urlencode($token) . "&phones=tzl:{$GetPhone}&callerId={$callerId}&TzintukTimeOut={$TzintukTimeOut}";
                                  file_get_contents($url);
                                  return "";
                              }
                              
                              // יצירת משתנים גלובליים - מוקדם יותר ועם בדיקות קיום
                              $ymApi = "https://www.call2all.co.il/ym/api/";
                              
                              $ApiDID = isset($_GET["ApiDID"]) ? $_GET["ApiDID"] : null;
                              $pass = isset($_GET["pass"]) ? $_GET["pass"] : null;
                              if (!$ApiDID || !$pass) {
                                  echo "id_list_message=" . MsgBranchConfigError;
                                  exit;
                              }
                              
                              // יצירת token - תוקן!
                              $token = "{$ApiDID}:{$pass}";
                              
                              $ApiExtension = isset($_GET["ApiExtension"]) ? $_GET["ApiExtension"] : null;
                              $ApiWhat = isset($_GET["what"]) ? $_GET["what"] : null;
                              $PlayStop = isset($_GET["PlayStop"]) ? $_GET["PlayStop"] : null;
                              
                              $ApiWhatFile = $ApiWhat && $ApiExtension ? str_replace("ivr2:/{$ApiExtension}/", "", $ApiWhat) : null;
                              $ApiWhatFile = $ApiWhatFile ? substr($ApiWhatFile, 0, strrpos($ApiWhatFile, ".")) : null;
                              $GoToPlayStop = $PlayStop ? $PlayStop - 5000 : null;
                              $GoToFolderAndPlay = $ApiExtension && $ApiWhatFile && $GoToPlayStop ? "/{$ApiExtension},{$ApiWhatFile},{$GoToPlayStop}" : "";
                              
                              
                              if (isset($_GET["hangup_insert_file"]) && $_GET["hangup_insert_file"] == "yes") {
                                  $hangupInsertFile = "yes";
                              }else{
                                  $hangupInsertFile = "";
                              }
                              
                              
                              if (isset($_GET["hangup_send_tzuntuk"]) && $_GET["hangup_send_tzuntuk"] == "yes") {
                                  $hangupSendTzintuk = "yes";
                              }else{
                                  $hangupSendTzintuk = "";
                              }
                              
                              // בניית כתובת ה-API המלאה (כמו קודם)
                              $GetFileInfo = "{$ymApi}GetFile?token=" . urlencode($token) . "&what=" . urlencode($ApiWhat);
                              
                              // ביצוע בקשת GET עם cURL (כמו קודם)
                              $ch = curl_init($GetFileInfo);
                              curl_setopt_array($ch, [
                                  CURLOPT_RETURNTRANSFER => true,
                                  CURLOPT_TIMEOUT => 10,
                              ]);
                              
                              $response = curl_exec($ch);
                              
                              if (curl_errno($ch)) {
                                  $error_message = 'cURL Error';
                                  echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                  exit;
                              } else {
                                  $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                                  if ($http_code == 200) {
                                      // פענוח JSON (כמו קודם)
                                      $result = json_decode($response, true);
                              
                                      // בדיקה אם הפענוח הצליח והשדה file קיים (כמו קודם)
                                      if ($result !== null && isset($result['file']) && is_array($result['file'])) {
                                          
                                          // בדיקה אם השדה phone מכיל null או משהו אחר
                                          if ($result['file']['phone'] !== null) {
                                              $GetPhone = $result['file']['phone'];
                                          } else {
                                              echo "id_list_message=" . MsgNoPhone . "&go_to_folder_and_play={$GoToFolderAndPlay}";
                                              exit;
                                          }
                              
                                      } else {
                                          $error_message = "Invalid JSON response or 'file' field not found/incorrect format Response";
                                          echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                          exit;
                                      }
                                  } else {
                                      $error_message = "HTTP Error: {$http_code} Response: {$response}";
                                      echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                      exit;
                                  }
                              }
                              
                              curl_close($ch);
                              
                              if (isset($_GET["hangup"])) {
                                  if ($hangupInsertFile == "yes") {
                                      record_ok($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                      if ($hangupSendTzintuk == "yes") {
                                          RunTzintuk($token, $GetPhone, $ymApi);
                                      }
                                  }else{
                                      record_cancel($token, $RecordPath, $GoToFolderAndPlay, $ymApi);
                                  }
                                  exit;
                              }
                              
                              // טיפול בהקלטה אישית
                              if (!isset($_GET["Record"])) {
                              
                                  echo RecordFunc($hangupInsertFile);
                                  exit;
                              
                              }else{
                                  
                                  $RecordPath = $_GET["Record"];
                              }
                              
                              // טיפול בהקלטה לתפריט
                              if (!empty($_GET) && key(array_slice($_GET, -1, 1, true)) === "Record") {
                              
                                  $menuRecordData = MenuRecord(); // שימוש ב $GoToFolderAndPlay
                                  echo $menuRecordData;
                              
                                  exit;
                              }
                              
                              // טיפול בהקשות
                              if (isset($_GET["MenuRecord"])) {
                                  
                                  $menuRecordOption = $_GET["MenuRecord"];
                              
                                  $optionsParam = "menu_record_options_" . $menuRecordOption;
                              
                                  if (isset($_GET[$optionsParam])) {
                                      $optionValue = $_GET[$optionsParam];
                              
                                      if (function_exists($optionValue) || $optionValue == "noop") {
                                          if ($optionValue == "noop") {
                                              echo MenuRecord();
                                          } else {
                                              if ($optionValue == "record_play") {
                                                  echo record_play($RecordPath);
                                              } elseif ($optionValue == "record_ok") {
                                                  echo record_ok($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                                  RunTzintuk($token, $GetPhone, $ymApi);
                                              } elseif ($optionValue == "record_again") {
                                                  echo record_again($hangupInsertFile);
                                              } elseif ($optionValue == "record_cancel") {
                                                  echo record_cancel($token, $RecordPath, $GoToFolderAndPlay, $ymApi);
                                              } elseif ($optionValue == "continue_recording") {
                                                  echo continue_recording($hangupInsertFile);
                                              }
                                          }
                                      }
                                  } else {
                                      if (array_key_exists($menuRecordOption, $recordFunctions)) {
                                          $functionToCall = $recordFunctions[$menuRecordOption];
                                          if ($functionToCall == "record_play") {
                                              echo record_play($RecordPath);
                                          } elseif ($functionToCall == "record_ok") {
                                              echo record_ok($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                              RunTzintuk($token, $GetPhone, $ymApi);
                                          } elseif ($functionToCall == "record_again") {
                                              echo record_again($hangupInsertFile);
                                          } elseif ($functionToCall == "record_cancel") {
                                              echo record_cancel($token, $RecordPath, $GoToFolderAndPlay, $ymApi);
                                          } elseif ($functionToCall == "continue_recording") {
                                              echo continue_recording($hangupInsertFile);
                                          }
                                      }else{
                                          echo MenuRecord();
                                      }
                                  }
                              }
                              
                              ?>
                              

                              👍👍

                              A תגובה 1 תגובה אחרונה תגובה ציטוט 0
                              • A
                                amp Software 0 @CUBASE נערך לאחרונה על ידי

                                @CUBASE
                                טופל

                                C תגובה 1 תגובה אחרונה תגובה ציטוט 1
                                • C
                                  CUBASE @amp Software 0 נערך לאחרונה על ידי CUBASE

                                  @amp-Software-0
                                  שינית גם את שם הפרמטר ל-record?

                                  כבר תיקנתי את זה בקוד שהבאתי בספויילר...

                                  עכשיו זה מבקש ממני שוב ושוב הקלטה...

                                  A תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                  • A
                                    amp Software 0 @CUBASE נערך לאחרונה על ידי

                                    @CUBASE
                                    טוב..

                                    C תגובה 1 תגובה אחרונה תגובה ציטוט 1
                                    • הוזכר על-ידי  C CUBASE 
                                    • C
                                      CUBASE @amp Software 0 נערך לאחרונה על ידי

                                      @amp-Software-0 אופססס..

                                      יצאתי מנקודת הנחה שהמערכת כל פעם שולחת את הבקשה האחרונה כפרמטר אחרון (כך ראיתי איפשהו בפורום)

                                      בגלל שבהקלטה ב-API יש תפריט שונה מהקלטה רגילה אז עשיתי שההקלטה תישמר ב-# בתיקייה זמנית ואז יבקש תפריט,

                                      בקוד כתבתי שאם הפרמטר האחרון הוא Record אז ידפיס תפריט,
                                      בפועל מה שקורה זה שהמשתמש מקליט, המערכת שולחת פרמטר Record=/ApiTempFiles/000.wav, המערכת מקבלת בקשה לתפריט ומחזירה פרמטר MenuRecord=3 (הקלטה חוזרת), ואז המערכת מקבלת בקשה להקלטה ומחזירה Record=/ApiTempFiles/000.wav&MenuRecord=3 ולא מחזירה את הפרמטר Record אחרון!!

                                      בקיצור, אצטרך להשתמש באובייקט SESSION כמו שכתבת כאן,
                                      אשמח אם תוכל לסייע לי בטיפול בקוד 🙏

                                      תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                      • C
                                        CUBASE נערך לאחרונה על ידי CUBASE

                                        @amp-Software-0 וואי איך אני מקווה שזה העדכון האחרון...

                                        PlayfilePersonalMessage.php

                                        <?php
                                        
                                        // הודעות מערכת
                                        const MsgRecordInstructions = "m-1012";
                                        const MsgMenuRecordInstructions = "m-1009";
                                        const MsgBranchConfigError = "m-1120";
                                        const MsgRecordSaved = "m-1452";
                                        const MsgRecordCanceled = "m-1306";
                                        const MsgContinueRecording = "m-2196";
                                        const MsgNoPhone = "m-1494";
                                        const MsgERROR = "m-1080";
                                        
                                        // פונקציה ליצירת פקודת read
                                        function CreateReadCommand(string $Message, array $Values): string {
                                            $FormattedValues = implode(",", $Values);
                                            return "read={$Message}={$FormattedValues}";
                                        }
                                        
                                        // פונקציות נוספות
                                        
                                        function record_play(string $RecordPath): string {
                                            return "id_list_message=f-{$RecordPath}&" . MenuRecord();
                                        }
                                        
                                        function record_ok(string $token, string $RecordPath, string $GetPhone, string $GoToFolderAndPlay, string $ymApi): string {
                                            $folderMove = isset($_GET["folder_move"]) ? $_GET["folder_move"] : "/personalMessages";
                                            $encodedWhat = urlencode("ivr2:{$RecordPath}.wav");
                                            $encodedTarget = urlencode("ivr2:{$folderMove}/Phone/{$GetPhone}");
                                            CheckIfFolderExists($token, $encodedTarget, $ymApi, $GoToFolderAndPlay);
                                            $url = "{$ymApi}FileAction?token={$token}&action=move&what={$encodedWhat}&target={$encodedTarget}";
                                            file_get_contents($url);
                                            unset($_SESSION["IfRecorded"]);
                                            return "id_list_message=" . MsgRecordSaved . "&go_to_folder_and_play={$GoToFolderAndPlay}";
                                        }
                                        
                                        function record_ok_and_run_tzintuk(string $token, string $RecordPath, string $GetPhone, string $GoToFolderAndPlay, string $ymApi): string {
                                            $folderMove = isset($_GET["folder_move"]) ? $_GET["folder_move"] : "/personalMessages";
                                            $encodedWhat = urlencode("ivr2:{$RecordPath}.wav");
                                            $encodedTarget = urlencode("ivr2:{$folderMove}/Phone/{$GetPhone}");
                                            CheckIfFolderExists($token, $encodedTarget, $ymApi, $GoToFolderAndPlay);
                                            $url = "{$ymApi}FileAction?token={$token}&action=move&what={$encodedWhat}&target={$encodedTarget}";
                                            file_get_contents($url);
                                            RunTzintuk($token, $GetPhone, $ymApi);
                                            unset($_SESSION["IfRecorded"]);
                                            return "id_list_message=" . MsgRecordSaved . "&go_to_folder_and_play={$GoToFolderAndPlay}";
                                        }
                                        
                                        function record_again(string $hangupInsertFile, $RecordName): string {
                                            $_SESSION["IfRecorded"] = "yes";
                                            $recordValues = [
                                                "Record", "", "record", "/ApiTempFiles", $RecordName, "no", $hangupInsertFile
                                            ];
                                            return CreateReadCommand(MsgRecordInstructions, $recordValues);
                                        }
                                        
                                        function record_cancel(string $token, string $RecordPath, string $GoToFolderAndPlay, string $ymApi): string {
                                            $encodedWhat = urlencode("ivr2:{$RecordPath}.wav");
                                            $url = "{$ymApi}FileAction?token={$token}&action=delete&what={$encodedWhat}";
                                            file_get_contents($url);
                                            unset($_SESSION["IfRecorded"]);
                                            return "id_list_message=" . MsgRecordCanceled . "&go_to_folder_and_play={$GoToFolderAndPlay}";
                                        }
                                        
                                        function continue_recording(string $hangupInsertFile, $RecordName): string {
                                            $_SESSION["IfRecorded"] = "yes";
                                            $recordValuesContinue = [
                                                "Record", "", "record", "/ApiTempFiles", $RecordName, "no", $hangupInsertFile, "yes"
                                            ];
                                            return CreateReadCommand(MsgContinueRecording, $recordValuesContinue);
                                        }
                                        
                                        // מערך פונקציות
                                        $recordFunctions = [
                                            "1" => "record_play",
                                            "2" => "record_ok_and_run_tzintuk",
                                            "3" => "record_again",
                                            "4" => "record_cancel",
                                            "5" => "continue_recording",
                                        ];
                                        
                                        function RecordFunc(string $hangupInsertFile): string {
                                            $_SESSION["IfRecorded"] = "yes";
                                            $recordValues = [
                                                "Record", "", "record", "/ApiTempFiles", "", "no", $hangupInsertFile
                                            ];
                                            return CreateReadCommand(MsgRecordInstructions, $recordValues);
                                        }
                                        
                                        function MenuRecord (): string {
                                            if (isset($_SESSION["IfRecorded"]) && $_SESSION["IfRecorded"] == "yes") {
                                                $_SESSION["IfRecorded"] = "no";
                                            }
                                        
                                            $menuRecordValues = [
                                                "MenuRecord", "", "1", "", "", "NO", "", "", "", "", "", "", "", "", "no"
                                            ];
                                            return CreateReadCommand(MsgMenuRecordInstructions, $menuRecordValues);
                                        }
                                        
                                        function RunTzintuk(string $token, string $GetPhone, string $ymApi) {
                                            $callerId = isset($_GET["tzintuk_your_id"]) ? $_GET["tzintuk_your_id"] : null;
                                            $TzintukTimeOut = isset($_GET["tzintuk_timeout"]) ? $_GET["tzintuk_timeout"] : null;
                                            $url = "{$ymApi}RunTzintuk?token={$token}&phones=tzl:{$GetPhone}&callerId={$callerId}&TzintukTimeOut={$TzintukTimeOut}";
                                            file_get_contents($url);
                                        }
                                        
                                        function CheckIfFolderExists(string $token, string $encodedTarget, string $ymApi, string $GoToFolderAndPlay) {
                                            $url = "{$ymApi}CheckIfFileExists?token={$token}&path={$encodedTarget}/ext.ini";
                                        
                                            $ch = curl_init($url);
                                            curl_setopt_array($ch, [
                                                CURLOPT_RETURNTRANSFER => true,
                                                CURLOPT_TIMEOUT => 10,
                                            ]);
                                        
                                            $response = curl_exec($ch);
                                        
                                            if (curl_errno($ch)) {
                                                $error_message = 'cURL Error';
                                                echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                                exit;
                                            } else {
                                                $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                                                if ($http_code == 200) {
                                                    // פענוח JSON
                                                    $result = json_decode($response, true);
                                        
                                                    // בדיקה האם הפענוח הצליח והשדה fileExists קיים
                                                    if ($result !== null && isset($result['fileExists'])) {
                                                        
                                                        // בדיקה אם השדה fileExists מכיל false
                                                        if ($result['fileExists'] == false) {
                                                            $OpenFolder = "{$ymApi}UpdateExtension?token={$token}&path={$encodedTarget}";
                                                            file_get_contents($OpenFolder);
                                                            $DeleteExtFile = "{$ymApi}FileAction?token={$token}&action=delete&what={$encodedTarget}/ext.ini";
                                                            file_get_contents($DeleteExtFile);
                                                        }
                                                    } else {
                                                        $error_message = "Invalid JSON response or 'file' field not found/incorrect format Response";
                                                        echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                                        exit;
                                                    }
                                                } else {
                                                    $error_message = "HTTP Error: {$http_code} Response: {$response}";
                                                    echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                                    exit;
                                                }
                                            }
                                        
                                            curl_close($ch);
                                        }
                                        
                                        // יצירת משתנים גלובליים - מוקדם יותר ועם בדיקות קיום
                                        $ymApi = "https://www.call2all.co.il/ym/api/";
                                        
                                        $ApiDID = isset($_GET["ApiDID"]) ? $_GET["ApiDID"] : null;
                                        $pass = isset($_GET["pass"]) ? $_GET["pass"] : null;
                                        $ApiCallID = isset($_GET["ApiCallId"]) ? $_GET["ApiCallId"] : null;
                                        $ApiExtension = isset($_GET["ApiExtension"]) ? $_GET["ApiExtension"] : null;
                                        $ApiWhat = isset($_GET["what"]) ? $_GET["what"] : null;
                                        $PlayStop = isset($_GET["PlayStop"]) ? $_GET["PlayStop"] : null;
                                        
                                        if (!$ApiDID || !$pass || !$ApiDID || !$ApiExtension || !$ApiWhat) {
                                            echo "id_list_message=" . MsgBranchConfigError;
                                            exit;
                                        }
                                        
                                        // יצירת טוקן עם קידוד URL
                                        $token = urldecode("{$ApiDID}:{$pass}");
                                        
                                        $ApiWhatFile = $ApiWhat && $ApiExtension ? str_replace("ivr2:/{$ApiExtension}/", "", $ApiWhat) : null;
                                        $ApiWhatFile = $ApiWhatFile ? substr($ApiWhatFile, 0, strrpos($ApiWhatFile, ".")) : null;
                                        $GoToPlayStop = $PlayStop ? $PlayStop - 5000 : null;
                                        $GoToFolderAndPlay = "/{$ApiExtension},{$ApiWhatFile},{$GoToPlayStop}";
                                        
                                        
                                        if (isset($_GET["hangup_insert_file"]) && $_GET["hangup_insert_file"] == "yes") {
                                            $hangupInsertFile = "yes";
                                        }else{
                                            $hangupInsertFile = "";
                                        }
                                        
                                        
                                        if (isset($_GET["hangup_send_tzuntuk"]) && $_GET["hangup_send_tzuntuk"] == "yes") {
                                            $hangupSendTzintuk = "yes";
                                        }else{
                                            $hangupSendTzintuk = "";
                                        }
                                        
                                        // בניית כתובת ה-API המלאה עם הטוקן והפרמטרים
                                        $GetFileInfo = "{$ymApi}GetFile?token={$token}&what=" . urlencode($ApiWhat);
                                        
                                        // ביצוע בקשת GET עם cURL
                                        $ch = curl_init($GetFileInfo);
                                        curl_setopt_array($ch, [
                                            CURLOPT_RETURNTRANSFER => true,
                                            CURLOPT_TIMEOUT => 10,
                                        ]);
                                        
                                        $response = curl_exec($ch);
                                        
                                        if (curl_errno($ch)) {
                                            $error_message = 'cURL Error';
                                            echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                            exit;
                                        } else {
                                            $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                                            if ($http_code == 200) {
                                                // פענוח JSON
                                                $result = json_decode($response, true);
                                        
                                                // בדיקה אם הפענוח הצליח והשדה file קיים והוא מערך
                                                if ($result !== null && isset($result['file']) && is_array($result['file'])) {
                                                    
                                                    // בדיקה אם השדה phone מכיל null או משהו אחר
                                                    if ($result['file']['phone'] !== null) {
                                                        $GetPhone = $result['file']['phone'];
                                                    } else {
                                                        echo "id_list_message=" . MsgNoPhone . "&go_to_folder_and_play={$GoToFolderAndPlay}";
                                                        exit;
                                                    }
                                        
                                                } else {
                                                    $error_message = "Invalid JSON response or 'file' field not found/incorrect format Response";
                                                    echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                                    exit;
                                                }
                                            } else {
                                                $error_message = "HTTP Error: {$http_code} Response: {$response}";
                                                echo "id_list_message=" . MsgERROR .  ".noop-{$error_message}&go_to_folder_and_play={$GoToFolderAndPlay}";
                                                exit;
                                            }
                                        }
                                        
                                        curl_close($ch);
                                        
                                        if (isset($_GET["hangup"]) && isset($_GET["Record"])) {
                                            if ($hangupInsertFile == "yes") {
                                        
                                                if ($hangupSendTzintuk == "yes") {
                                                    record_ok_and_run_tzintuk($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                                }else{
                                                    record_ok($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                                }
                                            }else{
                                                record_cancel($token, $RecordPath, $GoToFolderAndPlay, $ymApi);
                                            }
                                            exit;
                                        
                                        }else{
                                        
                                            exit;
                                        }
                                        
                                        session_id($ApiCallID);
                                        session_start();
                                        
                                        // טיפול בהקלטה אישית
                                        if (!isset($_GET["Record"])) {
                                        
                                            echo RecordFunc($hangupInsertFile);
                                            exit;
                                        
                                        }else{
                                            
                                            $RecordPath = str_replace(".wav", "", $_GET["Record"]);
                                            $RecordName = str_replace("/ApiTempFiles" . "/", "", $RecordPath);
                                        }
                                        
                                        // טיפול בתפריט
                                        if (isset($_SESSION["IfRecorded"]) && $_SESSION["IfRecorded"] == "yes") {
                                        
                                            echo MenuRecord();
                                        
                                            exit;
                                        }
                                        
                                        // טיפול בהקשות
                                        if (isset($_GET["MenuRecord"])) {
                                            
                                            $menuRecordOption = $_GET["MenuRecord"];
                                        
                                            $optionsParam = "menu_record_options_" . $menuRecordOption;
                                        
                                            if (isset($_GET[$optionsParam])) {
                                                $optionValue = $_GET[$optionsParam];
                                        
                                                if (function_exists($optionValue) || $optionValue == "noop") {
                                                        if ($optionValue == "record_play") {
                                                            echo record_play($RecordPath);
                                                        } elseif ($optionValue == "record_ok") {
                                                            echo record_ok($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                                        } elseif ($optionValue == "record_ok_and_run_tzintuk") {
                                                            echo record_ok_and_run_tzintuk($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                                        } elseif ($optionValue == "record_again") {
                                                            echo record_again($hangupInsertFile, $RecordName);
                                                        } elseif ($optionValue == "record_cancel") {
                                                            echo record_cancel($token, $RecordPath, $GoToFolderAndPlay, $ymApi);
                                                        } elseif ($optionValue == "continue_recording") {
                                                            echo continue_recording($hangupInsertFile, $RecordName);
                                                        } elseif ($optionValue == "noop") {
                                                            echo MenuRecord();
                                                    }
                                                }
                                            } else {
                                                if (array_key_exists($menuRecordOption, $recordFunctions)) {
                                                    $functionToCall = $recordFunctions[$menuRecordOption];
                                                    if ($functionToCall == "record_play") {
                                                        echo record_play($RecordPath);
                                                    } elseif ($functionToCall == "record_ok") {
                                                        echo record_ok($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                                    } elseif ($functionToCall == "record_ok_and_run_tzintuk") {
                                                        echo record_ok_and_run_tzintuk($token, $RecordPath, $GetPhone, $GoToFolderAndPlay, $ymApi);
                                                    } elseif ($functionToCall == "record_again") {
                                                        echo record_again($hangupInsertFile, $RecordName);
                                                    } elseif ($functionToCall == "record_cancel") {
                                                        echo record_cancel($token, $RecordPath, $GoToFolderAndPlay, $ymApi);
                                                    } elseif ($functionToCall == "continue_recording") {
                                                        echo continue_recording($hangupInsertFile, $RecordName);
                                                    }
                                                }else{
                                                    echo MenuRecord();
                                                }
                                            }
                                        }
                                        
                                        ?>
                                        
                                        A תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                        • C
                                          CUBASE נערך לאחרונה על ידי

                                          @amp-Software-0 מה עם זה?...

                                          תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                          • C
                                            CUBASE נערך לאחרונה על ידי CUBASE

                                            פוסט זה נמחק!
                                            תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                            • פוסט ראשון
                                              פוסט אחרון