TP-89230 | callid and dispose call

This commit is contained in:
Mayank Singh
2024-11-25 08:15:46 +05:30
parent e6a3587b02
commit f7b9d5f518

View File

@@ -42,10 +42,84 @@ class AmeyoAdapter implements IAdapter {
private sipAccountInfo: GenericObject;
private isAgentAvailable: boolean;
const
_appendTags = () => {
// Helper function to create and append elements
function createElement(tag, attributes = {}, parent = document.body) {
const element = document.createElement(tag);
// Set attributes
Object.keys(attributes).forEach(attr => {
if (attr === 'style') {
Object.assign(element.style, attributes.style); // Set styles
} else {
element[attr] = attributes[attr]; // Set other attributes
}
});
parent.appendChild(element);
return element;
}
createElement('audio', {
id: 'audio_remote',
autoplay: true
});
createElement('video', {
className: 'video',
width: '100%',
height: '100%',
id: 'video_local',
autoplay: true,
muted: true,
style: {
opacity: '0',
backgroundColor: '#000000',
WebkitTransitionProperty: 'opacity',
WebkitTransitionDuration: '2s'
}
});
createElement('video', {
className: 'video',
width: '100%',
height: '100%',
id: 'video_remote',
autoplay: true,
style: {
opacity: '0',
backgroundColor: '#000000',
WebkitTransitionProperty: 'opacity',
WebkitTransitionDuration: '2s'
}
});
createElement('audio', {
id: 'ringtone',
loop: true,
src: 'public-assets.np.navi-gi.in/jarvis/ringtone.wav'
});
createElement('audio', {
id: 'ringbacktone',
loop: true,
src: 'public-assets.np.navi-gi.in/jarvis/ringbacktone.wav'
});
createElement('audio', {
id: 'dtmfTone',
src: 'public-assets.np.navi-gi.in/jarvis/dtmf.wav'
});
}
constructor(options: AmeyoInitializationOptions) {
console.log('AmeyoAdapter constructor');
const script = document.createElement('script');
script.src = 'https://public-assets.np.navi-gi.in/jarvis/sip5ml.js'; // Assuming it's placed in the public folder
this._appendTags();
script.async = true;
document.body.appendChild(script);
this.baseUrl = options.baseUrl;