diff --git a/src/app/pd/chat-component/chat-component.component.ts b/src/app/pd/chat-component/chat-component.component.ts index 4b35d08..5d12d04 100644 --- a/src/app/pd/chat-component/chat-component.component.ts +++ b/src/app/pd/chat-component/chat-component.component.ts @@ -45,6 +45,7 @@ export class ChatComponentComponent implements OnInit { cusUrl: string = ''; private renderer: Renderer2; cm_name: string; + pd_category: string; constructor( private router: Router, private route: ActivatedRoute, @@ -53,6 +54,8 @@ export class ChatComponentComponent implements OnInit { this.renderer = rendererFactory.createRenderer(null, null) 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) 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') @@ -140,7 +143,14 @@ 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') + } + 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 777c1b1..82efff5 100644 --- a/src/app/pd/services/twilio/twilio.service.ts +++ b/src/app/pd/services/twilio/twilio.service.ts @@ -34,6 +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) } getToken(params): Observable { // return Observable.create((observer:any)=>{ @@ -545,7 +546,13 @@ 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 = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} + let params + if(this.user_data.pd_category == '2'){ + 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{ + params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"} + } + console.log("disconnected api",params) this.sendRoomandStatus(params).subscribe(rr=>{}) }