/**
 * Minified by jsDelivr using Terser v5.19.2.
 * Original file: /npm/sipml@2.1.4/sipml.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
SIPml={},SIPml.b_initialized=!1,SIPml.b_initializing=!1,SIPml.s_navigator_friendly_name="unknown",SIPml.b_navigator_outdated=!1,SIPml.s_navigator_version="unknown",SIPml.s_system_friendly_name="unknown",SIPml.b_webrtc4all_plugin_outdated=!1,SIPml.b_webrtc4all_supported=!1,SIPml.s_webrtc4all_version="unknown",SIPml.b_have_media_stream=!1,SIPml.b_webrtc_supported=!1,SIPml.setDebugLevel=function(e){tsk_utils_log_set_level("fatal"===e?1:"error"===e?2:"warn"===e?3:4)},SIPml.startNativeDebug=function(){WebRtc4all_GetPlugin().startDebug()},SIPml.stopNativeDebug=function(){WebRtc4all_GetPlugin().stopDebug()},SIPml.getWebRtcType=function(){switch(WebRtc4all_GetType()){case WebRtcType_e.W4A:case WebRtcType_e.IE:case WebRtcType_e.NPAPI:return"w4a";case WebRtcType_e.ERICSSON:return"erisson";case WebRtcType_e.NATIVE:return"native";default:return"unknown"}},SIPml.setWebRtcType=function(e){if(SIPml.isInitialized())throw new Error("ERR_ALREADY_INITIALIZED: Engine already initialized.");return WebRtc4all_SetType(e)},SIPml.getRunningApps=function(){if("w4a"!=SIPml.getWebRtcType())throw new Error("ERR_NOT_SUPPORTED: requires webrtc4all plugin");return WebRtc4all_GetPlugin().runningApps()},SIPml.setFps=function(e){if("w4a"!=SIPml.getWebRtcType())throw new Error("ERR_NOT_SUPPORTED: Setting maximum video size requires webrtc4all plugin");return WebRtc4all_GetPlugin().fps=e,0},SIPml.setMaxVideoSize=function(e){if("w4a"!=SIPml.getWebRtcType())throw new Error("ERR_NOT_SUPPORTED: Setting FPS requires webrtc4all plugin");return WebRtc4all_GetPlugin().maxVideoSize=e,0},SIPml.setMaxBandwidthUp=function(e){if("w4a"!=SIPml.getWebRtcType())throw new Error("ERR_NOT_SUPPORTED: Setting maximum bandwidth requires webrtc4all plugin");return WebRtc4all_GetPlugin().maxBandwidthUp=e,0},SIPml.setMaxBandwidthDown=function(e){if("w4a"!=SIPml.getWebRtcType())throw new Error("ERR_NOT_SUPPORTED: Setting maximum bandwidth requires webrtc4all plugin");return WebRtc4all_GetPlugin().maxBandwidthDown=e,0},SIPml.setZeroArtifacts=function(e){if("w4a"!=SIPml.getWebRtcType())throw new Error("ERR_NOT_SUPPORTED: Setting maximum bandwidth requires webrtc4all plugin");return WebRtc4all_GetPlugin().zeroArtifacts=e,0},SIPml.getWebRtc4AllVersion=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.s_webrtc4all_version},SIPml.getNavigatorVersion=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.s_navigator_version},SIPml.getNavigatorFriendlyName=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.s_navigator_friendly_name},SIPml.getSystemFriendlyName=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.s_system_friendly_name},SIPml.isNavigatorOutdated=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.b_navigator_outdated},SIPml.isWebRtc4AllPluginOutdated=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.b_webrtc4all_plugin_outdated},SIPml.isWebRtc4AllSupported=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.b_webrtc4all_supported},SIPml.isScreenShareSupported=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return"w4a"===SIPml.getWebRtcType()||navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1])>=26},SIPml.isWebRtcSupported=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.b_webrtc_supported},SIPml.isWebSocketSupported=function(){return tsk_utils_have_websocket()},SIPml.haveMediaStream=function(){if(!SIPml.isInitialized())throw new Error("ERR_NOT_INITIALIZED: Engine not initialized yet. Please call 'SIPml.init()' first");return SIPml.b_have_media_stream},SIPml.isReady=function(){return SIPml.isInitialized()&&SIPml.isWebRtcSupported()&&SIPml.haveMediaStream()},SIPml.isInitialized=function(){return SIPml.b_initialized},SIPml.init=function(e,t){if(!SIPml.b_initialized&&!SIPml.b_initializing){if(SIPml.b_initializing=!0,tsk_utils_init_webrtc(),tsk_utils_log_info("User-Agent="+(navigator.userAgent||"unknown")),SIPml.b_have_media_stream=tsk_utils_have_stream(),SIPml.b_webrtc_supported=tsk_utils_have_webrtc(),SIPml.b_webrtc4all_supported=tsk_utils_have_webrtc4all(),SIPml.s_webrtc4all_version=tsk_utils_webrtc4all_get_version(),SIPml.s_navigator_friendly_name=tsk_utils_get_navigator_friendly_name(),SIPml.s_system_friendly_name=tsk_utils_get_system_friendly_name(),tsk_utils_log_info("WebSocket supported = "+(SIPml.isWebSocketSupported()?"yes":"no")),tsk_utils_have_webrtc4all()&&(tsk_utils_log_info("WebRTC type = "+WebRtc4all_GetType()+" version = "+tsk_utils_webrtc4all_get_version()),"1.35.981"!=SIPml.s_webrtc4all_version&&(SIPml.b_webrtc4all_plugin_outdated=!0)),tsk_utils_log_info("Navigator friendly name = "+SIPml.s_navigator_friendly_name),"ie"==SIPml.s_navigator_friendly_name)null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)&&(SIPml.s_navigator_version=RegExp.$1);if(tsk_utils_log_info("OS friendly name = "+SIPml.s_system_friendly_name),tsk_utils_log_info("Have WebRTC = "+(tsk_utils_have_webrtc()?"yes":"false")),tsk_utils_log_info("Have GUM = "+(tsk_utils_have_stream()?"yes":"false")),!tsk_utils_have_webrtc()){if("chrome"==SIPml.s_navigator_friendly_name)return void(SIPml.b_navigator_outdated=!0);if(("win"==SIPml.s_system_friendly_name||"windows"==SIPml.s_system_friendly_name)&&"ie"==SIPml.s_navigator_friendly_name){var i=-1,s=navigator.userAgent;if(null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(s)&&(i=parseFloat(RegExp.$1)),i<9)return void(SIPml.b_navigator_outdated=!0);if(!tsk_utils_have_webrtc4all())return}}if(SIPml.b_webrtc_supported&&SIPml.b_have_media_stream)SIPml.b_initialized=!0,SIPml.b_initializing=!1,tsk_utils_log_info("Engine initialized"),e&&e({});else if(t)t({description:SIPml.b_webrtc_supported?SIPml.b_have_media_stream?"Internal error":"getUserMedia not supported":"WebRTC not supported"})}},SIPml.EventTarget=function(){this.ao_listeners=[]},SIPml.EventTarget.prototype.addEventListener=function(e,t){if(!t)throw new Error("ERR_INVALID_PARAMETER_VALUE: 'listener' must not be null");if(!e)throw new Error("ERR_INVALID_PARAMETER_VALUE: 'type' must not be null");if(!(e instanceof String||"string"==typeof e||e instanceof Array))throw new Error("ERR_INVALID_PARAMETER_TYPE: 'type' must be a string or array");if(e instanceof Array){var i=this;e.forEach((function(e){!tsk_string_is_null_or_empty(e)&&tsk_string_is_string(e)&&(i.ao_listeners[e]=t)}))}else this.ao_listeners[e]=t},SIPml.EventTarget.prototype.removeEventListener=function(e){tsk_string_is_string(e)&&!tsk_string_is_null_or_empty(e)&&(this.ao_listeners[e]=void 0)},SIPml.EventTarget.prototype.dispatchEvent=function(e){var t=this.ao_listeners[e.s_type]||this.ao_listeners["*"];t&&t.call(this,e.o_value)},SIPml.Event=function(e,t){this.type=e,this.description=t?t.s_phrase:e,this.o_event=t},SIPml.Event.prototype.getSipResponseCode=function(){var e=this.o_event?this.o_event.get_message():null;return e&&e.is_response()?e.get_response_code():-1},SIPml.Event.prototype.getContent=function(){var e=this.o_event?this.o_event.get_message():null;return e?e.get_content():null},SIPml.Event.prototype.getContentString=function(){var e=this.o_event?this.o_event.get_message():null;return e?e.get_content_as_string():null},SIPml.Event.prototype.getContentType=function(){var e=this.o_event?this.o_event.get_message():null;return e?e.get_content_type():null},SIPml.Stack=function(e){if(SIPml.init(),SIPml.EventTarget.call(this),!e)throw new Error("ERR_INVALID_PARAMETER_VALUE: null configuration value");if(tsk_string_is_null_or_empty(e.realm))throw new Error("ERR_INVALID_PARAMETER_VALUE: '"+e.realm+"' is not valid as realm value");if(tsk_string_is_null_or_empty(e.impi))throw new Error("ERR_INVALID_PARAMETER_VALUE: '"+e.impi+"' is not valid as impi value");if(tsk_string_is_null_or_empty(e.impu))throw new Error("ERR_INVALID_PARAMETER_VALUE: '"+e.impu+"' is not valid as impu value");var t,i,s=tsip_uri.prototype.Parse(e.impu);if(!s||!s.s_user_name||!s.s_host)throw new Error("ERR_INVALID_PARAMETER_VALUE: '"+e.impu+"' is not valid as SIP Uri");SIPml.isWebSocketSupported()?(t=(e.enable_rtcweb_breaker||window.location&&"https:"==window.location.protocol?10062:10060)+(new Date).getTime()%5*1e3,i="ns313841.ovh.net"):(t=5060,i=e.realm),this.o_stack=new tsip_stack(e.realm,e.impi,e.impu,i,t),this.o_stack.oStack=this,this.setConfiguration(e),this.o_stack.on_event_stack=function(e){var t;switch(e.i_code){case tsip_event_code_e.STACK_STARTING:t="starting";break;case tsip_event_code_e.STACK_STARTED:t="started";break;case tsip_event_code_e.STACK_STOPPING:t="stopping";break;case tsip_event_code_e.STACK_STOPPED:t="stopped";break;case tsip_event_code_e.STACK_FAILED_TO_START:t="failed_to_start";break;case tsip_event_code_e.STACK_FAILED_TO_STOP:t="failed_to_stop"}t&&e.o_stack.oStack.dispatchEvent({s_type:t,o_value:new SIPml.Stack.Event(t,e)})},this.o_stack.on_event_dialog=function(e){var t=null,i=e.o_session.i_id,s=e.o_session.o_stack.oStack.ao_sessions[i];if(s){switch(e.i_code){case tsip_event_code_e.DIALOG_TRANSPORT_ERROR:t="transport_error";break;case tsip_event_code_e.DIALOG_GLOBAL_ERROR:t="global_error";break;case tsip_event_code_e.DIALOG_MESSAGE_ERROR:t="message_error";break;case tsip_event_code_e.DIALOG_WEBRTC_ERROR:t="webrtc_error";break;case tsip_event_code_e.DIALOG_REQUEST_INCOMING:t="i_request";break;case tsip_event_code_e.DIALOG_REQUEST_OUTGOING:t="o_request";break;case tsip_event_code_e.DIALOG_REQUEST_CANCELLED:t="cancelled_request";break;case tsip_event_code_e.DIALOG_REQUEST_SENT:t="sent_request";break;case tsip_event_code_e.DIALOG_MEDIA_ADDED:t="media_added";break;case tsip_event_code_e.DIALOG_MEDIA_REMOVED:t="media_removed";break;case tsip_event_code_e.DIALOG_CONNECTING:t="connecting";break;case tsip_event_code_e.DIALOG_CONNECTED:t="connected";break;case tsip_event_code_e.DIALOG_BFCP_INFO:t="bfcp_info";break;case tsip_event_code_e.DIALOG_TERMINATING:t="terminating";break;case tsip_event_code_e.DIALOG_TERMINATED:t="terminated",e.o_session.o_stack.oStack.ao_sessions[i]=void 0}t&&s.dispatchEvent({s_type:t,o_value:new SIPml.Session.Event(s,t,e)})}else tsk_utils_log_warn("Cannot find session with id = "+i)},this.o_stack.on_event_message=function(e){var t=null,i=e.o_session.i_id,s=e.o_session.o_stack.oStack.ao_sessions[i];switch(e.e_message_type){case tsip_event_message_type_e.I_MESSAGE:t="i_new_message";break;case tsip_event_message_type_e.AO_MESSAGE:t="i_ao_request"}if(t)if("i_new_message"==t){var _=new SIPml.Stack.Event(t,e);_.newSession=new SIPml.Session.Message(e.o_session),e.o_session.o_stack.oStack.ao_sessions[i]=_.newSession,e.o_session.o_stack.oStack.dispatchEvent({s_type:t,o_value:_})}else s?s.dispatchEvent({s_type:t,o_value:new SIPml.Session.Event(s,t,e)}):tsk_utils_log_warn("Cannot find session with id = "+i+" and event = "+e.e_invite_type)},this.o_stack.on_event_publish=function(e){var t=null,i=e.o_session.i_id,s=e.o_session.o_stack.oStack.ao_sessions[i];if(s){switch(e.e_publish_type){case tsip_event_publish_type_e.I_PUBLISH:case tsip_event_publish_type_e.I_UNPUBLISH:break;case tsip_event_publish_type_e.AO_PUBLISH:case tsip_event_publish_type_e.AO_UNPUBLISH:t="i_ao_request"}t&&s.dispatchEvent({s_type:t,o_value:new SIPml.Session.Event(s,t,e)})}else tsk_utils_log_warn("Cannot find session with id = "+i+" and event = "+e.e_invite_type)},this.o_stack.on_event_subscribe=function(e){var t=null,i=e.o_session.i_id,s=e.o_session.o_stack.oStack.ao_sessions[i];if(s){switch(e.e_subscribe_type){case tsip_event_subscribe_type_e.I_SUBSCRIBE:case tsip_event_subscribe_type_e.I_UNSUBSRIBE:break;case tsip_event_subscribe_type_e.AO_SUBSCRIBE:case tsip_event_subscribe_type_e.AO_UNSUBSCRIBE:case tsip_event_subscribe_type_e.AO_NOTIFY:t="i_ao_request";break;case tsip_event_subscribe_type_e.I_NOTIFY:t="i_notify"}t&&s.dispatchEvent({s_type:t,o_value:new SIPml.Session.Event(s,t,e)})}else tsk_utils_log_warn("Cannot find session with id = "+i+" and event = "+e.e_invite_type)},this.o_stack.on_event_invite=function(e){var t=null,i=e.o_session.i_id,s=e.o_session.o_stack.oStack.ao_sessions[i];if(!s)switch(e.e_invite_type){case tsip_event_invite_type_e.I_NEW_CALL:case tsip_event_invite_type_e.M_STREAM_LOCAL_REQUESTED:case tsip_event_invite_type_e.M_STREAM_LOCAL_ACCEPTED:case tsip_event_invite_type_e.M_STREAM_LOCAL_REFUSED:case tsip_event_invite_type_e.M_BFCP_INFO:break;case tsip_event_invite_type_e.M_STREAM_LOCAL_ADDED:case tsip_event_invite_type_e.M_STREAM_REMOTE_ADDED:case tsip_event_invite_type_e.M_STREAM_LOCAL_REMOVED:case tsip_event_invite_type_e.M_STREAM_REMOTE_REMOVED:case tsip_event_invite_type_e.I_AO_REQUEST:return void tsk_utils_log_info("Not notifying to session with id = "+i+" for event = "+e.e_invite_type);default:return void tsk_utils_log_warn("Cannot find session with id = "+i+" and event = "+e.e_invite_type)}var _=function(e,t,i){if(e)return attachMediaStream(e,t),i&&t&&t.getAudioTracks().length>0||!i&&t&&t.getVideoTracks().length>0},n=function(t){var i=t?e.o_session.get_stream_local():e.o_session.get_stream_remote();_(t?s.videoLocal:s.videoRemote,i,!1)&&r(t?"m_stream_video_local_added":"m_stream_video_remote_added"),_(t?s.audioLocal:s.audioRemote,i,!0)&&r(t?"m_stream_audio_local_added":"m_stream_audio_remote_added")},o=function(e){_(e?s.videoLocal:s.videoRemote,null,!1)&&r(e?"m_stream_video_local_removed":"m_stream_video_remote_removed"),_(e?s.audioLocal:s.audioRemote,null,!0)&&r(e?"m_stream_audio_local_removed":"m_stream_audio_remote_removed")},r=function(t){if(t)switch(t){case"i_new_call":case"m_permission_requested":case"m_permission_accepted":case"m_permission_refused":var _=new SIPml.Stack.Event(t,e);"i_new_call"==t&&(_.newSession=new SIPml.Session.Call(e.o_session),e.o_session.o_stack.oStack.ao_sessions[i]=_.newSession),e.o_session.o_stack.oStack.dispatchEvent({s_type:t,o_value:_});break;default:s.dispatchEvent({s_type:t,o_value:new SIPml.Session.Event(s,t,e)})}};switch(e.e_invite_type){case tsip_event_invite_type_e.I_NEW_CALL:t="i_new_call";break;case tsip_event_invite_type_e.I_ECT_NEW_CALL:t="i_ect_new_call";break;case tsip_event_invite_type_e.I_AO_REQUEST:t="i_ao_request";break;case tsip_event_invite_type_e.M_EARLY_MEDIA:t="m_early_media";break;case tsip_event_invite_type_e.M_STREAM_LOCAL_REQUESTED:t="m_permission_requested";break;case tsip_event_invite_type_e.M_STREAM_LOCAL_ACCEPTED:t="m_permission_accepted";break;case tsip_event_invite_type_e.M_STREAM_LOCAL_REFUSED:t="m_permission_refused";break;case tsip_event_invite_type_e.M_STREAM_LOCAL_ADDED:return n(!0);case tsip_event_invite_type_e.M_STREAM_LOCAL_REMOVED:return o(!0);case tsip_event_invite_type_e.M_STREAM_REMOTE_ADDED:return n(!1);case tsip_event_invite_type_e.M_STREAM_REMOTE_REMOVED:return o(!1);case tsip_event_invite_type_e.M_LOCAL_HOLD_OK:t="m_local_hold_ok";break;case tsip_event_invite_type_e.M_LOCAL_HOLD_NOK:t="m_local_hold_nok";break;case tsip_event_invite_type_e.M_LOCAL_RESUME_OK:t="m_local_resume_ok";break;case tsip_event_invite_type_e.M_LOCAL_RESUME_NOK:t="m_local_resume_nok";break;case tsip_event_invite_type_e.M_REMOTE_HOLD:t="m_remote_hold";break;case tsip_event_invite_type_e.M_REMOTE_RESUME:t="m_remote_resume";break;case tsip_event_invite_type_e.M_BFCP_INFO:t="m_bfcp_info";break;case tsip_event_invite_type_e.O_ECT_TRYING:t="o_ect_trying";break;case tsip_event_invite_type_e.O_ECT_ACCEPTED:t="o_ect_accepted";break;case tsip_event_invite_type_e.O_ECT_COMPLETED:t="o_ect_completed";break;case tsip_event_invite_type_e.I_ECT_COMPLETED:t="i_ect_completed";break;case tsip_event_invite_type_e.O_ECT_FAILED:t="o_ect_failed";break;case tsip_event_invite_type_e.I_ECT_FAILED:t="i_ect_failed";break;case tsip_event_invite_type_e.O_ECT_NOTIFY:t="o_ect_notify";break;case tsip_event_invite_type_e.I_ECT_NOTIFY:t="i_ect_notify";break;case tsip_event_invite_type_e.I_ECT_REQUESTED:t="i_ect_requested";break;case tsip_event_invite_type_e.DIALOG_REQUEST_INCOMING:e.o_message&&e.o_message.is_info()&&(t="i_info")}r(t)}},SIPml.Stack.prototype=Object.create(SIPml.EventTarget.prototype),SIPml.Stack.prototype.ao_sessions=[],SIPml.Stack.prototype.setConfiguration=function(e){if(e.realm&&!tsk_string_is_string(e.realm))throw new Error("ERR_INVALID_PARAMETER_TYPE: '"+typeof e.realm+"' not a valid type for realm. String is expected");if(e.impi&&!tsk_string_is_string(e.impi))throw new Error("ERR_INVALID_PARAMETER_TYPE: '"+typeof e.impi+"' not a valid type for impi. String is expected");if(e.impu&&!tsk_string_is_string(e.impu))throw new Error("ERR_INVALID_PARAMETER_TYPE: '"+typeof e.impu+"' not a valid type for impu. String is expected");if(e.password&&!tsk_string_is_string(e.password))throw new Error("ERR_INVALID_PARAMETER_TYPE: '"+typeof e.password+"' not a valid type for password. String is expected");if(e.display_name&&!tsk_string_is_string(e.display_name))throw new Error("ERR_INVALID_PARAMETER_TYPE: '"+typeof e.display_name+"' not a valid type for display_name. String is expected");if(e.websocket_proxy_url&&!tsk_string_is_string(e.websocket_proxy_url))throw new Error("ERR_INVALID_PARAMETER_TYPE: '"+typeof e.websocket_proxy_url+"' not a valid type for websocket_proxy_url. String is expected");if(e.outbound_proxy_url&&!tsk_string_is_string(e.outbound_proxy_url))throw new Error("ERR_INVALID_PARAMETER_TYPE: '"+typeof e.outbound_proxy_url+"' not a valid type for outbound_proxy_url. String is expected");if(e.sip_headers&&"Array"!=typeof e.sip_headers&&!(e.sip_headers instanceof Array))throw new Error("ERR_INVALID_PARAMETER_TYPE: '"+typeof e.sip_headers+"' not a valid type for sip_headers. Array is expected");e.events_listener&&this.addEventListener(e.events_listener.events,e.events_listener.listener);var t=!!e.enable_rtcweb_breaker,i=!!e.enable_click2call,s=null==e.enable_early_ims||!!e.enable_early_ims,_=!!e.enable_media_stream_cache,n=e.bandwidth?e.bandwidth:{audio:void 0,video:void 0},o=e.video_size?e.video_size:{minWidth:void 0,minHeight:void 0,maxWidth:void 0,maxHeight:void 0},r=this.o_stack;return tsk_utils_log_info("s_websocket_server_url="+(e.websocket_proxy_url||"(null)")),tsk_utils_log_info("s_sip_outboundproxy_url="+(e.outbound_proxy_url||"(null)")),tsk_utils_log_info("b_rtcweb_breaker_enabled="+(t?"yes":"no")),tsk_utils_log_info("b_click2call_enabled="+(i?"yes":"no")),tsk_utils_log_info("b_early_ims="+(s?"yes":"no")),tsk_utils_log_info("b_enable_media_stream_cache="+(_?"yes":"no")),tsk_utils_log_info("o_bandwidth="+JSON.stringify(n)),tsk_utils_log_info("o_video_size="+JSON.stringify(o)),r.set(tsip_stack.prototype.SetPassword(e.password),tsip_stack.prototype.SetDisplayName(e.display_name),tsip_stack.prototype.SetProxyOutBoundUrl(e.outbound_proxy_url),tsip_stack.prototype.SetRTCWebBreakerEnabled(t),tsip_stack.prototype.SetClick2CallEnabled(i),tsip_stack.prototype.SetSecureTransportEnabled(t||window.location&&"https:"==window.location.protocol),tsip_stack.prototype.SetEarlyIMSEnabled(s),tsip_stack.prototype.SetWebsocketServerUrl(e.websocket_proxy_url),tsip_stack.prototype.SetIceServers(e.ice_servers),tsip_stack.prototype.SetMediaStreamCacheEnabled(_),tsip_stack.prototype.SetBandwidth(n),tsip_stack.prototype.SetVideoSize(o)),e.sip_headers&&e.sip_headers.forEach((function(e){!e||tsk_string_is_null_or_empty(e.name)||e.value&&!tsk_string_is_string(e.value)||r.set(tsip_stack.prototype.SetHeader(e.name,e.value))})),0},SIPml.Stack.prototype.start=function(){return this.o_stack.start()},SIPml.Stack.prototype.stop=function(e){return this.o_stack.stop(e)},SIPml.Stack.prototype.newSession=function(e,t){var i,s;if("register"==e)i=new tsip_session_register(this.o_stack),s=SIPml.Session.Registration;else if("message"==e)i=new tsip_session_message(this.o_stack),s=SIPml.Session.Message;else if("publish"==e)i=new tsip_session_publish(this.o_stack),s=SIPml.Session.Publish;else if("subscribe"==e)i=new tsip_session_subscribe(this.o_stack),s=SIPml.Session.Subscribe;else{if("call-audio"!=e&&"call-audiovideo"!=e&&"call-video"!=e&&"call-screenshare"!=e)throw new Error("ERR_INVALID_PARAMETER_VALUE: '"+e+"' not valid as session type");(i=new tsip_session_invite(this.o_stack)).s_type=e,s=SIPml.Session.Call}i.b_local=!0;var _=new s(i,t);return this.ao_sessions[_.getId()]=_,_},SIPml.Stack.Event=function(e,t){SIPml.Event.call(this,e,t)},SIPml.Stack.Event.prototype=Object.create(SIPml.Event.prototype),SIPml.Session=function(e,t){if(SIPml.EventTarget.call(this),!e)throw new Error("ERR_INVALID_PARAMETER_VALUE: Invalid session value");this.o_session=e,this.setConfiguration(t)},SIPml.Session.prototype=Object.create(SIPml.EventTarget.prototype),SIPml.Session.prototype.o_session=null,SIPml.Session.prototype.o_session=null,SIPml.Session.prototype.o_configuration=null,SIPml.Session.prototype.getId=function(){return this.o_session.get_id()},SIPml.Session.prototype.setConfiguration=function(e){if(e){var t=this.o_session;if(e.events_listener&&this.addEventListener(e.events_listener.events,e.events_listener.listener),this instanceof SIPml.Session.Call){t.set(tsip_session.prototype.SetBandwidth(e.bandwidth?e.bandwidth:{audio:void 0,video:void 0}),tsip_session.prototype.SetVideoSize(e.video_size?e.video_size:{minWidth:void 0,minHeight:void 0,maxWidth:void 0,maxHeight:void 0}),tsip_session.prototype.SetScreencastWindowID(e.screencast_window_id?e.screencast_window_id:0)),this.videoLocal=void 0===e.video_local?this.videoLocal:e.video_local,this.videoRemote=void 0===e.video_remote?this.videoRemote:e.video_remote,this.audioRemote=void 0===e.audio_remote?this.audioRemote:e.audio_remote,this.audioLocal=void 0===e.audio_local?this.audioLocal:e.audio_local;var i=function(e,t,i){if(e)return attachMediaStream(e,t),i&&t&&t.getAudioTracks().length>0||!i&&t&&t.getVideoTracks().length>0};i(this.videoLocal,t.get_stream_local(),!1)&&this.dispatchEvent({s_type:"m_stream_video_local_added",o_value:new SIPml.Session.Event(this,"m_stream_video_local_added")}),i(this.videoRemote,t.get_stream_remote(),!1)&&this.dispatchEvent({s_type:"m_stream_video_remote_added",o_value:new SIPml.Session.Event(this,"m_stream_video_remote_added")}),i(this.audioLocal,t.get_stream_local(),!0)&&this.dispatchEvent({s_type:"m_stream_audio_local_added",o_value:new SIPml.Session.Event(this,"m_stream_audio_local_added")}),i(this.audioRemote,t.get_stream_remote(),!0)&&this.dispatchEvent({s_type:"m_stream_audio_remote_added",o_value:new SIPml.Session.Event(this,"m_stream_audio_remote_added")})}e.sip_headers&&e.sip_headers.forEach((function(e){!e||tsk_string_is_null_or_empty(e.name)||e.value&&!tsk_string_is_string(e.value)||t.set(tsip_session.prototype.SetHeader(e.name,e.value))})),e.sip_caps&&e.sip_caps.forEach((function(e){!e||tsk_string_is_null_or_empty(e.name)||e.value&&!tsk_string_is_string(e.value)||t.set(tsip_session.prototype.SetCaps(e.name,e.value))})),e.expires&&t.set(tsip_session.prototype.SetExpires(e.expires)),e.from&&t.set(tsip_session.prototype.SetFromStr(e.from))}},SIPml.Session.prototype.getRemoteUri=function(){return(this.o_session.b_local?this.o_session.o_uri_to:this.o_session.o_uri_from).toString()},SIPml.Session.prototype.getRemoteFriendlyName=function(){var e=this.o_session.b_local?this.o_session.o_uri_to:this.o_session.o_uri_from;return e.s_display_name?e.s_display_name:e.s_user_name},SIPml.Session.prototype.reject=function(e){return this.setConfiguration(e),this.o_session.reject()},SIPml.Session.prototype.accept=function(e){return this.setConfiguration(e),this.o_session.accept()},SIPml.Session.Event=function(e,t,i){SIPml.Event.call(this,t,i),this.session=e},SIPml.Session.Event.prototype=Object.create(SIPml.Event.prototype),SIPml.Session.Event.prototype.getTransferDestinationFriendlyName=function(){var e=this.o_event?this.o_event.get_message():null;if(e){var t=e.get_header(tsip_header_type_e.Refer_To);if(t&&t.o_uri)return t.s_display_name?t.s_display_name:t.o_uri.s_user_name}return null},SIPml.Session.Registration=function(e,t){SIPml.Session.call(this,e,t)},SIPml.Session.Registration.prototype=Object.create(SIPml.Session.prototype),SIPml.Session.Registration.prototype.register=function(e){return this.setConfiguration(e),this.o_session.register()},SIPml.Session.Registration.prototype.unregister=function(e){return this.setConfiguration(e),this.o_session.unregister()},SIPml.Session.Call=function(e,t){switch(SIPml.Session.call(this,e,t),e.s_type){case"call-audio":this.mediaType=tmedia_type_e.AUDIO;break;case"call-audiovideo":this.mediaType=tmedia_type_e.AUDIO_VIDEO;break;case"call-video":this.mediaType=tmedia_type_e.VIDEO;break;case"call-screenshare":this.mediaType=tmedia_type_e.SCREEN_SHARE}},SIPml.Session.Call.prototype=Object.create(SIPml.Session.prototype),SIPml.Session.Call.prototype.videoLocal=null,SIPml.Session.Call.prototype.videoRemote=null,SIPml.Session.Call.prototype.call=function(e,t){if(tsk_string_is_null_or_empty(e))throw new Error("ERR_INVALID_PARAMETER_VALUE: 'to' must not be null");if(!SIPml.haveMediaStream())throw new Error("ERR_NOT_READY: Media engine not ready yet");return this.o_session.set(tsip_session.prototype.SetToStr(e)),this.setConfiguration(t),this.o_session.call(this.mediaType)},SIPml.Session.Call.prototype.hangup=function(e){return this.setConfiguration(e),this.o_session.hangup()},SIPml.Session.Call.prototype.hold=function(e){return this.setConfiguration(e),this.o_session.hold(this.mediaType)},SIPml.Session.Call.prototype.resume=function(e){return this.setConfiguration(e),this.o_session.resume(this.mediaType)},SIPml.Session.Call.prototype.info=function(e,t,i){return this.setConfiguration(i),this.o_session.info(e,t)},SIPml.Session.Call.prototype.dtmf=function(e,t){return this.setConfiguration(t),this.o_session.dtmf(e)},SIPml.Session.Call.prototype.transfer=function(e,t){return this.setConfiguration(t),this.o_session.transfer(e)},SIPml.Session.Call.prototype.acceptTransfer=function(e){return this.setConfiguration(e),this.o_session.transfer_accept()},SIPml.Session.Call.prototype.rejectTransfer=function(e){return this.setConfiguration(e),this.o_session.transfer_reject()},SIPml.Session.Call.prototype.startBfcpShare=function(e){if("w4a"!=SIPml.getWebRtcType())throw new Error("ERR_NOT_SUPPORTED: BFCP sharing requires webrtc4all plugin");return this.setConfiguration(e),this.o_session.start_bfcp_share()},SIPml.Session.Call.prototype.stopBfcpShare=function(e){if("w4a"!=SIPml.getWebRtcType())throw new Error("ERR_NOT_SUPPORTED: BFCP sharing requires webrtc4all plugin");return this.setConfiguration(e),this.o_session.stop_bfcp_share()},SIPml.Session.Call.prototype.mute=function(e,t){if("audio"!==e&&"video"!==e||"boolean"!=typeof t)throw new Error("ERR_INVALID_ARGUMENT");return this.o_session.set_mute(e,t)},SIPml.Session.Message=function(e,t){SIPml.Session.call(this,e,t)},SIPml.Session.Message.prototype=Object.create(SIPml.Session.prototype),SIPml.Session.Message.prototype.send=function(e,t,i,s){if(tsk_string_is_null_or_empty(e))throw new Error("ERR_INVALID_PARAMETER_VALUE: 'to' must not be null");return this.setConfiguration(s),this.o_session.set(tsip_session.prototype.SetToStr(e)),this.o_session.send(t,i)},SIPml.Session.Publish=function(e,t){SIPml.Session.call(this,e,t),e.set(tsip_session.prototype.SetToUri(e.get_stack().identity.o_uri_impu))},SIPml.Session.Publish.prototype=Object.create(SIPml.Session.prototype),SIPml.Session.Publish.prototype.publish=function(e,t,i){return this.setConfiguration(i),this.o_session.publish(e,t)},SIPml.Session.Publish.prototype.unpublish=function(e){return this.setConfiguration(e),this.o_session.unpublish()},SIPml.Session.Subscribe=function(e,t){SIPml.Session.call(this,e,t)},SIPml.Session.Subscribe.prototype=Object.create(SIPml.Session.prototype),SIPml.Session.Subscribe.prototype.subscribe=function(e,t){if(tsk_string_is_null_or_empty(e))throw new Error("ERR_INVALID_PARAMETER_VALUE: 'to' must not be null");return this.o_session.set(tsip_session.prototype.SetToStr(e)),this.setConfiguration(t),this.o_session.subscribe()},SIPml.Session.Subscribe.prototype.unsubscribe=function(e){return this.setConfiguration(e),this.o_session.unsubscribe()};
//# sourceMappingURL=/sm/7a8ad4d72220ec0ba50682992384e7cfe1e8c6f86dd5e0a656165ed7908b966a.map