@wizai/agent-sip-sdk 0.1.6-alpha → 0.1.7-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- "use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function a(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}u((r=r.apply(e,t||[])).next())})}function n(e,t){var n,r,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;let r=(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t};var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var a={title:"JsSIP",version:"3.10.1"},u=a,l={USER_AGENT:"".concat(u.title," ").concat(u.version),SIP:"sip",SIPS:"sips",causes:{CONNECTION_ERROR:"Connection Error",REQUEST_TIMEOUT:"Request Timeout",SIP_FAILURE_CODE:"SIP Failure Code",INTERNAL_ERROR:"Internal Error",BUSY:"Busy",REJECTED:"Rejected",REDIRECTED:"Redirected",UNAVAILABLE:"Unavailable",NOT_FOUND:"Not Found",ADDRESS_INCOMPLETE:"Address Incomplete",INCOMPATIBLE_SDP:"Incompatible SDP",MISSING_SDP:"Missing SDP",AUTHENTICATION_ERROR:"Authentication Error",BYE:"Terminated",WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",DIALOG_ERROR:"Dialog Error",USER_DENIED_MEDIA_ACCESS:"User Denied Media Access",BAD_MEDIA_DESCRIPTION:"Bad Media Description",RTP_TIMEOUT:"RTP Timeout"},SIP_ERROR_CAUSES:{REDIRECTED:[300,301,302,305,380],BUSY:[486,600],REJECTED:[403,603],NOT_FOUND:[404,604],UNAVAILABLE:[480,410,408,430],ADDRESS_INCOMPLETE:[484,424],INCOMPATIBLE_SDP:[488,606],AUTHENTICATION_ERROR:[401,407]},ACK:"ACK",BYE:"BYE",CANCEL:"CANCEL",INFO:"INFO",INVITE:"INVITE",MESSAGE:"MESSAGE",NOTIFY:"NOTIFY",OPTIONS:"OPTIONS",REGISTER:"REGISTER",REFER:"REFER",UPDATE:"UPDATE",SUBSCRIBE:"SUBSCRIBE",DTMF_TRANSPORT:{INFO:"INFO",RFC2833:"RFC2833"},REASON_PHRASE:{100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",424:"Bad Location Information",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"JsSIP Internal Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"},ALLOWED_METHODS:"INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY",ACCEPTED_BODY_TYPES:"application/sdp, application/dtmf-relay",MAX_FORWARDS:69,SESSION_EXPIRES:90,MIN_SESSION_EXPIRES:60,CONNECTION_RECOVERY_MAX_INTERVAL:30,CONNECTION_RECOVERY_MIN_INTERVAL:2};function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}function f(e){var t=_();return function(){var n,r=m(e);if(t){var i=m(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===c(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function p(e){var t="function"==typeof Map?new Map:void 0;return p=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return g(e,arguments,m(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),A(r,e)},p(e)}function g(e,t,n){return g=_()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&A(i,n.prototype),i},g.apply(null,arguments)}function _(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function A(e,t){return A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},A(e,t)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}var v,y,T,S,C,E,w,b,I=function(){d(t,p(Error));var e=f(t);function t(n,r){var i;return h(this,t),(i=e.call(this)).code=1,i.name="CONFIGURATION_ERROR",i.parameter=n,i.value=r,i.message=i.value?"Invalid value ".concat(JSON.stringify(i.value),' for parameter "').concat(i.parameter,'"'):"Missing parameter: ".concat(i.parameter),i}return t}(),R=function(){d(t,p(Error));var e=f(t);function t(n){var r;return h(this,t),(r=e.call(this)).code=2,r.name="INVALID_STATE_ERROR",r.status=n,r.message="Invalid status: ".concat(n),r}return t}(),O=function(){d(t,p(Error));var e=f(t);function t(n){var r;return h(this,t),(r=e.call(this)).code=3,r.name="NOT_SUPPORTED_ERROR",r.message=n,r}return t}(),k=function(){d(t,p(Error));var e=f(t);function t(n){var r;return h(this,t),(r=e.call(this)).code=4,r.name="NOT_READY_ERROR",r.message=n,r}return t}(),D={ConfigurationError:I,InvalidStateError:R,NotSupportedError:O,NotReadyError:k},q={};function M(){if(y)return v;function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}y=1;var n=U(),r=N();return v=function(){function e(t,r,i){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!(t&&t instanceof n))throw new TypeError('missing or invalid "uri" parameter');for(var s in this._uri=t,this._parameters={},this.display_name=r,i)Object.prototype.hasOwnProperty.call(i,s)&&this.setParam(s,i[s])}return t(e,null,[{key:"parse",value:function(e){return-1!==(e=r.parse(e,"Name_Addr_Header"))?e:void 0}}]),t(e,[{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=null==t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e)){var t=this._parameters[e];return delete this._parameters[e],t}}},{key:"clearParams",value:function(){this._parameters={}}},{key:"clone",value:function(){return new e(this._uri.clone(),this._display_name,JSON.parse(JSON.stringify(this._parameters)))}},{key:"_quote",value:function(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}},{key:"toString",value:function(){var e=this._display_name?'"'.concat(this._quote(this._display_name),'" '):"";for(var t in e+="<".concat(this._uri.toString(),">"),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,t)&&(e+=";".concat(t),null!==this._parameters[t]&&(e+="=".concat(this._parameters[t])));return e}},{key:"uri",get:function(){return this._uri}},{key:"display_name",get:function(){return this._display_name},set:function(e){this._display_name=0===e?"0":e}}]),e}(),v}function N(){return S||(S=1,T=function(){function e(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var t={parse:function(t,n){var r={CRLF:u,DIGIT:l,ALPHA:c,HEXDIG:h,WSP:d,OCTET:f,DQUOTE:p,SP:g,HTAB:_,alphanum:A,reserved:m,unreserved:v,mark:y,escaped:T,LWS:S,SWS:C,HCOLON:E,TEXT_UTF8_TRIM:w,TEXT_UTF8char:b,UTF8_NONASCII:I,UTF8_CONT:R,LHEX:function(){var e;null===(e=l())&&(/^[a-f]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[a-f]")));return e},token:O,token_nodot:k,separators:function(){var e;40===t.charCodeAt(i)?(e="(",i++):(e=null,a('"("'));null===e&&(41===t.charCodeAt(i)?(e=")",i++):(e=null,a('")"')),null===e&&(60===t.charCodeAt(i)?(e="<",i++):(e=null,a('"<"')),null===e&&(62===t.charCodeAt(i)?(e=">",i++):(e=null,a('">"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,a('"@"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","')),null===e&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,a('";"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(92===t.charCodeAt(i)?(e="\\",i++):(e=null,a('"\\\\"')),null===e&&null===(e=p())&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null===e&&(91===t.charCodeAt(i)?(e="[",i++):(e=null,a('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,a('"]"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(123===t.charCodeAt(i)?(e="{",i++):(e=null,a('"{"')),null===e&&(125===t.charCodeAt(i)?(e="}",i++):(e=null,a('"}"')),null===e&&null===(e=g())&&(e=_()))))))))))))))));return e},word:D,STAR:q,SLASH:N,EQUAL:x,LPAREN:L,RPAREN:B,RAQUOT:P,LAQUOT:F,COMMA:H,SEMI:G,COLON:Y,LDQUOT:j,RDQUOT:Q,comment:function e(){var t,n,r,s;if(s=i,null!==(t=L())){for(n=[],null===(r=W())&&null===(r=V())&&(r=e());null!==r;)n.push(r),null===(r=W())&&null===(r=V())&&(r=e());null!==n&&null!==(r=B())?t=[t,n,r]:(t=null,i=s)}else t=null,i=s;return t},ctext:W,quoted_string:K,quoted_string_clean:J,qdtext:z,quoted_pair:V,SIP_URI_noparams:Z,SIP_URI:X,uri_scheme:$,uri_scheme_sips:ee,uri_scheme_sip:te,userinfo:ne,user:re,user_unreserved:ie,password:se,hostport:oe,host:ae,hostname:ue,domainlabel:le,toplabel:ce,IPv6reference:he,IPv6address:de,h16:fe,ls32:pe,IPv4address:ge,dec_octet:_e,port:Ae,uri_parameters:me,uri_parameter:ve,transport_param:ye,user_param:Te,method_param:Se,ttl_param:Ce,maddr_param:Ee,lr_param:we,other_param:be,pname:Ie,pvalue:Re,paramchar:Oe,param_unreserved:ke,headers:De,header:qe,hname:Me,hvalue:Ne,hnv_unreserved:Ue,Request_Response:function(){var e;null===(e=ht())&&(e=xe());return e},Request_Line:xe,Request_URI:Le,absoluteURI:Be,hier_part:Pe,net_path:Fe,abs_path:He,opaque_part:Ge,uric:Ye,uric_no_slash:je,path_segments:Qe,segment:We,param:Ke,pchar:Je,scheme:ze,authority:Ve,srvr:Ze,reg_name:Xe,query:$e,SIP_Version:et,INVITEm:tt,ACKm:nt,OPTIONSm:rt,BYEm:it,CANCELm:st,REGISTERm:ot,SUBSCRIBEm:at,NOTIFYm:ut,REFERm:lt,Method:ct,Status_Line:ht,Status_Code:dt,extension_code:ft,Reason_Phrase:pt,Allow_Events:function(){var e,t,n,r,s,o;if(s=i,null!==(e=Bt())){for(t=[],o=i,null!==(n=H())&&null!==(r=Bt())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=Bt())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},Call_ID:function(){var e,n,r,s,o,u;s=i,o=i,null!==(e=D())?(u=i,64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null!==n&&null!==(r=D())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o);null!==e&&(e=function(e){Hn=t.substring(i,e)}(s));null===e&&(i=s);return e},Contact:function(){var e,t,n,r,s,o,a;if(s=i,null===(e=q()))if(o=i,null!==(e=gt())){for(t=[],a=i,null!==(n=H())&&null!==(r=gt())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=H())&&null!==(r=gt())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){var e,t;for(t=Hn.multi_header.length,e=0;e<t;e++)if(null===Hn.multi_header[e].parsed){Hn=null;break}Hn=null!==Hn?Hn.multi_header:-1}());null===e&&(i=s);return e},contact_param:gt,name_addr:_t,display_name:At,contact_params:mt,c_p_q:vt,c_p_expires:yt,delta_seconds:Tt,qvalue:St,generic_param:Ct,gen_value:Et,Content_Disposition:function(){var e,t,n,r,s,o;if(s=i,null!==(e=wt())){for(t=[],o=i,null!==(n=G())&&null!==(r=bt())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=bt())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},disp_type:wt,disp_param:bt,handling_param:It,Content_Encoding:function(){var e,t,n,r,s,o;if(s=i,null!==(e=O())){for(t=[],o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},Content_Length:function(){var e,t,n;if(n=i,null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;null!==e&&(e=void(Hn=parseInt(e.join(""))));null===e&&(i=n);return e},Content_Type:function(){var e,n;n=i,null!==(e=Rt())&&(e=function(e){Hn=t.substring(i,e)}(n));null===e&&(i=n);return e},media_type:Rt,m_type:Ot,discrete_type:kt,composite_type:Dt,extension_token:qt,x_token:Mt,m_subtype:Nt,m_parameter:Ut,m_value:xt,CSeq:function(){var e,t,n,r;r=i,null!==(e=Lt())&&null!==(t=S())&&null!==(n=ct())?e=[e,t,n]:(e=null,i=r);return e},CSeq_value:Lt,Expires:function(){var e,t;t=i,null!==(e=Tt())&&(e=void(Hn=e));null===e&&(i=t);return e},Event:function(){var e,t,n,r,s,o,a;if(s=i,o=i,null!==(e=Bt())){for(t=[],a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(u=e[0],e=void(Hn.event=u.join("").toLowerCase()));var u;null===e&&(i=s);return e},event_type:Bt,From:function(){var e,t,n,r,s,o,a;s=i,o=i,null===(e=Z())&&(e=_t());if(null!==e){for(t=[],a=i,null!==(n=G())&&null!==(r=Pt())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=Pt())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){var e=Hn.tag;try{Hn=new Fn(Hn.uri,Hn.display_name,Hn.params),e&&Hn.setParam("tag",e)}catch(e){Hn=-1}}());null===e&&(i=s);return e},from_param:Pt,tag_param:Ft,Max_Forwards:function(){var e,t,n;if(n=i,null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;null!==e&&(e=void(Hn=parseInt(e.join(""))));null===e&&(i=n);return e},Min_Expires:function(){var e,t;t=i,null!==(e=Tt())&&(e=void(Hn=e));null===e&&(i=t);return e},Name_Addr_Header:function(){var e,t,n,r,s,o,a,u,l,c;u=i,l=i,e=[],t=At();for(;null!==t;)e.push(t),t=At();if(null!==e)if(null!==(t=F()))if(null!==(n=X()))if(null!==(r=P())){for(s=[],c=i,null!==(o=G())&&null!==(a=Ct())?o=[o,a]:(o=null,i=c);null!==o;)s.push(o),c=i,null!==(o=G())&&null!==(a=Ct())?o=[o,a]:(o=null,i=c);null!==s?e=[e,t,n,r,s]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;else e=null,i=l;else e=null,i=l;null!==e&&(e=function(){try{Hn=new Fn(Hn.uri,Hn.display_name,Hn.params)}catch(e){Hn=-1}}());null===e&&(i=u);return e},Proxy_Authenticate:function(){return Ht()},challenge:Ht,other_challenge:Gt,auth_param:Yt,digest_cln:jt,realm:Qt,realm_value:Wt,domain:Kt,URI:Jt,nonce:zt,nonce_value:Vt,opaque:Zt,stale:Xt,algorithm:$t,qop_options:en,qop_value:tn,Proxy_Require:function(){var e,t,n,r,s,o;if(s=i,null!==(e=O())){for(t=[],o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},Record_Route:function(){var e,t,n,r,s,o,a;if(s=i,o=i,null!==(e=nn())){for(t=[],a=i,null!==(n=H())&&null!==(r=nn())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=H())&&null!==(r=nn())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){var e,t;for(t=Hn.multi_header.length,e=0;e<t;e++)if(null===Hn.multi_header[e].parsed){Hn=null;break}Hn=null!==Hn?Hn.multi_header:-1}());null===e&&(i=s);return e},rec_route:nn,Reason:function(){var e,n,r,s,o,u,l;o=i,u=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"SIP"'));null===e&&(e=O());if(null!==e){for(n=[],l=i,null!==(r=G())&&null!==(s=rn())?r=[r,s]:(r=null,i=l);null!==r;)n.push(r),l=i,null!==(r=G())&&null!==(s=rn())?r=[r,s]:(r=null,i=l);null!==n?e=[e,n]:(e=null,i=u)}else e=null,i=u;null!==e&&(e=function(e,t){if(Hn.protocol=t.toLowerCase(),Hn.params||(Hn.params={}),Hn.params.text&&'"'===Hn.params.text[0]){var n=Hn.params.text;Hn.text=n.substring(1,n.length-1),delete Hn.params.text}}(0,e[0]));null===e&&(i=o);return e},reason_param:rn,reason_cause:sn,Require:function(){var e,t,n,r,s,o;if(s=i,null!==(e=O())){for(t=[],o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},Route:function(){var e,t,n,r,s,o;if(s=i,null!==(e=on())){for(t=[],o=i,null!==(n=H())&&null!==(r=on())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=on())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},route_param:on,Subscription_State:function(){var e,t,n,r,s,o;if(s=i,null!==(e=an())){for(t=[],o=i,null!==(n=G())&&null!==(r=un())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=un())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},substate_value:an,subexp_params:un,event_reason_value:ln,Subject:function(){var e;return e=null!==(e=w())?e:""},Supported:function(){var e,t,n,r,s,o;if(s=i,null!==(e=O())){for(t=[],o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e=null!==e?e:""},To:function(){var e,t,n,r,s,o,a;s=i,o=i,null===(e=Z())&&(e=_t());if(null!==e){for(t=[],a=i,null!==(n=G())&&null!==(r=cn())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=cn())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){var e=Hn.tag;try{Hn=new Fn(Hn.uri,Hn.display_name,Hn.params),e&&Hn.setParam("tag",e)}catch(e){Hn=-1}}());null===e&&(i=s);return e},to_param:cn,Via:function(){var e,t,n,r,s,o;if(s=i,null!==(e=hn())){for(t=[],o=i,null!==(n=H())&&null!==(r=hn())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=hn())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},via_param:hn,via_params:dn,via_ttl:fn,via_maddr:pn,via_received:gn,via_branch:_n,response_port:An,rport:mn,sent_protocol:vn,protocol_name:yn,transport:Tn,sent_by:Sn,via_host:Cn,via_port:En,ttl:wn,WWW_Authenticate:function(){return Ht()},Session_Expires:function(){var e,t,n,r,s,o;if(s=i,null!==(e=bn())){for(t=[],o=i,null!==(n=G())&&null!==(r=In())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=In())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},s_e_expires:bn,s_e_params:In,s_e_refresher:Rn,extension_header:function(){var e,t,n,r;r=i,null!==(e=O())&&null!==(t=E())&&null!==(n=On())?e=[e,t,n]:(e=null,i=r);return e},header_value:On,message_body:function(){var e,t;e=[],t=f();for(;null!==t;)e.push(t),t=f();return e},uuid_URI:function(){var e,n,r;r=i,"uuid:"===t.substr(i,5)?(e="uuid:",i+=5):(e=null,a('"uuid:"'));null!==e&&null!==(n=kn())?e=[e,n]:(e=null,i=r);return e},uuid:kn,hex4:Dn,hex8:qn,hex12:Mn,Refer_To:function(){var e,t,n,r,s,o,a;s=i,o=i,null===(e=Z())&&(e=_t());if(null!==e){for(t=[],a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){try{Hn=new Fn(Hn.uri,Hn.display_name,Hn.params)}catch(e){Hn=-1}}());null===e&&(i=s);return e},Replaces:function(){var e,t,n,r,s,o;if(s=i,null!==(e=Nn())){for(t=[],o=i,null!==(n=G())&&null!==(r=Un())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=Un())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},call_id:Nn,replaces_param:Un,to_tag:xn,from_tag:Ln,early_flag:Bn};if(void 0!==n){if(void 0===r[n])throw new Error("Invalid rule name: "+e(n)+".")}else n="CRLF";var i=0,s=0,o=[];function a(e){i<s||(i>s&&(s=i,o=[]),o.push(e))}function u(){var e;return"\r\n"===t.substr(i,2)?(e="\r\n",i+=2):(e=null,a('"\\r\\n"')),e}function l(){var e;return/^[0-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[0-9]")),e}function c(){var e;return/^[a-zA-Z]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[a-zA-Z]")),e}function h(){var e;return/^[0-9a-fA-F]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[0-9a-fA-F]")),e}function d(){var e;return null===(e=g())&&(e=_()),e}function f(){var e;return/^[\0-\xFF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\0-\\xFF]")),e}function p(){var e;return/^["]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a('["]')),e}function g(){var e;return 32===t.charCodeAt(i)?(e=" ",i++):(e=null,a('" "')),e}function _(){var e;return 9===t.charCodeAt(i)?(e="\t",i++):(e=null,a('"\\t"')),e}function A(){var e;return/^[a-zA-Z0-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[a-zA-Z0-9]")),e}function m(){var e;return 59===t.charCodeAt(i)?(e=";",i++):(e=null,a('";"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,a('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","'))))))))))),e}function v(){var e;return null===(e=A())&&(e=y()),e}function y(){var e;return 45===t.charCodeAt(i)?(e="-",i++):(e=null,a('"-"')),null===e&&(95===t.charCodeAt(i)?(e="_",i++):(e=null,a('"_"')),null===e&&(46===t.charCodeAt(i)?(e=".",i++):(e=null,a('"."')),null===e&&(33===t.charCodeAt(i)?(e="!",i++):(e=null,a('"!"')),null===e&&(126===t.charCodeAt(i)?(e="~",i++):(e=null,a('"~"')),null===e&&(42===t.charCodeAt(i)?(e="*",i++):(e=null,a('"*"')),null===e&&(39===t.charCodeAt(i)?(e="'",i++):(e=null,a('"\'"')),null===e&&(40===t.charCodeAt(i)?(e="(",i++):(e=null,a('"("')),null===e&&(41===t.charCodeAt(i)?(e=")",i++):(e=null,a('")"')))))))))),e}function T(){var e,n,r,s,o;return s=i,o=i,37===t.charCodeAt(i)?(e="%",i++):(e=null,a('"%"')),null!==e&&null!==(n=h())&&null!==(r=h())?e=[e,n,r]:(e=null,i=o),null!==e&&(e=e.join("")),null===e&&(i=s),e}function S(){var e,t,n,r,s,o;for(r=i,s=i,o=i,e=[],t=d();null!==t;)e.push(t),t=d();if(null!==e&&null!==(t=u())?e=[e,t]:(e=null,i=o),null!==(e=null!==e?e:"")){if(null!==(n=d()))for(t=[];null!==n;)t.push(n),n=d();else t=null;null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return null!==e&&(e=" "),null===e&&(i=r),e}function C(){var e;return e=null!==(e=S())?e:""}function E(){var e,n,r,s,o;for(s=i,o=i,e=[],null===(n=g())&&(n=_());null!==n;)e.push(n),null===(n=g())&&(n=_());return null!==e?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=":"),null===e&&(i=s),e}function w(){var e,n,r,s,o,a,u;if(o=i,a=i,null!==(n=b()))for(e=[];null!==n;)e.push(n),n=b();else e=null;if(null!==e){for(n=[],u=i,r=[],s=S();null!==s;)r.push(s),s=S();for(null!==r&&null!==(s=b())?r=[r,s]:(r=null,i=u);null!==r;){for(n.push(r),u=i,r=[],s=S();null!==s;)r.push(s),s=S();null!==r&&null!==(s=b())?r=[r,s]:(r=null,i=u)}null!==n?e=[e,n]:(e=null,i=a)}else e=null,i=a;return null!==e&&(e=function(e){return t.substring(i,e)}(o)),null===e&&(i=o),e}function b(){var e;return/^[!-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[!-~]")),null===e&&(e=I()),e}function I(){var e;return/^[\x80-\uFFFF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\x80-\\uFFFF]")),e}function R(){var e;return/^[\x80-\xBF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\x80-\\xBF]")),e}function O(){var e,n,r;if(r=i,null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"')))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"'))))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function k(){var e,n,r;if(r=i,null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"'))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"')))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function D(){var e,n,r;if(r=i,null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"')),null===n&&(40===t.charCodeAt(i)?(n="(",i++):(n=null,a('"("')),null===n&&(41===t.charCodeAt(i)?(n=")",i++):(n=null,a('")"')),null===n&&(60===t.charCodeAt(i)?(n="<",i++):(n=null,a('"<"')),null===n&&(62===t.charCodeAt(i)?(n=">",i++):(n=null,a('">"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null===n&&(92===t.charCodeAt(i)?(n="\\",i++):(n=null,a('"\\\\"')),null===n&&null===(n=p())&&(47===t.charCodeAt(i)?(n="/",i++):(n=null,a('"/"')),null===n&&(91===t.charCodeAt(i)?(n="[",i++):(n=null,a('"["')),null===n&&(93===t.charCodeAt(i)?(n="]",i++):(n=null,a('"]"')),null===n&&(63===t.charCodeAt(i)?(n="?",i++):(n=null,a('"?"')),null===n&&(123===t.charCodeAt(i)?(n="{",i++):(n=null,a('"{"')),null===n&&(125===t.charCodeAt(i)?(n="}",i++):(n=null,a('"}"')))))))))))))))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"')),null===n&&(40===t.charCodeAt(i)?(n="(",i++):(n=null,a('"("')),null===n&&(41===t.charCodeAt(i)?(n=")",i++):(n=null,a('")"')),null===n&&(60===t.charCodeAt(i)?(n="<",i++):(n=null,a('"<"')),null===n&&(62===t.charCodeAt(i)?(n=">",i++):(n=null,a('">"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null===n&&(92===t.charCodeAt(i)?(n="\\",i++):(n=null,a('"\\\\"')),null===n&&null===(n=p())&&(47===t.charCodeAt(i)?(n="/",i++):(n=null,a('"/"')),null===n&&(91===t.charCodeAt(i)?(n="[",i++):(n=null,a('"["')),null===n&&(93===t.charCodeAt(i)?(n="]",i++):(n=null,a('"]"')),null===n&&(63===t.charCodeAt(i)?(n="?",i++):(n=null,a('"?"')),null===n&&(123===t.charCodeAt(i)?(n="{",i++):(n=null,a('"{"')),null===n&&(125===t.charCodeAt(i)?(n="}",i++):(n=null,a('"}"'))))))))))))))))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function q(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="*"),null===e&&(i=s),e}function N(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(47===t.charCodeAt(i)?(n="/",i++):(n=null,a('"/"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="/"),null===e&&(i=s),e}function x(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="="),null===e&&(i=s),e}function L(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(40===t.charCodeAt(i)?(n="(",i++):(n=null,a('"("')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="("),null===e&&(i=s),e}function B(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(41===t.charCodeAt(i)?(n=")",i++):(n=null,a('")"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=")"),null===e&&(i=s),e}function P(){var e,n,r,s;return r=i,s=i,62===t.charCodeAt(i)?(e=">",i++):(e=null,a('">"')),null!==e&&null!==(n=C())?e=[e,n]:(e=null,i=s),null!==e&&(e=">"),null===e&&(i=r),e}function F(){var e,n,r,s;return r=i,s=i,null!==(e=C())?(60===t.charCodeAt(i)?(n="<",i++):(n=null,a('"<"')),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null!==e&&(e="<"),null===e&&(i=r),e}function H(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=","),null===e&&(i=s),e}function G(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=";"),null===e&&(i=s),e}function Y(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=":"),null===e&&(i=s),e}function j(){var e,t,n,r;return n=i,r=i,null!==(e=C())&&null!==(t=p())?e=[e,t]:(e=null,i=r),null!==e&&(e='"'),null===e&&(i=n),e}function Q(){var e,t,n,r;return n=i,r=i,null!==(e=p())&&null!==(t=C())?e=[e,t]:(e=null,i=r),null!==e&&(e='"'),null===e&&(i=n),e}function W(){var e;return/^[!-']/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[!-']")),null===e&&(/^[*-[]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[*-[]")),null===e&&(/^[\]-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\]-~]")),null===e&&null===(e=I())&&(e=S()))),e}function K(){var e,n,r,s,o,a;if(o=i,a=i,null!==(e=C()))if(null!==(n=p())){for(r=[],null===(s=z())&&(s=V());null!==s;)r.push(s),null===(s=z())&&(s=V());null!==r&&null!==(s=p())?e=[e,n,r,s]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;return null!==e&&(e=function(e){return t.substring(i,e)}(o)),null===e&&(i=o),e}function J(){var e,n,r,s,o,a;if(o=i,a=i,null!==(e=C()))if(null!==(n=p())){for(r=[],null===(s=z())&&(s=V());null!==s;)r.push(s),null===(s=z())&&(s=V());null!==r&&null!==(s=p())?e=[e,n,r,s]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;return null!==e&&(e=function(e){var n=t.substring(i,e).trim();return n.substring(1,n.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1")}(o)),null===e&&(i=o),e}function z(){var e;return null===(e=S())&&(33===t.charCodeAt(i)?(e="!",i++):(e=null,a('"!"')),null===e&&(/^[#-[]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[#-[]")),null===e&&(/^[\]-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\]-~]")),null===e&&(e=I())))),e}function V(){var e,n,r;return r=i,92===t.charCodeAt(i)?(e="\\",i++):(e=null,a('"\\\\"')),null!==e?(/^[\0-\t]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[\\0-\\t]")),null===n&&(/^[\x0B-\f]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[\\x0B-\\f]")),null===n&&(/^[\x0E-]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[\\x0E-]")))),null!==n?e=[e,n]:(e=null,i=r)):(e=null,i=r),e}function Z(){var e,n,r,s,o,u;return o=i,u=i,null!==(e=$())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=null!==(r=ne())?r:"")&&null!==(s=oe())?e=[e,n,r,s]:(e=null,i=u)):(e=null,i=u),null!==e&&(e=function(){try{Hn.uri=new Pn(Hn.scheme,Hn.user,Hn.host,Hn.port),delete Hn.scheme,delete Hn.user,delete Hn.host,delete Hn.host_type,delete Hn.port}catch(e){Hn=-1}}()),null===e&&(i=o),e}function X(){var e,r,s,o,u,l,c,h;return c=i,h=i,null!==(e=$())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=null!==(s=ne())?s:"")&&null!==(o=oe())&&null!==(u=me())&&null!==(l=null!==(l=De())?l:"")?e=[e,r,s,o,u,l]:(e=null,i=h)):(e=null,i=h),null!==e&&(e=function(){try{Hn.uri=new Pn(Hn.scheme,Hn.user,Hn.host,Hn.port,Hn.uri_params,Hn.uri_headers),delete Hn.scheme,delete Hn.user,delete Hn.host,delete Hn.host_type,delete Hn.port,delete Hn.uri_params,"SIP_URI"===n&&(Hn=Hn.uri)}catch(e){Hn=-1}}()),null===e&&(i=c),e}function $(){var e;return null===(e=ee())&&(e=te()),e}function ee(){var e,n,r;return n=i,"sips"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"sips"')),null!==e&&(r=e,e=void(Hn.scheme=r.toLowerCase())),null===e&&(i=n),e}function te(){var e,n,r;return n=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"sip"')),null!==e&&(r=e,e=void(Hn.scheme=r.toLowerCase())),null===e&&(i=n),e}function ne(){var e,n,r,s,o,u;return s=i,o=i,null!==(e=re())?(u=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=se())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?(64===t.charCodeAt(i)?(r="@",i++):(r=null,a('"@"')),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o)):(e=null,i=o),null!==e&&(e=function(e){Hn.user=decodeURIComponent(t.substring(i-1,e))}(s)),null===e&&(i=s),e}function re(){var e,t;if(null===(t=v())&&null===(t=T())&&(t=ie()),null!==t)for(e=[];null!==t;)e.push(t),null===(t=v())&&null===(t=T())&&(t=ie());else e=null;return e}function ie(){var e;return 38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","')),null===e&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,a('";"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"'))))))))),e}function se(){var e,n,r;for(r=i,e=[],null===(n=v())&&null===(n=T())&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,a('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,a('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')))))));null!==n;)e.push(n),null===(n=v())&&null===(n=T())&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,a('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,a('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')))))));return null!==e&&(e=function(e){Hn.password=t.substring(i,e)}(r)),null===e&&(i=r),e}function oe(){var e,n,r,s,o;return s=i,null!==(e=ae())?(o=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=Ae())?n=[n,r]:(n=null,i=o),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=s)):(e=null,i=s),e}function ae(){var e,n;return n=i,null===(e=ue())&&null===(e=ge())&&(e=he()),null!==e&&(e=function(e){return Hn.host=t.substring(i,e).toLowerCase(),Hn.host}(n)),null===e&&(i=n),e}function ue(){var e,n,r,s,o,u;for(s=i,o=i,e=[],u=i,null!==(n=le())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==r?n=[n,r]:(n=null,i=u)):(n=null,i=u);null!==n;)e.push(n),u=i,null!==(n=le())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==r?n=[n,r]:(n=null,i=u)):(n=null,i=u);return null!==e&&null!==(n=ce())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==(r=null!==r?r:"")?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=function(e){return Hn.host_type="domain",t.substring(i,e)}(s)),null===e&&(i=s),e}function le(){var e,n,r,s;if(s=i,null!==(e=A())){for(n=[],null===(r=A())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,a('"_"'))));null!==r;)n.push(r),null===(r=A())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,a('"_"'))));null!==n?e=[e,n]:(e=null,i=s)}else e=null,i=s;return e}function ce(){var e,n,r,s;if(s=i,null!==(e=c())){for(n=[],null===(r=A())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,a('"_"'))));null!==r;)n.push(r),null===(r=A())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,a('"_"'))));null!==n?e=[e,n]:(e=null,i=s)}else e=null,i=s;return e}function he(){var e,n,r,s,o;return s=i,o=i,91===t.charCodeAt(i)?(e="[",i++):(e=null,a('"["')),null!==e&&null!==(n=de())?(93===t.charCodeAt(i)?(r="]",i++):(r=null,a('"]"')),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=function(e){return Hn.host_type="IPv6",t.substring(i,e)}(s)),null===e&&(i=s),e}function de(){var e,n,r,s,o,u,l,c,h,d,f,p,g,_,A,m;return _=i,A=i,null!==(e=fe())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?(58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?(58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,a('":"')),null!==c&&null!==(h=fe())?(58===t.charCodeAt(i)?(d=":",i++):(d=null,a('":"')),null!==d&&null!==(f=fe())?(58===t.charCodeAt(i)?(p=":",i++):(p=null,a('":"')),null!==p&&null!==(g=pe())?e=[e,n,r,s,o,u,l,c,h,d,f,p,g]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=fe())?(58===t.charCodeAt(i)?(h=":",i++):(h=null,a('":"')),null!==h&&null!==(d=fe())?(58===t.charCodeAt(i)?(f=":",i++):(f=null,a('":"')),null!==f&&null!==(p=pe())?e=[e,n,r,s,o,u,l,c,h,d,f,p]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=fe())?(58===t.charCodeAt(i)?(h=":",i++):(h=null,a('":"')),null!==h&&null!==(d=pe())?e=[e,n,r,s,o,u,l,c,h,d]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=pe())?e=[e,n,r,s,o,u,l,c]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=pe())?e=[e,n,r,s,o,u]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=pe())?e=[e,n,r,s]:(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=pe())?e=[e,n]:(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?e=[e,n]:(e=null,i=A),null===e&&(A=i,null!==(e=fe())?("::"===t.substr(i,2)?(n="::",i+=2):(n=null,a('"::"')),null!==n&&null!==(r=fe())?(58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?(58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,a('":"')),null!==c&&null!==(h=fe())?(58===t.charCodeAt(i)?(d=":",i++):(d=null,a('":"')),null!==d&&null!==(f=pe())?e=[e,n,r,s,o,u,l,c,h,d,f]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?("::"===t.substr(i,2)?(r="::",i+=2):(r=null,a('"::"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=fe())?(58===t.charCodeAt(i)?(h=":",i++):(h=null,a('":"')),null!==h&&null!==(d=pe())?e=[e,n,r,s,o,u,l,c,h,d]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?("::"===t.substr(i,2)?(s="::",i+=2):(s=null,a('"::"')),null!==s&&null!==(o=fe())?(58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,a('":"')),null!==c&&null!==(h=pe())?e=[e,n,r,s,o,u,l,c,h]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?(m=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?s=[s,o]:(s=null,i=m),null!==(s=null!==s?s:"")?("::"===t.substr(i,2)?(o="::",i+=2):(o=null,a('"::"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=pe())?e=[e,n,r,s,o,u,l,c]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?(m=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?s=[s,o]:(s=null,i=m),null!==(s=null!==s?s:"")?(m=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?o=[o,u]:(o=null,i=m),null!==(o=null!==o?o:"")?("::"===t.substr(i,2)?(u="::",i+=2):(u=null,a('"::"')),null!==u&&null!==(l=pe())?e=[e,n,r,s,o,u,l]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?(m=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?s=[s,o]:(s=null,i=m),null!==(s=null!==s?s:"")?(m=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?o=[o,u]:(o=null,i=m),null!==(o=null!==o?o:"")?(m=i,58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?u=[u,l]:(u=null,i=m),null!==(u=null!==u?u:"")?("::"===t.substr(i,2)?(l="::",i+=2):(l=null,a('"::"')),null!==l&&null!==(c=fe())?e=[e,n,r,s,o,u,l,c]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?(m=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?s=[s,o]:(s=null,i=m),null!==(s=null!==s?s:"")?(m=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?o=[o,u]:(o=null,i=m),null!==(o=null!==o?o:"")?(m=i,58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?u=[u,l]:(u=null,i=m),null!==(u=null!==u?u:"")?(m=i,58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=fe())?l=[l,c]:(l=null,i=m),null!==(l=null!==l?l:"")?("::"===t.substr(i,2)?(c="::",i+=2):(c=null,a('"::"')),null!==c?e=[e,n,r,s,o,u,l,c]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A))))))))))))))),null!==e&&(e=function(e){return Hn.host_type="IPv6",t.substring(i,e)}(_)),null===e&&(i=_),e}function fe(){var e,t,n,r,s;return s=i,null!==(e=h())&&null!==(t=null!==(t=h())?t:"")&&null!==(n=null!==(n=h())?n:"")&&null!==(r=null!==(r=h())?r:"")?e=[e,t,n,r]:(e=null,i=s),e}function pe(){var e,n,r,s;return s=i,null!==(e=fe())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?e=[e,n,r]:(e=null,i=s)):(e=null,i=s),null===e&&(e=ge()),e}function ge(){var e,n,r,s,o,u,l,c,h;return c=i,h=i,null!==(e=_e())?(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null!==n&&null!==(r=_e())?(46===t.charCodeAt(i)?(s=".",i++):(s=null,a('"."')),null!==s&&null!==(o=_e())?(46===t.charCodeAt(i)?(u=".",i++):(u=null,a('"."')),null!==u&&null!==(l=_e())?e=[e,n,r,s,o,u,l]:(e=null,i=h)):(e=null,i=h)):(e=null,i=h)):(e=null,i=h),null!==e&&(e=function(e){return Hn.host_type="IPv4",t.substring(i,e)}(c)),null===e&&(i=c),e}function _e(){var e,n,r,s;return s=i,"25"===t.substr(i,2)?(e="25",i+=2):(e=null,a('"25"')),null!==e?(/^[0-5]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[0-5]")),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null===e&&(s=i,50===t.charCodeAt(i)?(e="2",i++):(e=null,a('"2"')),null!==e?(/^[0-4]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[0-4]")),null!==n&&null!==(r=l())?e=[e,n,r]:(e=null,i=s)):(e=null,i=s),null===e&&(s=i,49===t.charCodeAt(i)?(e="1",i++):(e=null,a('"1"')),null!==e&&null!==(n=l())&&null!==(r=l())?e=[e,n,r]:(e=null,i=s),null===e&&(s=i,/^[1-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[1-9]")),null!==e&&null!==(n=l())?e=[e,n]:(e=null,i=s),null===e&&(e=l())))),e}function Ae(){var e,t,n,r,s,o,a,u;return o=i,a=i,null!==(e=null!==(e=l())?e:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(s=null!==(s=l())?s:"")?e=[e,t,n,r,s]:(e=null,i=a),null!==e&&(u=e,u=parseInt(u.join("")),Hn.port=u,e=u),null===e&&(i=o),e}function me(){var e,n,r,s;for(e=[],s=i,59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null!==n&&null!==(r=ve())?n=[n,r]:(n=null,i=s);null!==n;)e.push(n),s=i,59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null!==n&&null!==(r=ve())?n=[n,r]:(n=null,i=s);return e}function ve(){var e;return null===(e=ye())&&null===(e=Te())&&null===(e=Se())&&null===(e=Ce())&&null===(e=Ee())&&null===(e=we())&&(e=be()),e}function ye(){var e,n,r,s;return r=i,s=i,"transport="===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,a('"transport="')),null!==e?("udp"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,a('"udp"')),null===n&&("tcp"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,a('"tcp"')),null===n&&("sctp"===t.substr(i,4).toLowerCase()?(n=t.substr(i,4),i+=4):(n=null,a('"sctp"')),null===n&&("tls"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,a('"tls"')),null===n&&(n=O())))),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null!==e&&(e=function(e,t){Hn.uri_params||(Hn.uri_params={}),Hn.uri_params.transport=t.toLowerCase()}(0,e[1])),null===e&&(i=r),e}function Te(){var e,n,r,s,o;return r=i,s=i,"user="===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"user="')),null!==e?("phone"===t.substr(i,5).toLowerCase()?(n=t.substr(i,5),i+=5):(n=null,a('"phone"')),null===n&&("ip"===t.substr(i,2).toLowerCase()?(n=t.substr(i,2),i+=2):(n=null,a('"ip"')),null===n&&(n=O())),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null!==e&&(o=e[1],Hn.uri_params||(Hn.uri_params={}),e=void(Hn.uri_params.user=o.toLowerCase())),null===e&&(i=r),e}function Se(){var e,n,r,s,o;return r=i,s=i,"method="===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"method="')),null!==e&&null!==(n=ct())?e=[e,n]:(e=null,i=s),null!==e&&(o=e[1],Hn.uri_params||(Hn.uri_params={}),e=void(Hn.uri_params.method=o)),null===e&&(i=r),e}function Ce(){var e,n,r,s,o;return r=i,s=i,"ttl="===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"ttl="')),null!==e&&null!==(n=wn())?e=[e,n]:(e=null,i=s),null!==e&&(o=e[1],Hn.params||(Hn.params={}),e=void(Hn.params.ttl=o)),null===e&&(i=r),e}function Ee(){var e,n,r,s,o;return r=i,s=i,"maddr="===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"maddr="')),null!==e&&null!==(n=ae())?e=[e,n]:(e=null,i=s),null!==e&&(o=e[1],Hn.uri_params||(Hn.uri_params={}),e=void(Hn.uri_params.maddr=o)),null===e&&(i=r),e}function we(){var e,n,r,s,o,u;return s=i,o=i,"lr"===t.substr(i,2).toLowerCase()?(e=t.substr(i,2),i+=2):(e=null,a('"lr"')),null!==e?(u=i,61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null!==n&&null!==(r=O())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(Hn.uri_params||(Hn.uri_params={}),e=void(Hn.uri_params.lr=void 0)),null===e&&(i=s),e}function be(){var e,n,r,s,o,u,l,c;return s=i,o=i,null!==(e=Ie())?(u=i,61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null!==n&&null!==(r=Re())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(l=e[0],c=e[1],Hn.uri_params||(Hn.uri_params={}),c=void 0===c?void 0:c[1],e=void(Hn.uri_params[l.toLowerCase()]=c)),null===e&&(i=s),e}function Ie(){var e,t,n;if(n=i,null!==(t=Oe()))for(e=[];null!==t;)e.push(t),t=Oe();else e=null;return null!==e&&(e=e.join("")),null===e&&(i=n),e}function Re(){var e,t,n;if(n=i,null!==(t=Oe()))for(e=[];null!==t;)e.push(t),t=Oe();else e=null;return null!==e&&(e=e.join("")),null===e&&(i=n),e}function Oe(){var e;return null===(e=ke())&&null===(e=v())&&(e=T()),e}function ke(){var e;return 91===t.charCodeAt(i)?(e="[",i++):(e=null,a('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,a('"]"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')))))))),e}function De(){var e,n,r,s,o,u,l;if(u=i,63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null!==e)if(null!==(n=qe())){for(r=[],l=i,38===t.charCodeAt(i)?(s="&",i++):(s=null,a('"&"')),null!==s&&null!==(o=qe())?s=[s,o]:(s=null,i=l);null!==s;)r.push(s),l=i,38===t.charCodeAt(i)?(s="&",i++):(s=null,a('"&"')),null!==s&&null!==(o=qe())?s=[s,o]:(s=null,i=l);null!==r?e=[e,n,r]:(e=null,i=u)}else e=null,i=u;else e=null,i=u;return e}function qe(){var e,n,r,s,o,u,l;return s=i,o=i,null!==(e=Me())?(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null!==n&&null!==(r=Ne())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(u=e[0],l=e[2],u=u.join("").toLowerCase(),l=l.join(""),Hn.uri_headers||(Hn.uri_headers={}),e=void(Hn.uri_headers[u]?Hn.uri_headers[u].push(l):Hn.uri_headers[u]=[l])),null===e&&(i=s),e}function Me(){var e,t;if(null===(t=Ue())&&null===(t=v())&&(t=T()),null!==t)for(e=[];null!==t;)e.push(t),null===(t=Ue())&&null===(t=v())&&(t=T());else e=null;return e}function Ne(){var e,t;for(e=[],null===(t=Ue())&&null===(t=v())&&(t=T());null!==t;)e.push(t),null===(t=Ue())&&null===(t=v())&&(t=T());return e}function Ue(){var e;return 91===t.charCodeAt(i)?(e="[",i++):(e=null,a('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,a('"]"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')))))))),e}function xe(){var e,t,n,r,s,o;return o=i,null!==(e=ct())&&null!==(t=g())&&null!==(n=Le())&&null!==(r=g())&&null!==(s=et())?e=[e,t,n,r,s]:(e=null,i=o),e}function Le(){var e;return null===(e=X())&&(e=Be()),e}function Be(){var e,n,r,s;return s=i,null!==(e=ze())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n?(null===(r=Pe())&&(r=Ge()),null!==r?e=[e,n,r]:(e=null,i=s)):(e=null,i=s)):(e=null,i=s),e}function Pe(){var e,n,r,s,o;return s=i,null===(e=Fe())&&(e=He()),null!==e?(o=i,63===t.charCodeAt(i)?(n="?",i++):(n=null,a('"?"')),null!==n&&null!==(r=$e())?n=[n,r]:(n=null,i=o),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=s)):(e=null,i=s),e}function Fe(){var e,n,r,s;return s=i,"//"===t.substr(i,2)?(e="//",i+=2):(e=null,a('"//"')),null!==e&&null!==(n=Ve())&&null!==(r=null!==(r=He())?r:"")?e=[e,n,r]:(e=null,i=s),e}function He(){var e,n,r;return r=i,47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null!==e&&null!==(n=Qe())?e=[e,n]:(e=null,i=r),e}function Ge(){var e,t,n,r;if(r=i,null!==(e=je())){for(t=[],n=Ye();null!==n;)t.push(n),n=Ye();null!==t?e=[e,t]:(e=null,i=r)}else e=null,i=r;return e}function Ye(){var e;return null===(e=m())&&null===(e=v())&&(e=T()),e}function je(){var e;return null===(e=v())&&null===(e=T())&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,a('";"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,a('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","'))))))))))),e}function Qe(){var e,n,r,s,o,u;if(o=i,null!==(e=We())){for(n=[],u=i,47===t.charCodeAt(i)?(r="/",i++):(r=null,a('"/"')),null!==r&&null!==(s=We())?r=[r,s]:(r=null,i=u);null!==r;)n.push(r),u=i,47===t.charCodeAt(i)?(r="/",i++):(r=null,a('"/"')),null!==r&&null!==(s=We())?r=[r,s]:(r=null,i=u);null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return e}function We(){var e,n,r,s,o,u;for(o=i,e=[],n=Je();null!==n;)e.push(n),n=Je();if(null!==e){for(n=[],u=i,59===t.charCodeAt(i)?(r=";",i++):(r=null,a('";"')),null!==r&&null!==(s=Ke())?r=[r,s]:(r=null,i=u);null!==r;)n.push(r),u=i,59===t.charCodeAt(i)?(r=";",i++):(r=null,a('";"')),null!==r&&null!==(s=Ke())?r=[r,s]:(r=null,i=u);null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return e}function Ke(){var e,t;for(e=[],t=Je();null!==t;)e.push(t),t=Je();return e}function Je(){var e;return null===(e=v())&&null===(e=T())&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,a('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","'))))))))),e}function ze(){var e,n,r,s,o;if(s=i,o=i,null!==(e=c())){for(n=[],null===(r=c())&&null===(r=l())&&(43===t.charCodeAt(i)?(r="+",i++):(r=null,a('"+"')),null===r&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')))));null!==r;)n.push(r),null===(r=c())&&null===(r=l())&&(43===t.charCodeAt(i)?(r="+",i++):(r=null,a('"+"')),null===r&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')))));null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return null!==e&&(e=function(e){Hn.scheme=t.substring(i,e)}(s)),null===e&&(i=s),e}function Ve(){var e;return null===(e=Ze())&&(e=Xe()),e}function Ze(){var e,n,r,s;return r=i,s=i,null!==(e=ne())?(64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null!==(e=null!==e?e:"")&&null!==(n=oe())?e=[e,n]:(e=null,i=r),e=null!==e?e:""}function Xe(){var e,n;if(null===(n=v())&&null===(n=T())&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,a('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')),null===n&&(59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null===n&&(64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null===n&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,a('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=v())&&null===(n=T())&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,a('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')),null===n&&(59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null===n&&(64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null===n&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,a('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"'))))))))));else e=null;return e}function $e(){var e,t;for(e=[],t=Ye();null!==t;)e.push(t),t=Ye();return e}function et(){var e,n,r,s,o,u,c,h;if(c=i,h=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"SIP"')),null!==e)if(47===t.charCodeAt(i)?(n="/",i++):(n=null,a('"/"')),null!==n){if(null!==(s=l()))for(r=[];null!==s;)r.push(s),s=l();else r=null;if(null!==r)if(46===t.charCodeAt(i)?(s=".",i++):(s=null,a('"."')),null!==s){if(null!==(u=l()))for(o=[];null!==u;)o.push(u),u=l();else o=null;null!==o?e=[e,n,r,s,o]:(e=null,i=h)}else e=null,i=h;else e=null,i=h}else e=null,i=h;else e=null,i=h;return null!==e&&(e=function(e){Hn.sip_version=t.substring(i,e)}(c)),null===e&&(i=c),e}function tt(){var e;return"INVITE"===t.substr(i,6)?(e="INVITE",i+=6):(e=null,a('"INVITE"')),e}function nt(){var e;return"ACK"===t.substr(i,3)?(e="ACK",i+=3):(e=null,a('"ACK"')),e}function rt(){var e;return"OPTIONS"===t.substr(i,7)?(e="OPTIONS",i+=7):(e=null,a('"OPTIONS"')),e}function it(){var e;return"BYE"===t.substr(i,3)?(e="BYE",i+=3):(e=null,a('"BYE"')),e}function st(){var e;return"CANCEL"===t.substr(i,6)?(e="CANCEL",i+=6):(e=null,a('"CANCEL"')),e}function ot(){var e;return"REGISTER"===t.substr(i,8)?(e="REGISTER",i+=8):(e=null,a('"REGISTER"')),e}function at(){var e;return"SUBSCRIBE"===t.substr(i,9)?(e="SUBSCRIBE",i+=9):(e=null,a('"SUBSCRIBE"')),e}function ut(){var e;return"NOTIFY"===t.substr(i,6)?(e="NOTIFY",i+=6):(e=null,a('"NOTIFY"')),e}function lt(){var e;return"REFER"===t.substr(i,5)?(e="REFER",i+=5):(e=null,a('"REFER"')),e}function ct(){var e,n;return n=i,null===(e=tt())&&null===(e=nt())&&null===(e=rt())&&null===(e=it())&&null===(e=st())&&null===(e=ot())&&null===(e=at())&&null===(e=ut())&&null===(e=lt())&&(e=O()),null!==e&&(e=function(e){return Hn.method=t.substring(i,e),Hn.method}(n)),null===e&&(i=n),e}function ht(){var e,t,n,r,s,o;return o=i,null!==(e=et())&&null!==(t=g())&&null!==(n=dt())&&null!==(r=g())&&null!==(s=pt())?e=[e,t,n,r,s]:(e=null,i=o),e}function dt(){var e,t,n;return t=i,null!==(e=ft())&&(n=e,e=void(Hn.status_code=parseInt(n.join("")))),null===e&&(i=t),e}function ft(){var e,t,n,r;return r=i,null!==(e=l())&&null!==(t=l())&&null!==(n=l())?e=[e,t,n]:(e=null,i=r),e}function pt(){var e,n,r;for(r=i,e=[],null===(n=m())&&null===(n=v())&&null===(n=T())&&null===(n=I())&&null===(n=R())&&null===(n=g())&&(n=_());null!==n;)e.push(n),null===(n=m())&&null===(n=v())&&null===(n=T())&&null===(n=I())&&null===(n=R())&&null===(n=g())&&(n=_());return null!==e&&(e=function(e){Hn.reason_phrase=t.substring(i,e)}(r)),null===e&&(i=r),e}function gt(){var e,t,n,r,s,o,a;if(s=i,o=i,null===(e=Z())&&(e=_t()),null!==e){for(t=[],a=i,null!==(n=G())&&null!==(r=mt())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=mt())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return null!==e&&(e=function(e){var t;Hn.multi_header||(Hn.multi_header=[]);try{t=new Fn(Hn.uri,Hn.display_name,Hn.params),delete Hn.uri,delete Hn.display_name,delete Hn.params}catch(e){t=null}Hn.multi_header.push({possition:i,offset:e,parsed:t})}(s)),null===e&&(i=s),e}function _t(){var e,t,n,r,s;return s=i,null!==(e=null!==(e=At())?e:"")&&null!==(t=F())&&null!==(n=X())&&null!==(r=P())?e=[e,t,n,r]:(e=null,i=s),e}function At(){var e,t,n,r,s,o,a,u;if(s=i,o=i,null!==(e=O())){for(t=[],a=i,null!==(n=S())&&null!==(r=O())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=S())&&null!==(r=O())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return null===e&&(e=J()),null!==e&&(u=e,e=void(Hn.display_name="string"==typeof u?u:u[1].reduce(function(e,t){return e+t[0]+t[1]},u[0]))),null===e&&(i=s),e}function mt(){var e;return null===(e=vt())&&null===(e=yt())&&(e=Ct()),e}function vt(){var e,n,r,s,o,u;return s=i,o=i,"q"===t.substr(i,1).toLowerCase()?(e=t.substr(i,1),i++):(e=null,a('"q"')),null!==e&&null!==(n=x())&&null!==(r=St())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],Hn.params||(Hn.params={}),e=void(Hn.params.q=u)),null===e&&(i=s),e}function yt(){var e,n,r,s,o,u;return s=i,o=i,"expires"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"expires"')),null!==e&&null!==(n=x())&&null!==(r=Tt())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],Hn.params||(Hn.params={}),e=void(Hn.params.expires=u)),null===e&&(i=s),e}function Tt(){var e,t,n;if(n=i,null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null!==e&&(e=parseInt(e.join(""))),null===e&&(i=n),e}function St(){var e,n,r,s,o,u,c,h;return u=i,c=i,48===t.charCodeAt(i)?(e="0",i++):(e=null,a('"0"')),null!==e?(h=i,46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null!==n&&null!==(r=null!==(r=l())?r:"")&&null!==(s=null!==(s=l())?s:"")&&null!==(o=null!==(o=l())?o:"")?n=[n,r,s,o]:(n=null,i=h),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=c)):(e=null,i=c),null!==e&&(e=function(e){return parseFloat(t.substring(i,e))}(u)),null===e&&(i=u),e}function Ct(){var e,t,n,r,s,o,a,u;return r=i,s=i,null!==(e=O())?(o=i,null!==(t=x())&&null!==(n=Et())?t=[t,n]:(t=null,i=o),null!==(t=null!==t?t:"")?e=[e,t]:(e=null,i=s)):(e=null,i=s),null!==e&&(a=e[0],u=e[1],Hn.params||(Hn.params={}),u=void 0===u?void 0:u[1],e=void(Hn.params[a.toLowerCase()]=u)),null===e&&(i=r),e}function Et(){var e;return null===(e=O())&&null===(e=ae())&&(e=K()),e}function wt(){var e;return"render"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"render"')),null===e&&("session"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"session"')),null===e&&("icon"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"icon"')),null===e&&("alert"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"alert"')),null===e&&(e=O())))),e}function bt(){var e;return null===(e=It())&&(e=Ct()),e}function It(){var e,n,r,s;return s=i,"handling"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,a('"handling"')),null!==e&&null!==(n=x())?("optional"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,a('"optional"')),null===r&&("required"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,a('"required"')),null===r&&(r=O())),null!==r?e=[e,n,r]:(e=null,i=s)):(e=null,i=s),e}function Rt(){var e,t,n,r,s,o,a,u;if(a=i,null!==(e=Ot()))if(null!==(t=N()))if(null!==(n=Nt())){for(r=[],u=i,null!==(s=G())&&null!==(o=Ut())?s=[s,o]:(s=null,i=u);null!==s;)r.push(s),u=i,null!==(s=G())&&null!==(o=Ut())?s=[s,o]:(s=null,i=u);null!==r?e=[e,t,n,r]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;else e=null,i=a;return e}function Ot(){var e;return null===(e=kt())&&(e=Dt()),e}function kt(){var e;return"text"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"text"')),null===e&&("image"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"image"')),null===e&&("audio"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"audio"')),null===e&&("video"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"video"')),null===e&&("application"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,a('"application"')),null===e&&(e=qt()))))),e}function Dt(){var e;return"message"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"message"')),null===e&&("multipart"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"multipart"')),null===e&&(e=qt())),e}function qt(){var e;return null===(e=O())&&(e=Mt()),e}function Mt(){var e,n,r;return r=i,"x-"===t.substr(i,2).toLowerCase()?(e=t.substr(i,2),i+=2):(e=null,a('"x-"')),null!==e&&null!==(n=O())?e=[e,n]:(e=null,i=r),e}function Nt(){var e;return null===(e=qt())&&(e=O()),e}function Ut(){var e,t,n,r;return r=i,null!==(e=O())&&null!==(t=x())&&null!==(n=xt())?e=[e,t,n]:(e=null,i=r),e}function xt(){var e;return null===(e=O())&&(e=K()),e}function Lt(){var e,t,n,r;if(n=i,null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null!==e&&(r=e,e=void(Hn.value=parseInt(r.join("")))),null===e&&(i=n),e}function Bt(){var e,n,r,s,o,u;if(o=i,null!==(e=k())){for(n=[],u=i,46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==r&&null!==(s=k())?r=[r,s]:(r=null,i=u);null!==r;)n.push(r),u=i,46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==r&&null!==(s=k())?r=[r,s]:(r=null,i=u);null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return e}function Pt(){var e;return null===(e=Ft())&&(e=Ct()),e}function Ft(){var e,n,r,s,o,u;return s=i,o=i,"tag"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"tag"')),null!==e&&null!==(n=x())&&null!==(r=O())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.tag=u)),null===e&&(i=s),e}function Ht(){var e,n,r,s,o,u,l,c;if(l=i,"digest"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"Digest"')),null!==e)if(null!==(n=S()))if(null!==(r=jt())){for(s=[],c=i,null!==(o=H())&&null!==(u=jt())?o=[o,u]:(o=null,i=c);null!==o;)s.push(o),c=i,null!==(o=H())&&null!==(u=jt())?o=[o,u]:(o=null,i=c);null!==s?e=[e,n,r,s]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;else e=null,i=l;return null===e&&(e=Gt()),e}function Gt(){var e,t,n,r,s,o,a,u;if(a=i,null!==(e=O()))if(null!==(t=S()))if(null!==(n=Yt())){for(r=[],u=i,null!==(s=H())&&null!==(o=Yt())?s=[s,o]:(s=null,i=u);null!==s;)r.push(s),u=i,null!==(s=H())&&null!==(o=Yt())?s=[s,o]:(s=null,i=u);null!==r?e=[e,t,n,r]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;else e=null,i=a;return e}function Yt(){var e,t,n,r;return r=i,null!==(e=O())&&null!==(t=x())?(null===(n=O())&&(n=K()),null!==n?e=[e,t,n]:(e=null,i=r)):(e=null,i=r),e}function jt(){var e;return null===(e=Qt())&&null===(e=Kt())&&null===(e=zt())&&null===(e=Zt())&&null===(e=Xt())&&null===(e=$t())&&null===(e=en())&&(e=Yt()),e}function Qt(){var e,n,r,s;return s=i,"realm"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"realm"')),null!==e&&null!==(n=x())&&null!==(r=Wt())?e=[e,n,r]:(e=null,i=s),e}function Wt(){var e,t,n;return t=i,null!==(e=J())&&(n=e,e=void(Hn.realm=n)),null===e&&(i=t),e}function Kt(){var e,n,r,s,o,u,l,c,h;if(c=i,"domain"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"domain"')),null!==e)if(null!==(n=x()))if(null!==(r=j()))if(null!==(s=Jt())){if(o=[],h=i,null!==(l=g()))for(u=[];null!==l;)u.push(l),l=g();else u=null;for(null!==u&&null!==(l=Jt())?u=[u,l]:(u=null,i=h);null!==u;){if(o.push(u),h=i,null!==(l=g()))for(u=[];null!==l;)u.push(l),l=g();else u=null;null!==u&&null!==(l=Jt())?u=[u,l]:(u=null,i=h)}null!==o&&null!==(u=Q())?e=[e,n,r,s,o,u]:(e=null,i=c)}else e=null,i=c;else e=null,i=c;else e=null,i=c;else e=null,i=c;return e}function Jt(){var e;return null===(e=Be())&&(e=He()),e}function zt(){var e,n,r,s;return s=i,"nonce"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"nonce"')),null!==e&&null!==(n=x())&&null!==(r=Vt())?e=[e,n,r]:(e=null,i=s),e}function Vt(){var e,t,n;return t=i,null!==(e=J())&&(n=e,e=void(Hn.nonce=n)),null===e&&(i=t),e}function Zt(){var e,n,r,s,o,u;return s=i,o=i,"opaque"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"opaque"')),null!==e&&null!==(n=x())&&null!==(r=J())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.opaque=u)),null===e&&(i=s),e}function Xt(){var e,n,r,s,o;return s=i,"stale"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"stale"')),null!==e&&null!==(n=x())?(o=i,"true"===t.substr(i,4).toLowerCase()?(r=t.substr(i,4),i+=4):(r=null,a('"true"')),null!==r&&(r=void(Hn.stale=!0)),null===r&&(i=o),null===r&&(o=i,"false"===t.substr(i,5).toLowerCase()?(r=t.substr(i,5),i+=5):(r=null,a('"false"')),null!==r&&(r=void(Hn.stale=!1)),null===r&&(i=o)),null!==r?e=[e,n,r]:(e=null,i=s)):(e=null,i=s),e}function $t(){var e,n,r,s,o,u;return s=i,o=i,"algorithm"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"algorithm"')),null!==e&&null!==(n=x())?("md5"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,a('"MD5"')),null===r&&("md5-sess"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,a('"MD5-sess"')),null===r&&(r=O())),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.algorithm=u.toUpperCase())),null===e&&(i=s),e}function en(){var e,n,r,s,o,u,l,c,h,d;if(c=i,"qop"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"qop"')),null!==e)if(null!==(n=x()))if(null!==(r=j())){if(h=i,null!==(s=tn())){for(o=[],d=i,44===t.charCodeAt(i)?(u=",",i++):(u=null,a('","')),null!==u&&null!==(l=tn())?u=[u,l]:(u=null,i=d);null!==u;)o.push(u),d=i,44===t.charCodeAt(i)?(u=",",i++):(u=null,a('","')),null!==u&&null!==(l=tn())?u=[u,l]:(u=null,i=d);null!==o?s=[s,o]:(s=null,i=h)}else s=null,i=h;null!==s&&null!==(o=Q())?e=[e,n,r,s,o]:(e=null,i=c)}else e=null,i=c;else e=null,i=c;else e=null,i=c;return e}function tn(){var e,n,r;return n=i,"auth-int"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,a('"auth-int"')),null===e&&("auth"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"auth"')),null===e&&(e=O())),null!==e&&(r=e,Hn.qop||(Hn.qop=[]),e=void Hn.qop.push(r.toLowerCase())),null===e&&(i=n),e}function nn(){var e,t,n,r,s,o,a;if(s=i,o=i,null!==(e=_t())){for(t=[],a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return null!==e&&(e=function(e){var t;Hn.multi_header||(Hn.multi_header=[]);try{t=new Fn(Hn.uri,Hn.display_name,Hn.params),delete Hn.uri,delete Hn.display_name,delete Hn.params}catch(e){t=null}Hn.multi_header.push({possition:i,offset:e,parsed:t})}(s)),null===e&&(i=s),e}function rn(){var e;return null===(e=sn())&&(e=Ct()),e}function sn(){var e,n,r,s,o,u,c;if(o=i,u=i,"cause"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"cause"')),null!==e)if(null!==(n=x())){if(null!==(s=l()))for(r=[];null!==s;)r.push(s),s=l();else r=null;null!==r?e=[e,n,r]:(e=null,i=u)}else e=null,i=u;else e=null,i=u;return null!==e&&(c=e[2],e=void(Hn.cause=parseInt(c.join("")))),null===e&&(i=o),e}function on(){var e,t,n,r,s,o;if(s=i,null!==(e=_t())){for(t=[],o=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e}function an(){var e,n;return n=i,"active"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"active"')),null===e&&("pending"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"pending"')),null===e&&("terminated"===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,a('"terminated"')),null===e&&(e=O()))),null!==e&&(e=function(e){Hn.state=t.substring(i,e)}(n)),null===e&&(i=n),e}function un(){var e,n,r,s,o,u,l,c;return s=i,o=i,"reason"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"reason"')),null!==e&&null!==(n=x())&&null!==(r=ln())?e=[e,n,r]:(e=null,i=o),null!==e&&(e=void(void 0!==(u=e[2])&&(Hn.reason=u))),null===e&&(i=s),null===e&&(s=i,o=i,"expires"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"expires"')),null!==e&&null!==(n=x())&&null!==(r=Tt())?e=[e,n,r]:(e=null,i=o),null!==e&&(e=void(void 0!==(c=e[2])&&(Hn.expires=c))),null===e&&(i=s),null===e&&(s=i,o=i,"retry_after"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,a('"retry_after"')),null!==e&&null!==(n=x())&&null!==(r=Tt())?e=[e,n,r]:(e=null,i=o),null!==e&&(e=void(void 0!==(l=e[2])&&(Hn.retry_after=l))),null===e&&(i=s),null===e&&(e=Ct()))),e}function ln(){var e;return"deactivated"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,a('"deactivated"')),null===e&&("probation"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"probation"')),null===e&&("rejected"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,a('"rejected"')),null===e&&("timeout"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"timeout"')),null===e&&("giveup"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"giveup"')),null===e&&("noresource"===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,a('"noresource"')),null===e&&("invariant"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"invariant"')),null===e&&(e=O()))))))),e}function cn(){var e;return null===(e=Ft())&&(e=Ct()),e}function hn(){var e,t,n,r,s,o,a,u;if(a=i,null!==(e=vn()))if(null!==(t=S()))if(null!==(n=Sn())){for(r=[],u=i,null!==(s=G())&&null!==(o=dn())?s=[s,o]:(s=null,i=u);null!==s;)r.push(s),u=i,null!==(s=G())&&null!==(o=dn())?s=[s,o]:(s=null,i=u);null!==r?e=[e,t,n,r]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;else e=null,i=a;return e}function dn(){var e;return null===(e=fn())&&null===(e=pn())&&null===(e=gn())&&null===(e=_n())&&null===(e=An())&&(e=Ct()),e}function fn(){var e,n,r,s,o,u;return s=i,o=i,"ttl"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"ttl"')),null!==e&&null!==(n=x())&&null!==(r=wn())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.ttl=u)),null===e&&(i=s),e}function pn(){var e,n,r,s,o,u;return s=i,o=i,"maddr"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"maddr"')),null!==e&&null!==(n=x())&&null!==(r=ae())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.maddr=u)),null===e&&(i=s),e}function gn(){var e,n,r,s,o,u;return s=i,o=i,"received"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,a('"received"')),null!==e&&null!==(n=x())?(null===(r=ge())&&(r=de()),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.received=u)),null===e&&(i=s),e}function _n(){var e,n,r,s,o,u;return s=i,o=i,"branch"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"branch"')),null!==e&&null!==(n=x())&&null!==(r=O())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.branch=u)),null===e&&(i=s),e}function An(){var e,n,r,s,o;return s=i,"rport"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"rport"')),null!==e?(o=i,null!==(n=x())&&null!==(r=mn())?n=[n,r]:(n=null,i=o),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=s)):(e=null,i=s),e}function mn(){var e,t,n,r,s,o,a,u;return o=i,a=i,null!==(e=null!==(e=l())?e:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(s=null!==(s=l())?s:"")?e=[e,t,n,r,s]:(e=null,i=a),null!==e&&(u=e,e=void(Hn.rport=parseInt(u.join("")))),null===e&&(i=o),e}function vn(){var e,t,n,r,s,o;return o=i,null!==(e=yn())&&null!==(t=N())&&null!==(n=O())&&null!==(r=N())&&null!==(s=Tn())?e=[e,t,n,r,s]:(e=null,i=o),e}function yn(){var e,n,r;return n=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"SIP"')),null===e&&(e=O()),null!==e&&(r=e,e=void(Hn.protocol=r)),null===e&&(i=n),e}function Tn(){var e,n,r;return n=i,"udp"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"UDP"')),null===e&&("tcp"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"TCP"')),null===e&&("tls"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"TLS"')),null===e&&("sctp"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"SCTP"')),null===e&&(e=O())))),null!==e&&(r=e,e=void(Hn.transport=r)),null===e&&(i=n),e}function Sn(){var e,t,n,r,s;return r=i,null!==(e=Cn())?(s=i,null!==(t=Y())&&null!==(n=En())?t=[t,n]:(t=null,i=s),null!==(t=null!==t?t:"")?e=[e,t]:(e=null,i=r)):(e=null,i=r),e}function Cn(){var e,n;return n=i,null===(e=ge())&&null===(e=he())&&(e=ue()),null!==e&&(e=function(e){Hn.host=t.substring(i,e)}(n)),null===e&&(i=n),e}function En(){var e,t,n,r,s,o,a,u;return o=i,a=i,null!==(e=null!==(e=l())?e:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(s=null!==(s=l())?s:"")?e=[e,t,n,r,s]:(e=null,i=a),null!==e&&(u=e,e=void(Hn.port=parseInt(u.join("")))),null===e&&(i=o),e}function wn(){var e,t,n,r,s;return r=i,s=i,null!==(e=l())&&null!==(t=null!==(t=l())?t:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,t,n]:(e=null,i=s),null!==e&&(e=parseInt(e.join(""))),null===e&&(i=r),e}function bn(){var e,t,n;return t=i,null!==(e=Tt())&&(n=e,e=void(Hn.expires=n)),null===e&&(i=t),e}function In(){var e;return null===(e=Rn())&&(e=Ct()),e}function Rn(){var e,n,r,s,o,u;return s=i,o=i,"refresher"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"refresher"')),null!==e&&null!==(n=x())?("uac"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,a('"uac"')),null===r&&("uas"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,a('"uas"'))),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.refresher=u.toLowerCase())),null===e&&(i=s),e}function On(){var e,t;for(e=[],null===(t=b())&&null===(t=R())&&(t=S());null!==t;)e.push(t),null===(t=b())&&null===(t=R())&&(t=S());return e}function kn(){var e,n,r,s,o,u,l,c,h,d,f;return d=i,f=i,null!==(e=qn())?(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null!==n&&null!==(r=Dn())?(45===t.charCodeAt(i)?(s="-",i++):(s=null,a('"-"')),null!==s&&null!==(o=Dn())?(45===t.charCodeAt(i)?(u="-",i++):(u=null,a('"-"')),null!==u&&null!==(l=Dn())?(45===t.charCodeAt(i)?(c="-",i++):(c=null,a('"-"')),null!==c&&null!==(h=Mn())?e=[e,n,r,s,o,u,l,c,h]:(e=null,i=f)):(e=null,i=f)):(e=null,i=f)):(e=null,i=f)):(e=null,i=f),null!==e&&(e=function(e){Hn=t.substring(i+5,e)}(d,e[0])),null===e&&(i=d),e}function Dn(){var e,t,n,r,s;return s=i,null!==(e=h())&&null!==(t=h())&&null!==(n=h())&&null!==(r=h())?e=[e,t,n,r]:(e=null,i=s),e}function qn(){var e,t,n;return n=i,null!==(e=Dn())&&null!==(t=Dn())?e=[e,t]:(e=null,i=n),e}function Mn(){var e,t,n,r;return r=i,null!==(e=Dn())&&null!==(t=Dn())&&null!==(n=Dn())?e=[e,t,n]:(e=null,i=r),e}function Nn(){var e,n,r,s,o,u;return s=i,o=i,null!==(e=D())?(u=i,64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null!==n&&null!==(r=D())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=function(e){Hn.call_id=t.substring(i,e)}(s)),null===e&&(i=s),e}function Un(){var e;return null===(e=xn())&&null===(e=Ln())&&null===(e=Bn())&&(e=Ct()),e}function xn(){var e,n,r,s,o,u;return s=i,o=i,"to-tag"===t.substr(i,6)?(e="to-tag",i+=6):(e=null,a('"to-tag"')),null!==e&&null!==(n=x())&&null!==(r=O())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.to_tag=u)),null===e&&(i=s),e}function Ln(){var e,n,r,s,o,u;return s=i,o=i,"from-tag"===t.substr(i,8)?(e="from-tag",i+=8):(e=null,a('"from-tag"')),null!==e&&null!==(n=x())&&null!==(r=O())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.from_tag=u)),null===e&&(i=s),e}function Bn(){var e,n;return n=i,"early-only"===t.substr(i,10)?(e="early-only",i+=10):(e=null,a('"early-only"')),null!==e&&(e=void(Hn.early_only=!0)),null===e&&(i=n),e}var Pn=U(),Fn=M(),Hn={};if(null===r[n]()||i!==t.length){var Gn=Math.max(i,s),Yn=Gn<t.length?t.charAt(Gn):null,jn=function(){for(var e=1,n=1,r=!1,o=0;o<Math.max(i,s);o++){var a=t.charAt(o);"\n"===a?(r||e++,n=1,r=!1):"\r"===a||"\u2028"===a||"\u2029"===a?(e++,n=1,r=!0):(n++,r=!1)}return{line:e,column:n}}();return new this.SyntaxError(function(e){e.sort();for(var t=null,n=[],r=0;r<e.length;r++)e[r]!==t&&(n.push(e[r]),t=e[r]);return n}(o),Yn,Gn,jn.line,jn.column),-1}return Hn},toSource:function(){return this._source},SyntaxError:function(t,n,r,i,s){this.name="SyntaxError",this.expected=t,this.found=n,this.message=function(t,n){var r;switch(t.length){case 0:r="end of input";break;case 1:r=t[0];break;default:r=t.slice(0,t.length-1).join(", ")+" or "+t[t.length-1]}return"Expected "+r+" but "+(n?e(n):"end of input")+" found."}(t,n),this.offset=r,this.line=i,this.column=s}};return t.SyntaxError.prototype=Error.prototype,t}()),T}function U(){if(E)return C;function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n){r&&(e=r);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}E=1;var i=l,s=x(),o=N();return C=function(){function t(e,n,r,s){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!r)throw new TypeError('missing or invalid "host" parameter');for(var u in this._parameters={},this._headers={},this._scheme=e||i.SIP,this._user=n,this._host=r,this._port=s,o)Object.prototype.hasOwnProperty.call(o,u)&&this.setParam(u,o[u]);for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&this.setHeader(l,a[l])}return r(t,null,[{key:"parse",value:function(e){return-1!==(e=o.parse(e,"SIP_URI"))?e:void 0}}]),r(t,[{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=null==t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e)){var t=this._parameters[e];return delete this._parameters[e],t}}},{key:"clearParams",value:function(){this._parameters={}}},{key:"setHeader",value:function(e,t){this._headers[s.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){if(e)return this._headers[s.headerize(e)]}},{key:"hasHeader",value:function(e){if(e)return!!this._headers.hasOwnProperty(s.headerize(e))}},{key:"deleteHeader",value:function(e){if(e=s.headerize(e),this._headers.hasOwnProperty(e)){var t=this._headers[e];return delete this._headers[e],t}}},{key:"clearHeaders",value:function(){this._headers={}}},{key:"clone",value:function(){return new t(this._scheme,this._user,this._host,this._port,JSON.parse(JSON.stringify(this._parameters)),JSON.parse(JSON.stringify(this._headers)))}},{key:"toString",value:function(){var t=[],n="".concat(this._scheme,":");for(var r in this._user&&(n+="".concat(s.escapeUser(this._user),"@")),n+=this._host,(this._port||0===this._port)&&(n+=":".concat(this._port)),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,r)&&(n+=";".concat(r),null!==this._parameters[r]&&(n+="=".concat(this._parameters[r])));for(var i in this._headers)if(Object.prototype.hasOwnProperty.call(this._headers,i)){var o,a=e(this._headers[i]);try{for(a.s();!(o=a.n()).done;){var u=o.value;t.push("".concat(i,"=").concat(u))}}catch(e){a.e(e)}finally{a.f()}}return t.length>0&&(n+="?".concat(t.join("&"))),n}},{key:"toAor",value:function(e){var t="".concat(this._scheme,":");return this._user&&(t+="".concat(s.escapeUser(this._user),"@")),t+=this._host,e&&(this._port||0===this._port)&&(t+=":".concat(this._port)),t}},{key:"scheme",get:function(){return this._scheme},set:function(e){this._scheme=e.toLowerCase()}},{key:"user",get:function(){return this._user},set:function(e){this._user=e}},{key:"host",get:function(){return this._host},set:function(e){this._host=e.toLowerCase()}},{key:"port",get:function(){return this._port},set:function(e){this._port=0===e?e:parseInt(e,10)||null}}]),t}(),C}function x(){if(w)return q;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e))||t){r&&(e=r);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}w=1;var r=l,i=U(),s=N();q.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length};var o=q.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)};q.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},q.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},q.isEmpty=function(e){return null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e)},q.hasMethods=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var i=0,s=n;i<s.length;i++){var a=s[i];if(o(e[a]))return!1}return!0};var a=q.createRandomToken=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,r="";for(t=0;t<e;t++)r+=(Math.random()*n|0).toString(n);return r};q.newTag=function(){return a(10)},q.newUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},q.hostType=function(e){if(e)return-1!==(e=s.parse(e,"host"))?e.host_type:void 0};var u=q.escapeUser=function(e){return encodeURIComponent(decodeURIComponent(e)).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")};return q.normalizeTarget=function(e,t){if(e){if(e instanceof i)return e;if("string"==typeof e){var n,s,o,a=e.split("@");switch(a.length){case 1:if(!t)return;n=e,s=t;break;case 2:n=a[0],s=a[1];break;default:n=a.slice(0,a.length-1).join("@"),s=a[a.length-1]}return n=n.replace(/^(sips?|tel):/i,""),/^[-.()]*\+?[0-9\-.()]+$/.test(n)&&(n=n.replace(/[-.()]/g,"")),e="".concat(r.SIP,":").concat(u(n),"@").concat(s),(o=i.parse(e))?o:void 0}}else;},q.headerize=function(e){var t,n={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),i="",s=r.length;for(t=0;t<s;t++)0!==t&&(i+="-"),i+=r[t].charAt(0).toUpperCase()+r[t].substring(1);return n[i]&&(i=n[i]),i},q.sipErrorCause=function(e){for(var t in r.SIP_ERROR_CAUSES)if(-1!==r.SIP_ERROR_CAUSES[t].indexOf(e))return r.causes[t];return r.causes.SIP_FAILURE_CODE},q.getRandomTestNetIP=function(){return"192.0.2.".concat((e=1,t=254,Math.floor(Math.random()*(t-e+1)+e)));var e,t},q.calculateMD5=function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n=2147483648&e,r=2147483648&t,i=1073741824&e,s=1073741824&t,o=(1073741823&e)+(1073741823&t);return i&s?2147483648^o^n^r:i|s?1073741824&o?3221225472^o^n^r:1073741824^o^n^r:o^n^r}function r(e,r,i,s,o,a,u){return e=n(e,n(n(function(e,t,n){return e&t|~e&n}(r,i,s),o),u)),n(t(e,a),r)}function i(e,r,i,s,o,a,u){return e=n(e,n(n(function(e,t,n){return e&n|t&~n}(r,i,s),o),u)),n(t(e,a),r)}function s(e,r,i,s,o,a,u){return e=n(e,n(n(function(e,t,n){return e^t^n}(r,i,s),o),u)),n(t(e,a),r)}function o(e,r,i,s,o,a,u){return e=n(e,n(n(function(e,t,n){return t^(e|~n)}(r,i,s),o),u)),n(t(e,a),r)}function a(e){var t,n="",r="";for(t=0;t<=3;t++)n+=(r="0".concat((e>>>8*t&255).toString(16))).substr(r.length-2,2);return n}var u,l,c,h,d,f,p,g,_,A;for(u=function(e){for(var t,n=e.length,r=n+8,i=16*((r-r%64)/64+1),s=new Array(i-1),o=0,a=0;a<n;)o=a%4*8,s[t=(a-a%4)/4]=s[t]|e.charCodeAt(a)<<o,a++;return o=a%4*8,s[t=(a-a%4)/4]=s[t]|128<<o,s[i-2]=n<<3,s[i-1]=n>>>29,s}(e=function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e)),p=1732584193,g=4023233417,_=2562383102,A=271733878,l=0;l<u.length;l+=16)c=p,h=g,d=_,f=A,p=r(p,g,_,A,u[l+0],7,3614090360),A=r(A,p,g,_,u[l+1],12,3905402710),_=r(_,A,p,g,u[l+2],17,606105819),g=r(g,_,A,p,u[l+3],22,3250441966),p=r(p,g,_,A,u[l+4],7,4118548399),A=r(A,p,g,_,u[l+5],12,1200080426),_=r(_,A,p,g,u[l+6],17,2821735955),g=r(g,_,A,p,u[l+7],22,4249261313),p=r(p,g,_,A,u[l+8],7,1770035416),A=r(A,p,g,_,u[l+9],12,2336552879),_=r(_,A,p,g,u[l+10],17,4294925233),g=r(g,_,A,p,u[l+11],22,2304563134),p=r(p,g,_,A,u[l+12],7,1804603682),A=r(A,p,g,_,u[l+13],12,4254626195),_=r(_,A,p,g,u[l+14],17,2792965006),p=i(p,g=r(g,_,A,p,u[l+15],22,1236535329),_,A,u[l+1],5,4129170786),A=i(A,p,g,_,u[l+6],9,3225465664),_=i(_,A,p,g,u[l+11],14,643717713),g=i(g,_,A,p,u[l+0],20,3921069994),p=i(p,g,_,A,u[l+5],5,3593408605),A=i(A,p,g,_,u[l+10],9,38016083),_=i(_,A,p,g,u[l+15],14,3634488961),g=i(g,_,A,p,u[l+4],20,3889429448),p=i(p,g,_,A,u[l+9],5,568446438),A=i(A,p,g,_,u[l+14],9,3275163606),_=i(_,A,p,g,u[l+3],14,4107603335),g=i(g,_,A,p,u[l+8],20,1163531501),p=i(p,g,_,A,u[l+13],5,2850285829),A=i(A,p,g,_,u[l+2],9,4243563512),_=i(_,A,p,g,u[l+7],14,1735328473),p=s(p,g=i(g,_,A,p,u[l+12],20,2368359562),_,A,u[l+5],4,4294588738),A=s(A,p,g,_,u[l+8],11,2272392833),_=s(_,A,p,g,u[l+11],16,1839030562),g=s(g,_,A,p,u[l+14],23,4259657740),p=s(p,g,_,A,u[l+1],4,2763975236),A=s(A,p,g,_,u[l+4],11,1272893353),_=s(_,A,p,g,u[l+7],16,4139469664),g=s(g,_,A,p,u[l+10],23,3200236656),p=s(p,g,_,A,u[l+13],4,681279174),A=s(A,p,g,_,u[l+0],11,3936430074),_=s(_,A,p,g,u[l+3],16,3572445317),g=s(g,_,A,p,u[l+6],23,76029189),p=s(p,g,_,A,u[l+9],4,3654602809),A=s(A,p,g,_,u[l+12],11,3873151461),_=s(_,A,p,g,u[l+15],16,530742520),p=o(p,g=s(g,_,A,p,u[l+2],23,3299628645),_,A,u[l+0],6,4096336452),A=o(A,p,g,_,u[l+7],10,1126891415),_=o(_,A,p,g,u[l+14],15,2878612391),g=o(g,_,A,p,u[l+5],21,4237533241),p=o(p,g,_,A,u[l+12],6,1700485571),A=o(A,p,g,_,u[l+3],10,2399980690),_=o(_,A,p,g,u[l+10],15,4293915773),g=o(g,_,A,p,u[l+1],21,2240044497),p=o(p,g,_,A,u[l+8],6,1873313359),A=o(A,p,g,_,u[l+15],10,4264355552),_=o(_,A,p,g,u[l+6],15,2734768916),g=o(g,_,A,p,u[l+13],21,1309151649),p=o(p,g,_,A,u[l+4],6,4149444226),A=o(A,p,g,_,u[l+11],10,3174756917),_=o(_,A,p,g,u[l+2],15,718787259),g=o(g,_,A,p,u[l+9],21,3951481745),p=n(p,c),g=n(g,h),_=n(_,d),A=n(A,f);return(a(p)+a(g)+a(_)+a(A)).toLowerCase()},q.closeMediaStream=function(n){if(n)try{if(n.getTracks){var r,i=t(n.getTracks());try{for(i.s();!(r=i.n()).done;){r.value.stop()}}catch(e){i.e(e)}finally{i.f()}}else{var s,o=t(n.getAudioTracks());try{for(o.s();!(s=o.n()).done;){s.value.stop()}}catch(e){o.e(e)}finally{o.f()}var a,u=t(n.getVideoTracks());try{for(u.s();!(a=u.n()).done;){a.value.stop()}}catch(e){u.e(e)}finally{u.f()}}}catch(t){"function"!=typeof n.stop&&"object"!==e(n.stop)||n.stop()}},q.cloneArray=function(e){return e&&e.slice()||[]},q.cloneObject=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e&&Object.assign({},e)||t},q}function L(){}function B(){B.init.call(this)}function P(e){return void 0===e._maxListeners?B.defaultMaxListeners:e._maxListeners}function F(e,t,n,r){var i,s,o,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]):(s=e._events=new L,e._eventsCount=0),o){if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=P(e))&&i>0&&o.length>i){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,"function"==typeof console.warn?console.warn(a):console.log(a)}}else o=s[t]=n,++e._eventsCount;return e}function H(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function G(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function Y(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}L.prototype=Object.create(null),B.EventEmitter=B,B.usingDomains=!1,B.prototype.domain=void 0,B.prototype._events=void 0,B.prototype._maxListeners=void 0,B.defaultMaxListeners=10,B.init=function(){this.domain=null,B.usingDomains&&(!b.active||this instanceof b.Domain||(this.domain=b.active)),this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new L,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},B.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},B.prototype.getMaxListeners=function(){return P(this)},B.prototype.emit=function(e){var t,n,r,i,s,o,a,u="error"===e;if(o=this._events)u=u&&null==o.error;else if(!u)return!1;if(a=this.domain,u){if(t=arguments[1],!a){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=o[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=Y(e,r),s=0;s<r;++s)i[s].call(n)}(n,c,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,s=Y(e,i),o=0;o<i;++o)s[o].call(n,r)}(n,c,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var s=e.length,o=Y(e,s),a=0;a<s;++a)o[a].call(n,r,i)}(n,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,s){if(t)e.call(n,r,i,s);else for(var o=e.length,a=Y(e,o),u=0;u<o;++u)a[u].call(n,r,i,s)}(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),s=1;s<r;s++)i[s-1]=arguments[s];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,s=Y(e,i),o=0;o<i;++o)s[o].apply(n,r)}(n,c,this,i)}return!0},B.prototype.addListener=function(e,t){return F(this,e,t,!1)},B.prototype.on=B.prototype.addListener,B.prototype.prependListener=function(e,t){return F(this,e,t,!0)},B.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,H(this,e,t)),this},B.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,H(this,e,t)),this},B.prototype.removeListener=function(e,t){var n,r,i,s,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0===--this._eventsCount?this._events=new L:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0===--this._eventsCount)return this._events=new L,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,o||t)}return this},B.prototype.off=function(e,t){return this.removeListener(e,t)},B.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new L,this._eventsCount=0):n[e]&&(0===--this._eventsCount?this._events=new L:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),s=0;s<i.length;++s)"removeListener"!==(r=i[s])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new L,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},B.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},B.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):G.call(e,t)},B.prototype.listenerCount=G,B.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var j=o(Object.freeze({__proto__:null,EventEmitter:B,default:B})),Q="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function W(){throw new Error("setTimeout has not been defined")}function K(){throw new Error("clearTimeout has not been defined")}var J=W,z=K;function V(e){if(J===setTimeout)return setTimeout(e,0);if((J===W||!J)&&setTimeout)return J=setTimeout,setTimeout(e,0);try{return J(e,0)}catch(t){try{return J.call(null,e,0)}catch(t){return J.call(this,e,0)}}}"function"==typeof Q.setTimeout&&(J=setTimeout),"function"==typeof Q.clearTimeout&&(z=clearTimeout);var Z,X=[],$=!1,ee=-1;function te(){$&&Z&&($=!1,Z.length?X=Z.concat(X):ee=-1,X.length&&ne())}function ne(){if(!$){var e=V(te);$=!0;for(var t=X.length;t;){for(Z=X,X=[];++ee<t;)Z&&Z[ee].run();ee=-1,t=X.length}Z=null,$=!1,function(e){if(z===clearTimeout)return clearTimeout(e);if((z===K||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(e);try{return z(e)}catch(t){try{return z.call(null,e)}catch(t){return z.call(this,e)}}}(e)}}function re(e,t){this.fun=e,this.array=t}re.prototype.run=function(){this.fun.apply(null,this.array)};function ie(){}var se=ie,oe=ie,ae=ie,ue=ie,le=ie,ce=ie,he=ie;var de=Q.performance||{},fe=de.now||de.mozNow||de.msNow||de.oNow||de.webkitNow||function(){return(new Date).getTime()};var pe=new Date;var ge,_e,Ae,me,ve,ye={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];X.push(new re(e,t)),1!==X.length||$||V(ne)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:se,addListener:oe,once:ae,off:ue,removeListener:le,removeAllListeners:ce,emit:he,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*fe.call(de),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-pe)/1e3}},Te={exports:{}},Se={exports:{}};function Ce(){if(_e)return ge;_e=1;var e=1e3,t=60*e,n=60*t,r=24*n,i=7*r,s=365.25*r;function o(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}return ge=function(a,u){u=u||{};var l=typeof a;if("string"===l&&a.length>0)return function(o){if((o=String(o)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!a)return;var u=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*i;case"days":case"day":case"d":return u*r;case"hours":case"hour":case"hrs":case"hr":case"h":return u*n;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(a);if("number"===l&&isFinite(a))return u.long?function(i){var s=Math.abs(i);if(s>=r)return o(i,s,r,"day");if(s>=n)return o(i,s,n,"hour");if(s>=t)return o(i,s,t,"minute");if(s>=e)return o(i,s,e,"second");return i+" ms"}(a):function(i){var s=Math.abs(i);if(s>=r)return Math.round(i/r)+"d";if(s>=n)return Math.round(i/n)+"h";if(s>=t)return Math.round(i/t)+"m";if(s>=e)return Math.round(i/e)+"s";return i+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}Te.exports=(ve||(ve=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}return!e&&"env"in ye&&(e=ye.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=(me||(me=1,Ae=function(e){function t(e){let r,i,s,o=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),s=i-(r||i);n.diff=s,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,i)=>{if("%%"===r)return"%";o++;const s=t.formatters[i];if("function"==typeof s){const t=e[o];r=s.call(n,t),e.splice(o,1),o--}return r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e,t){let n=0,r=0,i=-1,s=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(i=r,s=n,r++):(n++,r++);else{if(-1===i)return!1;r=i+1,s++,n=s}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(r(e,n))return!1;for(const n of t.names)if(r(e,n))return!0;return!1},t.humanize=Ce(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}),Ae)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Se,Se.exports)),Se.exports);var Ee=Te.exports;function we(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var be=Ee,Ie="JsSIP",Re=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t?(this._debug=be.default("".concat(Ie,":").concat(t)),this._warn=be.default("".concat(Ie,":WARN:").concat(t)),this._error=be.default("".concat(Ie,":ERROR:").concat(t))):(this._debug=be.default(Ie),this._warn=be.default("".concat(Ie,":WARN")),this._error=be.default("".concat(Ie,":ERROR"))),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}return we(e,[{key:"debug",get:function(){return this._debug}},{key:"warn",get:function(){return this._warn}},{key:"error",get:function(){return this._error}}]),e}(),Oe={},ke={},De={exports:{}},qe=De.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(qe).forEach(function(e){qe[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})});var Me=De.exports;!function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,r){var i=e.name&&e.names;e.push&&!n[e.push]?n[e.push]=[]:i&&!n[e.name]&&(n[e.name]={});var s=e.push?{}:i?n[e.name]:n;!function(e,n,r,i){if(i&&!r)n[i]=t(e[1]);else for(var s=0;s<r.length;s+=1)null!=e[s+1]&&(n[r[s]]=t(e[s+1]))}(r.match(e.reg),s,e.names,e.name),e.push&&n[e.push].push(s)},r=Me,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},s=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach(function(e){var t=e[0],i=e.slice(2);"m"===t&&(s.push({rtp:[],fmtp:[]}),o=s[s.length-1]);for(var a=0;a<(r[t]||[]).length;a+=1){var u=r[t][a];if(u.reg.test(i))return n(u,o,i)}}),t.media=s,t};var s=function(e,n){var r=n.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&n.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(s,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],r=e.split(" ").map(t),i=0;i<r.length;i+=3)n.push({component:r[i],ip:r[i+1],port:r[i+2]});return n},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(s,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var n,r=!1;return"~"!==e[0]?n=t(e):(n=t(e.substring(1,e.length)),r=!0),{scid:n,paused:r}})})}}(ke);var Ne=Me,Ue=/%[sdv%]/g,xe=function(e){var t=1,n=arguments,r=n.length;return e.replace(Ue,function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}})},Le=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var s=t.names[i];t.name?r.push(n[t.name][s]):r.push(n[t.names[i]])}else r.push(n[t.name]);return xe.apply(null,r)},Be=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Pe=["i","c","b","a"],Fe=ke,He=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var n=t.outerOrder||Be,r=t.innerOrder||Pe,i=[];return n.forEach(function(t){Ne[t].forEach(function(n){n.name in e&&null!=e[n.name]?i.push(Le(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){i.push(Le(t,n,e))})})}),e.media.forEach(function(e){i.push(Le("m",Ne.m[0],e)),r.forEach(function(t){Ne[t].forEach(function(n){n.name in e&&null!=e[n.name]?i.push(Le(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){i.push(Le(t,n,e))})})})}),i.join("\r\n")+"\r\n"},Ge=Me;function Ye(e){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(e)}function je(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qe(e,t)}function Qe(e,t){return Qe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Qe(e,t)}function We(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Ke(e);if(t){var i=Ke(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Ye(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Ke(e){return Ke=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ke(e)}function Je(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ze(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ze(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ze(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}Oe.grammar=Ge,Oe.write=He,Oe.parse=Fe.parse,Oe.parseParams=Fe.parseParams,Oe.parseFmtpConfig=Fe.parseFmtpConfig,Oe.parsePayloads=Fe.parsePayloads,Oe.parseRemoteCandidates=Fe.parseRemoteCandidates,Oe.parseImageAttributes=Fe.parseImageAttributes,Oe.parseSimulcastStreamList=Fe.parseSimulcastStreamList;var Xe=Oe,$e=Re,et=l,tt=x(),nt=M(),rt=N(),it=new $e("SIPMessage"),st=function(){function e(t,n,r,i,s,o){if(Ve(this,e),!t||!n||!r)return null;i=i||{},this.ua=r,this.headers={},this.method=t,this.ruri=n,this.body=o,this.extraHeaders=tt.cloneArray(s),this.ua.configuration.extra_headers&&(this.extraHeaders=this.extraHeaders.concat(this.ua.configuration.extra_headers)),i.route_set?this.setHeader("route",i.route_set):r.configuration.use_preloaded_route&&this.setHeader("route","<".concat(r.transport.sip_uri,";lr>")),this.setHeader("via",""),this.setHeader("max-forwards",et.MAX_FORWARDS);var a=i.to_uri||n,u=i.to_tag?{tag:i.to_tag}:null,l=void 0!==i.to_display_name?i.to_display_name:null;this.to=new nt(a,l,u),this.setHeader("to",this.to.toString());var c,h=i.from_uri||r.configuration.uri,d={tag:i.from_tag||tt.newTag()};c=void 0!==i.from_display_name?i.from_display_name:r.configuration.display_name?r.configuration.display_name:null,this.from=new nt(h,c,d),this.setHeader("from",this.from.toString());var f=i.call_id||r.configuration.jssip_id+tt.createRandomToken(15);this.call_id=f,this.setHeader("call-id",f);var p=i.cseq||Math.floor(1e4*Math.random());this.cseq=p,this.setHeader("cseq","".concat(p," ").concat(t))}return Ze(e,[{key:"setHeader",value:function(e,t){for(var n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),r=0;r<this.extraHeaders.length;r++)n.test(this.extraHeaders[r])&&this.extraHeaders.splice(r,1);this.headers[tt.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){var t=this.headers[tt.headerize(e)];if(t){if(t[0])return t[0]}else{var n,r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),i=Je(this.extraHeaders);try{for(i.s();!(n=i.n()).done;){var s=n.value;if(r.test(s))return s.substring(s.indexOf(":")+1).trim()}}catch(e){i.e(e)}finally{i.f()}}}},{key:"getHeaders",value:function(e){var t=this.headers[tt.headerize(e)],n=[];if(t){var r,i=Je(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;n.push(s)}}catch(e){i.e(e)}finally{i.f()}return n}var o,a=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),u=Je(this.extraHeaders);try{for(u.s();!(o=u.n()).done;){var l=o.value;a.test(l)&&n.push(l.substring(l.indexOf(":")+1).trim())}}catch(e){u.e(e)}finally{u.f()}return n}},{key:"hasHeader",value:function(e){if(this.headers[tt.headerize(e)])return!0;var t,n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),r=Je(this.extraHeaders);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(n.test(i))return!0}}catch(e){r.e(e)}finally{r.f()}return!1}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=Xe.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){var e="".concat(this.method," ").concat(this.ruri," SIP/2.0\r\n");for(var t in this.headers)if(Object.prototype.hasOwnProperty.call(this.headers,t)){var n,r=Je(this.headers[t]);try{for(r.s();!(n=r.n()).done;){var i=n.value;e+="".concat(t,": ").concat(i,"\r\n")}}catch(e){r.e(e)}finally{r.f()}}var s,o=Je(this.extraHeaders);try{for(o.s();!(s=o.n()).done;){var a=s.value;e+="".concat(a.trim(),"\r\n")}}catch(e){o.e(e)}finally{o.f()}var u=[];switch(this.method){case et.REGISTER:u.push("path","gruu");break;case et.INVITE:this.ua.configuration.session_timers&&u.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&u.push("gruu"),u.push("ice","replaces");break;case et.UPDATE:this.ua.configuration.session_timers&&u.push("timer"),u.push("ice")}u.push("outbound");var l=this.ua.configuration.user_agent||et.USER_AGENT;if(e+="Allow: ".concat(et.ALLOWED_METHODS,"\r\n"),e+="Supported: ".concat(u,"\r\n"),e+="User-Agent: ".concat(l,"\r\n"),this.body){var c=tt.str_utf8_length(this.body);e+="Content-Length: ".concat(c,"\r\n\r\n"),e+=this.body}else e+="Content-Length: 0\r\n\r\n";return e}},{key:"clone",value:function(){var t=new e(this.method,this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=tt.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t}}]),e}(),ot=function(){je(t,st);var e=We(t);function t(n,r,i,s,o){var a;return Ve(this,t),(a=e.call(this,et.INVITE,n,r,i,s,o)).transaction=null,a}return Ze(t,[{key:"cancel",value:function(e){this.transaction.cancel(e)}},{key:"clone",value:function(){var e=new t(this.ruri,this.ua);return Object.keys(this.headers).forEach(function(t){e.headers[t]=this.headers[t].slice()},this),e.body=this.body,e.extraHeaders=tt.cloneArray(this.extraHeaders),e.to=this.to,e.from=this.from,e.call_id=this.call_id,e.cseq=this.cseq,e.transaction=this.transaction,e}}]),t}(),at=function(){function e(){Ve(this,e),this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null,this.sdp=null}return Ze(e,[{key:"addHeader",value:function(e,t){var n={raw:t};e=tt.headerize(e),this.headers[e]?this.headers[e].push(n):this.headers[e]=[n]}},{key:"getHeader",value:function(e){var t=this.headers[tt.headerize(e)];if(t)return t[0]?t[0].raw:void 0}},{key:"getHeaders",value:function(e){var t=this.headers[tt.headerize(e)],n=[];if(!t)return[];var r,i=Je(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;n.push(s.raw)}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"hasHeader",value:function(e){return!!this.headers[tt.headerize(e)]}},{key:"parseHeader",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e=tt.headerize(e),this.headers[e]){if(!(t>=this.headers[e].length)){var n=this.headers[e][t],r=n.raw;if(n.parsed)return n.parsed;var i=rt.parse(r,e.replace(/-/g,"_"));return-1===i?(this.headers[e].splice(t,1),void it.debug('error parsing "'.concat(e,'" header field with value "').concat(r,'"'))):(n.parsed=i,i)}it.debug('not so many "'.concat(e,'" headers present'))}else it.debug('header "'.concat(e,'" not present'))}},{key:"s",value:function(e,t){return this.parseHeader(e,t)}},{key:"setHeader",value:function(e,t){var n={raw:t};this.headers[tt.headerize(e)]=[n]}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=Xe.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){return this.data}}]),e}(),ut=function(){je(t,at);var e=We(t);function t(n){var r;return Ve(this,t),(r=e.call(this)).ua=n,r.headers={},r.ruri=null,r.transport=null,r.server_transaction=null,r}return Ze(t,[{key:"reply",value:function(e,t,n,r,i,s){var o=[],a=this.getHeader("To");if(t=t||null,!(e=e||null)||e<100||e>699)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));t=t||et.REASON_PHRASE[e]||"",n=tt.cloneArray(n),this.ua.configuration.extra_headers&&(n=n.concat(this.ua.configuration.extra_headers));var u="SIP/2.0 ".concat(e," ").concat(t,"\r\n");if(this.method===et.INVITE&&e>100&&e<=200){var l,c=Je(this.getHeaders("record-route"));try{for(c.s();!(l=c.n()).done;){var h=l.value;u+="Record-Route: ".concat(h,"\r\n")}}catch(e){c.e(e)}finally{c.f()}}var d,f=Je(this.getHeaders("via"));try{for(f.s();!(d=f.n()).done;){var p=d.value;u+="Via: ".concat(p,"\r\n")}}catch(e){f.e(e)}finally{f.f()}!this.to_tag&&e>100?a+=";tag=".concat(tt.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(a+=";tag=".concat(this.to_tag)),u+="To: ".concat(a,"\r\n"),u+="From: ".concat(this.getHeader("From"),"\r\n"),u+="Call-ID: ".concat(this.call_id,"\r\n"),u+="CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");var g,_=Je(n);try{for(_.s();!(g=_.n()).done;){var A=g.value;u+="".concat(A.trim(),"\r\n")}}catch(e){_.e(e)}finally{_.f()}switch(this.method){case et.INVITE:this.ua.configuration.session_timers&&o.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&o.push("gruu"),o.push("ice","replaces");break;case et.UPDATE:this.ua.configuration.session_timers&&o.push("timer"),r&&o.push("ice"),o.push("replaces")}if(o.push("outbound"),this.method===et.OPTIONS?(u+="Allow: ".concat(et.ALLOWED_METHODS,"\r\n"),u+="Accept: ".concat(et.ACCEPTED_BODY_TYPES,"\r\n")):405===e?u+="Allow: ".concat(et.ALLOWED_METHODS,"\r\n"):415===e&&(u+="Accept: ".concat(et.ACCEPTED_BODY_TYPES,"\r\n")),u+="Supported: ".concat(o,"\r\n"),r){var m=tt.str_utf8_length(r);u+="Content-Type: application/sdp\r\n",u+="Content-Length: ".concat(m,"\r\n\r\n"),u+=r}else u+="Content-Length: ".concat(0,"\r\n\r\n");this.server_transaction.receiveResponse(e,u,i,s)}},{key:"reply_sl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.getHeaders("via");if(!e||e<100||e>699)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));t=t||et.REASON_PHRASE[e]||"";var r,i="SIP/2.0 ".concat(e," ").concat(t,"\r\n"),s=Je(n);try{for(s.s();!(r=s.n()).done;){var o=r.value;i+="Via: ".concat(o,"\r\n")}}catch(e){s.e(e)}finally{s.f()}var a=this.getHeader("To");if(!this.to_tag&&e>100?a+=";tag=".concat(tt.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(a+=";tag=".concat(this.to_tag)),i+="To: ".concat(a,"\r\n"),i+="From: ".concat(this.getHeader("From"),"\r\n"),i+="Call-ID: ".concat(this.call_id,"\r\n"),i+="CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n"),this.ua.configuration.extra_headers){var u,l=Je(this.ua.configuration.extra_headers);try{for(l.s();!(u=l.n()).done;){var c=u.value;i+="".concat(c.trim(),"\r\n")}}catch(e){l.e(e)}finally{l.f()}}i+="Content-Length: ".concat(0,"\r\n\r\n"),this.transport.send(i)}}]),t}(),lt={OutgoingRequest:st,InitialOutgoingInviteRequest:ot,IncomingRequest:ut,IncomingResponse:function(){je(t,at);var e=We(t);function t(){var n;return Ve(this,t),(n=e.call(this)).headers={},n.status_code=null,n.reason_phrase=null,n}return t}()};function ct(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var ht=Re,dt=x(),ft=new ht("DigestAuthentication"),pt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._credentials=t,this._cnonce=null,this._nc=0,this._ncHex="00000000",this._algorithm=null,this._realm=null,this._nonce=null,this._opaque=null,this._stale=null,this._qop=null,this._method=null,this._uri=null,this._ha1=null,this._response=null}return ct(e,[{key:"get",value:function(e){switch(e){case"realm":return this._realm;case"ha1":return this._ha1;default:return void ft.warn('get() | cannot get "%s" parameter',e)}}},{key:"authenticate",value:function(e,t){var n=e.method,r=e.ruri,i=e.body,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(this._algorithm=t.algorithm,this._realm=t.realm,this._nonce=t.nonce,this._opaque=t.opaque,this._stale=t.stale,this._algorithm){if("MD5"!==this._algorithm)return ft.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return ft.warn("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return ft.warn("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return ft.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return ft.warn('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]',this._credentials.realm,this._realm),!1}if(t.qop)if(t.qop.indexOf("auth-int")>-1)this._qop="auth-int";else{if(!(t.qop.indexOf("auth")>-1))return ft.warn('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this._qop="auth"}else this._qop=null;this._method=n,this._uri=r,this._cnonce=s||dt.createRandomToken(12),this._nc+=1;var o,a,u=Number(this._nc).toString(16);return this._ncHex="00000000".substr(0,8-u.length)+u,4294967296===this._nc&&(this._nc=1,this._ncHex="00000001"),this._credentials.password?this._ha1=dt.calculateMD5("".concat(this._credentials.username,":").concat(this._realm,":").concat(this._credentials.password)):this._ha1=this._credentials.ha1,"auth"===this._qop?(o="".concat(this._method,":").concat(this._uri),a=dt.calculateMD5(o),ft.debug('authenticate() | using qop=auth [a2:"%s"]',o),this._response=dt.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(a))):"auth-int"===this._qop?(o="".concat(this._method,":").concat(this._uri,":").concat(dt.calculateMD5(i||"")),a=dt.calculateMD5(o),ft.debug('authenticate() | using qop=auth-int [a2:"%s"]',o),this._response=dt.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(a))):null===this._qop&&(o="".concat(this._method,":").concat(this._uri),a=dt.calculateMD5(o),ft.debug('authenticate() | using qop=null [a2:"%s"]',o),this._response=dt.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(a))),ft.debug("authenticate() | response generated"),!0}},{key:"toString",value:function(){var e=[];if(!this._response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm=".concat(this._algorithm)),e.push('username="'.concat(this._credentials.username,'"')),e.push('realm="'.concat(this._realm,'"')),e.push('nonce="'.concat(this._nonce,'"')),e.push('uri="'.concat(this._uri,'"')),e.push('response="'.concat(this._response,'"')),this._opaque&&e.push('opaque="'.concat(this._opaque,'"')),this._qop&&(e.push("qop=".concat(this._qop)),e.push('cnonce="'.concat(this._cnonce,'"')),e.push("nc=".concat(this._ncHex))),"Digest ".concat(e.join(", "))}}]),e}(),gt=500,_t={T1:gt,T2:4e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4};function At(e){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},At(e)}function mt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vt(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function yt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Tt(e,t)}function Tt(e,t){return Tt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Tt(e,t)}function St(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Et(e);if(t){var i=Et(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===At(t)||"function"==typeof t))return t;return Ct(e)}(this,n)}}function Ct(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Et(e){return Et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Et(e)}var wt=j.EventEmitter,bt=Re,It=l,Rt=lt,Ot=_t,kt=new bt("NonInviteClientTransaction"),Dt=new bt("InviteClientTransaction"),qt=new bt("AckClientTransaction"),Mt=new bt("NonInviteServerTransaction"),Nt=new bt("InviteServerTransaction"),Ut={STATUS_TRYING:1,STATUS_PROCEEDING:2,STATUS_CALLING:3,STATUS_ACCEPTED:4,STATUS_COMPLETED:5,STATUS_TERMINATED:6,STATUS_CONFIRMED:7,NON_INVITE_CLIENT:"nict",NON_INVITE_SERVER:"nist",INVITE_CLIENT:"ict",INVITE_SERVER:"ist"},xt=function(){yt(t,wt);var e=St(t);function t(n,r,i,s){var o;mt(this,t),(o=e.call(this)).type=Ut.NON_INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=n,o.transport=r,o.request=i,o.eventHandlers=s;var a="SIP/2.0/".concat(r.via_transport);return a+=" ".concat(n.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",a),o.ua.newTransaction(Ct(o)),o}return vt(t,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(Ut.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},Ot.TIMER_F),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){kt.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onTransportError()}},{key:"timer_F",value:function(){kt.debug("Timer F expired for transaction ".concat(this.id)),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout()}},{key:"timer_K",value:function(){this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"receiveResponse",value:function(e){var t=this,n=e.status_code;if(n<200)switch(this.state){case Ut.STATUS_TRYING:case Ut.STATUS_PROCEEDING:this.stateChanged(Ut.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e)}else switch(this.state){case Ut.STATUS_TRYING:case Ut.STATUS_PROCEEDING:this.stateChanged(Ut.STATUS_COMPLETED),clearTimeout(this.F),408===n?this.eventHandlers.onRequestTimeout():this.eventHandlers.onReceiveResponse(e),this.K=setTimeout(function(){t.timer_K()},Ot.TIMER_K)}}},{key:"C",get:function(){return Ut}}]),t}(),Lt=function(){yt(t,wt);var e=St(t);function t(n,r,i,s){var o;mt(this,t),(o=e.call(this)).type=Ut.INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=n,o.transport=r,o.request=i,o.eventHandlers=s,i.transaction=Ct(o);var a="SIP/2.0/".concat(r.via_transport);return a+=" ".concat(n.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",a),o.ua.newTransaction(Ct(o)),o}return vt(t,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(Ut.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},Ot.TIMER_B),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==Ut.STATUS_ACCEPTED&&(Dt.debug("transport error occurred, deleting transaction ".concat(this.id)),this.eventHandlers.onTransportError()),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_M",value:function(){Dt.debug("Timer M expired for transaction ".concat(this.id)),this.state===Ut.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"timer_B",value:function(){Dt.debug("Timer B expired for transaction ".concat(this.id)),this.state===Ut.STATUS_CALLING&&(this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout())}},{key:"timer_D",value:function(){Dt.debug("Timer D expired for transaction ".concat(this.id)),clearTimeout(this.B),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"sendACK",value:function(e){var t=this,n=new Rt.OutgoingRequest(It.ACK,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});n.setHeader("from",this.request.getHeader("from")),n.setHeader("via",this.request.getHeader("via")),n.setHeader("to",e.getHeader("to")),this.D=setTimeout(function(){t.timer_D()},Ot.TIMER_D),this.transport.send(n)}},{key:"cancel",value:function(e){if(this.state===Ut.STATUS_PROCEEDING){var t=new Rt.OutgoingRequest(It.CANCEL,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});t.setHeader("from",this.request.getHeader("from")),t.setHeader("via",this.request.getHeader("via")),t.setHeader("to",this.request.getHeader("to")),e&&t.setHeader("reason",e),this.transport.send(t)}}},{key:"receiveResponse",value:function(e){var t=this,n=e.status_code;if(n>=100&&n<=199)switch(this.state){case Ut.STATUS_CALLING:this.stateChanged(Ut.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e);break;case Ut.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(e)}else if(n>=200&&n<=299)switch(this.state){case Ut.STATUS_CALLING:case Ut.STATUS_PROCEEDING:this.stateChanged(Ut.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},Ot.TIMER_M),this.eventHandlers.onReceiveResponse(e);break;case Ut.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(e)}else if(n>=300&&n<=699)switch(this.state){case Ut.STATUS_CALLING:case Ut.STATUS_PROCEEDING:this.stateChanged(Ut.STATUS_COMPLETED),this.sendACK(e),this.eventHandlers.onReceiveResponse(e);break;case Ut.STATUS_COMPLETED:this.sendACK(e)}}},{key:"C",get:function(){return Ut}}]),t}(),Bt=function(){yt(t,wt);var e=St(t);function t(n,r,i,s){var o;mt(this,t),(o=e.call(this)).id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.transport=r,o.request=i,o.eventHandlers=s;var a="SIP/2.0/".concat(r.via_transport);return a+=" ".concat(n.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",a),o}return vt(t,[{key:"send",value:function(){this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){qt.debug("transport error occurred for transaction ".concat(this.id)),this.eventHandlers.onTransportError()}},{key:"C",get:function(){return Ut}}]),t}(),Pt=function(){yt(t,wt);var e=St(t);function t(n,r,i){var s;return mt(this,t),(s=e.call(this)).type=Ut.NON_INVITE_SERVER,s.id=i.via_branch,s.ua=n,s.transport=r,s.request=i,s.last_response="",i.server_transaction=Ct(s),s.state=Ut.STATUS_TRYING,n.newTransaction(Ct(s)),s}return vt(t,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_J",value:function(){Mt.debug("Timer J expired for transaction ".concat(this.id)),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Mt.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(e,t,n,r){var i=this;if(100===e)switch(this.state){case Ut.STATUS_TRYING:this.stateChanged(Ut.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case Ut.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=200&&e<=699)switch(this.state){case Ut.STATUS_TRYING:case Ut.STATUS_PROCEEDING:this.stateChanged(Ut.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){i.timer_J()},Ot.TIMER_J),this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}}},{key:"C",get:function(){return Ut}}]),t}(),Ft=function(){yt(t,wt);var e=St(t);function t(n,r,i){var s;return mt(this,t),(s=e.call(this)).type=Ut.INVITE_SERVER,s.id=i.via_branch,s.ua=n,s.transport=r,s.request=i,s.last_response="",i.server_transaction=Ct(s),s.state=Ut.STATUS_PROCEEDING,n.newTransaction(Ct(s)),s.resendProvisionalTimer=null,i.reply(100),s}return vt(t,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_H",value:function(){Nt.debug("Timer H expired for transaction ".concat(this.id)),this.state===Ut.STATUS_COMPLETED&&Nt.debug("ACK not received, dialog will be terminated"),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_I",value:function(){this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_L",value:function(){Nt.debug("Timer L expired for transaction ".concat(this.id)),this.state===Ut.STATUS_ACCEPTED&&(this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Nt.debug("transport error occurred, deleting transaction ".concat(this.id)),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),clearTimeout(this.L),clearTimeout(this.H),clearTimeout(this.I),this.stateChanged(Ut.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"resend_provisional",value:function(){this.transport.send(this.last_response)||this.onTransportError()}},{key:"receiveResponse",value:function(e,t,n,r){var i=this;if(e>=100&&e<=199&&this.state===Ut.STATUS_PROCEEDING)this.transport.send(t)||this.onTransportError(),this.last_response=t;if(e>100&&e<=199&&this.state===Ut.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){i.resend_provisional()},Ot.PROVISIONAL_RESPONSE_INTERVAL));else if(e>=200&&e<=299)switch(this.state){case Ut.STATUS_PROCEEDING:this.stateChanged(Ut.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){i.timer_L()},Ot.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case Ut.STATUS_ACCEPTED:this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=300&&e<=699&&this.state===Ut.STATUS_PROCEEDING)null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(Ut.STATUS_COMPLETED),this.H=setTimeout(function(){i.timer_H()},Ot.TIMER_H),n&&n()):(this.onTransportError(),r&&r())}},{key:"C",get:function(){return Ut}}]),t}();var Ht={C:Ut,NonInviteClientTransaction:xt,InviteClientTransaction:Lt,AckClientTransaction:Bt,NonInviteServerTransaction:Pt,InviteServerTransaction:Ft,checkTransaction:function(e,t){var n,r=e._transactions;switch(t.method){case It.INVITE:if(n=r.ist[t.via_branch]){if(n.state===Ut.STATUS_PROCEEDING)n.transport.send(n.last_response);return!0}break;case It.ACK:if(!(n=r.ist[t.via_branch]))return!1;if(n.state===Ut.STATUS_ACCEPTED)return!1;if(n.state===Ut.STATUS_COMPLETED)return n.state=Ut.STATUS_CONFIRMED,n.I=setTimeout(function(){n.timer_I()},Ot.TIMER_I),!0;break;case It.CANCEL:return(n=r.ist[t.via_branch])?(t.reply_sl(200),n.state!==Ut.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(n=r.nist[t.via_branch]){switch(n.state){case Ut.STATUS_TRYING:break;case Ut.STATUS_PROCEEDING:case Ut.STATUS_COMPLETED:n.transport.send(n.last_response)}return!0}}}};function Gt(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var Yt=l,jt=pt,Qt=Ht,Wt=new Re("RequestSender"),Kt={onRequestTimeout:function(){},onTransportError:function(){},onReceiveResponse:function(){},onAuthenticated:function(){}},Jt=function(){function e(t,n,r){for(var i in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ua=t,this._eventHandlers=r,this._method=n.method,this._request=n,this._auth=null,this._challenged=!1,this._staled=!1,Kt)Object.prototype.hasOwnProperty.call(Kt,i)&&(this._eventHandlers[i]||(this._eventHandlers[i]=Kt[i]));t.status!==t.C.STATUS_USER_CLOSED||this._method===Yt.BYE&&this._method===Yt.ACK||this._eventHandlers.onTransportError()}return Gt(e,[{key:"send",value:function(){var e=this,t={onRequestTimeout:function(){e._eventHandlers.onRequestTimeout()},onTransportError:function(){e._eventHandlers.onTransportError()},onReceiveResponse:function(t){e._receiveResponse(t)}};switch(this._method){case"INVITE":this.clientTransaction=new Qt.InviteClientTransaction(this._ua,this._ua.transport,this._request,t);break;case"ACK":this.clientTransaction=new Qt.AckClientTransaction(this._ua,this._ua.transport,this._request,t);break;default:this.clientTransaction=new Qt.NonInviteClientTransaction(this._ua,this._ua.transport,this._request,t)}this._ua._configuration.authorization_jwt&&this._request.setHeader("Authorization",this._ua._configuration.authorization_jwt),this.clientTransaction.send()}},{key:"_receiveResponse",value:function(e){var t,n,r=e.status_code;if(401!==r&&407!==r||null===this._ua.configuration.password&&null===this._ua.configuration.ha1)this._eventHandlers.onReceiveResponse(e);else{if(401===e.status_code?(t=e.parseHeader("www-authenticate"),n="authorization"):(t=e.parseHeader("proxy-authenticate"),n="proxy-authorization"),!t)return Wt.debug("".concat(e.status_code," with wrong or missing challenge, cannot authenticate")),void this._eventHandlers.onReceiveResponse(e);if(!this._challenged||!this._staled&&!0===t.stale){if(this._auth||(this._auth=new jt({username:this._ua.configuration.authorization_user,password:this._ua.configuration.password,realm:this._ua.configuration.realm,ha1:this._ua.configuration.ha1})),!this._auth.authenticate(this._request,t))return void this._eventHandlers.onReceiveResponse(e);this._challenged=!0,this._ua.set("realm",this._auth.get("realm")),this._ua.set("ha1",this._auth.get("ha1")),t.stale&&(this._staled=!0),this._request=this._request.clone(),this._request.cseq+=1,this._request.setHeader("cseq","".concat(this._request.cseq," ").concat(this._method)),this._request.setHeader(n,this._auth.toString()),this._eventHandlers.onAuthenticated(this._request),this.send()}else this._eventHandlers.onReceiveResponse(e)}}}]),e}();function zt(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var Vt=Re,Zt=x(),Xt=l,$t=lt,en=Jt,tn=new Vt("Registrator"),nn=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._reg_id=1,this._ua=t,this._transport=n,this._registrar=t.configuration.registrar_server,this._expires=t.configuration.register_expires,this._call_id=Zt.createRandomToken(22),this._cseq=0,this._to_uri=t.configuration.uri,this._registrationTimer=null,this._registering=!1,this._registered=!1,this._contact=this._ua.contact.toString(),this._contact+=";+sip.ice",this._extraHeaders=[],this._extraContactParams="",this._sipInstance='"<urn:uuid:'.concat(this._ua.configuration.instance_id,'>"'),this._contact+=";reg-id=".concat(this._reg_id),this._contact+=";+sip.instance=".concat(this._sipInstance)}return zt(e,[{key:"setExtraHeaders",value:function(e){Array.isArray(e)||(e=[]),this._extraHeaders=e.slice()}},{key:"setExtraContactParams",value:function(e){for(var t in e instanceof Object||(e={}),this._extraContactParams="",e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];this._extraContactParams+=";".concat(t),n&&(this._extraContactParams+="=".concat(n))}}},{key:"register",value:function(){var e=this;if(this._registering)tn.debug("Register request in progress...");else{var t=this._extraHeaders.slice();t.push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams)),t.push("Expires: ".concat(this._expires));var n=new $t.OutgoingRequest(Xt.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},t),r=new en(this._ua,n,{onRequestTimeout:function(){e._registrationFailure(null,Xt.causes.REQUEST_TIMEOUT)},onTransportError:function(){e._registrationFailure(null,Xt.causes.CONNECTION_ERROR)},onAuthenticated:function(){e._cseq+=1},onReceiveResponse:function(t){if(t.cseq===e._cseq)switch(null!==e._registrationTimer&&(clearTimeout(e._registrationTimer),e._registrationTimer=null),!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):if(e._registering=!1,!t.hasHeader("Contact")){tn.debug("no Contact header in response to REGISTER, response ignored");break}var n=t.headers.Contact.reduce(function(e,t){return e.concat(t.parsed)},[]),r=n.find(function(t){return e._sipInstance===t.getParam("+sip.instance")&&e._reg_id===parseInt(t.getParam("reg-id"))});if(r||(r=n.find(function(t){return t.uri.user===e._ua.contact.uri.user})),!r){tn.debug("no Contact header pointing to us, response ignored");break}var i=r.getParam("expires");!i&&t.hasHeader("expires")&&(i=t.getHeader("expires")),i||(i=e._expires),(i=Number(i))<10&&(i=10);var s=i>64?1e3*i/2+Math.floor(1e3*(i/2-32)*Math.random()):1e3*i-5e3;e._registrationTimer=setTimeout(function(){e._registrationTimer=null,0===e._ua.listeners("registrationExpiring").length?e.register():e._ua.emit("registrationExpiring")},s),r.hasParam("temp-gruu")&&(e._ua.contact.temp_gruu=r.getParam("temp-gruu").replace(/"/g,"")),r.hasParam("pub-gruu")&&(e._ua.contact.pub_gruu=r.getParam("pub-gruu").replace(/"/g,"")),e._registered||(e._registered=!0,e._ua.registered({response:t}));break;case/^423$/.test(t.status_code):t.hasHeader("min-expires")?(e._expires=Number(t.getHeader("min-expires")),e._expires<10&&(e._expires=10),e.register()):(tn.debug("423 response received for REGISTER without Min-Expires"),e._registrationFailure(t,Xt.causes.SIP_FAILURE_CODE));break;default:var o=Zt.sipErrorCause(t.status_code);e._registrationFailure(t,o)}}});this._registering=!0,r.send()}}},{key:"unregister",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._registered){this._registered=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null);var n=this._extraHeaders.slice();t.all?n.push("Contact: *".concat(this._extraContactParams)):n.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams)),n.push("Expires: 0");var r=new $t.OutgoingRequest(Xt.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},n);new en(this._ua,r,{onRequestTimeout:function(){e._unregistered(null,Xt.causes.REQUEST_TIMEOUT)},onTransportError:function(){e._unregistered(null,Xt.causes.CONNECTION_ERROR)},onAuthenticated:function(){e._cseq+=1},onReceiveResponse:function(t){switch(!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):e._unregistered(t);break;default:var n=Zt.sipErrorCause(t.status_code);e._unregistered(t,n)}}}).send()}else tn.debug("already unregistered")}},{key:"close",value:function(){this._registered&&this.unregister()}},{key:"onTransportClosed",value:function(){this._registering=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),this._registered&&(this._registered=!1,this._ua.unregistered({}))}},{key:"_registrationFailure",value:function(e,t){this._registering=!1,this._ua.registrationFailed({response:e||null,cause:t}),this._registered&&(this._registered=!1,this._ua.unregistered({response:e||null,cause:t}))}},{key:"_unregistered",value:function(e,t){this._registering=!1,this._registered=!1,this._ua.unregistered({response:e||null,cause:t||null})}},{key:"registered",get:function(){return this._registered}}]),e}();function rn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var sn=l,on=Ht,an=Jt,un={onRequestTimeout:function(){},onTransportError:function(){},onSuccessResponse:function(){},onErrorResponse:function(){},onAuthenticated:function(){},onDialogError:function(){}};function ln(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function cn(e,t,n){return t&&ln(e.prototype,t),n&&ln(e,n),e}var hn=Re,dn=lt,fn=l,pn=Ht,gn=function(){function e(t,n,r){for(var i in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._dialog=t,this._ua=t._ua,this._request=n,this._eventHandlers=r,this._reattempt=!1,this._reattemptTimer=null,un)Object.prototype.hasOwnProperty.call(un,i)&&(this._eventHandlers[i]||(this._eventHandlers[i]=un[i]))}return rn(e,[{key:"send",value:function(){var e=this,t=new an(this._ua,this._request,{onRequestTimeout:function(){e._eventHandlers.onRequestTimeout()},onTransportError:function(){e._eventHandlers.onTransportError()},onAuthenticated:function(t){e._eventHandlers.onAuthenticated(t)},onReceiveResponse:function(t){e._receiveResponse(t)}});if(t.send(),(this._request.method===sn.INVITE||this._request.method===sn.UPDATE&&this._request.body)&&t.clientTransaction.state!==on.C.STATUS_TERMINATED){this._dialog.uac_pending_reply=!0;t.clientTransaction.on("stateChanged",function n(){t.clientTransaction.state!==on.C.STATUS_ACCEPTED&&t.clientTransaction.state!==on.C.STATUS_COMPLETED&&t.clientTransaction.state!==on.C.STATUS_TERMINATED||(t.clientTransaction.removeListener("stateChanged",n),e._dialog.uac_pending_reply=!1)})}}},{key:"_receiveResponse",value:function(e){var t=this;408===e.status_code||481===e.status_code?this._eventHandlers.onDialogError(e):e.method===sn.INVITE&&491===e.status_code?this._reattempt?e.status_code>=200&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):e.status_code>=300&&this._eventHandlers.onErrorResponse(e):(this._request.cseq=this._dialog.local_seqnum+=1,this._reattemptTimer=setTimeout(function(){t._dialog.isTerminated()||(t._reattempt=!0,t.send())},1e3)):e.status_code>=200&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):e.status_code>=300&&this._eventHandlers.onErrorResponse(e)}},{key:"request",get:function(){return this._request}}]),e}(),_n=x(),An=new hn("Dialog"),mn={STATUS_EARLY:1,STATUS_CONFIRMED:2,STATUS_TERMINATED:3},vn=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:mn.STATUS_CONFIRMED;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._owner=t,this._ua=t._ua,this._uac_pending_reply=!1,this._uas_pending_reply=!1,!n.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};n instanceof dn.IncomingResponse&&(i=n.status_code<200?mn.STATUS_EARLY:mn.STATUS_CONFIRMED);var s=n.parseHeader("contact");"UAS"===r?(this._id={call_id:n.call_id,local_tag:n.to_tag,remote_tag:n.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=i,this._remote_seqnum=n.cseq,this._local_uri=n.parseHeader("to").uri,this._remote_uri=n.parseHeader("from").uri,this._remote_target=s.uri,this._route_set=n.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===r&&(this._id={call_id:n.call_id,local_tag:n.from_tag,remote_tag:n.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=i,this._local_seqnum=n.cseq,this._local_uri=n.parseHeader("from").uri,this._remote_uri=n.parseHeader("to").uri,this._remote_target=s.uri,this._route_set=n.getHeaders("record-route").reverse(),this._ack_seqnum=null),this._ua.newDialog(this),An.debug("new ".concat(r," dialog created with status ").concat(this._state===mn.STATUS_EARLY?"EARLY":"CONFIRMED"))}return cn(e,null,[{key:"C",get:function(){return mn}}]),cn(e,[{key:"isTerminated",value:function(){return this._status===mn.STATUS_TERMINATED}},{key:"update",value:function(e,t){this._state=mn.STATUS_CONFIRMED,An.debug("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){An.debug("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this),this._state=mn.STATUS_TERMINATED}},{key:"sendRequest",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=_n.cloneArray(n.extraHeaders),i=_n.cloneObject(n.eventHandlers),s=n.body||null,o=this._createRequest(e,r,s);return i.onAuthenticated=function(){t._local_seqnum+=1},new gn(this,o,i).send(),o}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===fn.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===fn.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,n){t=_n.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var r=e===fn.CANCEL||e===fn.ACK?this._local_seqnum:this._local_seqnum+=1;return new dn.OutgoingRequest(e,this._remote_target,this._ua,{cseq:r,call_id:this._id.call_id,from_uri:this._local_uri,from_tag:this._id.local_tag,to_uri:this._remote_uri,to_tag:this._id.remote_tag,route_set:this._route_set},t,n)}},{key:"_checkInDialogRequest",value:function(e){var t=this;if(this._remote_seqnum)if(e.cseq<this._remote_seqnum){if(e.method!==fn.ACK)return e.reply(500),!1;if(null===this._ack_seqnum||e.cseq!==this._ack_seqnum)return!1}else e.cseq>this._remote_seqnum&&(this._remote_seqnum=e.cseq);else this._remote_seqnum=e.cseq;if(e.method===fn.INVITE||e.method===fn.UPDATE&&e.body){if(!0===this._uac_pending_reply)e.reply(491);else{if(!0===this._uas_pending_reply){var n=1+(10*Math.random()|0);return e.reply(500,null,["Retry-After:".concat(n)]),!1}this._uas_pending_reply=!0;e.server_transaction.on("stateChanged",function n(){e.server_transaction.state!==pn.C.STATUS_ACCEPTED&&e.server_transaction.state!==pn.C.STATUS_COMPLETED&&e.server_transaction.state!==pn.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),t._uas_pending_reply=!1)})}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===pn.C.STATUS_ACCEPTED&&(t._remote_target=e.parseHeader("contact").uri)})}else e.method===fn.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===pn.C.STATUS_COMPLETED&&(t._remote_target=e.parseHeader("contact").uri)});return!0}},{key:"id",get:function(){return this._id}},{key:"local_seqnum",get:function(){return this._local_seqnum},set:function(e){this._local_seqnum=e}},{key:"owner",get:function(){return this._owner}},{key:"uac_pending_reply",get:function(){return this._uac_pending_reply},set:function(e){this._uac_pending_reply=e}},{key:"uas_pending_reply",get:function(){return this._uas_pending_reply}}]),e}(),yn={exports:{}};function Tn(e){return Tn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tn(e)}function Sn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Cn(e,t){return Cn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Cn(e,t)}function En(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=wn(e);if(t){var i=wn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Tn(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function wn(e){return wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},wn(e)}var bn=j.EventEmitter,In=Re,Rn=l,On=D,kn=x(),Dn=new In("RTCSession:DTMF"),qn={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500};yn.exports=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Cn(e,t)}(t,bn);var e=En(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._session=n,r._direction=null,r._tone=null,r._duration=null,r._request=null,r}return Sn(t,[{key:"send",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw new TypeError("Not enough arguments");if(this._direction="outgoing",this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new On.InvalidStateError(this._session.status);var r=kn.cloneArray(n.extraHeaders);if(this.eventHandlers=kn.cloneObject(n.eventHandlers),"string"==typeof e)e=e.toUpperCase();else{if("number"!=typeof e)throw new TypeError("Invalid tone: ".concat(e));e=e.toString()}if(!e.match(/^[0-9A-DR#*]$/))throw new TypeError("Invalid tone: ".concat(e));this._tone=e,this._duration=n.duration,r.push("Content-Type: application/dtmf-relay");var i="Signal=".concat(this._tone,"\r\n");i+="Duration=".concat(this._duration),this._session.newDTMF({originator:"local",dtmf:this,request:this._request}),this._session.sendRequest(Rn.INFO,{extraHeaders:r,eventHandlers:{onSuccessResponse:function(e){t.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){t.eventHandlers.onFailed&&t.eventHandlers.onFailed(),t.emit("failed",{originator:"remote",response:e})},onRequestTimeout:function(){t._session.onRequestTimeout()},onTransportError:function(){t._session.onTransportError()},onDialogError:function(){t._session.onDialogError()}},body:i})}},{key:"init_incoming",value:function(e){var t=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,n=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;if(this._direction="incoming",this._request=e,e.reply(200),e.body){var r=e.body.split("\n");r.length>=1&&t.test(r[0])&&(this._tone=r[0].replace(t,"$2")),r.length>=2&&n.test(r[1])&&(this._duration=parseInt(r[1].replace(n,"$2"),10))}this._duration||(this._duration=qn.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):Dn.debug("invalid INFO DTMF received, discarded")}},{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}}]),t}(),yn.exports.C=qn;var Mn=yn.exports;function Nn(e){return Nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nn(e)}function Un(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function xn(e,t){return xn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},xn(e,t)}function Ln(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Bn(e);if(t){var i=Bn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Nn(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Bn(e){return Bn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Bn(e)}var Pn=j.EventEmitter,Fn=l,Hn=D,Gn=x(),Yn=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xn(e,t)}(t,Pn);var e=Ln(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._session=n,r._direction=null,r._contentType=null,r._body=null,r}return Un(t,[{key:"send",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this._direction="outgoing",void 0===e)throw new TypeError("Not enough arguments");if(this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new Hn.InvalidStateError(this._session.status);this._contentType=e,this._body=t;var i=Gn.cloneArray(r.extraHeaders);i.push("Content-Type: ".concat(e)),this._session.newInfo({originator:"local",info:this,request:this.request}),this._session.sendRequest(Fn.INFO,{extraHeaders:i,eventHandlers:{onSuccessResponse:function(e){n.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){n.emit("failed",{originator:"remote",response:e})},onTransportError:function(){n._session.onTransportError()},onRequestTimeout:function(){n._session.onRequestTimeout()},onDialogError:function(){n._session.onDialogError()}},body:t})}},{key:"init_incoming",value:function(e){this._direction="incoming",this.request=e,e.reply(200),this._contentType=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,this._body=e.body,this._session.newInfo({originator:"remote",info:this,request:e})}},{key:"contentType",get:function(){return this._contentType}},{key:"body",get:function(){return this._body}}]),t}();function jn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var Qn=l,Wn=new Re("RTCSession:ReferNotifier"),Kn="refer",Jn="message/sipfrag;version=2.0",zn=300,Vn=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._session=t,this._id=n,this._expires=r||zn,this._active=!0,this.notify(100)}return jn(e,[{key:"notify",value:function(e,t){var n;(Wn.debug("notify()"),!1!==this._active)&&(t=t||Qn.REASON_PHRASE[e]||"",n=e>=200?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(Qn.NOTIFY,{extraHeaders:["Event: ".concat(Kn,";id=").concat(this._id),"Subscription-State: ".concat(n),"Content-Type: ".concat(Jn)],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}]),e}();function Zn(e){return Zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zn(e)}function Xn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function $n(e,t){return $n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},$n(e,t)}function er(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=tr(e);if(t){var i=tr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Zn(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function tr(e){return tr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},tr(e)}var nr=j.EventEmitter,rr=Re,ir=l,sr=N(),or=x(),ar=new rr("RTCSession:ReferSubscriber"),ur=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$n(e,t)}(t,nr);var e=er(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._id=null,r._session=n,r}return Xn(t,[{key:"sendRefer",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ar.debug("sendRefer()");var r=or.cloneArray(n.extraHeaders),i=or.cloneObject(n.eventHandlers);for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);var o=null;n.replaces&&(o=n.replaces._request.call_id,o+=";to-tag=".concat(n.replaces._to_tag),o+=";from-tag=".concat(n.replaces._from_tag),o=encodeURIComponent(o));var a="Refer-To: <".concat(e).concat(o?"?Replaces=".concat(o):"",">");if(r.push(a),!r.some(function(e){return e.toLowerCase().startsWith("referred-by:")})){var u="Referred-By: <".concat(this._session._ua._configuration.uri._scheme,":").concat(this._session._ua._configuration.uri._user,"@").concat(this._session._ua._configuration.uri._host,">");r.push(u)}r.push("Contact: ".concat(this._session.contact));var l=this._session.sendRequest(ir.REFER,{extraHeaders:r,eventHandlers:{onSuccessResponse:function(e){t._requestSucceeded(e)},onErrorResponse:function(e){t._requestFailed(e,ir.causes.REJECTED)},onTransportError:function(){t._requestFailed(null,ir.causes.CONNECTION_ERROR)},onRequestTimeout:function(){t._requestFailed(null,ir.causes.REQUEST_TIMEOUT)},onDialogError:function(){t._requestFailed(null,ir.causes.DIALOG_ERROR)}}});this._id=l.cseq}},{key:"receiveNotify",value:function(e){if(ar.debug("receiveNotify()"),e.body){var t=sr.parse(e.body.trim().split("\r\n",1)[0],"Status_Line");if(-1!==t)switch(!0){case/^100$/.test(t.status_code):this.emit("trying",{request:e,status_line:t});break;case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",{request:e,status_line:t});break;case/^2[0-9]{2}$/.test(t.status_code):this.emit("accepted",{request:e,status_line:t});break;default:this.emit("failed",{request:e,status_line:t})}else ar.debug('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){ar.debug("REFER succeeded"),ar.debug('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){ar.debug("REFER failed"),ar.debug('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}},{key:"id",get:function(){return this._id}}]),t}();function lr(e){return lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lr(e)}function cr(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return hr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hr(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fr(e,t,n){return t&&dr(e.prototype,t),n&&dr(e,n),e}function pr(e,t){return pr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},pr(e,t)}function gr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=_r(e);if(t){var i=_r(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===lr(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function _r(e){return _r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_r(e)}var Ar=j.EventEmitter,mr=Oe,vr=Re,yr=l,Tr=D,Sr=Ht,Cr=x(),Er=_t,wr=lt,br=vn,Ir=Jt,Rr=Mn,Or=Yn,kr=Vn,Dr=ur,qr=U(),Mr=new vr("RTCSession"),Nr={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9},Ur=["audio","video"],xr=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pr(e,t)}(t,Ar);var e=gr(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Mr.debug("new"),(r=e.call(this))._id=null,r._ua=n,r._status=Nr.STATUS_NULL,r._dialog=null,r._earlyDialogs={},r._contact=null,r._from_tag=null,r._to_tag=null,r._connection=null,r._connectionPromiseQueue=Promise.resolve(),r._request=null,r._is_canceled=!1,r._cancel_reason="",r._is_confirmed=!1,r._late_sdp=!1,r._rtcOfferConstraints=null,r._rtcAnswerConstraints=null,r._localMediaStream=null,r._localMediaStreamLocallyGenerated=!1,r._rtcReady=!0,r._iceReady=!1,r._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},r._direction=null,r._local_identity=null,r._remote_identity=null,r._start_time=null,r._end_time=null,r._tones=null,r._audioMuted=!1,r._videoMuted=!1,r._localHold=!1,r._remoteHold=!1,r._sessionTimers={enabled:r._ua.configuration.session_timers,refreshMethod:r._ua.configuration.session_timers_refresh_method,defaultExpires:yr.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},r._referSubscribers={},r._data={},r}return fr(t,null,[{key:"C",get:function(){return Nr}}]),fr(t,[{key:"isInProgress",value:function(){switch(this._status){case Nr.STATUS_NULL:case Nr.STATUS_INVITE_SENT:case Nr.STATUS_1XX_RECEIVED:case Nr.STATUS_INVITE_RECEIVED:case Nr.STATUS_WAITING_FOR_ANSWER:return!0;default:return!1}}},{key:"isEstablished",value:function(){switch(this._status){case Nr.STATUS_ANSWERED:case Nr.STATUS_WAITING_FOR_ACK:case Nr.STATUS_CONFIRMED:return!0;default:return!1}}},{key:"isEnded",value:function(){switch(this._status){case Nr.STATUS_CANCELED:case Nr.STATUS_TERMINATED:return!0;default:return!1}}},{key:"isMuted",value:function(){return{audio:this._audioMuted,video:this._videoMuted}}},{key:"isOnHold",value:function(){return{local:this._localHold,remote:this._remoteHold}}},{key:"connect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;Mr.debug("connect()");var r=e,i=Cr.cloneObject(t.eventHandlers),s=Cr.cloneArray(t.extraHeaders),o=Cr.cloneObject(t.mediaConstraints,{audio:!0,video:!0}),a=t.mediaStream||null,u=Cr.cloneObject(t.pcConfig,{iceServers:[]}),l=t.rtcConstraints||null,c=t.rtcOfferConstraints||null;if(this._rtcOfferConstraints=c,this._rtcAnswerConstraints=t.rtcAnswerConstraints||null,this._data=t.data||this._data,void 0===e)throw new TypeError("Not enough arguments");if(this._status!==Nr.STATUS_NULL)throw new Tr.InvalidStateError(this._status);if(!window.RTCPeerConnection)throw new Tr.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(r));for(var h in this._sessionTimers.enabled&&Cr.isDecimal(t.sessionTimersExpires)&&(t.sessionTimersExpires>=yr.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=t.sessionTimersExpires:this._sessionTimers.defaultExpires=yr.SESSION_EXPIRES),i)Object.prototype.hasOwnProperty.call(i,h)&&this.on(h,i[h]);this._from_tag=Cr.newTag();var d=t.anonymous||!1,f={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:d,outbound:!0}),d?(f.from_display_name="Anonymous",f.from_uri=new qr("sip","anonymous","anonymous.invalid"),s.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),s.push("Privacy: id")):t.fromUserName&&(f.from_uri=new qr("sip",t.fromUserName,this._ua.configuration.uri.host),s.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),t.fromDisplayName&&(f.from_display_name=t.fromDisplayName),s.push("Contact: ".concat(this._contact)),s.push("Content-Type: application/sdp"),this._sessionTimers.enabled&&s.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires).concat(this._ua.configuration.session_timers_force_refresher?";refresher=uac":"")),this._request=new wr.InitialOutgoingInviteRequest(e,this._ua,f,s),this._id=this._request.call_id+this._from_tag,this._createRTCConnection(u,l),this._direction="outgoing",this._local_identity=this._request.from,this._remote_identity=this._request.to,n&&n(this),this._newRTCSession("local",this._request),this._sendInitialRequest(o,c,a)}},{key:"init_incoming",value:function(e,t){var n,r=this;Mr.debug("init_incoming()");var i=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0;e.body&&"application/sdp"!==i?e.reply(415):(this._status=Nr.STATUS_INVITE_RECEIVED,this._from_tag=e.from_tag,this._id=e.call_id+this._from_tag,this._request=e,this._contact=this._ua.contact.toString(),e.hasHeader("expires")&&(n=1e3*e.getHeader("expires")),e.to_tag=Cr.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=Nr.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),r._failed("local",null,yr.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),n&&(this._timers.expiresTimer=setTimeout(function(){r._status===Nr.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),r._failed("system",null,yr.causes.EXPIRES))},n)),this._direction="incoming",this._local_identity=e.to,this._remote_identity=e.from,t&&t(this),this._newRTCSession("remote",e),this._status!==Nr.STATUS_TERMINATED&&(e.reply(180,null,["Contact: ".concat(this._contact)]),this._progress("local",null))):e.reply(500,"Missing Contact header field"))}},{key:"answer",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Mr.debug("answer()");var n=this._request,r=Cr.cloneArray(t.extraHeaders),i=Cr.cloneObject(t.mediaConstraints),s=t.mediaStream||null,o=Cr.cloneObject(t.pcConfig,{iceServers:[]}),a=t.rtcConstraints||null,u=t.rtcAnswerConstraints||null,l=Cr.cloneObject(t.rtcOfferConstraints),c=!1,h=!1,d=!1,f=!1;if(this._rtcAnswerConstraints=u,this._rtcOfferConstraints=t.rtcOfferConstraints||null,this._data=t.data||this._data,"incoming"!==this._direction)throw new Tr.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==Nr.STATUS_WAITING_FOR_ANSWER)throw new Tr.InvalidStateError(this._status);if(this._sessionTimers.enabled&&Cr.isDecimal(t.sessionTimersExpires)&&(t.sessionTimersExpires>=yr.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=t.sessionTimersExpires:this._sessionTimers.defaultExpires=yr.SESSION_EXPIRES),this._status=Nr.STATUS_ANSWERED,this._createDialog(n,"UAS")){clearTimeout(this._timers.userNoAnswerTimer),r.unshift("Contact: ".concat(this._contact));var p=n.parseSDP();Array.isArray(p.media)||(p.media=[p.media]);var g,_=cr(p.media);try{for(_.s();!(g=_.n()).done;){var A=g.value;"audio"===A.type&&(c=!0,A.direction&&"sendrecv"!==A.direction||(d=!0)),"video"===A.type&&(h=!0,A.direction&&"sendrecv"!==A.direction||(f=!0))}}catch(e){_.e(e)}finally{_.f()}if(s&&!1===i.audio){var m,v=cr(s.getAudioTracks());try{for(v.s();!(m=v.n()).done;){var y=m.value;s.removeTrack(y)}}catch(e){v.e(e)}finally{v.f()}}if(s&&!1===i.video){var T,S=cr(s.getVideoTracks());try{for(S.s();!(T=S.n()).done;){var C=T.value;s.removeTrack(C)}}catch(e){S.e(e)}finally{S.f()}}s||void 0!==i.audio||(i.audio=d),s||void 0!==i.video||(i.video=f),s||c||l.offerToReceiveAudio||(i.audio=!1),s||h||l.offerToReceiveVideo||(i.video=!1),this._createRTCConnection(o,a),Promise.resolve().then(function(){return s||(i.audio||i.video?(e._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(i).catch(function(t){if(e._status===Nr.STATUS_TERMINATED)throw new Error("terminated");throw n.reply(480),e._failed("local",null,yr.causes.USER_DENIED_MEDIA_ACCESS),Mr.warn('emit "getusermediafailed" [error:%o]',t),e.emit("getusermediafailed",t),new Error("getUserMedia() failed")})):void 0)}).then(function(t){if(e._status===Nr.STATUS_TERMINATED)throw new Error("terminated");e._localMediaStream=t,t&&t.getTracks().forEach(function(n){e._connection.addTrack(n,t)})}).then(function(){if(!e._late_sdp){var t={originator:"remote",type:"offer",sdp:n.body};Mr.debug('emit "sdp"'),e.emit("sdp",t);var r=new RTCSessionDescription({type:"offer",sdp:t.sdp});return e._connectionPromiseQueue=e._connectionPromiseQueue.then(function(){return e._connection.setRemoteDescription(r)}).catch(function(t){throw n.reply(488),e._failed("system",null,yr.causes.WEBRTC_ERROR),Mr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',t),e.emit("peerconnection:setremotedescriptionfailed",t),new Error("peerconnection.setRemoteDescription() failed")}),e._connectionPromiseQueue}}).then(function(){if(e._status===Nr.STATUS_TERMINATED)throw new Error("terminated");return e._connecting(n),e._late_sdp?e._createLocalDescription("offer",e._rtcOfferConstraints).catch(function(){throw n.reply(500),new Error("_createLocalDescription() failed")}):e._createLocalDescription("answer",u).catch(function(){throw n.reply(500),new Error("_createLocalDescription() failed")})}).then(function(t){if(e._status===Nr.STATUS_TERMINATED)throw new Error("terminated");e._handleSessionTimersInIncomingRequest(n,r),n.reply(200,null,r,t,function(){e._status=Nr.STATUS_WAITING_FOR_ACK,e._setInvite2xxTimer(n,t),e._setACKTimer(),e._accepted("local")},function(){e._failed("system",null,yr.causes.CONNECTION_ERROR)})}).catch(function(t){e._status!==Nr.STATUS_TERMINATED&&Mr.warn(t)})}else n.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Mr.debug("terminate()");var n,r=t.cause||yr.causes.BYE,i=Cr.cloneArray(t.extraHeaders),s=t.body,o=t.status_code,a=t.reason_phrase;if(this._status===Nr.STATUS_TERMINATED)throw new Tr.InvalidStateError(this._status);switch(this._status){case Nr.STATUS_NULL:case Nr.STATUS_INVITE_SENT:case Nr.STATUS_1XX_RECEIVED:if(Mr.debug("canceling session"),o&&(o<200||o>=700))throw new TypeError("Invalid status_code: ".concat(o));o&&(a=a||yr.REASON_PHRASE[o]||"",n="SIP ;cause=".concat(o,' ;text="').concat(a,'"')),this._status===Nr.STATUS_NULL||this._status===Nr.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=n):this._status===Nr.STATUS_1XX_RECEIVED&&this._request.cancel(n),this._status=Nr.STATUS_CANCELED,this._failed("local",null,yr.causes.CANCELED);break;case Nr.STATUS_WAITING_FOR_ANSWER:case Nr.STATUS_ANSWERED:if(Mr.debug("rejecting session"),(o=o||480)<300||o>=700)throw new TypeError("Invalid status_code: ".concat(o));this._request.reply(o,a,i,s),this._failed("local",null,yr.causes.REJECTED);break;case Nr.STATUS_WAITING_FOR_ACK:case Nr.STATUS_CONFIRMED:if(Mr.debug("terminating session"),a=t.reason_phrase||yr.REASON_PHRASE[o]||"",o&&(o<200||o>=700))throw new TypeError("Invalid status_code: ".concat(o));if(o&&i.push("Reason: SIP ;cause=".concat(o,'; text="').concat(a,'"')),this._status===Nr.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==Sr.C.STATUS_TERMINATED){var u=this._dialog;this.receiveRequest=function(t){t.method===yr.ACK&&(e.sendRequest(yr.BYE,{extraHeaders:i,body:s}),u.terminate())},this._request.server_transaction.on("stateChanged",function(){e._request.server_transaction.state===Sr.C.STATUS_TERMINATED&&(e.sendRequest(yr.BYE,{extraHeaders:i,body:s}),u.terminate())}),this._ended("local",null,r),this._dialog=u,this._ua.newDialog(u)}else this.sendRequest(yr.BYE,{extraHeaders:i,body:s}),this._ended("local",null,r)}}},{key:"sendDTMF",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mr.debug("sendDTMF() | tones: %s",e);var n=0,r=t.duration||null,i=t.interToneGap||null,s=t.transportType||yr.DTMF_TRANSPORT.INFO;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==Nr.STATUS_CONFIRMED&&this._status!==Nr.STATUS_WAITING_FOR_ACK&&this._status!==Nr.STATUS_1XX_RECEIVED)throw new Tr.InvalidStateError(this._status);if(s!==yr.DTMF_TRANSPORT.INFO&&s!==yr.DTMF_TRANSPORT.RFC2833)throw new TypeError("invalid transportType: ".concat(s));if("number"==typeof e&&(e=e.toString()),!e||"string"!=typeof e||!e.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(e));if(r&&!Cr.isDecimal(r))throw new TypeError("Invalid tone duration: ".concat(r));if(r?r<Rr.C.MIN_DURATION?(Mr.debug('"duration" value is lower than the minimum allowed, setting it to '.concat(Rr.C.MIN_DURATION," milliseconds")),r=Rr.C.MIN_DURATION):r>Rr.C.MAX_DURATION?(Mr.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(Rr.C.MAX_DURATION," milliseconds")),r=Rr.C.MAX_DURATION):r=Math.abs(r):r=Rr.C.DEFAULT_DURATION,t.duration=r,i&&!Cr.isDecimal(i))throw new TypeError("Invalid interToneGap: ".concat(i));if(i?i<Rr.C.MIN_INTER_TONE_GAP?(Mr.debug('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(Rr.C.MIN_INTER_TONE_GAP," milliseconds")),i=Rr.C.MIN_INTER_TONE_GAP):i=Math.abs(i):i=Rr.C.DEFAULT_INTER_TONE_GAP,s!==yr.DTMF_TRANSPORT.RFC2833)this._tones?this._tones+=e:(this._tones=e,function e(){var s,o=this;if(this._status===Nr.STATUS_TERMINATED||!this._tones||n>=this._tones.length)return void(this._tones=null);var a=this._tones[n];if(n+=1,","===a)s=2e3;else{var u=new Rr(this);t.eventHandlers={onFailed:function(){o._tones=null}},u.send(a,t),s=r+i}setTimeout(e.bind(this),s)}.call(this));else{var o=this._getDTMFRTPSender();o&&(e=o.toneBuffer+e,o.insertDTMF(e,r,i))}}},{key:"sendInfo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Mr.debug("sendInfo()"),this._status!==Nr.STATUS_CONFIRMED&&this._status!==Nr.STATUS_WAITING_FOR_ACK&&this._status!==Nr.STATUS_1XX_RECEIVED)throw new Tr.InvalidStateError(this._status);new Or(this).send(e,t,n)}},{key:"mute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!1};Mr.debug("mute()");var t=!1,n=!1;!1===this._audioMuted&&e.audio&&(t=!0,this._audioMuted=!0,this._toggleMuteAudio(!0)),!1===this._videoMuted&&e.video&&(n=!0,this._videoMuted=!0,this._toggleMuteVideo(!0)),!0!==t&&!0!==n||this._onmute({audio:t,video:n})}},{key:"unmute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0};Mr.debug("unmute()");var t=!1,n=!1;!0===this._audioMuted&&e.audio&&(t=!0,this._audioMuted=!1,!1===this._localHold&&this._toggleMuteAudio(!1)),!0===this._videoMuted&&e.video&&(n=!0,this._videoMuted=!1,!1===this._localHold&&this._toggleMuteVideo(!1)),!0!==t&&!0!==n||this._onunmute({audio:t,video:n})}},{key:"hold",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(Mr.debug("hold()"),this._status!==Nr.STATUS_WAITING_FOR_ACK&&this._status!==Nr.STATUS_CONFIRMED)return!1;if(!0===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!0,this._onhold("local");var r={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:yr.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:t.extraHeaders}),!0}},{key:"unhold",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(Mr.debug("unhold()"),this._status!==Nr.STATUS_WAITING_FOR_ACK&&this._status!==Nr.STATUS_CONFIRMED)return!1;if(!1===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!1,this._onunhold("local");var r={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:yr.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:t.extraHeaders}),!0}},{key:"renegotiate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;Mr.debug("renegotiate()");var r=t.rtcOfferConstraints||null;if(this._status!==Nr.STATUS_WAITING_FOR_ACK&&this._status!==Nr.STATUS_CONFIRMED)return!1;if(!this._isReadyToReOffer())return!1;var i={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:yr.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}};return this._setLocalMediaStatus(),t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:i,rtcOfferConstraints:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:i,rtcOfferConstraints:r,extraHeaders:t.extraHeaders}),!0}},{key:"refer",value:function(e,t){var n=this;Mr.debug("refer()");var r=e;if(this._status!==Nr.STATUS_WAITING_FOR_ACK&&this._status!==Nr.STATUS_CONFIRMED)return!1;if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(r));var i=new Dr(this);i.sendRefer(e,t);var s=i.id;return this._referSubscribers[s]=i,i.on("requestFailed",function(){delete n._referSubscribers[s]}),i.on("accepted",function(){delete n._referSubscribers[s]}),i.on("failed",function(){delete n._referSubscribers[s]}),i}},{key:"sendRequest",value:function(e,t){return Mr.debug("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(Mr.debug("receiveRequest()"),e.method===yr.CANCEL)this._status!==Nr.STATUS_WAITING_FOR_ANSWER&&this._status!==Nr.STATUS_ANSWERED||(this._status=Nr.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,yr.causes.CANCELED));else switch(e.method){case yr.ACK:if(this._status!==Nr.STATUS_WAITING_FOR_ACK)return;if(this._status=Nr.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:yr.causes.MISSING_SDP,status_code:400});break}var n={originator:"remote",type:"answer",sdp:e.body};Mr.debug('emit "sdp"'),this.emit("sdp",n);var r=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(r)}).then(function(){t._is_confirmed||t._confirmed("remote",e)}).catch(function(e){t.terminate({cause:yr.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),Mr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else this._is_confirmed||this._confirmed("remote",e);break;case yr.BYE:this._status===Nr.STATUS_CONFIRMED||this._status===Nr.STATUS_WAITING_FOR_ACK?(e.reply(200),this._ended("remote",e,yr.causes.BYE)):this._status===Nr.STATUS_INVITE_RECEIVED||this._status===Nr.STATUS_WAITING_FOR_ANSWER?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,yr.causes.BYE)):e.reply(403,"Wrong Status");break;case yr.INVITE:this._status===Nr.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case yr.INFO:if(this._status===Nr.STATUS_1XX_RECEIVED||this._status===Nr.STATUS_WAITING_FOR_ANSWER||this._status===Nr.STATUS_ANSWERED||this._status===Nr.STATUS_WAITING_FOR_ACK||this._status===Nr.STATUS_CONFIRMED){var i=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0;i&&i.match(/^application\/dtmf-relay/i)?new Rr(this).init_incoming(e):void 0!==i?new Or(this).init_incoming(e):e.reply(415)}else e.reply(403,"Wrong Status");break;case yr.UPDATE:this._status===Nr.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case yr.REFER:this._status===Nr.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case yr.NOTIFY:this._status===Nr.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){Mr.warn("onTransportError()"),this._status!==Nr.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:yr.causes.CONNECTION_ERROR,cause:yr.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){Mr.warn("onRequestTimeout()"),this._status!==Nr.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:yr.causes.REQUEST_TIMEOUT,cause:yr.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){Mr.warn("onDialogError()"),this._status!==Nr.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:yr.causes.DIALOG_ERROR,cause:yr.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){Mr.debug("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){Mr.debug("newInfo()"),this.emit("newInfo",e)}},{key:"_isReadyToReOffer",value:function(){return this._rtcReady?this._dialog?!0!==this._dialog.uac_pending_reply&&!0!==this._dialog.uas_pending_reply||(Mr.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(Mr.debug("_isReadyToReOffer() | session not established yet"),!1):(Mr.debug("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){if(Mr.debug("close()"),this._localMediaStream&&this._localMediaStreamLocallyGenerated&&(Mr.debug("close() | closing local MediaStream"),Cr.closeMediaStream(this._localMediaStream)),this._status!==Nr.STATUS_TERMINATED){if(this._status=Nr.STATUS_TERMINATED,this._connection)try{this._connection.close()}catch(e){Mr.warn("close() | error closing the RTCPeerConnection: %o",e)}for(var e in this._timers)Object.prototype.hasOwnProperty.call(this._timers,e)&&clearTimeout(this._timers[e]);for(var t in clearTimeout(this._sessionTimers.timer),this._dialog&&(this._dialog.terminate(),delete this._dialog),this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,t)&&(this._earlyDialogs[t].terminate(),delete this._earlyDialogs[t]);for(var n in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,n)&&delete this._referSubscribers[n];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(e,t){var n=Er.T1;this._timers.invite2xxTimer=setTimeout(function r(){this._status===Nr.STATUS_WAITING_FOR_ACK&&(e.reply(200,null,["Contact: ".concat(this._contact)],t),n<Er.T2&&(n*=2)>Er.T2&&(n=Er.T2),this._timers.invite2xxTimer=setTimeout(r.bind(this),n))}.bind(this),n)}},{key:"_setACKTimer",value:function(){var e=this;this._timers.ackTimer=setTimeout(function(){e._status===Nr.STATUS_WAITING_FOR_ACK&&(Mr.debug("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(yr.BYE),e._ended("remote",null,yr.causes.NO_ACK))},Er.TIMER_H)}},{key:"_createRTCConnection",value:function(e,t){var n=this;this._connection=new RTCPeerConnection(e,t),this._connection.addEventListener("iceconnectionstatechange",function(){"failed"===n._connection.iceConnectionState&&n.terminate({cause:yr.causes.RTP_TIMEOUT,status_code:408,reason_phrase:yr.causes.RTP_TIMEOUT})}),Mr.debug('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(e,t){var n=this;if(Mr.debug("createLocalDescription()"),"offer"!==e&&"answer"!==e)throw new Error('createLocalDescription() | invalid type "'.concat(e,'"'));var r=this._connection;return this._rtcReady=!1,Promise.resolve().then(function(){return"offer"===e?r.createOffer(t).catch(function(e){return Mr.warn('emit "peerconnection:createofferfailed" [error:%o]',e),n.emit("peerconnection:createofferfailed",e),Promise.reject(e)}):r.createAnswer(t).catch(function(e){return Mr.warn('emit "peerconnection:createanswerfailed" [error:%o]',e),n.emit("peerconnection:createanswerfailed",e),Promise.reject(e)})}).then(function(e){return r.setLocalDescription(e).catch(function(e){return n._rtcReady=!0,Mr.warn('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',e),n.emit("peerconnection:setlocaldescriptionfailed",e),Promise.reject(e)})}).then(function(){var i=t&&t.iceRestart;if("complete"===r.iceGatheringState&&!i||"gathering"===r.iceGatheringState&&n._iceReady){n._rtcReady=!0;var s={originator:"local",type:e,sdp:r.localDescription.sdp};return Mr.debug('emit "sdp"'),n.emit("sdp",s),Promise.resolve(s.sdp)}return new Promise(function(t){var i,s,o=!1;n._iceReady=!1;var a=function(){if(!o){r.removeEventListener("icecandidate",i),r.removeEventListener("icegatheringstatechange",s),o=!0,n._rtcReady=!0,n._iceReady=!0;var a={originator:"local",type:e,sdp:r.localDescription.sdp};Mr.debug('emit "sdp"'),n.emit("sdp",a),t(a.sdp)}};r.addEventListener("icecandidate",i=function(e){var t=e.candidate;t?n.emit("icecandidate",{candidate:t,ready:a}):a()}),r.addEventListener("icegatheringstatechange",s=function(){"complete"===r.iceGatheringState&&a()})})})}},{key:"_createDialog",value:function(e,t,n){var r="UAS"===t?e.to_tag:e.from_tag,i="UAS"===t?e.from_tag:e.to_tag,s=e.call_id+r+i,o=this._earlyDialogs[s];if(n)return!!o||((o=new br(this,e,t,br.C.STATUS_EARLY)).error?(Mr.debug(o.error),this._failed("remote",e,yr.causes.INTERNAL_ERROR),!1):(this._earlyDialogs[s]=o,!0));if(this._from_tag=e.from_tag,this._to_tag=e.to_tag,o)return o.update(e,t),this._dialog=o,delete this._earlyDialogs[s],!0;var a=new br(this,e,t);return a.error?(Mr.debug(a.error),this._failed("remote",e,yr.causes.INTERNAL_ERROR),!1):(this._dialog=a,!0)}},{key:"_receiveReinvite",value:function(e){var t=this;Mr.debug("receiveReinvite()");var n=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,r={request:e,callback:void 0,reject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i=!0;var n=t.status_code||403,r=t.reason_phrase||"",s=Cr.cloneArray(t.extraHeaders);if(this._status!==Nr.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: ".concat(n));e.reply(n,r,s)}.bind(this)},i=!1;if(this.emit("reinvite",r),!i){if(this._late_sdp=!1,!e.body)return this._late_sdp=!0,this._remoteHold&&(this._remoteHold=!1,this._onunhold("remote")),void(this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._createLocalDescription("offer",t._rtcOfferConstraints)}).then(function(e){s.call(t,e)}).catch(function(){e.reply(500)}));if("application/sdp"!==n)return Mr.debug("invalid Content-Type"),void e.reply(415);this._processInDialogSdpOffer(e).then(function(e){t._status!==Nr.STATUS_TERMINATED&&s.call(t,e)}).catch(function(e){Mr.warn(e)})}function s(t){var n=this,i=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(e,i),this._late_sdp&&(t=this._mangleOffer(t)),e.reply(200,null,i,t,function(){n._status=Nr.STATUS_WAITING_FOR_ACK,n._setInvite2xxTimer(e,t),n._setACKTimer()}),"function"==typeof r.callback&&r.callback()}}},{key:"_receiveUpdate",value:function(e){var t=this;Mr.debug("receiveUpdate()");var n=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,r={request:e,callback:void 0,reject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i=!0;var n=t.status_code||403,r=t.reason_phrase||"",s=Cr.cloneArray(t.extraHeaders);if(this._status!==Nr.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: ".concat(n));e.reply(n,r,s)}.bind(this)},i=!1;if(this.emit("update",r),!i)if(e.body){if("application/sdp"!==n)return Mr.debug("invalid Content-Type"),void e.reply(415);this._processInDialogSdpOffer(e).then(function(e){t._status!==Nr.STATUS_TERMINATED&&s.call(t,e)}).catch(function(e){Mr.warn(e)})}else s.call(this,null);function s(t){var n=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(e,n),e.reply(200,null,n,t),"function"==typeof r.callback&&r.callback()}}},{key:"_processInDialogSdpOffer",value:function(e){var t=this;Mr.debug("_processInDialogSdpOffer()");var n,r=e.parseSDP(),i=!1,s=cr(r.media);try{for(s.s();!(n=s.n()).done;){var o=n.value;if(-1!==Ur.indexOf(o.type)){var a=o.direction||r.direction||"sendrecv";if("sendonly"!==a&&"inactive"!==a){i=!1;break}i=!0}}}catch(e){s.e(e)}finally{s.f()}var u={originator:"remote",type:"offer",sdp:e.body};Mr.debug('emit "sdp"'),this.emit("sdp",u);var l=new RTCSessionDescription({type:"offer",sdp:u.sdp});return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(t._status===Nr.STATUS_TERMINATED)throw new Error("terminated");return t._connection.setRemoteDescription(l).catch(function(n){throw e.reply(488),Mr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',n),t.emit("peerconnection:setremotedescriptionfailed",n),n})}).then(function(){if(t._status===Nr.STATUS_TERMINATED)throw new Error("terminated");!0===t._remoteHold&&!1===i?(t._remoteHold=!1,t._onunhold("remote")):!1===t._remoteHold&&!0===i&&(t._remoteHold=!0,t._onhold("remote"))}).then(function(){if(t._status===Nr.STATUS_TERMINATED)throw new Error("terminated");return t._createLocalDescription("answer",t._rtcAnswerConstraints).catch(function(t){throw e.reply(500),Mr.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]',t),t})}).catch(function(e){Mr.warn("_processInDialogSdpOffer() failed [error: %o]",e)}),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(e){var n=this;if(Mr.debug("receiveRefer()"),!e.refer_to)return Mr.debug("no Refer-To header field present in REFER"),void e.reply(400);if(e.refer_to.uri.scheme!==yr.SIP)return Mr.debug("Refer-To header field points to a non-SIP URI scheme"),void e.reply(416);e.reply(202);var r=new kr(this,e.cseq);function i(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n="function"==typeof n?n:null,this._status!==Nr.STATUS_WAITING_FOR_ACK&&this._status!==Nr.STATUS_CONFIRMED)return!1;var s=new t(this._ua);if(s.on("progress",function(e){var t=e.response;r.notify(t.status_code,t.reason_phrase)}),s.on("accepted",function(e){var t=e.response;r.notify(t.status_code,t.reason_phrase)}),s.on("_failed",function(e){var t=e.message,n=e.cause;t?r.notify(t.status_code,t.reason_phrase):r.notify(487,n)}),e.refer_to.uri.hasHeader("replaces")){var o=decodeURIComponent(e.refer_to.uri.getHeader("replaces"));i.extraHeaders=Cr.cloneArray(i.extraHeaders),i.extraHeaders.push("Replaces: ".concat(o))}s.connect(e.refer_to.uri.toAor(),i,n)}function s(){r.notify(603)}Mr.debug('emit "refer"'),this.emit("refer",{request:e,accept:function(e,t){i.call(n,e,t)},reject:function(){s.call(n)}})}},{key:"_receiveNotify",value:function(e){if(Mr.debug("receiveNotify()"),e.event||e.reply(400),"refer"===e.event.event){var t,n;if(e.event.params&&e.event.params.id)t=e.event.params.id,n=this._referSubscribers[t];else{if(1!==Object.keys(this._referSubscribers).length)return void e.reply(400,"Missing event id parameter");n=this._referSubscribers[Object.keys(this._referSubscribers)[0]]}if(!n)return void e.reply(481,"Subscription does not exist");n.receiveNotify(e),e.reply(200)}else e.reply(489)}},{key:"_receiveReplaces",value:function(e){var n=this;function r(n){var r=this;if(this._status!==Nr.STATUS_WAITING_FOR_ACK&&this._status!==Nr.STATUS_CONFIRMED)return!1;var i=new t(this._ua);i.on("confirmed",function(){r.terminate()}),i.init_incoming(e,n)}function i(){Mr.debug("Replaced INVITE rejected by the user"),e.reply(486)}Mr.debug("receiveReplaces()"),this.emit("replaces",{request:e,accept:function(e){r.call(n,e)},reject:function(){i.call(n)}})}},{key:"_sendInitialRequest",value:function(e,t,n){var r=this,i=new Ir(this._ua,this._request,{onRequestTimeout:function(){r.onRequestTimeout()},onTransportError:function(){r.onTransportError()},onAuthenticated:function(e){r._request=e},onReceiveResponse:function(e){r._receiveInviteResponse(e)}});Promise.resolve().then(function(){return n||(e.audio||e.video?(r._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(e).catch(function(e){if(r._status===Nr.STATUS_TERMINATED)throw new Error("terminated");throw r._failed("local",null,yr.causes.USER_DENIED_MEDIA_ACCESS),Mr.warn('emit "getusermediafailed" [error:%o]',e),r.emit("getusermediafailed",e),e})):void 0)}).then(function(e){if(r._status===Nr.STATUS_TERMINATED)throw new Error("terminated");return r._localMediaStream=e,e&&e.getTracks().forEach(function(t){r._connection.addTrack(t,e)}),r._connecting(r._request),r._createLocalDescription("offer",t).catch(function(e){throw r._failed("local",null,yr.causes.WEBRTC_ERROR),e})}).then(function(e){if(r._is_canceled||r._status===Nr.STATUS_TERMINATED)throw new Error("terminated");r._request.body=e,r._status=Nr.STATUS_INVITE_SENT,Mr.debug('emit "sending" [request:%o]',r._request),r.emit("sending",{request:r._request}),i.send()}).catch(function(e){r._status!==Nr.STATUS_TERMINATED&&Mr.warn(e)})}},{key:"_getDTMFRTPSender",value:function(){var e=this._connection.getSenders().find(function(e){return e.track&&"audio"===e.track.kind});if(e&&e.dtmf)return e.dtmf;Mr.warn("sendDTMF() | no local audio track to send DTMF with")}},{key:"_receiveInviteResponse",value:function(e){var t=this;if(Mr.debug("receiveInviteResponse()"),this._dialog&&e.status_code>=200&&e.status_code<=299){if(this._dialog.id.call_id===e.call_id&&this._dialog.id.local_tag===e.from_tag&&this._dialog.id.remote_tag===e.to_tag)return void this.sendRequest(yr.ACK);var n=new br(this,e,"UAC");return void 0!==n.error?void Mr.debug(n.error):(this.sendRequest(yr.ACK),void this.sendRequest(yr.BYE))}if(this._is_canceled)e.status_code>=100&&e.status_code<200?this._request.cancel(this._cancel_reason):e.status_code>=200&&e.status_code<299&&this._acceptAndTerminate(e);else if(this._status===Nr.STATUS_INVITE_SENT||this._status===Nr.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(e.status_code):this._status=Nr.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(e.status_code):if(!e.to_tag){Mr.debug("1xx response received without to tag");break}if(e.hasHeader("contact")&&!this._createDialog(e,"UAC",!0))break;if(this._status=Nr.STATUS_1XX_RECEIVED,!e.body){this._progress("remote",e);break}var r={originator:"remote",type:"answer",sdp:e.body};Mr.debug('emit "sdp"'),this.emit("sdp",r);var i=new RTCSessionDescription({type:"answer",sdp:r.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(i)}).then(function(){return t._progress("remote",e)}).catch(function(e){Mr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)});break;case/^2[0-9]{2}$/.test(e.status_code):if(this._status=Nr.STATUS_CONFIRMED,!e.body){this._acceptAndTerminate(e,400,yr.causes.MISSING_SDP),this._failed("remote",e,yr.causes.BAD_MEDIA_DESCRIPTION);break}if(!this._createDialog(e,"UAC"))break;var s={originator:"remote",type:"answer",sdp:e.body};Mr.debug('emit "sdp"'),this.emit("sdp",s);var o=new RTCSessionDescription({type:"answer",sdp:s.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if("stable"===t._connection.signalingState)return t._connection.createOffer(t._rtcOfferConstraints).then(function(e){return t._connection.setLocalDescription(e)}).catch(function(n){t._acceptAndTerminate(e,500,n.toString()),t._failed("local",e,yr.causes.WEBRTC_ERROR)})}).then(function(){t._connection.setRemoteDescription(o).then(function(){t._handleSessionTimersInIncomingResponse(e),t._accepted("remote",e),t.sendRequest(yr.ACK),t._confirmed("local",null)}).catch(function(n){t._acceptAndTerminate(e,488,"Not Acceptable Here"),t._failed("remote",e,yr.causes.BAD_MEDIA_DESCRIPTION),Mr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',n),t.emit("peerconnection:setremotedescriptionfailed",n)})});break;default:var a=Cr.sipErrorCause(e.status_code);this._failed("remote",e,a)}}},{key:"_sendReinvite",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Mr.debug("sendReinvite()");var n=Cr.cloneArray(t.extraHeaders),r=Cr.cloneObject(t.eventHandlers),i=t.rtcOfferConstraints||this._rtcOfferConstraints||null,s=!1;function o(e){var t=this;if(this._status!==Nr.STATUS_TERMINATED&&(this.sendRequest(yr.ACK),!s))if(this._handleSessionTimersInIncomingResponse(e),e.body)if(e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()){var n={originator:"remote",type:"answer",sdp:e.body};Mr.debug('emit "sdp"'),this.emit("sdp",n);var i=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(i)}).then(function(){r.succeeded&&r.succeeded(e)}).catch(function(e){a.call(t),Mr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else a.call(this);else a.call(this)}function a(e){r.failed&&r.failed(e)}n.push("Contact: ".concat(this._contact)),n.push("Content-Type: application/sdp"),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return e._createLocalDescription("offer",i)}).then(function(t){var r={originator:"local",type:"offer",sdp:t=e._mangleOffer(t)};Mr.debug('emit "sdp"'),e.emit("sdp",r),e.sendRequest(yr.INVITE,{extraHeaders:n,body:t,eventHandlers:{onSuccessResponse:function(t){o.call(e,t),s=!0},onErrorResponse:function(t){a.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}).catch(function(){a()})}},{key:"_sendUpdate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Mr.debug("sendUpdate()");var n=Cr.cloneArray(t.extraHeaders),r=Cr.cloneObject(t.eventHandlers),i=t.rtcOfferConstraints||this._rtcOfferConstraints||null,s=t.sdpOffer||!1,o=!1;function a(e){var t=this;if(this._status!==Nr.STATUS_TERMINATED&&!o)if(this._handleSessionTimersInIncomingResponse(e),s){if(!e.body)return void u.call(this);if(!e.hasHeader("Content-Type")||"application/sdp"!==e.getHeader("Content-Type").toLowerCase())return void u.call(this);var n={originator:"remote",type:"answer",sdp:e.body};Mr.debug('emit "sdp"'),this.emit("sdp",n);var i=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(i)}).then(function(){r.succeeded&&r.succeeded(e)}).catch(function(e){u.call(t),Mr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else r.succeeded&&r.succeeded(e)}function u(e){r.failed&&r.failed(e)}n.push("Contact: ".concat(this._contact)),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),s?(n.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return e._createLocalDescription("offer",i)}).then(function(t){var r={originator:"local",type:"offer",sdp:t=e._mangleOffer(t)};Mr.debug('emit "sdp"'),e.emit("sdp",r),e.sendRequest(yr.UPDATE,{extraHeaders:n,body:t,eventHandlers:{onSuccessResponse:function(t){a.call(e,t),o=!0},onErrorResponse:function(t){u.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}).catch(function(){u.call(e)})):this.sendRequest(yr.UPDATE,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(t){a.call(e,t)},onErrorResponse:function(t){u.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(e,t,n){Mr.debug("acceptAndTerminate()");var r=[];t&&(n=n||yr.REASON_PHRASE[t]||"",r.push("Reason: SIP ;cause=".concat(t,'; text="').concat(n,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(yr.ACK),this.sendRequest(yr.BYE,{extraHeaders:r})),this._status=Nr.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=mr.parse(e),this._localHold&&!this._remoteHold){Mr.debug("mangleOffer() | me on hold, mangling offer");var t,n=cr(e.media);try{for(n.s();!(t=n.n()).done;){var r=t.value;-1!==Ur.indexOf(r.type)&&(r.direction?"sendrecv"===r.direction?r.direction="sendonly":"recvonly"===r.direction&&(r.direction="inactive"):r.direction="sendonly")}}catch(e){n.e(e)}finally{n.f()}}else if(this._localHold&&this._remoteHold){Mr.debug("mangleOffer() | both on hold, mangling offer");var i,s=cr(e.media);try{for(s.s();!(i=s.n()).done;){var o=i.value;-1!==Ur.indexOf(o.type)&&(o.direction="inactive")}}catch(e){s.e(e)}finally{s.f()}}else if(this._remoteHold){Mr.debug("mangleOffer() | remote on hold, mangling offer");var a,u=cr(e.media);try{for(u.s();!(a=u.n()).done;){var l=a.value;-1!==Ur.indexOf(l.type)&&(l.direction?"sendrecv"===l.direction?l.direction="recvonly":"recvonly"===l.direction&&(l.direction="inactive"):l.direction="recvonly")}}catch(e){u.e(e)}finally{u.f()}}return mr.write(e)}},{key:"_setLocalMediaStatus",value:function(){var e=!0,t=!0;(this._localHold||this._remoteHold)&&(e=!1,t=!1),this._audioMuted&&(e=!1),this._videoMuted&&(t=!1),this._toggleMuteAudio(!e),this._toggleMuteVideo(!t)}},{key:"_handleSessionTimersInIncomingRequest",value:function(e,t){var n;this._sessionTimers.enabled&&(e.session_expires&&e.session_expires>=yr.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,n=e.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,n="uas"),t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(n)),this._sessionTimers.refresher="uas"===n,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(e){var t;this._sessionTimers.enabled&&(e.session_expires&&e.session_expires>=yr.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,t=e.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,t="uac"),this._sessionTimers.refresher="uac"===t,this._runSessionTimer())}},{key:"_runSessionTimer",value:function(){var e=this,t=this._sessionTimers.currentExpires;this._sessionTimers.running=!0,clearTimeout(this._sessionTimers.timer),this._sessionTimers.refresher?this._sessionTimers.timer=setTimeout(function(){e._status!==Nr.STATUS_TERMINATED&&e._isReadyToReOffer()&&(Mr.debug("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===yr.UPDATE?e._sendUpdate():e._sendReinvite())},500*t):this._sessionTimers.timer=setTimeout(function(){e._status!==Nr.STATUS_TERMINATED&&(Mr.warn("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:yr.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}},{key:"_toggleMuteAudio",value:function(e){var t,n=this._connection.getSenders().filter(function(e){return e.track&&"audio"===e.track.kind}),r=cr(n);try{for(r.s();!(t=r.n()).done;){t.value.track.enabled=!e}}catch(e){r.e(e)}finally{r.f()}}},{key:"_toggleMuteVideo",value:function(e){var t,n=this._connection.getSenders().filter(function(e){return e.track&&"video"===e.track.kind}),r=cr(n);try{for(r.s();!(t=r.n()).done;){t.value.track.enabled=!e}}catch(e){r.e(e)}finally{r.f()}}},{key:"_newRTCSession",value:function(e,t){Mr.debug("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){Mr.debug("session connecting"),Mr.debug('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){Mr.debug("session progress"),Mr.debug('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){Mr.debug("session accepted"),this._start_time=new Date,Mr.debug('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){Mr.debug("session confirmed"),this._is_confirmed=!0,Mr.debug('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,n){Mr.debug("session ended"),this._end_time=new Date,this._close(),Mr.debug('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:n})}},{key:"_failed",value:function(e,t,n){Mr.debug("session failed"),Mr.debug('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:n}),this._close(),Mr.debug('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:n})}},{key:"_onhold",value:function(e){Mr.debug("session onhold"),this._setLocalMediaStatus(),Mr.debug('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){Mr.debug("session onunhold"),this._setLocalMediaStatus(),Mr.debug('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,n=e.video;Mr.debug("session onmute"),this._setLocalMediaStatus(),Mr.debug('emit "muted"'),this.emit("muted",{audio:t,video:n})}},{key:"_onunmute",value:function(e){var t=e.audio,n=e.video;Mr.debug("session onunmute"),this._setLocalMediaStatus(),Mr.debug('emit "unmuted"'),this.emit("unmuted",{audio:t,video:n})}},{key:"C",get:function(){return Nr}},{key:"causes",get:function(){return yr.causes}},{key:"id",get:function(){return this._id}},{key:"connection",get:function(){return this._connection}},{key:"contact",get:function(){return this._contact}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"start_time",get:function(){return this._start_time}},{key:"end_time",get:function(){return this._end_time}},{key:"data",get:function(){return this._data},set:function(e){this._data=e}},{key:"status",get:function(){return this._status}}]),t}();function Lr(e){return Lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lr(e)}function Br(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Pr(e,t){return Pr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Pr(e,t)}function Fr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Hr(e);if(t){var i=Hr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Lr(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Hr(e){return Hr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Hr(e)}var Gr=j.EventEmitter,Yr=Re,jr=l,Qr=lt,Wr=x(),Kr=Jt,Jr=D,zr=U(),Vr=new Yr("Message"),Zr=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pr(e,t)}(t,Gr);var e=Fr(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._ua=n,r._request=null,r._closed=!1,r._direction=null,r._local_identity=null,r._remote_identity=null,r._is_replied=!1,r._data={},r}return Br(t,[{key:"send",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e;if(void 0===e||void 0===t)throw new TypeError("Not enough arguments");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(i));var s=Wr.cloneArray(r.extraHeaders),o=Wr.cloneObject(r.eventHandlers),a=r.contentType||"text/plain",u={};for(var l in r.fromUserName&&(u.from_uri=new zr("sip",r.fromUserName,this._ua.configuration.uri.host),s.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),r.fromDisplayName&&(u.from_display_name=r.fromDisplayName),o)Object.prototype.hasOwnProperty.call(o,l)&&this.on(l,o[l]);s.push("Content-Type: ".concat(a)),this._request=new Qr.OutgoingRequest(jr.MESSAGE,e,this._ua,u,s),t&&(this._request.body=t);var c=new Kr(this._ua,this._request,{onRequestTimeout:function(){n._onRequestTimeout()},onTransportError:function(){n._onTransportError()},onReceiveResponse:function(e){n._receiveResponse(e)}});this._newMessage("local",this._request),c.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newMessage("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Wr.cloneArray(e.extraHeaders),n=e.body;if("incoming"!==this._direction)throw new Jr.NotSupportedError('"accept" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");this._is_replied=!0,this._request.reply(200,null,t,n)}},{key:"reject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,n=e.reason_phrase,r=Wr.cloneArray(e.extraHeaders),i=e.body;if("incoming"!==this._direction)throw new Jr.NotSupportedError('"reject" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");if(t<300||t>=700)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,n,r,i)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=Wr.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,jr.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,jr.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newMessage",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newMessage(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,n){Vr.debug("MESSAGE failed"),this._close(),Vr.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:n})}},{key:"_succeeded",value:function(e,t){Vr.debug("MESSAGE succeeded"),this._close(),Vr.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}}]),t}();function Xr(e){return Xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xr(e)}function $r(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function ei(e,t){return ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ei(e,t)}function ti(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=ni(e);if(t){var i=ni(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Xr(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function ni(e){return ni=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ni(e)}var ri=j.EventEmitter,ii=Re,si=l,oi=lt,ai=x(),ui=Jt,li=D,ci=new ii("Options"),hi=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ei(e,t)}(t,ri);var e=ti(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._ua=n,r._request=null,r._closed=!1,r._direction=null,r._local_identity=null,r._remote_identity=null,r._is_replied=!1,r._data={},r}return $r(t,[{key:"send",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e;if(void 0===e)throw new TypeError("A target is required for OPTIONS");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(i));var s=ai.cloneArray(r.extraHeaders),o=ai.cloneObject(r.eventHandlers),a=r.contentType||"application/sdp";for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&this.on(u,o[u]);s.push("Content-Type: ".concat(a)),this._request=new oi.OutgoingRequest(si.OPTIONS,e,this._ua,null,s),t&&(this._request.body=t);var l=new ui(this._ua,this._request,{onRequestTimeout:function(){n._onRequestTimeout()},onTransportError:function(){n._onTransportError()},onReceiveResponse:function(e){n._receiveResponse(e)}});this._newOptions("local",this._request),l.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newOptions("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=ai.cloneArray(e.extraHeaders),n=e.body;if("incoming"!==this._direction)throw new li.NotSupportedError('"accept" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");this._is_replied=!0,this._request.reply(200,null,t,n)}},{key:"reject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,n=e.reason_phrase,r=ai.cloneArray(e.extraHeaders),i=e.body;if("incoming"!==this._direction)throw new li.NotSupportedError('"reject" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");if(t<300||t>=700)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,n,r,i)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=ai.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,si.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,si.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newOptions",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newOptions(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,n){ci.debug("OPTIONS failed"),this._close(),ci.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:n})}},{key:"_succeeded",value:function(e,t){ci.debug("OPTIONS succeeded"),this._close(),ci.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}}]),t}(),di={},fi=Re,pi=x(),gi=N(),_i=new fi("Socket");function Ai(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}di.isSocket=function(e){if(Array.isArray(e))return!1;if(void 0===e)return _i.warn("undefined JsSIP.Socket instance"),!1;try{if(!pi.isString(e.url))throw _i.warn("missing or invalid JsSIP.Socket url property"),new Error("Missing or invalid JsSIP.Socket url property");if(!pi.isString(e.via_transport))throw _i.warn("missing or invalid JsSIP.Socket via_transport property"),new Error("Missing or invalid JsSIP.Socket via_transport property");if(-1===gi.parse(e.sip_uri,"SIP_URI"))throw _i.warn("missing or invalid JsSIP.Socket sip_uri property"),new Error("missing or invalid JsSIP.Socket sip_uri property")}catch(e){return!1}try{["connect","disconnect","send"].forEach(function(t){if(!pi.isFunction(e[t]))throw _i.warn("missing or invalid JsSIP.Socket method: ".concat(t)),new Error("Missing or invalid JsSIP.Socket method: ".concat(t))})}catch(e){return!1}return!0};var mi=di,vi=l,yi=new Re("Transport"),Ti={STATUS_CONNECTED:0,STATUS_CONNECTING:1,STATUS_DISCONNECTED:2,SOCKET_STATUS_READY:0,SOCKET_STATUS_ERROR:1,recovery_options:{min_interval:vi.CONNECTION_RECOVERY_MIN_INTERVAL,max_interval:vi.CONNECTION_RECOVERY_MAX_INTERVAL}},Si=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ti.recovery_options;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yi.debug("new()"),this.status=Ti.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=n,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1;try{this.textDecoder=new TextDecoder("utf8")}catch(e){yi.warn("cannot use TextDecoder: ".concat(e))}if(void 0===t)throw new TypeError("Invalid argument. undefined 'sockets' argument");t instanceof Array||(t=[t]),t.forEach(function(e){if(!mi.isSocket(e.socket))throw new TypeError("Invalid argument. invalid 'JsSIP.Socket' instance");if(e.weight&&!Number(e.weight))throw new TypeError("Invalid argument. 'weight' attribute is not a number");this.sockets.push({socket:e.socket,weight:e.weight||0,status:Ti.SOCKET_STATUS_READY})},this),this._getSocket()}return Ai(e,[{key:"connect",value:function(){yi.debug("connect()"),this.isConnected()?yi.debug("Transport is already connected"):this.isConnecting()?yi.debug("Transport is connecting"):(this.close_requested=!1,this.status=Ti.STATUS_CONNECTING,this.onconnecting({socket:this.socket,attempts:this.recover_attempts}),this.close_requested||(this.socket.onconnect=this._onConnect.bind(this),this.socket.ondisconnect=this._onDisconnect.bind(this),this.socket.ondata=this._onData.bind(this),this.socket.connect()))}},{key:"disconnect",value:function(){yi.debug("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=Ti.STATUS_DISCONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.socket.onconnect=function(){},this.socket.ondisconnect=function(){},this.socket.ondata=function(){},this.socket.disconnect(),this.ondisconnect({socket:this.socket,error:!1})}},{key:"send",value:function(e){if(yi.debug("send()"),!this.isConnected())return yi.warn("unable to send message, transport is not connected"),!1;var t=e.toString();return yi.debug("sending message:\n\n".concat(t,"\n")),this.socket.send(t)}},{key:"isConnected",value:function(){return this.status===Ti.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===Ti.STATUS_CONNECTING}},{key:"_reconnect",value:function(){var e=this;this.recover_attempts+=1;var t=Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1);t<this.recovery_options.min_interval?t=this.recovery_options.min_interval:t>this.recovery_options.max_interval&&(t=this.recovery_options.max_interval),yi.debug("reconnection attempt: ".concat(this.recover_attempts,". next connection attempt in ").concat(t," seconds")),this.recovery_timer=setTimeout(function(){e.close_requested||e.isConnected()||e.isConnecting()||(e._getSocket(),e.connect())},1e3*t)}},{key:"_getSocket",value:function(){var e=[];if(this.sockets.forEach(function(t){t.status!==Ti.SOCKET_STATUS_ERROR&&(0===e.length?e.push(t):t.weight>e[0].weight?e=[t]:t.weight===e[0].weight&&e.push(t))}),0===e.length)return this.sockets.forEach(function(e){e.status=Ti.SOCKET_STATUS_READY}),void this._getSocket();var t=Math.floor(Math.random()*e.length);this.socket=e[t].socket}},{key:"_onConnect",value:function(){this.recover_attempts=0,this.status=Ti.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(e,t,n){this.status=Ti.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:n}),this.close_requested||(this.sockets.forEach(function(e){this.socket===e.socket&&(e.status=Ti.SOCKET_STATUS_ERROR)},this),this._reconnect(e))}},{key:"_onData",value:function(e){if("\r\n\r\n"!==e)if("\r\n"!==e){if("string"!=typeof e){try{e=this.textDecoder?this.textDecoder.decode(e):String.fromCharCode.apply(null,new Uint8Array(e))}catch(e){return void yi.debug("received binary message failed to be converted into string, message discarded")}yi.debug("received binary message:\n\n".concat(e,"\n"))}else yi.debug("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else yi.debug("received message with CRLF Keep Alive response");else{yi.debug("received message with double-CRLF Keep Alive request");try{this.socket.send("\r\n")}catch(e){yi.warn("error sending Keep Alive response: ".concat(e))}}}},{key:"via_transport",get:function(){return this.socket.via_transport}},{key:"url",get:function(){return this.socket.url}},{key:"sip_uri",get:function(){return this.socket.sip_uri}}]),e}(),Ci={};function Ei(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return wi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wi(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var bi=Re,Ii=N(),Ri=lt,Oi=new bi("Parser");function ki(e,t){var n=t,r=0,i=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===r;){if(-1===(i=e.indexOf("\r\n",n)))return i;!e.substring(i+2,i+4).match(/(^\r\n)/)&&e.charAt(i+2).match(/(^\s+)/)?n=i+2:r=i}return r}function Di(e,t,n,r){var i,s=t.indexOf(":",n),o=t.substring(n,s).trim(),a=t.substring(s+1,r).trim();switch(o.toLowerCase()){case"via":case"v":e.addHeader("via",a),1===e.getHeaders("via").length?(i=e.parseHeader("Via"))&&(e.via=i,e.via_branch=i.branch):i=0;break;case"from":case"f":e.setHeader("from",a),(i=e.parseHeader("from"))&&(e.from=i,e.from_tag=i.getParam("tag"));break;case"to":case"t":e.setHeader("to",a),(i=e.parseHeader("to"))&&(e.to=i,e.to_tag=i.getParam("tag"));break;case"record-route":if(-1===(i=Ii.parse(a,"Record_Route")))i=void 0;else{var u,l=Ei(i);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.addHeader("record-route",a.substring(c.possition,c.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=c.parsed}}catch(e){l.e(e)}finally{l.f()}}break;case"call-id":case"i":e.setHeader("call-id",a),(i=e.parseHeader("call-id"))&&(e.call_id=a);break;case"contact":case"m":if(-1===(i=Ii.parse(a,"Contact")))i=void 0;else{var h,d=Ei(i);try{for(d.s();!(h=d.n()).done;){var f=h.value;e.addHeader("contact",a.substring(f.possition,f.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=f.parsed}}catch(e){d.e(e)}finally{d.f()}}break;case"content-length":case"l":e.setHeader("content-length",a),i=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",a),i=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",a),(i=e.parseHeader("cseq"))&&(e.cseq=i.value),e instanceof Ri.IncomingResponse&&(e.method=i.method);break;case"max-forwards":e.setHeader("max-forwards",a),i=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",a),i=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",a),i=e.parseHeader("proxy-authenticate");break;case"session-expires":case"x":e.setHeader("session-expires",a),(i=e.parseHeader("session-expires"))&&(e.session_expires=i.expires,e.session_expires_refresher=i.refresher);break;case"refer-to":case"r":e.setHeader("refer-to",a),(i=e.parseHeader("refer-to"))&&(e.refer_to=i);break;case"replaces":e.setHeader("replaces",a),(i=e.parseHeader("replaces"))&&(e.replaces=i);break;case"event":case"o":e.setHeader("event",a),(i=e.parseHeader("event"))&&(e.event=i);break;default:e.addHeader(o,a),i=0}return void 0!==i||{error:'error parsing header "'.concat(o,'"')}}function qi(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Mi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mi(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function Mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Ci.parseMessage=function(e,t){var n,r,i=e.indexOf("\r\n");if(-1!==i){var s=e.substring(0,i),o=Ii.parse(s,"Request_Response");if(-1!==o){o.status_code?((n=new Ri.IncomingResponse).status_code=o.status_code,n.reason_phrase=o.reason_phrase):((n=new Ri.IncomingRequest(t)).method=o.method,n.ruri=o.uri),n.data=e;for(var a=i+2;;){if(-2===(i=ki(e,a))){r=a+2;break}if(-1===i)return void Oi.warn("parseMessage() | malformed message");if(!0!==(o=Di(n,e,a,i)))return void Oi.warn("parseMessage() |",o.error);a=i+2}if(n.hasHeader("content-length")){var u=n.getHeader("content-length");n.body=e.substr(r,u)}else n.body=e.substring(r);return n}Oi.warn('parseMessage() | error parsing first line of SIP message: "'.concat(s,'"'))}else Oi.warn("parseMessage() | no CRLF found, not a SIP message")};var Ni,Ui,xi,Li=Re,Bi=l,Pi=lt,Fi=x(),Hi=new Li("sanityCheck"),Gi=[function(){for(var e=0,t=["from","to","call_id","cseq","via"];e<t.length;e++){var n=t[e];if(!Ni.hasHeader(n))return Hi.debug("missing mandatory header field : ".concat(n,", dropping the response")),!1}}],Yi=[function(){if("sip"!==Ni.s("to").uri.scheme)return Qi(416),!1},function(){if(!Ni.to_tag&&Ni.call_id.substr(0,5)===Ui.configuration.jssip_id)return Qi(482),!1},function(){var e=Fi.str_utf8_length(Ni.body),t=Ni.getHeader("content-length");if(e<t)return Qi(400),!1},function(){var e,t=Ni.from_tag,n=Ni.call_id,r=Ni.cseq;if(Ni.to_tag)return;if(Ni.method===Bi.INVITE){if(Ui._transactions.ist[Ni.via_branch])return!1;for(var i in Ui._transactions.ist)if(Object.prototype.hasOwnProperty.call(Ui._transactions.ist,i)&&(e=Ui._transactions.ist[i]).request.from_tag===t&&e.request.call_id===n&&e.request.cseq===r)return Qi(482),!1}else{if(Ui._transactions.nist[Ni.via_branch])return!1;for(var s in Ui._transactions.nist)if(Object.prototype.hasOwnProperty.call(Ui._transactions.nist,s)&&(e=Ui._transactions.nist[s]).request.from_tag===t&&e.request.call_id===n&&e.request.cseq===r)return Qi(482),!1}}],ji=[function(){if(Ni.getHeaders("via").length>1)return Hi.debug("more than one Via header field present in the response, dropping the response"),!1},function(){var e=Fi.str_utf8_length(Ni.body),t=Ni.getHeader("content-length");if(e<t)return Hi.debug("message body length is lower than the value in Content-Length header field, dropping the response"),!1}];function Qi(e){var t,n,r=Ni.getHeaders("via"),i="SIP/2.0 ".concat(e," ").concat(Bi.REASON_PHRASE[e],"\r\n"),s=qi(r);try{for(s.s();!(n=s.n()).done;){var o=n.value;i+="Via: ".concat(o,"\r\n")}}catch(e){s.e(e)}finally{s.f()}t=Ni.getHeader("To"),Ni.to_tag||(t+=";tag=".concat(Fi.newTag())),i+="To: ".concat(t,"\r\n"),i+="From: ".concat(Ni.getHeader("From"),"\r\n"),i+="Call-ID: ".concat(Ni.call_id,"\r\n"),i+="CSeq: ".concat(Ni.cseq," ").concat(Ni.method,"\r\n"),i+="\r\n",xi.send(i)}var Wi={};function Ki(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ji(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ji(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function Ji(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var zi=x(),Vi=l,Zi=N(),Xi=U(),$i=di,es=D;Wi.settings={authorization_user:null,password:null,realm:null,ha1:null,authorization_jwt:null,display_name:null,uri:null,contact_uri:null,instance_id:null,use_preloaded_route:!1,session_timers:!0,session_timers_refresh_method:Vi.UPDATE,session_timers_force_refresher:!1,no_answer_timeout:60,register:!0,register_expires:600,registrar_server:null,sockets:null,connection_recovery_max_interval:Vi.CONNECTION_RECOVERY_MAX_INTERVAL,connection_recovery_min_interval:Vi.CONNECTION_RECOVERY_MIN_INTERVAL,extra_headers:null,via_host:"".concat(zi.createRandomToken(12),".invalid")};var ts={mandatory:{sockets:function(e){var t=[];if($i.isSocket(e))t.push({socket:e});else{if(!Array.isArray(e)||!e.length)return;var n,r=Ki(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;Object.prototype.hasOwnProperty.call(i,"socket")&&$i.isSocket(i.socket)?t.push(i):$i.isSocket(i)&&t.push({socket:i})}}catch(e){r.e(e)}finally{r.f()}}return t},uri:function(e){/^sip:/i.test(e)||(e="".concat(Vi.SIP,":").concat(e));var t=Xi.parse(e);return t&&t.user?t:void 0}},optional:{authorization_user:function(e){return-1===Zi.parse('"'.concat(e,'"'),"quoted_string")?void 0:e},authorization_jwt:function(e){if("string"==typeof e)return e},user_agent:function(e){if("string"==typeof e)return e},connection_recovery_max_interval:function(e){if(zi.isDecimal(e)){var t=Number(e);if(t>0)return t}},connection_recovery_min_interval:function(e){if(zi.isDecimal(e)){var t=Number(e);if(t>0)return t}},contact_uri:function(e){if("string"==typeof e){var t=Zi.parse(e,"SIP_URI");if(-1!==t)return t}},display_name:function(e){return e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===Zi.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(zi.isDecimal(e)){var t=Number(e);if(t>0)return t}},session_timers:function(e){if("boolean"==typeof e)return e},session_timers_refresh_method:function(e){if("string"==typeof e&&((e=e.toUpperCase())===Vi.INVITE||e===Vi.UPDATE))return e},session_timers_force_refresher:function(e){if("boolean"==typeof e)return e},password:function(e){return String(e)},realm:function(e){return String(e)},ha1:function(e){return String(e)},register:function(e){if("boolean"==typeof e)return e},register_expires:function(e){if(zi.isDecimal(e)){var t=Number(e);if(t>0)return t}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(Vi.SIP,":").concat(e));var t=Xi.parse(e);return t?t.user?void 0:t:void 0},use_preloaded_route:function(e){if("boolean"==typeof e)return e},extra_headers:function(e){var t=[];if(Array.isArray(e)&&e.length){var n,r=Ki(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;"string"==typeof i&&t.push(i)}}catch(e){r.e(e)}finally{r.f()}return t}}}};function ns(e){return ns="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ns(e)}function rs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function is(e,t,n){return t&&rs(e.prototype,t),n&&rs(e,n),e}function ss(e,t){return ss=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ss(e,t)}function os(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=us(e);if(t){var i=us(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===ns(t)||"function"==typeof t))return t;return as(e)}(this,n)}}function as(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function us(e){return us=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},us(e)}Wi.load=function(e,t){for(var n in ts.mandatory){if(!t.hasOwnProperty(n))throw new es.ConfigurationError(n);var r=t[n],i=ts.mandatory[n](r);if(void 0===i)throw new es.ConfigurationError(n,r);e[n]=i}for(var s in ts.optional)if(t.hasOwnProperty(s)){var o=t[s];if(zi.isEmpty(o))continue;var a=ts.optional[s](o);if(void 0===a)throw new es.ConfigurationError(s,o);e[s]=a}};var ls=j.EventEmitter,cs=Re,hs=l,ds=nn,fs=xr,ps=Zr,gs=hi,_s=Ht,As=Si,ms=x(),vs=D,ys=U(),Ts=Ci,Ss=lt,Cs=function(e,t,n){Ni=e,Ui=t,xi=n;var r,i=qi(Gi);try{for(i.s();!(r=i.n()).done;){if(!1===(0,r.value)())return!1}}catch(e){i.e(e)}finally{i.f()}if(Ni instanceof Pi.IncomingRequest){var s,o=qi(Yi);try{for(o.s();!(s=o.n()).done;){if(!1===(0,s.value)())return!1}}catch(e){o.e(e)}finally{o.f()}}else if(Ni instanceof Pi.IncomingResponse){var a,u=qi(ji);try{for(u.s();!(a=u.n()).done;){if(!1===(0,a.value)())return!1}}catch(e){u.e(e)}finally{u.f()}}return!0},Es=Wi,ws=new cs("UA"),bs={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2},Is=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ss(e,t)}(t,ls);var e=os(t);function t(n){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ws.debug("new() [configuration:%o]",n),(r=e.call(this))._cache={credentials:{}},r._configuration=Object.assign({},Es.settings),r._dynConfiguration={},r._dialogs={},r._applicants={},r._sessions={},r._transport=null,r._contact=null,r._status=bs.STATUS_INIT,r._error=null,r._transactions={nist:{},nict:{},ist:{},ict:{}},r._data={},r._closeTimer=null,void 0===n)throw new TypeError("Not enough arguments");try{r._loadConfig(n)}catch(e){throw r._status=bs.STATUS_NOT_READY,r._error=bs.CONFIGURATION_ERROR,e}return r._registrator=new ds(as(r)),r}return is(t,null,[{key:"C",get:function(){return bs}}]),is(t,[{key:"start",value:function(){ws.debug("start()"),this._status===bs.STATUS_INIT?this._transport.connect():this._status===bs.STATUS_USER_CLOSED?(ws.debug("restarting UA"),null!==this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null,this._transport.disconnect()),this._status=bs.STATUS_INIT,this._transport.connect()):this._status===bs.STATUS_READY?ws.debug("UA is in READY status, not restarted"):ws.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"),this._dynConfiguration.register=this._configuration.register}},{key:"register",value:function(){ws.debug("register()"),this._dynConfiguration.register=!0,this._registrator.register()}},{key:"unregister",value:function(e){ws.debug("unregister()"),this._dynConfiguration.register=!1,this._registrator.unregister(e)}},{key:"registrator",value:function(){return this._registrator}},{key:"isRegistered",value:function(){return this._registrator.registered}},{key:"isConnected",value:function(){return this._transport.isConnected()}},{key:"call",value:function(e,t){ws.debug("call()");var n=new fs(this);return n.connect(e,t),n}},{key:"sendMessage",value:function(e,t,n){ws.debug("sendMessage()");var r=new ps(this);return r.send(e,t,n),r}},{key:"sendOptions",value:function(e,t,n){ws.debug("sendOptions()");var r=new gs(this);return r.send(e,t,n),r}},{key:"terminateSessions",value:function(e){for(var t in ws.debug("terminateSessions()"),this._sessions)this._sessions[t].isEnded()||this._sessions[t].terminate(e)}},{key:"stop",value:function(){var e=this;if(ws.debug("stop()"),this._dynConfiguration={},this._status!==bs.STATUS_USER_CLOSED){this._registrator.close();var t=Object.keys(this._sessions).length;for(var n in this._sessions)if(Object.prototype.hasOwnProperty.call(this._sessions,n)){ws.debug("closing session ".concat(n));try{this._sessions[n].terminate()}catch(e){}}for(var r in this._applicants)if(Object.prototype.hasOwnProperty.call(this._applicants,r))try{this._applicants[r].close()}catch(e){}this._status=bs.STATUS_USER_CLOSED,0===Object.keys(this._transactions.nict).length+Object.keys(this._transactions.nist).length+Object.keys(this._transactions.ict).length+Object.keys(this._transactions.ist).length&&0===t?this._transport.disconnect():this._closeTimer=setTimeout(function(){e._closeTimer=null,e._transport.disconnect()},2e3)}else ws.debug("UA already closed")}},{key:"normalizeTarget",value:function(e){return ms.normalizeTarget(e,this._configuration.hostport_params)}},{key:"get",value:function(e){switch(e){case"authorization_user":return this._configuration.authorization_user;case"realm":return this._configuration.realm;case"ha1":return this._configuration.ha1;case"authorization_jwt":return this._configuration.authorization_jwt;default:return void ws.warn('get() | cannot get "%s" parameter in runtime',e)}}},{key:"set",value:function(e,t){switch(e){case"authorization_user":this._configuration.authorization_user=String(t);break;case"password":this._configuration.password=String(t);break;case"realm":this._configuration.realm=String(t);break;case"ha1":this._configuration.ha1=String(t),this._configuration.password=null;break;case"authorization_jwt":this._configuration.authorization_jwt=String(t);break;case"display_name":this._configuration.display_name=t;break;case"extra_headers":this._configuration.extra_headers=t;break;default:return ws.warn('set() | cannot set "%s" parameter in runtime',e),!1}return!0}},{key:"newTransaction",value:function(e){this._transactions[e.type][e.id]=e,this.emit("newTransaction",{transaction:e})}},{key:"destroyTransaction",value:function(e){delete this._transactions[e.type][e.id],this.emit("transactionDestroyed",{transaction:e})}},{key:"newDialog",value:function(e){this._dialogs[e.id]=e}},{key:"destroyDialog",value:function(e){delete this._dialogs[e.id]}},{key:"newMessage",value:function(e,t){this._applicants[e]=e,this.emit("newMessage",t)}},{key:"newOptions",value:function(e,t){this._applicants[e]=e,this.emit("newOptions",t)}},{key:"destroyMessage",value:function(e){delete this._applicants[e]}},{key:"newRTCSession",value:function(e,t){this._sessions[e.id]=e,this.emit("newRTCSession",t)}},{key:"destroyRTCSession",value:function(e){delete this._sessions[e.id]}},{key:"registered",value:function(e){this.emit("registered",e)}},{key:"unregistered",value:function(e){this.emit("unregistered",e)}},{key:"registrationFailed",value:function(e){this.emit("registrationFailed",e)}},{key:"receiveRequest",value:function(e){var t=e.method;if(e.ruri.user!==this._configuration.uri.user&&e.ruri.user!==this._contact.uri.user)return ws.debug("Request-URI does not point to us"),void(e.method!==hs.ACK&&e.reply_sl(404));if(e.ruri.scheme!==hs.SIPS){if(!_s.checkTransaction(this,e)){if(t===hs.INVITE?new _s.InviteServerTransaction(this,this._transport,e):t!==hs.ACK&&t!==hs.CANCEL&&new _s.NonInviteServerTransaction(this,this._transport,e),t===hs.OPTIONS){if(0===this.listeners("newOptions").length)return void e.reply(200);new gs(this).init_incoming(e)}else if(t===hs.MESSAGE){if(0===this.listeners("newMessage").length)return void e.reply(405);new ps(this).init_incoming(e)}else if(t===hs.INVITE&&!e.to_tag&&0===this.listeners("newRTCSession").length)return void e.reply(405);var n,r;if(e.to_tag)(n=this._findDialog(e.call_id,e.from_tag,e.to_tag))?n.receiveRequest(e):t===hs.NOTIFY?(r=this._findSession(e))?r.receiveRequest(e):(ws.debug("received NOTIFY request for a non existent subscription"),e.reply(481,"Subscription does not exist")):t!==hs.ACK&&e.reply(481);else switch(t){case hs.INVITE:if(window.RTCPeerConnection)if(e.hasHeader("replaces")){var i=e.replaces;(n=this._findDialog(i.call_id,i.from_tag,i.to_tag))?(r=n.owner).isEnded()?e.reply(603):r.receiveRequest(e):e.reply(481)}else(r=new fs(this)).init_incoming(e);else ws.warn("INVITE received but WebRTC is not supported"),e.reply(488);break;case hs.BYE:e.reply(481);break;case hs.CANCEL:(r=this._findSession(e))?r.receiveRequest(e):ws.debug("received CANCEL request for a non existent session");break;case hs.ACK:break;case hs.NOTIFY:this.emit("sipEvent",{event:e.event,request:e}),e.reply(200);break;default:e.reply(405)}}}else e.reply_sl(416)}},{key:"_findSession",value:function(e){var t=e.call_id,n=e.from_tag,r=e.to_tag,i=t+n,s=this._sessions[i],o=t+r,a=this._sessions[o];return s||(a||null)}},{key:"_findDialog",value:function(e,t,n){var r=e+t+n,i=this._dialogs[r];return i||(r=e+n+t,(i=this._dialogs[r])||null)}},{key:"_loadConfig",value:function(e){try{Es.load(this._configuration,e)}catch(e){throw e}0===this._configuration.display_name&&(this._configuration.display_name="0"),this._configuration.instance_id||(this._configuration.instance_id=ms.newUUID()),this._configuration.jssip_id=ms.createRandomToken(5);var t=this._configuration.uri.clone();t.user=null,this._configuration.hostport_params=t.toString().replace(/^sip:/i,"");try{this._transport=new As(this._configuration.sockets,{max_interval:this._configuration.connection_recovery_max_interval,min_interval:this._configuration.connection_recovery_min_interval}),this._transport.onconnecting=Rs.bind(this),this._transport.onconnect=Os.bind(this),this._transport.ondisconnect=ks.bind(this),this._transport.ondata=Ds.bind(this)}catch(e){throw ws.warn(e),new vs.ConfigurationError("sockets",this._configuration.sockets)}if(delete this._configuration.sockets,this._configuration.authorization_user||(this._configuration.authorization_user=this._configuration.uri.user),!this._configuration.registrar_server){var n=this._configuration.uri.clone();n.user=null,n.clearParams(),n.clearHeaders(),this._configuration.registrar_server=n}this._configuration.no_answer_timeout*=1e3,this._configuration.contact_uri?this._configuration.via_host=this._configuration.contact_uri.host:this._configuration.contact_uri=new ys("sip",ms.createRandomToken(8),this._configuration.via_host,null,{transport:"ws"}),this._contact={pub_gruu:null,temp_gruu:null,uri:this._configuration.contact_uri,toString:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.anonymous||null,n=e.outbound||null,r="<";return r+=t?this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":this.pub_gruu||this.uri.toString(),!n||(t?this.temp_gruu:this.pub_gruu)||(r+=";ob"),r+=">"}};var r=["authorization_user","password","realm","ha1","authorization_jwt","display_name","register","extra_headers"];for(var i in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,i)&&(-1!==r.indexOf(i)?Object.defineProperty(this._configuration,i,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,i,{writable:!1,configurable:!1}));for(var s in ws.debug("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call(Es.settings,s))switch(s){case"uri":case"registrar_server":ws.debug("- ".concat(s,": ").concat(this._configuration[s]));break;case"password":case"ha1":case"authorization_jwt":ws.debug("- ".concat(s,": NOT SHOWN"));break;default:ws.debug("- ".concat(s,": ").concat(JSON.stringify(this._configuration[s])))}}},{key:"C",get:function(){return bs}},{key:"status",get:function(){return this._status}},{key:"contact",get:function(){return this._contact}},{key:"configuration",get:function(){return this._configuration}},{key:"transport",get:function(){return this._transport}}]),t}();function Rs(e){this.emit("connecting",e)}function Os(e){this._status!==bs.STATUS_USER_CLOSED&&(this._status=bs.STATUS_READY,this._error=null,this.emit("connected",e),this._dynConfiguration.register&&this._registrator.register())}function ks(e){for(var t=0,n=["nict","ict","nist","ist"];t<n.length;t++){var r=n[t];for(var i in this._transactions[r])Object.prototype.hasOwnProperty.call(this._transactions[r],i)&&this._transactions[r][i].onTransportError()}this.emit("disconnected",e),this._registrator.onTransportClosed(),this._status!==bs.STATUS_USER_CLOSED&&(this._status=bs.STATUS_NOT_READY,this._error=bs.NETWORK_ERROR)}function Ds(e){var t=e.transport,n=e.message;if((n=Ts.parseMessage(n,this))&&!(this._status===bs.STATUS_USER_CLOSED&&n instanceof Ss.IncomingRequest)&&Cs(n,this,t))if(n instanceof Ss.IncomingRequest)n.transport=t,this.receiveRequest(n);else if(n instanceof Ss.IncomingResponse){var r;switch(n.method){case hs.INVITE:(r=this._transactions.ict[n.via_branch])&&r.receiveResponse(n);break;case hs.ACK:break;default:(r=this._transactions.nict[n.via_branch])&&r.receiveResponse(n)}}}function qs(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var Ms=Re,Ns=N(),Us=new Ms("WebSocketInterface"),xs=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Us.debug('new() [url:"%s"]',t),this._url=t,this._sip_uri=null,this._via_transport=null,this._ws=null;var n=Ns.parse(t,"absoluteURI");if(-1===n)throw Us.warn("invalid WebSocket URI: ".concat(t)),new TypeError("Invalid argument: ".concat(t));if("wss"!==n.scheme&&"ws"!==n.scheme)throw Us.warn("invalid WebSocket URI scheme: ".concat(n.scheme)),new TypeError("Invalid argument: ".concat(t));this._sip_uri="sip:".concat(n.host).concat(n.port?":".concat(n.port):"",";transport=ws"),this._via_transport=n.scheme.toUpperCase()}return qs(e,[{key:"connect",value:function(){if(Us.debug("connect()"),this.isConnected())Us.debug("WebSocket ".concat(this._url," is already connected"));else if(this.isConnecting())Us.debug("WebSocket ".concat(this._url," is connecting"));else{this._ws&&this.disconnect(),Us.debug("connecting to WebSocket ".concat(this._url));try{this._ws=new WebSocket(this._url,"sip"),this._ws.binaryType="arraybuffer",this._ws.onopen=this._onOpen.bind(this),this._ws.onclose=this._onClose.bind(this),this._ws.onmessage=this._onMessage.bind(this),this._ws.onerror=this._onError.bind(this)}catch(e){this._onError(e)}}}},{key:"disconnect",value:function(){Us.debug("disconnect()"),this._ws&&(this._ws.onopen=function(){},this._ws.onclose=function(){},this._ws.onmessage=function(){},this._ws.onerror=function(){},this._ws.close(),this._ws=null)}},{key:"send",value:function(e){return Us.debug("send()"),this.isConnected()?(this._ws.send(e),!0):(Us.warn("unable to send message, WebSocket is not open"),!1)}},{key:"isConnected",value:function(){return this._ws&&this._ws.readyState===this._ws.OPEN}},{key:"isConnecting",value:function(){return this._ws&&this._ws.readyState===this._ws.CONNECTING}},{key:"_onOpen",value:function(){Us.debug("WebSocket ".concat(this._url," connected")),this.onconnect()}},{key:"_onClose",value:function(e){var t=e.wasClean,n=e.code,r=e.reason;Us.debug("WebSocket ".concat(this._url," closed")),!1===t&&Us.debug("WebSocket abrupt disconnection"),this.ondisconnect(!t,n,r)}},{key:"_onMessage",value:function(e){var t=e.data;Us.debug("received WebSocket message"),this.ondata(t)}},{key:"_onError",value:function(e){Us.warn("WebSocket ".concat(this._url," error: "),e)}},{key:"via_transport",get:function(){return this._via_transport},set:function(e){this._via_transport=e.toUpperCase()}},{key:"sip_uri",get:function(){return this._sip_uri}},{key:"url",get:function(){return this._url}}]),e}(),Ls=a,Bs=l,Ps=D,Fs=x(),Hs=Is,Gs=U(),Ys=M(),js=N(),Qs=xs;Ee("JsSIP")("version %s",Ls.version);var Ws,Ks,Js=s({C:Bs,Exceptions:Ps,Utils:Fs,UA:Hs,URI:Gs,NameAddrHeader:Ys,WebSocketInterface:Qs,Grammar:js,debug:Ee,get name(){return Ls.title},get version(){return Ls.version}});!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=-1]="FAILED",e[e.TIMEOUT=-2]="TIMEOUT",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.UNAVAILABLE=403]="UNAVAILABLE",e[e.SYSTEMBUSY=450]="SYSTEMBUSY",e[e.NOENOUGNCHARACTER=10001]="NOENOUGNCHARACTER"}(Ws||(Ws={})),function(e){e[e.SUCCESS=200]="SUCCESS",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.UNAVAILABLE=403]="UNAVAILABLE",e[e.TIMEOUT=408]="TIMEOUT",e[e.LOCKED=423]="LOCKED",e[e.SYSTEMBUSY=450]="SYSTEMBUSY",e[e.FAILED=500]="FAILED",e[e.NOENOUGNCHARACTER=10001]="NOENOUGNCHARACTER"}(Ks||(Ks={})),Js.debug.disable();var zs=function(){function e(e){this.callType="",this.ua={},this.socket={},this.isManualStop=!1,this.pingTimerId=0,this.newRTCSession={},this.incomingSession={},this.outgoingSession={},this.stream={},this.audio=new Audio,this.ringAudio=new Audio("data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYwLjEyLjEwMAAAAAAAAAAAAAAA/+NAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAABGAABmoQACAwMDBAgIDBAUFBYaGh4iIiUpLCwvMzM3Ozs/Q0dHS09PU1dXW19kZGhsbHB0dHh8gICEiIiMkJCUmJycoKSkqKyssLO3t7u/v8PHx8vP0tLW2tre4uLm6u7u8fT0+Pv7//8AAAAATGF2YzYwLjI2AAAAAAAAAAAAAAAAJANAAAAAAAAAZqGS3w4qAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/jEGQAAAABpAAAAAAAAANIAAAAAP+YSXZLC+9DgcDGZj1QcY5YcTQaglIDDNqAdgLpg2P/4xBkHwAAAaQAAAAAAAADSAAAAADgNYwHkQM0RbgZwQGMBwA3jBsHigAxsBjA3ySYqkDK/+MQZD4AAAGkAAAAAAAAA0gAAAAA4fOHfEpCyAvv+Rcvm6KZfE7ESKhuQMMh/xKA4DNlkf/jEGRdAAAB/gC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QYZrYAoGBiIgCV6HGOQ/+OAZGMyLgs1L854EAwQEmr/ggAAMYLAJJgPgPGAiBYYTIWBgYAKhAAaWaHeCyIA6+1owMAJGeMffYqgFJzpNoWw0/yEbXobcWCHCFgESsA8kAIAQDrfGAeAMulsm4JRxVahwVUjyeaGqu8FZyzIFAFMCYC0uUqda6lyRRgOADmBGAQMABt+IAAXLhtT6tiNIABMJgModxLrkgALxImFxDAdCGBQLKz34DAE1K1wKNgIA8wJQOQqACs9EfLHOhe9TsqgBNvA3G5z0ZkUWkUigFl0NNbk0Rp4xDyKEhi8vVsV67dHDjcP/////////+559w+7bln75v/agyddayFYGKLTvuO1irO9wpN7/mu2cmv0djsxY7//r9fUpOQyWjcW/PNmn4AkMslFj+51LNO+8RmDAEALlklkcbi0rj9iLSGWSmVrCqxOiAOLhTDAUCgACASdhlPDzgsC4Ne+ciltbqLnx/s/3b/8on//////b////u9C3+Gvy1OzdLcTQc/gYBZYbhjaJjEREgJkhCqKgaiwxmY1pLcHXK1lHkTmfo0w/+OAZC0dVe9aAMxkACPUFpZXgZAANKa+uO278vWKqV6krnC+e2/ml2M4dRItMdk65YTGasEsP/8tvCliDkIJi83T9zEHMVqULvSeUhaqVxnV7v557jcjdx2HUUD5V3OyqGoahphv///+VNbAooYXLKSxD9v86e3SASEy4F5vz8NZcvdyyQ6hoLw1u7/L9fuksS/POGHcnJfn///00qpYdZSX2q3KuNnL////Xa1n///////z7nn3mud/88+4Yc1lvk13Hlymy3jj+XdU+H//3fs8mABQLBIKA24poAIo3/+/dH32/fV/+teul3us6cHNABMWLdxIQ6XurA7ER0HKA2PjbKiYhIHwiQnyqztb+aL+QD9cpff81IuL8YYzBFj3xthi0hB3OkpKp/23/TfNzMY8TmOwgaRu2xtRLovBzA24misUTFBL9///zAmG/9i+bpOmYE2MQbKh1HD6d9BMU0UlsQAAAOQ9vmal7/rwNKo1ACPQV3HIimSBpguYyMw0M/M0uip6xDzWhINFWaga8IJ1LCJeMTBRQH0T5FT50pi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2zSU9LPyymx1+W946////+m1z//////9c/7m+3u49wywzx7ruHed/LVWQCAARAMEiCgCACGJYS8OuPZaE3yp9q/1fh54fnf1Pt/93//2///6JMQU1FMy4xMDEgKGJldGEgMimqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/jEGTgAAAB/gDgAAAAAAP8AcAAAKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo="),this.answerEvent=[],this.newMessageEvent=[],this.sessionEvent={},this.callDetails=null,this.getMediaStream=function(){return navigator.mediaDevices.getUserMedia({audio:!0,video:!1})},this.incomingCallCallback=e.incomingCallCallback,(null==e?void 0:e.getMediaStream)&&(this.getMediaStream=e.getMediaStream)}return e.prototype.initMicrophone=function(){var e=this;this.getMediaStream().then(function(t){e.stream=t}).catch(function(){console.error("Error getting microphone stream")})},e.prototype.destroyMicrophone=function(){var e,t;this.stream&&(null===(t=(e=this.stream).getTracks)||void 0===t||t.call(e).forEach(function(e){return e.stop()}),this.stream={})},e.prototype.reset=function(){this.newRTCSession={},this.incomingSession={},this.outgoingSession={},this.setCallType(""),this.callDetails=null,this.pingTimerId=0,clearTimeout(this.pingTimerId)},e.prototype.setCallType=function(e){this.callType=e},e.prototype.getCallType=function(){return this.callType},e.prototype.init=function(e){return t(this,void 0,void 0,function(){var r,i,s,o,a,u=this;return n(this,function(l){return r=e.wssuri,i=e.password,s=e.uri,this.socket=new Js.WebSocketInterface(r),o={sockets:[this.socket],uri:s,password:i,register:!0,register_expires:10,session_timers:!0},(a=new Js.UA(o)).on("connected",function(){u.sendPing()}),a.on("disconnected",function(){u.isManualStop&&u.stop()}),a.on("registrationFailed",function(){u.stop()}),a.on("registrationExpiring",function(){u.ua.register()}),a.on("newMessage",function(e){var t=JSON.parse(e.request.body);u.emitNewMessageEvent({code:Ks.SUCCESS,data:t,message:"success"})}),a.on("newRTCSession",function(e){return t(u,void 0,void 0,function(){var t,r,i=this;return n(this,function(n){switch(n.label){case 0:return this.callDetails=null,this.newRTCSession=e,t=e.session,"remote"!==e.originator?[3,4]:"outboundCall"!==this.callType?[3,1]:(this.answer(),[3,3]);case 1:return this.setCallType("inboundCall"),[4,this.incomingCallCallback(e)];case 2:r=n.sent(),this.callDetails=r.data,this.playRing(),this.emitAnswerEvent(r),n.label=3;case 3:return this.incomingSession=t,this.incomingSession.on("connecting",function(){}),[3,5];case 4:this.outgoingSession=t,this.outgoingSession.on("connecting",function(){}),n.label=5;case 5:return t.on("confirmed",function(e){"outboundCall"!==i.callType&&i.emitSessionEvent("success",{code:Ks.SUCCESS,data:i.callDetails,message:"success"})}),t.on("ended",function(e){i.emitSessionEvent("ended",{code:Ks.SUCCESS,data:i.callDetails,message:"success"}),i.reset()}),t.on("failed",function(e){i.emitSessionEvent("failed",{code:Ks.FAILED,data:i.callDetails,message:"failed"}),i.reset()}),t.on("peerconnection",function(e){e.peerconnection.ontrack=function(e){if(e.streams&&e.streams[0])i.audio.srcObject=e.streams[0],i.audio.paused&&i.audio.play();else{var t=new MediaStream;t.addTrack(e.track),i.audio.srcObject=t,i.audio.paused&&i.audio.play()}}}),[2]}})})}),this.ua=a,this.ringAudio.loop=!0,[2]})})},e.prototype.start=function(){this.isManualStop=!1,this.initMicrophone(),this.ua.start()},e.prototype.stop=function(e){e&&(this.isManualStop=!0),this.destroyMicrophone(),this.reset(),this.ua.stop()},e.prototype.destroy=function(){this.stop(),this.ua={}},e.prototype.getSocketWS=function(){return this.socket._ws},e.prototype.sendPing=function(){var e=this;this.pingTimerId=setTimeout(function(){var t=e.socket.send("ping"),n=e.getSocketWS();if(!t&&![0,1].includes(null==n?void 0:n.readyState))return e.socket.connect(),clearTimeout(e.pingTimerId),void(e.pingTimerId=0);e.sendPing()},3e3)},e.prototype.playRing=function(){this.ringAudio.play()},e.prototype.stopRing=function(){this.ringAudio.pause(),this.ringAudio.currentTime=0},e.prototype.call=function(e,t,n,r){var i={eventHandlers:t,mediaConstraints:{audio:!0,video:!1},mediaStream:this.stream,sessionTimersExpires:1800};this.ua.call(e,i)},e.prototype.hangup=function(){this.stopRing(),this.ua.terminateSessions()},e.prototype.ignore=function(){this.stopRing(),this.ua.terminateSessions({cause:"Busy",status_code:486})},e.prototype.answer=function(){this.stopRing(),this.newRTCSession.session.answer({mediaConstraints:{audio:!0,video:!1},mediaStream:this.stream,sessionTimersExpires:1800})},e.prototype.attachAnswerEvent=function(e){e&&"function"==typeof e&&this.answerEvent.push(e)},e.prototype.removeAnswerEvent=function(e){var t=this.answerEvent;if(t&&t.length)for(var n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}},e.prototype.emitAnswerEvent=function(e){this.answerEvent.forEach(function(t){t(e)})},e.prototype.attachNewMessageEvent=function(e){var t;e&&"function"==typeof e&&(null===(t=this.newMessageEvent)||void 0===t||t.push(e))},e.prototype.removeNewMessageEvent=function(e){var t=this.newMessageEvent;if(t&&t.length)for(var n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}},e.prototype.emitNewMessageEvent=function(e){this.newMessageEvent.forEach(function(t){t(e)})},e.prototype.attchSessionEvent=function(e,t){t&&"function"==typeof t&&(this.sessionEvent[e]||(this.sessionEvent[e]=[]),this.sessionEvent[e].push(t))},e.prototype.removeSessionEvent=function(e,t){var n=this.sessionEvent[e];if(n&&n.length)for(var r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1);break}},e.prototype.emitSessionEvent=function(e,t){(this.sessionEvent[e]||[]).forEach(function(e){e(t)})},e.prototype.on=function(e,t){return this.ua.on(e,t),this},e.prototype.RTCSessionOn=function(e,t){this.newRTCSession.session.on(e,t)},e.prototype.mute=function(){this.newRTCSession.session.mute({audio:!0})},e.prototype.unmute=function(){this.newRTCSession.session.unmute({audio:!0})},e.prototype.isMuted=function(){return this.newRTCSession.session.isMuted()},e.prototype.getIsRegistered=function(){return this.ua.isRegistered()},e}(),Vs={exports:{}};
1
+ "use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function a(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}u((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;let i=(e=21)=>{let t="",n=0|e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t};var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var u={title:"JsSIP",version:"3.10.1"},l=u,c={USER_AGENT:"".concat(l.title," ").concat(l.version),SIP:"sip",SIPS:"sips",causes:{CONNECTION_ERROR:"Connection Error",REQUEST_TIMEOUT:"Request Timeout",SIP_FAILURE_CODE:"SIP Failure Code",INTERNAL_ERROR:"Internal Error",BUSY:"Busy",REJECTED:"Rejected",REDIRECTED:"Redirected",UNAVAILABLE:"Unavailable",NOT_FOUND:"Not Found",ADDRESS_INCOMPLETE:"Address Incomplete",INCOMPATIBLE_SDP:"Incompatible SDP",MISSING_SDP:"Missing SDP",AUTHENTICATION_ERROR:"Authentication Error",BYE:"Terminated",WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",DIALOG_ERROR:"Dialog Error",USER_DENIED_MEDIA_ACCESS:"User Denied Media Access",BAD_MEDIA_DESCRIPTION:"Bad Media Description",RTP_TIMEOUT:"RTP Timeout"},SIP_ERROR_CAUSES:{REDIRECTED:[300,301,302,305,380],BUSY:[486,600],REJECTED:[403,603],NOT_FOUND:[404,604],UNAVAILABLE:[480,410,408,430],ADDRESS_INCOMPLETE:[484,424],INCOMPATIBLE_SDP:[488,606],AUTHENTICATION_ERROR:[401,407]},ACK:"ACK",BYE:"BYE",CANCEL:"CANCEL",INFO:"INFO",INVITE:"INVITE",MESSAGE:"MESSAGE",NOTIFY:"NOTIFY",OPTIONS:"OPTIONS",REGISTER:"REGISTER",REFER:"REFER",UPDATE:"UPDATE",SUBSCRIBE:"SUBSCRIBE",DTMF_TRANSPORT:{INFO:"INFO",RFC2833:"RFC2833"},REASON_PHRASE:{100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",424:"Bad Location Information",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"JsSIP Internal Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"},ALLOWED_METHODS:"INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY",ACCEPTED_BODY_TYPES:"application/sdp, application/dtmf-relay",MAX_FORWARDS:69,SESSION_EXPIRES:90,MIN_SESSION_EXPIRES:60,CONNECTION_RECOVERY_MAX_INTERVAL:30,CONNECTION_RECOVERY_MIN_INTERVAL:2};function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}function p(e){var t=A();return function(){var n,r=v(e);if(t){var i=v(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function g(e){var t="function"==typeof Map?new Map:void 0;return g=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _(e,arguments,v(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),m(r,e)},g(e)}function _(e,t,n){return _=A()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&m(i,n.prototype),i},_.apply(null,arguments)}function A(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}var y,T,S,C,E,w,b,I,R=function(){f(t,g(Error));var e=p(t);function t(n,r){var i;return d(this,t),(i=e.call(this)).code=1,i.name="CONFIGURATION_ERROR",i.parameter=n,i.value=r,i.message=i.value?"Invalid value ".concat(JSON.stringify(i.value),' for parameter "').concat(i.parameter,'"'):"Missing parameter: ".concat(i.parameter),i}return t}(),O=function(){f(t,g(Error));var e=p(t);function t(n){var r;return d(this,t),(r=e.call(this)).code=2,r.name="INVALID_STATE_ERROR",r.status=n,r.message="Invalid status: ".concat(n),r}return t}(),k=function(){f(t,g(Error));var e=p(t);function t(n){var r;return d(this,t),(r=e.call(this)).code=3,r.name="NOT_SUPPORTED_ERROR",r.message=n,r}return t}(),D=function(){f(t,g(Error));var e=p(t);function t(n){var r;return d(this,t),(r=e.call(this)).code=4,r.name="NOT_READY_ERROR",r.message=n,r}return t}(),q={ConfigurationError:R,InvalidStateError:O,NotSupportedError:k,NotReadyError:D},M={};function N(){if(T)return y;function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}T=1;var n=x(),r=U();return y=function(){function e(t,r,i){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!(t&&t instanceof n))throw new TypeError('missing or invalid "uri" parameter');for(var s in this._uri=t,this._parameters={},this.display_name=r,i)Object.prototype.hasOwnProperty.call(i,s)&&this.setParam(s,i[s])}return t(e,null,[{key:"parse",value:function(e){return-1!==(e=r.parse(e,"Name_Addr_Header"))?e:void 0}}]),t(e,[{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=null==t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e)){var t=this._parameters[e];return delete this._parameters[e],t}}},{key:"clearParams",value:function(){this._parameters={}}},{key:"clone",value:function(){return new e(this._uri.clone(),this._display_name,JSON.parse(JSON.stringify(this._parameters)))}},{key:"_quote",value:function(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}},{key:"toString",value:function(){var e=this._display_name?'"'.concat(this._quote(this._display_name),'" '):"";for(var t in e+="<".concat(this._uri.toString(),">"),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,t)&&(e+=";".concat(t),null!==this._parameters[t]&&(e+="=".concat(this._parameters[t])));return e}},{key:"uri",get:function(){return this._uri}},{key:"display_name",get:function(){return this._display_name},set:function(e){this._display_name=0===e?"0":e}}]),e}(),y}function U(){return C||(C=1,S=function(){function e(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var t={parse:function(t,n){var r={CRLF:u,DIGIT:l,ALPHA:c,HEXDIG:h,WSP:d,OCTET:f,DQUOTE:p,SP:g,HTAB:_,alphanum:A,reserved:m,unreserved:v,mark:y,escaped:T,LWS:S,SWS:C,HCOLON:E,TEXT_UTF8_TRIM:w,TEXT_UTF8char:b,UTF8_NONASCII:I,UTF8_CONT:R,LHEX:function(){var e;null===(e=l())&&(/^[a-f]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[a-f]")));return e},token:O,token_nodot:k,separators:function(){var e;40===t.charCodeAt(i)?(e="(",i++):(e=null,a('"("'));null===e&&(41===t.charCodeAt(i)?(e=")",i++):(e=null,a('")"')),null===e&&(60===t.charCodeAt(i)?(e="<",i++):(e=null,a('"<"')),null===e&&(62===t.charCodeAt(i)?(e=">",i++):(e=null,a('">"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,a('"@"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","')),null===e&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,a('";"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(92===t.charCodeAt(i)?(e="\\",i++):(e=null,a('"\\\\"')),null===e&&null===(e=p())&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null===e&&(91===t.charCodeAt(i)?(e="[",i++):(e=null,a('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,a('"]"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(123===t.charCodeAt(i)?(e="{",i++):(e=null,a('"{"')),null===e&&(125===t.charCodeAt(i)?(e="}",i++):(e=null,a('"}"')),null===e&&null===(e=g())&&(e=_()))))))))))))))));return e},word:D,STAR:q,SLASH:M,EQUAL:U,LPAREN:L,RPAREN:B,RAQUOT:P,LAQUOT:F,COMMA:H,SEMI:G,COLON:Y,LDQUOT:j,RDQUOT:Q,comment:function e(){var t,n,r,s;if(s=i,null!==(t=L())){for(n=[],null===(r=W())&&null===(r=V())&&(r=e());null!==r;)n.push(r),null===(r=W())&&null===(r=V())&&(r=e());null!==n&&null!==(r=B())?t=[t,n,r]:(t=null,i=s)}else t=null,i=s;return t},ctext:W,quoted_string:K,quoted_string_clean:J,qdtext:z,quoted_pair:V,SIP_URI_noparams:Z,SIP_URI:X,uri_scheme:$,uri_scheme_sips:ee,uri_scheme_sip:te,userinfo:ne,user:re,user_unreserved:ie,password:se,hostport:oe,host:ae,hostname:ue,domainlabel:le,toplabel:ce,IPv6reference:he,IPv6address:de,h16:fe,ls32:pe,IPv4address:ge,dec_octet:_e,port:Ae,uri_parameters:me,uri_parameter:ve,transport_param:ye,user_param:Te,method_param:Se,ttl_param:Ce,maddr_param:Ee,lr_param:we,other_param:be,pname:Ie,pvalue:Re,paramchar:Oe,param_unreserved:ke,headers:De,header:qe,hname:Me,hvalue:Ne,hnv_unreserved:Ue,Request_Response:function(){var e;null===(e=ht())&&(e=xe());return e},Request_Line:xe,Request_URI:Le,absoluteURI:Be,hier_part:Pe,net_path:Fe,abs_path:He,opaque_part:Ge,uric:Ye,uric_no_slash:je,path_segments:Qe,segment:We,param:Ke,pchar:Je,scheme:ze,authority:Ve,srvr:Ze,reg_name:Xe,query:$e,SIP_Version:et,INVITEm:tt,ACKm:nt,OPTIONSm:rt,BYEm:it,CANCELm:st,REGISTERm:ot,SUBSCRIBEm:at,NOTIFYm:ut,REFERm:lt,Method:ct,Status_Line:ht,Status_Code:dt,extension_code:ft,Reason_Phrase:pt,Allow_Events:function(){var e,t,n,r,s,o;if(s=i,null!==(e=Bt())){for(t=[],o=i,null!==(n=H())&&null!==(r=Bt())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=Bt())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},Call_ID:function(){var e,n,r,s,o,u;s=i,o=i,null!==(e=D())?(u=i,64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null!==n&&null!==(r=D())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o);null!==e&&(e=function(e){Hn=t.substring(i,e)}(s));null===e&&(i=s);return e},Contact:function(){var e,t,n,r,s,o,a;if(s=i,null===(e=q()))if(o=i,null!==(e=gt())){for(t=[],a=i,null!==(n=H())&&null!==(r=gt())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=H())&&null!==(r=gt())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){var e,t;for(t=Hn.multi_header.length,e=0;e<t;e++)if(null===Hn.multi_header[e].parsed){Hn=null;break}Hn=null!==Hn?Hn.multi_header:-1}());null===e&&(i=s);return e},contact_param:gt,name_addr:_t,display_name:At,contact_params:mt,c_p_q:vt,c_p_expires:yt,delta_seconds:Tt,qvalue:St,generic_param:Ct,gen_value:Et,Content_Disposition:function(){var e,t,n,r,s,o;if(s=i,null!==(e=wt())){for(t=[],o=i,null!==(n=G())&&null!==(r=bt())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=bt())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},disp_type:wt,disp_param:bt,handling_param:It,Content_Encoding:function(){var e,t,n,r,s,o;if(s=i,null!==(e=O())){for(t=[],o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},Content_Length:function(){var e,t,n;if(n=i,null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;null!==e&&(e=void(Hn=parseInt(e.join(""))));null===e&&(i=n);return e},Content_Type:function(){var e,n;n=i,null!==(e=Rt())&&(e=function(e){Hn=t.substring(i,e)}(n));null===e&&(i=n);return e},media_type:Rt,m_type:Ot,discrete_type:kt,composite_type:Dt,extension_token:qt,x_token:Mt,m_subtype:Nt,m_parameter:Ut,m_value:xt,CSeq:function(){var e,t,n,r;r=i,null!==(e=Lt())&&null!==(t=S())&&null!==(n=ct())?e=[e,t,n]:(e=null,i=r);return e},CSeq_value:Lt,Expires:function(){var e,t;t=i,null!==(e=Tt())&&(e=void(Hn=e));null===e&&(i=t);return e},Event:function(){var e,t,n,r,s,o,a;if(s=i,o=i,null!==(e=Bt())){for(t=[],a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(u=e[0],e=void(Hn.event=u.join("").toLowerCase()));var u;null===e&&(i=s);return e},event_type:Bt,From:function(){var e,t,n,r,s,o,a;s=i,o=i,null===(e=Z())&&(e=_t());if(null!==e){for(t=[],a=i,null!==(n=G())&&null!==(r=Pt())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=Pt())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){var e=Hn.tag;try{Hn=new Fn(Hn.uri,Hn.display_name,Hn.params),e&&Hn.setParam("tag",e)}catch(e){Hn=-1}}());null===e&&(i=s);return e},from_param:Pt,tag_param:Ft,Max_Forwards:function(){var e,t,n;if(n=i,null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;null!==e&&(e=void(Hn=parseInt(e.join(""))));null===e&&(i=n);return e},Min_Expires:function(){var e,t;t=i,null!==(e=Tt())&&(e=void(Hn=e));null===e&&(i=t);return e},Name_Addr_Header:function(){var e,t,n,r,s,o,a,u,l,c;u=i,l=i,e=[],t=At();for(;null!==t;)e.push(t),t=At();if(null!==e)if(null!==(t=F()))if(null!==(n=X()))if(null!==(r=P())){for(s=[],c=i,null!==(o=G())&&null!==(a=Ct())?o=[o,a]:(o=null,i=c);null!==o;)s.push(o),c=i,null!==(o=G())&&null!==(a=Ct())?o=[o,a]:(o=null,i=c);null!==s?e=[e,t,n,r,s]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;else e=null,i=l;else e=null,i=l;null!==e&&(e=function(){try{Hn=new Fn(Hn.uri,Hn.display_name,Hn.params)}catch(e){Hn=-1}}());null===e&&(i=u);return e},Proxy_Authenticate:function(){return Ht()},challenge:Ht,other_challenge:Gt,auth_param:Yt,digest_cln:jt,realm:Qt,realm_value:Wt,domain:Kt,URI:Jt,nonce:zt,nonce_value:Vt,opaque:Zt,stale:Xt,algorithm:$t,qop_options:en,qop_value:tn,Proxy_Require:function(){var e,t,n,r,s,o;if(s=i,null!==(e=O())){for(t=[],o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},Record_Route:function(){var e,t,n,r,s,o,a;if(s=i,o=i,null!==(e=nn())){for(t=[],a=i,null!==(n=H())&&null!==(r=nn())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=H())&&null!==(r=nn())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){var e,t;for(t=Hn.multi_header.length,e=0;e<t;e++)if(null===Hn.multi_header[e].parsed){Hn=null;break}Hn=null!==Hn?Hn.multi_header:-1}());null===e&&(i=s);return e},rec_route:nn,Reason:function(){var e,n,r,s,o,u,l;o=i,u=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"SIP"'));null===e&&(e=O());if(null!==e){for(n=[],l=i,null!==(r=G())&&null!==(s=rn())?r=[r,s]:(r=null,i=l);null!==r;)n.push(r),l=i,null!==(r=G())&&null!==(s=rn())?r=[r,s]:(r=null,i=l);null!==n?e=[e,n]:(e=null,i=u)}else e=null,i=u;null!==e&&(e=function(e,t){if(Hn.protocol=t.toLowerCase(),Hn.params||(Hn.params={}),Hn.params.text&&'"'===Hn.params.text[0]){var n=Hn.params.text;Hn.text=n.substring(1,n.length-1),delete Hn.params.text}}(0,e[0]));null===e&&(i=o);return e},reason_param:rn,reason_cause:sn,Require:function(){var e,t,n,r,s,o;if(s=i,null!==(e=O())){for(t=[],o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},Route:function(){var e,t,n,r,s,o;if(s=i,null!==(e=on())){for(t=[],o=i,null!==(n=H())&&null!==(r=on())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=on())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},route_param:on,Subscription_State:function(){var e,t,n,r,s,o;if(s=i,null!==(e=an())){for(t=[],o=i,null!==(n=G())&&null!==(r=un())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=un())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},substate_value:an,subexp_params:un,event_reason_value:ln,Subject:function(){var e;return e=null!==(e=w())?e:""},Supported:function(){var e,t,n,r,s,o;if(s=i,null!==(e=O())){for(t=[],o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=O())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e=null!==e?e:""},To:function(){var e,t,n,r,s,o,a;s=i,o=i,null===(e=Z())&&(e=_t());if(null!==e){for(t=[],a=i,null!==(n=G())&&null!==(r=cn())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=cn())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){var e=Hn.tag;try{Hn=new Fn(Hn.uri,Hn.display_name,Hn.params),e&&Hn.setParam("tag",e)}catch(e){Hn=-1}}());null===e&&(i=s);return e},to_param:cn,Via:function(){var e,t,n,r,s,o;if(s=i,null!==(e=hn())){for(t=[],o=i,null!==(n=H())&&null!==(r=hn())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=H())&&null!==(r=hn())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},via_param:hn,via_params:dn,via_ttl:fn,via_maddr:pn,via_received:gn,via_branch:_n,response_port:An,rport:mn,sent_protocol:vn,protocol_name:yn,transport:Tn,sent_by:Sn,via_host:Cn,via_port:En,ttl:wn,WWW_Authenticate:function(){return Ht()},Session_Expires:function(){var e,t,n,r,s,o;if(s=i,null!==(e=bn())){for(t=[],o=i,null!==(n=G())&&null!==(r=In())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=In())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},s_e_expires:bn,s_e_params:In,s_e_refresher:Rn,extension_header:function(){var e,t,n,r;r=i,null!==(e=O())&&null!==(t=E())&&null!==(n=On())?e=[e,t,n]:(e=null,i=r);return e},header_value:On,message_body:function(){var e,t;e=[],t=f();for(;null!==t;)e.push(t),t=f();return e},uuid_URI:function(){var e,n,r;r=i,"uuid:"===t.substr(i,5)?(e="uuid:",i+=5):(e=null,a('"uuid:"'));null!==e&&null!==(n=kn())?e=[e,n]:(e=null,i=r);return e},uuid:kn,hex4:Dn,hex8:qn,hex12:Mn,Refer_To:function(){var e,t,n,r,s,o,a;s=i,o=i,null===(e=Z())&&(e=_t());if(null!==e){for(t=[],a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;null!==e&&(e=function(){try{Hn=new Fn(Hn.uri,Hn.display_name,Hn.params)}catch(e){Hn=-1}}());null===e&&(i=s);return e},Replaces:function(){var e,t,n,r,s,o;if(s=i,null!==(e=Nn())){for(t=[],o=i,null!==(n=G())&&null!==(r=Un())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=Un())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e},call_id:Nn,replaces_param:Un,to_tag:xn,from_tag:Ln,early_flag:Bn};if(void 0!==n){if(void 0===r[n])throw new Error("Invalid rule name: "+e(n)+".")}else n="CRLF";var i=0,s=0,o=[];function a(e){i<s||(i>s&&(s=i,o=[]),o.push(e))}function u(){var e;return"\r\n"===t.substr(i,2)?(e="\r\n",i+=2):(e=null,a('"\\r\\n"')),e}function l(){var e;return/^[0-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[0-9]")),e}function c(){var e;return/^[a-zA-Z]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[a-zA-Z]")),e}function h(){var e;return/^[0-9a-fA-F]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[0-9a-fA-F]")),e}function d(){var e;return null===(e=g())&&(e=_()),e}function f(){var e;return/^[\0-\xFF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\0-\\xFF]")),e}function p(){var e;return/^["]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a('["]')),e}function g(){var e;return 32===t.charCodeAt(i)?(e=" ",i++):(e=null,a('" "')),e}function _(){var e;return 9===t.charCodeAt(i)?(e="\t",i++):(e=null,a('"\\t"')),e}function A(){var e;return/^[a-zA-Z0-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[a-zA-Z0-9]")),e}function m(){var e;return 59===t.charCodeAt(i)?(e=";",i++):(e=null,a('";"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,a('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","'))))))))))),e}function v(){var e;return null===(e=A())&&(e=y()),e}function y(){var e;return 45===t.charCodeAt(i)?(e="-",i++):(e=null,a('"-"')),null===e&&(95===t.charCodeAt(i)?(e="_",i++):(e=null,a('"_"')),null===e&&(46===t.charCodeAt(i)?(e=".",i++):(e=null,a('"."')),null===e&&(33===t.charCodeAt(i)?(e="!",i++):(e=null,a('"!"')),null===e&&(126===t.charCodeAt(i)?(e="~",i++):(e=null,a('"~"')),null===e&&(42===t.charCodeAt(i)?(e="*",i++):(e=null,a('"*"')),null===e&&(39===t.charCodeAt(i)?(e="'",i++):(e=null,a('"\'"')),null===e&&(40===t.charCodeAt(i)?(e="(",i++):(e=null,a('"("')),null===e&&(41===t.charCodeAt(i)?(e=")",i++):(e=null,a('")"')))))))))),e}function T(){var e,n,r,s,o;return s=i,o=i,37===t.charCodeAt(i)?(e="%",i++):(e=null,a('"%"')),null!==e&&null!==(n=h())&&null!==(r=h())?e=[e,n,r]:(e=null,i=o),null!==e&&(e=e.join("")),null===e&&(i=s),e}function S(){var e,t,n,r,s,o;for(r=i,s=i,o=i,e=[],t=d();null!==t;)e.push(t),t=d();if(null!==e&&null!==(t=u())?e=[e,t]:(e=null,i=o),null!==(e=null!==e?e:"")){if(null!==(n=d()))for(t=[];null!==n;)t.push(n),n=d();else t=null;null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return null!==e&&(e=" "),null===e&&(i=r),e}function C(){var e;return e=null!==(e=S())?e:""}function E(){var e,n,r,s,o;for(s=i,o=i,e=[],null===(n=g())&&(n=_());null!==n;)e.push(n),null===(n=g())&&(n=_());return null!==e?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=":"),null===e&&(i=s),e}function w(){var e,n,r,s,o,a,u;if(o=i,a=i,null!==(n=b()))for(e=[];null!==n;)e.push(n),n=b();else e=null;if(null!==e){for(n=[],u=i,r=[],s=S();null!==s;)r.push(s),s=S();for(null!==r&&null!==(s=b())?r=[r,s]:(r=null,i=u);null!==r;){for(n.push(r),u=i,r=[],s=S();null!==s;)r.push(s),s=S();null!==r&&null!==(s=b())?r=[r,s]:(r=null,i=u)}null!==n?e=[e,n]:(e=null,i=a)}else e=null,i=a;return null!==e&&(e=function(e){return t.substring(i,e)}(o)),null===e&&(i=o),e}function b(){var e;return/^[!-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[!-~]")),null===e&&(e=I()),e}function I(){var e;return/^[\x80-\uFFFF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\x80-\\uFFFF]")),e}function R(){var e;return/^[\x80-\xBF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\x80-\\xBF]")),e}function O(){var e,n,r;if(r=i,null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"')))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"'))))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function k(){var e,n,r;if(r=i,null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"'))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"')))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function D(){var e,n,r;if(r=i,null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"')),null===n&&(40===t.charCodeAt(i)?(n="(",i++):(n=null,a('"("')),null===n&&(41===t.charCodeAt(i)?(n=")",i++):(n=null,a('")"')),null===n&&(60===t.charCodeAt(i)?(n="<",i++):(n=null,a('"<"')),null===n&&(62===t.charCodeAt(i)?(n=">",i++):(n=null,a('">"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null===n&&(92===t.charCodeAt(i)?(n="\\",i++):(n=null,a('"\\\\"')),null===n&&null===(n=p())&&(47===t.charCodeAt(i)?(n="/",i++):(n=null,a('"/"')),null===n&&(91===t.charCodeAt(i)?(n="[",i++):(n=null,a('"["')),null===n&&(93===t.charCodeAt(i)?(n="]",i++):(n=null,a('"]"')),null===n&&(63===t.charCodeAt(i)?(n="?",i++):(n=null,a('"?"')),null===n&&(123===t.charCodeAt(i)?(n="{",i++):(n=null,a('"{"')),null===n&&(125===t.charCodeAt(i)?(n="}",i++):(n=null,a('"}"')))))))))))))))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=A())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,a('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,a('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,a('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,a('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,a('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,a('"~"')),null===n&&(40===t.charCodeAt(i)?(n="(",i++):(n=null,a('"("')),null===n&&(41===t.charCodeAt(i)?(n=")",i++):(n=null,a('")"')),null===n&&(60===t.charCodeAt(i)?(n="<",i++):(n=null,a('"<"')),null===n&&(62===t.charCodeAt(i)?(n=">",i++):(n=null,a('">"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null===n&&(92===t.charCodeAt(i)?(n="\\",i++):(n=null,a('"\\\\"')),null===n&&null===(n=p())&&(47===t.charCodeAt(i)?(n="/",i++):(n=null,a('"/"')),null===n&&(91===t.charCodeAt(i)?(n="[",i++):(n=null,a('"["')),null===n&&(93===t.charCodeAt(i)?(n="]",i++):(n=null,a('"]"')),null===n&&(63===t.charCodeAt(i)?(n="?",i++):(n=null,a('"?"')),null===n&&(123===t.charCodeAt(i)?(n="{",i++):(n=null,a('"{"')),null===n&&(125===t.charCodeAt(i)?(n="}",i++):(n=null,a('"}"'))))))))))))))))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function q(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(42===t.charCodeAt(i)?(n="*",i++):(n=null,a('"*"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="*"),null===e&&(i=s),e}function M(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(47===t.charCodeAt(i)?(n="/",i++):(n=null,a('"/"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="/"),null===e&&(i=s),e}function U(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="="),null===e&&(i=s),e}function L(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(40===t.charCodeAt(i)?(n="(",i++):(n=null,a('"("')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="("),null===e&&(i=s),e}function B(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(41===t.charCodeAt(i)?(n=")",i++):(n=null,a('")"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=")"),null===e&&(i=s),e}function P(){var e,n,r,s;return r=i,s=i,62===t.charCodeAt(i)?(e=">",i++):(e=null,a('">"')),null!==e&&null!==(n=C())?e=[e,n]:(e=null,i=s),null!==e&&(e=">"),null===e&&(i=r),e}function F(){var e,n,r,s;return r=i,s=i,null!==(e=C())?(60===t.charCodeAt(i)?(n="<",i++):(n=null,a('"<"')),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null!==e&&(e="<"),null===e&&(i=r),e}function H(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=","),null===e&&(i=s),e}function G(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=";"),null===e&&(i=s),e}function Y(){var e,n,r,s,o;return s=i,o=i,null!==(e=C())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=C())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=":"),null===e&&(i=s),e}function j(){var e,t,n,r;return n=i,r=i,null!==(e=C())&&null!==(t=p())?e=[e,t]:(e=null,i=r),null!==e&&(e='"'),null===e&&(i=n),e}function Q(){var e,t,n,r;return n=i,r=i,null!==(e=p())&&null!==(t=C())?e=[e,t]:(e=null,i=r),null!==e&&(e='"'),null===e&&(i=n),e}function W(){var e;return/^[!-']/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[!-']")),null===e&&(/^[*-[]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[*-[]")),null===e&&(/^[\]-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\]-~]")),null===e&&null===(e=I())&&(e=S()))),e}function K(){var e,n,r,s,o,a;if(o=i,a=i,null!==(e=C()))if(null!==(n=p())){for(r=[],null===(s=z())&&(s=V());null!==s;)r.push(s),null===(s=z())&&(s=V());null!==r&&null!==(s=p())?e=[e,n,r,s]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;return null!==e&&(e=function(e){return t.substring(i,e)}(o)),null===e&&(i=o),e}function J(){var e,n,r,s,o,a;if(o=i,a=i,null!==(e=C()))if(null!==(n=p())){for(r=[],null===(s=z())&&(s=V());null!==s;)r.push(s),null===(s=z())&&(s=V());null!==r&&null!==(s=p())?e=[e,n,r,s]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;return null!==e&&(e=function(e){var n=t.substring(i,e).trim();return n.substring(1,n.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1")}(o)),null===e&&(i=o),e}function z(){var e;return null===(e=S())&&(33===t.charCodeAt(i)?(e="!",i++):(e=null,a('"!"')),null===e&&(/^[#-[]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[#-[]")),null===e&&(/^[\]-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[\\]-~]")),null===e&&(e=I())))),e}function V(){var e,n,r;return r=i,92===t.charCodeAt(i)?(e="\\",i++):(e=null,a('"\\\\"')),null!==e?(/^[\0-\t]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[\\0-\\t]")),null===n&&(/^[\x0B-\f]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[\\x0B-\\f]")),null===n&&(/^[\x0E-]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[\\x0E-]")))),null!==n?e=[e,n]:(e=null,i=r)):(e=null,i=r),e}function Z(){var e,n,r,s,o,u;return o=i,u=i,null!==(e=$())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=null!==(r=ne())?r:"")&&null!==(s=oe())?e=[e,n,r,s]:(e=null,i=u)):(e=null,i=u),null!==e&&(e=function(){try{Hn.uri=new Pn(Hn.scheme,Hn.user,Hn.host,Hn.port),delete Hn.scheme,delete Hn.user,delete Hn.host,delete Hn.host_type,delete Hn.port}catch(e){Hn=-1}}()),null===e&&(i=o),e}function X(){var e,r,s,o,u,l,c,h;return c=i,h=i,null!==(e=$())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=null!==(s=ne())?s:"")&&null!==(o=oe())&&null!==(u=me())&&null!==(l=null!==(l=De())?l:"")?e=[e,r,s,o,u,l]:(e=null,i=h)):(e=null,i=h),null!==e&&(e=function(){try{Hn.uri=new Pn(Hn.scheme,Hn.user,Hn.host,Hn.port,Hn.uri_params,Hn.uri_headers),delete Hn.scheme,delete Hn.user,delete Hn.host,delete Hn.host_type,delete Hn.port,delete Hn.uri_params,"SIP_URI"===n&&(Hn=Hn.uri)}catch(e){Hn=-1}}()),null===e&&(i=c),e}function $(){var e;return null===(e=ee())&&(e=te()),e}function ee(){var e,n,r;return n=i,"sips"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"sips"')),null!==e&&(r=e,e=void(Hn.scheme=r.toLowerCase())),null===e&&(i=n),e}function te(){var e,n,r;return n=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"sip"')),null!==e&&(r=e,e=void(Hn.scheme=r.toLowerCase())),null===e&&(i=n),e}function ne(){var e,n,r,s,o,u;return s=i,o=i,null!==(e=re())?(u=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=se())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?(64===t.charCodeAt(i)?(r="@",i++):(r=null,a('"@"')),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o)):(e=null,i=o),null!==e&&(e=function(e){Hn.user=decodeURIComponent(t.substring(i-1,e))}(s)),null===e&&(i=s),e}function re(){var e,t;if(null===(t=v())&&null===(t=T())&&(t=ie()),null!==t)for(e=[];null!==t;)e.push(t),null===(t=v())&&null===(t=T())&&(t=ie());else e=null;return e}function ie(){var e;return 38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","')),null===e&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,a('";"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"'))))))))),e}function se(){var e,n,r;for(r=i,e=[],null===(n=v())&&null===(n=T())&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,a('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,a('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')))))));null!==n;)e.push(n),null===(n=v())&&null===(n=T())&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,a('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')),null===n&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,a('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')))))));return null!==e&&(e=function(e){Hn.password=t.substring(i,e)}(r)),null===e&&(i=r),e}function oe(){var e,n,r,s,o;return s=i,null!==(e=ae())?(o=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=Ae())?n=[n,r]:(n=null,i=o),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=s)):(e=null,i=s),e}function ae(){var e,n;return n=i,null===(e=ue())&&null===(e=ge())&&(e=he()),null!==e&&(e=function(e){return Hn.host=t.substring(i,e).toLowerCase(),Hn.host}(n)),null===e&&(i=n),e}function ue(){var e,n,r,s,o,u;for(s=i,o=i,e=[],u=i,null!==(n=le())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==r?n=[n,r]:(n=null,i=u)):(n=null,i=u);null!==n;)e.push(n),u=i,null!==(n=le())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==r?n=[n,r]:(n=null,i=u)):(n=null,i=u);return null!==e&&null!==(n=ce())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==(r=null!==r?r:"")?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=function(e){return Hn.host_type="domain",t.substring(i,e)}(s)),null===e&&(i=s),e}function le(){var e,n,r,s;if(s=i,null!==(e=A())){for(n=[],null===(r=A())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,a('"_"'))));null!==r;)n.push(r),null===(r=A())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,a('"_"'))));null!==n?e=[e,n]:(e=null,i=s)}else e=null,i=s;return e}function ce(){var e,n,r,s;if(s=i,null!==(e=c())){for(n=[],null===(r=A())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,a('"_"'))));null!==r;)n.push(r),null===(r=A())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,a('"_"'))));null!==n?e=[e,n]:(e=null,i=s)}else e=null,i=s;return e}function he(){var e,n,r,s,o;return s=i,o=i,91===t.charCodeAt(i)?(e="[",i++):(e=null,a('"["')),null!==e&&null!==(n=de())?(93===t.charCodeAt(i)?(r="]",i++):(r=null,a('"]"')),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=function(e){return Hn.host_type="IPv6",t.substring(i,e)}(s)),null===e&&(i=s),e}function de(){var e,n,r,s,o,u,l,c,h,d,f,p,g,_,A,m;return _=i,A=i,null!==(e=fe())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?(58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?(58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,a('":"')),null!==c&&null!==(h=fe())?(58===t.charCodeAt(i)?(d=":",i++):(d=null,a('":"')),null!==d&&null!==(f=fe())?(58===t.charCodeAt(i)?(p=":",i++):(p=null,a('":"')),null!==p&&null!==(g=pe())?e=[e,n,r,s,o,u,l,c,h,d,f,p,g]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=fe())?(58===t.charCodeAt(i)?(h=":",i++):(h=null,a('":"')),null!==h&&null!==(d=fe())?(58===t.charCodeAt(i)?(f=":",i++):(f=null,a('":"')),null!==f&&null!==(p=pe())?e=[e,n,r,s,o,u,l,c,h,d,f,p]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=fe())?(58===t.charCodeAt(i)?(h=":",i++):(h=null,a('":"')),null!==h&&null!==(d=pe())?e=[e,n,r,s,o,u,l,c,h,d]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=pe())?e=[e,n,r,s,o,u,l,c]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=pe())?e=[e,n,r,s,o,u]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=pe())?e=[e,n,r,s]:(e=null,i=A)):(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=pe())?e=[e,n]:(e=null,i=A),null===e&&(A=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,a('"::"')),null!==e&&null!==(n=fe())?e=[e,n]:(e=null,i=A),null===e&&(A=i,null!==(e=fe())?("::"===t.substr(i,2)?(n="::",i+=2):(n=null,a('"::"')),null!==n&&null!==(r=fe())?(58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?(58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,a('":"')),null!==c&&null!==(h=fe())?(58===t.charCodeAt(i)?(d=":",i++):(d=null,a('":"')),null!==d&&null!==(f=pe())?e=[e,n,r,s,o,u,l,c,h,d,f]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?("::"===t.substr(i,2)?(r="::",i+=2):(r=null,a('"::"')),null!==r&&null!==(s=fe())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=fe())?(58===t.charCodeAt(i)?(h=":",i++):(h=null,a('":"')),null!==h&&null!==(d=pe())?e=[e,n,r,s,o,u,l,c,h,d]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?("::"===t.substr(i,2)?(s="::",i+=2):(s=null,a('"::"')),null!==s&&null!==(o=fe())?(58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,a('":"')),null!==c&&null!==(h=pe())?e=[e,n,r,s,o,u,l,c,h]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?(m=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?s=[s,o]:(s=null,i=m),null!==(s=null!==s?s:"")?("::"===t.substr(i,2)?(o="::",i+=2):(o=null,a('"::"')),null!==o&&null!==(u=fe())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=pe())?e=[e,n,r,s,o,u,l,c]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?(m=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?s=[s,o]:(s=null,i=m),null!==(s=null!==s?s:"")?(m=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?o=[o,u]:(o=null,i=m),null!==(o=null!==o?o:"")?("::"===t.substr(i,2)?(u="::",i+=2):(u=null,a('"::"')),null!==u&&null!==(l=pe())?e=[e,n,r,s,o,u,l]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?(m=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?s=[s,o]:(s=null,i=m),null!==(s=null!==s?s:"")?(m=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?o=[o,u]:(o=null,i=m),null!==(o=null!==o?o:"")?(m=i,58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?u=[u,l]:(u=null,i=m),null!==(u=null!==u?u:"")?("::"===t.substr(i,2)?(l="::",i+=2):(l=null,a('"::"')),null!==l&&null!==(c=fe())?e=[e,n,r,s,o,u,l,c]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A),null===e&&(A=i,null!==(e=fe())?(m=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?n=[n,r]:(n=null,i=m),null!==(n=null!==n?n:"")?(m=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,a('":"')),null!==r&&null!==(s=fe())?r=[r,s]:(r=null,i=m),null!==(r=null!==r?r:"")?(m=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,a('":"')),null!==s&&null!==(o=fe())?s=[s,o]:(s=null,i=m),null!==(s=null!==s?s:"")?(m=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,a('":"')),null!==o&&null!==(u=fe())?o=[o,u]:(o=null,i=m),null!==(o=null!==o?o:"")?(m=i,58===t.charCodeAt(i)?(u=":",i++):(u=null,a('":"')),null!==u&&null!==(l=fe())?u=[u,l]:(u=null,i=m),null!==(u=null!==u?u:"")?(m=i,58===t.charCodeAt(i)?(l=":",i++):(l=null,a('":"')),null!==l&&null!==(c=fe())?l=[l,c]:(l=null,i=m),null!==(l=null!==l?l:"")?("::"===t.substr(i,2)?(c="::",i+=2):(c=null,a('"::"')),null!==c?e=[e,n,r,s,o,u,l,c]:(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A)):(e=null,i=A))))))))))))))),null!==e&&(e=function(e){return Hn.host_type="IPv6",t.substring(i,e)}(_)),null===e&&(i=_),e}function fe(){var e,t,n,r,s;return s=i,null!==(e=h())&&null!==(t=null!==(t=h())?t:"")&&null!==(n=null!==(n=h())?n:"")&&null!==(r=null!==(r=h())?r:"")?e=[e,t,n,r]:(e=null,i=s),e}function pe(){var e,n,r,s;return s=i,null!==(e=fe())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n&&null!==(r=fe())?e=[e,n,r]:(e=null,i=s)):(e=null,i=s),null===e&&(e=ge()),e}function ge(){var e,n,r,s,o,u,l,c,h;return c=i,h=i,null!==(e=_e())?(46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null!==n&&null!==(r=_e())?(46===t.charCodeAt(i)?(s=".",i++):(s=null,a('"."')),null!==s&&null!==(o=_e())?(46===t.charCodeAt(i)?(u=".",i++):(u=null,a('"."')),null!==u&&null!==(l=_e())?e=[e,n,r,s,o,u,l]:(e=null,i=h)):(e=null,i=h)):(e=null,i=h)):(e=null,i=h),null!==e&&(e=function(e){return Hn.host_type="IPv4",t.substring(i,e)}(c)),null===e&&(i=c),e}function _e(){var e,n,r,s;return s=i,"25"===t.substr(i,2)?(e="25",i+=2):(e=null,a('"25"')),null!==e?(/^[0-5]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[0-5]")),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null===e&&(s=i,50===t.charCodeAt(i)?(e="2",i++):(e=null,a('"2"')),null!==e?(/^[0-4]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,a("[0-4]")),null!==n&&null!==(r=l())?e=[e,n,r]:(e=null,i=s)):(e=null,i=s),null===e&&(s=i,49===t.charCodeAt(i)?(e="1",i++):(e=null,a('"1"')),null!==e&&null!==(n=l())&&null!==(r=l())?e=[e,n,r]:(e=null,i=s),null===e&&(s=i,/^[1-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,a("[1-9]")),null!==e&&null!==(n=l())?e=[e,n]:(e=null,i=s),null===e&&(e=l())))),e}function Ae(){var e,t,n,r,s,o,a,u;return o=i,a=i,null!==(e=null!==(e=l())?e:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(s=null!==(s=l())?s:"")?e=[e,t,n,r,s]:(e=null,i=a),null!==e&&(u=e,u=parseInt(u.join("")),Hn.port=u,e=u),null===e&&(i=o),e}function me(){var e,n,r,s;for(e=[],s=i,59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null!==n&&null!==(r=ve())?n=[n,r]:(n=null,i=s);null!==n;)e.push(n),s=i,59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null!==n&&null!==(r=ve())?n=[n,r]:(n=null,i=s);return e}function ve(){var e;return null===(e=ye())&&null===(e=Te())&&null===(e=Se())&&null===(e=Ce())&&null===(e=Ee())&&null===(e=we())&&(e=be()),e}function ye(){var e,n,r,s;return r=i,s=i,"transport="===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,a('"transport="')),null!==e?("udp"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,a('"udp"')),null===n&&("tcp"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,a('"tcp"')),null===n&&("sctp"===t.substr(i,4).toLowerCase()?(n=t.substr(i,4),i+=4):(n=null,a('"sctp"')),null===n&&("tls"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,a('"tls"')),null===n&&(n=O())))),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null!==e&&(e=function(e,t){Hn.uri_params||(Hn.uri_params={}),Hn.uri_params.transport=t.toLowerCase()}(0,e[1])),null===e&&(i=r),e}function Te(){var e,n,r,s,o;return r=i,s=i,"user="===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"user="')),null!==e?("phone"===t.substr(i,5).toLowerCase()?(n=t.substr(i,5),i+=5):(n=null,a('"phone"')),null===n&&("ip"===t.substr(i,2).toLowerCase()?(n=t.substr(i,2),i+=2):(n=null,a('"ip"')),null===n&&(n=O())),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null!==e&&(o=e[1],Hn.uri_params||(Hn.uri_params={}),e=void(Hn.uri_params.user=o.toLowerCase())),null===e&&(i=r),e}function Se(){var e,n,r,s,o;return r=i,s=i,"method="===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"method="')),null!==e&&null!==(n=ct())?e=[e,n]:(e=null,i=s),null!==e&&(o=e[1],Hn.uri_params||(Hn.uri_params={}),e=void(Hn.uri_params.method=o)),null===e&&(i=r),e}function Ce(){var e,n,r,s,o;return r=i,s=i,"ttl="===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"ttl="')),null!==e&&null!==(n=wn())?e=[e,n]:(e=null,i=s),null!==e&&(o=e[1],Hn.params||(Hn.params={}),e=void(Hn.params.ttl=o)),null===e&&(i=r),e}function Ee(){var e,n,r,s,o;return r=i,s=i,"maddr="===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"maddr="')),null!==e&&null!==(n=ae())?e=[e,n]:(e=null,i=s),null!==e&&(o=e[1],Hn.uri_params||(Hn.uri_params={}),e=void(Hn.uri_params.maddr=o)),null===e&&(i=r),e}function we(){var e,n,r,s,o,u;return s=i,o=i,"lr"===t.substr(i,2).toLowerCase()?(e=t.substr(i,2),i+=2):(e=null,a('"lr"')),null!==e?(u=i,61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null!==n&&null!==(r=O())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(Hn.uri_params||(Hn.uri_params={}),e=void(Hn.uri_params.lr=void 0)),null===e&&(i=s),e}function be(){var e,n,r,s,o,u,l,c;return s=i,o=i,null!==(e=Ie())?(u=i,61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null!==n&&null!==(r=Re())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(l=e[0],c=e[1],Hn.uri_params||(Hn.uri_params={}),c=void 0===c?void 0:c[1],e=void(Hn.uri_params[l.toLowerCase()]=c)),null===e&&(i=s),e}function Ie(){var e,t,n;if(n=i,null!==(t=Oe()))for(e=[];null!==t;)e.push(t),t=Oe();else e=null;return null!==e&&(e=e.join("")),null===e&&(i=n),e}function Re(){var e,t,n;if(n=i,null!==(t=Oe()))for(e=[];null!==t;)e.push(t),t=Oe();else e=null;return null!==e&&(e=e.join("")),null===e&&(i=n),e}function Oe(){var e;return null===(e=ke())&&null===(e=v())&&(e=T()),e}function ke(){var e;return 91===t.charCodeAt(i)?(e="[",i++):(e=null,a('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,a('"]"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')))))))),e}function De(){var e,n,r,s,o,u,l;if(u=i,63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null!==e)if(null!==(n=qe())){for(r=[],l=i,38===t.charCodeAt(i)?(s="&",i++):(s=null,a('"&"')),null!==s&&null!==(o=qe())?s=[s,o]:(s=null,i=l);null!==s;)r.push(s),l=i,38===t.charCodeAt(i)?(s="&",i++):(s=null,a('"&"')),null!==s&&null!==(o=qe())?s=[s,o]:(s=null,i=l);null!==r?e=[e,n,r]:(e=null,i=u)}else e=null,i=u;else e=null,i=u;return e}function qe(){var e,n,r,s,o,u,l;return s=i,o=i,null!==(e=Me())?(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null!==n&&null!==(r=Ne())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(u=e[0],l=e[2],u=u.join("").toLowerCase(),l=l.join(""),Hn.uri_headers||(Hn.uri_headers={}),e=void(Hn.uri_headers[u]?Hn.uri_headers[u].push(l):Hn.uri_headers[u]=[l])),null===e&&(i=s),e}function Me(){var e,t;if(null===(t=Ue())&&null===(t=v())&&(t=T()),null!==t)for(e=[];null!==t;)e.push(t),null===(t=Ue())&&null===(t=v())&&(t=T());else e=null;return e}function Ne(){var e,t;for(e=[],null===(t=Ue())&&null===(t=v())&&(t=T());null!==t;)e.push(t),null===(t=Ue())&&null===(t=v())&&(t=T());return e}function Ue(){var e;return 91===t.charCodeAt(i)?(e="[",i++):(e=null,a('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,a('"]"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')))))))),e}function xe(){var e,t,n,r,s,o;return o=i,null!==(e=ct())&&null!==(t=g())&&null!==(n=Le())&&null!==(r=g())&&null!==(s=et())?e=[e,t,n,r,s]:(e=null,i=o),e}function Le(){var e;return null===(e=X())&&(e=Be()),e}function Be(){var e,n,r,s;return s=i,null!==(e=ze())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null!==n?(null===(r=Pe())&&(r=Ge()),null!==r?e=[e,n,r]:(e=null,i=s)):(e=null,i=s)):(e=null,i=s),e}function Pe(){var e,n,r,s,o;return s=i,null===(e=Fe())&&(e=He()),null!==e?(o=i,63===t.charCodeAt(i)?(n="?",i++):(n=null,a('"?"')),null!==n&&null!==(r=$e())?n=[n,r]:(n=null,i=o),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=s)):(e=null,i=s),e}function Fe(){var e,n,r,s;return s=i,"//"===t.substr(i,2)?(e="//",i+=2):(e=null,a('"//"')),null!==e&&null!==(n=Ve())&&null!==(r=null!==(r=He())?r:"")?e=[e,n,r]:(e=null,i=s),e}function He(){var e,n,r;return r=i,47===t.charCodeAt(i)?(e="/",i++):(e=null,a('"/"')),null!==e&&null!==(n=Qe())?e=[e,n]:(e=null,i=r),e}function Ge(){var e,t,n,r;if(r=i,null!==(e=je())){for(t=[],n=Ye();null!==n;)t.push(n),n=Ye();null!==t?e=[e,t]:(e=null,i=r)}else e=null,i=r;return e}function Ye(){var e;return null===(e=m())&&null===(e=v())&&(e=T()),e}function je(){var e;return null===(e=v())&&null===(e=T())&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,a('";"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,a('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,a('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","'))))))))))),e}function Qe(){var e,n,r,s,o,u;if(o=i,null!==(e=We())){for(n=[],u=i,47===t.charCodeAt(i)?(r="/",i++):(r=null,a('"/"')),null!==r&&null!==(s=We())?r=[r,s]:(r=null,i=u);null!==r;)n.push(r),u=i,47===t.charCodeAt(i)?(r="/",i++):(r=null,a('"/"')),null!==r&&null!==(s=We())?r=[r,s]:(r=null,i=u);null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return e}function We(){var e,n,r,s,o,u;for(o=i,e=[],n=Je();null!==n;)e.push(n),n=Je();if(null!==e){for(n=[],u=i,59===t.charCodeAt(i)?(r=";",i++):(r=null,a('";"')),null!==r&&null!==(s=Ke())?r=[r,s]:(r=null,i=u);null!==r;)n.push(r),u=i,59===t.charCodeAt(i)?(r=";",i++):(r=null,a('";"')),null!==r&&null!==(s=Ke())?r=[r,s]:(r=null,i=u);null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return e}function Ke(){var e,t;for(e=[],t=Je();null!==t;)e.push(t),t=Je();return e}function Je(){var e;return null===(e=v())&&null===(e=T())&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,a('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,a('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,a('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,a('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,a('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,a('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,a('","'))))))))),e}function ze(){var e,n,r,s,o;if(s=i,o=i,null!==(e=c())){for(n=[],null===(r=c())&&null===(r=l())&&(43===t.charCodeAt(i)?(r="+",i++):(r=null,a('"+"')),null===r&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')))));null!==r;)n.push(r),null===(r=c())&&null===(r=l())&&(43===t.charCodeAt(i)?(r="+",i++):(r=null,a('"+"')),null===r&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,a('"-"')),null===r&&(46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')))));null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return null!==e&&(e=function(e){Hn.scheme=t.substring(i,e)}(s)),null===e&&(i=s),e}function Ve(){var e;return null===(e=Ze())&&(e=Xe()),e}function Ze(){var e,n,r,s;return r=i,s=i,null!==(e=ne())?(64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null!==n?e=[e,n]:(e=null,i=s)):(e=null,i=s),null!==(e=null!==e?e:"")&&null!==(n=oe())?e=[e,n]:(e=null,i=r),e=null!==e?e:""}function Xe(){var e,n;if(null===(n=v())&&null===(n=T())&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,a('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')),null===n&&(59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null===n&&(64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null===n&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,a('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"')))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=v())&&null===(n=T())&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,a('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,a('","')),null===n&&(59===t.charCodeAt(i)?(n=";",i++):(n=null,a('";"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,a('":"')),null===n&&(64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null===n&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,a('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,a('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,a('"+"'))))))))));else e=null;return e}function $e(){var e,t;for(e=[],t=Ye();null!==t;)e.push(t),t=Ye();return e}function et(){var e,n,r,s,o,u,c,h;if(c=i,h=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"SIP"')),null!==e)if(47===t.charCodeAt(i)?(n="/",i++):(n=null,a('"/"')),null!==n){if(null!==(s=l()))for(r=[];null!==s;)r.push(s),s=l();else r=null;if(null!==r)if(46===t.charCodeAt(i)?(s=".",i++):(s=null,a('"."')),null!==s){if(null!==(u=l()))for(o=[];null!==u;)o.push(u),u=l();else o=null;null!==o?e=[e,n,r,s,o]:(e=null,i=h)}else e=null,i=h;else e=null,i=h}else e=null,i=h;else e=null,i=h;return null!==e&&(e=function(e){Hn.sip_version=t.substring(i,e)}(c)),null===e&&(i=c),e}function tt(){var e;return"INVITE"===t.substr(i,6)?(e="INVITE",i+=6):(e=null,a('"INVITE"')),e}function nt(){var e;return"ACK"===t.substr(i,3)?(e="ACK",i+=3):(e=null,a('"ACK"')),e}function rt(){var e;return"OPTIONS"===t.substr(i,7)?(e="OPTIONS",i+=7):(e=null,a('"OPTIONS"')),e}function it(){var e;return"BYE"===t.substr(i,3)?(e="BYE",i+=3):(e=null,a('"BYE"')),e}function st(){var e;return"CANCEL"===t.substr(i,6)?(e="CANCEL",i+=6):(e=null,a('"CANCEL"')),e}function ot(){var e;return"REGISTER"===t.substr(i,8)?(e="REGISTER",i+=8):(e=null,a('"REGISTER"')),e}function at(){var e;return"SUBSCRIBE"===t.substr(i,9)?(e="SUBSCRIBE",i+=9):(e=null,a('"SUBSCRIBE"')),e}function ut(){var e;return"NOTIFY"===t.substr(i,6)?(e="NOTIFY",i+=6):(e=null,a('"NOTIFY"')),e}function lt(){var e;return"REFER"===t.substr(i,5)?(e="REFER",i+=5):(e=null,a('"REFER"')),e}function ct(){var e,n;return n=i,null===(e=tt())&&null===(e=nt())&&null===(e=rt())&&null===(e=it())&&null===(e=st())&&null===(e=ot())&&null===(e=at())&&null===(e=ut())&&null===(e=lt())&&(e=O()),null!==e&&(e=function(e){return Hn.method=t.substring(i,e),Hn.method}(n)),null===e&&(i=n),e}function ht(){var e,t,n,r,s,o;return o=i,null!==(e=et())&&null!==(t=g())&&null!==(n=dt())&&null!==(r=g())&&null!==(s=pt())?e=[e,t,n,r,s]:(e=null,i=o),e}function dt(){var e,t,n;return t=i,null!==(e=ft())&&(n=e,e=void(Hn.status_code=parseInt(n.join("")))),null===e&&(i=t),e}function ft(){var e,t,n,r;return r=i,null!==(e=l())&&null!==(t=l())&&null!==(n=l())?e=[e,t,n]:(e=null,i=r),e}function pt(){var e,n,r;for(r=i,e=[],null===(n=m())&&null===(n=v())&&null===(n=T())&&null===(n=I())&&null===(n=R())&&null===(n=g())&&(n=_());null!==n;)e.push(n),null===(n=m())&&null===(n=v())&&null===(n=T())&&null===(n=I())&&null===(n=R())&&null===(n=g())&&(n=_());return null!==e&&(e=function(e){Hn.reason_phrase=t.substring(i,e)}(r)),null===e&&(i=r),e}function gt(){var e,t,n,r,s,o,a;if(s=i,o=i,null===(e=Z())&&(e=_t()),null!==e){for(t=[],a=i,null!==(n=G())&&null!==(r=mt())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=mt())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return null!==e&&(e=function(e){var t;Hn.multi_header||(Hn.multi_header=[]);try{t=new Fn(Hn.uri,Hn.display_name,Hn.params),delete Hn.uri,delete Hn.display_name,delete Hn.params}catch(e){t=null}Hn.multi_header.push({possition:i,offset:e,parsed:t})}(s)),null===e&&(i=s),e}function _t(){var e,t,n,r,s;return s=i,null!==(e=null!==(e=At())?e:"")&&null!==(t=F())&&null!==(n=X())&&null!==(r=P())?e=[e,t,n,r]:(e=null,i=s),e}function At(){var e,t,n,r,s,o,a,u;if(s=i,o=i,null!==(e=O())){for(t=[],a=i,null!==(n=S())&&null!==(r=O())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=S())&&null!==(r=O())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return null===e&&(e=J()),null!==e&&(u=e,e=void(Hn.display_name="string"==typeof u?u:u[1].reduce(function(e,t){return e+t[0]+t[1]},u[0]))),null===e&&(i=s),e}function mt(){var e;return null===(e=vt())&&null===(e=yt())&&(e=Ct()),e}function vt(){var e,n,r,s,o,u;return s=i,o=i,"q"===t.substr(i,1).toLowerCase()?(e=t.substr(i,1),i++):(e=null,a('"q"')),null!==e&&null!==(n=U())&&null!==(r=St())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],Hn.params||(Hn.params={}),e=void(Hn.params.q=u)),null===e&&(i=s),e}function yt(){var e,n,r,s,o,u;return s=i,o=i,"expires"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"expires"')),null!==e&&null!==(n=U())&&null!==(r=Tt())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],Hn.params||(Hn.params={}),e=void(Hn.params.expires=u)),null===e&&(i=s),e}function Tt(){var e,t,n;if(n=i,null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null!==e&&(e=parseInt(e.join(""))),null===e&&(i=n),e}function St(){var e,n,r,s,o,u,c,h;return u=i,c=i,48===t.charCodeAt(i)?(e="0",i++):(e=null,a('"0"')),null!==e?(h=i,46===t.charCodeAt(i)?(n=".",i++):(n=null,a('"."')),null!==n&&null!==(r=null!==(r=l())?r:"")&&null!==(s=null!==(s=l())?s:"")&&null!==(o=null!==(o=l())?o:"")?n=[n,r,s,o]:(n=null,i=h),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=c)):(e=null,i=c),null!==e&&(e=function(e){return parseFloat(t.substring(i,e))}(u)),null===e&&(i=u),e}function Ct(){var e,t,n,r,s,o,a,u;return r=i,s=i,null!==(e=O())?(o=i,null!==(t=U())&&null!==(n=Et())?t=[t,n]:(t=null,i=o),null!==(t=null!==t?t:"")?e=[e,t]:(e=null,i=s)):(e=null,i=s),null!==e&&(a=e[0],u=e[1],Hn.params||(Hn.params={}),u=void 0===u?void 0:u[1],e=void(Hn.params[a.toLowerCase()]=u)),null===e&&(i=r),e}function Et(){var e;return null===(e=O())&&null===(e=ae())&&(e=K()),e}function wt(){var e;return"render"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"render"')),null===e&&("session"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"session"')),null===e&&("icon"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"icon"')),null===e&&("alert"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"alert"')),null===e&&(e=O())))),e}function bt(){var e;return null===(e=It())&&(e=Ct()),e}function It(){var e,n,r,s;return s=i,"handling"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,a('"handling"')),null!==e&&null!==(n=U())?("optional"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,a('"optional"')),null===r&&("required"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,a('"required"')),null===r&&(r=O())),null!==r?e=[e,n,r]:(e=null,i=s)):(e=null,i=s),e}function Rt(){var e,t,n,r,s,o,a,u;if(a=i,null!==(e=Ot()))if(null!==(t=M()))if(null!==(n=Nt())){for(r=[],u=i,null!==(s=G())&&null!==(o=Ut())?s=[s,o]:(s=null,i=u);null!==s;)r.push(s),u=i,null!==(s=G())&&null!==(o=Ut())?s=[s,o]:(s=null,i=u);null!==r?e=[e,t,n,r]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;else e=null,i=a;return e}function Ot(){var e;return null===(e=kt())&&(e=Dt()),e}function kt(){var e;return"text"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"text"')),null===e&&("image"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"image"')),null===e&&("audio"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"audio"')),null===e&&("video"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"video"')),null===e&&("application"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,a('"application"')),null===e&&(e=qt()))))),e}function Dt(){var e;return"message"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"message"')),null===e&&("multipart"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"multipart"')),null===e&&(e=qt())),e}function qt(){var e;return null===(e=O())&&(e=Mt()),e}function Mt(){var e,n,r;return r=i,"x-"===t.substr(i,2).toLowerCase()?(e=t.substr(i,2),i+=2):(e=null,a('"x-"')),null!==e&&null!==(n=O())?e=[e,n]:(e=null,i=r),e}function Nt(){var e;return null===(e=qt())&&(e=O()),e}function Ut(){var e,t,n,r;return r=i,null!==(e=O())&&null!==(t=U())&&null!==(n=xt())?e=[e,t,n]:(e=null,i=r),e}function xt(){var e;return null===(e=O())&&(e=K()),e}function Lt(){var e,t,n,r;if(n=i,null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null!==e&&(r=e,e=void(Hn.value=parseInt(r.join("")))),null===e&&(i=n),e}function Bt(){var e,n,r,s,o,u;if(o=i,null!==(e=k())){for(n=[],u=i,46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==r&&null!==(s=k())?r=[r,s]:(r=null,i=u);null!==r;)n.push(r),u=i,46===t.charCodeAt(i)?(r=".",i++):(r=null,a('"."')),null!==r&&null!==(s=k())?r=[r,s]:(r=null,i=u);null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return e}function Pt(){var e;return null===(e=Ft())&&(e=Ct()),e}function Ft(){var e,n,r,s,o,u;return s=i,o=i,"tag"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"tag"')),null!==e&&null!==(n=U())&&null!==(r=O())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.tag=u)),null===e&&(i=s),e}function Ht(){var e,n,r,s,o,u,l,c;if(l=i,"digest"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"Digest"')),null!==e)if(null!==(n=S()))if(null!==(r=jt())){for(s=[],c=i,null!==(o=H())&&null!==(u=jt())?o=[o,u]:(o=null,i=c);null!==o;)s.push(o),c=i,null!==(o=H())&&null!==(u=jt())?o=[o,u]:(o=null,i=c);null!==s?e=[e,n,r,s]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;else e=null,i=l;return null===e&&(e=Gt()),e}function Gt(){var e,t,n,r,s,o,a,u;if(a=i,null!==(e=O()))if(null!==(t=S()))if(null!==(n=Yt())){for(r=[],u=i,null!==(s=H())&&null!==(o=Yt())?s=[s,o]:(s=null,i=u);null!==s;)r.push(s),u=i,null!==(s=H())&&null!==(o=Yt())?s=[s,o]:(s=null,i=u);null!==r?e=[e,t,n,r]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;else e=null,i=a;return e}function Yt(){var e,t,n,r;return r=i,null!==(e=O())&&null!==(t=U())?(null===(n=O())&&(n=K()),null!==n?e=[e,t,n]:(e=null,i=r)):(e=null,i=r),e}function jt(){var e;return null===(e=Qt())&&null===(e=Kt())&&null===(e=zt())&&null===(e=Zt())&&null===(e=Xt())&&null===(e=$t())&&null===(e=en())&&(e=Yt()),e}function Qt(){var e,n,r,s;return s=i,"realm"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"realm"')),null!==e&&null!==(n=U())&&null!==(r=Wt())?e=[e,n,r]:(e=null,i=s),e}function Wt(){var e,t,n;return t=i,null!==(e=J())&&(n=e,e=void(Hn.realm=n)),null===e&&(i=t),e}function Kt(){var e,n,r,s,o,u,l,c,h;if(c=i,"domain"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"domain"')),null!==e)if(null!==(n=U()))if(null!==(r=j()))if(null!==(s=Jt())){if(o=[],h=i,null!==(l=g()))for(u=[];null!==l;)u.push(l),l=g();else u=null;for(null!==u&&null!==(l=Jt())?u=[u,l]:(u=null,i=h);null!==u;){if(o.push(u),h=i,null!==(l=g()))for(u=[];null!==l;)u.push(l),l=g();else u=null;null!==u&&null!==(l=Jt())?u=[u,l]:(u=null,i=h)}null!==o&&null!==(u=Q())?e=[e,n,r,s,o,u]:(e=null,i=c)}else e=null,i=c;else e=null,i=c;else e=null,i=c;else e=null,i=c;return e}function Jt(){var e;return null===(e=Be())&&(e=He()),e}function zt(){var e,n,r,s;return s=i,"nonce"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"nonce"')),null!==e&&null!==(n=U())&&null!==(r=Vt())?e=[e,n,r]:(e=null,i=s),e}function Vt(){var e,t,n;return t=i,null!==(e=J())&&(n=e,e=void(Hn.nonce=n)),null===e&&(i=t),e}function Zt(){var e,n,r,s,o,u;return s=i,o=i,"opaque"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"opaque"')),null!==e&&null!==(n=U())&&null!==(r=J())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.opaque=u)),null===e&&(i=s),e}function Xt(){var e,n,r,s,o;return s=i,"stale"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"stale"')),null!==e&&null!==(n=U())?(o=i,"true"===t.substr(i,4).toLowerCase()?(r=t.substr(i,4),i+=4):(r=null,a('"true"')),null!==r&&(r=void(Hn.stale=!0)),null===r&&(i=o),null===r&&(o=i,"false"===t.substr(i,5).toLowerCase()?(r=t.substr(i,5),i+=5):(r=null,a('"false"')),null!==r&&(r=void(Hn.stale=!1)),null===r&&(i=o)),null!==r?e=[e,n,r]:(e=null,i=s)):(e=null,i=s),e}function $t(){var e,n,r,s,o,u;return s=i,o=i,"algorithm"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"algorithm"')),null!==e&&null!==(n=U())?("md5"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,a('"MD5"')),null===r&&("md5-sess"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,a('"MD5-sess"')),null===r&&(r=O())),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.algorithm=u.toUpperCase())),null===e&&(i=s),e}function en(){var e,n,r,s,o,u,l,c,h,d;if(c=i,"qop"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"qop"')),null!==e)if(null!==(n=U()))if(null!==(r=j())){if(h=i,null!==(s=tn())){for(o=[],d=i,44===t.charCodeAt(i)?(u=",",i++):(u=null,a('","')),null!==u&&null!==(l=tn())?u=[u,l]:(u=null,i=d);null!==u;)o.push(u),d=i,44===t.charCodeAt(i)?(u=",",i++):(u=null,a('","')),null!==u&&null!==(l=tn())?u=[u,l]:(u=null,i=d);null!==o?s=[s,o]:(s=null,i=h)}else s=null,i=h;null!==s&&null!==(o=Q())?e=[e,n,r,s,o]:(e=null,i=c)}else e=null,i=c;else e=null,i=c;else e=null,i=c;return e}function tn(){var e,n,r;return n=i,"auth-int"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,a('"auth-int"')),null===e&&("auth"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"auth"')),null===e&&(e=O())),null!==e&&(r=e,Hn.qop||(Hn.qop=[]),e=void Hn.qop.push(r.toLowerCase())),null===e&&(i=n),e}function nn(){var e,t,n,r,s,o,a;if(s=i,o=i,null!==(e=_t())){for(t=[],a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return null!==e&&(e=function(e){var t;Hn.multi_header||(Hn.multi_header=[]);try{t=new Fn(Hn.uri,Hn.display_name,Hn.params),delete Hn.uri,delete Hn.display_name,delete Hn.params}catch(e){t=null}Hn.multi_header.push({possition:i,offset:e,parsed:t})}(s)),null===e&&(i=s),e}function rn(){var e;return null===(e=sn())&&(e=Ct()),e}function sn(){var e,n,r,s,o,u,c;if(o=i,u=i,"cause"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"cause"')),null!==e)if(null!==(n=U())){if(null!==(s=l()))for(r=[];null!==s;)r.push(s),s=l();else r=null;null!==r?e=[e,n,r]:(e=null,i=u)}else e=null,i=u;else e=null,i=u;return null!==e&&(c=e[2],e=void(Hn.cause=parseInt(c.join("")))),null===e&&(i=o),e}function on(){var e,t,n,r,s,o;if(s=i,null!==(e=_t())){for(t=[],o=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=o);null!==n;)t.push(n),o=i,null!==(n=G())&&null!==(r=Ct())?n=[n,r]:(n=null,i=o);null!==t?e=[e,t]:(e=null,i=s)}else e=null,i=s;return e}function an(){var e,n;return n=i,"active"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"active"')),null===e&&("pending"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"pending"')),null===e&&("terminated"===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,a('"terminated"')),null===e&&(e=O()))),null!==e&&(e=function(e){Hn.state=t.substring(i,e)}(n)),null===e&&(i=n),e}function un(){var e,n,r,s,o,u,l,c;return s=i,o=i,"reason"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"reason"')),null!==e&&null!==(n=U())&&null!==(r=ln())?e=[e,n,r]:(e=null,i=o),null!==e&&(e=void(void 0!==(u=e[2])&&(Hn.reason=u))),null===e&&(i=s),null===e&&(s=i,o=i,"expires"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"expires"')),null!==e&&null!==(n=U())&&null!==(r=Tt())?e=[e,n,r]:(e=null,i=o),null!==e&&(e=void(void 0!==(c=e[2])&&(Hn.expires=c))),null===e&&(i=s),null===e&&(s=i,o=i,"retry_after"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,a('"retry_after"')),null!==e&&null!==(n=U())&&null!==(r=Tt())?e=[e,n,r]:(e=null,i=o),null!==e&&(e=void(void 0!==(l=e[2])&&(Hn.retry_after=l))),null===e&&(i=s),null===e&&(e=Ct()))),e}function ln(){var e;return"deactivated"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,a('"deactivated"')),null===e&&("probation"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"probation"')),null===e&&("rejected"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,a('"rejected"')),null===e&&("timeout"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,a('"timeout"')),null===e&&("giveup"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"giveup"')),null===e&&("noresource"===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,a('"noresource"')),null===e&&("invariant"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"invariant"')),null===e&&(e=O()))))))),e}function cn(){var e;return null===(e=Ft())&&(e=Ct()),e}function hn(){var e,t,n,r,s,o,a,u;if(a=i,null!==(e=vn()))if(null!==(t=S()))if(null!==(n=Sn())){for(r=[],u=i,null!==(s=G())&&null!==(o=dn())?s=[s,o]:(s=null,i=u);null!==s;)r.push(s),u=i,null!==(s=G())&&null!==(o=dn())?s=[s,o]:(s=null,i=u);null!==r?e=[e,t,n,r]:(e=null,i=a)}else e=null,i=a;else e=null,i=a;else e=null,i=a;return e}function dn(){var e;return null===(e=fn())&&null===(e=pn())&&null===(e=gn())&&null===(e=_n())&&null===(e=An())&&(e=Ct()),e}function fn(){var e,n,r,s,o,u;return s=i,o=i,"ttl"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"ttl"')),null!==e&&null!==(n=U())&&null!==(r=wn())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.ttl=u)),null===e&&(i=s),e}function pn(){var e,n,r,s,o,u;return s=i,o=i,"maddr"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"maddr"')),null!==e&&null!==(n=U())&&null!==(r=ae())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.maddr=u)),null===e&&(i=s),e}function gn(){var e,n,r,s,o,u;return s=i,o=i,"received"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,a('"received"')),null!==e&&null!==(n=U())?(null===(r=ge())&&(r=de()),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.received=u)),null===e&&(i=s),e}function _n(){var e,n,r,s,o,u;return s=i,o=i,"branch"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,a('"branch"')),null!==e&&null!==(n=U())&&null!==(r=O())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.branch=u)),null===e&&(i=s),e}function An(){var e,n,r,s,o;return s=i,"rport"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,a('"rport"')),null!==e?(o=i,null!==(n=U())&&null!==(r=mn())?n=[n,r]:(n=null,i=o),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=s)):(e=null,i=s),e}function mn(){var e,t,n,r,s,o,a,u;return o=i,a=i,null!==(e=null!==(e=l())?e:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(s=null!==(s=l())?s:"")?e=[e,t,n,r,s]:(e=null,i=a),null!==e&&(u=e,e=void(Hn.rport=parseInt(u.join("")))),null===e&&(i=o),e}function vn(){var e,t,n,r,s,o;return o=i,null!==(e=yn())&&null!==(t=M())&&null!==(n=O())&&null!==(r=M())&&null!==(s=Tn())?e=[e,t,n,r,s]:(e=null,i=o),e}function yn(){var e,n,r;return n=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"SIP"')),null===e&&(e=O()),null!==e&&(r=e,e=void(Hn.protocol=r)),null===e&&(i=n),e}function Tn(){var e,n,r;return n=i,"udp"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"UDP"')),null===e&&("tcp"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"TCP"')),null===e&&("tls"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,a('"TLS"')),null===e&&("sctp"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,a('"SCTP"')),null===e&&(e=O())))),null!==e&&(r=e,e=void(Hn.transport=r)),null===e&&(i=n),e}function Sn(){var e,t,n,r,s;return r=i,null!==(e=Cn())?(s=i,null!==(t=Y())&&null!==(n=En())?t=[t,n]:(t=null,i=s),null!==(t=null!==t?t:"")?e=[e,t]:(e=null,i=r)):(e=null,i=r),e}function Cn(){var e,n;return n=i,null===(e=ge())&&null===(e=he())&&(e=ue()),null!==e&&(e=function(e){Hn.host=t.substring(i,e)}(n)),null===e&&(i=n),e}function En(){var e,t,n,r,s,o,a,u;return o=i,a=i,null!==(e=null!==(e=l())?e:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(s=null!==(s=l())?s:"")?e=[e,t,n,r,s]:(e=null,i=a),null!==e&&(u=e,e=void(Hn.port=parseInt(u.join("")))),null===e&&(i=o),e}function wn(){var e,t,n,r,s;return r=i,s=i,null!==(e=l())&&null!==(t=null!==(t=l())?t:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,t,n]:(e=null,i=s),null!==e&&(e=parseInt(e.join(""))),null===e&&(i=r),e}function bn(){var e,t,n;return t=i,null!==(e=Tt())&&(n=e,e=void(Hn.expires=n)),null===e&&(i=t),e}function In(){var e;return null===(e=Rn())&&(e=Ct()),e}function Rn(){var e,n,r,s,o,u;return s=i,o=i,"refresher"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,a('"refresher"')),null!==e&&null!==(n=U())?("uac"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,a('"uac"')),null===r&&("uas"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,a('"uas"'))),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.refresher=u.toLowerCase())),null===e&&(i=s),e}function On(){var e,t;for(e=[],null===(t=b())&&null===(t=R())&&(t=S());null!==t;)e.push(t),null===(t=b())&&null===(t=R())&&(t=S());return e}function kn(){var e,n,r,s,o,u,l,c,h,d,f;return d=i,f=i,null!==(e=qn())?(45===t.charCodeAt(i)?(n="-",i++):(n=null,a('"-"')),null!==n&&null!==(r=Dn())?(45===t.charCodeAt(i)?(s="-",i++):(s=null,a('"-"')),null!==s&&null!==(o=Dn())?(45===t.charCodeAt(i)?(u="-",i++):(u=null,a('"-"')),null!==u&&null!==(l=Dn())?(45===t.charCodeAt(i)?(c="-",i++):(c=null,a('"-"')),null!==c&&null!==(h=Mn())?e=[e,n,r,s,o,u,l,c,h]:(e=null,i=f)):(e=null,i=f)):(e=null,i=f)):(e=null,i=f)):(e=null,i=f),null!==e&&(e=function(e){Hn=t.substring(i+5,e)}(d,e[0])),null===e&&(i=d),e}function Dn(){var e,t,n,r,s;return s=i,null!==(e=h())&&null!==(t=h())&&null!==(n=h())&&null!==(r=h())?e=[e,t,n,r]:(e=null,i=s),e}function qn(){var e,t,n;return n=i,null!==(e=Dn())&&null!==(t=Dn())?e=[e,t]:(e=null,i=n),e}function Mn(){var e,t,n,r;return r=i,null!==(e=Dn())&&null!==(t=Dn())&&null!==(n=Dn())?e=[e,t,n]:(e=null,i=r),e}function Nn(){var e,n,r,s,o,u;return s=i,o=i,null!==(e=D())?(u=i,64===t.charCodeAt(i)?(n="@",i++):(n=null,a('"@"')),null!==n&&null!==(r=D())?n=[n,r]:(n=null,i=u),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(e=function(e){Hn.call_id=t.substring(i,e)}(s)),null===e&&(i=s),e}function Un(){var e;return null===(e=xn())&&null===(e=Ln())&&null===(e=Bn())&&(e=Ct()),e}function xn(){var e,n,r,s,o,u;return s=i,o=i,"to-tag"===t.substr(i,6)?(e="to-tag",i+=6):(e=null,a('"to-tag"')),null!==e&&null!==(n=U())&&null!==(r=O())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.to_tag=u)),null===e&&(i=s),e}function Ln(){var e,n,r,s,o,u;return s=i,o=i,"from-tag"===t.substr(i,8)?(e="from-tag",i+=8):(e=null,a('"from-tag"')),null!==e&&null!==(n=U())&&null!==(r=O())?e=[e,n,r]:(e=null,i=o),null!==e&&(u=e[2],e=void(Hn.from_tag=u)),null===e&&(i=s),e}function Bn(){var e,n;return n=i,"early-only"===t.substr(i,10)?(e="early-only",i+=10):(e=null,a('"early-only"')),null!==e&&(e=void(Hn.early_only=!0)),null===e&&(i=n),e}var Pn=x(),Fn=N(),Hn={};if(null===r[n]()||i!==t.length){var Gn=Math.max(i,s),Yn=Gn<t.length?t.charAt(Gn):null,jn=function(){for(var e=1,n=1,r=!1,o=0;o<Math.max(i,s);o++){var a=t.charAt(o);"\n"===a?(r||e++,n=1,r=!1):"\r"===a||"\u2028"===a||"\u2029"===a?(e++,n=1,r=!0):(n++,r=!1)}return{line:e,column:n}}();return new this.SyntaxError(function(e){e.sort();for(var t=null,n=[],r=0;r<e.length;r++)e[r]!==t&&(n.push(e[r]),t=e[r]);return n}(o),Yn,Gn,jn.line,jn.column),-1}return Hn},toSource:function(){return this._source},SyntaxError:function(t,n,r,i,s){this.name="SyntaxError",this.expected=t,this.found=n,this.message=function(t,n){var r;switch(t.length){case 0:r="end of input";break;case 1:r=t[0];break;default:r=t.slice(0,t.length-1).join(", ")+" or "+t[t.length-1]}return"Expected "+r+" but "+(n?e(n):"end of input")+" found."}(t,n),this.offset=r,this.line=i,this.column=s}};return t.SyntaxError.prototype=Error.prototype,t}()),S}function x(){if(w)return E;function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n){r&&(e=r);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}w=1;var i=c,s=L(),o=U();return E=function(){function t(e,n,r,s){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!r)throw new TypeError('missing or invalid "host" parameter');for(var u in this._parameters={},this._headers={},this._scheme=e||i.SIP,this._user=n,this._host=r,this._port=s,o)Object.prototype.hasOwnProperty.call(o,u)&&this.setParam(u,o[u]);for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&this.setHeader(l,a[l])}return r(t,null,[{key:"parse",value:function(e){return-1!==(e=o.parse(e,"SIP_URI"))?e:void 0}}]),r(t,[{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=null==t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e)){var t=this._parameters[e];return delete this._parameters[e],t}}},{key:"clearParams",value:function(){this._parameters={}}},{key:"setHeader",value:function(e,t){this._headers[s.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){if(e)return this._headers[s.headerize(e)]}},{key:"hasHeader",value:function(e){if(e)return!!this._headers.hasOwnProperty(s.headerize(e))}},{key:"deleteHeader",value:function(e){if(e=s.headerize(e),this._headers.hasOwnProperty(e)){var t=this._headers[e];return delete this._headers[e],t}}},{key:"clearHeaders",value:function(){this._headers={}}},{key:"clone",value:function(){return new t(this._scheme,this._user,this._host,this._port,JSON.parse(JSON.stringify(this._parameters)),JSON.parse(JSON.stringify(this._headers)))}},{key:"toString",value:function(){var t=[],n="".concat(this._scheme,":");for(var r in this._user&&(n+="".concat(s.escapeUser(this._user),"@")),n+=this._host,(this._port||0===this._port)&&(n+=":".concat(this._port)),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,r)&&(n+=";".concat(r),null!==this._parameters[r]&&(n+="=".concat(this._parameters[r])));for(var i in this._headers)if(Object.prototype.hasOwnProperty.call(this._headers,i)){var o,a=e(this._headers[i]);try{for(a.s();!(o=a.n()).done;){var u=o.value;t.push("".concat(i,"=").concat(u))}}catch(e){a.e(e)}finally{a.f()}}return t.length>0&&(n+="?".concat(t.join("&"))),n}},{key:"toAor",value:function(e){var t="".concat(this._scheme,":");return this._user&&(t+="".concat(s.escapeUser(this._user),"@")),t+=this._host,e&&(this._port||0===this._port)&&(t+=":".concat(this._port)),t}},{key:"scheme",get:function(){return this._scheme},set:function(e){this._scheme=e.toLowerCase()}},{key:"user",get:function(){return this._user},set:function(e){this._user=e}},{key:"host",get:function(){return this._host},set:function(e){this._host=e.toLowerCase()}},{key:"port",get:function(){return this._port},set:function(e){this._port=0===e?e:parseInt(e,10)||null}}]),t}(),E}function L(){if(b)return M;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e))||t){r&&(e=r);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}b=1;var r=c,i=x(),s=U();M.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length};var o=M.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)};M.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},M.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},M.isEmpty=function(e){return null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e)},M.hasMethods=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var i=0,s=n;i<s.length;i++){var a=s[i];if(o(e[a]))return!1}return!0};var a=M.createRandomToken=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,r="";for(t=0;t<e;t++)r+=(Math.random()*n|0).toString(n);return r};M.newTag=function(){return a(10)},M.newUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},M.hostType=function(e){if(e)return-1!==(e=s.parse(e,"host"))?e.host_type:void 0};var u=M.escapeUser=function(e){return encodeURIComponent(decodeURIComponent(e)).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")};return M.normalizeTarget=function(e,t){if(e){if(e instanceof i)return e;if("string"==typeof e){var n,s,o,a=e.split("@");switch(a.length){case 1:if(!t)return;n=e,s=t;break;case 2:n=a[0],s=a[1];break;default:n=a.slice(0,a.length-1).join("@"),s=a[a.length-1]}return n=n.replace(/^(sips?|tel):/i,""),/^[-.()]*\+?[0-9\-.()]+$/.test(n)&&(n=n.replace(/[-.()]/g,"")),e="".concat(r.SIP,":").concat(u(n),"@").concat(s),(o=i.parse(e))?o:void 0}}else;},M.headerize=function(e){var t,n={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),i="",s=r.length;for(t=0;t<s;t++)0!==t&&(i+="-"),i+=r[t].charAt(0).toUpperCase()+r[t].substring(1);return n[i]&&(i=n[i]),i},M.sipErrorCause=function(e){for(var t in r.SIP_ERROR_CAUSES)if(-1!==r.SIP_ERROR_CAUSES[t].indexOf(e))return r.causes[t];return r.causes.SIP_FAILURE_CODE},M.getRandomTestNetIP=function(){return"192.0.2.".concat((e=1,t=254,Math.floor(Math.random()*(t-e+1)+e)));var e,t},M.calculateMD5=function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n=2147483648&e,r=2147483648&t,i=1073741824&e,s=1073741824&t,o=(1073741823&e)+(1073741823&t);return i&s?2147483648^o^n^r:i|s?1073741824&o?3221225472^o^n^r:1073741824^o^n^r:o^n^r}function r(e,r,i,s,o,a,u){return e=n(e,n(n(function(e,t,n){return e&t|~e&n}(r,i,s),o),u)),n(t(e,a),r)}function i(e,r,i,s,o,a,u){return e=n(e,n(n(function(e,t,n){return e&n|t&~n}(r,i,s),o),u)),n(t(e,a),r)}function s(e,r,i,s,o,a,u){return e=n(e,n(n(function(e,t,n){return e^t^n}(r,i,s),o),u)),n(t(e,a),r)}function o(e,r,i,s,o,a,u){return e=n(e,n(n(function(e,t,n){return t^(e|~n)}(r,i,s),o),u)),n(t(e,a),r)}function a(e){var t,n="",r="";for(t=0;t<=3;t++)n+=(r="0".concat((e>>>8*t&255).toString(16))).substr(r.length-2,2);return n}var u,l,c,h,d,f,p,g,_,A;for(u=function(e){for(var t,n=e.length,r=n+8,i=16*((r-r%64)/64+1),s=new Array(i-1),o=0,a=0;a<n;)o=a%4*8,s[t=(a-a%4)/4]=s[t]|e.charCodeAt(a)<<o,a++;return o=a%4*8,s[t=(a-a%4)/4]=s[t]|128<<o,s[i-2]=n<<3,s[i-1]=n>>>29,s}(e=function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e)),p=1732584193,g=4023233417,_=2562383102,A=271733878,l=0;l<u.length;l+=16)c=p,h=g,d=_,f=A,p=r(p,g,_,A,u[l+0],7,3614090360),A=r(A,p,g,_,u[l+1],12,3905402710),_=r(_,A,p,g,u[l+2],17,606105819),g=r(g,_,A,p,u[l+3],22,3250441966),p=r(p,g,_,A,u[l+4],7,4118548399),A=r(A,p,g,_,u[l+5],12,1200080426),_=r(_,A,p,g,u[l+6],17,2821735955),g=r(g,_,A,p,u[l+7],22,4249261313),p=r(p,g,_,A,u[l+8],7,1770035416),A=r(A,p,g,_,u[l+9],12,2336552879),_=r(_,A,p,g,u[l+10],17,4294925233),g=r(g,_,A,p,u[l+11],22,2304563134),p=r(p,g,_,A,u[l+12],7,1804603682),A=r(A,p,g,_,u[l+13],12,4254626195),_=r(_,A,p,g,u[l+14],17,2792965006),p=i(p,g=r(g,_,A,p,u[l+15],22,1236535329),_,A,u[l+1],5,4129170786),A=i(A,p,g,_,u[l+6],9,3225465664),_=i(_,A,p,g,u[l+11],14,643717713),g=i(g,_,A,p,u[l+0],20,3921069994),p=i(p,g,_,A,u[l+5],5,3593408605),A=i(A,p,g,_,u[l+10],9,38016083),_=i(_,A,p,g,u[l+15],14,3634488961),g=i(g,_,A,p,u[l+4],20,3889429448),p=i(p,g,_,A,u[l+9],5,568446438),A=i(A,p,g,_,u[l+14],9,3275163606),_=i(_,A,p,g,u[l+3],14,4107603335),g=i(g,_,A,p,u[l+8],20,1163531501),p=i(p,g,_,A,u[l+13],5,2850285829),A=i(A,p,g,_,u[l+2],9,4243563512),_=i(_,A,p,g,u[l+7],14,1735328473),p=s(p,g=i(g,_,A,p,u[l+12],20,2368359562),_,A,u[l+5],4,4294588738),A=s(A,p,g,_,u[l+8],11,2272392833),_=s(_,A,p,g,u[l+11],16,1839030562),g=s(g,_,A,p,u[l+14],23,4259657740),p=s(p,g,_,A,u[l+1],4,2763975236),A=s(A,p,g,_,u[l+4],11,1272893353),_=s(_,A,p,g,u[l+7],16,4139469664),g=s(g,_,A,p,u[l+10],23,3200236656),p=s(p,g,_,A,u[l+13],4,681279174),A=s(A,p,g,_,u[l+0],11,3936430074),_=s(_,A,p,g,u[l+3],16,3572445317),g=s(g,_,A,p,u[l+6],23,76029189),p=s(p,g,_,A,u[l+9],4,3654602809),A=s(A,p,g,_,u[l+12],11,3873151461),_=s(_,A,p,g,u[l+15],16,530742520),p=o(p,g=s(g,_,A,p,u[l+2],23,3299628645),_,A,u[l+0],6,4096336452),A=o(A,p,g,_,u[l+7],10,1126891415),_=o(_,A,p,g,u[l+14],15,2878612391),g=o(g,_,A,p,u[l+5],21,4237533241),p=o(p,g,_,A,u[l+12],6,1700485571),A=o(A,p,g,_,u[l+3],10,2399980690),_=o(_,A,p,g,u[l+10],15,4293915773),g=o(g,_,A,p,u[l+1],21,2240044497),p=o(p,g,_,A,u[l+8],6,1873313359),A=o(A,p,g,_,u[l+15],10,4264355552),_=o(_,A,p,g,u[l+6],15,2734768916),g=o(g,_,A,p,u[l+13],21,1309151649),p=o(p,g,_,A,u[l+4],6,4149444226),A=o(A,p,g,_,u[l+11],10,3174756917),_=o(_,A,p,g,u[l+2],15,718787259),g=o(g,_,A,p,u[l+9],21,3951481745),p=n(p,c),g=n(g,h),_=n(_,d),A=n(A,f);return(a(p)+a(g)+a(_)+a(A)).toLowerCase()},M.closeMediaStream=function(n){if(n)try{if(n.getTracks){var r,i=t(n.getTracks());try{for(i.s();!(r=i.n()).done;){r.value.stop()}}catch(e){i.e(e)}finally{i.f()}}else{var s,o=t(n.getAudioTracks());try{for(o.s();!(s=o.n()).done;){s.value.stop()}}catch(e){o.e(e)}finally{o.f()}var a,u=t(n.getVideoTracks());try{for(u.s();!(a=u.n()).done;){a.value.stop()}}catch(e){u.e(e)}finally{u.f()}}}catch(t){"function"!=typeof n.stop&&"object"!==e(n.stop)||n.stop()}},M.cloneArray=function(e){return e&&e.slice()||[]},M.cloneObject=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e&&Object.assign({},e)||t},M}function B(){}function P(){P.init.call(this)}function F(e){return void 0===e._maxListeners?P.defaultMaxListeners:e._maxListeners}function H(e,t,n,r){var i,s,o,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]):(s=e._events=new B,e._eventsCount=0),o){if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=F(e))&&i>0&&o.length>i){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,"function"==typeof console.warn?console.warn(a):console.log(a)}}else o=s[t]=n,++e._eventsCount;return e}function G(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function Y(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function j(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}B.prototype=Object.create(null),P.EventEmitter=P,P.usingDomains=!1,P.prototype.domain=void 0,P.prototype._events=void 0,P.prototype._maxListeners=void 0,P.defaultMaxListeners=10,P.init=function(){this.domain=null,P.usingDomains&&(!I.active||this instanceof I.Domain||(this.domain=I.active)),this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new B,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},P.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},P.prototype.getMaxListeners=function(){return F(this)},P.prototype.emit=function(e){var t,n,r,i,s,o,a,u="error"===e;if(o=this._events)u=u&&null==o.error;else if(!u)return!1;if(a=this.domain,u){if(t=arguments[1],!a){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=o[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=j(e,r),s=0;s<r;++s)i[s].call(n)}(n,c,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,s=j(e,i),o=0;o<i;++o)s[o].call(n,r)}(n,c,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var s=e.length,o=j(e,s),a=0;a<s;++a)o[a].call(n,r,i)}(n,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,s){if(t)e.call(n,r,i,s);else for(var o=e.length,a=j(e,o),u=0;u<o;++u)a[u].call(n,r,i,s)}(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),s=1;s<r;s++)i[s-1]=arguments[s];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,s=j(e,i),o=0;o<i;++o)s[o].apply(n,r)}(n,c,this,i)}return!0},P.prototype.addListener=function(e,t){return H(this,e,t,!1)},P.prototype.on=P.prototype.addListener,P.prototype.prependListener=function(e,t){return H(this,e,t,!0)},P.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,G(this,e,t)),this},P.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,G(this,e,t)),this},P.prototype.removeListener=function(e,t){var n,r,i,s,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0===--this._eventsCount?this._events=new B:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0===--this._eventsCount)return this._events=new B,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,o||t)}return this},P.prototype.off=function(e,t){return this.removeListener(e,t)},P.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new B,this._eventsCount=0):n[e]&&(0===--this._eventsCount?this._events=new B:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),s=0;s<i.length;++s)"removeListener"!==(r=i[s])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new B,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},P.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},P.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Y.call(e,t)},P.prototype.listenerCount=Y,P.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Q=a(Object.freeze({__proto__:null,EventEmitter:P,default:P})),W="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function K(){throw new Error("setTimeout has not been defined")}function J(){throw new Error("clearTimeout has not been defined")}var z=K,V=J;function Z(e){if(z===setTimeout)return setTimeout(e,0);if((z===K||!z)&&setTimeout)return z=setTimeout,setTimeout(e,0);try{return z(e,0)}catch(t){try{return z.call(null,e,0)}catch(t){return z.call(this,e,0)}}}"function"==typeof W.setTimeout&&(z=setTimeout),"function"==typeof W.clearTimeout&&(V=clearTimeout);var X,$=[],ee=!1,te=-1;function ne(){ee&&X&&(ee=!1,X.length?$=X.concat($):te=-1,$.length&&re())}function re(){if(!ee){var e=Z(ne);ee=!0;for(var t=$.length;t;){for(X=$,$=[];++te<t;)X&&X[te].run();te=-1,t=$.length}X=null,ee=!1,function(e){if(V===clearTimeout)return clearTimeout(e);if((V===J||!V)&&clearTimeout)return V=clearTimeout,clearTimeout(e);try{return V(e)}catch(t){try{return V.call(null,e)}catch(t){return V.call(this,e)}}}(e)}}function ie(e,t){this.fun=e,this.array=t}ie.prototype.run=function(){this.fun.apply(null,this.array)};function se(){}var oe=se,ae=se,ue=se,le=se,ce=se,he=se,de=se;var fe=W.performance||{},pe=fe.now||fe.mozNow||fe.msNow||fe.oNow||fe.webkitNow||function(){return(new Date).getTime()};var ge=new Date;var _e,Ae,me,ve,ye,Te={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];$.push(new ie(e,t)),1!==$.length||ee||Z(re)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:oe,addListener:ae,once:ue,off:le,removeListener:ce,removeAllListeners:he,emit:de,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*pe.call(fe),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ge)/1e3}},Se={exports:{}},Ce={exports:{}};function Ee(){if(Ae)return _e;Ae=1;var e=1e3,t=60*e,n=60*t,r=24*n,i=7*r,s=365.25*r;function o(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}return _e=function(a,u){u=u||{};var l=typeof a;if("string"===l&&a.length>0)return function(o){if((o=String(o)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!a)return;var u=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*i;case"days":case"day":case"d":return u*r;case"hours":case"hour":case"hrs":case"hr":case"h":return u*n;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(a);if("number"===l&&isFinite(a))return u.long?function(i){var s=Math.abs(i);if(s>=r)return o(i,s,r,"day");if(s>=n)return o(i,s,n,"hour");if(s>=t)return o(i,s,t,"minute");if(s>=e)return o(i,s,e,"second");return i+" ms"}(a):function(i){var s=Math.abs(i);if(s>=r)return Math.round(i/r)+"d";if(s>=n)return Math.round(i/n)+"h";if(s>=t)return Math.round(i/t)+"m";if(s>=e)return Math.round(i/e)+"s";return i+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}Se.exports=(ye||(ye=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}return!e&&"env"in Te&&(e=Te.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=(ve||(ve=1,me=function(e){function t(e){let r,i,s,o=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),s=i-(r||i);n.diff=s,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,i)=>{if("%%"===r)return"%";o++;const s=t.formatters[i];if("function"==typeof s){const t=e[o];r=s.call(n,t),e.splice(o,1),o--}return r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e,t){let n=0,r=0,i=-1,s=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(i=r,s=n,r++):(n++,r++);else{if(-1===i)return!1;r=i+1,s++,n=s}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(r(e,n))return!1;for(const n of t.names)if(r(e,n))return!0;return!1},t.humanize=Ee(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}),me)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ce,Ce.exports)),Ce.exports);var we=Se.exports;function be(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var Ie=we,Re="JsSIP",Oe=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t?(this._debug=Ie.default("".concat(Re,":").concat(t)),this._warn=Ie.default("".concat(Re,":WARN:").concat(t)),this._error=Ie.default("".concat(Re,":ERROR:").concat(t))):(this._debug=Ie.default(Re),this._warn=Ie.default("".concat(Re,":WARN")),this._error=Ie.default("".concat(Re,":ERROR"))),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}return be(e,[{key:"debug",get:function(){return this._debug}},{key:"warn",get:function(){return this._warn}},{key:"error",get:function(){return this._error}}]),e}(),ke={},De={},qe={exports:{}},Me=qe.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(Me).forEach(function(e){Me[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})});var Ne=qe.exports;!function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,r){var i=e.name&&e.names;e.push&&!n[e.push]?n[e.push]=[]:i&&!n[e.name]&&(n[e.name]={});var s=e.push?{}:i?n[e.name]:n;!function(e,n,r,i){if(i&&!r)n[i]=t(e[1]);else for(var s=0;s<r.length;s+=1)null!=e[s+1]&&(n[r[s]]=t(e[s+1]))}(r.match(e.reg),s,e.names,e.name),e.push&&n[e.push].push(s)},r=Ne,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},s=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach(function(e){var t=e[0],i=e.slice(2);"m"===t&&(s.push({rtp:[],fmtp:[]}),o=s[s.length-1]);for(var a=0;a<(r[t]||[]).length;a+=1){var u=r[t][a];if(u.reg.test(i))return n(u,o,i)}}),t.media=s,t};var s=function(e,n){var r=n.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&n.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(s,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],r=e.split(" ").map(t),i=0;i<r.length;i+=3)n.push({component:r[i],ip:r[i+1],port:r[i+2]});return n},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(s,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var n,r=!1;return"~"!==e[0]?n=t(e):(n=t(e.substring(1,e.length)),r=!0),{scid:n,paused:r}})})}}(De);var Ue=Ne,xe=/%[sdv%]/g,Le=function(e){var t=1,n=arguments,r=n.length;return e.replace(xe,function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}})},Be=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var s=t.names[i];t.name?r.push(n[t.name][s]):r.push(n[t.names[i]])}else r.push(n[t.name]);return Le.apply(null,r)},Pe=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Fe=["i","c","b","a"],He=De,Ge=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var n=t.outerOrder||Pe,r=t.innerOrder||Fe,i=[];return n.forEach(function(t){Ue[t].forEach(function(n){n.name in e&&null!=e[n.name]?i.push(Be(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){i.push(Be(t,n,e))})})}),e.media.forEach(function(e){i.push(Be("m",Ue.m[0],e)),r.forEach(function(t){Ue[t].forEach(function(n){n.name in e&&null!=e[n.name]?i.push(Be(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach(function(e){i.push(Be(t,n,e))})})})}),i.join("\r\n")+"\r\n"},Ye=Ne;function je(e){return je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},je(e)}function Qe(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&We(e,t)}function We(e,t){return We=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},We(e,t)}function Ke(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Je(e);if(t){var i=Je(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===je(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Je(e){return Je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Je(e)}function ze(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ve(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function Ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xe(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}ke.grammar=Ye,ke.write=Ge,ke.parse=He.parse,ke.parseParams=He.parseParams,ke.parseFmtpConfig=He.parseFmtpConfig,ke.parsePayloads=He.parsePayloads,ke.parseRemoteCandidates=He.parseRemoteCandidates,ke.parseImageAttributes=He.parseImageAttributes,ke.parseSimulcastStreamList=He.parseSimulcastStreamList;var $e=ke,et=Oe,tt=c,nt=L(),rt=N(),it=U(),st=new et("SIPMessage"),ot=function(){function e(t,n,r,i,s,o){if(Ze(this,e),!t||!n||!r)return null;i=i||{},this.ua=r,this.headers={},this.method=t,this.ruri=n,this.body=o,this.extraHeaders=nt.cloneArray(s),this.ua.configuration.extra_headers&&(this.extraHeaders=this.extraHeaders.concat(this.ua.configuration.extra_headers)),i.route_set?this.setHeader("route",i.route_set):r.configuration.use_preloaded_route&&this.setHeader("route","<".concat(r.transport.sip_uri,";lr>")),this.setHeader("via",""),this.setHeader("max-forwards",tt.MAX_FORWARDS);var a=i.to_uri||n,u=i.to_tag?{tag:i.to_tag}:null,l=void 0!==i.to_display_name?i.to_display_name:null;this.to=new rt(a,l,u),this.setHeader("to",this.to.toString());var c,h=i.from_uri||r.configuration.uri,d={tag:i.from_tag||nt.newTag()};c=void 0!==i.from_display_name?i.from_display_name:r.configuration.display_name?r.configuration.display_name:null,this.from=new rt(h,c,d),this.setHeader("from",this.from.toString());var f=i.call_id||r.configuration.jssip_id+nt.createRandomToken(15);this.call_id=f,this.setHeader("call-id",f);var p=i.cseq||Math.floor(1e4*Math.random());this.cseq=p,this.setHeader("cseq","".concat(p," ").concat(t))}return Xe(e,[{key:"setHeader",value:function(e,t){for(var n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),r=0;r<this.extraHeaders.length;r++)n.test(this.extraHeaders[r])&&this.extraHeaders.splice(r,1);this.headers[nt.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){var t=this.headers[nt.headerize(e)];if(t){if(t[0])return t[0]}else{var n,r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),i=ze(this.extraHeaders);try{for(i.s();!(n=i.n()).done;){var s=n.value;if(r.test(s))return s.substring(s.indexOf(":")+1).trim()}}catch(e){i.e(e)}finally{i.f()}}}},{key:"getHeaders",value:function(e){var t=this.headers[nt.headerize(e)],n=[];if(t){var r,i=ze(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;n.push(s)}}catch(e){i.e(e)}finally{i.f()}return n}var o,a=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),u=ze(this.extraHeaders);try{for(u.s();!(o=u.n()).done;){var l=o.value;a.test(l)&&n.push(l.substring(l.indexOf(":")+1).trim())}}catch(e){u.e(e)}finally{u.f()}return n}},{key:"hasHeader",value:function(e){if(this.headers[nt.headerize(e)])return!0;var t,n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),r=ze(this.extraHeaders);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(n.test(i))return!0}}catch(e){r.e(e)}finally{r.f()}return!1}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=$e.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){var e="".concat(this.method," ").concat(this.ruri," SIP/2.0\r\n");for(var t in this.headers)if(Object.prototype.hasOwnProperty.call(this.headers,t)){var n,r=ze(this.headers[t]);try{for(r.s();!(n=r.n()).done;){var i=n.value;e+="".concat(t,": ").concat(i,"\r\n")}}catch(e){r.e(e)}finally{r.f()}}var s,o=ze(this.extraHeaders);try{for(o.s();!(s=o.n()).done;){var a=s.value;e+="".concat(a.trim(),"\r\n")}}catch(e){o.e(e)}finally{o.f()}var u=[];switch(this.method){case tt.REGISTER:u.push("path","gruu");break;case tt.INVITE:this.ua.configuration.session_timers&&u.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&u.push("gruu"),u.push("ice","replaces");break;case tt.UPDATE:this.ua.configuration.session_timers&&u.push("timer"),u.push("ice")}u.push("outbound");var l=this.ua.configuration.user_agent||tt.USER_AGENT;if(e+="Allow: ".concat(tt.ALLOWED_METHODS,"\r\n"),e+="Supported: ".concat(u,"\r\n"),e+="User-Agent: ".concat(l,"\r\n"),this.body){var c=nt.str_utf8_length(this.body);e+="Content-Length: ".concat(c,"\r\n\r\n"),e+=this.body}else e+="Content-Length: 0\r\n\r\n";return e}},{key:"clone",value:function(){var t=new e(this.method,this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=nt.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t}}]),e}(),at=function(){Qe(t,ot);var e=Ke(t);function t(n,r,i,s,o){var a;return Ze(this,t),(a=e.call(this,tt.INVITE,n,r,i,s,o)).transaction=null,a}return Xe(t,[{key:"cancel",value:function(e){this.transaction.cancel(e)}},{key:"clone",value:function(){var e=new t(this.ruri,this.ua);return Object.keys(this.headers).forEach(function(t){e.headers[t]=this.headers[t].slice()},this),e.body=this.body,e.extraHeaders=nt.cloneArray(this.extraHeaders),e.to=this.to,e.from=this.from,e.call_id=this.call_id,e.cseq=this.cseq,e.transaction=this.transaction,e}}]),t}(),ut=function(){function e(){Ze(this,e),this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null,this.sdp=null}return Xe(e,[{key:"addHeader",value:function(e,t){var n={raw:t};e=nt.headerize(e),this.headers[e]?this.headers[e].push(n):this.headers[e]=[n]}},{key:"getHeader",value:function(e){var t=this.headers[nt.headerize(e)];if(t)return t[0]?t[0].raw:void 0}},{key:"getHeaders",value:function(e){var t=this.headers[nt.headerize(e)],n=[];if(!t)return[];var r,i=ze(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;n.push(s.raw)}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"hasHeader",value:function(e){return!!this.headers[nt.headerize(e)]}},{key:"parseHeader",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e=nt.headerize(e),this.headers[e]){if(!(t>=this.headers[e].length)){var n=this.headers[e][t],r=n.raw;if(n.parsed)return n.parsed;var i=it.parse(r,e.replace(/-/g,"_"));return-1===i?(this.headers[e].splice(t,1),void st.debug('error parsing "'.concat(e,'" header field with value "').concat(r,'"'))):(n.parsed=i,i)}st.debug('not so many "'.concat(e,'" headers present'))}else st.debug('header "'.concat(e,'" not present'))}},{key:"s",value:function(e,t){return this.parseHeader(e,t)}},{key:"setHeader",value:function(e,t){var n={raw:t};this.headers[nt.headerize(e)]=[n]}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=$e.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){return this.data}}]),e}(),lt=function(){Qe(t,ut);var e=Ke(t);function t(n){var r;return Ze(this,t),(r=e.call(this)).ua=n,r.headers={},r.ruri=null,r.transport=null,r.server_transaction=null,r}return Xe(t,[{key:"reply",value:function(e,t,n,r,i,s){var o=[],a=this.getHeader("To");if(t=t||null,!(e=e||null)||e<100||e>699)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));t=t||tt.REASON_PHRASE[e]||"",n=nt.cloneArray(n),this.ua.configuration.extra_headers&&(n=n.concat(this.ua.configuration.extra_headers));var u="SIP/2.0 ".concat(e," ").concat(t,"\r\n");if(this.method===tt.INVITE&&e>100&&e<=200){var l,c=ze(this.getHeaders("record-route"));try{for(c.s();!(l=c.n()).done;){var h=l.value;u+="Record-Route: ".concat(h,"\r\n")}}catch(e){c.e(e)}finally{c.f()}}var d,f=ze(this.getHeaders("via"));try{for(f.s();!(d=f.n()).done;){var p=d.value;u+="Via: ".concat(p,"\r\n")}}catch(e){f.e(e)}finally{f.f()}!this.to_tag&&e>100?a+=";tag=".concat(nt.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(a+=";tag=".concat(this.to_tag)),u+="To: ".concat(a,"\r\n"),u+="From: ".concat(this.getHeader("From"),"\r\n"),u+="Call-ID: ".concat(this.call_id,"\r\n"),u+="CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");var g,_=ze(n);try{for(_.s();!(g=_.n()).done;){var A=g.value;u+="".concat(A.trim(),"\r\n")}}catch(e){_.e(e)}finally{_.f()}switch(this.method){case tt.INVITE:this.ua.configuration.session_timers&&o.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&o.push("gruu"),o.push("ice","replaces");break;case tt.UPDATE:this.ua.configuration.session_timers&&o.push("timer"),r&&o.push("ice"),o.push("replaces")}if(o.push("outbound"),this.method===tt.OPTIONS?(u+="Allow: ".concat(tt.ALLOWED_METHODS,"\r\n"),u+="Accept: ".concat(tt.ACCEPTED_BODY_TYPES,"\r\n")):405===e?u+="Allow: ".concat(tt.ALLOWED_METHODS,"\r\n"):415===e&&(u+="Accept: ".concat(tt.ACCEPTED_BODY_TYPES,"\r\n")),u+="Supported: ".concat(o,"\r\n"),r){var m=nt.str_utf8_length(r);u+="Content-Type: application/sdp\r\n",u+="Content-Length: ".concat(m,"\r\n\r\n"),u+=r}else u+="Content-Length: ".concat(0,"\r\n\r\n");this.server_transaction.receiveResponse(e,u,i,s)}},{key:"reply_sl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.getHeaders("via");if(!e||e<100||e>699)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));t=t||tt.REASON_PHRASE[e]||"";var r,i="SIP/2.0 ".concat(e," ").concat(t,"\r\n"),s=ze(n);try{for(s.s();!(r=s.n()).done;){var o=r.value;i+="Via: ".concat(o,"\r\n")}}catch(e){s.e(e)}finally{s.f()}var a=this.getHeader("To");if(!this.to_tag&&e>100?a+=";tag=".concat(nt.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(a+=";tag=".concat(this.to_tag)),i+="To: ".concat(a,"\r\n"),i+="From: ".concat(this.getHeader("From"),"\r\n"),i+="Call-ID: ".concat(this.call_id,"\r\n"),i+="CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n"),this.ua.configuration.extra_headers){var u,l=ze(this.ua.configuration.extra_headers);try{for(l.s();!(u=l.n()).done;){var c=u.value;i+="".concat(c.trim(),"\r\n")}}catch(e){l.e(e)}finally{l.f()}}i+="Content-Length: ".concat(0,"\r\n\r\n"),this.transport.send(i)}}]),t}(),ct={OutgoingRequest:ot,InitialOutgoingInviteRequest:at,IncomingRequest:lt,IncomingResponse:function(){Qe(t,ut);var e=Ke(t);function t(){var n;return Ze(this,t),(n=e.call(this)).headers={},n.status_code=null,n.reason_phrase=null,n}return t}()};function ht(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var dt=Oe,ft=L(),pt=new dt("DigestAuthentication"),gt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._credentials=t,this._cnonce=null,this._nc=0,this._ncHex="00000000",this._algorithm=null,this._realm=null,this._nonce=null,this._opaque=null,this._stale=null,this._qop=null,this._method=null,this._uri=null,this._ha1=null,this._response=null}return ht(e,[{key:"get",value:function(e){switch(e){case"realm":return this._realm;case"ha1":return this._ha1;default:return void pt.warn('get() | cannot get "%s" parameter',e)}}},{key:"authenticate",value:function(e,t){var n=e.method,r=e.ruri,i=e.body,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(this._algorithm=t.algorithm,this._realm=t.realm,this._nonce=t.nonce,this._opaque=t.opaque,this._stale=t.stale,this._algorithm){if("MD5"!==this._algorithm)return pt.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return pt.warn("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return pt.warn("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return pt.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return pt.warn('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]',this._credentials.realm,this._realm),!1}if(t.qop)if(t.qop.indexOf("auth-int")>-1)this._qop="auth-int";else{if(!(t.qop.indexOf("auth")>-1))return pt.warn('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this._qop="auth"}else this._qop=null;this._method=n,this._uri=r,this._cnonce=s||ft.createRandomToken(12),this._nc+=1;var o,a,u=Number(this._nc).toString(16);return this._ncHex="00000000".substr(0,8-u.length)+u,4294967296===this._nc&&(this._nc=1,this._ncHex="00000001"),this._credentials.password?this._ha1=ft.calculateMD5("".concat(this._credentials.username,":").concat(this._realm,":").concat(this._credentials.password)):this._ha1=this._credentials.ha1,"auth"===this._qop?(o="".concat(this._method,":").concat(this._uri),a=ft.calculateMD5(o),pt.debug('authenticate() | using qop=auth [a2:"%s"]',o),this._response=ft.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(a))):"auth-int"===this._qop?(o="".concat(this._method,":").concat(this._uri,":").concat(ft.calculateMD5(i||"")),a=ft.calculateMD5(o),pt.debug('authenticate() | using qop=auth-int [a2:"%s"]',o),this._response=ft.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(a))):null===this._qop&&(o="".concat(this._method,":").concat(this._uri),a=ft.calculateMD5(o),pt.debug('authenticate() | using qop=null [a2:"%s"]',o),this._response=ft.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(a))),pt.debug("authenticate() | response generated"),!0}},{key:"toString",value:function(){var e=[];if(!this._response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm=".concat(this._algorithm)),e.push('username="'.concat(this._credentials.username,'"')),e.push('realm="'.concat(this._realm,'"')),e.push('nonce="'.concat(this._nonce,'"')),e.push('uri="'.concat(this._uri,'"')),e.push('response="'.concat(this._response,'"')),this._opaque&&e.push('opaque="'.concat(this._opaque,'"')),this._qop&&(e.push("qop=".concat(this._qop)),e.push('cnonce="'.concat(this._cnonce,'"')),e.push("nc=".concat(this._ncHex))),"Digest ".concat(e.join(", "))}}]),e}(),_t=500,At={T1:_t,T2:4e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4};function mt(e){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mt(e)}function vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yt(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Tt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&St(e,t)}function St(e,t){return St=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},St(e,t)}function Ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=wt(e);if(t){var i=wt(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===mt(t)||"function"==typeof t))return t;return Et(e)}(this,n)}}function Et(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wt(e){return wt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},wt(e)}var bt=Q.EventEmitter,It=Oe,Rt=c,Ot=ct,kt=At,Dt=new It("NonInviteClientTransaction"),qt=new It("InviteClientTransaction"),Mt=new It("AckClientTransaction"),Nt=new It("NonInviteServerTransaction"),Ut=new It("InviteServerTransaction"),xt={STATUS_TRYING:1,STATUS_PROCEEDING:2,STATUS_CALLING:3,STATUS_ACCEPTED:4,STATUS_COMPLETED:5,STATUS_TERMINATED:6,STATUS_CONFIRMED:7,NON_INVITE_CLIENT:"nict",NON_INVITE_SERVER:"nist",INVITE_CLIENT:"ict",INVITE_SERVER:"ist"},Lt=function(){Tt(t,bt);var e=Ct(t);function t(n,r,i,s){var o;vt(this,t),(o=e.call(this)).type=xt.NON_INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=n,o.transport=r,o.request=i,o.eventHandlers=s;var a="SIP/2.0/".concat(r.via_transport);return a+=" ".concat(n.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",a),o.ua.newTransaction(Et(o)),o}return yt(t,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(xt.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},kt.TIMER_F),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Dt.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onTransportError()}},{key:"timer_F",value:function(){Dt.debug("Timer F expired for transaction ".concat(this.id)),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout()}},{key:"timer_K",value:function(){this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"receiveResponse",value:function(e){var t=this,n=e.status_code;if(n<200)switch(this.state){case xt.STATUS_TRYING:case xt.STATUS_PROCEEDING:this.stateChanged(xt.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e)}else switch(this.state){case xt.STATUS_TRYING:case xt.STATUS_PROCEEDING:this.stateChanged(xt.STATUS_COMPLETED),clearTimeout(this.F),408===n?this.eventHandlers.onRequestTimeout():this.eventHandlers.onReceiveResponse(e),this.K=setTimeout(function(){t.timer_K()},kt.TIMER_K)}}},{key:"C",get:function(){return xt}}]),t}(),Bt=function(){Tt(t,bt);var e=Ct(t);function t(n,r,i,s){var o;vt(this,t),(o=e.call(this)).type=xt.INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=n,o.transport=r,o.request=i,o.eventHandlers=s,i.transaction=Et(o);var a="SIP/2.0/".concat(r.via_transport);return a+=" ".concat(n.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",a),o.ua.newTransaction(Et(o)),o}return yt(t,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(xt.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},kt.TIMER_B),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==xt.STATUS_ACCEPTED&&(qt.debug("transport error occurred, deleting transaction ".concat(this.id)),this.eventHandlers.onTransportError()),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_M",value:function(){qt.debug("Timer M expired for transaction ".concat(this.id)),this.state===xt.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"timer_B",value:function(){qt.debug("Timer B expired for transaction ".concat(this.id)),this.state===xt.STATUS_CALLING&&(this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout())}},{key:"timer_D",value:function(){qt.debug("Timer D expired for transaction ".concat(this.id)),clearTimeout(this.B),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"sendACK",value:function(e){var t=this,n=new Ot.OutgoingRequest(Rt.ACK,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});n.setHeader("from",this.request.getHeader("from")),n.setHeader("via",this.request.getHeader("via")),n.setHeader("to",e.getHeader("to")),this.D=setTimeout(function(){t.timer_D()},kt.TIMER_D),this.transport.send(n)}},{key:"cancel",value:function(e){if(this.state===xt.STATUS_PROCEEDING){var t=new Ot.OutgoingRequest(Rt.CANCEL,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});t.setHeader("from",this.request.getHeader("from")),t.setHeader("via",this.request.getHeader("via")),t.setHeader("to",this.request.getHeader("to")),e&&t.setHeader("reason",e),this.transport.send(t)}}},{key:"receiveResponse",value:function(e){var t=this,n=e.status_code;if(n>=100&&n<=199)switch(this.state){case xt.STATUS_CALLING:this.stateChanged(xt.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e);break;case xt.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(e)}else if(n>=200&&n<=299)switch(this.state){case xt.STATUS_CALLING:case xt.STATUS_PROCEEDING:this.stateChanged(xt.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},kt.TIMER_M),this.eventHandlers.onReceiveResponse(e);break;case xt.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(e)}else if(n>=300&&n<=699)switch(this.state){case xt.STATUS_CALLING:case xt.STATUS_PROCEEDING:this.stateChanged(xt.STATUS_COMPLETED),this.sendACK(e),this.eventHandlers.onReceiveResponse(e);break;case xt.STATUS_COMPLETED:this.sendACK(e)}}},{key:"C",get:function(){return xt}}]),t}(),Pt=function(){Tt(t,bt);var e=Ct(t);function t(n,r,i,s){var o;vt(this,t),(o=e.call(this)).id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.transport=r,o.request=i,o.eventHandlers=s;var a="SIP/2.0/".concat(r.via_transport);return a+=" ".concat(n.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",a),o}return yt(t,[{key:"send",value:function(){this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Mt.debug("transport error occurred for transaction ".concat(this.id)),this.eventHandlers.onTransportError()}},{key:"C",get:function(){return xt}}]),t}(),Ft=function(){Tt(t,bt);var e=Ct(t);function t(n,r,i){var s;return vt(this,t),(s=e.call(this)).type=xt.NON_INVITE_SERVER,s.id=i.via_branch,s.ua=n,s.transport=r,s.request=i,s.last_response="",i.server_transaction=Et(s),s.state=xt.STATUS_TRYING,n.newTransaction(Et(s)),s}return yt(t,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_J",value:function(){Nt.debug("Timer J expired for transaction ".concat(this.id)),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Nt.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(e,t,n,r){var i=this;if(100===e)switch(this.state){case xt.STATUS_TRYING:this.stateChanged(xt.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case xt.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=200&&e<=699)switch(this.state){case xt.STATUS_TRYING:case xt.STATUS_PROCEEDING:this.stateChanged(xt.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){i.timer_J()},kt.TIMER_J),this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}}},{key:"C",get:function(){return xt}}]),t}(),Ht=function(){Tt(t,bt);var e=Ct(t);function t(n,r,i){var s;return vt(this,t),(s=e.call(this)).type=xt.INVITE_SERVER,s.id=i.via_branch,s.ua=n,s.transport=r,s.request=i,s.last_response="",i.server_transaction=Et(s),s.state=xt.STATUS_PROCEEDING,n.newTransaction(Et(s)),s.resendProvisionalTimer=null,i.reply(100),s}return yt(t,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_H",value:function(){Ut.debug("Timer H expired for transaction ".concat(this.id)),this.state===xt.STATUS_COMPLETED&&Ut.debug("ACK not received, dialog will be terminated"),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_I",value:function(){this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_L",value:function(){Ut.debug("Timer L expired for transaction ".concat(this.id)),this.state===xt.STATUS_ACCEPTED&&(this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Ut.debug("transport error occurred, deleting transaction ".concat(this.id)),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),clearTimeout(this.L),clearTimeout(this.H),clearTimeout(this.I),this.stateChanged(xt.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"resend_provisional",value:function(){this.transport.send(this.last_response)||this.onTransportError()}},{key:"receiveResponse",value:function(e,t,n,r){var i=this;if(e>=100&&e<=199&&this.state===xt.STATUS_PROCEEDING)this.transport.send(t)||this.onTransportError(),this.last_response=t;if(e>100&&e<=199&&this.state===xt.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){i.resend_provisional()},kt.PROVISIONAL_RESPONSE_INTERVAL));else if(e>=200&&e<=299)switch(this.state){case xt.STATUS_PROCEEDING:this.stateChanged(xt.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){i.timer_L()},kt.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case xt.STATUS_ACCEPTED:this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=300&&e<=699&&this.state===xt.STATUS_PROCEEDING)null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(xt.STATUS_COMPLETED),this.H=setTimeout(function(){i.timer_H()},kt.TIMER_H),n&&n()):(this.onTransportError(),r&&r())}},{key:"C",get:function(){return xt}}]),t}();var Gt={C:xt,NonInviteClientTransaction:Lt,InviteClientTransaction:Bt,AckClientTransaction:Pt,NonInviteServerTransaction:Ft,InviteServerTransaction:Ht,checkTransaction:function(e,t){var n,r=e._transactions;switch(t.method){case Rt.INVITE:if(n=r.ist[t.via_branch]){if(n.state===xt.STATUS_PROCEEDING)n.transport.send(n.last_response);return!0}break;case Rt.ACK:if(!(n=r.ist[t.via_branch]))return!1;if(n.state===xt.STATUS_ACCEPTED)return!1;if(n.state===xt.STATUS_COMPLETED)return n.state=xt.STATUS_CONFIRMED,n.I=setTimeout(function(){n.timer_I()},kt.TIMER_I),!0;break;case Rt.CANCEL:return(n=r.ist[t.via_branch])?(t.reply_sl(200),n.state!==xt.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(n=r.nist[t.via_branch]){switch(n.state){case xt.STATUS_TRYING:break;case xt.STATUS_PROCEEDING:case xt.STATUS_COMPLETED:n.transport.send(n.last_response)}return!0}}}};function Yt(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var jt=c,Qt=gt,Wt=Gt,Kt=new Oe("RequestSender"),Jt={onRequestTimeout:function(){},onTransportError:function(){},onReceiveResponse:function(){},onAuthenticated:function(){}},zt=function(){function e(t,n,r){for(var i in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ua=t,this._eventHandlers=r,this._method=n.method,this._request=n,this._auth=null,this._challenged=!1,this._staled=!1,Jt)Object.prototype.hasOwnProperty.call(Jt,i)&&(this._eventHandlers[i]||(this._eventHandlers[i]=Jt[i]));t.status!==t.C.STATUS_USER_CLOSED||this._method===jt.BYE&&this._method===jt.ACK||this._eventHandlers.onTransportError()}return Yt(e,[{key:"send",value:function(){var e=this,t={onRequestTimeout:function(){e._eventHandlers.onRequestTimeout()},onTransportError:function(){e._eventHandlers.onTransportError()},onReceiveResponse:function(t){e._receiveResponse(t)}};switch(this._method){case"INVITE":this.clientTransaction=new Wt.InviteClientTransaction(this._ua,this._ua.transport,this._request,t);break;case"ACK":this.clientTransaction=new Wt.AckClientTransaction(this._ua,this._ua.transport,this._request,t);break;default:this.clientTransaction=new Wt.NonInviteClientTransaction(this._ua,this._ua.transport,this._request,t)}this._ua._configuration.authorization_jwt&&this._request.setHeader("Authorization",this._ua._configuration.authorization_jwt),this.clientTransaction.send()}},{key:"_receiveResponse",value:function(e){var t,n,r=e.status_code;if(401!==r&&407!==r||null===this._ua.configuration.password&&null===this._ua.configuration.ha1)this._eventHandlers.onReceiveResponse(e);else{if(401===e.status_code?(t=e.parseHeader("www-authenticate"),n="authorization"):(t=e.parseHeader("proxy-authenticate"),n="proxy-authorization"),!t)return Kt.debug("".concat(e.status_code," with wrong or missing challenge, cannot authenticate")),void this._eventHandlers.onReceiveResponse(e);if(!this._challenged||!this._staled&&!0===t.stale){if(this._auth||(this._auth=new Qt({username:this._ua.configuration.authorization_user,password:this._ua.configuration.password,realm:this._ua.configuration.realm,ha1:this._ua.configuration.ha1})),!this._auth.authenticate(this._request,t))return void this._eventHandlers.onReceiveResponse(e);this._challenged=!0,this._ua.set("realm",this._auth.get("realm")),this._ua.set("ha1",this._auth.get("ha1")),t.stale&&(this._staled=!0),this._request=this._request.clone(),this._request.cseq+=1,this._request.setHeader("cseq","".concat(this._request.cseq," ").concat(this._method)),this._request.setHeader(n,this._auth.toString()),this._eventHandlers.onAuthenticated(this._request),this.send()}else this._eventHandlers.onReceiveResponse(e)}}}]),e}();function Vt(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var Zt=Oe,Xt=L(),$t=c,en=ct,tn=zt,nn=new Zt("Registrator"),rn=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._reg_id=1,this._ua=t,this._transport=n,this._registrar=t.configuration.registrar_server,this._expires=t.configuration.register_expires,this._call_id=Xt.createRandomToken(22),this._cseq=0,this._to_uri=t.configuration.uri,this._registrationTimer=null,this._registering=!1,this._registered=!1,this._contact=this._ua.contact.toString(),this._contact+=";+sip.ice",this._extraHeaders=[],this._extraContactParams="",this._sipInstance='"<urn:uuid:'.concat(this._ua.configuration.instance_id,'>"'),this._contact+=";reg-id=".concat(this._reg_id),this._contact+=";+sip.instance=".concat(this._sipInstance)}return Vt(e,[{key:"setExtraHeaders",value:function(e){Array.isArray(e)||(e=[]),this._extraHeaders=e.slice()}},{key:"setExtraContactParams",value:function(e){for(var t in e instanceof Object||(e={}),this._extraContactParams="",e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];this._extraContactParams+=";".concat(t),n&&(this._extraContactParams+="=".concat(n))}}},{key:"register",value:function(){var e=this;if(this._registering)nn.debug("Register request in progress...");else{var t=this._extraHeaders.slice();t.push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams)),t.push("Expires: ".concat(this._expires));var n=new en.OutgoingRequest($t.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},t),r=new tn(this._ua,n,{onRequestTimeout:function(){e._registrationFailure(null,$t.causes.REQUEST_TIMEOUT)},onTransportError:function(){e._registrationFailure(null,$t.causes.CONNECTION_ERROR)},onAuthenticated:function(){e._cseq+=1},onReceiveResponse:function(t){if(t.cseq===e._cseq)switch(null!==e._registrationTimer&&(clearTimeout(e._registrationTimer),e._registrationTimer=null),!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):if(e._registering=!1,!t.hasHeader("Contact")){nn.debug("no Contact header in response to REGISTER, response ignored");break}var n=t.headers.Contact.reduce(function(e,t){return e.concat(t.parsed)},[]),r=n.find(function(t){return e._sipInstance===t.getParam("+sip.instance")&&e._reg_id===parseInt(t.getParam("reg-id"))});if(r||(r=n.find(function(t){return t.uri.user===e._ua.contact.uri.user})),!r){nn.debug("no Contact header pointing to us, response ignored");break}var i=r.getParam("expires");!i&&t.hasHeader("expires")&&(i=t.getHeader("expires")),i||(i=e._expires),(i=Number(i))<10&&(i=10);var s=i>64?1e3*i/2+Math.floor(1e3*(i/2-32)*Math.random()):1e3*i-5e3;e._registrationTimer=setTimeout(function(){e._registrationTimer=null,0===e._ua.listeners("registrationExpiring").length?e.register():e._ua.emit("registrationExpiring")},s),r.hasParam("temp-gruu")&&(e._ua.contact.temp_gruu=r.getParam("temp-gruu").replace(/"/g,"")),r.hasParam("pub-gruu")&&(e._ua.contact.pub_gruu=r.getParam("pub-gruu").replace(/"/g,"")),e._registered||(e._registered=!0,e._ua.registered({response:t}));break;case/^423$/.test(t.status_code):t.hasHeader("min-expires")?(e._expires=Number(t.getHeader("min-expires")),e._expires<10&&(e._expires=10),e.register()):(nn.debug("423 response received for REGISTER without Min-Expires"),e._registrationFailure(t,$t.causes.SIP_FAILURE_CODE));break;default:var o=Xt.sipErrorCause(t.status_code);e._registrationFailure(t,o)}}});this._registering=!0,r.send()}}},{key:"unregister",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._registered){this._registered=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null);var n=this._extraHeaders.slice();t.all?n.push("Contact: *".concat(this._extraContactParams)):n.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams)),n.push("Expires: 0");var r=new en.OutgoingRequest($t.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},n);new tn(this._ua,r,{onRequestTimeout:function(){e._unregistered(null,$t.causes.REQUEST_TIMEOUT)},onTransportError:function(){e._unregistered(null,$t.causes.CONNECTION_ERROR)},onAuthenticated:function(){e._cseq+=1},onReceiveResponse:function(t){switch(!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):e._unregistered(t);break;default:var n=Xt.sipErrorCause(t.status_code);e._unregistered(t,n)}}}).send()}else nn.debug("already unregistered")}},{key:"close",value:function(){this._registered&&this.unregister()}},{key:"onTransportClosed",value:function(){this._registering=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),this._registered&&(this._registered=!1,this._ua.unregistered({}))}},{key:"_registrationFailure",value:function(e,t){this._registering=!1,this._ua.registrationFailed({response:e||null,cause:t}),this._registered&&(this._registered=!1,this._ua.unregistered({response:e||null,cause:t}))}},{key:"_unregistered",value:function(e,t){this._registering=!1,this._registered=!1,this._ua.unregistered({response:e||null,cause:t||null})}},{key:"registered",get:function(){return this._registered}}]),e}();function sn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var on=c,an=Gt,un=zt,ln={onRequestTimeout:function(){},onTransportError:function(){},onSuccessResponse:function(){},onErrorResponse:function(){},onAuthenticated:function(){},onDialogError:function(){}};function cn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function hn(e,t,n){return t&&cn(e.prototype,t),n&&cn(e,n),e}var dn=Oe,fn=ct,pn=c,gn=Gt,_n=function(){function e(t,n,r){for(var i in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._dialog=t,this._ua=t._ua,this._request=n,this._eventHandlers=r,this._reattempt=!1,this._reattemptTimer=null,ln)Object.prototype.hasOwnProperty.call(ln,i)&&(this._eventHandlers[i]||(this._eventHandlers[i]=ln[i]))}return sn(e,[{key:"send",value:function(){var e=this,t=new un(this._ua,this._request,{onRequestTimeout:function(){e._eventHandlers.onRequestTimeout()},onTransportError:function(){e._eventHandlers.onTransportError()},onAuthenticated:function(t){e._eventHandlers.onAuthenticated(t)},onReceiveResponse:function(t){e._receiveResponse(t)}});if(t.send(),(this._request.method===on.INVITE||this._request.method===on.UPDATE&&this._request.body)&&t.clientTransaction.state!==an.C.STATUS_TERMINATED){this._dialog.uac_pending_reply=!0;t.clientTransaction.on("stateChanged",function n(){t.clientTransaction.state!==an.C.STATUS_ACCEPTED&&t.clientTransaction.state!==an.C.STATUS_COMPLETED&&t.clientTransaction.state!==an.C.STATUS_TERMINATED||(t.clientTransaction.removeListener("stateChanged",n),e._dialog.uac_pending_reply=!1)})}}},{key:"_receiveResponse",value:function(e){var t=this;408===e.status_code||481===e.status_code?this._eventHandlers.onDialogError(e):e.method===on.INVITE&&491===e.status_code?this._reattempt?e.status_code>=200&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):e.status_code>=300&&this._eventHandlers.onErrorResponse(e):(this._request.cseq=this._dialog.local_seqnum+=1,this._reattemptTimer=setTimeout(function(){t._dialog.isTerminated()||(t._reattempt=!0,t.send())},1e3)):e.status_code>=200&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):e.status_code>=300&&this._eventHandlers.onErrorResponse(e)}},{key:"request",get:function(){return this._request}}]),e}(),An=L(),mn=new dn("Dialog"),vn={STATUS_EARLY:1,STATUS_CONFIRMED:2,STATUS_TERMINATED:3},yn=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vn.STATUS_CONFIRMED;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._owner=t,this._ua=t._ua,this._uac_pending_reply=!1,this._uas_pending_reply=!1,!n.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};n instanceof fn.IncomingResponse&&(i=n.status_code<200?vn.STATUS_EARLY:vn.STATUS_CONFIRMED);var s=n.parseHeader("contact");"UAS"===r?(this._id={call_id:n.call_id,local_tag:n.to_tag,remote_tag:n.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=i,this._remote_seqnum=n.cseq,this._local_uri=n.parseHeader("to").uri,this._remote_uri=n.parseHeader("from").uri,this._remote_target=s.uri,this._route_set=n.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===r&&(this._id={call_id:n.call_id,local_tag:n.from_tag,remote_tag:n.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=i,this._local_seqnum=n.cseq,this._local_uri=n.parseHeader("from").uri,this._remote_uri=n.parseHeader("to").uri,this._remote_target=s.uri,this._route_set=n.getHeaders("record-route").reverse(),this._ack_seqnum=null),this._ua.newDialog(this),mn.debug("new ".concat(r," dialog created with status ").concat(this._state===vn.STATUS_EARLY?"EARLY":"CONFIRMED"))}return hn(e,null,[{key:"C",get:function(){return vn}}]),hn(e,[{key:"isTerminated",value:function(){return this._status===vn.STATUS_TERMINATED}},{key:"update",value:function(e,t){this._state=vn.STATUS_CONFIRMED,mn.debug("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){mn.debug("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this),this._state=vn.STATUS_TERMINATED}},{key:"sendRequest",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=An.cloneArray(n.extraHeaders),i=An.cloneObject(n.eventHandlers),s=n.body||null,o=this._createRequest(e,r,s);return i.onAuthenticated=function(){t._local_seqnum+=1},new _n(this,o,i).send(),o}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===pn.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===pn.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,n){t=An.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var r=e===pn.CANCEL||e===pn.ACK?this._local_seqnum:this._local_seqnum+=1;return new fn.OutgoingRequest(e,this._remote_target,this._ua,{cseq:r,call_id:this._id.call_id,from_uri:this._local_uri,from_tag:this._id.local_tag,to_uri:this._remote_uri,to_tag:this._id.remote_tag,route_set:this._route_set},t,n)}},{key:"_checkInDialogRequest",value:function(e){var t=this;if(this._remote_seqnum)if(e.cseq<this._remote_seqnum){if(e.method!==pn.ACK)return e.reply(500),!1;if(null===this._ack_seqnum||e.cseq!==this._ack_seqnum)return!1}else e.cseq>this._remote_seqnum&&(this._remote_seqnum=e.cseq);else this._remote_seqnum=e.cseq;if(e.method===pn.INVITE||e.method===pn.UPDATE&&e.body){if(!0===this._uac_pending_reply)e.reply(491);else{if(!0===this._uas_pending_reply){var n=1+(10*Math.random()|0);return e.reply(500,null,["Retry-After:".concat(n)]),!1}this._uas_pending_reply=!0;e.server_transaction.on("stateChanged",function n(){e.server_transaction.state!==gn.C.STATUS_ACCEPTED&&e.server_transaction.state!==gn.C.STATUS_COMPLETED&&e.server_transaction.state!==gn.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),t._uas_pending_reply=!1)})}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===gn.C.STATUS_ACCEPTED&&(t._remote_target=e.parseHeader("contact").uri)})}else e.method===pn.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===gn.C.STATUS_COMPLETED&&(t._remote_target=e.parseHeader("contact").uri)});return!0}},{key:"id",get:function(){return this._id}},{key:"local_seqnum",get:function(){return this._local_seqnum},set:function(e){this._local_seqnum=e}},{key:"owner",get:function(){return this._owner}},{key:"uac_pending_reply",get:function(){return this._uac_pending_reply},set:function(e){this._uac_pending_reply=e}},{key:"uas_pending_reply",get:function(){return this._uas_pending_reply}}]),e}(),Tn={exports:{}};function Sn(e){return Sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sn(e)}function Cn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function En(e,t){return En=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},En(e,t)}function wn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=bn(e);if(t){var i=bn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Sn(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function bn(e){return bn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},bn(e)}var In=Q.EventEmitter,Rn=Oe,On=c,kn=q,Dn=L(),qn=new Rn("RTCSession:DTMF"),Mn={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500};Tn.exports=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&En(e,t)}(t,In);var e=wn(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._session=n,r._direction=null,r._tone=null,r._duration=null,r._request=null,r}return Cn(t,[{key:"send",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw new TypeError("Not enough arguments");if(this._direction="outgoing",this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new kn.InvalidStateError(this._session.status);var r=Dn.cloneArray(n.extraHeaders);if(this.eventHandlers=Dn.cloneObject(n.eventHandlers),"string"==typeof e)e=e.toUpperCase();else{if("number"!=typeof e)throw new TypeError("Invalid tone: ".concat(e));e=e.toString()}if(!e.match(/^[0-9A-DR#*]$/))throw new TypeError("Invalid tone: ".concat(e));this._tone=e,this._duration=n.duration,r.push("Content-Type: application/dtmf-relay");var i="Signal=".concat(this._tone,"\r\n");i+="Duration=".concat(this._duration),this._session.newDTMF({originator:"local",dtmf:this,request:this._request}),this._session.sendRequest(On.INFO,{extraHeaders:r,eventHandlers:{onSuccessResponse:function(e){t.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){t.eventHandlers.onFailed&&t.eventHandlers.onFailed(),t.emit("failed",{originator:"remote",response:e})},onRequestTimeout:function(){t._session.onRequestTimeout()},onTransportError:function(){t._session.onTransportError()},onDialogError:function(){t._session.onDialogError()}},body:i})}},{key:"init_incoming",value:function(e){var t=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,n=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;if(this._direction="incoming",this._request=e,e.reply(200),e.body){var r=e.body.split("\n");r.length>=1&&t.test(r[0])&&(this._tone=r[0].replace(t,"$2")),r.length>=2&&n.test(r[1])&&(this._duration=parseInt(r[1].replace(n,"$2"),10))}this._duration||(this._duration=Mn.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):qn.debug("invalid INFO DTMF received, discarded")}},{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}}]),t}(),Tn.exports.C=Mn;var Nn=Tn.exports;function Un(e){return Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Un(e)}function xn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Ln(e,t){return Ln=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ln(e,t)}function Bn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Pn(e);if(t){var i=Pn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Un(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Pn(e){return Pn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Pn(e)}var Fn=Q.EventEmitter,Hn=c,Gn=q,Yn=L(),jn=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ln(e,t)}(t,Fn);var e=Bn(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._session=n,r._direction=null,r._contentType=null,r._body=null,r}return xn(t,[{key:"send",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this._direction="outgoing",void 0===e)throw new TypeError("Not enough arguments");if(this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new Gn.InvalidStateError(this._session.status);this._contentType=e,this._body=t;var i=Yn.cloneArray(r.extraHeaders);i.push("Content-Type: ".concat(e)),this._session.newInfo({originator:"local",info:this,request:this.request}),this._session.sendRequest(Hn.INFO,{extraHeaders:i,eventHandlers:{onSuccessResponse:function(e){n.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){n.emit("failed",{originator:"remote",response:e})},onTransportError:function(){n._session.onTransportError()},onRequestTimeout:function(){n._session.onRequestTimeout()},onDialogError:function(){n._session.onDialogError()}},body:t})}},{key:"init_incoming",value:function(e){this._direction="incoming",this.request=e,e.reply(200),this._contentType=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,this._body=e.body,this._session.newInfo({originator:"remote",info:this,request:e})}},{key:"contentType",get:function(){return this._contentType}},{key:"body",get:function(){return this._body}}]),t}();function Qn(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var Wn=c,Kn=new Oe("RTCSession:ReferNotifier"),Jn="refer",zn="message/sipfrag;version=2.0",Vn=300,Zn=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._session=t,this._id=n,this._expires=r||Vn,this._active=!0,this.notify(100)}return Qn(e,[{key:"notify",value:function(e,t){var n;(Kn.debug("notify()"),!1!==this._active)&&(t=t||Wn.REASON_PHRASE[e]||"",n=e>=200?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(Wn.NOTIFY,{extraHeaders:["Event: ".concat(Jn,";id=").concat(this._id),"Subscription-State: ".concat(n),"Content-Type: ".concat(zn)],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}]),e}();function Xn(e){return Xn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xn(e)}function $n(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function er(e,t){return er=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},er(e,t)}function tr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=nr(e);if(t){var i=nr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Xn(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function nr(e){return nr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},nr(e)}var rr=Q.EventEmitter,ir=Oe,sr=c,or=U(),ar=L(),ur=new ir("RTCSession:ReferSubscriber"),lr=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&er(e,t)}(t,rr);var e=tr(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._id=null,r._session=n,r}return $n(t,[{key:"sendRefer",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ur.debug("sendRefer()");var r=ar.cloneArray(n.extraHeaders),i=ar.cloneObject(n.eventHandlers);for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);var o=null;n.replaces&&(o=n.replaces._request.call_id,o+=";to-tag=".concat(n.replaces._to_tag),o+=";from-tag=".concat(n.replaces._from_tag),o=encodeURIComponent(o));var a="Refer-To: <".concat(e).concat(o?"?Replaces=".concat(o):"",">");if(r.push(a),!r.some(function(e){return e.toLowerCase().startsWith("referred-by:")})){var u="Referred-By: <".concat(this._session._ua._configuration.uri._scheme,":").concat(this._session._ua._configuration.uri._user,"@").concat(this._session._ua._configuration.uri._host,">");r.push(u)}r.push("Contact: ".concat(this._session.contact));var l=this._session.sendRequest(sr.REFER,{extraHeaders:r,eventHandlers:{onSuccessResponse:function(e){t._requestSucceeded(e)},onErrorResponse:function(e){t._requestFailed(e,sr.causes.REJECTED)},onTransportError:function(){t._requestFailed(null,sr.causes.CONNECTION_ERROR)},onRequestTimeout:function(){t._requestFailed(null,sr.causes.REQUEST_TIMEOUT)},onDialogError:function(){t._requestFailed(null,sr.causes.DIALOG_ERROR)}}});this._id=l.cseq}},{key:"receiveNotify",value:function(e){if(ur.debug("receiveNotify()"),e.body){var t=or.parse(e.body.trim().split("\r\n",1)[0],"Status_Line");if(-1!==t)switch(!0){case/^100$/.test(t.status_code):this.emit("trying",{request:e,status_line:t});break;case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",{request:e,status_line:t});break;case/^2[0-9]{2}$/.test(t.status_code):this.emit("accepted",{request:e,status_line:t});break;default:this.emit("failed",{request:e,status_line:t})}else ur.debug('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){ur.debug("REFER succeeded"),ur.debug('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){ur.debug("REFER failed"),ur.debug('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}},{key:"id",get:function(){return this._id}}]),t}();function cr(e){return cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cr(e)}function hr(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return dr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dr(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function dr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function pr(e,t,n){return t&&fr(e.prototype,t),n&&fr(e,n),e}function gr(e,t){return gr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},gr(e,t)}function _r(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Ar(e);if(t){var i=Ar(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===cr(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Ar(e){return Ar=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ar(e)}var mr=Q.EventEmitter,vr=ke,yr=Oe,Tr=c,Sr=q,Cr=Gt,Er=L(),wr=At,br=ct,Ir=yn,Rr=zt,Or=Nn,kr=jn,Dr=Zn,qr=lr,Mr=x(),Nr=new yr("RTCSession"),Ur={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9},xr=["audio","video"],Lr=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&gr(e,t)}(t,mr);var e=_r(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Nr.debug("new"),(r=e.call(this))._id=null,r._ua=n,r._status=Ur.STATUS_NULL,r._dialog=null,r._earlyDialogs={},r._contact=null,r._from_tag=null,r._to_tag=null,r._connection=null,r._connectionPromiseQueue=Promise.resolve(),r._request=null,r._is_canceled=!1,r._cancel_reason="",r._is_confirmed=!1,r._late_sdp=!1,r._rtcOfferConstraints=null,r._rtcAnswerConstraints=null,r._localMediaStream=null,r._localMediaStreamLocallyGenerated=!1,r._rtcReady=!0,r._iceReady=!1,r._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},r._direction=null,r._local_identity=null,r._remote_identity=null,r._start_time=null,r._end_time=null,r._tones=null,r._audioMuted=!1,r._videoMuted=!1,r._localHold=!1,r._remoteHold=!1,r._sessionTimers={enabled:r._ua.configuration.session_timers,refreshMethod:r._ua.configuration.session_timers_refresh_method,defaultExpires:Tr.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},r._referSubscribers={},r._data={},r}return pr(t,null,[{key:"C",get:function(){return Ur}}]),pr(t,[{key:"isInProgress",value:function(){switch(this._status){case Ur.STATUS_NULL:case Ur.STATUS_INVITE_SENT:case Ur.STATUS_1XX_RECEIVED:case Ur.STATUS_INVITE_RECEIVED:case Ur.STATUS_WAITING_FOR_ANSWER:return!0;default:return!1}}},{key:"isEstablished",value:function(){switch(this._status){case Ur.STATUS_ANSWERED:case Ur.STATUS_WAITING_FOR_ACK:case Ur.STATUS_CONFIRMED:return!0;default:return!1}}},{key:"isEnded",value:function(){switch(this._status){case Ur.STATUS_CANCELED:case Ur.STATUS_TERMINATED:return!0;default:return!1}}},{key:"isMuted",value:function(){return{audio:this._audioMuted,video:this._videoMuted}}},{key:"isOnHold",value:function(){return{local:this._localHold,remote:this._remoteHold}}},{key:"connect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;Nr.debug("connect()");var r=e,i=Er.cloneObject(t.eventHandlers),s=Er.cloneArray(t.extraHeaders),o=Er.cloneObject(t.mediaConstraints,{audio:!0,video:!0}),a=t.mediaStream||null,u=Er.cloneObject(t.pcConfig,{iceServers:[]}),l=t.rtcConstraints||null,c=t.rtcOfferConstraints||null;if(this._rtcOfferConstraints=c,this._rtcAnswerConstraints=t.rtcAnswerConstraints||null,this._data=t.data||this._data,void 0===e)throw new TypeError("Not enough arguments");if(this._status!==Ur.STATUS_NULL)throw new Sr.InvalidStateError(this._status);if(!window.RTCPeerConnection)throw new Sr.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(r));for(var h in this._sessionTimers.enabled&&Er.isDecimal(t.sessionTimersExpires)&&(t.sessionTimersExpires>=Tr.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=t.sessionTimersExpires:this._sessionTimers.defaultExpires=Tr.SESSION_EXPIRES),i)Object.prototype.hasOwnProperty.call(i,h)&&this.on(h,i[h]);this._from_tag=Er.newTag();var d=t.anonymous||!1,f={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:d,outbound:!0}),d?(f.from_display_name="Anonymous",f.from_uri=new Mr("sip","anonymous","anonymous.invalid"),s.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),s.push("Privacy: id")):t.fromUserName&&(f.from_uri=new Mr("sip",t.fromUserName,this._ua.configuration.uri.host),s.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),t.fromDisplayName&&(f.from_display_name=t.fromDisplayName),s.push("Contact: ".concat(this._contact)),s.push("Content-Type: application/sdp"),this._sessionTimers.enabled&&s.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires).concat(this._ua.configuration.session_timers_force_refresher?";refresher=uac":"")),this._request=new br.InitialOutgoingInviteRequest(e,this._ua,f,s),this._id=this._request.call_id+this._from_tag,this._createRTCConnection(u,l),this._direction="outgoing",this._local_identity=this._request.from,this._remote_identity=this._request.to,n&&n(this),this._newRTCSession("local",this._request),this._sendInitialRequest(o,c,a)}},{key:"init_incoming",value:function(e,t){var n,r=this;Nr.debug("init_incoming()");var i=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0;e.body&&"application/sdp"!==i?e.reply(415):(this._status=Ur.STATUS_INVITE_RECEIVED,this._from_tag=e.from_tag,this._id=e.call_id+this._from_tag,this._request=e,this._contact=this._ua.contact.toString(),e.hasHeader("expires")&&(n=1e3*e.getHeader("expires")),e.to_tag=Er.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=Ur.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),r._failed("local",null,Tr.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),n&&(this._timers.expiresTimer=setTimeout(function(){r._status===Ur.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),r._failed("system",null,Tr.causes.EXPIRES))},n)),this._direction="incoming",this._local_identity=e.to,this._remote_identity=e.from,t&&t(this),this._newRTCSession("remote",e),this._status!==Ur.STATUS_TERMINATED&&(e.reply(180,null,["Contact: ".concat(this._contact)]),this._progress("local",null))):e.reply(500,"Missing Contact header field"))}},{key:"answer",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Nr.debug("answer()");var n=this._request,r=Er.cloneArray(t.extraHeaders),i=Er.cloneObject(t.mediaConstraints),s=t.mediaStream||null,o=Er.cloneObject(t.pcConfig,{iceServers:[]}),a=t.rtcConstraints||null,u=t.rtcAnswerConstraints||null,l=Er.cloneObject(t.rtcOfferConstraints),c=!1,h=!1,d=!1,f=!1;if(this._rtcAnswerConstraints=u,this._rtcOfferConstraints=t.rtcOfferConstraints||null,this._data=t.data||this._data,"incoming"!==this._direction)throw new Sr.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==Ur.STATUS_WAITING_FOR_ANSWER)throw new Sr.InvalidStateError(this._status);if(this._sessionTimers.enabled&&Er.isDecimal(t.sessionTimersExpires)&&(t.sessionTimersExpires>=Tr.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=t.sessionTimersExpires:this._sessionTimers.defaultExpires=Tr.SESSION_EXPIRES),this._status=Ur.STATUS_ANSWERED,this._createDialog(n,"UAS")){clearTimeout(this._timers.userNoAnswerTimer),r.unshift("Contact: ".concat(this._contact));var p=n.parseSDP();Array.isArray(p.media)||(p.media=[p.media]);var g,_=hr(p.media);try{for(_.s();!(g=_.n()).done;){var A=g.value;"audio"===A.type&&(c=!0,A.direction&&"sendrecv"!==A.direction||(d=!0)),"video"===A.type&&(h=!0,A.direction&&"sendrecv"!==A.direction||(f=!0))}}catch(e){_.e(e)}finally{_.f()}if(s&&!1===i.audio){var m,v=hr(s.getAudioTracks());try{for(v.s();!(m=v.n()).done;){var y=m.value;s.removeTrack(y)}}catch(e){v.e(e)}finally{v.f()}}if(s&&!1===i.video){var T,S=hr(s.getVideoTracks());try{for(S.s();!(T=S.n()).done;){var C=T.value;s.removeTrack(C)}}catch(e){S.e(e)}finally{S.f()}}s||void 0!==i.audio||(i.audio=d),s||void 0!==i.video||(i.video=f),s||c||l.offerToReceiveAudio||(i.audio=!1),s||h||l.offerToReceiveVideo||(i.video=!1),this._createRTCConnection(o,a),Promise.resolve().then(function(){return s||(i.audio||i.video?(e._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(i).catch(function(t){if(e._status===Ur.STATUS_TERMINATED)throw new Error("terminated");throw n.reply(480),e._failed("local",null,Tr.causes.USER_DENIED_MEDIA_ACCESS),Nr.warn('emit "getusermediafailed" [error:%o]',t),e.emit("getusermediafailed",t),new Error("getUserMedia() failed")})):void 0)}).then(function(t){if(e._status===Ur.STATUS_TERMINATED)throw new Error("terminated");e._localMediaStream=t,t&&t.getTracks().forEach(function(n){e._connection.addTrack(n,t)})}).then(function(){if(!e._late_sdp){var t={originator:"remote",type:"offer",sdp:n.body};Nr.debug('emit "sdp"'),e.emit("sdp",t);var r=new RTCSessionDescription({type:"offer",sdp:t.sdp});return e._connectionPromiseQueue=e._connectionPromiseQueue.then(function(){return e._connection.setRemoteDescription(r)}).catch(function(t){throw n.reply(488),e._failed("system",null,Tr.causes.WEBRTC_ERROR),Nr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',t),e.emit("peerconnection:setremotedescriptionfailed",t),new Error("peerconnection.setRemoteDescription() failed")}),e._connectionPromiseQueue}}).then(function(){if(e._status===Ur.STATUS_TERMINATED)throw new Error("terminated");return e._connecting(n),e._late_sdp?e._createLocalDescription("offer",e._rtcOfferConstraints).catch(function(){throw n.reply(500),new Error("_createLocalDescription() failed")}):e._createLocalDescription("answer",u).catch(function(){throw n.reply(500),new Error("_createLocalDescription() failed")})}).then(function(t){if(e._status===Ur.STATUS_TERMINATED)throw new Error("terminated");e._handleSessionTimersInIncomingRequest(n,r),n.reply(200,null,r,t,function(){e._status=Ur.STATUS_WAITING_FOR_ACK,e._setInvite2xxTimer(n,t),e._setACKTimer(),e._accepted("local")},function(){e._failed("system",null,Tr.causes.CONNECTION_ERROR)})}).catch(function(t){e._status!==Ur.STATUS_TERMINATED&&Nr.warn(t)})}else n.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Nr.debug("terminate()");var n,r=t.cause||Tr.causes.BYE,i=Er.cloneArray(t.extraHeaders),s=t.body,o=t.status_code,a=t.reason_phrase;if(this._status===Ur.STATUS_TERMINATED)throw new Sr.InvalidStateError(this._status);switch(this._status){case Ur.STATUS_NULL:case Ur.STATUS_INVITE_SENT:case Ur.STATUS_1XX_RECEIVED:if(Nr.debug("canceling session"),o&&(o<200||o>=700))throw new TypeError("Invalid status_code: ".concat(o));o&&(a=a||Tr.REASON_PHRASE[o]||"",n="SIP ;cause=".concat(o,' ;text="').concat(a,'"')),this._status===Ur.STATUS_NULL||this._status===Ur.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=n):this._status===Ur.STATUS_1XX_RECEIVED&&this._request.cancel(n),this._status=Ur.STATUS_CANCELED,this._failed("local",null,Tr.causes.CANCELED);break;case Ur.STATUS_WAITING_FOR_ANSWER:case Ur.STATUS_ANSWERED:if(Nr.debug("rejecting session"),(o=o||480)<300||o>=700)throw new TypeError("Invalid status_code: ".concat(o));this._request.reply(o,a,i,s),this._failed("local",null,Tr.causes.REJECTED);break;case Ur.STATUS_WAITING_FOR_ACK:case Ur.STATUS_CONFIRMED:if(Nr.debug("terminating session"),a=t.reason_phrase||Tr.REASON_PHRASE[o]||"",o&&(o<200||o>=700))throw new TypeError("Invalid status_code: ".concat(o));if(o&&i.push("Reason: SIP ;cause=".concat(o,'; text="').concat(a,'"')),this._status===Ur.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==Cr.C.STATUS_TERMINATED){var u=this._dialog;this.receiveRequest=function(t){t.method===Tr.ACK&&(e.sendRequest(Tr.BYE,{extraHeaders:i,body:s}),u.terminate())},this._request.server_transaction.on("stateChanged",function(){e._request.server_transaction.state===Cr.C.STATUS_TERMINATED&&(e.sendRequest(Tr.BYE,{extraHeaders:i,body:s}),u.terminate())}),this._ended("local",null,r),this._dialog=u,this._ua.newDialog(u)}else this.sendRequest(Tr.BYE,{extraHeaders:i,body:s}),this._ended("local",null,r)}}},{key:"sendDTMF",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Nr.debug("sendDTMF() | tones: %s",e);var n=0,r=t.duration||null,i=t.interToneGap||null,s=t.transportType||Tr.DTMF_TRANSPORT.INFO;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==Ur.STATUS_CONFIRMED&&this._status!==Ur.STATUS_WAITING_FOR_ACK&&this._status!==Ur.STATUS_1XX_RECEIVED)throw new Sr.InvalidStateError(this._status);if(s!==Tr.DTMF_TRANSPORT.INFO&&s!==Tr.DTMF_TRANSPORT.RFC2833)throw new TypeError("invalid transportType: ".concat(s));if("number"==typeof e&&(e=e.toString()),!e||"string"!=typeof e||!e.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(e));if(r&&!Er.isDecimal(r))throw new TypeError("Invalid tone duration: ".concat(r));if(r?r<Or.C.MIN_DURATION?(Nr.debug('"duration" value is lower than the minimum allowed, setting it to '.concat(Or.C.MIN_DURATION," milliseconds")),r=Or.C.MIN_DURATION):r>Or.C.MAX_DURATION?(Nr.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(Or.C.MAX_DURATION," milliseconds")),r=Or.C.MAX_DURATION):r=Math.abs(r):r=Or.C.DEFAULT_DURATION,t.duration=r,i&&!Er.isDecimal(i))throw new TypeError("Invalid interToneGap: ".concat(i));if(i?i<Or.C.MIN_INTER_TONE_GAP?(Nr.debug('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(Or.C.MIN_INTER_TONE_GAP," milliseconds")),i=Or.C.MIN_INTER_TONE_GAP):i=Math.abs(i):i=Or.C.DEFAULT_INTER_TONE_GAP,s!==Tr.DTMF_TRANSPORT.RFC2833)this._tones?this._tones+=e:(this._tones=e,function e(){var s,o=this;if(this._status===Ur.STATUS_TERMINATED||!this._tones||n>=this._tones.length)return void(this._tones=null);var a=this._tones[n];if(n+=1,","===a)s=2e3;else{var u=new Or(this);t.eventHandlers={onFailed:function(){o._tones=null}},u.send(a,t),s=r+i}setTimeout(e.bind(this),s)}.call(this));else{var o=this._getDTMFRTPSender();o&&(e=o.toneBuffer+e,o.insertDTMF(e,r,i))}}},{key:"sendInfo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Nr.debug("sendInfo()"),this._status!==Ur.STATUS_CONFIRMED&&this._status!==Ur.STATUS_WAITING_FOR_ACK&&this._status!==Ur.STATUS_1XX_RECEIVED)throw new Sr.InvalidStateError(this._status);new kr(this).send(e,t,n)}},{key:"mute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!1};Nr.debug("mute()");var t=!1,n=!1;!1===this._audioMuted&&e.audio&&(t=!0,this._audioMuted=!0,this._toggleMuteAudio(!0)),!1===this._videoMuted&&e.video&&(n=!0,this._videoMuted=!0,this._toggleMuteVideo(!0)),!0!==t&&!0!==n||this._onmute({audio:t,video:n})}},{key:"unmute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0};Nr.debug("unmute()");var t=!1,n=!1;!0===this._audioMuted&&e.audio&&(t=!0,this._audioMuted=!1,!1===this._localHold&&this._toggleMuteAudio(!1)),!0===this._videoMuted&&e.video&&(n=!0,this._videoMuted=!1,!1===this._localHold&&this._toggleMuteVideo(!1)),!0!==t&&!0!==n||this._onunmute({audio:t,video:n})}},{key:"hold",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(Nr.debug("hold()"),this._status!==Ur.STATUS_WAITING_FOR_ACK&&this._status!==Ur.STATUS_CONFIRMED)return!1;if(!0===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!0,this._onhold("local");var r={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:Tr.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:t.extraHeaders}),!0}},{key:"unhold",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(Nr.debug("unhold()"),this._status!==Ur.STATUS_WAITING_FOR_ACK&&this._status!==Ur.STATUS_CONFIRMED)return!1;if(!1===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!1,this._onunhold("local");var r={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:Tr.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:t.extraHeaders}),!0}},{key:"renegotiate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;Nr.debug("renegotiate()");var r=t.rtcOfferConstraints||null;if(this._status!==Ur.STATUS_WAITING_FOR_ACK&&this._status!==Ur.STATUS_CONFIRMED)return!1;if(!this._isReadyToReOffer())return!1;var i={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:Tr.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}};return this._setLocalMediaStatus(),t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:i,rtcOfferConstraints:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:i,rtcOfferConstraints:r,extraHeaders:t.extraHeaders}),!0}},{key:"refer",value:function(e,t){var n=this;Nr.debug("refer()");var r=e;if(this._status!==Ur.STATUS_WAITING_FOR_ACK&&this._status!==Ur.STATUS_CONFIRMED)return!1;if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(r));var i=new qr(this);i.sendRefer(e,t);var s=i.id;return this._referSubscribers[s]=i,i.on("requestFailed",function(){delete n._referSubscribers[s]}),i.on("accepted",function(){delete n._referSubscribers[s]}),i.on("failed",function(){delete n._referSubscribers[s]}),i}},{key:"sendRequest",value:function(e,t){return Nr.debug("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(Nr.debug("receiveRequest()"),e.method===Tr.CANCEL)this._status!==Ur.STATUS_WAITING_FOR_ANSWER&&this._status!==Ur.STATUS_ANSWERED||(this._status=Ur.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,Tr.causes.CANCELED));else switch(e.method){case Tr.ACK:if(this._status!==Ur.STATUS_WAITING_FOR_ACK)return;if(this._status=Ur.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:Tr.causes.MISSING_SDP,status_code:400});break}var n={originator:"remote",type:"answer",sdp:e.body};Nr.debug('emit "sdp"'),this.emit("sdp",n);var r=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(r)}).then(function(){t._is_confirmed||t._confirmed("remote",e)}).catch(function(e){t.terminate({cause:Tr.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),Nr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else this._is_confirmed||this._confirmed("remote",e);break;case Tr.BYE:this._status===Ur.STATUS_CONFIRMED||this._status===Ur.STATUS_WAITING_FOR_ACK?(e.reply(200),this._ended("remote",e,Tr.causes.BYE)):this._status===Ur.STATUS_INVITE_RECEIVED||this._status===Ur.STATUS_WAITING_FOR_ANSWER?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,Tr.causes.BYE)):e.reply(403,"Wrong Status");break;case Tr.INVITE:this._status===Ur.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case Tr.INFO:if(this._status===Ur.STATUS_1XX_RECEIVED||this._status===Ur.STATUS_WAITING_FOR_ANSWER||this._status===Ur.STATUS_ANSWERED||this._status===Ur.STATUS_WAITING_FOR_ACK||this._status===Ur.STATUS_CONFIRMED){var i=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0;i&&i.match(/^application\/dtmf-relay/i)?new Or(this).init_incoming(e):void 0!==i?new kr(this).init_incoming(e):e.reply(415)}else e.reply(403,"Wrong Status");break;case Tr.UPDATE:this._status===Ur.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case Tr.REFER:this._status===Ur.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case Tr.NOTIFY:this._status===Ur.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){Nr.warn("onTransportError()"),this._status!==Ur.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:Tr.causes.CONNECTION_ERROR,cause:Tr.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){Nr.warn("onRequestTimeout()"),this._status!==Ur.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:Tr.causes.REQUEST_TIMEOUT,cause:Tr.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){Nr.warn("onDialogError()"),this._status!==Ur.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:Tr.causes.DIALOG_ERROR,cause:Tr.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){Nr.debug("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){Nr.debug("newInfo()"),this.emit("newInfo",e)}},{key:"_isReadyToReOffer",value:function(){return this._rtcReady?this._dialog?!0!==this._dialog.uac_pending_reply&&!0!==this._dialog.uas_pending_reply||(Nr.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(Nr.debug("_isReadyToReOffer() | session not established yet"),!1):(Nr.debug("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){if(Nr.debug("close()"),this._localMediaStream&&this._localMediaStreamLocallyGenerated&&(Nr.debug("close() | closing local MediaStream"),Er.closeMediaStream(this._localMediaStream)),this._status!==Ur.STATUS_TERMINATED){if(this._status=Ur.STATUS_TERMINATED,this._connection)try{this._connection.close()}catch(e){Nr.warn("close() | error closing the RTCPeerConnection: %o",e)}for(var e in this._timers)Object.prototype.hasOwnProperty.call(this._timers,e)&&clearTimeout(this._timers[e]);for(var t in clearTimeout(this._sessionTimers.timer),this._dialog&&(this._dialog.terminate(),delete this._dialog),this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,t)&&(this._earlyDialogs[t].terminate(),delete this._earlyDialogs[t]);for(var n in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,n)&&delete this._referSubscribers[n];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(e,t){var n=wr.T1;this._timers.invite2xxTimer=setTimeout(function r(){this._status===Ur.STATUS_WAITING_FOR_ACK&&(e.reply(200,null,["Contact: ".concat(this._contact)],t),n<wr.T2&&(n*=2)>wr.T2&&(n=wr.T2),this._timers.invite2xxTimer=setTimeout(r.bind(this),n))}.bind(this),n)}},{key:"_setACKTimer",value:function(){var e=this;this._timers.ackTimer=setTimeout(function(){e._status===Ur.STATUS_WAITING_FOR_ACK&&(Nr.debug("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(Tr.BYE),e._ended("remote",null,Tr.causes.NO_ACK))},wr.TIMER_H)}},{key:"_createRTCConnection",value:function(e,t){var n=this;this._connection=new RTCPeerConnection(e,t),this._connection.addEventListener("iceconnectionstatechange",function(){"failed"===n._connection.iceConnectionState&&n.terminate({cause:Tr.causes.RTP_TIMEOUT,status_code:408,reason_phrase:Tr.causes.RTP_TIMEOUT})}),Nr.debug('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(e,t){var n=this;if(Nr.debug("createLocalDescription()"),"offer"!==e&&"answer"!==e)throw new Error('createLocalDescription() | invalid type "'.concat(e,'"'));var r=this._connection;return this._rtcReady=!1,Promise.resolve().then(function(){return"offer"===e?r.createOffer(t).catch(function(e){return Nr.warn('emit "peerconnection:createofferfailed" [error:%o]',e),n.emit("peerconnection:createofferfailed",e),Promise.reject(e)}):r.createAnswer(t).catch(function(e){return Nr.warn('emit "peerconnection:createanswerfailed" [error:%o]',e),n.emit("peerconnection:createanswerfailed",e),Promise.reject(e)})}).then(function(e){return r.setLocalDescription(e).catch(function(e){return n._rtcReady=!0,Nr.warn('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',e),n.emit("peerconnection:setlocaldescriptionfailed",e),Promise.reject(e)})}).then(function(){var i=t&&t.iceRestart;if("complete"===r.iceGatheringState&&!i||"gathering"===r.iceGatheringState&&n._iceReady){n._rtcReady=!0;var s={originator:"local",type:e,sdp:r.localDescription.sdp};return Nr.debug('emit "sdp"'),n.emit("sdp",s),Promise.resolve(s.sdp)}return new Promise(function(t){var i,s,o=!1;n._iceReady=!1;var a=function(){if(!o){r.removeEventListener("icecandidate",i),r.removeEventListener("icegatheringstatechange",s),o=!0,n._rtcReady=!0,n._iceReady=!0;var a={originator:"local",type:e,sdp:r.localDescription.sdp};Nr.debug('emit "sdp"'),n.emit("sdp",a),t(a.sdp)}};r.addEventListener("icecandidate",i=function(e){var t=e.candidate;t?n.emit("icecandidate",{candidate:t,ready:a}):a()}),r.addEventListener("icegatheringstatechange",s=function(){"complete"===r.iceGatheringState&&a()})})})}},{key:"_createDialog",value:function(e,t,n){var r="UAS"===t?e.to_tag:e.from_tag,i="UAS"===t?e.from_tag:e.to_tag,s=e.call_id+r+i,o=this._earlyDialogs[s];if(n)return!!o||((o=new Ir(this,e,t,Ir.C.STATUS_EARLY)).error?(Nr.debug(o.error),this._failed("remote",e,Tr.causes.INTERNAL_ERROR),!1):(this._earlyDialogs[s]=o,!0));if(this._from_tag=e.from_tag,this._to_tag=e.to_tag,o)return o.update(e,t),this._dialog=o,delete this._earlyDialogs[s],!0;var a=new Ir(this,e,t);return a.error?(Nr.debug(a.error),this._failed("remote",e,Tr.causes.INTERNAL_ERROR),!1):(this._dialog=a,!0)}},{key:"_receiveReinvite",value:function(e){var t=this;Nr.debug("receiveReinvite()");var n=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,r={request:e,callback:void 0,reject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i=!0;var n=t.status_code||403,r=t.reason_phrase||"",s=Er.cloneArray(t.extraHeaders);if(this._status!==Ur.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: ".concat(n));e.reply(n,r,s)}.bind(this)},i=!1;if(this.emit("reinvite",r),!i){if(this._late_sdp=!1,!e.body)return this._late_sdp=!0,this._remoteHold&&(this._remoteHold=!1,this._onunhold("remote")),void(this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._createLocalDescription("offer",t._rtcOfferConstraints)}).then(function(e){s.call(t,e)}).catch(function(){e.reply(500)}));if("application/sdp"!==n)return Nr.debug("invalid Content-Type"),void e.reply(415);this._processInDialogSdpOffer(e).then(function(e){t._status!==Ur.STATUS_TERMINATED&&s.call(t,e)}).catch(function(e){Nr.warn(e)})}function s(t){var n=this,i=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(e,i),this._late_sdp&&(t=this._mangleOffer(t)),e.reply(200,null,i,t,function(){n._status=Ur.STATUS_WAITING_FOR_ACK,n._setInvite2xxTimer(e,t),n._setACKTimer()}),"function"==typeof r.callback&&r.callback()}}},{key:"_receiveUpdate",value:function(e){var t=this;Nr.debug("receiveUpdate()");var n=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,r={request:e,callback:void 0,reject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i=!0;var n=t.status_code||403,r=t.reason_phrase||"",s=Er.cloneArray(t.extraHeaders);if(this._status!==Ur.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: ".concat(n));e.reply(n,r,s)}.bind(this)},i=!1;if(this.emit("update",r),!i)if(e.body){if("application/sdp"!==n)return Nr.debug("invalid Content-Type"),void e.reply(415);this._processInDialogSdpOffer(e).then(function(e){t._status!==Ur.STATUS_TERMINATED&&s.call(t,e)}).catch(function(e){Nr.warn(e)})}else s.call(this,null);function s(t){var n=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(e,n),e.reply(200,null,n,t),"function"==typeof r.callback&&r.callback()}}},{key:"_processInDialogSdpOffer",value:function(e){var t=this;Nr.debug("_processInDialogSdpOffer()");var n,r=e.parseSDP(),i=!1,s=hr(r.media);try{for(s.s();!(n=s.n()).done;){var o=n.value;if(-1!==xr.indexOf(o.type)){var a=o.direction||r.direction||"sendrecv";if("sendonly"!==a&&"inactive"!==a){i=!1;break}i=!0}}}catch(e){s.e(e)}finally{s.f()}var u={originator:"remote",type:"offer",sdp:e.body};Nr.debug('emit "sdp"'),this.emit("sdp",u);var l=new RTCSessionDescription({type:"offer",sdp:u.sdp});return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(t._status===Ur.STATUS_TERMINATED)throw new Error("terminated");return t._connection.setRemoteDescription(l).catch(function(n){throw e.reply(488),Nr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',n),t.emit("peerconnection:setremotedescriptionfailed",n),n})}).then(function(){if(t._status===Ur.STATUS_TERMINATED)throw new Error("terminated");!0===t._remoteHold&&!1===i?(t._remoteHold=!1,t._onunhold("remote")):!1===t._remoteHold&&!0===i&&(t._remoteHold=!0,t._onhold("remote"))}).then(function(){if(t._status===Ur.STATUS_TERMINATED)throw new Error("terminated");return t._createLocalDescription("answer",t._rtcAnswerConstraints).catch(function(t){throw e.reply(500),Nr.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]',t),t})}).catch(function(e){Nr.warn("_processInDialogSdpOffer() failed [error: %o]",e)}),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(e){var n=this;if(Nr.debug("receiveRefer()"),!e.refer_to)return Nr.debug("no Refer-To header field present in REFER"),void e.reply(400);if(e.refer_to.uri.scheme!==Tr.SIP)return Nr.debug("Refer-To header field points to a non-SIP URI scheme"),void e.reply(416);e.reply(202);var r=new Dr(this,e.cseq);function i(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n="function"==typeof n?n:null,this._status!==Ur.STATUS_WAITING_FOR_ACK&&this._status!==Ur.STATUS_CONFIRMED)return!1;var s=new t(this._ua);if(s.on("progress",function(e){var t=e.response;r.notify(t.status_code,t.reason_phrase)}),s.on("accepted",function(e){var t=e.response;r.notify(t.status_code,t.reason_phrase)}),s.on("_failed",function(e){var t=e.message,n=e.cause;t?r.notify(t.status_code,t.reason_phrase):r.notify(487,n)}),e.refer_to.uri.hasHeader("replaces")){var o=decodeURIComponent(e.refer_to.uri.getHeader("replaces"));i.extraHeaders=Er.cloneArray(i.extraHeaders),i.extraHeaders.push("Replaces: ".concat(o))}s.connect(e.refer_to.uri.toAor(),i,n)}function s(){r.notify(603)}Nr.debug('emit "refer"'),this.emit("refer",{request:e,accept:function(e,t){i.call(n,e,t)},reject:function(){s.call(n)}})}},{key:"_receiveNotify",value:function(e){if(Nr.debug("receiveNotify()"),e.event||e.reply(400),"refer"===e.event.event){var t,n;if(e.event.params&&e.event.params.id)t=e.event.params.id,n=this._referSubscribers[t];else{if(1!==Object.keys(this._referSubscribers).length)return void e.reply(400,"Missing event id parameter");n=this._referSubscribers[Object.keys(this._referSubscribers)[0]]}if(!n)return void e.reply(481,"Subscription does not exist");n.receiveNotify(e),e.reply(200)}else e.reply(489)}},{key:"_receiveReplaces",value:function(e){var n=this;function r(n){var r=this;if(this._status!==Ur.STATUS_WAITING_FOR_ACK&&this._status!==Ur.STATUS_CONFIRMED)return!1;var i=new t(this._ua);i.on("confirmed",function(){r.terminate()}),i.init_incoming(e,n)}function i(){Nr.debug("Replaced INVITE rejected by the user"),e.reply(486)}Nr.debug("receiveReplaces()"),this.emit("replaces",{request:e,accept:function(e){r.call(n,e)},reject:function(){i.call(n)}})}},{key:"_sendInitialRequest",value:function(e,t,n){var r=this,i=new Rr(this._ua,this._request,{onRequestTimeout:function(){r.onRequestTimeout()},onTransportError:function(){r.onTransportError()},onAuthenticated:function(e){r._request=e},onReceiveResponse:function(e){r._receiveInviteResponse(e)}});Promise.resolve().then(function(){return n||(e.audio||e.video?(r._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(e).catch(function(e){if(r._status===Ur.STATUS_TERMINATED)throw new Error("terminated");throw r._failed("local",null,Tr.causes.USER_DENIED_MEDIA_ACCESS),Nr.warn('emit "getusermediafailed" [error:%o]',e),r.emit("getusermediafailed",e),e})):void 0)}).then(function(e){if(r._status===Ur.STATUS_TERMINATED)throw new Error("terminated");return r._localMediaStream=e,e&&e.getTracks().forEach(function(t){r._connection.addTrack(t,e)}),r._connecting(r._request),r._createLocalDescription("offer",t).catch(function(e){throw r._failed("local",null,Tr.causes.WEBRTC_ERROR),e})}).then(function(e){if(r._is_canceled||r._status===Ur.STATUS_TERMINATED)throw new Error("terminated");r._request.body=e,r._status=Ur.STATUS_INVITE_SENT,Nr.debug('emit "sending" [request:%o]',r._request),r.emit("sending",{request:r._request}),i.send()}).catch(function(e){r._status!==Ur.STATUS_TERMINATED&&Nr.warn(e)})}},{key:"_getDTMFRTPSender",value:function(){var e=this._connection.getSenders().find(function(e){return e.track&&"audio"===e.track.kind});if(e&&e.dtmf)return e.dtmf;Nr.warn("sendDTMF() | no local audio track to send DTMF with")}},{key:"_receiveInviteResponse",value:function(e){var t=this;if(Nr.debug("receiveInviteResponse()"),this._dialog&&e.status_code>=200&&e.status_code<=299){if(this._dialog.id.call_id===e.call_id&&this._dialog.id.local_tag===e.from_tag&&this._dialog.id.remote_tag===e.to_tag)return void this.sendRequest(Tr.ACK);var n=new Ir(this,e,"UAC");return void 0!==n.error?void Nr.debug(n.error):(this.sendRequest(Tr.ACK),void this.sendRequest(Tr.BYE))}if(this._is_canceled)e.status_code>=100&&e.status_code<200?this._request.cancel(this._cancel_reason):e.status_code>=200&&e.status_code<299&&this._acceptAndTerminate(e);else if(this._status===Ur.STATUS_INVITE_SENT||this._status===Ur.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(e.status_code):this._status=Ur.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(e.status_code):if(!e.to_tag){Nr.debug("1xx response received without to tag");break}if(e.hasHeader("contact")&&!this._createDialog(e,"UAC",!0))break;if(this._status=Ur.STATUS_1XX_RECEIVED,!e.body){this._progress("remote",e);break}var r={originator:"remote",type:"answer",sdp:e.body};Nr.debug('emit "sdp"'),this.emit("sdp",r);var i=new RTCSessionDescription({type:"answer",sdp:r.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(i)}).then(function(){return t._progress("remote",e)}).catch(function(e){Nr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)});break;case/^2[0-9]{2}$/.test(e.status_code):if(this._status=Ur.STATUS_CONFIRMED,!e.body){this._acceptAndTerminate(e,400,Tr.causes.MISSING_SDP),this._failed("remote",e,Tr.causes.BAD_MEDIA_DESCRIPTION);break}if(!this._createDialog(e,"UAC"))break;var s={originator:"remote",type:"answer",sdp:e.body};Nr.debug('emit "sdp"'),this.emit("sdp",s);var o=new RTCSessionDescription({type:"answer",sdp:s.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if("stable"===t._connection.signalingState)return t._connection.createOffer(t._rtcOfferConstraints).then(function(e){return t._connection.setLocalDescription(e)}).catch(function(n){t._acceptAndTerminate(e,500,n.toString()),t._failed("local",e,Tr.causes.WEBRTC_ERROR)})}).then(function(){t._connection.setRemoteDescription(o).then(function(){t._handleSessionTimersInIncomingResponse(e),t._accepted("remote",e),t.sendRequest(Tr.ACK),t._confirmed("local",null)}).catch(function(n){t._acceptAndTerminate(e,488,"Not Acceptable Here"),t._failed("remote",e,Tr.causes.BAD_MEDIA_DESCRIPTION),Nr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',n),t.emit("peerconnection:setremotedescriptionfailed",n)})});break;default:var a=Er.sipErrorCause(e.status_code);this._failed("remote",e,a)}}},{key:"_sendReinvite",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Nr.debug("sendReinvite()");var n=Er.cloneArray(t.extraHeaders),r=Er.cloneObject(t.eventHandlers),i=t.rtcOfferConstraints||this._rtcOfferConstraints||null,s=!1;function o(e){var t=this;if(this._status!==Ur.STATUS_TERMINATED&&(this.sendRequest(Tr.ACK),!s))if(this._handleSessionTimersInIncomingResponse(e),e.body)if(e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()){var n={originator:"remote",type:"answer",sdp:e.body};Nr.debug('emit "sdp"'),this.emit("sdp",n);var i=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(i)}).then(function(){r.succeeded&&r.succeeded(e)}).catch(function(e){a.call(t),Nr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else a.call(this);else a.call(this)}function a(e){r.failed&&r.failed(e)}n.push("Contact: ".concat(this._contact)),n.push("Content-Type: application/sdp"),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return e._createLocalDescription("offer",i)}).then(function(t){var r={originator:"local",type:"offer",sdp:t=e._mangleOffer(t)};Nr.debug('emit "sdp"'),e.emit("sdp",r),e.sendRequest(Tr.INVITE,{extraHeaders:n,body:t,eventHandlers:{onSuccessResponse:function(t){o.call(e,t),s=!0},onErrorResponse:function(t){a.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}).catch(function(){a()})}},{key:"_sendUpdate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Nr.debug("sendUpdate()");var n=Er.cloneArray(t.extraHeaders),r=Er.cloneObject(t.eventHandlers),i=t.rtcOfferConstraints||this._rtcOfferConstraints||null,s=t.sdpOffer||!1,o=!1;function a(e){var t=this;if(this._status!==Ur.STATUS_TERMINATED&&!o)if(this._handleSessionTimersInIncomingResponse(e),s){if(!e.body)return void u.call(this);if(!e.hasHeader("Content-Type")||"application/sdp"!==e.getHeader("Content-Type").toLowerCase())return void u.call(this);var n={originator:"remote",type:"answer",sdp:e.body};Nr.debug('emit "sdp"'),this.emit("sdp",n);var i=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(i)}).then(function(){r.succeeded&&r.succeeded(e)}).catch(function(e){u.call(t),Nr.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else r.succeeded&&r.succeeded(e)}function u(e){r.failed&&r.failed(e)}n.push("Contact: ".concat(this._contact)),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),s?(n.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return e._createLocalDescription("offer",i)}).then(function(t){var r={originator:"local",type:"offer",sdp:t=e._mangleOffer(t)};Nr.debug('emit "sdp"'),e.emit("sdp",r),e.sendRequest(Tr.UPDATE,{extraHeaders:n,body:t,eventHandlers:{onSuccessResponse:function(t){a.call(e,t),o=!0},onErrorResponse:function(t){u.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}).catch(function(){u.call(e)})):this.sendRequest(Tr.UPDATE,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(t){a.call(e,t)},onErrorResponse:function(t){u.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(e,t,n){Nr.debug("acceptAndTerminate()");var r=[];t&&(n=n||Tr.REASON_PHRASE[t]||"",r.push("Reason: SIP ;cause=".concat(t,'; text="').concat(n,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(Tr.ACK),this.sendRequest(Tr.BYE,{extraHeaders:r})),this._status=Ur.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=vr.parse(e),this._localHold&&!this._remoteHold){Nr.debug("mangleOffer() | me on hold, mangling offer");var t,n=hr(e.media);try{for(n.s();!(t=n.n()).done;){var r=t.value;-1!==xr.indexOf(r.type)&&(r.direction?"sendrecv"===r.direction?r.direction="sendonly":"recvonly"===r.direction&&(r.direction="inactive"):r.direction="sendonly")}}catch(e){n.e(e)}finally{n.f()}}else if(this._localHold&&this._remoteHold){Nr.debug("mangleOffer() | both on hold, mangling offer");var i,s=hr(e.media);try{for(s.s();!(i=s.n()).done;){var o=i.value;-1!==xr.indexOf(o.type)&&(o.direction="inactive")}}catch(e){s.e(e)}finally{s.f()}}else if(this._remoteHold){Nr.debug("mangleOffer() | remote on hold, mangling offer");var a,u=hr(e.media);try{for(u.s();!(a=u.n()).done;){var l=a.value;-1!==xr.indexOf(l.type)&&(l.direction?"sendrecv"===l.direction?l.direction="recvonly":"recvonly"===l.direction&&(l.direction="inactive"):l.direction="recvonly")}}catch(e){u.e(e)}finally{u.f()}}return vr.write(e)}},{key:"_setLocalMediaStatus",value:function(){var e=!0,t=!0;(this._localHold||this._remoteHold)&&(e=!1,t=!1),this._audioMuted&&(e=!1),this._videoMuted&&(t=!1),this._toggleMuteAudio(!e),this._toggleMuteVideo(!t)}},{key:"_handleSessionTimersInIncomingRequest",value:function(e,t){var n;this._sessionTimers.enabled&&(e.session_expires&&e.session_expires>=Tr.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,n=e.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,n="uas"),t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(n)),this._sessionTimers.refresher="uas"===n,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(e){var t;this._sessionTimers.enabled&&(e.session_expires&&e.session_expires>=Tr.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,t=e.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,t="uac"),this._sessionTimers.refresher="uac"===t,this._runSessionTimer())}},{key:"_runSessionTimer",value:function(){var e=this,t=this._sessionTimers.currentExpires;this._sessionTimers.running=!0,clearTimeout(this._sessionTimers.timer),this._sessionTimers.refresher?this._sessionTimers.timer=setTimeout(function(){e._status!==Ur.STATUS_TERMINATED&&e._isReadyToReOffer()&&(Nr.debug("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===Tr.UPDATE?e._sendUpdate():e._sendReinvite())},500*t):this._sessionTimers.timer=setTimeout(function(){e._status!==Ur.STATUS_TERMINATED&&(Nr.warn("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:Tr.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}},{key:"_toggleMuteAudio",value:function(e){var t,n=this._connection.getSenders().filter(function(e){return e.track&&"audio"===e.track.kind}),r=hr(n);try{for(r.s();!(t=r.n()).done;){t.value.track.enabled=!e}}catch(e){r.e(e)}finally{r.f()}}},{key:"_toggleMuteVideo",value:function(e){var t,n=this._connection.getSenders().filter(function(e){return e.track&&"video"===e.track.kind}),r=hr(n);try{for(r.s();!(t=r.n()).done;){t.value.track.enabled=!e}}catch(e){r.e(e)}finally{r.f()}}},{key:"_newRTCSession",value:function(e,t){Nr.debug("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){Nr.debug("session connecting"),Nr.debug('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){Nr.debug("session progress"),Nr.debug('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){Nr.debug("session accepted"),this._start_time=new Date,Nr.debug('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){Nr.debug("session confirmed"),this._is_confirmed=!0,Nr.debug('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,n){Nr.debug("session ended"),this._end_time=new Date,this._close(),Nr.debug('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:n})}},{key:"_failed",value:function(e,t,n){Nr.debug("session failed"),Nr.debug('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:n}),this._close(),Nr.debug('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:n})}},{key:"_onhold",value:function(e){Nr.debug("session onhold"),this._setLocalMediaStatus(),Nr.debug('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){Nr.debug("session onunhold"),this._setLocalMediaStatus(),Nr.debug('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,n=e.video;Nr.debug("session onmute"),this._setLocalMediaStatus(),Nr.debug('emit "muted"'),this.emit("muted",{audio:t,video:n})}},{key:"_onunmute",value:function(e){var t=e.audio,n=e.video;Nr.debug("session onunmute"),this._setLocalMediaStatus(),Nr.debug('emit "unmuted"'),this.emit("unmuted",{audio:t,video:n})}},{key:"C",get:function(){return Ur}},{key:"causes",get:function(){return Tr.causes}},{key:"id",get:function(){return this._id}},{key:"connection",get:function(){return this._connection}},{key:"contact",get:function(){return this._contact}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"start_time",get:function(){return this._start_time}},{key:"end_time",get:function(){return this._end_time}},{key:"data",get:function(){return this._data},set:function(e){this._data=e}},{key:"status",get:function(){return this._status}}]),t}();function Br(e){return Br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Br(e)}function Pr(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function Fr(e,t){return Fr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Fr(e,t)}function Hr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=Gr(e);if(t){var i=Gr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Br(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Gr(e){return Gr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Gr(e)}var Yr=Q.EventEmitter,jr=Oe,Qr=c,Wr=ct,Kr=L(),Jr=zt,zr=q,Vr=x(),Zr=new jr("Message"),Xr=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fr(e,t)}(t,Yr);var e=Hr(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._ua=n,r._request=null,r._closed=!1,r._direction=null,r._local_identity=null,r._remote_identity=null,r._is_replied=!1,r._data={},r}return Pr(t,[{key:"send",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e;if(void 0===e||void 0===t)throw new TypeError("Not enough arguments");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(i));var s=Kr.cloneArray(r.extraHeaders),o=Kr.cloneObject(r.eventHandlers),a=r.contentType||"text/plain",u={};for(var l in r.fromUserName&&(u.from_uri=new Vr("sip",r.fromUserName,this._ua.configuration.uri.host),s.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),r.fromDisplayName&&(u.from_display_name=r.fromDisplayName),o)Object.prototype.hasOwnProperty.call(o,l)&&this.on(l,o[l]);s.push("Content-Type: ".concat(a)),this._request=new Wr.OutgoingRequest(Qr.MESSAGE,e,this._ua,u,s),t&&(this._request.body=t);var c=new Jr(this._ua,this._request,{onRequestTimeout:function(){n._onRequestTimeout()},onTransportError:function(){n._onTransportError()},onReceiveResponse:function(e){n._receiveResponse(e)}});this._newMessage("local",this._request),c.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newMessage("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Kr.cloneArray(e.extraHeaders),n=e.body;if("incoming"!==this._direction)throw new zr.NotSupportedError('"accept" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");this._is_replied=!0,this._request.reply(200,null,t,n)}},{key:"reject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,n=e.reason_phrase,r=Kr.cloneArray(e.extraHeaders),i=e.body;if("incoming"!==this._direction)throw new zr.NotSupportedError('"reject" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");if(t<300||t>=700)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,n,r,i)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=Kr.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,Qr.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,Qr.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newMessage",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newMessage(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,n){Zr.debug("MESSAGE failed"),this._close(),Zr.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:n})}},{key:"_succeeded",value:function(e,t){Zr.debug("MESSAGE succeeded"),this._close(),Zr.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}}]),t}();function $r(e){return $r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$r(e)}function ei(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function ti(e,t){return ti=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ti(e,t)}function ni(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=ri(e);if(t){var i=ri(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===$r(t)||"function"==typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function ri(e){return ri=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ri(e)}var ii=Q.EventEmitter,si=Oe,oi=c,ai=ct,ui=L(),li=zt,ci=q,hi=new si("Options"),di=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ti(e,t)}(t,ii);var e=ni(t);function t(n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=e.call(this))._ua=n,r._request=null,r._closed=!1,r._direction=null,r._local_identity=null,r._remote_identity=null,r._is_replied=!1,r._data={},r}return ei(t,[{key:"send",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e;if(void 0===e)throw new TypeError("A target is required for OPTIONS");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(i));var s=ui.cloneArray(r.extraHeaders),o=ui.cloneObject(r.eventHandlers),a=r.contentType||"application/sdp";for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&this.on(u,o[u]);s.push("Content-Type: ".concat(a)),this._request=new ai.OutgoingRequest(oi.OPTIONS,e,this._ua,null,s),t&&(this._request.body=t);var l=new li(this._ua,this._request,{onRequestTimeout:function(){n._onRequestTimeout()},onTransportError:function(){n._onTransportError()},onReceiveResponse:function(e){n._receiveResponse(e)}});this._newOptions("local",this._request),l.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newOptions("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=ui.cloneArray(e.extraHeaders),n=e.body;if("incoming"!==this._direction)throw new ci.NotSupportedError('"accept" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");this._is_replied=!0,this._request.reply(200,null,t,n)}},{key:"reject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,n=e.reason_phrase,r=ui.cloneArray(e.extraHeaders),i=e.body;if("incoming"!==this._direction)throw new ci.NotSupportedError('"reject" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");if(t<300||t>=700)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,n,r,i)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=ui.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,oi.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,oi.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newOptions",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newOptions(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,n){hi.debug("OPTIONS failed"),this._close(),hi.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:n})}},{key:"_succeeded",value:function(e,t){hi.debug("OPTIONS succeeded"),this._close(),hi.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}}]),t}(),fi={},pi=Oe,gi=L(),_i=U(),Ai=new pi("Socket");function mi(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}fi.isSocket=function(e){if(Array.isArray(e))return!1;if(void 0===e)return Ai.warn("undefined JsSIP.Socket instance"),!1;try{if(!gi.isString(e.url))throw Ai.warn("missing or invalid JsSIP.Socket url property"),new Error("Missing or invalid JsSIP.Socket url property");if(!gi.isString(e.via_transport))throw Ai.warn("missing or invalid JsSIP.Socket via_transport property"),new Error("Missing or invalid JsSIP.Socket via_transport property");if(-1===_i.parse(e.sip_uri,"SIP_URI"))throw Ai.warn("missing or invalid JsSIP.Socket sip_uri property"),new Error("missing or invalid JsSIP.Socket sip_uri property")}catch(e){return!1}try{["connect","disconnect","send"].forEach(function(t){if(!gi.isFunction(e[t]))throw Ai.warn("missing or invalid JsSIP.Socket method: ".concat(t)),new Error("Missing or invalid JsSIP.Socket method: ".concat(t))})}catch(e){return!1}return!0};var vi=fi,yi=c,Ti=new Oe("Transport"),Si={STATUS_CONNECTED:0,STATUS_CONNECTING:1,STATUS_DISCONNECTED:2,SOCKET_STATUS_READY:0,SOCKET_STATUS_ERROR:1,recovery_options:{min_interval:yi.CONNECTION_RECOVERY_MIN_INTERVAL,max_interval:yi.CONNECTION_RECOVERY_MAX_INTERVAL}},Ci=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Si.recovery_options;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ti.debug("new()"),this.status=Si.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=n,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1;try{this.textDecoder=new TextDecoder("utf8")}catch(e){Ti.warn("cannot use TextDecoder: ".concat(e))}if(void 0===t)throw new TypeError("Invalid argument. undefined 'sockets' argument");t instanceof Array||(t=[t]),t.forEach(function(e){if(!vi.isSocket(e.socket))throw new TypeError("Invalid argument. invalid 'JsSIP.Socket' instance");if(e.weight&&!Number(e.weight))throw new TypeError("Invalid argument. 'weight' attribute is not a number");this.sockets.push({socket:e.socket,weight:e.weight||0,status:Si.SOCKET_STATUS_READY})},this),this._getSocket()}return mi(e,[{key:"connect",value:function(){Ti.debug("connect()"),this.isConnected()?Ti.debug("Transport is already connected"):this.isConnecting()?Ti.debug("Transport is connecting"):(this.close_requested=!1,this.status=Si.STATUS_CONNECTING,this.onconnecting({socket:this.socket,attempts:this.recover_attempts}),this.close_requested||(this.socket.onconnect=this._onConnect.bind(this),this.socket.ondisconnect=this._onDisconnect.bind(this),this.socket.ondata=this._onData.bind(this),this.socket.connect()))}},{key:"disconnect",value:function(){Ti.debug("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=Si.STATUS_DISCONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.socket.onconnect=function(){},this.socket.ondisconnect=function(){},this.socket.ondata=function(){},this.socket.disconnect(),this.ondisconnect({socket:this.socket,error:!1})}},{key:"send",value:function(e){if(Ti.debug("send()"),!this.isConnected())return Ti.warn("unable to send message, transport is not connected"),!1;var t=e.toString();return Ti.debug("sending message:\n\n".concat(t,"\n")),this.socket.send(t)}},{key:"isConnected",value:function(){return this.status===Si.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===Si.STATUS_CONNECTING}},{key:"_reconnect",value:function(){var e=this;this.recover_attempts+=1;var t=Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1);t<this.recovery_options.min_interval?t=this.recovery_options.min_interval:t>this.recovery_options.max_interval&&(t=this.recovery_options.max_interval),Ti.debug("reconnection attempt: ".concat(this.recover_attempts,". next connection attempt in ").concat(t," seconds")),this.recovery_timer=setTimeout(function(){e.close_requested||e.isConnected()||e.isConnecting()||(e._getSocket(),e.connect())},1e3*t)}},{key:"_getSocket",value:function(){var e=[];if(this.sockets.forEach(function(t){t.status!==Si.SOCKET_STATUS_ERROR&&(0===e.length?e.push(t):t.weight>e[0].weight?e=[t]:t.weight===e[0].weight&&e.push(t))}),0===e.length)return this.sockets.forEach(function(e){e.status=Si.SOCKET_STATUS_READY}),void this._getSocket();var t=Math.floor(Math.random()*e.length);this.socket=e[t].socket}},{key:"_onConnect",value:function(){this.recover_attempts=0,this.status=Si.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(e,t,n){this.status=Si.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:n}),this.close_requested||(this.sockets.forEach(function(e){this.socket===e.socket&&(e.status=Si.SOCKET_STATUS_ERROR)},this),this._reconnect(e))}},{key:"_onData",value:function(e){if("\r\n\r\n"!==e)if("\r\n"!==e){if("string"!=typeof e){try{e=this.textDecoder?this.textDecoder.decode(e):String.fromCharCode.apply(null,new Uint8Array(e))}catch(e){return void Ti.debug("received binary message failed to be converted into string, message discarded")}Ti.debug("received binary message:\n\n".concat(e,"\n"))}else Ti.debug("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else Ti.debug("received message with CRLF Keep Alive response");else{Ti.debug("received message with double-CRLF Keep Alive request");try{this.socket.send("\r\n")}catch(e){Ti.warn("error sending Keep Alive response: ".concat(e))}}}},{key:"via_transport",get:function(){return this.socket.via_transport}},{key:"url",get:function(){return this.socket.url}},{key:"sip_uri",get:function(){return this.socket.sip_uri}}]),e}(),Ei={};function wi(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return bi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bi(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ii=Oe,Ri=U(),Oi=ct,ki=new Ii("Parser");function Di(e,t){var n=t,r=0,i=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===r;){if(-1===(i=e.indexOf("\r\n",n)))return i;!e.substring(i+2,i+4).match(/(^\r\n)/)&&e.charAt(i+2).match(/(^\s+)/)?n=i+2:r=i}return r}function qi(e,t,n,r){var i,s=t.indexOf(":",n),o=t.substring(n,s).trim(),a=t.substring(s+1,r).trim();switch(o.toLowerCase()){case"via":case"v":e.addHeader("via",a),1===e.getHeaders("via").length?(i=e.parseHeader("Via"))&&(e.via=i,e.via_branch=i.branch):i=0;break;case"from":case"f":e.setHeader("from",a),(i=e.parseHeader("from"))&&(e.from=i,e.from_tag=i.getParam("tag"));break;case"to":case"t":e.setHeader("to",a),(i=e.parseHeader("to"))&&(e.to=i,e.to_tag=i.getParam("tag"));break;case"record-route":if(-1===(i=Ri.parse(a,"Record_Route")))i=void 0;else{var u,l=wi(i);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.addHeader("record-route",a.substring(c.possition,c.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=c.parsed}}catch(e){l.e(e)}finally{l.f()}}break;case"call-id":case"i":e.setHeader("call-id",a),(i=e.parseHeader("call-id"))&&(e.call_id=a);break;case"contact":case"m":if(-1===(i=Ri.parse(a,"Contact")))i=void 0;else{var h,d=wi(i);try{for(d.s();!(h=d.n()).done;){var f=h.value;e.addHeader("contact",a.substring(f.possition,f.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=f.parsed}}catch(e){d.e(e)}finally{d.f()}}break;case"content-length":case"l":e.setHeader("content-length",a),i=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",a),i=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",a),(i=e.parseHeader("cseq"))&&(e.cseq=i.value),e instanceof Oi.IncomingResponse&&(e.method=i.method);break;case"max-forwards":e.setHeader("max-forwards",a),i=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",a),i=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",a),i=e.parseHeader("proxy-authenticate");break;case"session-expires":case"x":e.setHeader("session-expires",a),(i=e.parseHeader("session-expires"))&&(e.session_expires=i.expires,e.session_expires_refresher=i.refresher);break;case"refer-to":case"r":e.setHeader("refer-to",a),(i=e.parseHeader("refer-to"))&&(e.refer_to=i);break;case"replaces":e.setHeader("replaces",a),(i=e.parseHeader("replaces"))&&(e.replaces=i);break;case"event":case"o":e.setHeader("event",a),(i=e.parseHeader("event"))&&(e.event=i);break;default:e.addHeader(o,a),i=0}return void 0!==i||{error:'error parsing header "'.concat(o,'"')}}function Mi(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ni(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ni(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function Ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Ei.parseMessage=function(e,t){var n,r,i=e.indexOf("\r\n");if(-1!==i){var s=e.substring(0,i),o=Ri.parse(s,"Request_Response");if(-1!==o){o.status_code?((n=new Oi.IncomingResponse).status_code=o.status_code,n.reason_phrase=o.reason_phrase):((n=new Oi.IncomingRequest(t)).method=o.method,n.ruri=o.uri),n.data=e;for(var a=i+2;;){if(-2===(i=Di(e,a))){r=a+2;break}if(-1===i)return void ki.warn("parseMessage() | malformed message");if(!0!==(o=qi(n,e,a,i)))return void ki.warn("parseMessage() |",o.error);a=i+2}if(n.hasHeader("content-length")){var u=n.getHeader("content-length");n.body=e.substr(r,u)}else n.body=e.substring(r);return n}ki.warn('parseMessage() | error parsing first line of SIP message: "'.concat(s,'"'))}else ki.warn("parseMessage() | no CRLF found, not a SIP message")};var Ui,xi,Li,Bi=Oe,Pi=c,Fi=ct,Hi=L(),Gi=new Bi("sanityCheck"),Yi=[function(){for(var e=0,t=["from","to","call_id","cseq","via"];e<t.length;e++){var n=t[e];if(!Ui.hasHeader(n))return Gi.debug("missing mandatory header field : ".concat(n,", dropping the response")),!1}}],ji=[function(){if("sip"!==Ui.s("to").uri.scheme)return Wi(416),!1},function(){if(!Ui.to_tag&&Ui.call_id.substr(0,5)===xi.configuration.jssip_id)return Wi(482),!1},function(){var e=Hi.str_utf8_length(Ui.body),t=Ui.getHeader("content-length");if(e<t)return Wi(400),!1},function(){var e,t=Ui.from_tag,n=Ui.call_id,r=Ui.cseq;if(Ui.to_tag)return;if(Ui.method===Pi.INVITE){if(xi._transactions.ist[Ui.via_branch])return!1;for(var i in xi._transactions.ist)if(Object.prototype.hasOwnProperty.call(xi._transactions.ist,i)&&(e=xi._transactions.ist[i]).request.from_tag===t&&e.request.call_id===n&&e.request.cseq===r)return Wi(482),!1}else{if(xi._transactions.nist[Ui.via_branch])return!1;for(var s in xi._transactions.nist)if(Object.prototype.hasOwnProperty.call(xi._transactions.nist,s)&&(e=xi._transactions.nist[s]).request.from_tag===t&&e.request.call_id===n&&e.request.cseq===r)return Wi(482),!1}}],Qi=[function(){if(Ui.getHeaders("via").length>1)return Gi.debug("more than one Via header field present in the response, dropping the response"),!1},function(){var e=Hi.str_utf8_length(Ui.body),t=Ui.getHeader("content-length");if(e<t)return Gi.debug("message body length is lower than the value in Content-Length header field, dropping the response"),!1}];function Wi(e){var t,n,r=Ui.getHeaders("via"),i="SIP/2.0 ".concat(e," ").concat(Pi.REASON_PHRASE[e],"\r\n"),s=Mi(r);try{for(s.s();!(n=s.n()).done;){var o=n.value;i+="Via: ".concat(o,"\r\n")}}catch(e){s.e(e)}finally{s.f()}t=Ui.getHeader("To"),Ui.to_tag||(t+=";tag=".concat(Hi.newTag())),i+="To: ".concat(t,"\r\n"),i+="From: ".concat(Ui.getHeader("From"),"\r\n"),i+="Call-ID: ".concat(Ui.call_id,"\r\n"),i+="CSeq: ".concat(Ui.cseq," ").concat(Ui.method,"\r\n"),i+="\r\n",Li.send(i)}var Ki={};function Ji(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return zi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zi(e,t)}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}function zi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Vi=L(),Zi=c,Xi=U(),$i=x(),es=fi,ts=q;Ki.settings={authorization_user:null,password:null,realm:null,ha1:null,authorization_jwt:null,display_name:null,uri:null,contact_uri:null,instance_id:null,use_preloaded_route:!1,session_timers:!0,session_timers_refresh_method:Zi.UPDATE,session_timers_force_refresher:!1,no_answer_timeout:60,register:!0,register_expires:600,registrar_server:null,sockets:null,connection_recovery_max_interval:Zi.CONNECTION_RECOVERY_MAX_INTERVAL,connection_recovery_min_interval:Zi.CONNECTION_RECOVERY_MIN_INTERVAL,extra_headers:null,via_host:"".concat(Vi.createRandomToken(12),".invalid")};var ns={mandatory:{sockets:function(e){var t=[];if(es.isSocket(e))t.push({socket:e});else{if(!Array.isArray(e)||!e.length)return;var n,r=Ji(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;Object.prototype.hasOwnProperty.call(i,"socket")&&es.isSocket(i.socket)?t.push(i):es.isSocket(i)&&t.push({socket:i})}}catch(e){r.e(e)}finally{r.f()}}return t},uri:function(e){/^sip:/i.test(e)||(e="".concat(Zi.SIP,":").concat(e));var t=$i.parse(e);return t&&t.user?t:void 0}},optional:{authorization_user:function(e){return-1===Xi.parse('"'.concat(e,'"'),"quoted_string")?void 0:e},authorization_jwt:function(e){if("string"==typeof e)return e},user_agent:function(e){if("string"==typeof e)return e},connection_recovery_max_interval:function(e){if(Vi.isDecimal(e)){var t=Number(e);if(t>0)return t}},connection_recovery_min_interval:function(e){if(Vi.isDecimal(e)){var t=Number(e);if(t>0)return t}},contact_uri:function(e){if("string"==typeof e){var t=Xi.parse(e,"SIP_URI");if(-1!==t)return t}},display_name:function(e){return e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===Xi.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(Vi.isDecimal(e)){var t=Number(e);if(t>0)return t}},session_timers:function(e){if("boolean"==typeof e)return e},session_timers_refresh_method:function(e){if("string"==typeof e&&((e=e.toUpperCase())===Zi.INVITE||e===Zi.UPDATE))return e},session_timers_force_refresher:function(e){if("boolean"==typeof e)return e},password:function(e){return String(e)},realm:function(e){return String(e)},ha1:function(e){return String(e)},register:function(e){if("boolean"==typeof e)return e},register_expires:function(e){if(Vi.isDecimal(e)){var t=Number(e);if(t>0)return t}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(Zi.SIP,":").concat(e));var t=$i.parse(e);return t?t.user?void 0:t:void 0},use_preloaded_route:function(e){if("boolean"==typeof e)return e},extra_headers:function(e){var t=[];if(Array.isArray(e)&&e.length){var n,r=Ji(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;"string"==typeof i&&t.push(i)}}catch(e){r.e(e)}finally{r.f()}return t}}}};function rs(e){return rs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rs(e)}function is(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ss(e,t,n){return t&&is(e.prototype,t),n&&is(e,n),e}function os(e,t){return os=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},os(e,t)}function as(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=ls(e);if(t){var i=ls(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===rs(t)||"function"==typeof t))return t;return us(e)}(this,n)}}function us(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ls(e){return ls=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ls(e)}Ki.load=function(e,t){for(var n in ns.mandatory){if(!t.hasOwnProperty(n))throw new ts.ConfigurationError(n);var r=t[n],i=ns.mandatory[n](r);if(void 0===i)throw new ts.ConfigurationError(n,r);e[n]=i}for(var s in ns.optional)if(t.hasOwnProperty(s)){var o=t[s];if(Vi.isEmpty(o))continue;var a=ns.optional[s](o);if(void 0===a)throw new ts.ConfigurationError(s,o);e[s]=a}};var cs=Q.EventEmitter,hs=Oe,ds=c,fs=rn,ps=Lr,gs=Xr,_s=di,As=Gt,ms=Ci,vs=L(),ys=q,Ts=x(),Ss=Ei,Cs=ct,Es=function(e,t,n){Ui=e,xi=t,Li=n;var r,i=Mi(Yi);try{for(i.s();!(r=i.n()).done;){if(!1===(0,r.value)())return!1}}catch(e){i.e(e)}finally{i.f()}if(Ui instanceof Fi.IncomingRequest){var s,o=Mi(ji);try{for(o.s();!(s=o.n()).done;){if(!1===(0,s.value)())return!1}}catch(e){o.e(e)}finally{o.f()}}else if(Ui instanceof Fi.IncomingResponse){var a,u=Mi(Qi);try{for(u.s();!(a=u.n()).done;){if(!1===(0,a.value)())return!1}}catch(e){u.e(e)}finally{u.f()}}return!0},ws=Ki,bs=new hs("UA"),Is={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2},Rs=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&os(e,t)}(t,cs);var e=as(t);function t(n){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),bs.debug("new() [configuration:%o]",n),(r=e.call(this))._cache={credentials:{}},r._configuration=Object.assign({},ws.settings),r._dynConfiguration={},r._dialogs={},r._applicants={},r._sessions={},r._transport=null,r._contact=null,r._status=Is.STATUS_INIT,r._error=null,r._transactions={nist:{},nict:{},ist:{},ict:{}},r._data={},r._closeTimer=null,void 0===n)throw new TypeError("Not enough arguments");try{r._loadConfig(n)}catch(e){throw r._status=Is.STATUS_NOT_READY,r._error=Is.CONFIGURATION_ERROR,e}return r._registrator=new fs(us(r)),r}return ss(t,null,[{key:"C",get:function(){return Is}}]),ss(t,[{key:"start",value:function(){bs.debug("start()"),this._status===Is.STATUS_INIT?this._transport.connect():this._status===Is.STATUS_USER_CLOSED?(bs.debug("restarting UA"),null!==this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null,this._transport.disconnect()),this._status=Is.STATUS_INIT,this._transport.connect()):this._status===Is.STATUS_READY?bs.debug("UA is in READY status, not restarted"):bs.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"),this._dynConfiguration.register=this._configuration.register}},{key:"register",value:function(){bs.debug("register()"),this._dynConfiguration.register=!0,this._registrator.register()}},{key:"unregister",value:function(e){bs.debug("unregister()"),this._dynConfiguration.register=!1,this._registrator.unregister(e)}},{key:"registrator",value:function(){return this._registrator}},{key:"isRegistered",value:function(){return this._registrator.registered}},{key:"isConnected",value:function(){return this._transport.isConnected()}},{key:"call",value:function(e,t){bs.debug("call()");var n=new ps(this);return n.connect(e,t),n}},{key:"sendMessage",value:function(e,t,n){bs.debug("sendMessage()");var r=new gs(this);return r.send(e,t,n),r}},{key:"sendOptions",value:function(e,t,n){bs.debug("sendOptions()");var r=new _s(this);return r.send(e,t,n),r}},{key:"terminateSessions",value:function(e){for(var t in bs.debug("terminateSessions()"),this._sessions)this._sessions[t].isEnded()||this._sessions[t].terminate(e)}},{key:"stop",value:function(){var e=this;if(bs.debug("stop()"),this._dynConfiguration={},this._status!==Is.STATUS_USER_CLOSED){this._registrator.close();var t=Object.keys(this._sessions).length;for(var n in this._sessions)if(Object.prototype.hasOwnProperty.call(this._sessions,n)){bs.debug("closing session ".concat(n));try{this._sessions[n].terminate()}catch(e){}}for(var r in this._applicants)if(Object.prototype.hasOwnProperty.call(this._applicants,r))try{this._applicants[r].close()}catch(e){}this._status=Is.STATUS_USER_CLOSED,0===Object.keys(this._transactions.nict).length+Object.keys(this._transactions.nist).length+Object.keys(this._transactions.ict).length+Object.keys(this._transactions.ist).length&&0===t?this._transport.disconnect():this._closeTimer=setTimeout(function(){e._closeTimer=null,e._transport.disconnect()},2e3)}else bs.debug("UA already closed")}},{key:"normalizeTarget",value:function(e){return vs.normalizeTarget(e,this._configuration.hostport_params)}},{key:"get",value:function(e){switch(e){case"authorization_user":return this._configuration.authorization_user;case"realm":return this._configuration.realm;case"ha1":return this._configuration.ha1;case"authorization_jwt":return this._configuration.authorization_jwt;default:return void bs.warn('get() | cannot get "%s" parameter in runtime',e)}}},{key:"set",value:function(e,t){switch(e){case"authorization_user":this._configuration.authorization_user=String(t);break;case"password":this._configuration.password=String(t);break;case"realm":this._configuration.realm=String(t);break;case"ha1":this._configuration.ha1=String(t),this._configuration.password=null;break;case"authorization_jwt":this._configuration.authorization_jwt=String(t);break;case"display_name":this._configuration.display_name=t;break;case"extra_headers":this._configuration.extra_headers=t;break;default:return bs.warn('set() | cannot set "%s" parameter in runtime',e),!1}return!0}},{key:"newTransaction",value:function(e){this._transactions[e.type][e.id]=e,this.emit("newTransaction",{transaction:e})}},{key:"destroyTransaction",value:function(e){delete this._transactions[e.type][e.id],this.emit("transactionDestroyed",{transaction:e})}},{key:"newDialog",value:function(e){this._dialogs[e.id]=e}},{key:"destroyDialog",value:function(e){delete this._dialogs[e.id]}},{key:"newMessage",value:function(e,t){this._applicants[e]=e,this.emit("newMessage",t)}},{key:"newOptions",value:function(e,t){this._applicants[e]=e,this.emit("newOptions",t)}},{key:"destroyMessage",value:function(e){delete this._applicants[e]}},{key:"newRTCSession",value:function(e,t){this._sessions[e.id]=e,this.emit("newRTCSession",t)}},{key:"destroyRTCSession",value:function(e){delete this._sessions[e.id]}},{key:"registered",value:function(e){this.emit("registered",e)}},{key:"unregistered",value:function(e){this.emit("unregistered",e)}},{key:"registrationFailed",value:function(e){this.emit("registrationFailed",e)}},{key:"receiveRequest",value:function(e){var t=e.method;if(e.ruri.user!==this._configuration.uri.user&&e.ruri.user!==this._contact.uri.user)return bs.debug("Request-URI does not point to us"),void(e.method!==ds.ACK&&e.reply_sl(404));if(e.ruri.scheme!==ds.SIPS){if(!As.checkTransaction(this,e)){if(t===ds.INVITE?new As.InviteServerTransaction(this,this._transport,e):t!==ds.ACK&&t!==ds.CANCEL&&new As.NonInviteServerTransaction(this,this._transport,e),t===ds.OPTIONS){if(0===this.listeners("newOptions").length)return void e.reply(200);new _s(this).init_incoming(e)}else if(t===ds.MESSAGE){if(0===this.listeners("newMessage").length)return void e.reply(405);new gs(this).init_incoming(e)}else if(t===ds.INVITE&&!e.to_tag&&0===this.listeners("newRTCSession").length)return void e.reply(405);var n,r;if(e.to_tag)(n=this._findDialog(e.call_id,e.from_tag,e.to_tag))?n.receiveRequest(e):t===ds.NOTIFY?(r=this._findSession(e))?r.receiveRequest(e):(bs.debug("received NOTIFY request for a non existent subscription"),e.reply(481,"Subscription does not exist")):t!==ds.ACK&&e.reply(481);else switch(t){case ds.INVITE:if(window.RTCPeerConnection)if(e.hasHeader("replaces")){var i=e.replaces;(n=this._findDialog(i.call_id,i.from_tag,i.to_tag))?(r=n.owner).isEnded()?e.reply(603):r.receiveRequest(e):e.reply(481)}else(r=new ps(this)).init_incoming(e);else bs.warn("INVITE received but WebRTC is not supported"),e.reply(488);break;case ds.BYE:e.reply(481);break;case ds.CANCEL:(r=this._findSession(e))?r.receiveRequest(e):bs.debug("received CANCEL request for a non existent session");break;case ds.ACK:break;case ds.NOTIFY:this.emit("sipEvent",{event:e.event,request:e}),e.reply(200);break;default:e.reply(405)}}}else e.reply_sl(416)}},{key:"_findSession",value:function(e){var t=e.call_id,n=e.from_tag,r=e.to_tag,i=t+n,s=this._sessions[i],o=t+r,a=this._sessions[o];return s||(a||null)}},{key:"_findDialog",value:function(e,t,n){var r=e+t+n,i=this._dialogs[r];return i||(r=e+n+t,(i=this._dialogs[r])||null)}},{key:"_loadConfig",value:function(e){try{ws.load(this._configuration,e)}catch(e){throw e}0===this._configuration.display_name&&(this._configuration.display_name="0"),this._configuration.instance_id||(this._configuration.instance_id=vs.newUUID()),this._configuration.jssip_id=vs.createRandomToken(5);var t=this._configuration.uri.clone();t.user=null,this._configuration.hostport_params=t.toString().replace(/^sip:/i,"");try{this._transport=new ms(this._configuration.sockets,{max_interval:this._configuration.connection_recovery_max_interval,min_interval:this._configuration.connection_recovery_min_interval}),this._transport.onconnecting=Os.bind(this),this._transport.onconnect=ks.bind(this),this._transport.ondisconnect=Ds.bind(this),this._transport.ondata=qs.bind(this)}catch(e){throw bs.warn(e),new ys.ConfigurationError("sockets",this._configuration.sockets)}if(delete this._configuration.sockets,this._configuration.authorization_user||(this._configuration.authorization_user=this._configuration.uri.user),!this._configuration.registrar_server){var n=this._configuration.uri.clone();n.user=null,n.clearParams(),n.clearHeaders(),this._configuration.registrar_server=n}this._configuration.no_answer_timeout*=1e3,this._configuration.contact_uri?this._configuration.via_host=this._configuration.contact_uri.host:this._configuration.contact_uri=new Ts("sip",vs.createRandomToken(8),this._configuration.via_host,null,{transport:"ws"}),this._contact={pub_gruu:null,temp_gruu:null,uri:this._configuration.contact_uri,toString:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.anonymous||null,n=e.outbound||null,r="<";return r+=t?this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":this.pub_gruu||this.uri.toString(),!n||(t?this.temp_gruu:this.pub_gruu)||(r+=";ob"),r+=">"}};var r=["authorization_user","password","realm","ha1","authorization_jwt","display_name","register","extra_headers"];for(var i in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,i)&&(-1!==r.indexOf(i)?Object.defineProperty(this._configuration,i,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,i,{writable:!1,configurable:!1}));for(var s in bs.debug("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call(ws.settings,s))switch(s){case"uri":case"registrar_server":bs.debug("- ".concat(s,": ").concat(this._configuration[s]));break;case"password":case"ha1":case"authorization_jwt":bs.debug("- ".concat(s,": NOT SHOWN"));break;default:bs.debug("- ".concat(s,": ").concat(JSON.stringify(this._configuration[s])))}}},{key:"C",get:function(){return Is}},{key:"status",get:function(){return this._status}},{key:"contact",get:function(){return this._contact}},{key:"configuration",get:function(){return this._configuration}},{key:"transport",get:function(){return this._transport}}]),t}();function Os(e){this.emit("connecting",e)}function ks(e){this._status!==Is.STATUS_USER_CLOSED&&(this._status=Is.STATUS_READY,this._error=null,this.emit("connected",e),this._dynConfiguration.register&&this._registrator.register())}function Ds(e){for(var t=0,n=["nict","ict","nist","ist"];t<n.length;t++){var r=n[t];for(var i in this._transactions[r])Object.prototype.hasOwnProperty.call(this._transactions[r],i)&&this._transactions[r][i].onTransportError()}this.emit("disconnected",e),this._registrator.onTransportClosed(),this._status!==Is.STATUS_USER_CLOSED&&(this._status=Is.STATUS_NOT_READY,this._error=Is.NETWORK_ERROR)}function qs(e){var t=e.transport,n=e.message;if((n=Ss.parseMessage(n,this))&&!(this._status===Is.STATUS_USER_CLOSED&&n instanceof Cs.IncomingRequest)&&Es(n,this,t))if(n instanceof Cs.IncomingRequest)n.transport=t,this.receiveRequest(n);else if(n instanceof Cs.IncomingResponse){var r;switch(n.method){case ds.INVITE:(r=this._transactions.ict[n.via_branch])&&r.receiveResponse(n);break;case ds.ACK:break;default:(r=this._transactions.nict[n.via_branch])&&r.receiveResponse(n)}}}function Ms(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}var Ns=Oe,Us=U(),xs=new Ns("WebSocketInterface"),Ls=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),xs.debug('new() [url:"%s"]',t),this._url=t,this._sip_uri=null,this._via_transport=null,this._ws=null;var n=Us.parse(t,"absoluteURI");if(-1===n)throw xs.warn("invalid WebSocket URI: ".concat(t)),new TypeError("Invalid argument: ".concat(t));if("wss"!==n.scheme&&"ws"!==n.scheme)throw xs.warn("invalid WebSocket URI scheme: ".concat(n.scheme)),new TypeError("Invalid argument: ".concat(t));this._sip_uri="sip:".concat(n.host).concat(n.port?":".concat(n.port):"",";transport=ws"),this._via_transport=n.scheme.toUpperCase()}return Ms(e,[{key:"connect",value:function(){if(xs.debug("connect()"),this.isConnected())xs.debug("WebSocket ".concat(this._url," is already connected"));else if(this.isConnecting())xs.debug("WebSocket ".concat(this._url," is connecting"));else{this._ws&&this.disconnect(),xs.debug("connecting to WebSocket ".concat(this._url));try{this._ws=new WebSocket(this._url,"sip"),this._ws.binaryType="arraybuffer",this._ws.onopen=this._onOpen.bind(this),this._ws.onclose=this._onClose.bind(this),this._ws.onmessage=this._onMessage.bind(this),this._ws.onerror=this._onError.bind(this)}catch(e){this._onError(e)}}}},{key:"disconnect",value:function(){xs.debug("disconnect()"),this._ws&&(this._ws.onopen=function(){},this._ws.onclose=function(){},this._ws.onmessage=function(){},this._ws.onerror=function(){},this._ws.close(),this._ws=null)}},{key:"send",value:function(e){return xs.debug("send()"),this.isConnected()?(this._ws.send(e),!0):(xs.warn("unable to send message, WebSocket is not open"),!1)}},{key:"isConnected",value:function(){return this._ws&&this._ws.readyState===this._ws.OPEN}},{key:"isConnecting",value:function(){return this._ws&&this._ws.readyState===this._ws.CONNECTING}},{key:"_onOpen",value:function(){xs.debug("WebSocket ".concat(this._url," connected")),this.onconnect()}},{key:"_onClose",value:function(e){var t=e.wasClean,n=e.code,r=e.reason;xs.debug("WebSocket ".concat(this._url," closed")),!1===t&&xs.debug("WebSocket abrupt disconnection"),this.ondisconnect(!t,n,r)}},{key:"_onMessage",value:function(e){var t=e.data;xs.debug("received WebSocket message"),this.ondata(t)}},{key:"_onError",value:function(e){xs.warn("WebSocket ".concat(this._url," error: "),e)}},{key:"via_transport",get:function(){return this._via_transport},set:function(e){this._via_transport=e.toUpperCase()}},{key:"sip_uri",get:function(){return this._sip_uri}},{key:"url",get:function(){return this._url}}]),e}(),Bs=u,Ps=c,Fs=q,Hs=L(),Gs=Rs,Ys=x(),js=N(),Qs=U(),Ws=Ls;we("JsSIP")("version %s",Bs.version);var Ks,Js,zs=o({C:Ps,Exceptions:Fs,Utils:Hs,UA:Gs,URI:Ys,NameAddrHeader:js,WebSocketInterface:Ws,Grammar:Qs,debug:we,get name(){return Bs.title},get version(){return Bs.version}});!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=-1]="FAILED",e[e.TIMEOUT=-2]="TIMEOUT",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.UNAVAILABLE=403]="UNAVAILABLE",e[e.SYSTEMBUSY=450]="SYSTEMBUSY",e[e.NOENOUGNCHARACTER=10001]="NOENOUGNCHARACTER"}(Ks||(Ks={})),function(e){e[e.SUCCESS=200]="SUCCESS",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.UNAVAILABLE=403]="UNAVAILABLE",e[e.TIMEOUT=408]="TIMEOUT",e[e.LOCKED=423]="LOCKED",e[e.SYSTEMBUSY=450]="SYSTEMBUSY",e[e.FAILED=500]="FAILED",e[e.NOENOUGNCHARACTER=10001]="NOENOUGNCHARACTER"}(Js||(Js={})),zs.debug.disable();var Vs=function(){function e(e){this.callType="",this.ua={},this.socket={},this.isManualStop=!1,this.pingTimerId=0,this.newRTCSession={},this.incomingSession={},this.outgoingSession={},this.stream={},this.audio=new Audio,this.ringAudio=new Audio("data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYwLjEyLjEwMAAAAAAAAAAAAAAA/+NAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAABGAABmoQACAwMDBAgIDBAUFBYaGh4iIiUpLCwvMzM3Ozs/Q0dHS09PU1dXW19kZGhsbHB0dHh8gICEiIiMkJCUmJycoKSkqKyssLO3t7u/v8PHx8vP0tLW2tre4uLm6u7u8fT0+Pv7//8AAAAATGF2YzYwLjI2AAAAAAAAAAAAAAAAJANAAAAAAAAAZqGS3w4qAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/jEGQAAAABpAAAAAAAAANIAAAAAP+YSXZLC+9DgcDGZj1QcY5YcTQaglIDDNqAdgLpg2P/4xBkHwAAAaQAA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sw1v7393ya3/8yiTvRqr5srFsgBwAAAAKTgKUWWQOl+a////66K/v0b//+hEb5m+f/oxX+lF9X/R+X9P///+mm1u/0SztjAEGmcwt84pf89/zFwAFa7ksqi1eUyliKgqlLhoTQYAZgMDphREZlIJZgsBYGDQiAtCWYEgMaHuEYeAAYCgIBgBMT/+OAZDYlMgswo+74AA2RokofwRAACxMZhXMiFeMHBVgxUw7jCrA2IAD21HgFVPPO3FjTrOKy10XGgODn6gN+5Daty+ds242wSvFqkWf6DY1G5a88IeCFQ640zGFkWFOr8Rn2gF3ZWYAgAqMyzw4AWK0D7U2Gr9NTS6m2kNIJyJO3DrpAUAAwAQCB4BYwBQLDBHCwMJ0AJ8AaAAiMyq64MPWv5rv/v8u44440tLl12b0MVIRGIax/3uq1dU0as6pqamy3Symm7+qaNU1NTY////////8/e99/////////////////f/+6WVT2pVZ////yy1TRqNRqXU1NKqWzjjzVNKqaz+X/jS0tkR4BiYoYA/zN4S//J+ye4USGdv5G//+kx3Q3/+n/WqCv/+p3/xFEQNHv///1BVzPMi9I12M4lYAAAYPL5XczooDZ2yqWytmxgcCg4IBqYT5pyMZgGC5hiDpg8FhQVRgAEpnt5Zj4MpguEpgoMhmYSpqOUp3SfJoMR1mHmKKYhYR5gvgZlUAQBAWGAQAMwUQgDvomQJACOswN/+OAZGInQb8k8674ABRDJkWvQVAAubAUVk8BIA5m76vw2GSL6gIYADSoMBYAFTOC1GG0ZS0l00Q1mqduy9qUwQAGnIl4zUtMq5ym+XKra/ooAOFACjAiAtSpC4AQ0AjDTT5WrqKRhkim0FsqSIVkIgBGdurPMJjbI0EjTzADADAQCJgEg9GAuAUYDoG48Amw58XNqYYcz/DDD//+09Ky/Dsruw9DkYjDsxS9XiUCR+336kYl9v////////////////uFPU//y/Cxblj/xSRMsdOL77//nc///////lSrlE41Altvn4UJqcvBiPeWLAiKBgHv81/jBg/Ge3zG/+YYqmHnt/ukw+hpcn/7Oiu3///1T///5rfu3/////mD8z5hINyRHYgGI6G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GYMDpAhcA3J1wYBCwFXCdTwuM4UMF83czo/x5nYGEAQ5CgZAcAha51MkrGb/43Bk/CmJ4zF/zmgSCeAKSlOCAAANJcdmKxVtRJ+oBmYzHq1Nd3n3F44y8tLU1jjz/6/z8OlYZvFmdS2zSU9LPyymx1+W946////+m1z//////9c/7m+3u49wywzx7ruHed/LVWQCAARAMEiCgCACGJYS8OuPZaE3yp9q/1fh54fnf1Pt/93//2///6JMQU1FMy4xMDEgKGJldGEgMimqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/jEGTgAAAB/gDgAAAAAAP8AcAAAKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo="),this.answerEvent=[],this.newMessageEvent=[],this.sessionEvent={},this.callDetails=null,this.getMediaStream=function(){return navigator.mediaDevices.getUserMedia({audio:!0,video:!1})},this.incomingCallCallback=e.incomingCallCallback,(null==e?void 0:e.getMediaStream)&&(this.getMediaStream=e.getMediaStream)}return e.prototype.initMicrophone=function(){var e=this;this.getMediaStream().then(function(t){e.stream=t}).catch(function(){console.error("Error getting microphone stream")})},e.prototype.destroyMicrophone=function(){var e,t;this.stream&&(null===(t=(e=this.stream).getTracks)||void 0===t||t.call(e).forEach(function(e){return e.stop()}),this.stream={})},e.prototype.reset=function(){this.newRTCSession={},this.incomingSession={},this.outgoingSession={},this.setCallType(""),this.callDetails=null,clearTimeout(this.pingTimerId),this.pingTimerId=0},e.prototype.setCallType=function(e){this.callType=e},e.prototype.getCallType=function(){return this.callType},e.prototype.init=function(e){return n(this,void 0,void 0,function(){var t,i,s,o,a,u=this;return r(this,function(l){return t=e.wssuri,i=e.password,s=e.uri,this.socket=new zs.WebSocketInterface(t),o={sockets:[this.socket],uri:s,password:i,register:!0,register_expires:10,session_timers:!0},(a=new zs.UA(o)).on("connected",function(){u.sendPing()}),a.on("disconnected",function(){u.isManualStop&&u.stop()}),a.on("registrationFailed",function(){u.stop()}),a.on("registrationExpiring",function(){u.ua.register()}),a.on("newMessage",function(e){var t=JSON.parse(e.request.body);u.emitNewMessageEvent({code:Js.SUCCESS,data:t,message:"success"})}),a.on("newRTCSession",function(e){return n(u,void 0,void 0,function(){var t,n,i=this;return r(this,function(r){switch(r.label){case 0:return this.callDetails=null,this.newRTCSession=e,t=e.session,"remote"!==e.originator?[3,4]:"outboundCall"!==this.callType?[3,1]:(this.answer(),[3,3]);case 1:return this.setCallType("inboundCall"),[4,this.incomingCallCallback(e)];case 2:n=r.sent(),this.callDetails=n.data,this.playRing(),this.emitAnswerEvent(n),r.label=3;case 3:return this.incomingSession=t,this.incomingSession.on("connecting",function(){}),[3,5];case 4:this.outgoingSession=t,this.outgoingSession.on("connecting",function(){}),r.label=5;case 5:return t.on("confirmed",function(e){"outboundCall"!==i.callType&&i.emitSessionEvent("success",{code:Js.SUCCESS,data:i.callDetails,message:"success"})}),t.on("ended",function(e){i.emitSessionEvent("ended",{code:Js.SUCCESS,data:i.callDetails,message:"success"}),i.reset()}),t.on("failed",function(e){i.emitSessionEvent("failed",{code:Js.FAILED,data:i.callDetails,message:"failed"}),i.reset()}),t.on("peerconnection",function(e){e.peerconnection.ontrack=function(e){if(e.streams&&e.streams[0])i.audio.srcObject=e.streams[0],i.audio.paused&&i.audio.play();else{var t=new MediaStream;t.addTrack(e.track),i.audio.srcObject=t,i.audio.paused&&i.audio.play()}}}),[2]}})})}),this.ua=a,this.ringAudio.loop=!0,[2]})})},e.prototype.start=function(){this.isManualStop=!1,this.initMicrophone(),this.ua.start()},e.prototype.stop=function(e){e&&(this.isManualStop=!0),this.destroyMicrophone(),this.reset(),this.ua.stop()},e.prototype.destroy=function(){this.stop(),this.ua={}},e.prototype.getSocketWS=function(){return this.socket._ws},e.prototype.sendPing=function(){var e=this;this.pingTimerId=setTimeout(function(){var t=!1;try{t=e.socket.send("ping")}catch(e){t=!1}var n=e.getSocketWS();if(!t&&![0,1].includes(null==n?void 0:n.readyState))return e.socket.connect(),clearTimeout(e.pingTimerId),void(e.pingTimerId=0);e.sendPing()},3e3)},e.prototype.playRing=function(){this.ringAudio.play()},e.prototype.stopRing=function(){this.ringAudio.pause(),this.ringAudio.currentTime=0},e.prototype.call=function(e,t,n,r){var i={eventHandlers:t,mediaConstraints:{audio:!0,video:!1},mediaStream:this.stream,sessionTimersExpires:1800};this.ua.call(e,i)},e.prototype.hangup=function(){this.stopRing(),this.ua.terminateSessions()},e.prototype.ignore=function(){this.stopRing(),this.ua.terminateSessions({cause:"Busy",status_code:486})},e.prototype.answer=function(){this.stopRing(),this.newRTCSession.session.answer({mediaConstraints:{audio:!0,video:!1},mediaStream:this.stream,sessionTimersExpires:1800})},e.prototype.attachAnswerEvent=function(e){e&&"function"==typeof e&&this.answerEvent.push(e)},e.prototype.removeAnswerEvent=function(e){var t=this.answerEvent;if(t&&t.length)for(var n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}},e.prototype.emitAnswerEvent=function(e){this.answerEvent.forEach(function(t){t(e)})},e.prototype.attachNewMessageEvent=function(e){var t;e&&"function"==typeof e&&(null===(t=this.newMessageEvent)||void 0===t||t.push(e))},e.prototype.removeNewMessageEvent=function(e){var t=this.newMessageEvent;if(t&&t.length)for(var n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}},e.prototype.emitNewMessageEvent=function(e){this.newMessageEvent.forEach(function(t){t(e)})},e.prototype.attchSessionEvent=function(e,t){t&&"function"==typeof t&&(this.sessionEvent[e]||(this.sessionEvent[e]=[]),this.sessionEvent[e].push(t))},e.prototype.removeSessionEvent=function(e,t){var n=this.sessionEvent[e];if(n&&n.length)for(var r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1);break}},e.prototype.emitSessionEvent=function(e,t){(this.sessionEvent[e]||[]).forEach(function(e){e(t)})},e.prototype.on=function(e,t){return this.ua.on(e,t),this},e.prototype.RTCSessionOn=function(e,t){this.newRTCSession.session.on(e,t)},e.prototype.mute=function(){this.newRTCSession.session.mute({audio:!0})},e.prototype.unmute=function(){this.newRTCSession.session.unmute({audio:!0})},e.prototype.isMuted=function(){return this.newRTCSession.session.isMuted()},e.prototype.getIsRegistered=function(){return this.ua.isRegistered()},e}(),Zs={exports:{}};
2
2
  /** @license
3
3
  * eventsource.js
4
4
  * Available under MIT License (MIT)
5
5
  * https://github.com/Yaffle/EventSource/
6
6
  */
7
- !function(e,t){!function(n){var r=n.setTimeout,i=n.clearTimeout,s=n.XMLHttpRequest,o=n.XDomainRequest,a=n.ActiveXObject,u=n.EventSource,l=n.document,c=n.Promise,h=n.fetch,d=n.Response,f=n.TextDecoder,p=n.TextEncoder,g=n.AbortController;if("undefined"==typeof window||void 0===l||"readyState"in l||null!=l.body||(l.readyState="loading",window.addEventListener("load",function(e){l.readyState="complete"},!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==g){var _=h;h=function(e,t){var n=t.signal;return _(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then(function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}})},g=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function A(){this.bitsNeeded=0,this.codePoint=0}A.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r=65533,i="",s=this.bitsNeeded,o=this.codePoint,a=0;a<e.length;a+=1){var u=e[a];0!==s&&(u<128||u>191||!t(o<<6|63&u,s-6,n(s,o)))&&(s=0,o=r,i+=String.fromCharCode(o)),0===s?(u>=0&&u<=127?(s=0,o=u):u>=192&&u<=223?(s=6,o=31&u):u>=224&&u<=239?(s=12,o=15&u):u>=240&&u<=247?(s=18,o=7&u):(s=0,o=r),0===s||t(o,s,n(s,o))||(s=0,o=r)):(s-=6,o=o<<6|63&u),0===s&&(o<=65535?i+=String.fromCharCode(o):(i+=String.fromCharCode(55296+(o-65535-1>>10)),i+=String.fromCharCode(56320+(o-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=o,i};null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=A);var m=function(){};function v(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=m,this.onload=m,this.onerror=m,this.onreadystatechange=m,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=m}function y(e){return e.replace(/[A-Z]/g,function(e){return String.fromCharCode(e.charCodeAt(0)+32)})}function T(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var i=n[r].split(": "),s=i.shift(),o=i.join(": ");t[y(s)]=o}this._map=t}function S(){}function C(e){this._headers=e}function E(){}function w(){this._listeners=Object.create(null)}function b(e){r(function(){throw e},0)}function I(e){this.type=e,this.target=void 0}function R(e,t){I.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function O(e,t){I.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){I.call(this,e),this.error=t.error}v.prototype.open=function(e,t){this._abort(!0);var n=this,o=this._xhr,a=1,u=0;this._abort=function(e){0!==n._sendTimeout&&(i(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,o.onload=m,o.onerror=m,o.onabort=m,o.onprogress=m,o.onreadystatechange=m,o.abort(),0!==u&&(i(u),u=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var l=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in o)e=200,t="OK",r=o.contentType;else try{e=o.status,t=o.statusText,r=o.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},c=function(){if(l(),2===a||3===a){a=3;var e="";try{e=o.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:m}),c(),1===a||2===a||3===a){if(a=4,0!==u&&(i(u),u=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},d=function(){u=r(function(){d()},500),3===o.readyState&&c()};"onload"in o&&(o.onload=function(e){h("load",e)}),"onerror"in o&&(o.onerror=function(e){h("error",e)}),"onabort"in o&&(o.onabort=function(e){h("abort",e)}),"onprogress"in o&&(o.onprogress=c),"onreadystatechange"in o&&(o.onreadystatechange=function(e){!function(e){null!=o&&(4===o.readyState?"onload"in o&&"onerror"in o&&"onabort"in o||h(""===o.responseText?"error":"load",e):3===o.readyState?"onprogress"in o||c():2===o.readyState&&l())}(e)}),!("contentType"in o)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),o.open(e,t,!0),"readyState"in o&&(u=r(function(){d()},0))},v.prototype.abort=function(){this._abort(!1)},v.prototype.getResponseHeader=function(e){return this._contentType},v.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},v.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},v.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==l||null==l.readyState||"complete"===l.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=r(function(){t._sendTimeout=0,t.send()},4)}},T.prototype.get=function(e){return this._map[y(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),S.prototype.open=function(e,t,n,r,i,o,a){e.open("GET",i);var u=0;for(var l in e.onprogress=function(){var t=e.responseText.slice(u);u+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var n=e.status,r=e.statusText,i=e.getResponseHeader("Content-Type"),o=e.getAllResponseHeaders();t(n,r,i,new T(o))}},e.withCredentials=o,a)Object.prototype.hasOwnProperty.call(a,l)&&e.setRequestHeader(l,a[l]);return e.send(),e},C.prototype.get=function(e){return this._headers.get(e)},E.prototype.open=function(e,t,n,r,i,s,o){var a=null,u=new g,l=u.signal,d=new f;return h(i,{headers:o,credentials:s?"include":"same-origin",signal:l,cache:"no-store"}).then(function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new C(e.headers)),new c(function(e,t){var r=function(){a.read().then(function(t){if(t.done)e(void 0);else{var i=d.decode(t.value,{stream:!0});n(i),r()}}).catch(function(e){t(e)})};r()})}).catch(function(e){return"AbortError"===e.name?void 0:e}).then(function(e){r(e)}),{abort:function(){null!=a&&a.cancel(),u.abort()}}},w.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var i=t[r];try{"function"==typeof i.handleEvent?i.handleEvent(e):i.call(this,e)}catch(e){b(e)}}},w.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var i=!1,s=0;s<r.length;s+=1)r[s]===t&&(i=!0);i||r.push(t)},w.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var i=[],s=0;s<r.length;s+=1)r[s]!==t&&i.push(r[s]);0===i.length?delete n[e]:n[e]=i}},R.prototype=Object.create(I.prototype),O.prototype=Object.create(I.prototype),k.prototype=Object.create(I.prototype);var D=-1,q=-1,M=/^text\/event\-stream(;.*)?$/i,N=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),U(n)},U=function(e){return Math.min(Math.max(e,1e3),18e6)},x=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){b(e)}};function L(e,t){w.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,n){t=String(t);var a=Boolean(n.withCredentials),u=n.lastEventIdQueryParameterName||"lastEventId",l=U(1e3),c=N(n.heartbeatTimeout,45e3),h="",d=l,f=!1,p=0,g=n.headers||{},_=n.Transport,A=B&&null==_?void 0:new v(null!=_?new _:null!=s&&"withCredentials"in s.prototype||null==o?new s:new o),m=null!=_&&"string"!=typeof _?new _:null==A?new E:new S,y=void 0,T=0,C=D,w="",b="",I="",L="",P=0,F=0,H=0,G=function(t,n,r,i){if(0===C)if(200===t&&null!=r&&M.test(r)){C=1,f=Date.now(),d=l,e.readyState=1;var s=new O("open",{status:t,statusText:n,headers:i});e.dispatchEvent(s),x(e,e.onopen,s)}else{var o="";200!==t?(n&&(n=n.replace(/\s+/g," ")),o="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):o="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",Q();s=new O("error",{status:t,statusText:n,headers:i});e.dispatchEvent(s),x(e,e.onerror,s),console.error(o)}},Y=function(t){if(1===C){for(var n=-1,s=0;s<t.length;s+=1){(u=t.charCodeAt(s))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(n=s)}var o=(-1!==n?L:"")+t.slice(0,n+1);L=(-1===n?L:"")+t.slice(n+1),""!==t&&(f=Date.now(),p+=t.length);for(var a=0;a<o.length;a+=1){var u=o.charCodeAt(a);if(P===q&&u==="\n".charCodeAt(0))P=0;else if(P===q&&(P=0),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(0!==P){1===P&&(H=a+1);var g=o.slice(F,H-1),_=o.slice(H+(H<a&&o.charCodeAt(H)===" ".charCodeAt(0)?1:0),a);"data"===g?(w+="\n",w+=_):"id"===g?b=_:"event"===g?I=_:"retry"===g?(l=N(_,l),d=l):"heartbeatTimeout"===g&&(c=N(_,c),0!==T&&(i(T),T=r(function(){W()},c)))}if(0===P){if(""!==w){h=b,""===I&&(I="message");var A=new R(I,{data:w.slice(1),lastEventId:b});if(e.dispatchEvent(A),"open"===I?x(e,e.onopen,A):"message"===I?x(e,e.onmessage,A):"error"===I&&x(e,e.onerror,A),2===C)return}w="",I=""}P=u==="\r".charCodeAt(0)?q:0}else 0===P&&(F=a,P=1),1===P?u===":".charCodeAt(0)&&(H=a+1,P=2):2===P&&(P=3)}}},j=function(t){if(1===C||0===C){C=D,0!==T&&(i(T),T=0),T=r(function(){W()},d),d=U(Math.min(16*l,2*d)),e.readyState=0;var n=new k("error",{error:t});e.dispatchEvent(n),x(e,e.onerror,n),null!=t&&console.error(t)}},Q=function(){C=2,null!=y&&(y.abort(),y=void 0),0!==T&&(i(T),T=0),e.readyState=2},W=function(){if(T=0,C===D){f=!1,p=0,T=r(function(){W()},c),C=0,w="",I="",b=h,L="",F=0,H=0,P=0;var n=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var i=t.indexOf("?");n=-1===i?t:t.slice(0,i+1)+t.slice(i+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,function(e,t){return t===u?"":e}),n+=(-1===t.indexOf("?")?"?":"&")+u+"="+encodeURIComponent(h)}var s=e.withCredentials,o={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(o[l]=a[l]);try{y=m.open(A,G,Y,j,n,s,o)}catch(e){throw Q(),e}}else if(f||null==y){var d=Math.max((f||Date.now())+c-Date.now(),1);f=!1,T=r(function(){W()},d)}else j(new Error("No activity within "+c+" milliseconds. "+(0===C?"No response received.":p+" chars received.")+" Reconnecting.")),null!=y&&(y.abort(),y=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=g,e._close=Q,W()}(this,e,t)}var B=null!=h&&null!=d&&"body"in d.prototype;L.prototype=Object.create(w.prototype),L.prototype.CONNECTING=0,L.prototype.OPEN=1,L.prototype.CLOSED=2,L.prototype.close=function(){this._close()},L.CONNECTING=0,L.OPEN=1,L.CLOSED=2,L.prototype.withCredentials=void 0;var P,F=u;null==s||null!=u&&"withCredentials"in u.prototype||(F=L),P=function(e){e.EventSourcePolyfill=L,e.NativeEventSource=u,e.EventSource=F}(t),void 0!==P&&(e.exports=P)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}(Vs,Vs.exports);var Zs,Xs,$s=Vs.exports,eo={exports:{}},to=s(eo.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",i="second",s="minute",o="hour",a="day",u="week",l="month",c="quarter",h="year",d="date",f="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},A=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},m={s:A,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+A(r,2,"0")+":"+A(i,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),s=n-i<0,o=t.clone().add(r+(s?-1:1),l);return+(-(r+(n-i)/(s?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:h,w:u,d:a,D:d,h:o,m:s,s:i,ms:r,Q:c}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},v="en",y={};y[v]=_;var T="$isDayjsObject",S=function(e){return e instanceof b||!(!e||!e[T])},C=function e(t,n,r){var i;if(!t)return v;if("string"==typeof t){var s=t.toLowerCase();y[s]&&(i=s),n&&(y[s]=n,i=s);var o=t.split("-");if(!i&&o.length>1)return e(o[0])}else{var a=t.name;y[a]=t,i=a}return!r&&i&&(v=i),i||!r&&v},E=function(e,t){if(S(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new b(n)},w=m;w.l=C,w.i=S,w.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var b=function(){function _(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[T]=!0}var A=_.prototype;return A.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(p);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(t)}(e),this.init()},A.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},A.$utils=function(){return w},A.isValid=function(){return!(this.$d.toString()===f)},A.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},A.isAfter=function(e,t){return E(e)<this.startOf(t)},A.isBefore=function(e,t){return this.endOf(t)<E(e)},A.$g=function(e,t,n){return w.u(e)?this[t]:this.set(n,e)},A.unix=function(){return Math.floor(this.valueOf()/1e3)},A.valueOf=function(){return this.$d.getTime()},A.startOf=function(e,t){var n=this,r=!!w.u(t)||t,c=w.p(e),f=function(e,t){var i=w.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(a)},p=function(e,t){return w.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},g=this.$W,_=this.$M,A=this.$D,m="set"+(this.$u?"UTC":"");switch(c){case h:return r?f(1,0):f(31,11);case l:return r?f(1,_):f(0,_+1);case u:var v=this.$locale().weekStart||0,y=(g<v?g+7:g)-v;return f(r?A-y:A+(6-y),_);case a:case d:return p(m+"Hours",0);case o:return p(m+"Minutes",1);case s:return p(m+"Seconds",2);case i:return p(m+"Milliseconds",3);default:return this.clone()}},A.endOf=function(e){return this.startOf(e,!1)},A.$set=function(e,t){var n,u=w.p(e),c="set"+(this.$u?"UTC":""),f=(n={},n[a]=c+"Date",n[d]=c+"Date",n[l]=c+"Month",n[h]=c+"FullYear",n[o]=c+"Hours",n[s]=c+"Minutes",n[i]=c+"Seconds",n[r]=c+"Milliseconds",n)[u],p=u===a?this.$D+(t-this.$W):t;if(u===l||u===h){var g=this.clone().set(d,1);g.$d[f](p),g.init(),this.$d=g.set(d,Math.min(this.$D,g.daysInMonth())).$d}else f&&this.$d[f](p);return this.init(),this},A.set=function(e,t){return this.clone().$set(e,t)},A.get=function(e){return this[w.p(e)]()},A.add=function(r,c){var d,f=this;r=Number(r);var p=w.p(c),g=function(e){var t=E(f);return w.w(t.date(t.date()+Math.round(e*r)),f)};if(p===l)return this.set(l,this.$M+r);if(p===h)return this.set(h,this.$y+r);if(p===a)return g(1);if(p===u)return g(7);var _=(d={},d[s]=t,d[o]=n,d[i]=e,d)[p]||1,A=this.$d.getTime()+r*_;return w.w(A,this)},A.subtract=function(e,t){return this.add(-1*e,t)},A.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",i=w.z(this),s=this.$H,o=this.$m,a=this.$M,u=n.weekdays,l=n.months,c=n.meridiem,h=function(e,n,i,s){return e&&(e[n]||e(t,r))||i[n].slice(0,s)},d=function(e){return w.s(s%12||12,e,"0")},p=c||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(g,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return w.s(t.$y,4,"0");case"M":return a+1;case"MM":return w.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return t.$D;case"DD":return w.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return h(n.weekdaysMin,t.$W,u,2);case"ddd":return h(n.weekdaysShort,t.$W,u,3);case"dddd":return u[t.$W];case"H":return String(s);case"HH":return w.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return p(s,o,!0);case"A":return p(s,o,!1);case"m":return String(o);case"mm":return w.s(o,2,"0");case"s":return String(t.$s);case"ss":return w.s(t.$s,2,"0");case"SSS":return w.s(t.$ms,3,"0");case"Z":return i}return null}(e)||i.replace(":","")})},A.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},A.diff=function(r,d,f){var p,g=this,_=w.p(d),A=E(r),m=(A.utcOffset()-this.utcOffset())*t,v=this-A,y=function(){return w.m(g,A)};switch(_){case h:p=y()/12;break;case l:p=y();break;case c:p=y()/3;break;case u:p=(v-m)/6048e5;break;case a:p=(v-m)/864e5;break;case o:p=v/n;break;case s:p=v/t;break;case i:p=v/e;break;default:p=v}return f?p:w.a(p)},A.daysInMonth=function(){return this.endOf(l).$D},A.$locale=function(){return y[this.$L]},A.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},A.clone=function(){return w.w(this.$d,this)},A.toDate=function(){return new Date(this.valueOf())},A.toJSON=function(){return this.isValid()?this.toISOString():null},A.toISOString=function(){return this.$d.toISOString()},A.toString=function(){return this.$d.toUTCString()},_}(),I=b.prototype;return E.prototype=I,[["$ms",r],["$s",i],["$m",s],["$H",o],["$W",a],["$M",l],["$y",h],["$D",d]].forEach(function(e){I[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),E.extend=function(e,t){return e.$i||(e(t,b,E),e.$i=!0),E},E.locale=C,E.isDayjs=S,E.unix=function(e){return E(1e3*e)},E.en=y[v],E.Ls=y,E.p={},E}()),no="aks_agent_token",ro=function(){function r(e){this.baseUrl="",this.eventSource=null,this.retryCount=0,this.retryMap=new Map,this.token="",this.id=e.id,this.getSystemToken=e.getSystemToken,this.resetSSE=e.resetSSE,this.retryCount=e.retryCount||0,this.baseUrl=e.baseUrl||""}return r.prototype.validateToken=function(e,r){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,fetch("".concat(this.baseUrl,"/iam/token/validate?accountId=").concat(e),{method:"GET",headers:{authentication:r}}).then(function(e){return e.json()})]})})},r.prototype.initToken=function(){return t(this,void 0,void 0,function(){var e,t,r;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.getSystemToken()];case 1:return(e=n.sent())?[4,this.validateToken(this.id,e)]:[2,{code:Ws.FAILED,data:null,message:"get system token failed"}];case 2:return(t=n.sent()).code===Ws.SUCCESS?(this.token=e,sessionStorage.setItem(no,e),this.executePeriodically(this.refreshToken.bind(this),12e5),[2,{code:Ws.SUCCESS,data:null,message:t.message}]):[2,{code:Ws.FAILED,data:null,message:t.message}];case 3:return r=n.sent(),[2,{code:Ws.FAILED,data:null,message:(null==r?void 0:r.toString())||"system error"}];case 4:return[2]}})})},r.prototype.refreshToken=function(){return t(this,void 0,void 0,function(){var e=this;return n(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/iam/oauth2/refresh")}).then(function(t){t.token&&(e.token=t.token,sessionStorage.setItem(no,t.token),e.eventSource&&e.resetSSE())})]})})},r.prototype.getAgentStatusList=function(){return t(this,void 0,void 0,function(){return n(this,function(e){return[2,this.request({url:"".concat(this.baseUrl,"/voipPlatform/agent/status/list")})]})})},r.prototype.getAgentInfo=function(){return t(this,void 0,void 0,function(){return n(this,function(e){return[2,this.request({url:"".concat(this.baseUrl,"/voipPlatform/agent/getAgentByUserId")})]})})},r.prototype.getAgentSetting=function(e){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/call_tasks/getAgentSetting"),data:e})]})})},r.prototype.updateAgentHangup=function(e){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/agent/").concat(e),method:"PUT"})]})})},r.prototype.updateAgentTicket=function(e){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this.request({method:"POST",url:"".concat(this.baseUrl,"/voipPlatform/agent/ticket"),data:e})]})})},r.prototype.registerSSE=function(e){return t(this,void 0,void 0,function(){var r,i,s,o,a,u=this;return n(this,function(l){return r=e.agentId,i=e.onMessage,s=function(e){},o=new Promise(function(e){s=e}),a=this.token,this.eventSource=new $s.EventSourcePolyfill("".concat(this.baseUrl,"/crm/v1/agent_command/regist_agent_event?agentId=").concat(r),{headers:{Authentication:a,"Cache-Control":"no-cache",Connection:"keep-alive"},heartbeatTimeout:12e4}),this.eventSource.onmessage=i,this.eventSource.onopen=function(){return t(u,void 0,void 0,function(){return n(this,function(e){return s(!0),[2]})})},this.eventSource.onerror=function(){return t(u,void 0,void 0,function(){return n(this,function(e){return s(!1),[2]})})},[2,o]})})},r.prototype.closeSSE=function(e){return t(this,void 0,void 0,function(){var t,r,i=this;return n(this,function(n){return t=e.agentId,r=e.clearTicket,this.eventSource?[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/agent_command/regist_agent_close?agentId=").concat(t,"&clearTicket=").concat(r)}).then(function(){i.eventSource.close(),i.eventSource=null})]:[2]})})},r.prototype.switchAgentStatus=function(e){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this.request({method:"PUT",url:"".concat(this.baseUrl,"/voipPlatform/agent/agentStatusSwitch"),data:e})]})})},r.prototype.outboundCall=function(e){return t(this,void 0,void 0,function(){var t,r;return n(this,function(n){return t=e.phone,r=e.line,[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/agentOutBoundCall/dialer/startCall/").concat(t,"/").concat(r),method:"POST"})]})})},r.prototype.saveAgentResponseTime=function(e){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this.request({method:"POST",url:"".concat(this.baseUrl,"/crm/v1/call_record/callRecordAgent"),data:e})]})})},r.prototype.getCallTaskInfo=function(e){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/call_tasks/getCallTaskName/").concat(e.callTaskId)})]})})},r.prototype.getAfterCallProcessTime=function(e){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/predictCall/afterCallProcessTime/").concat(e.callTaskId)})]})})},r.prototype.formatFormData=function(e){var t=new FormData;for(var n in e)e[n]&&t.append(n,e[n]);return t},r.prototype.sendBeacon=function(e){if("function"==typeof navigator.sendBeacon&&e.url){e.createTime||(e.createTime=to().format("yyyy-MM-DD HH:mm:ss")),e.sendTime=to().format("yyyy-MM-DD HH:mm:ss"),e.Authentication=this.getTokenWithFallback();var t=e.url,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["url"]),r=this.formatFormData(n),i=navigator.sendBeacon(t,r);if(!i){e.lastSendResult=i;var s=JSON.parse(localStorage.getItem("aks_beacon_queue")||"[]");s.push(e),localStorage.setItem("aks_beacon_queue",JSON.stringify(s))}}},r.prototype.clearnSendBeaconQueue=function(){return t(this,void 0,void 0,function(){var e,t;return n(this,function(n){switch(n.label){case 0:return(e=JSON.parse(localStorage.getItem("aks_beacon_queue")||"[]")).length?[4,this.waitToken()]:[3,4];case 1:return n.sent()?[3,3]:[4,this.initToken()];case 2:if(n.sent().code!==Ws.SUCCESS)return[2];n.label=3;case 3:for(t=0;t<e.length-1;t++)this.sendBeacon(e[t]);n.label=4;case 4:return[2]}})})},r.prototype.getTokenWithFallback=function(){return this.token?this.token:sessionStorage.getItem(no)||""},r.prototype.waitToken=function(e,t){var n=this;return void 0===e&&(e=3e3),void 0===t&&(t=200),new Promise(function(r){var i=setInterval(function(){((e-=t)<=0||n.token)&&(clearInterval(i),r(Boolean(n.token)))},200)})},r.prototype.request=function(r){return t(this,void 0,void 0,function(){var i,s,o,a=this;return n(this,function(u){switch(u.label){case 0:return!this.retryMap.has(r.url)&&this.retryCount&&this.retryMap.set(r.url,this.retryCount),this.token?[3,3]:[4,this.waitToken()];case 1:return u.sent()?[3,3]:[4,this.initToken()];case 2:if((i=u.sent()).code!==Ws.SUCCESS)return[2,{code:i.code,message:i.message,data:null}];u.label=3;case 3:return s={method:r.method||"GET",headers:e({"Content-Type":"application/json",authentication:this.token},r.headers)},"GET"!==(null===(o=s.method)||void 0===o?void 0:o.toLocaleUpperCase())&&(s.body=JSON.stringify(r.data)),[2,fetch(r.url,s).then(function(e){return t(a,void 0,void 0,function(){var t,i;return n(this,function(n){switch(n.label){case 0:return t=this.retryMap.get(r.url),401!==e.status?[3,3]:t?(this.retryMap.set(r.url,t-1),[4,this.initToken()]):[3,2];case 1:return(i=n.sent()).code===Ws.SUCCESS?[2,this.request(r)]:[2,i];case 2:return this.retryCount&&this.retryMap.delete(r.url),[2,{code:Ws.UNAUTHORIZED,message:"Unauthorized",data:null}];case 3:return[2,e.json()]}})})})]}})})},r.prototype.executePeriodically=function(e,t){var n=Date.now()+t,r=function(){var i=Date.now();i>=n&&(e(),n+=t);var s=Math.max(0,n-i);setTimeout(r,s)};r()},r.getInstance=function(e){return!r.instance&&e&&(r.instance=new r(e)),r.instance},r.instance=null,r}();!function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.HANGUP=4]="HANGUP"}(Zs||(Zs={})),function(e){e[e.ANSWER=1]="ANSWER",e[e.HANGUP=2]="HANGUP"}(Xs||(Xs={}));var io=function(){function i(e){var t=this;this.sip={},this.api={},this.agentInfo={},this.initEvent={},this.agentEvent={},this.agentWaitingTime=0,this.agentResponseTime=0,this.timer=null,this.callDetails={},this.api=ro.getInstance({id:e.id,getSystemToken:e.getSystemToken,resetSSE:this.resetSSE.bind(this),retryCount:e.retryCount,baseUrl:null==e?void 0:e.baseUrl}),this.sip=new zs({incomingCallCallback:this.incomingCall.bind(this),getMediaStream:null==e?void 0:e.getMediaStream}),this.sip.attchSessionEvent("failed",this.sessionFailed.bind(this)),this.attachAgentEvent("online",this.openOnunload.bind(this)),this.attachAgentEvent("offline",this.cancelOnunload.bind(this)),this.init().then(function(){t.api.clearnSendBeaconQueue()})}return i.prototype.init=function(){return t(this,void 0,void 0,function(){var t,r;return n(this,function(n){switch(n.label){case 0:return[4,this.api.initToken()];case 1:return t=n.sent(),r=e(e({},t),{code:t.code===Ws.SUCCESS?Ks.SUCCESS:Ks.FAILED}),this.emitInitEvent(t.code===Ws.SUCCESS?"success":"failed",r),[2,r]}})})},i.prototype.getAgentStatusList=function(){return t(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return[4,this.api.getAgentStatusList()];case 1:return(e=t.sent()).code===Ws.SUCCESS?[2,{code:Ks.SUCCESS,data:e.data||[],message:e.message}]:[2,{code:Ks.FAILED,data:null,message:e.message}]}})})},i.prototype.getTicket=function(){var e=window.sessionStorage.getItem("wiz-agent-ticket");return e||(e=r(),window.sessionStorage.setItem("wiz-agent-ticket",e)),e},i.prototype.getHostName=function(e){try{return new URL(e).hostname}catch(e){return""}},i.prototype.processSSEMessage=function(e){return t(this,void 0,void 0,function(){var t,r;return n(this,function(n){switch(n.label){case 0:return t=JSON.parse(null==e?void 0:e.data)||{},r=this.agentInfo.statusName,-1===t.agentId?[3,2]:[4,this.offlineAgent(r)];case 1:n.sent(),1===t.status&&this.onlineAgent(r),n.label=2;case 2:return[2]}})})},i.prototype.resetSSE=function(){return t(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.api.closeSSE({agentId:this.agentInfo.id,clearTicket:1})];case 1:return e.sent(),[4,this.api.registerSSE({agentId:this.agentInfo.id,onMessage:this.processSSEMessage.bind(this)})];case 2:return e.sent(),[2]}})})},i.prototype.createSSEAndOpensips=function(e,r){return t(this,void 0,void 0,function(){var t=this;return n(this,function(n){switch(n.label){case 0:return this.api.registerSSE({agentId:e,onMessage:this.processSSEMessage.bind(this)})?[3,2]:[4,this.api.updateAgentTicket({agentId:e,ticket:r,type:Zs.OFFLINE})];case 1:return n.sent().code!==Ws.SUCCESS?[2,{code:Ks.FAILED,message:"Registration of SSE failed and update Agent Ticket failed"}]:[2,{code:Ks.FAILED,message:"Registration of SSE failed"}];case 2:return[4,new Promise(function(e){var n=function(e){var r=!1;t.sip.on("registered",function(){r=!0,e(!0)}),t.sip.on("registrationFailed",function(){e(!1)}),setTimeout(function(){r||(t.sip.stop(),n(e))},500),t.sip.start()};n(e)})];case 3:return n.sent()?[3,5]:[4,this.api.closeSSE({agentId:e,clearTicket:1})];case 4:return n.sent(),[2,{code:Ks.FAILED,message:"SIP registration failed"}];case 5:return[2,{code:Ks.SUCCESS,message:"success"}]}})})},i.prototype.getAgentStatus=function(){return t(this,void 0,void 0,function(){var e,t,r,i,s,o,a,u,l,c,h,d,f,p,g,_,A;return n(this,function(n){switch(n.label){case 0:return e=this.getTicket(),[4,Promise.allSettled([this.api.getAgentInfo(),this.api.getAgentSetting({key:"callCenter"})])];case 1:return t=n.sent(),r=t.map(function(e){return"fulfilled"!==e.status?{code:Ws.FAILED,data:null,message:"system error"}:e.value}),i=r[0],s=r[1],"code"in i&&i.code!==Ws.SUCCESS?[2,{code:Ks.FAILED,data:null,message:i.message}]:("agentWaitingTime"in s&&(this.agentWaitingTime=s.agentWaitingTime||0),"data"in i&&(null===(_=i.data)||void 0===_?void 0:_[0])?(o=null===(A=i.data)||void 0===A?void 0:A[0],a=o.id,u=o.groupId,l=o.status,c=o.ticket,h="sip:".concat(o.number,"@").concat(this.getHostName(o.realm)),this.sip.init({wssuri:o.realm,password:o.password,uri:h}),d={code:Ks.SUCCESS,data:{id:a,groupId:u,status:l,subStatus:o.statusName},message:"success"},l===Zs.OFFLINE?(this.emitAgentEvent("offline",d),this.agentInfo=o,[2,d]):(this.emitAgentEvent("online",d),c&&c!==e?(this.agentInfo=o,[2,{code:Ks.LOCKED,data:{id:a,groupId:u,status:l,subStatus:o.statusName},message:"Agent ticket occupied"}]):c?[3,3]:[4,this.api.updateAgentTicket({agentId:a,ticket:e,type:Zs.ONLINE})])):[2,{code:Ks.FAILED,data:null,message:"Agent not found"}]);case 2:if(n.sent().code!==Ws.SUCCESS)return[2,{code:Ks.FAILED,data:null,message:"Update Agent Ticket failed"}];n.label=3;case 3:return[4,this.createSSEAndOpensips(a,e)];case 4:return f=n.sent(),p=f.code,g=f.message,p===Ks.SUCCESS?(this.agentInfo=o,[2,{code:Ks.SUCCESS,data:d.data,message:g}]):[2,{code:Ks.FAILED,data:null,message:g}]}})})},i.prototype.onlineAgent=function(e){return t(this,void 0,void 0,function(){var t,r,i,s,o,a,u,l,c,h,d;return n(this,function(n){switch(n.label){case 0:return t=this.agentInfo,r=t.status,i=t.id,s=t.groupId,r!==Zs.ONLINE?[3,2]:[4,this.api.switchAgentStatus({id:i,groupId:s,status:Zs.ONLINE,subStatus:e})];case 1:return(u=n.sent()).code!==Ws.SUCCESS?[2,{code:Ks.FAILED,data:null,message:u.message}]:(d={code:Ks.SUCCESS,data:{status:Zs.ONLINE,subStatus:e},message:"Agent is already online"},this.agentInfo.statusName=e,this.emitAgentEvent("online",d),[2,d]);case 2:return r!==Zs.OFFLINE?[3,6]:(o=this.getTicket(),[4,this.api.updateAgentTicket({agentId:i,ticket:o,type:Zs.ONLINE})]);case 3:return(a=n.sent()).code!==Ws.SUCCESS?[2,{code:Ks.FAILED,data:null,message:a.message}]:[4,this.api.switchAgentStatus({id:i,groupId:s,status:Zs.ONLINE,subStatus:e})];case 4:return(u=n.sent()).code!==Ws.SUCCESS?[2,{code:Ks.FAILED,data:null,message:u.message}]:[4,this.createSSEAndOpensips(i,o)];case 5:return l=n.sent(),c=l.code,h=l.message,c!==Ks.SUCCESS?[2,{code:Ks.FAILED,data:null,message:h}]:(d={code:c,data:{status:Zs.ONLINE,subStatus:e},message:h},this.agentInfo.status=Zs.ONLINE,this.agentInfo.statusName=e,this.emitAgentEvent("online",d),[2,d]);case 6:return[2,{code:Ks.FAILED,data:null,message:"Agent Status is not valid"}]}})})},i.prototype.offlineAgent=function(e){return t(this,void 0,void 0,function(){var t,r,i,s,o,a;return n(this,function(n){switch(n.label){case 0:return t=this.agentInfo,r=t.status,i=t.id,s=t.groupId,r!==Zs.OFFLINE?[3,2]:[4,this.api.switchAgentStatus({id:i,groupId:s,status:Zs.OFFLINE,subStatus:e})];case 1:return(o=n.sent()).code!==Ws.SUCCESS?[2,{code:Ks.FAILED,data:null,message:o.message}]:(a={code:Ks.SUCCESS,data:{status:Zs.OFFLINE,subStatus:e},message:"Agent is already offline"},this.agentInfo.statusName=e,this.emitAgentEvent("offline",a),[2,a]);case 2:return r!==Zs.ONLINE?[3,4]:[4,this.api.switchAgentStatus({id:i,groupId:s,status:Zs.OFFLINE,subStatus:e})];case 3:return(o=n.sent()).code!==Ws.SUCCESS?[2,{code:Ks.FAILED,data:null,message:o.message}]:(this.api.closeSSE({agentId:i,clearTicket:1}),this.sip.stop(!0),a={code:Ks.SUCCESS,data:{status:Zs.OFFLINE,subStatus:e},message:"Agent is already offline"},this.emitAgentEvent("offline",a),this.agentInfo.status=Zs.OFFLINE,this.agentInfo.statusName=e,[2,a]);case 4:return[2,{code:Ks.FAILED,data:null,message:"Agent Status is not valid"}]}})})},i.prototype.switchAgentStatus=function(e){return t(this,void 0,void 0,function(){var t,r;return n(this,function(n){return t=e.status,r=e.subStatus,t===Zs.ONLINE?[2,this.onlineAgent(r)]:t===Zs.OFFLINE?[2,this.offlineAgent(r)]:[2,{code:Ks.FAILED,data:null,message:"system error"}]})})},i.prototype.outboundCall=function(e){return t(this,void 0,void 0,function(){var t,r=this;return n(this,function(n){return(t=this.agentInfo.outboundLineId)?[2,this.api.outboundCall({phone:e,line:t}).then(function(e){return e.code===Ws.SUCCESS?(r.sip.setCallType("outboundCall"),{code:Ks.SUCCESS,data:e.data,message:e.message||e.msg}):{code:Ks.FAILED,data:null,message:e.message||e.msg}})]:[2,Promise.resolve({code:Ks.FAILED,data:null,message:"Agent has no outbound line"})]})})},i.prototype.finshACW=function(){return t(this,void 0,void 0,function(){var e,t,r,i;return n(this,function(n){switch(n.label){case 0:return e=this.agentInfo,t=e.id,r=e.groupId,[4,this.api.switchAgentStatus({id:t,groupId:r,status:Zs.HANGUP})];case 1:return[2,{code:(i=n.sent()).code===Ws.SUCCESS?Ks.SUCCESS:Ks.FAILED,data:null,message:i.message}]}})})},i.prototype.sessionEnded=function(){return t(this,void 0,void 0,function(){return n(this,function(e){return this.api.switchAgentStatus({id:this.agentInfo.id,groupId:this.agentInfo.groupId,status:Zs.HANGUP}),[2]})})},i.prototype.sessionFailed=function(){return t(this,void 0,void 0,function(){return n(this,function(e){return this.api.updateAgentHangup(this.agentInfo.id),[2]})})},i.prototype.openOnunload=function(){var e=this;window.onbeforeunload=function(e){e.returnValue="beforeunload"},window.onunload=function(){e.api.sendBeacon({url:"/crm/v1/agent_command/regist_agent_abnormal_close",id:e.agentInfo.id,groupId:e.agentInfo.groupId,trace:r()}),e.sip.destroy(),e.api.closeSSE({agentId:e.agentInfo.id,clearTicket:1}),e.timer&&(clearInterval(e.timer),e.timer=null)}},i.prototype.cancelOnunload=function(){window.onbeforeunload=function(){},window.onunload=function(){}},i.prototype.saveAgentResponseTime=function(e){this.api.saveAgentResponseTime({callId:this.callDetails.callId,agentId:this.agentInfo.id,agentResponseTime:this.agentResponseTime,agentGroupId:this.agentInfo.groupId,resultType:e}),this.timer&&(clearInterval(this.timer),this.agentResponseTime=0)},i.prototype.hangup=function(){this.sip.hangup()},i.prototype.timingResTime=function(){var e=this;this.timer&&(clearInterval(this.timer),this.timer=null);var t=this.agentWaitingTime;this.agentResponseTime=0,this.timer=setInterval(function(){if(t<=0)return clearInterval((null==e?void 0:e.timer)||0),e.timer=null,void e.ignore();t-=1,e.agentResponseTime+=1},1e3)},i.prototype.incomingCall=function(e){return t(this,void 0,void 0,function(){var t,r,i,s,o,a,u,l,c,h,d,f,p,g,_,A,m,v,y,T;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),t=e.request,r=(null===(A=null===(_=t.headers["Call-Param"])||void 0===_?void 0:_[0])||void 0===A?void 0:A.raw)||"",i=r?atob(r):"",s=JSON.parse(i||"{}"),o=(null===(v=null===(m=t.headers["Call-Task"])||void 0===m?void 0:m[0])||void 0===v?void 0:v.raw)||"",a=(null===(T=null===(y=t.headers["Call-Record-Id"])||void 0===y?void 0:y[0])||void 0===T?void 0:T.raw)||null,console.log("============incomingCall============",s),console.log("============body============",t),u=Object.fromEntries(Object.entries(s).filter(function(e){return""!==e[0]})),l="",c="",o?[4,Promise.allSettled([this.api.getCallTaskInfo({callTaskId:o}),this.api.getAfterCallProcessTime({callTaskId:o})])]:[3,2];case 1:h=n.sent(),d=h[0],f=h[1],"fulfilled"===d.status&&(l=d.value.name||""),"fulfilled"===f.status&&(p=f.value,console.log("getAfterCallProcessTime res:",p),p.code===Ks.SUCCESS&&(c=String(p.data||""))),n.label=2;case 2:return this.callDetails={callId:a||"",callType:this.sip.getCallType()||"",taskName:l,afterCallProcessTime:c,extraJson:u},[2,Promise.resolve({code:Ks.SUCCESS,data:this.callDetails,message:"success"})];case 3:return g=n.sent(),[2,Promise.resolve({code:Ks.FAILED,data:null,message:(null==g?void 0:g.toString())||"system error"})];case 4:return[2]}})})},i.prototype.answer=function(){this.sip.answer(),this.saveAgentResponseTime(Xs.ANSWER)},i.prototype.ignore=function(){this.sip.ignore(),this.saveAgentResponseTime(Xs.HANGUP)},i.prototype.mute=function(){this.sip.mute()},i.prototype.unmute=function(){this.sip.unmute()},i.prototype.attachInitEvent=function(e,t){t&&"function"==typeof t&&(this.initEvent[e]||(this.initEvent[e]=[]),this.initEvent[e].push(t))},i.prototype.removeInitEvent=function(e,t){var n=this.initEvent[e];if(n&&n.length)for(var r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1);break}},i.prototype.emitInitEvent=function(e,t){(this.initEvent[e]||[]).forEach(function(e){e(t)})},i.prototype.attachAgentEvent=function(e,t){t&&"function"==typeof t&&(this.agentEvent[e]||(this.agentEvent[e]=[]),this.agentEvent[e].push(t))},i.prototype.removeAgentEvent=function(e,t){var n=this.agentEvent[e];if(n&&n.length)for(var r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1);break}},i.prototype.emitAgentEvent=function(e,t){(this.agentEvent[e]||[]).forEach(function(e){e(t)})},i.prototype.attachAnswerEvent=function(e){this.sip.attachAnswerEvent(e)},i.prototype.removeAnswerEvent=function(e){this.sip.removeAnswerEvent(e)},i.prototype.attachNewMessageEvent=function(e){this.sip.attachNewMessageEvent(e)},i.prototype.removeNewMessageEvent=function(e){this.sip.removeNewMessageEvent(e)},i.prototype.attchSessionEvent=function(e,t){this.sip.attchSessionEvent(e,t)},i.prototype.removeSessionEvent=function(e,t){this.sip.removeSessionEvent(e,t)},i}();module.exports=io;
7
+ !function(e,t){!function(n){var r=n.setTimeout,i=n.clearTimeout,s=n.XMLHttpRequest,o=n.XDomainRequest,a=n.ActiveXObject,u=n.EventSource,l=n.document,c=n.Promise,h=n.fetch,d=n.Response,f=n.TextDecoder,p=n.TextEncoder,g=n.AbortController;if("undefined"==typeof window||void 0===l||"readyState"in l||null!=l.body||(l.readyState="loading",window.addEventListener("load",function(e){l.readyState="complete"},!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==g){var _=h;h=function(e,t){var n=t.signal;return _(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then(function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}})},g=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function A(){this.bitsNeeded=0,this.codePoint=0}A.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r=65533,i="",s=this.bitsNeeded,o=this.codePoint,a=0;a<e.length;a+=1){var u=e[a];0!==s&&(u<128||u>191||!t(o<<6|63&u,s-6,n(s,o)))&&(s=0,o=r,i+=String.fromCharCode(o)),0===s?(u>=0&&u<=127?(s=0,o=u):u>=192&&u<=223?(s=6,o=31&u):u>=224&&u<=239?(s=12,o=15&u):u>=240&&u<=247?(s=18,o=7&u):(s=0,o=r),0===s||t(o,s,n(s,o))||(s=0,o=r)):(s-=6,o=o<<6|63&u),0===s&&(o<=65535?i+=String.fromCharCode(o):(i+=String.fromCharCode(55296+(o-65535-1>>10)),i+=String.fromCharCode(56320+(o-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=o,i};null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=A);var m=function(){};function v(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=m,this.onload=m,this.onerror=m,this.onreadystatechange=m,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=m}function y(e){return e.replace(/[A-Z]/g,function(e){return String.fromCharCode(e.charCodeAt(0)+32)})}function T(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var i=n[r].split(": "),s=i.shift(),o=i.join(": ");t[y(s)]=o}this._map=t}function S(){}function C(e){this._headers=e}function E(){}function w(){this._listeners=Object.create(null)}function b(e){r(function(){throw e},0)}function I(e){this.type=e,this.target=void 0}function R(e,t){I.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function O(e,t){I.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){I.call(this,e),this.error=t.error}v.prototype.open=function(e,t){this._abort(!0);var n=this,o=this._xhr,a=1,u=0;this._abort=function(e){0!==n._sendTimeout&&(i(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,o.onload=m,o.onerror=m,o.onabort=m,o.onprogress=m,o.onreadystatechange=m,o.abort(),0!==u&&(i(u),u=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var l=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in o)e=200,t="OK",r=o.contentType;else try{e=o.status,t=o.statusText,r=o.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},c=function(){if(l(),2===a||3===a){a=3;var e="";try{e=o.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:m}),c(),1===a||2===a||3===a){if(a=4,0!==u&&(i(u),u=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},d=function(){u=r(function(){d()},500),3===o.readyState&&c()};"onload"in o&&(o.onload=function(e){h("load",e)}),"onerror"in o&&(o.onerror=function(e){h("error",e)}),"onabort"in o&&(o.onabort=function(e){h("abort",e)}),"onprogress"in o&&(o.onprogress=c),"onreadystatechange"in o&&(o.onreadystatechange=function(e){!function(e){null!=o&&(4===o.readyState?"onload"in o&&"onerror"in o&&"onabort"in o||h(""===o.responseText?"error":"load",e):3===o.readyState?"onprogress"in o||c():2===o.readyState&&l())}(e)}),!("contentType"in o)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),o.open(e,t,!0),"readyState"in o&&(u=r(function(){d()},0))},v.prototype.abort=function(){this._abort(!1)},v.prototype.getResponseHeader=function(e){return this._contentType},v.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},v.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},v.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==l||null==l.readyState||"complete"===l.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=r(function(){t._sendTimeout=0,t.send()},4)}},T.prototype.get=function(e){return this._map[y(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),S.prototype.open=function(e,t,n,r,i,o,a){e.open("GET",i);var u=0;for(var l in e.onprogress=function(){var t=e.responseText.slice(u);u+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var n=e.status,r=e.statusText,i=e.getResponseHeader("Content-Type"),o=e.getAllResponseHeaders();t(n,r,i,new T(o))}},e.withCredentials=o,a)Object.prototype.hasOwnProperty.call(a,l)&&e.setRequestHeader(l,a[l]);return e.send(),e},C.prototype.get=function(e){return this._headers.get(e)},E.prototype.open=function(e,t,n,r,i,s,o){var a=null,u=new g,l=u.signal,d=new f;return h(i,{headers:o,credentials:s?"include":"same-origin",signal:l,cache:"no-store"}).then(function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new C(e.headers)),new c(function(e,t){var r=function(){a.read().then(function(t){if(t.done)e(void 0);else{var i=d.decode(t.value,{stream:!0});n(i),r()}}).catch(function(e){t(e)})};r()})}).catch(function(e){return"AbortError"===e.name?void 0:e}).then(function(e){r(e)}),{abort:function(){null!=a&&a.cancel(),u.abort()}}},w.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var i=t[r];try{"function"==typeof i.handleEvent?i.handleEvent(e):i.call(this,e)}catch(e){b(e)}}},w.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var i=!1,s=0;s<r.length;s+=1)r[s]===t&&(i=!0);i||r.push(t)},w.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var i=[],s=0;s<r.length;s+=1)r[s]!==t&&i.push(r[s]);0===i.length?delete n[e]:n[e]=i}},R.prototype=Object.create(I.prototype),O.prototype=Object.create(I.prototype),k.prototype=Object.create(I.prototype);var D=-1,q=-1,M=/^text\/event\-stream(;.*)?$/i,N=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),U(n)},U=function(e){return Math.min(Math.max(e,1e3),18e6)},x=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){b(e)}};function L(e,t){w.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,n){t=String(t);var a=Boolean(n.withCredentials),u=n.lastEventIdQueryParameterName||"lastEventId",l=U(1e3),c=N(n.heartbeatTimeout,45e3),h="",d=l,f=!1,p=0,g=n.headers||{},_=n.Transport,A=B&&null==_?void 0:new v(null!=_?new _:null!=s&&"withCredentials"in s.prototype||null==o?new s:new o),m=null!=_&&"string"!=typeof _?new _:null==A?new E:new S,y=void 0,T=0,C=D,w="",b="",I="",L="",P=0,F=0,H=0,G=function(t,n,r,i){if(0===C)if(200===t&&null!=r&&M.test(r)){C=1,f=Date.now(),d=l,e.readyState=1;var s=new O("open",{status:t,statusText:n,headers:i});e.dispatchEvent(s),x(e,e.onopen,s)}else{var o="";200!==t?(n&&(n=n.replace(/\s+/g," ")),o="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):o="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",Q();s=new O("error",{status:t,statusText:n,headers:i});e.dispatchEvent(s),x(e,e.onerror,s),console.error(o)}},Y=function(t){if(1===C){for(var n=-1,s=0;s<t.length;s+=1){(u=t.charCodeAt(s))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(n=s)}var o=(-1!==n?L:"")+t.slice(0,n+1);L=(-1===n?L:"")+t.slice(n+1),""!==t&&(f=Date.now(),p+=t.length);for(var a=0;a<o.length;a+=1){var u=o.charCodeAt(a);if(P===q&&u==="\n".charCodeAt(0))P=0;else if(P===q&&(P=0),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(0!==P){1===P&&(H=a+1);var g=o.slice(F,H-1),_=o.slice(H+(H<a&&o.charCodeAt(H)===" ".charCodeAt(0)?1:0),a);"data"===g?(w+="\n",w+=_):"id"===g?b=_:"event"===g?I=_:"retry"===g?(l=N(_,l),d=l):"heartbeatTimeout"===g&&(c=N(_,c),0!==T&&(i(T),T=r(function(){W()},c)))}if(0===P){if(""!==w){h=b,""===I&&(I="message");var A=new R(I,{data:w.slice(1),lastEventId:b});if(e.dispatchEvent(A),"open"===I?x(e,e.onopen,A):"message"===I?x(e,e.onmessage,A):"error"===I&&x(e,e.onerror,A),2===C)return}w="",I=""}P=u==="\r".charCodeAt(0)?q:0}else 0===P&&(F=a,P=1),1===P?u===":".charCodeAt(0)&&(H=a+1,P=2):2===P&&(P=3)}}},j=function(t){if(1===C||0===C){C=D,0!==T&&(i(T),T=0),T=r(function(){W()},d),d=U(Math.min(16*l,2*d)),e.readyState=0;var n=new k("error",{error:t});e.dispatchEvent(n),x(e,e.onerror,n),null!=t&&console.error(t)}},Q=function(){C=2,null!=y&&(y.abort(),y=void 0),0!==T&&(i(T),T=0),e.readyState=2},W=function(){if(T=0,C===D){f=!1,p=0,T=r(function(){W()},c),C=0,w="",I="",b=h,L="",F=0,H=0,P=0;var n=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var i=t.indexOf("?");n=-1===i?t:t.slice(0,i+1)+t.slice(i+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,function(e,t){return t===u?"":e}),n+=(-1===t.indexOf("?")?"?":"&")+u+"="+encodeURIComponent(h)}var s=e.withCredentials,o={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(o[l]=a[l]);try{y=m.open(A,G,Y,j,n,s,o)}catch(e){throw Q(),e}}else if(f||null==y){var d=Math.max((f||Date.now())+c-Date.now(),1);f=!1,T=r(function(){W()},d)}else j(new Error("No activity within "+c+" milliseconds. "+(0===C?"No response received.":p+" chars received.")+" Reconnecting.")),null!=y&&(y.abort(),y=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=g,e._close=Q,W()}(this,e,t)}var B=null!=h&&null!=d&&"body"in d.prototype;L.prototype=Object.create(w.prototype),L.prototype.CONNECTING=0,L.prototype.OPEN=1,L.prototype.CLOSED=2,L.prototype.close=function(){this._close()},L.CONNECTING=0,L.OPEN=1,L.CLOSED=2,L.prototype.withCredentials=void 0;var P,F=u;null==s||null!=u&&"withCredentials"in u.prototype||(F=L),P=function(e){e.EventSourcePolyfill=L,e.NativeEventSource=u,e.EventSource=F}(t),void 0!==P&&(e.exports=P)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:s:globalThis)}(Zs,Zs.exports);var Xs,$s,eo=Zs.exports,to={exports:{}},no=o(to.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",i="second",s="minute",o="hour",a="day",u="week",l="month",c="quarter",h="year",d="date",f="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},A=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},m={s:A,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+A(r,2,"0")+":"+A(i,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),s=n-i<0,o=t.clone().add(r+(s?-1:1),l);return+(-(r+(n-i)/(s?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:h,w:u,d:a,D:d,h:o,m:s,s:i,ms:r,Q:c}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},v="en",y={};y[v]=_;var T="$isDayjsObject",S=function(e){return e instanceof b||!(!e||!e[T])},C=function e(t,n,r){var i;if(!t)return v;if("string"==typeof t){var s=t.toLowerCase();y[s]&&(i=s),n&&(y[s]=n,i=s);var o=t.split("-");if(!i&&o.length>1)return e(o[0])}else{var a=t.name;y[a]=t,i=a}return!r&&i&&(v=i),i||!r&&v},E=function(e,t){if(S(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new b(n)},w=m;w.l=C,w.i=S,w.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var b=function(){function _(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[T]=!0}var A=_.prototype;return A.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(p);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(t)}(e),this.init()},A.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},A.$utils=function(){return w},A.isValid=function(){return!(this.$d.toString()===f)},A.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},A.isAfter=function(e,t){return E(e)<this.startOf(t)},A.isBefore=function(e,t){return this.endOf(t)<E(e)},A.$g=function(e,t,n){return w.u(e)?this[t]:this.set(n,e)},A.unix=function(){return Math.floor(this.valueOf()/1e3)},A.valueOf=function(){return this.$d.getTime()},A.startOf=function(e,t){var n=this,r=!!w.u(t)||t,c=w.p(e),f=function(e,t){var i=w.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(a)},p=function(e,t){return w.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},g=this.$W,_=this.$M,A=this.$D,m="set"+(this.$u?"UTC":"");switch(c){case h:return r?f(1,0):f(31,11);case l:return r?f(1,_):f(0,_+1);case u:var v=this.$locale().weekStart||0,y=(g<v?g+7:g)-v;return f(r?A-y:A+(6-y),_);case a:case d:return p(m+"Hours",0);case o:return p(m+"Minutes",1);case s:return p(m+"Seconds",2);case i:return p(m+"Milliseconds",3);default:return this.clone()}},A.endOf=function(e){return this.startOf(e,!1)},A.$set=function(e,t){var n,u=w.p(e),c="set"+(this.$u?"UTC":""),f=(n={},n[a]=c+"Date",n[d]=c+"Date",n[l]=c+"Month",n[h]=c+"FullYear",n[o]=c+"Hours",n[s]=c+"Minutes",n[i]=c+"Seconds",n[r]=c+"Milliseconds",n)[u],p=u===a?this.$D+(t-this.$W):t;if(u===l||u===h){var g=this.clone().set(d,1);g.$d[f](p),g.init(),this.$d=g.set(d,Math.min(this.$D,g.daysInMonth())).$d}else f&&this.$d[f](p);return this.init(),this},A.set=function(e,t){return this.clone().$set(e,t)},A.get=function(e){return this[w.p(e)]()},A.add=function(r,c){var d,f=this;r=Number(r);var p=w.p(c),g=function(e){var t=E(f);return w.w(t.date(t.date()+Math.round(e*r)),f)};if(p===l)return this.set(l,this.$M+r);if(p===h)return this.set(h,this.$y+r);if(p===a)return g(1);if(p===u)return g(7);var _=(d={},d[s]=t,d[o]=n,d[i]=e,d)[p]||1,A=this.$d.getTime()+r*_;return w.w(A,this)},A.subtract=function(e,t){return this.add(-1*e,t)},A.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",i=w.z(this),s=this.$H,o=this.$m,a=this.$M,u=n.weekdays,l=n.months,c=n.meridiem,h=function(e,n,i,s){return e&&(e[n]||e(t,r))||i[n].slice(0,s)},d=function(e){return w.s(s%12||12,e,"0")},p=c||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(g,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return w.s(t.$y,4,"0");case"M":return a+1;case"MM":return w.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return t.$D;case"DD":return w.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return h(n.weekdaysMin,t.$W,u,2);case"ddd":return h(n.weekdaysShort,t.$W,u,3);case"dddd":return u[t.$W];case"H":return String(s);case"HH":return w.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return p(s,o,!0);case"A":return p(s,o,!1);case"m":return String(o);case"mm":return w.s(o,2,"0");case"s":return String(t.$s);case"ss":return w.s(t.$s,2,"0");case"SSS":return w.s(t.$ms,3,"0");case"Z":return i}return null}(e)||i.replace(":","")})},A.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},A.diff=function(r,d,f){var p,g=this,_=w.p(d),A=E(r),m=(A.utcOffset()-this.utcOffset())*t,v=this-A,y=function(){return w.m(g,A)};switch(_){case h:p=y()/12;break;case l:p=y();break;case c:p=y()/3;break;case u:p=(v-m)/6048e5;break;case a:p=(v-m)/864e5;break;case o:p=v/n;break;case s:p=v/t;break;case i:p=v/e;break;default:p=v}return f?p:w.a(p)},A.daysInMonth=function(){return this.endOf(l).$D},A.$locale=function(){return y[this.$L]},A.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},A.clone=function(){return w.w(this.$d,this)},A.toDate=function(){return new Date(this.valueOf())},A.toJSON=function(){return this.isValid()?this.toISOString():null},A.toISOString=function(){return this.$d.toISOString()},A.toString=function(){return this.$d.toUTCString()},_}(),I=b.prototype;return E.prototype=I,[["$ms",r],["$s",i],["$m",s],["$H",o],["$W",a],["$M",l],["$y",h],["$D",d]].forEach(function(e){I[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),E.extend=function(e,t){return e.$i||(e(t,b,E),e.$i=!0),E},E.locale=C,E.isDayjs=S,E.unix=function(e){return E(1e3*e)},E.en=y[v],E.Ls=y,E.p={},E}()),ro="aks_agent_token",io=function(){function e(e){this.baseUrl="",this.eventSource=null,this.retryCount=0,this.retryMap=new Map,this.token="",this.id=e.id,this.getSystemToken=e.getSystemToken,this.resetSSE=e.resetSSE,this.retryCount=e.retryCount||0,this.baseUrl=e.baseUrl||""}return e.prototype.validateToken=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,fetch("".concat(this.baseUrl,"/iam/token/validate?accountId=").concat(e),{method:"GET",headers:{authentication:t}}).then(function(e){return e.json()})]})})},e.prototype.initToken=function(){return n(this,void 0,void 0,function(){var e,t,n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.getSystemToken()];case 1:return(e=r.sent())?[4,this.validateToken(this.id,e)]:[2,{code:Ks.FAILED,data:null,message:"get system token failed"}];case 2:return(t=r.sent()).code===Ks.SUCCESS?(this.token=e,sessionStorage.setItem(ro,e),this.executePeriodically(this.refreshToken.bind(this),12e5),[2,{code:Ks.SUCCESS,data:null,message:t.message}]):[2,{code:Ks.FAILED,data:null,message:t.message}];case 3:return n=r.sent(),[2,{code:Ks.FAILED,data:null,message:(null==n?void 0:n.toString())||"system error"}];case 4:return[2]}})})},e.prototype.refreshToken=function(){return n(this,void 0,void 0,function(){var e=this;return r(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/iam/oauth2/refresh")}).then(function(t){t.token&&(e.token=t.token,sessionStorage.setItem(ro,t.token),e.eventSource&&e.resetSSE())})]})})},e.prototype.getAgentStatusList=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return[2,this.request({url:"".concat(this.baseUrl,"/voipPlatform/agent/status/list")})]})})},e.prototype.getAgentInfo=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return[2,this.request({url:"".concat(this.baseUrl,"/voipPlatform/agent/getAgentByUserId")})]})})},e.prototype.getAgentSetting=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/call_tasks/getAgentSetting"),data:e})]})})},e.prototype.updateAgentHangup=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/agent/").concat(e),method:"PUT"})]})})},e.prototype.updateAgentTicket=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.request({method:"POST",url:"".concat(this.baseUrl,"/voipPlatform/agent/ticket"),data:e})]})})},e.prototype.registerSSE=function(e){return n(this,void 0,void 0,function(){var t,i,s,o,a,u=this;return r(this,function(l){return t=e.agentId,i=e.onMessage,s=function(e){},o=new Promise(function(e){s=e}),a=this.token,this.eventSource=new eo.EventSourcePolyfill("".concat(this.baseUrl,"/crm/v1/agent_command/regist_agent_event?agentId=").concat(t),{headers:{Authentication:a,"Cache-Control":"no-cache",Connection:"keep-alive"},heartbeatTimeout:12e4}),this.eventSource.onmessage=i,this.eventSource.onopen=function(){return n(u,void 0,void 0,function(){return r(this,function(e){return s(!0),[2]})})},this.eventSource.onerror=function(){return n(u,void 0,void 0,function(){return r(this,function(e){return s(!1),[2]})})},[2,o]})})},e.prototype.closeSSE=function(e){return n(this,void 0,void 0,function(){var t,n,i=this;return r(this,function(r){return t=e.agentId,n=e.clearTicket,this.eventSource?[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/agent_command/regist_agent_close?agentId=").concat(t,"&clearTicket=").concat(n)}).then(function(){i.eventSource.close(),i.eventSource=null})]:[2]})})},e.prototype.switchAgentStatus=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.request({method:"PUT",url:"".concat(this.baseUrl,"/voipPlatform/agent/agentStatusSwitch"),data:e})]})})},e.prototype.outboundCall=function(e){return n(this,void 0,void 0,function(){var t,n;return r(this,function(r){return t=e.phone,n=e.line,[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/agentOutBoundCall/dialer/startCall/").concat(t,"/").concat(n),method:"POST"})]})})},e.prototype.saveAgentResponseTime=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.request({method:"POST",url:"".concat(this.baseUrl,"/crm/v1/call_record/callRecordAgent"),data:e})]})})},e.prototype.getCallTaskInfo=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/call_tasks/getCallTaskName/").concat(e.callTaskId)})]})})},e.prototype.getAfterCallProcessTime=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.request({url:"".concat(this.baseUrl,"/crm/v1/predictCall/afterCallProcessTime/").concat(e.callTaskId)})]})})},e.prototype.formatFormData=function(e){var t=new FormData;for(var n in e)e[n]&&t.append(n,e[n]);return t},e.prototype.sendBeacon=function(e){if("function"==typeof navigator.sendBeacon&&e.url){e.createTime||(e.createTime=no().format("yyyy-MM-DD HH:mm:ss")),e.sendTime=no().format("yyyy-MM-DD HH:mm:ss"),e.Authentication=this.getTokenWithFallback();var t=e.url,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["url"]),r=this.formatFormData(n),i=navigator.sendBeacon(t,r);if(!i){e.lastSendResult=i;var s=JSON.parse(localStorage.getItem("aks_beacon_queue")||"[]");s.push(e),localStorage.setItem("aks_beacon_queue",JSON.stringify(s))}}},e.prototype.clearnSendBeaconQueue=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:return(e=JSON.parse(localStorage.getItem("aks_beacon_queue")||"[]")).length?[4,this.waitToken()]:[3,4];case 1:return n.sent()?[3,3]:[4,this.initToken()];case 2:if(n.sent().code!==Ks.SUCCESS)return[2];n.label=3;case 3:for(t=0;t<e.length-1;t++)this.sendBeacon(e[t]);n.label=4;case 4:return[2]}})})},e.prototype.getTokenWithFallback=function(){return this.token?this.token:sessionStorage.getItem(ro)||""},e.prototype.waitToken=function(e,t){var n=this;return void 0===e&&(e=3e3),void 0===t&&(t=200),new Promise(function(r){var i=setInterval(function(){((e-=t)<=0||n.token)&&(clearInterval(i),r(Boolean(n.token)))},200)})},e.prototype.request=function(e){return n(this,void 0,void 0,function(){var i,s,o,a=this;return r(this,function(u){switch(u.label){case 0:return!this.retryMap.has(e.url)&&this.retryCount&&this.retryMap.set(e.url,this.retryCount),this.token?[3,3]:[4,this.waitToken()];case 1:return u.sent()?[3,3]:[4,this.initToken()];case 2:if((i=u.sent()).code!==Ks.SUCCESS)return[2,{code:i.code,message:i.message,data:null}];u.label=3;case 3:return s={method:e.method||"GET",headers:t({"Content-Type":"application/json",authentication:this.token},e.headers)},"GET"!==(null===(o=s.method)||void 0===o?void 0:o.toLocaleUpperCase())&&(s.body=JSON.stringify(e.data)),[2,fetch(e.url,s).then(function(t){return n(a,void 0,void 0,function(){var n,i;return r(this,function(r){switch(r.label){case 0:return n=this.retryMap.get(e.url),401!==t.status?[3,3]:n?(this.retryMap.set(e.url,n-1),[4,this.initToken()]):[3,2];case 1:return(i=r.sent()).code===Ks.SUCCESS?[2,this.request(e)]:[2,i];case 2:return this.retryCount&&this.retryMap.delete(e.url),[2,{code:Ks.UNAUTHORIZED,message:"Unauthorized",data:null}];case 3:return[2,t.json()]}})})})]}})})},e.prototype.executePeriodically=function(e,t){var n=Date.now()+t,r=function(){var i=Date.now();i>=n&&(e(),n+=t);var s=Math.max(0,n-i);setTimeout(r,s)};r()},e.getInstance=function(t){return!e.instance&&t&&(e.instance=new e(t)),e.instance},e.instance=null,e}();!function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.HANGUP=4]="HANGUP"}(Xs||(Xs={})),function(e){e[e.ANSWER=1]="ANSWER",e[e.HANGUP=2]="HANGUP"}($s||($s={}));var so=function(t){function n(e,n){var r=t.call(this,n)||this;return r.name="SDKError",r.code=e,r}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n}(Error),oo=function(){function e(e){var t=this;this.sip={},this.api={},this.agentInfo={},this.initEvent={},this.agentEvent={},this.agentWaitingTime=0,this.agentResponseTime=0,this.timer=null,this.callDetails={},this.unloadingHandled=!1,this.pageHideHandler=null,this.visibilityChangeHandler=null,this.api=io.getInstance({id:e.id,getSystemToken:e.getSystemToken,resetSSE:this.resetSSE.bind(this),retryCount:e.retryCount,baseUrl:null==e?void 0:e.baseUrl}),this.sip=new Vs({incomingCallCallback:this.incomingCall.bind(this),getMediaStream:null==e?void 0:e.getMediaStream}),this.sip.attchSessionEvent("failed",this.sessionFailed.bind(this)),this.attachAgentEvent("online",this.openOnunload.bind(this)),this.attachAgentEvent("offline",this.cancelOnunload.bind(this)),this.init().then(function(){t.api.clearnSendBeaconQueue()})}return e.prototype.init=function(){return n(this,void 0,void 0,function(){var e,n;return r(this,function(r){switch(r.label){case 0:return[4,this.api.initToken()];case 1:return e=r.sent(),n=t(t({},e),{code:e.code===Ks.SUCCESS?Js.SUCCESS:Js.FAILED}),this.emitInitEvent(e.code===Ks.SUCCESS?"success":"failed",n),[2,n]}})})},e.prototype.getAgentStatusList=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.api.getAgentStatusList()];case 1:return(e=t.sent()).code===Ks.SUCCESS?[2,{code:Js.SUCCESS,data:e.data||[],message:e.message}]:[2,{code:Js.FAILED,data:null,message:e.message}]}})})},e.prototype.getTicket=function(){var e=window.sessionStorage.getItem("wiz-agent-ticket");return e||(e=i(),window.sessionStorage.setItem("wiz-agent-ticket",e)),e},e.prototype.getHostName=function(e){try{return new URL(e).hostname}catch(e){return""}},e.prototype.processSSEMessage=function(e){return n(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return t=JSON.parse(null==e?void 0:e.data)||{},n=this.agentInfo.statusName,-1===t.agentId?[3,2]:[4,this.offlineAgent(n)];case 1:r.sent(),1===t.status&&this.onlineAgent(n),r.label=2;case 2:return[2]}})})},e.prototype.resetSSE=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.api.closeSSE({agentId:this.agentInfo.id,clearTicket:1})];case 1:return e.sent(),[4,this.api.registerSSE({agentId:this.agentInfo.id,onMessage:this.processSSEMessage.bind(this)})];case 2:return e.sent(),[2]}})})},e.prototype.createSSEAndOpensips=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){switch(n.label){case 0:return this.api.registerSSE({agentId:e,onMessage:this.processSSEMessage.bind(this)})?[3,2]:[4,this.api.updateAgentTicket({agentId:e,ticket:t,type:Xs.OFFLINE})];case 1:return n.sent().code!==Ks.SUCCESS?[2,{code:Js.FAILED,message:"Registration of SSE failed and update Agent Ticket failed"}]:[2,{code:Js.FAILED,message:"Registration of SSE failed"}];case 2:return[4,this.waitSIPRegistered(7e3)];case 3:return n.sent()?[3,5]:[4,this.api.closeSSE({agentId:e,clearTicket:1})];case 4:return n.sent(),[2,{code:Js.FAILED,message:"SIP registration failed"}];case 5:return[2,{code:Js.SUCCESS,message:"success"}]}})})},e.prototype.waitSIPRegistered=function(){return n(this,arguments,void 0,function(e){var t=this;return void 0===e&&(e=7e3),r(this,function(n){return[2,new Promise(function(n){var r=!1,i=function(e){r||(r=!0,n(e))};t.sip.on("registered",function(){return i(!0)}),t.sip.on("registrationFailed",function(){return i(!1)}),setTimeout(function(){return i(!1)},e),t.sip.start()})]})})},e.prototype.getAgentStatus=function(){return n(this,void 0,void 0,function(){var e,t,n,i,s,o,a,u,l,c,h,d,f,p,g,_,A;return r(this,function(r){switch(r.label){case 0:return e=this.getTicket(),[4,Promise.allSettled([this.api.getAgentInfo(),this.api.getAgentSetting({key:"callCenter"})])];case 1:if(t=r.sent(),n=t.map(function(e){return"fulfilled"!==e.status?{code:Ks.FAILED,data:null,message:"system error"}:e.value}),i=n[0],s=n[1],"code"in i&&i.code!==Ks.SUCCESS)throw new so(Js.FAILED,i.message);if("agentWaitingTime"in s&&(this.agentWaitingTime=s.agentWaitingTime||0),!("data"in i)||!(null===(_=i.data)||void 0===_?void 0:_[0]))throw new so(Js.FAILED,"Agent not found");return o=null===(A=i.data)||void 0===A?void 0:A[0],a=o.id,u=o.groupId,l=o.status,c=o.ticket,h="sip:".concat(o.number,"@").concat(this.getHostName(o.realm)),this.sip.init({wssuri:o.realm,password:o.password,uri:h}),d={code:Js.SUCCESS,data:{id:a,groupId:u,status:l,subStatus:o.statusName},message:"success"},l===Xs.OFFLINE?(this.emitAgentEvent("offline",d),this.agentInfo=o,[2,d]):(this.emitAgentEvent("online",d),c&&c!==e?(this.agentInfo=o,[2,{code:Js.LOCKED,data:{id:a,groupId:u,status:l,subStatus:o.statusName},message:"Agent ticket occupied"}]):c?[3,3]:[4,this.api.updateAgentTicket({agentId:a,ticket:e,type:Xs.ONLINE})]);case 2:if(r.sent().code!==Ks.SUCCESS)throw new so(Js.FAILED,"Update Agent Ticket failed");r.label=3;case 3:return[4,this.createSSEAndOpensips(a,e)];case 4:if(f=r.sent(),p=f.code,g=f.message,p===Js.SUCCESS)return this.agentInfo=o,[2,{code:Js.SUCCESS,data:d.data,message:g}];throw new so(Js.FAILED,g)}})})},e.prototype.onlineAgent=function(e){return n(this,void 0,void 0,function(){var t,n,i,s,o,a,u,l,c,h,d,f,p;return r(this,function(r){switch(r.label){case 0:return t=this.agentInfo,n=t.status,i=t.id,s=t.groupId,n!==Xs.ONLINE?[3,5]:[4,this.offlineAgent(e)];case 1:return(o=r.sent()).code!==Js.SUCCESS?[2,{code:Js.FAILED,data:null,message:o.message}]:(u=this.getTicket(),[4,this.api.updateAgentTicket({agentId:i,ticket:u,type:Xs.ONLINE})]);case 2:case 6:return(l=r.sent()).code!==Ks.SUCCESS?[2,{code:Js.FAILED,data:null,message:l.message}]:[4,this.api.switchAgentStatus({id:i,groupId:s,status:Xs.ONLINE,subStatus:e})];case 3:case 7:return(c=r.sent()).code!==Ks.SUCCESS?[2,{code:Js.FAILED,data:null,message:c.message}]:[4,this.createSSEAndOpensips(i,u)];case 4:return a=r.sent(),d=a.code,f=a.message,d!==Js.SUCCESS?[2,{code:Js.FAILED,data:null,message:f}]:(p={code:Js.SUCCESS,data:{status:Xs.ONLINE,subStatus:e},message:"Agent is already online"},this.agentInfo.status=Xs.ONLINE,this.agentInfo.statusName=e,this.emitAgentEvent("online",p),[2,p]);case 5:return n!==Xs.OFFLINE?[3,9]:(u=this.getTicket(),[4,this.api.updateAgentTicket({agentId:i,ticket:u,type:Xs.ONLINE})]);case 8:return h=r.sent(),d=h.code,f=h.message,d!==Js.SUCCESS?[2,{code:Js.FAILED,data:null,message:f}]:(p={code:d,data:{status:Xs.ONLINE,subStatus:e},message:f},this.agentInfo.status=Xs.ONLINE,this.agentInfo.statusName=e,this.emitAgentEvent("online",p),[2,p]);case 9:throw new Error("Agent Status is not valid")}})})},e.prototype.offlineAgent=function(e){return n(this,void 0,void 0,function(){var t,n,i,s,o,a;return r(this,function(r){switch(r.label){case 0:return t=this.agentInfo,n=t.status,i=t.id,s=t.groupId,n!==Xs.OFFLINE?[3,2]:[4,this.api.switchAgentStatus({id:i,groupId:s,status:Xs.OFFLINE,subStatus:e})];case 1:return(o=r.sent()).code!==Ks.SUCCESS?[2,{code:Js.FAILED,data:null,message:o.message}]:(a={code:Js.SUCCESS,data:{status:Xs.OFFLINE,subStatus:e},message:"Agent is already offline"},this.agentInfo.statusName=e,this.emitAgentEvent("offline",a),[2,a]);case 2:return n!==Xs.ONLINE?[3,4]:[4,this.api.switchAgentStatus({id:i,groupId:s,status:Xs.OFFLINE,subStatus:e})];case 3:return(o=r.sent()).code!==Ks.SUCCESS?[2,{code:Js.FAILED,data:null,message:o.message}]:(this.api.closeSSE({agentId:i,clearTicket:1}),this.sip.stop(!0),a={code:Js.SUCCESS,data:{status:Xs.OFFLINE,subStatus:e},message:"Agent is already offline"},this.emitAgentEvent("offline",a),this.agentInfo.status=Xs.OFFLINE,this.agentInfo.statusName=e,[2,a]);case 4:throw new Error("Agent Status is not valid")}})})},e.prototype.switchAgentStatus=function(e){return n(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:return[4,this.getAgentStatus()];case 1:return(t=r.sent()).code===Js.FAILED?[2,{code:Js.FAILED,data:null,message:t.message}]:t.code===Js.LOCKED?[2,{code:Js.FAILED,data:null,message:t.message||"Agent ticket occupied"}]:(n=e.status,i=e.subStatus,n===Xs.ONLINE?[2,this.onlineAgent(i)]:n===Xs.OFFLINE?[2,this.offlineAgent(i)]:[2,{code:Js.FAILED,data:null,message:"system error"}])}})})},e.prototype.outboundCall=function(e){return n(this,void 0,void 0,function(){var t,n=this;return r(this,function(r){return(t=this.agentInfo.outboundLineId)?[2,this.api.outboundCall({phone:e,line:t}).then(function(e){return e.code===Ks.SUCCESS?(n.sip.setCallType("outboundCall"),{code:Js.SUCCESS,data:e.data,message:e.message||e.msg}):{code:Js.FAILED,data:null,message:e.message||e.msg}})]:[2,Promise.resolve({code:Js.FAILED,data:null,message:"Agent has no outbound line"})]})})},e.prototype.finshACW=function(){return n(this,void 0,void 0,function(){var e,t,n,i;return r(this,function(r){switch(r.label){case 0:return e=this.agentInfo,t=e.id,n=e.groupId,[4,this.api.switchAgentStatus({id:t,groupId:n,status:Xs.HANGUP})];case 1:return[2,{code:(i=r.sent()).code===Ks.SUCCESS?Js.SUCCESS:Js.FAILED,data:null,message:i.message}]}})})},e.prototype.sessionEnded=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return this.api.switchAgentStatus({id:this.agentInfo.id,groupId:this.agentInfo.groupId,status:Xs.HANGUP}),[2]})})},e.prototype.sessionFailed=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return this.api.updateAgentHangup(this.agentInfo.id),[2]})})},e.prototype.openOnunload=function(){var e=this;window.onbeforeunload=function(e){e.returnValue="beforeunload"},window.onunload=function(){e.doForceOfflineCleanup()},this.unloadingHandled=!1},e.prototype.cancelOnunload=function(){window.onbeforeunload=function(){},window.onunload=function(){},this.pageHideHandler=null,this.visibilityChangeHandler=null,this.unloadingHandled=!1},e.prototype.doForceOfflineCleanup=function(){this.unloadingHandled||(this.unloadingHandled=!0,this.api.sendBeacon({url:"/crm/v1/agent_command/regist_agent_abnormal_close",id:this.agentInfo.id,groupId:this.agentInfo.groupId,trace:i()}),this.sip.destroy(),this.api.closeSSE({agentId:this.agentInfo.id,clearTicket:1}),this.timer&&(clearInterval(this.timer),this.timer=null))},e.prototype.saveAgentResponseTime=function(e){this.api.saveAgentResponseTime({callId:this.callDetails.callId,agentId:this.agentInfo.id,agentResponseTime:this.agentResponseTime,agentGroupId:this.agentInfo.groupId,resultType:e}),this.timer&&(clearInterval(this.timer),this.agentResponseTime=0)},e.prototype.hangup=function(){this.sip.hangup()},e.prototype.timingResTime=function(){var e=this;this.timer&&(clearInterval(this.timer),this.timer=null);var t=this.agentWaitingTime;this.agentResponseTime=0,this.timer=setInterval(function(){if(t<=0)return clearInterval((null==e?void 0:e.timer)||0),e.timer=null,void e.ignore();t-=1,e.agentResponseTime+=1},1e3)},e.prototype.incomingCall=function(e){return n(this,void 0,void 0,function(){var t,n,i,s,o,a,u,l,c,h,d,f,p,g,_,A,m,v,y,T;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),t=e.request,n=(null===(A=null===(_=t.headers["Call-Param"])||void 0===_?void 0:_[0])||void 0===A?void 0:A.raw)||"",i=n?atob(n):"",s=JSON.parse(i||"{}"),o=(null===(v=null===(m=t.headers["Call-Task"])||void 0===m?void 0:m[0])||void 0===v?void 0:v.raw)||"",a=(null===(T=null===(y=t.headers["Call-Record-Id"])||void 0===y?void 0:y[0])||void 0===T?void 0:T.raw)||null,console.log("============incomingCall============",s),console.log("============body============",t),u=Object.fromEntries(Object.entries(s).filter(function(e){return""!==e[0]})),l="",c="",o?[4,Promise.allSettled([this.api.getCallTaskInfo({callTaskId:o}),this.api.getAfterCallProcessTime({callTaskId:o})])]:[3,2];case 1:h=r.sent(),d=h[0],f=h[1],"fulfilled"===d.status&&(l=d.value.name||""),"fulfilled"===f.status&&(p=f.value,console.log("getAfterCallProcessTime res:",p),p.code===Js.SUCCESS&&(c=String(p.data||""))),r.label=2;case 2:return this.callDetails={callId:a||"",callType:this.sip.getCallType()||"",taskName:l,afterCallProcessTime:c,phone:u.phone||u.Phone||u.PHONE||"",contactId:u.contactId||u.ContactId||u.CONTACT_ID||"",extraJson:u},[2,Promise.resolve({code:Js.SUCCESS,data:this.callDetails,message:"success"})];case 3:return g=r.sent(),[2,Promise.resolve({code:Js.FAILED,data:null,message:(null==g?void 0:g.toString())||"system error"})];case 4:return[2]}})})},e.prototype.answer=function(){this.sip.answer(),this.saveAgentResponseTime($s.ANSWER)},e.prototype.ignore=function(){this.sip.ignore(),this.saveAgentResponseTime($s.HANGUP)},e.prototype.mute=function(){this.sip.mute()},e.prototype.unmute=function(){this.sip.unmute()},e.prototype.attachInitEvent=function(e,t){t&&"function"==typeof t&&(this.initEvent[e]||(this.initEvent[e]=[]),this.initEvent[e].push(t))},e.prototype.removeInitEvent=function(e,t){var n=this.initEvent[e];if(n&&n.length)for(var r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1);break}},e.prototype.emitInitEvent=function(e,t){(this.initEvent[e]||[]).forEach(function(e){e(t)})},e.prototype.attachAgentEvent=function(e,t){t&&"function"==typeof t&&(this.agentEvent[e]||(this.agentEvent[e]=[]),this.agentEvent[e].push(t))},e.prototype.removeAgentEvent=function(e,t){var n=this.agentEvent[e];if(n&&n.length)for(var r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1);break}},e.prototype.emitAgentEvent=function(e,t){(this.agentEvent[e]||[]).forEach(function(e){e(t)})},e.prototype.attachAnswerEvent=function(e){this.sip.attachAnswerEvent(e)},e.prototype.removeAnswerEvent=function(e){this.sip.removeAnswerEvent(e)},e.prototype.attachNewMessageEvent=function(e){this.sip.attachNewMessageEvent(e)},e.prototype.removeNewMessageEvent=function(e){this.sip.removeNewMessageEvent(e)},e.prototype.attchSessionEvent=function(e,t){this.sip.attchSessionEvent(e,t)},e.prototype.removeSessionEvent=function(e,t){this.sip.removeSessionEvent(e,t)},e}();module.exports=oo;