soft-phone
Version:
143 lines • 9.51 kB
JavaScript
import { Component } from '@angular/core';
import { PhoneService } from '../../../service/index';
import { CallState } from '../../index';
var RecipientDetailComponent = /** @class */ (function () {
function RecipientDetailComponent(service) {
this.service = service;
}
RecipientDetailComponent.prototype.ngOnInit = function () {
};
RecipientDetailComponent.prototype.displayOutbound = function () {
if (this.service.status === CallState.ActiveCallOutbound || this.service.status === CallState.InCall) {
return true;
}
return false;
};
RecipientDetailComponent.prototype.displayInbound = function () {
if (this.service.status === CallState.ActiveCallInbound) {
return true;
}
return false;
};
RecipientDetailComponent.prototype.isNewCustomer = function () {
if (this.service.selectedUser) {
if (this.service.selectedUser.fullname === this.service.selectedUser.phoneNumber) {
return true;
}
}
return false;
};
RecipientDetailComponent.prototype.forwardCall = function () {
if (this.service.selectedUser) {
this.service.status = CallState.DialPadForwarding;
this.service.displayText = "";
}
};
RecipientDetailComponent.prototype.displayEndCall = function () {
if (this.service.status !== CallState.ActiveCallInbound && (this.service.status === CallState.ActiveCallForwarding || this.service.status === CallState.ActiveCallOutbound || this.service.status === CallState.InCall)) {
return true;
}
return false;
};
RecipientDetailComponent.prototype.displayForwardCall = function () {
if (this.service.status === CallState.InCall) {
return true;
}
return false;
};
RecipientDetailComponent.prototype.displayAcceptCall = function () {
if (this.service.status === CallState.ActiveCallInbound) {
return true;
}
return false;
};
RecipientDetailComponent.prototype.displayRejectCall = function () {
if (this.service.status === CallState.ActiveCallInbound) {
return true;
}
return false;
};
RecipientDetailComponent.prototype.displayToggleHoldResumeCall = function () {
if (this.service.status === CallState.InCall) {
return true;
}
return false;
};
RecipientDetailComponent.prototype.displayToggleMuteCall = function () {
if (this.service.status === CallState.InCall) {
return true;
}
return false;
};
RecipientDetailComponent.prototype.displayStatus = function () {
if (this.service.status === CallState.ActiveCallOutbound || this.service.status === CallState.ActiveCallForwarding) {
//this.callStat = CallStatus[CallStatus.Ringing.toString()];
return true;
}
return false;
};
RecipientDetailComponent.prototype.displayTimer = function () {
if (this.service.status === CallState.InCall) {
this.min = "00";
this.sec = "06";
return true;
}
return false;
};
RecipientDetailComponent.prototype.acceptCall = function () {
this.service.callSession.accept();
};
RecipientDetailComponent.prototype.rejectCall = function () {
this.service.callSession.reject();
};
RecipientDetailComponent.prototype.toggleHoldResumeCall = function () {
if (this.service.callSession) {
var i_ret;
this.service.btnHoldResumedisabled = true;
this.service.callStat = this.service.callSession.bHeld ? '<i>Resuming the call...</i>' : '<i>Holding the call...</i>';
i_ret = this.service.callSession.bHeld ? this.service.callSession.resume() : this.service.callSession.hold();
if (i_ret != 0) {
this.service.callStat = 'Hold / Resume failed';
this.service.btnHoldResumedisabled = false;
return;
}
}
};
// Mute or Unmute the call
RecipientDetailComponent.prototype.toggleMuteCall = function () {
if (this.service.callSession) {
var i_ret;
var bMute = !this.service.callSession.bMute;
this.service.callStat = bMute ? 'Mute the call...' : 'Unmute the call...';
i_ret = this.service.callSession.mute('audio' /*could be 'video'*/, bMute);
if (i_ret != 0) {
this.service.callStat = 'Mute / Unmute failed';
return;
}
this.service.callSession.bMute = bMute;
this.service.btnMutevalue = bMute ? "Unmute" : "Mute";
}
};
// terminates the call (SIP BYE or CANCEL)
RecipientDetailComponent.prototype.hangUpCall = function () {
var _this = this;
if (this.service.callSession) {
this.service.callStat = 'Terminating the call..';
this.service.callSession.hangup({ events_listener: { events: '*', listener: function (e) { _this.service.onSipEventSession(e); } } });
}
};
RecipientDetailComponent.decorators = [
{ type: Component, args: [{
selector: 'recipient-detail',
template: "\n <div class=\"ui-g\" >\n <div class=\"ui-g-12 nopad\" >\n <recipient-summary *ngIf=\"service.selectedAgent\" [agent]=\"service.selectedAgent\" [displayOutbound] =\"false\" [displayForward]=\"true\"></recipient-summary>\n </div> \n\n\n </div>\n\n\n <div *ngIf=\"service.selectedUser\" class=\"ui-g-12\" class=\"Caller-details\">\n <div *ngIf=\"displayOutbound()\" class=\"ui-g-12\" style=\"float: right\" ><span class=\"material-icons ui-icon-forward item-icon\" style=\"font-size:20px\" ></span></div> \n <div *ngIf=\"displayInbound()\" class=\"ui-g-12\" style=\"float: right\" ><span class=\"material-icons ui-icon-arrow-back item-icon\" style=\"font-size:20px\" ></span></div> \n <div class=\"ui-g-12\"><span class=\"material-icons ui-icon-person item-icon\" style=\"font-size:250px\" ></span></div>\n <div class=\"ui-g-12\" >\n <div> <h3>{{service.selectedUser.fullname}}</h3> <span *ngIf=\"isNewCustomer()\" class=\"material-icons ui-icon-add item-icon\" ></span> </div>\n <p>{{service.selectedUser.Contact}}</p>\n <p>{{service.selectedUser.Address}}</p>\n <p>{{service.selectedUser.Anniversary}}</p>\n <p>{{service.selectedUser.Demography}}</p>\n\n <span class=\"ui-g-6 nopad\" *ngFor=\"let d of service.selectedUser.details\" ><a href=\"localhost:3005\"><span class=\"material-icons ui-icon-rss-feed item-icon\" style=\"font-size:10px\" ></span> {{d.description}}</a></span>\n\n \n <a href=\"localhost:3005\">more...</a>\n <div class=\"nopad\"><span *ngIf=\"displayStatus()\" >{{service.callStat}}</span><span *ngIf=\"displayTimer()\" >{{min}} : {{sec}}</span></div>\n </div>\n <div class=\"ui-g-12\" >\n <button *ngIf=\"displayEndCall()\" pButton type=\"button\" (click)=\"hangUpCall()\" label=\"Hang Up Call\" id=\"btn\" ></button>\n <button *ngIf=\"displayForwardCall()\" pButton type=\"button\" (click)=\"forwardCall()\" label=\"Forward Call\" id=\"btn\" [disabled]=service.forwardCallvalue ></button>\n <button *ngIf=\"displayRecordCall()\" pButton type=\"button\" (click)=\"service.recordCall(1)\" label=\"Record Call\" id=\"btn\" [disabled]=service.recordCallvalue ></button>\n <button *ngIf=\"displayAcceptCall()\" pButton type=\"button\" (click)=\"acceptCall()\" label=\"Accept Call\" id=\"btn\" ></button>\n <button *ngIf=\"displayRejectCall()\" pButton type=\"button\" (click)=\"rejectCall()\" label=\"Reject Call\" id=\"btn\" ></button>\n <button *ngIf=\"displayToggleHoldResumeCall()\" pButton type=\"button\" (click)=\"toggleHoldResumeCall()\" label=\"{{service.btnHoldResumedvalue}}\" [disabled]=service.btnHoldResumedisabled id=\"btn\" ></button>\n <button *ngIf=\"displayToggleMuteCall()\" pButton type=\"button\" (click)=\"toggleMuteCall()\" label=\"{{service.btnMutevalue}}\" id=\"btn\" ></button>\n </div>\n </div>\n ",
styles: ["\n #panel{width:450px;margin:0 auto}#panel-heada{text-align:center}.Caller-details{text-align:center}.Call-button{text-align:center}#btn{width:250px}.fone{text-align:center}body #kpp .ui-button{width:280px;height:40px}body #kp .ui-button{width:80px;height:80px;float:none}.butgrp{padding-bottom:0px}.nopad{padding:0px}.short{height:184px;max-height:184px;overflow-y:auto;overflow-x:hidden;width:280px}.phone-width{width:290px}.expand{min-height:184px;max-height:395px;overflow-x:hidden;overflow-y:auto}.full-width{width:100%}body .md-inputfield{margin-bottom:5px}.c-input span input{width:100% !important}.recip{width:280px;height:60px;margin:0px}\n "]
},] },
];
/** @nocollapse */
RecipientDetailComponent.ctorParameters = function () { return [
{ type: PhoneService, },
]; };
return RecipientDetailComponent;
}());
export { RecipientDetailComponent };
//# sourceMappingURL=recipient-detail.component.js.map