This interface is used as the result of the VoipParseWebhookRequest function and determines the system's actions based on a request sent to the webhook of the telephony module.

Hierarchy

  • VoipWebhookParseResult

Properties

Optional callRecord

callRecord: VoipCallRecord

Information about the call recording.

If this field is filled out, the system will save the recording of the call in the activity stream of the associated app item. Data from this field is used by the system to display the widget that allows listening to call recordings in the activity stream.

async function  VoipParseWebhookRequest(request: FetchRequest):  Promise<VoipWebhookParseResult> {
    const data = JSON.parse(request.body);  
    return { 
         callRecord: { 
             srcPhone:  data.srcPhone, 
             dstPhone: data.dstPhone, 
              direction: VoipCallDirection.In, 
             duration: data.duration,  
             // Data from this field will be available in the ` VoipGetCallLink function` 
             call: { 
                 link:  data.callLink, 
             }, 
             disposition:  VoipCallDisposition.Answered, 
         } 
     }; 
} 
async function  VoipGetCallLink(callData: any): Promise<string> { 
    return callData. callLink; // Getting the data saved in VoipParseWebhookRequest 
} 

Optional event

A telephony event. If this field is filled out, the system displays notifications about calls to the associated users.

async function VoipParseWebhookRequest(request: FetchRequest):  Promise<VoipWebhookParseResult> {
  const data = JSON.parse(request.body);  
  return { 
      event: { 
          event:  VoipWebhookEvent.NotifyStart, 
          direction: VoipCallDirection.In,  
          dstPhone: data.dstPhone, 
          srcPhone: data.srcPhone,  
          disposition: VoipCallDisposition.Unknown, 
      }; 
  }; 
}  

Optional response

response: HttpResponse

If the field is filled out, the client who is sending a request to the webhook receives an HTTP response.

async function VoipParseWebhookRequest(request: FetchRequest):  Promise<VoipWebhookParseResult> {
   return { 
       response: new  HttpResponse() 
           .status(400) 
           .content('Hello,  world!'), 
   }; 
}