I am trying to create a custom CTI panel using calling-extensions-sdk, but unfortunately I cannot figure out how to do the redirect to a different domain, where my PBX is running.
Here is my scenario:
I set an initial URL to a decision server. It retrieves the portal ID, makes the API request to get the URL.
P.S: It works, when the initial URL is set to the same domain as the final domain, e.g. company1.x.com. The problem is that at the beginning I don’t know which domain should be set, because it is retrieved based on the portal ID.
I am trying to create a custom CTI panel using calling-extensions-sdk, but unfortunately I cannot figure out how to do the redirect to a different domain, where my PBX is running.
Here is my scenario:
I set an initial URL to a decision server. It retrieves the portal ID, makes the API request to get the URL.
P.S: It works, when the initial URL is set to the same domain as the final domain, e.g. company1.x.com. The problem is that at the beginning I don’t know which domain should be set, because it is retrieved based on the portal ID.
The issue you’re encountering occurs because you are trying to set the widget URL and immediately redirect the page, which can cause a conflict since the redirection interrupts the process of setting the iframe URL. To resolve this, you should first set the widget URL using SET_WIDGET_URL and only perform the redirect afterward. This ensures the iframe URL is correctly updated before the page navigates away. Additionally, it’s a good idea to add a slight delay (using setTimeout) before the redirect happens, allowing enough time for the SET_WIDGET_URL request to be processed. By setting the URL first and then redirecting after a short delay, you ensure that both actions occur successfully without interfering with each other