cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4027
Views
10
Helpful
3
Replies

How to create custom element in CVP

tauqeer.nasir1
Level 4
Level 4

Dear Team,

I want to create the custom element in CVP call studio but unable to find any useful link or video. Please share if anyone has useful links or video.

Thank you,

Touqeer

3 Replies 3

vincent.zheng
Level 4
Level 4

What kind of element you want to create?

Hi Vincent,

I want to create an element to play an array of audio files.

Hi Tauqeer, 

 

You can create a custom action element by implementing ElementInterface. Here are the steps. 

 

  1. Create a new Java Class and extend it from ActionElementBase. 
  2. Implement ElementInterface to tell CVP that this is an element. 
  3. Overwride getElementName(), getDisplayFolderName() and getDescription() to give a meanigful name & description to your element. 
  4. Override doAction() method and write whatever logic you want.

Here is a simple code snippet. I have tried it is working fine. 

 

public class WebServiceAction extends ActionElementBase implements ElementInterface {

@Override
public String getElementName() {
return this.getClass().getSimpleName();
}

@Override
public String getDisplayFolderName() {
return this.getClass().getPackage().getName();
}

@Override
public String getDescription() {
return "This element does nothing :) .";
}

@Override
public void doAction(String arg0, ActionElementData arg1) throws Exception {
// write you logic here

}

}

Once you are done with your business logic. Follow these steps to see the element in the call studio. 

  1. Copy compiled (.class) file of your Java Class.
  2. Place the compiled file into your VXML project classes directory  (your-vxml-app > deploy > java > application > classes) 
  3. Make sure you place the file according to your package hierarchy. If your package name is com.ef.customelement. Create the folder hierarchy (com> ef> customelement) and then place the file. 
  4. Close your VXML application project and open it again.
  5. Double click on your app.callflow file. 
  6. You should see your element under Elements > Local Elements. 

Remember: You will not be able to see your element until you double click on your app.callflow file. Also, the element would not come up if you forget to implement a right interface or did not override the required methods.

 

Cheers!