![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/gadevoir/app/fragment/ |
Upload File : |
import Fragment from "absol/src/AppPattern/Fragment"; import {$, _} from "../dom/Core"; import OOP from "absol/src/HTML5/OOP"; import '../../style/incomefrg.css'; /** * @typedef {{from: string, conversationId: string, incomeType:("voice"|"video")}} Income */ /*** * * @augments Income * @augments Fragment * @constructor * @param {Income} props */ function OutgoingFrg(props) { Fragment.call(this); this.to = null; this.outgoingType = 'voice'; /*** * * @type {GPhone|null} */ this.phone = null; Object.assign(this, props); } OOP.mixClass(OutgoingFrg, Fragment); OutgoingFrg.prototype.createView = function () { this.$view = _({ class: ['gdv-fragment', 'gdv-outgoing-frag'], child: [ { class: 'gdv-income-frag-info', child: [ { class: 'gdv-income-frag-name', child: { text: this.to } }, { class: 'gdv-income-frag-type', child: { text: 'outgoing voice chat' } }, { class: 'gdv-income-frag-status', child: { text: 'DIAL' } } ] }, { class: 'gdv-outgoing-frag-button-ctn', child: [ { tag: 'button', class: ['gdv-income-frag-action-btn', 'gdv-outgoing-frag-cancel-btn'], child: 'span.mdi.mdi-phone-hangup' } ] }] }); this.$cancelBtn = $('.gdv-outgoing-frag-cancel-btn', this.$view) .on('click', this.cancel.bind(this)); this.$status = $('.gdv-income-frag-status', this.$view); }; OutgoingFrg.prototype.onStart = function () { this.phone = this.getContext("PHONE"); this.phone.dial(this.to, 20000, function (data) { if (data.state === 'WAITING') { this.$status.firstChild.data = "WAITING"; } else if (data.state === "ACCEPT") { this.returns = { answer: "ACCEPT" }; this.stop(); } else /*if (data.state === "NOT_RESPONSE" || data.state === "BUSY" || data.state === 'NOT_ANSWER')*/ { this.$status.firstChild.data = data.state; this.returns = { state: data.state }; this.$cancelBtn.disabled = true; setTimeout(this.stop.bind(this), 3000); } }.bind(this)); }; OutgoingFrg.prototype.onStop = function () { // this.connector.offReceive('outgoing_response', this.ev_receiveOutgoingResponse); // clearInterval(this._statusAnim); }; OutgoingFrg.prototype.cancel = function () { this.$cancelBtn.disabled = true; this.$status.firstChild.data = "CANCELED"; setTimeout(this.stop.bind(this), 500); }; export default OutgoingFrg;