Skip to main content
Question

show the notification in the page


i am integrating RC web widget in CRM now i want to show the notification on the CRM page whenever call is active.....so can you tell me how can i do this

2 replies

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2317 replies
  • July 22, 2022

Add this Javascript function to your code. Detect the event and do/show whatever you want to do with them,

window.addEventListener('message', (e) => {
  const data = e.data;
  if (data.call && data.call.direction == 'Inbound'){
    console.log(`Incoming call from: ${data.call.from.phoneNumber}. Call status: ${data.call.telephonyStatus}`)
    if (data.call.telephonyStatus == 'Ringing')
        console.log("Incoming call ringing")
  }
  if (data) {
    switch (data.type) {
      case 'rc-call-ring-notify':
        // when user gets a ringing call
        console.log("RINGING...")
        console.log(data.call);
        break;
      case 'rc-call-init-notify':
        // when user creates a call from dial
        console.log("SETUP...")
        console.log(data.call);
        break;
      case 'rc-call-start-notify':
        // when a incoming call is accepted or a outbound call is connected
        console.log("INCOMING RING...")
        console.log(data.call);
        break;
      case 'rc-call-hold-notify':
        // when user holds a call
        console.log(data.call);
        break;
      case 'rc-call-resume-notify':
        // when user unholds call
        console.log(data.call);
        break;
      case 'rc-call-end-notify':
        // when call ended
        console.log("TERMINATING...")
        console.log(data.call);
        break;
      case 'rc-call-mute-notify':
        // when muted or unmuted event
        console.log(data.call);
        break;
      case 'rc-message-updated-notify':
        console.log("VOICEMAIL?")
        console.log(data.message.type)
        console.log(data.message.uri)
        break
      default:
        console.log("OTHERS...")
        //console.log(data);
        break;
    }
  }
});

  • Author
  • New Participant
  • 4 replies
  • July 23, 2022

i want to show the message on website not in RC widget.........like when a call is answered on the page it shows (call active from {number} to {number}) so that other users of RC can see that on CRM can see that message


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings