diff --git a/src/app/pd/chat-component/chat-component.component.ts b/src/app/pd/chat-component/chat-component.component.ts index 475710f..b0f62b8 100644 --- a/src/app/pd/chat-component/chat-component.component.ts +++ b/src/app/pd/chat-component/chat-component.component.ts @@ -55,7 +55,7 @@ export class ChatComponentComponent implements OnInit { this.randomStr = this.route.snapshot.paramMap.get('randomStr') // this.flag= this.route.snapshot.paramMap.get('flag'); this.pd_category = this.route.snapshot.paramMap.get('pd_category') - console.log(this.pd_category) + console.log("pd category in compnt ",this.pd_category); this.type = this.route.snapshot.paramMap.get('type') this.pd_id = this.route.snapshot.paramMap.get('id') this.cm_name = this.route.snapshot.paramMap.get('uid') @@ -71,22 +71,15 @@ export class ChatComponentComponent implements OnInit { } this.type_name = this.type == '1' ? 'CUSTOMER' : this.type == '2' ? 'PDOFFICER' : this.type == '3' ? this.cm_name : 'UNKNOWN' if(this.type == '2' || this.type == '3') { - if(this.pd_category == '2'){ - if(window.location.origin.includes('localhost')){ - this.cusUrl = window.location.origin+'/#/chat/'+this.randomStr+";id="+this.pd_id+";type=1"+";pd_category=2"; - } - else{ - this.cusUrl = window.location.origin+'/vchat/#/chat/'+this.randomStr+";id="+this.pd_id+";type=1"+";pd_category=2"; - } - }else{ - if(window.location.origin.includes('localhost')){ + if(window.location.origin.includes('localhost')){ this.cusUrl = window.location.origin+'/#/chat/'+this.randomStr+";id="+this.pd_id+";type=1;"; - } - else{ - this.cusUrl = window.location.origin+'/vchat/#/chat/'+this.randomStr+";id="+this.pd_id+";type=1;"; - } } - + else{ + this.cusUrl = window.location.origin+'/vchat/#/chat/'+this.randomStr+";id="+this.pd_id+";type=1;"; + } + if(this.pd_category == '2'){ + this.cusUrl = this.cusUrl+"pd_category=2"; + } } this.username = this.route.snapshot.paramMap.get('name') if (this.username == null) { @@ -107,7 +100,7 @@ export class ChatComponentComponent implements OnInit { }) - console.log(navigator.getUserMedia) + // console.log(navigator.getUserMedia) // if (navigator.getUserMedia) // navigator.getUserMedia({ audio: true, video: true }, function (stream) { @@ -153,15 +146,11 @@ export class ChatComponentComponent implements OnInit { this.twilioService.localVideo = this.localVideo; this.twilioService.remoteVideo = this.remoteVideo; + this.twilioService.user_data = {type:this.type,pd_id:this.pd_id,random_string:this.randomStr,type_name:this.type_name} if(this.pd_category == '2'){ - console.log('pd_category') - this.twilioService.user_data = {type:this.type,pd_id:this.pd_id,random_string:this.randomStr,type_name:this.type_name,pd_category:this.pd_category} - }else{ - this.twilioService.user_data = {type:this.type,pd_id:this.pd_id,random_string:this.randomStr,type_name:this.type_name} - console.log('151') + this.twilioService.user_data['pd_category']=this.pd_category ; } - - + // console.log(this.twilioService.user_data); console.log("Getting token", this.twilioService.localVideo, this.localVideo, this.remoteVideo, this.type_name); } diff --git a/src/app/pd/services/twilio/twilio.service.ts b/src/app/pd/services/twilio/twilio.service.ts index 1cdc809..1487b44 100644 --- a/src/app/pd/services/twilio/twilio.service.ts +++ b/src/app/pd/services/twilio/twilio.service.ts @@ -34,7 +34,7 @@ export class TwilioService { private router: Router, private rendererFactory: RendererFactory2,private _snackBar:MatSnackBar) { this.renderer = rendererFactory.createRenderer(null, null); - console.log(this.user_data) + console.log("User Data From Component",this.user_data); } getToken(params): Observable { // return Observable.create((observer:any)=>{ @@ -137,39 +137,28 @@ export class TwilioService { }); - console.log('abc'); + console.log(this.getWithOutCustomer); let withoutcustomer = this.getWithOutCustomer(this.roomParticipants) console.log('getWithOutCustomer',withoutcustomer) - console.log('count'); - console.log(withoutcustomer); + if((this.user_data.type == '1' && withoutcustomer == '1') ||(this.user_data.type == '2' && withoutcustomer == '1')){ - console.log('sineedge'); - // alert('record'); + console.log("User type in service",this.user_data) - console.log(this.user_data.pd_category) - let params + let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"0"} + console.log(this.user_data.pd_category) if(this.user_data.pd_category == '2'){ - console.log('pd cat') - params = {"pd_category":this.user_data.pd_category,"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} - }else{ - console.log('pd cat else') - params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} + params["pd_category"] = this.user_data.pd_category; } - console.log("connected api",params) + console.log("connected api",params) this.sendRoomandStatus(params).subscribe(rr=>{}) } else if(this.user_data.type == '3' && withoutcustomer == '1'){ - console.log('lenderdemo'); console.log("User type in service",this.user_data) - let params + let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"0"} if(this.user_data.pd_category == '2'){ - console.log('pd cat') - params = {"pd_category":this.user_data.pd_category,"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} - }else{ - console.log('pd cat else') - params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} + params["pd_category"] = this.user_data.pd_category; } console.log("connected api",params) this.sendRoomandStatus(params).subscribe(rr=>{}) @@ -561,28 +550,20 @@ disconnect(){ if (this.roomObj && this.roomObj !== null) { console.log("User type in service",this.user_data,this.remoteVideo) if(this.user_data.type == '2' && this.remoteVideo.nativeElement.firstChild != null) { - let params + let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} if(this.user_data.pd_category == '2'){ - console.log('pd cat') - params = {"pd_category":this.user_data.pd_category,"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} - }else{ - console.log('pd cat else') - params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} + params["pd_category"] = this.user_data.pd_category; } - - console.log("disconnected api",params) + console.log("disconnected Fns in twilioservice t2 ",params); this.sendRoomandStatus(params).subscribe(rr=>{}) } else if(this.user_data.type == '3' && withoutcustomer == '0'){ console.log("User type in service",this.user_data) - let params + let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} if(this.user_data.pd_category == '2'){ - console.log('pd cat') - params = {"pd_category":this.user_data.pd_category,"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} - }else{ - console.log('pd cat else') - params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} - } console.log("disconnected api",params) + params["pd_category"] = this.user_data.pd_category; + } + console.log("disconnected Fns in twilioservice t3 ",params); this.sendRoomandStatus(params).subscribe(rr=>{}) } this.roomObj.disconnect();