/*
 * JsSIP v3.3.7.6
 * the Javascript SIP library
 * Copyright: 2012-2019 Jos? Luis Mill?n <jmillan@aliax.net> (https://github.com/jmillan)
 * Homepage: https://jssip.net
 * License: MIT
 */
var $jscompjssip={scope:{}};$jscompjssip.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(f,u,x){if(x.get||x.set)throw new TypeError("ES3 does not support getters and setters.");f!=Array.prototype&&f!=Object.prototype&&(f[u]=x.value)};$jscompjssip.getGlobal=function(f){return"undefined"!=typeof window&&window===f?f:"undefined"!=typeof global&&null!=global?global:f};$jscompjssip.global=$jscompjssip.getGlobal(this);$jscompjssip.SYMBOL_PREFIX="jscompjssip_symbol_";
$jscompjssip.initSymbol=function(){$jscompjssip.initSymbol=function(){};$jscompjssip.global.Symbol||($jscompjssip.global.Symbol=$jscompjssip.Symbol)};$jscompjssip.symbolCounter_=0;$jscompjssip.Symbol=function(f){return $jscompjssip.SYMBOL_PREFIX+(f||"")+$jscompjssip.symbolCounter_++};
$jscompjssip.initSymbolIterator=function(){$jscompjssip.initSymbol();var f=$jscompjssip.global.Symbol.iterator;f||(f=$jscompjssip.global.Symbol.iterator=$jscompjssip.global.Symbol("iterator"));"function"!=typeof Array.prototype[f]&&$jscompjssip.defineProperty(Array.prototype,f,{configurable:!0,writable:!0,value:function(){return $jscompjssip.arrayIterator(this)}});$jscompjssip.initSymbolIterator=function(){}};$jscompjssip.arrayIterator=function(f){var u=0;return $jscompjssip.iteratorPrototype(function(){return u<f.length?{done:!1,value:f[u++]}:{done:!0}})};
$jscompjssip.iteratorPrototype=function(f){$jscompjssip.initSymbolIterator();f={next:f};f[$jscompjssip.global.Symbol.iterator]=function(){return this};return f};$jscompjssip.makeIterator=function(f){$jscompjssip.initSymbolIterator();var u=f[Symbol.iterator];return u?u.call(f):$jscompjssip.arrayIterator(f)};$jscompjssip.arrayFromIterator=function(f){for(var u,x=[];!(u=f.next()).done;)x.push(u.value);return x};$jscompjssip.arrayFromIterable=function(f){return f instanceof Array?f:$jscompjssip.arrayFromIterator($jscompjssip.makeIterator(f))};
$jscompjssip.owns=function(f,u){return Object.prototype.hasOwnProperty.call(f,u)};$jscompjssip.polyfill=function(f,u,x,p){if(u){x=$jscompjssip.global;f=f.split(".");for(p=0;p<f.length-1;p++){var q=f[p];q in x||(x[q]={});x=x[q]}f=f[f.length-1];p=x[f];u=u(p);u!=p&&null!=u&&$jscompjssip.defineProperty(x,f,{configurable:!0,writable:!0,value:u})}};
$jscompjssip.polyfill("WeakMap",function(f){function u(a){$jscompjssip.owns(a,p)||$jscompjssip.defineProperty(a,p,{value:{}})}function x(a){var e=Object[a];e&&(Object[a]=function(a){u(a);return e(a)})}if(function(){if(!f||!Object.seal)return!1;try{var a=Object.seal({}),e=Object.seal({}),E=new f([[a,2],[e,3]]);if(2!=E.get(a)||3!=E.get(e))return!1;E.delete(a);E.set(e,4);return!E.has(a)&&4==E.get(e)}catch(l){return!1}}())return f;var p="$jscompjssip_hidden_"+Math.random().toString().substring(2);x("freeze");x("preventExtensions");
x("seal");var q=0,a=function(a){this.id_=(q+=Math.random()+1).toString();if(a){$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();a=$jscompjssip.makeIterator(a);for(var e;!(e=a.next()).done;)e=e.value,this.set(e[0],e[1])}};a.prototype.set=function(a,e){u(a);if(!$jscompjssip.owns(a,p))throw Error("WeakMap key fail: "+a);a[p][this.id_]=e;return this};a.prototype.get=function(a){return $jscompjssip.owns(a,p)?a[p][this.id_]:void 0};a.prototype.has=function(a){return $jscompjssip.owns(a,p)&&$jscompjssip.owns(a[p],this.id_)};a.prototype.delete=
function(a){return $jscompjssip.owns(a,p)&&$jscompjssip.owns(a[p],this.id_)?delete a[p][this.id_]:!1};return a},"es6-impl","es3");$jscompjssip.ASSUME_NO_NATIVE_MAP=!1;
$jscompjssip.polyfill("Map",function(f){if(!$jscompjssip.ASSUME_NO_NATIVE_MAP&&function(){if(!f||!f.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),E=new f($jscompjssip.makeIterator([[a,"s"]]));if("s"!=E.get(a)||1!=E.size||E.get({x:4})||E.set({x:4},"t")!=E||2!=E.size)return!1;var l=E.entries(),c=l.next();if(c.done||c.value[0]!=a||"s"!=c.value[1])return!1;c=l.next();return c.done||4!=c.value[0].x||"t"!=c.value[1]||!l.next().done?!1:!0}catch(h){return!1}}())return f;$jscompjssip.initSymbol();
$jscompjssip.initSymbolIterator();var u=new WeakMap,x=function(e){this.data_={};this.head_=a();this.size=0;if(e){e=$jscompjssip.makeIterator(e);for(var f;!(f=e.next()).done;)f=f.value,this.set(f[0],f[1])}};x.prototype.set=function(a,f){var e=p(this,a);e.list||(e.list=this.data_[e.id]=[]);e.entry?e.entry.value=f:(e.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:f},e.list.push(e.entry),this.head_.previous.next=e.entry,this.head_.previous=e.entry,this.size++);return this};x.prototype.delete=
function(a){a=p(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};x.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=a();this.size=0};x.prototype.has=function(a){return!!p(this,a).entry};x.prototype.get=function(a){return(a=p(this,a).entry)&&a.value};x.prototype.entries=function(){return q(this,function(a){return[a.key,
a.value]})};x.prototype.keys=function(){return q(this,function(a){return a.key})};x.prototype.values=function(){return q(this,function(a){return a.value})};x.prototype.forEach=function(a,f){for(var e=this.entries(),c;!(c=e.next()).done;)c=c.value,a.call(f,c[1],c[0],this)};x.prototype[Symbol.iterator]=x.prototype.entries;var p=function(a,f){var e;e=f&&typeof f;"object"==e||"function"==e?u.has(f)?e=u.get(f):(e=""+ ++y,u.set(f,e)):e="p_"+f;var c=a.data_[e];if(c&&$jscompjssip.owns(a.data_,e))for(a=0;a<c.length;a++){var h=
c[a];if(f!==f&&h.key!==h.key||f===h.key)return{id:e,list:c,index:a,entry:h}}return{id:e,list:c,index:-1,entry:void 0}},q=function(a,f){var e=a.head_;return $jscompjssip.iteratorPrototype(function(){if(e){for(;e.head!=a.head_;)e=e.previous;for(;e.next!=e.head;)return e=e.next,{done:!1,value:f(e)};e=null}return{done:!0,value:void 0}})},a=function(){var a={};return a.previous=a.next=a.head=a},y=0;return x},"es6-impl","es3");
$jscompjssip.polyfill("Reflect.apply",function(f){if(f)return f;var u=Function.prototype.apply;return function(f,p,q){return u.call(f,p,q)}},"es6","es3");$jscompjssip.polyfill("Reflect.construct",function(f){return f?f:function(f,x,p){void 0===p&&(p=f);p=Object.create(p.prototype||Object.prototype);return Reflect.apply(f,p,x)||p}},"es6","es5");
$jscompjssip.polyfill("Object.setPrototypeOf",function(f){return f?f:"object"!=typeof"".__proto__?null:function(f,x){f.__proto__=x;if(f.__proto__!==x)throw new TypeError(f+" is not extensible");return f}},"es6","es5");$jscompjssip.EXPOSE_ASYNC_EXECUTOR=!0;$jscompjssip.FORCE_POLYFILL_PROMISE=!1;
$jscompjssip.polyfill("Promise",function(f){function u(){this.batch_=null}if(f&&!$jscompjssip.FORCE_POLYFILL_PROMISE)return f;u.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};u.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var x=$jscompjssip.global.setTimeout;u.prototype.asyncExecuteFunction=function(a){x(a,0)};u.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var f=0;f<a.length;++f){var e=a[f];delete a[f];try{e()}catch(E){this.asyncThrow_(E)}}}this.batch_=null};u.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var p=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var f=this.createResolveAndReject_();try{a(f.resolve,f.reject)}catch(e){f.reject(e)}};p.prototype.createResolveAndReject_=function(){function a(a){return function(l){e||(e=!0,a.call(f,l))}}var f=this,e=
!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};p.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof p)this.settleSameAsPromise_(a);else{var f;a:switch(typeof a){case "object":f=null!=a;break a;case "function":f=!0;break a;default:f=!1}f?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};p.prototype.resolveToNonPromiseObj_=function(a){var f=void 0;try{f=a.then}catch(e){this.reject_(e);return}"function"==
typeof f?this.settleSameAsThenable_(f,a):this.fulfill_(a)};p.prototype.reject_=function(a){this.settle_(2,a)};p.prototype.fulfill_=function(a){this.settle_(1,a)};p.prototype.settle_=function(a,f){if(0!=this.state_)throw Error("Cannot settle("+a+", "+f|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=f;this.executeOnSettledCallbacks_()};p.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=this.onSettledCallbacks_,f=0;f<a.length;++f)a[f].call(),
a[f]=null;this.onSettledCallbacks_=null}};var q=new u;p.prototype.settleSameAsPromise_=function(a){var f=this.createResolveAndReject_();a.callWhenSettled_(f.resolve,f.reject)};p.prototype.settleSameAsThenable_=function(a,f){var e=this.createResolveAndReject_();try{a.call(f,e.resolve,e.reject)}catch(E){e.reject(E)}};p.prototype.then=function(a,f){function e(a,e){return"function"==typeof a?function(e){try{E(a(e))}catch(F){l(F)}}:e}var E,l,c=new p(function(a,e){E=a;l=e});this.callWhenSettled_(e(a,E),
e(f,l));return c};p.prototype.catch=function(a){return this.then(void 0,a)};p.prototype.callWhenSettled_=function(a,f){function e(){switch(E.state_){case 1:a(E.result_);break;case 2:f(E.result_);break;default:throw Error("Unexpected state: "+E.state_);}}var E=this;null==this.onSettledCallbacks_?q.asyncExecute(e):this.onSettledCallbacks_.push(function(){q.asyncExecute(e)})};p.resolve=function(a){return a instanceof p?a:new p(function(f,e){f(a)})};p.reject=function(a){return new p(function(f,e){e(a)})};
p.race=function(a){return new p(function(f,e){for(var E=$jscompjssip.makeIterator(a),l=E.next();!l.done;l=E.next())p.resolve(l.value).callWhenSettled_(f,e)})};p.all=function(a){var f=$jscompjssip.makeIterator(a),e=f.next();return e.done?p.resolve([]):new p(function(a,l){function c(e){return function(c){h[e]=c;z--;0==z&&a(h)}}var h=[],z=0;do h.push(void 0),z++,p.resolve(e.value).callWhenSettled_(c(h.length-1),l),e=f.next();while(!e.done)})};$jscompjssip.EXPOSE_ASYNC_EXECUTOR&&(p.$jscompjssip$new$AsyncExecutor=function(){return new u});
return p},"es6-impl","es3");$jscompjssip.array=$jscompjssip.array||{};$jscompjssip.iteratorFromArray=function(f,u){$jscompjssip.initSymbolIterator();f instanceof String&&(f+="");var x=0,p={next:function(){if(x<f.length){var q=x++;return{value:u(q,f[q]),done:!1}}p.next=function(){return{done:!0,value:void 0}};return p.next()}};p[Symbol.iterator]=function(){return p};return p};
$jscompjssip.polyfill("Array.prototype.keys",function(f){return f?f:function(){return $jscompjssip.iteratorFromArray(this,function(f){return f})}},"es6-impl","es3");$jscompjssip.findInternal=function(f,u,x){f instanceof String&&(f=String(f));for(var p=f.length,q=0;q<p;q++){var a=f[q];if(u.call(x,a,q,f))return{i:q,v:a}}return{i:-1,v:void 0}};$jscompjssip.polyfill("Array.prototype.find",function(f){return f?f:function(f,x){return $jscompjssip.findInternal(this,f,x).v}},"es6-impl","es3");
$jscompjssip.polyfill("Object.assign",function(f){return f?f:function(f,x){for(var p=1;p<arguments.length;p++){var q=arguments[p];if(q)for(var a in q)$jscompjssip.owns(q,a)&&(f[a]=q[a])}return f}},"es6-impl","es3");$jscompjssip.polyfill("Object.getOwnPropertySymbols",function(f){return f?f:function(){return[]}},"es6-impl","es5");
$jscompjssip.polyfill("Reflect.ownKeys",function(f){return f?f:function(f){var x=[],p=Object.getOwnPropertyNames(f);f=Object.getOwnPropertySymbols(f);for(var q=0;q<p.length;q++)("jscompjssip_symbol_"==p[q].substring(0,14)?f:x).push(p[q]);return x.concat(f)}},"es6","es5");
(function(f){"object"===typeof exports&&"undefined"!==typeof module?module.exports=f():"function"===typeof define&&define.amd?define([],f):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).JsSIP=f()})(function(){return function(){function f(u,x,p){function q(e,E){if(!x[e]){if(!u[e]){var l="function"==typeof require&&require;if(!E&&l)return l(e,!0);if(a)return a(e,!0);E=Error("Cannot find module '"+e+"'");throw E.code="MODULE_NOT_FOUND",E;}E=
x[e]={exports:{}};u[e][0].call(E.exports,function(a){return q(u[e][1][a]||a)},E,E.exports,f,u,x,p)}return x[e].exports}for(var a="function"==typeof require&&require,y=0;y<p.length;y++)q(p[y]);return q}return f}()({1:[function(f,u,x){var p=f("./Utils"),q=f("./Constants"),a=f("./Grammar"),y=f("./URI"),e=f("./Socket"),E=f("./Exceptions");x.settings={authorization_user:null,password:null,realm:null,ha1:null,display_name:null,uri:null,contact_uri:null,instance_id:null,use_preloaded_route:!1,session_timers:!0,
session_timers_refresh_method:q.UPDATE,no_answer_timeout:60,register:!0,register_expires:600,registrar_server:null,sockets:null,connection_recovery_max_interval:null,connection_recovery_min_interval:null,via_host:"".concat(p.createRandomToken(12),".invalid")};var l={sockets:function(a){var c=[];if(e.isSocket(a))c.push({socket:a});else if(Array.isArray(a)&&a.length){var h=!0,f=!1,l=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var I=a[Symbol.iterator](),L;!(h=(L=I.next()).done);h=
!0){var K=L.value;Object.prototype.hasOwnProperty.call(K,"socket")&&e.isSocket(K.socket)?c.push(K):e.isSocket(K)&&c.push({socket:K})}}catch(G){f=!0,l=G}finally{try{h||null==I.return||I.return()}finally{if(f)throw l;}}}else return;return c},uri:function(a){/^sip:/i.test(a)||(a="".concat(q.SIP,":").concat(a));if((a=y.parse(a))&&a.user)return a}},c={authorization_user:function(e){if(-1!==a.parse('"'.concat(e,'"'),"quoted_string"))return e},user_agent:function(a){if("string"===typeof a)return a},connection_recovery_max_interval:function(a){if(p.isDecimal(a)&&
(a=Number(a),0<a))return a},connection_recovery_min_interval:function(a){if(p.isDecimal(a)&&(a=Number(a),0<a))return a},contact_uri:function(e){if("string"===typeof e&&(e=a.parse(e,"SIP_URI"),-1!==e))return e},display_name:function(a){return a},instance_id:function(e){/^uuid:/i.test(e)&&(e=e.substr(5));if(-1!==a.parse(e,"uuid"))return e},no_answer_timeout:function(a){if(p.isDecimal(a)&&(a=Number(a),0<a))return a},session_timers:function(a){if("boolean"===typeof a)return a},session_timers_refresh_method:function(a){if("string"===
typeof a&&(a=a.toUpperCase(),a===q.INVITE||a===q.UPDATE))return a},password:function(a){return String(a)},realm:function(a){return String(a)},ha1:function(a){return String(a)},register:function(a){if("boolean"===typeof a)return a},register_expires:function(a){if(p.isDecimal(a)&&(a=Number(a),0<a))return a},registrar_server:function(a){/^sip:/i.test(a)||(a="".concat(q.SIP,":").concat(a));if((a=y.parse(a))&&!a.user)return a},use_preloaded_route:function(a){if("boolean"===typeof a)return a}};x.load=function(a,
e){for(var h in l)if(e.hasOwnProperty(h)){var f=e[h],z=l[h](f);if(void 0!==z)a[h]=z;else throw new E.ConfigurationError(h,f);}else throw new E.ConfigurationError(h);for(var I in c)if(e.hasOwnProperty(I)&&(h=e[I],!p.isEmpty(h)))if(f=c[I](h),void 0!==f)a[I]=f;else throw new E.ConfigurationError(I,h);}},{"./Constants":2,"./Exceptions":6,"./Grammar":7,"./Socket":20,"./URI":25,"./Utils":26}],2:[function(f,u,x){f=f("../package.json");u.exports={USER_AGENT:"".concat(f.title," ").concat(f.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",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",ACCEPTED_BODY_TYPES:"application/sdp, application/dtmf-relay",MAX_FORWARDS:69,SESSION_EXPIRES:90,MIN_SESSION_EXPIRES:60}},{"../package.json":38}],
3:[function(f,u,x){function p(a,e){for(var c=0;c<e.length;c++){var h=e[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function q(a,e,c){e&&p(a.prototype,e);c&&p(a,c);return a}var a=f("./SIPMessage"),y=f("./Constants"),e=f("./Transactions"),E=f("./Dialog/RequestSender"),l=f("./Utils"),c=f("debug")("JsSIP:Dialog"),h={STATUS_EARLY:1,STATUS_CONFIRMED:2};u.exports=function(){function f(e,l,z){var B=3<arguments.length&&void 0!==arguments[3]?
arguments[3]:h.STATUS_CONFIRMED;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this._owner=e;this._ua=e._ua;this._uas_pending_reply=this._uac_pending_reply=!1;if(!l.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};l instanceof a.IncomingResponse&&(B=200>l.status_code?h.STATUS_EARLY:h.STATUS_CONFIRMED);var F=l.parseHeader("contact");"UAS"===z?(this._id={call_id:l.call_id,local_tag:l.to_tag,remote_tag:l.from_tag,toString:function(){return this.call_id+
this.local_tag+this.remote_tag}},this._state=B,this._remote_seqnum=l.cseq,this._local_uri=l.parseHeader("to").uri,this._remote_uri=l.parseHeader("from").uri,this._remote_target=F.uri,this._route_set=l.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===z&&(this._id={call_id:l.call_id,local_tag:l.from_tag,remote_tag:l.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=B,this._local_seqnum=l.cseq,this._local_uri=l.parseHeader("from").uri,
this._remote_uri=l.parseHeader("to").uri,this._remote_target=F.uri,this._route_set=l.getHeaders("record-route").reverse(),this._ack_seqnum=null);this._ua.newDialog(this);c("new ".concat(z," dialog created with status ").concat(this._state===h.STATUS_EARLY?"EARLY":"CONFIRMED"))}q(f,null,[{key:"C",get:function(){return h}}]);q(f,[{key:"update",value:function(a,e){this._state=h.STATUS_CONFIRMED;c("dialog ".concat(this._id.toString(),"  changed to CONFIRMED state"));"UAC"===e&&(this._route_set=a.getHeaders("record-route").reverse())}},
{key:"terminate",value:function(){c("dialog ".concat(this._id.toString()," deleted"));this._ua.destroyDialog(this)}},{key:"sendRequest",value:function(a){var e=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},h=l.cloneArray(c.extraHeaders),f=c.eventHandlers||{},c=this._createRequest(a,h,c.body||null);f.onAuthenticated=function(){e._local_seqnum+=1};(new E(this,c,f)).send();return c}},{key:"receiveRequest",value:function(a){this._checkInDialogRequest(a)&&(a.method===y.ACK&&null!==this._ack_seqnum?
this._ack_seqnum=null:a.method===y.INVITE&&(this._ack_seqnum=a.cseq),this._owner.receiveRequest(a))}},{key:"_createRequest",value:function(e,c,h){c=l.cloneArray(c);this._local_seqnum||(this._local_seqnum=Math.floor(1E4*Math.random()));var f=e===y.CANCEL||e===y.ACK?this._local_seqnum:this._local_seqnum+=1;return new a.OutgoingRequest(e,this._remote_target,this._ua,{cseq:f,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},c,h)}},{key:"_checkInDialogRequest",value:function(a){var c=this;if(this._remote_seqnum)if(a.cseq<this._remote_seqnum)if(a.method===y.ACK){if(null===this._ack_seqnum||a.cseq!==this._ack_seqnum)return!1}else return a.reply(500),!1;else a.cseq>this._remote_seqnum&&(this._remote_seqnum=a.cseq);else this._remote_seqnum=a.cseq;if(a.method===y.INVITE||a.method===y.UPDATE&&a.body){if(!0===this._uac_pending_reply)a.reply(491);else{if(!0===this._uas_pending_reply)return a.reply(500,
null,["Retry-After:".concat((10*Math.random()|0)+1)]),!1;this._uas_pending_reply=!0;a.server_transaction.on("stateChanged",function I(){if(a.server_transaction.state===e.C.STATUS_ACCEPTED||a.server_transaction.state===e.C.STATUS_COMPLETED||a.server_transaction.state===e.C.STATUS_TERMINATED)a.server_transaction.removeListener("stateChanged",I),c._uas_pending_reply=!1})}if(a.hasHeader("contact"))a.server_transaction.on("stateChanged",function(){a.server_transaction.state===e.C.STATUS_ACCEPTED&&(c._remote_target=
a.parseHeader("contact").uri)})}else if(a.method===y.NOTIFY&&a.hasHeader("contact"))a.server_transaction.on("stateChanged",function(){a.server_transaction.state===e.C.STATUS_COMPLETED&&(c._remote_target=a.parseHeader("contact").uri)});return!0}},{key:"id",get:function(){return this._id}},{key:"local_seqnum",get:function(){return this._local_seqnum},set:function(a){this._local_seqnum=a}},{key:"owner",get:function(){return this._owner}},{key:"uac_pending_reply",get:function(){return this._uac_pending_reply},
set:function(a){this._uac_pending_reply=a}},{key:"uas_pending_reply",get:function(){return this._uas_pending_reply}}]);return f}()},{"./Constants":2,"./Dialog/RequestSender":4,"./SIPMessage":19,"./Transactions":22,"./Utils":26,debug:30}],4:[function(f,u,x){function p(a,e){for(var c=0;c<e.length;c++){var f=e[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}function q(a,e,h){e&&p(a.prototype,e);h&&p(a,h);return a}var a=f("../Constants"),
y=f("../Transactions");f("../RTCSession");var e=f("../RequestSender"),E={onRequestTimeout:function(){},onTransportError:function(){},onSuccessResponse:function(){},onErrorResponse:function(){},onAuthenticated:function(){},onDialogError:function(){}};u.exports=function(){function f(a,e,l){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this._dialog=a;this._ua=a._ua;this._request=e;this._eventHandlers=l;this._reattempt=!1;this._reattemptTimer=null;for(var c in E)Object.prototype.hasOwnProperty.call(E,
c)&&(this._eventHandlers[c]||(this._eventHandlers[c]=E[c]))}q(f,[{key:"send",value:function(){var c=this,h=new e(this._ua,this._request,{onRequestTimeout:function(){c._eventHandlers.onRequestTimeout()},onTransportError:function(){c._eventHandlers.onTransportError()},onAuthenticated:function(a){c._eventHandlers.onAuthenticated(a)},onReceiveResponse:function(a){c._receiveResponse(a)}});h.send();(this._request.method===a.INVITE||this._request.method===a.UPDATE&&this._request.body)&&h.clientTransaction.state!==
y.C.STATUS_TERMINATED&&(this._dialog.uac_pending_reply=!0,h.clientTransaction.on("stateChanged",function B(){if(h.clientTransaction.state===y.C.STATUS_ACCEPTED||h.clientTransaction.state===y.C.STATUS_COMPLETED||h.clientTransaction.state===y.C.STATUS_TERMINATED)h.clientTransaction.removeListener("stateChanged",B),c._dialog.uac_pending_reply=!1}))}},{key:"_receiveResponse",value:function(e){var c=this;if(408===e.status_code||481===e.status_code)this._eventHandlers.onDialogError(e);else if(e.method===
a.INVITE&&491===e.status_code)if(this._reattempt)if(200<=e.status_code&&300>e.status_code)this._eventHandlers.onSuccessResponse(e);else{if(300<=e.status_code)this._eventHandlers.onErrorResponse(e)}else this._request.cseq=this._dialog.local_seqnum+=1,this._reattemptTimer=setTimeout(function(){8!==c._dialog.owner.status&&(c._reattempt=!0,c._request.transaction.send())},1E3);else if(200<=e.status_code&&300>e.status_code)this._eventHandlers.onSuccessResponse(e);else if(300<=e.status_code)this._eventHandlers.onErrorResponse(e)}},
{key:"request",get:function(){return this._request}}]);return f}()},{"../Constants":2,"../RTCSession":12,"../RequestSender":18,"../Transactions":22}],5:[function(f,u,x){function p(a,e){for(var c=0;c<e.length;c++){var h=e[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function q(a,e,c){e&&p(a.prototype,e);c&&p(a,c);return a}var a=f("./Utils"),y=f("debug")("JsSIP:DigestAuthentication"),e=f("debug")("JsSIP:ERROR:DigestAuthentication");
e.log=console.warn.bind(console);u.exports=function(){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this._credentials=a;this._cnonce=null;this._nc=0;this._ncHex="00000000";this._response=this._ha1=this._uri=this._method=this._qop=this._stale=this._opaque=this._nonce=this._realm=this._algorithm=null}q(f,[{key:"get",value:function(a){switch(a){case "realm":return this._realm;case "ha1":return this._ha1;default:e('get() | cannot get "%s" parameter',a)}}},
{key:"authenticate",value:function(f,c){var h=f.method,l=f.ruri,B=f.body,F=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;this._algorithm=c.algorithm;this._realm=c.realm;this._nonce=c.nonce;this._opaque=c.opaque;this._stale=c.stale;if(this._algorithm){if("MD5"!==this._algorithm)return e('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return e("authenticate() | challenge without Digest nonce, authentication aborted"),
!1;if(!this._realm)return e("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return e("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return e('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(c.qop)if(-1<
c.qop.indexOf("auth-int"))this._qop="auth-int";else if(-1<c.qop.indexOf("auth"))this._qop="auth";else return e('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;else this._qop=null;this._method=h;this._uri=l;this._cnonce=F||a.createRandomToken(12);this._nc+=1;h=Number(this._nc).toString(16);this._ncHex="00000000".substr(0,8-h.length)+h;4294967296===this._nc&&(this._nc=1,this._ncHex="00000001");this._ha1=this._credentials.password?a.calculateMD5("".concat(this._credentials.username,
":").concat(this._realm,":").concat(this._credentials.password)):this._credentials.ha1;"auth"===this._qop?(B="".concat(this._method,":").concat(this._uri),h=a.calculateMD5(B),y('authenticate() | using qop=auth [a2:"%s"]',B),this._response=a.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(h))):"auth-int"===this._qop?(B="".concat(this._method,":").concat(this._uri,":").concat(a.calculateMD5(B?B:"")),h=a.calculateMD5(B),y('authenticate() | using qop=auth-int [a2:"%s"]',
B),this._response=a.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(h))):null===this._qop&&(B="".concat(this._method,":").concat(this._uri),h=a.calculateMD5(B),y('authenticate() | using qop=null [a2:"%s"]',B),this._response=a.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(h)));y("authenticate() | response generated");return!0}},{key:"toString",value:function(){var a=[];if(!this._response)throw Error("response field does not exist, cannot generate Authorization header");
a.push("algorithm=".concat(this._algorithm));a.push('username="'.concat(this._credentials.username,'"'));a.push('realm="'.concat(this._realm,'"'));a.push('nonce="'.concat(this._nonce,'"'));a.push('uri="'.concat(this._uri,'"'));a.push('response="'.concat(this._response,'"'));this._opaque&&a.push('opaque="'.concat(this._opaque,'"'));this._qop&&(a.push("qop=".concat(this._qop)),a.push('cnonce="'.concat(this._cnonce,'"')),a.push("nc=".concat(this._ncHex)));return"Digest ".concat(a.join(", "))}}]);return f}()},
{"./Utils":26,debug:30}],6:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};return p(a)}function q(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function");
}function a(a,e){if(e&&("object"===p(e)||"function"===typeof e))return e;if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function y(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}});e&&c(a,e)}function e(a){var f="function"===typeof Map?new Map:void 0;e=function(a){function e(){return l(a,
arguments,h(this).constructor)}if(null===a||-1===Function.toString.call(a).indexOf("[native code]"))return a;if("function"!==typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof f){if(f.has(a))return f.get(a);f.set(a,e)}e.prototype=Object.create(a.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});return c(e,a)};return e(a)}function E(){if("undefined"===typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;
if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(F){return!1}}function l(a,e,h){l=E()?Reflect.construct:function(a,e,h){var f=[null];f.push.apply(f,e);a=new (Function.bind.apply(a,f));h&&c(a,h.prototype);return a};return l.apply(null,arguments)}function c(a,e){c=Object.setPrototypeOf||function(a,e){a.__proto__=e;return a};return c(a,e)}function h(a){h=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||
Object.getPrototypeOf(a)};return h(a)}f=function(e){function c(e,f){var l;q(this,c);l=a(this,h(c).call(this));l.code=1;l.name="CONFIGURATION_ERROR";l.parameter=e;l.value=f;l.message=l.value?"Invalid value ".concat(JSON.stringify(l.value),' for parameter "').concat(l.parameter,'"'):"Missing parameter: ".concat(l.parameter);return l}y(c,e);return c}(e(Error));x=function(e){function c(e){var f;q(this,c);f=a(this,h(c).call(this));f.code=2;f.name="INVALID_STATE_ERROR";f.status=e;f.message="Invalid status: ".concat(e);
return f}y(c,e);return c}(e(Error));var z=function(e){function c(e){var f;q(this,c);f=a(this,h(c).call(this));f.code=3;f.name="NOT_SUPPORTED_ERROR";f.message=e;return f}y(c,e);return c}(e(Error)),B=function(e){function c(e){var f;q(this,c);f=a(this,h(c).call(this));f.code=4;f.name="NOT_READY_ERROR";f.message=e;return f}y(c,e);return c}(e(Error));u.exports={ConfigurationError:f,InvalidStateError:x,NotSupportedError:z,NotReadyError:B}},{}],7:[function(f,u,x){u.exports=function(){function p(a){return'"'+
a.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 q={parse:function(a,y){function e(b){d<ea||(d>ea&&(ea=d,Ma=[]),Ma.push(b))}function E(){var b;"\r\n"===a.substr(d,2)?(b="\r\n",d+=2):(b=null,0===n&&e('"\\r\\n"'));return b}function l(){var b;/^[0-9]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[0-9]"));return b}function c(){var b;
/^[a-zA-Z]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[a-zA-Z]"));return b}function h(){var b;/^[0-9a-fA-F]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[0-9a-fA-F]"));return b}function z(){var b;b=M();null===b&&(b=I());return b}function B(){var b;/^[\0-\xFF]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[\\0-\\xFF]"));return b}function F(){var b;/^["]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e('["]'));return b}function M(){var b;32===a.charCodeAt(d)?
(b=" ",d++):(b=null,0===n&&e('" "'));return b}function I(){var b;9===a.charCodeAt(d)?(b="\t",d++):(b=null,0===n&&e('"\\t"'));return b}function L(){var b;/^[a-zA-Z0-9]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[a-zA-Z0-9]"));return b}function K(){var b;59===a.charCodeAt(d)?(b=";",d++):(b=null,0===n&&e('";"'));null===b&&(47===a.charCodeAt(d)?(b="/",d++):(b=null,0===n&&e('"/"')),null===b&&(63===a.charCodeAt(d)?(b="?",d++):(b=null,0===n&&e('"?"')),null===b&&(58===a.charCodeAt(d)?(b=":",
d++):(b=null,0===n&&e('":"')),null===b&&(64===a.charCodeAt(d)?(b="@",d++):(b=null,0===n&&e('"@"')),null===b&&(38===a.charCodeAt(d)?(b="&",d++):(b=null,0===n&&e('"&"')),null===b&&(61===a.charCodeAt(d)?(b="=",d++):(b=null,0===n&&e('"="')),null===b&&(43===a.charCodeAt(d)?(b="+",d++):(b=null,0===n&&e('"+"')),null===b&&(36===a.charCodeAt(d)?(b="$",d++):(b=null,0===n&&e('"$"')),null===b&&(44===a.charCodeAt(d)?(b=",",d++):(b=null,0===n&&e('","')))))))))));return b}function G(){var b;b=L();null===b&&(b=r());
return b}function r(){var b;45===a.charCodeAt(d)?(b="-",d++):(b=null,0===n&&e('"-"'));null===b&&(95===a.charCodeAt(d)?(b="_",d++):(b=null,0===n&&e('"_"')),null===b&&(46===a.charCodeAt(d)?(b=".",d++):(b=null,0===n&&e('"."')),null===b&&(33===a.charCodeAt(d)?(b="!",d++):(b=null,0===n&&e('"!"')),null===b&&(126===a.charCodeAt(d)?(b="~",d++):(b=null,0===n&&e('"~"')),null===b&&(42===a.charCodeAt(d)?(b="*",d++):(b=null,0===n&&e('"*"')),null===b&&(39===a.charCodeAt(d)?(b="'",d++):(b=null,0===n&&e('"\'"')),
null===b&&(40===a.charCodeAt(d)?(b="(",d++):(b=null,0===n&&e('"("')),null===b&&(41===a.charCodeAt(d)?(b=")",d++):(b=null,0===n&&e('")"'))))))))));return b}function P(){var b,g,m,J,c;c=J=d;37===a.charCodeAt(d)?(b="%",d++):(b=null,0===n&&e('"%"'));null!==b?(g=h(),null!==g?(m=h(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b=b.join(""));null===b&&(d=J);return b}function D(){var b,g,a,e,c;a=c=e=d;b=[];for(g=z();null!==g;)b.push(g),g=z();null!==b?(g=E(),null!==g?b=[b,g]:(b=null,
d=a)):(b=null,d=a);b=null!==b?b:"";if(null!==b){a=z();if(null!==a)for(g=[];null!==a;)g.push(a),a=z();else g=null;null!==g?b=[b,g]:(b=null,d=c)}else b=null,d=c;null!==b&&(b=" ");null===b&&(d=e);return b}function t(){var b;b=D();return null!==b?b:""}function O(){var b,g,m,J,c;c=J=d;b=[];g=M();for(null===g&&(g=I());null!==g;)b.push(g),g=M(),null===g&&(g=I());null!==b?(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);
null!==b&&(b=":");null===b&&(d=J);return b}function w(){var b,g,m,e,c,k,h;k=c=d;g=q();if(null!==g)for(b=[];null!==g;)b.push(g),g=q();else b=null;if(null!==b){g=[];h=d;m=[];for(e=D();null!==e;)m.push(e),e=D();null!==m?(e=q(),null!==e?m=[m,e]:(m=null,d=h)):(m=null,d=h);for(;null!==m;){g.push(m);h=d;m=[];for(e=D();null!==e;)m.push(e),e=D();null!==m?(e=q(),null!==e?m=[m,e]:(m=null,d=h)):(m=null,d=h)}null!==g?b=[b,g]:(b=null,d=k)}else b=null,d=k;null!==b&&(b=a.substring(d,c));null===b&&(d=c);return b}
function q(){var b;/^[!-~]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[!-~]"));null===b&&(b=x());return b}function x(){var b;/^[\x80-\uFFFF]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[\\x80-\\uFFFF]"));return b}function V(){var b;/^[\x80-\xBF]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[\\x80-\\xBF]"));return b}function k(){var b,g,m;m=d;g=L();null===g&&(45===a.charCodeAt(d)?(g="-",d++):(g=null,0===n&&e('"-"')),null===g&&(46===a.charCodeAt(d)?(g=".",d++):
(g=null,0===n&&e('"."')),null===g&&(33===a.charCodeAt(d)?(g="!",d++):(g=null,0===n&&e('"!"')),null===g&&(37===a.charCodeAt(d)?(g="%",d++):(g=null,0===n&&e('"%"')),null===g&&(42===a.charCodeAt(d)?(g="*",d++):(g=null,0===n&&e('"*"')),null===g&&(95===a.charCodeAt(d)?(g="_",d++):(g=null,0===n&&e('"_"')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')),null===g&&(96===a.charCodeAt(d)?(g="`",d++):(g=null,0===n&&e('"`"')),null===g&&(39===a.charCodeAt(d)?(g="'",d++):(g=null,0===n&&e('"\'"')),
null===g&&(126===a.charCodeAt(d)?(g="~",d++):(g=null,0===n&&e('"~"'))))))))))));if(null!==g)for(b=[];null!==g;)b.push(g),g=L(),null===g&&(45===a.charCodeAt(d)?(g="-",d++):(g=null,0===n&&e('"-"')),null===g&&(46===a.charCodeAt(d)?(g=".",d++):(g=null,0===n&&e('"."')),null===g&&(33===a.charCodeAt(d)?(g="!",d++):(g=null,0===n&&e('"!"')),null===g&&(37===a.charCodeAt(d)?(g="%",d++):(g=null,0===n&&e('"%"')),null===g&&(42===a.charCodeAt(d)?(g="*",d++):(g=null,0===n&&e('"*"')),null===g&&(95===a.charCodeAt(d)?
(g="_",d++):(g=null,0===n&&e('"_"')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')),null===g&&(96===a.charCodeAt(d)?(g="`",d++):(g=null,0===n&&e('"`"')),null===g&&(39===a.charCodeAt(d)?(g="'",d++):(g=null,0===n&&e('"\'"')),null===g&&(126===a.charCodeAt(d)?(g="~",d++):(g=null,0===n&&e('"~"'))))))))))));else b=null;null!==b&&(b=a.substring(d,m));null===b&&(d=m);return b}function v(){var b,g,m;m=d;g=L();null===g&&(45===a.charCodeAt(d)?(g="-",d++):(g=null,0===n&&e('"-"')),null===
g&&(33===a.charCodeAt(d)?(g="!",d++):(g=null,0===n&&e('"!"')),null===g&&(37===a.charCodeAt(d)?(g="%",d++):(g=null,0===n&&e('"%"')),null===g&&(42===a.charCodeAt(d)?(g="*",d++):(g=null,0===n&&e('"*"')),null===g&&(95===a.charCodeAt(d)?(g="_",d++):(g=null,0===n&&e('"_"')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')),null===g&&(96===a.charCodeAt(d)?(g="`",d++):(g=null,0===n&&e('"`"')),null===g&&(39===a.charCodeAt(d)?(g="'",d++):(g=null,0===n&&e('"\'"')),null===g&&(126===a.charCodeAt(d)?
(g="~",d++):(g=null,0===n&&e('"~"')))))))))));if(null!==g)for(b=[];null!==g;)b.push(g),g=L(),null===g&&(45===a.charCodeAt(d)?(g="-",d++):(g=null,0===n&&e('"-"')),null===g&&(33===a.charCodeAt(d)?(g="!",d++):(g=null,0===n&&e('"!"')),null===g&&(37===a.charCodeAt(d)?(g="%",d++):(g=null,0===n&&e('"%"')),null===g&&(42===a.charCodeAt(d)?(g="*",d++):(g=null,0===n&&e('"*"')),null===g&&(95===a.charCodeAt(d)?(g="_",d++):(g=null,0===n&&e('"_"')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')),
null===g&&(96===a.charCodeAt(d)?(g="`",d++):(g=null,0===n&&e('"`"')),null===g&&(39===a.charCodeAt(d)?(g="'",d++):(g=null,0===n&&e('"\'"')),null===g&&(126===a.charCodeAt(d)?(g="~",d++):(g=null,0===n&&e('"~"')))))))))));else b=null;null!==b&&(b=a.substring(d,m));null===b&&(d=m);return b}function fa(){var b,g,m;m=d;g=L();null===g&&(45===a.charCodeAt(d)?(g="-",d++):(g=null,0===n&&e('"-"')),null===g&&(46===a.charCodeAt(d)?(g=".",d++):(g=null,0===n&&e('"."')),null===g&&(33===a.charCodeAt(d)?(g="!",d++):
(g=null,0===n&&e('"!"')),null===g&&(37===a.charCodeAt(d)?(g="%",d++):(g=null,0===n&&e('"%"')),null===g&&(42===a.charCodeAt(d)?(g="*",d++):(g=null,0===n&&e('"*"')),null===g&&(95===a.charCodeAt(d)?(g="_",d++):(g=null,0===n&&e('"_"')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')),null===g&&(96===a.charCodeAt(d)?(g="`",d++):(g=null,0===n&&e('"`"')),null===g&&(39===a.charCodeAt(d)?(g="'",d++):(g=null,0===n&&e('"\'"')),null===g&&(126===a.charCodeAt(d)?(g="~",d++):(g=null,0===n&&e('"~"')),
null===g&&(40===a.charCodeAt(d)?(g="(",d++):(g=null,0===n&&e('"("')),null===g&&(41===a.charCodeAt(d)?(g=")",d++):(g=null,0===n&&e('")"')),null===g&&(60===a.charCodeAt(d)?(g="<",d++):(g=null,0===n&&e('"<"')),null===g&&(62===a.charCodeAt(d)?(g=">",d++):(g=null,0===n&&e('">"')),null===g&&(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null===g&&(92===a.charCodeAt(d)?(g="\\",d++):(g=null,0===n&&e('"\\\\"')),null===g&&(g=F(),null===g&&(47===a.charCodeAt(d)?(g="/",d++):(g=null,0===n&&e('"/"')),
null===g&&(91===a.charCodeAt(d)?(g="[",d++):(g=null,0===n&&e('"["')),null===g&&(93===a.charCodeAt(d)?(g="]",d++):(g=null,0===n&&e('"]"')),null===g&&(63===a.charCodeAt(d)?(g="?",d++):(g=null,0===n&&e('"?"')),null===g&&(123===a.charCodeAt(d)?(g="{",d++):(g=null,0===n&&e('"{"')),null===g&&(125===a.charCodeAt(d)?(g="}",d++):(g=null,0===n&&e('"}"')))))))))))))))))))))))));if(null!==g)for(b=[];null!==g;)b.push(g),g=L(),null===g&&(45===a.charCodeAt(d)?(g="-",d++):(g=null,0===n&&e('"-"')),null===g&&(46===
a.charCodeAt(d)?(g=".",d++):(g=null,0===n&&e('"."')),null===g&&(33===a.charCodeAt(d)?(g="!",d++):(g=null,0===n&&e('"!"')),null===g&&(37===a.charCodeAt(d)?(g="%",d++):(g=null,0===n&&e('"%"')),null===g&&(42===a.charCodeAt(d)?(g="*",d++):(g=null,0===n&&e('"*"')),null===g&&(95===a.charCodeAt(d)?(g="_",d++):(g=null,0===n&&e('"_"')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')),null===g&&(96===a.charCodeAt(d)?(g="`",d++):(g=null,0===n&&e('"`"')),null===g&&(39===a.charCodeAt(d)?(g=
"'",d++):(g=null,0===n&&e('"\'"')),null===g&&(126===a.charCodeAt(d)?(g="~",d++):(g=null,0===n&&e('"~"')),null===g&&(40===a.charCodeAt(d)?(g="(",d++):(g=null,0===n&&e('"("')),null===g&&(41===a.charCodeAt(d)?(g=")",d++):(g=null,0===n&&e('")"')),null===g&&(60===a.charCodeAt(d)?(g="<",d++):(g=null,0===n&&e('"<"')),null===g&&(62===a.charCodeAt(d)?(g=">",d++):(g=null,0===n&&e('">"')),null===g&&(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null===g&&(92===a.charCodeAt(d)?(g="\\",d++):(g=null,
0===n&&e('"\\\\"')),null===g&&(g=F(),null===g&&(47===a.charCodeAt(d)?(g="/",d++):(g=null,0===n&&e('"/"')),null===g&&(91===a.charCodeAt(d)?(g="[",d++):(g=null,0===n&&e('"["')),null===g&&(93===a.charCodeAt(d)?(g="]",d++):(g=null,0===n&&e('"]"')),null===g&&(63===a.charCodeAt(d)?(g="?",d++):(g=null,0===n&&e('"?"')),null===g&&(123===a.charCodeAt(d)?(g="{",d++):(g=null,0===n&&e('"{"')),null===g&&(125===a.charCodeAt(d)?(g="}",d++):(g=null,0===n&&e('"}"')))))))))))))))))))))))));else b=null;null!==b&&(b=
a.substring(d,m));null===b&&(d=m);return b}function C(){var b,g,m,J,c;c=J=d;b=t();null!==b?(42===a.charCodeAt(d)?(g="*",d++):(g=null,0===n&&e('"*"')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b="*");null===b&&(d=J);return b}function ua(){var b,g,m,J,c;c=J=d;b=t();null!==b?(47===a.charCodeAt(d)?(g="/",d++):(g=null,0===n&&e('"/"')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b="/");null===b&&(d=J);return b}function S(){var b,
g,m,J,c;c=J=d;b=t();null!==b?(61===a.charCodeAt(d)?(g="=",d++):(g=null,0===n&&e('"="')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b="=");null===b&&(d=J);return b}function ca(){var b,g,m,J,c;c=J=d;b=t();null!==b?(40===a.charCodeAt(d)?(g="(",d++):(g=null,0===n&&e('"("')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b="(");null===b&&(d=J);return b}function u(){var b,g,m,J,c;c=J=d;b=t();null!==b?(41===a.charCodeAt(d)?
(g=")",d++):(g=null,0===n&&e('")"')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b=")");null===b&&(d=J);return b}function Na(){var b,g,m,J;J=m=d;62===a.charCodeAt(d)?(b=">",d++):(b=null,0===n&&e('">"'));null!==b?(g=t(),null!==g?b=[b,g]:(b=null,d=J)):(b=null,d=J);null!==b&&(b=">");null===b&&(d=m);return b}function Oa(){var b,g,m,J;J=m=d;b=t();null!==b?(60===a.charCodeAt(d)?(g="<",d++):(g=null,0===n&&e('"<"')),null!==g?b=[b,g]:(b=null,d=J)):(b=null,d=J);null!==
b&&(b="<");null===b&&(d=m);return b}function N(){var b,g,m,J,c;c=J=d;b=t();null!==b?(44===a.charCodeAt(d)?(g=",",d++):(g=null,0===n&&e('","')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b=",");null===b&&(d=J);return b}function Q(){var b,g,m,J,c;c=J=d;b=t();null!==b?(59===a.charCodeAt(d)?(g=";",d++):(g=null,0===n&&e('";"')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b=";");null===b&&(d=J);return b}function ob(){var b,
g,m,J,c;c=J=d;b=t();null!==b?(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=t(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null!==b&&(b=":");null===b&&(d=J);return b}function Pa(){var b,g,a,e;e=a=d;b=t();null!==b?(g=F(),null!==g?b=[b,g]:(b=null,d=e)):(b=null,d=e);null!==b&&(b='"');null===b&&(d=a);return b}function ha(){var b,g,a,e;e=a=d;b=F();null!==b?(g=t(),null!==g?b=[b,g]:(b=null,d=e)):(b=null,d=e);null!==b&&(b='"');null===b&&(d=a);return b}function Qa(){var b,
g,a,e;e=d;b=ca();if(null!==b){g=[];a=Ra();null===a&&(a=Z(),null===a&&(a=Qa()));for(;null!==a;)g.push(a),a=Ra(),null===a&&(a=Z(),null===a&&(a=Qa()));null!==g?(a=u(),null!==a?b=[b,g,a]:(b=null,d=e)):(b=null,d=e)}else b=null,d=e;return b}function Ra(){var b;/^[!-']/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[!-']"));null===b&&(/^[*-[]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[*-[]")),null===b&&(/^[\]-~]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[\\]-~]")),
null===b&&(b=x(),null===b&&(b=D()))));return b}function va(){var b,g,m,e,c,k;k=c=d;b=t();if(null!==b)if(g=F(),null!==g){m=[];e=ia();for(null===e&&(e=Z());null!==e;)m.push(e),e=ia(),null===e&&(e=Z());null!==m?(e=F(),null!==e?b=[b,g,m,e]:(b=null,d=k)):(b=null,d=k)}else b=null,d=k;else b=null,d=k;null!==b&&(b=a.substring(d,c));null===b&&(d=c);return b}function ja(){var b,g,m,e,c,k;k=c=d;b=t();if(null!==b)if(g=F(),null!==g){m=[];e=ia();for(null===e&&(e=Z());null!==e;)m.push(e),e=ia(),null===e&&(e=Z());
null!==m?(e=F(),null!==e?b=[b,g,m,e]:(b=null,d=k)):(b=null,d=k)}else b=null,d=k;else b=null,d=k;null!==b&&(b=a.substring(d,c).trim(),b=b.substring(1,b.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1"));null===b&&(d=c);return b}function ia(){var b;b=D();null===b&&(33===a.charCodeAt(d)?(b="!",d++):(b=null,0===n&&e('"!"')),null===b&&(/^[#-[]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[#-[]")),null===b&&(/^[\]-~]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[\\]-~]")),
null===b&&(b=x()))));return b}function Z(){var b,g,m;m=d;92===a.charCodeAt(d)?(b="\\",d++):(b=null,0===n&&e('"\\\\"'));null!==b?(/^[\0-\t]/.test(a.charAt(d))?(g=a.charAt(d),d++):(g=null,0===n&&e("[\\0-\\t]")),null===g&&(/^[\x0B-\f]/.test(a.charAt(d))?(g=a.charAt(d),d++):(g=null,0===n&&e("[\\x0B-\\f]")),null===g&&(/^[\x0E-\u007f]/.test(a.charAt(d))?(g=a.charAt(d),d++):(g=null,0===n&&e("[\\x0E-\u007f]")))),null!==g?b=[b,g]:(b=null,d=m)):(b=null,d=m);return b}function ka(){var b,g,m,J,c,k;k=c=d;b=X();
null!==b?(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=wa(),m=null!==m?m:"",null!==m?(J=xa(),null!==J?b=[b,g,m,J]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k)):(b=null,d=k);if(null!==b){try{A.uri=new pb(A.scheme,A.user,A.host,A.port),delete A.scheme,delete A.user,delete A.host,delete A.host_type,delete A.port}catch(kd){A=-1}b=void 0}null===b&&(d=c);return b}function ya(){var b,g,m,J,c,k,h,f;f=h=d;b=X();null!==b?(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==
g?(m=wa(),m=null!==m?m:"",null!==m?(J=xa(),null!==J?(c=rb(),null!==c?(k=sb(),k=null!==k?k:"",null!==k?b=[b,g,m,J,c,k]:(b=null,d=f)):(b=null,d=f)):(b=null,d=f)):(b=null,d=f)):(b=null,d=f)):(b=null,d=f);if(null!==b){try{A.uri=new pb(A.scheme,A.user,A.host,A.port,A.uri_params,A.uri_headers),delete A.scheme,delete A.user,delete A.host,delete A.host_type,delete A.port,delete A.uri_params,"SIP_URI"===y&&(A=A.uri)}catch(tb){A=-1}b=void 0}null===b&&(d=h);return b}function X(){var b;b=ub();null===b&&(b=vb());
return b}function ub(){var b,g;g=d;"sips"===a.substr(d,4).toLowerCase()?(b=a.substr(d,4),d+=4):(b=null,0===n&&e('"sips"'));null!==b&&(A.scheme=b.toLowerCase(),b=void 0);null===b&&(d=g);return b}function vb(){var b,g;g=d;"sip"===a.substr(d,3).toLowerCase()?(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"sip"'));null!==b&&(A.scheme=b.toLowerCase(),b=void 0);null===b&&(d=g);return b}function wa(){var b,g,m,c,k,h;k=c=d;b=wb();null!==b?(h=d,58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?
(m=xb(),null!==m?g=[g,m]:(g=null,d=h)):(g=null,d=h),g=null!==g?g:"",null!==g?(64===a.charCodeAt(d)?(m="@",d++):(m=null,0===n&&e('"@"')),null!==m?b=[b,g,m]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);null!==b&&(A.user=decodeURIComponent(a.substring(d-1,c)),b=void 0);null===b&&(d=c);return b}function wb(){var b,d;d=G();null===d&&(d=P(),null===d&&(d=Sa()));if(null!==d)for(b=[];null!==d;)b.push(d),d=G(),null===d&&(d=P(),null===d&&(d=Sa()));else b=null;return b}function Sa(){var b;38===a.charCodeAt(d)?(b=
"&",d++):(b=null,0===n&&e('"&"'));null===b&&(61===a.charCodeAt(d)?(b="=",d++):(b=null,0===n&&e('"="')),null===b&&(43===a.charCodeAt(d)?(b="+",d++):(b=null,0===n&&e('"+"')),null===b&&(36===a.charCodeAt(d)?(b="$",d++):(b=null,0===n&&e('"$"')),null===b&&(44===a.charCodeAt(d)?(b=",",d++):(b=null,0===n&&e('","')),null===b&&(59===a.charCodeAt(d)?(b=";",d++):(b=null,0===n&&e('";"')),null===b&&(63===a.charCodeAt(d)?(b="?",d++):(b=null,0===n&&e('"?"')),null===b&&(47===a.charCodeAt(d)?(b="/",d++):(b=null,0===
n&&e('"/"')))))))));return b}function xb(){var b,g,m;m=d;b=[];g=G();null===g&&(g=P(),null===g&&(38===a.charCodeAt(d)?(g="&",d++):(g=null,0===n&&e('"&"')),null===g&&(61===a.charCodeAt(d)?(g="=",d++):(g=null,0===n&&e('"="')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')),null===g&&(36===a.charCodeAt(d)?(g="$",d++):(g=null,0===n&&e('"$"')),null===g&&(44===a.charCodeAt(d)?(g=",",d++):(g=null,0===n&&e('","'))))))));for(;null!==g;)b.push(g),g=G(),null===g&&(g=P(),null===g&&(38===a.charCodeAt(d)?
(g="&",d++):(g=null,0===n&&e('"&"')),null===g&&(61===a.charCodeAt(d)?(g="=",d++):(g=null,0===n&&e('"="')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')),null===g&&(36===a.charCodeAt(d)?(g="$",d++):(g=null,0===n&&e('"$"')),null===g&&(44===a.charCodeAt(d)?(g=",",d++):(g=null,0===n&&e('","'))))))));null!==b&&(A.password=a.substring(d,m),b=void 0);null===b&&(d=m);return b}function xa(){var b,g,m,c,k;c=d;b=la();null!==b?(k=d,58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),
null!==g?(m=yb(),null!==m?g=[g,m]:(g=null,d=k)):(g=null,d=k),g=null!==g?g:"",null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);return b}function la(){var b,g;g=d;b=Ta();null===b&&(b=ma(),null===b&&(b=Ua()));null!==b&&(A.host=a.substring(d,g).toLowerCase(),b=A.host);null===b&&(d=g);return b}function Ta(){var b,g,m,c,k,h;k=c=d;b=[];h=d;g=Va();null!==g?(46===a.charCodeAt(d)?(m=".",d++):(m=null,0===n&&e('"."')),null!==m?g=[g,m]:(g=null,d=h)):(g=null,d=h);for(;null!==g;)b.push(g),h=d,g=Va(),null!==g?(46===a.charCodeAt(d)?
(m=".",d++):(m=null,0===n&&e('"."')),null!==m?g=[g,m]:(g=null,d=h)):(g=null,d=h);null!==b?(g=zb(),null!==g?(46===a.charCodeAt(d)?(m=".",d++):(m=null,0===n&&e('"."')),m=null!==m?m:"",null!==m?b=[b,g,m]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);null!==b&&(A.host_type="domain",b=a.substring(d,c));null===b&&(d=c);return b}function Va(){var b,g,m,c;c=d;b=L();if(null!==b){g=[];m=L();null===m&&(45===a.charCodeAt(d)?(m="-",d++):(m=null,0===n&&e('"-"')),null===m&&(95===a.charCodeAt(d)?(m="_",d++):(m=null,0===
n&&e('"_"'))));for(;null!==m;)g.push(m),m=L(),null===m&&(45===a.charCodeAt(d)?(m="-",d++):(m=null,0===n&&e('"-"')),null===m&&(95===a.charCodeAt(d)?(m="_",d++):(m=null,0===n&&e('"_"'))));null!==g?b=[b,g]:(b=null,d=c)}else b=null,d=c;return b}function zb(){var b,g,m,J;J=d;b=c();if(null!==b){g=[];m=L();null===m&&(45===a.charCodeAt(d)?(m="-",d++):(m=null,0===n&&e('"-"')),null===m&&(95===a.charCodeAt(d)?(m="_",d++):(m=null,0===n&&e('"_"'))));for(;null!==m;)g.push(m),m=L(),null===m&&(45===a.charCodeAt(d)?
(m="-",d++):(m=null,0===n&&e('"-"')),null===m&&(95===a.charCodeAt(d)?(m="_",d++):(m=null,0===n&&e('"_"'))));null!==g?b=[b,g]:(b=null,d=J)}else b=null,d=J;return b}function Ua(){var b,g,m,c,k;k=c=d;91===a.charCodeAt(d)?(b="[",d++):(b=null,0===n&&e('"["'));null!==b?(g=Wa(),null!==g?(93===a.charCodeAt(d)?(m="]",d++):(m=null,0===n&&e('"]"')),null!==m?b=[b,g,m]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);null!==b&&(A.host_type="IPv6",b=a.substring(d,c));null===b&&(d=c);return b}function Wa(){var b,g,m,c,
k,h,f,l,v,r,t,z,B,w,C;C=w=d;b=H();null!==b?(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=H(),null!==m?(58===a.charCodeAt(d)?(c=":",d++):(c=null,0===n&&e('":"')),null!==c?(k=H(),null!==k?(58===a.charCodeAt(d)?(h=":",d++):(h=null,0===n&&e('":"')),null!==h?(f=H(),null!==f?(58===a.charCodeAt(d)?(l=":",d++):(l=null,0===n&&e('":"')),null!==l?(v=H(),null!==v?(58===a.charCodeAt(d)?(r=":",d++):(r=null,0===n&&e('":"')),null!==r?(t=H(),null!==t?(58===a.charCodeAt(d)?(z=":",d++):(z=null,
0===n&&e('":"')),null!==z?(B=W(),null!==B?b=[b,g,m,c,k,h,f,l,v,r,t,z,B]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C);null===b&&(C=d,"::"===a.substr(d,2)?(b="::",d+=2):(b=null,0===n&&e('"::"')),null!==b?(g=H(),null!==g?(58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?(58===a.charCodeAt(d)?(k=":",d++):(k=null,0===n&&e('":"')),null!==
k?(h=H(),null!==h?(58===a.charCodeAt(d)?(f=":",d++):(f=null,0===n&&e('":"')),null!==f?(l=H(),null!==l?(58===a.charCodeAt(d)?(v=":",d++):(v=null,0===n&&e('":"')),null!==v?(r=H(),null!==r?(58===a.charCodeAt(d)?(t=":",d++):(t=null,0===n&&e('":"')),null!==t?(z=W(),null!==z?b=[b,g,m,c,k,h,f,l,v,r,t,z]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,"::"===a.substr(d,2)?
(b="::",d+=2):(b=null,0===n&&e('"::"')),null!==b?(g=H(),null!==g?(58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?(58===a.charCodeAt(d)?(k=":",d++):(k=null,0===n&&e('":"')),null!==k?(h=H(),null!==h?(58===a.charCodeAt(d)?(f=":",d++):(f=null,0===n&&e('":"')),null!==f?(l=H(),null!==l?(58===a.charCodeAt(d)?(v=":",d++):(v=null,0===n&&e('":"')),null!==v?(r=W(),null!==r?b=[b,g,m,c,k,h,f,l,v,r]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,
d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,"::"===a.substr(d,2)?(b="::",d+=2):(b=null,0===n&&e('"::"')),null!==b?(g=H(),null!==g?(58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?(58===a.charCodeAt(d)?(k=":",d++):(k=null,0===n&&e('":"')),null!==k?(h=H(),null!==h?(58===a.charCodeAt(d)?(f=":",d++):(f=null,0===n&&e('":"')),null!==f?(l=W(),null!==l?b=[b,g,m,c,k,h,f,l]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):
(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,"::"===a.substr(d,2)?(b="::",d+=2):(b=null,0===n&&e('"::"')),null!==b?(g=H(),null!==g?(58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?(58===a.charCodeAt(d)?(k=":",d++):(k=null,0===n&&e('":"')),null!==k?(h=W(),null!==h?b=[b,g,m,c,k,h]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,"::"===a.substr(d,2)?(b="::",d+=2):(b=null,0===n&&e('"::"')),null!==b?(g=H(),
null!==g?(58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=W(),null!==c?b=[b,g,m,c]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,"::"===a.substr(d,2)?(b="::",d+=2):(b=null,0===n&&e('"::"')),null!==b?(g=W(),null!==g?b=[b,g]:(b=null,d=C)):(b=null,d=C),null===b&&(C=d,"::"===a.substr(d,2)?(b="::",d+=2):(b=null,0===n&&e('"::"')),null!==b?(g=H(),null!==g?b=[b,g]:(b=null,d=C)):(b=null,d=C),null===b&&(C=d,b=H(),null!==b?("::"===a.substr(d,2)?(g="::",d+=2):(g=
null,0===n&&e('"::"')),null!==g?(m=H(),null!==m?(58===a.charCodeAt(d)?(c=":",d++):(c=null,0===n&&e('":"')),null!==c?(k=H(),null!==k?(58===a.charCodeAt(d)?(h=":",d++):(h=null,0===n&&e('":"')),null!==h?(f=H(),null!==f?(58===a.charCodeAt(d)?(l=":",d++):(l=null,0===n&&e('":"')),null!==l?(v=H(),null!==v?(58===a.charCodeAt(d)?(r=":",d++):(r=null,0===n&&e('":"')),null!==r?(t=W(),null!==t?b=[b,g,m,c,k,h,f,l,v,r,t]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,
d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,b=H(),null!==b?(v=d,58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=H(),null!==m?g=[g,m]:(g=null,d=v)):(g=null,d=v),g=null!==g?g:"",null!==g?("::"===a.substr(d,2)?(m="::",d+=2):(m=null,0===n&&e('"::"')),null!==m?(c=H(),null!==c?(58===a.charCodeAt(d)?(k=":",d++):(k=null,0===n&&e('":"')),null!==k?(h=H(),null!==h?(58===a.charCodeAt(d)?(f=":",d++):(f=null,0===n&&e('":"')),null!==f?(l=H(),null!==l?(58===a.charCodeAt(d)?
(v=":",d++):(v=null,0===n&&e('":"')),null!==v?(r=W(),null!==r?b=[b,g,m,c,k,h,f,l,v,r]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,b=H(),null!==b?(v=d,58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=H(),null!==m?g=[g,m]:(g=null,d=v)):(g=null,d=v),g=null!==g?g:"",null!==g?(v=d,58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?m=[m,c]:(m=
null,d=v)):(m=null,d=v),m=null!==m?m:"",null!==m?("::"===a.substr(d,2)?(c="::",d+=2):(c=null,0===n&&e('"::"')),null!==c?(k=H(),null!==k?(58===a.charCodeAt(d)?(h=":",d++):(h=null,0===n&&e('":"')),null!==h?(f=H(),null!==f?(58===a.charCodeAt(d)?(l=":",d++):(l=null,0===n&&e('":"')),null!==l?(v=W(),null!==v?b=[b,g,m,c,k,h,f,l,v]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,b=H(),null!==b?(v=d,58===a.charCodeAt(d)?
(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=H(),null!==m?g=[g,m]:(g=null,d=v)):(g=null,d=v),g=null!==g?g:"",null!==g?(v=d,58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?m=[m,c]:(m=null,d=v)):(m=null,d=v),m=null!==m?m:"",null!==m?(v=d,58===a.charCodeAt(d)?(c=":",d++):(c=null,0===n&&e('":"')),null!==c?(k=H(),null!==k?c=[c,k]:(c=null,d=v)):(c=null,d=v),c=null!==c?c:"",null!==c?("::"===a.substr(d,2)?(k="::",d+=2):(k=null,0===n&&e('"::"')),null!==k?(h=H(),null!==
h?(58===a.charCodeAt(d)?(f=":",d++):(f=null,0===n&&e('":"')),null!==f?(l=W(),null!==l?b=[b,g,m,c,k,h,f,l]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,b=H(),null!==b?(v=d,58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=H(),null!==m?g=[g,m]:(g=null,d=v)):(g=null,d=v),g=null!==g?g:"",null!==g?(v=d,58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?m=[m,c]:(m=null,d=
v)):(m=null,d=v),m=null!==m?m:"",null!==m?(v=d,58===a.charCodeAt(d)?(c=":",d++):(c=null,0===n&&e('":"')),null!==c?(k=H(),null!==k?c=[c,k]:(c=null,d=v)):(c=null,d=v),c=null!==c?c:"",null!==c?(v=d,58===a.charCodeAt(d)?(k=":",d++):(k=null,0===n&&e('":"')),null!==k?(h=H(),null!==h?k=[k,h]:(k=null,d=v)):(k=null,d=v),k=null!==k?k:"",null!==k?("::"===a.substr(d,2)?(h="::",d+=2):(h=null,0===n&&e('"::"')),null!==h?(f=W(),null!==f?b=[b,g,m,c,k,h,f]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=
null,d=C)):(b=null,d=C)):(b=null,d=C),null===b&&(C=d,b=H(),null!==b?(v=d,58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=H(),null!==m?g=[g,m]:(g=null,d=v)):(g=null,d=v),g=null!==g?g:"",null!==g?(v=d,58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?m=[m,c]:(m=null,d=v)):(m=null,d=v),m=null!==m?m:"",null!==m?(v=d,58===a.charCodeAt(d)?(c=":",d++):(c=null,0===n&&e('":"')),null!==c?(k=H(),null!==k?c=[c,k]:(c=null,d=v)):(c=null,d=v),c=null!==c?c:"",
null!==c?(v=d,58===a.charCodeAt(d)?(k=":",d++):(k=null,0===n&&e('":"')),null!==k?(h=H(),null!==h?k=[k,h]:(k=null,d=v)):(k=null,d=v),k=null!==k?k:"",null!==k?(v=d,58===a.charCodeAt(d)?(h=":",d++):(h=null,0===n&&e('":"')),null!==h?(f=H(),null!==f?h=[h,f]:(h=null,d=v)):(h=null,d=v),h=null!==h?h:"",null!==h?("::"===a.substr(d,2)?(f="::",d+=2):(f=null,0===n&&e('"::"')),null!==f?(l=H(),null!==l?b=[b,g,m,c,k,h,f,l]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,
d=C)):(b=null,d=C),null===b&&(C=d,b=H(),null!==b?(v=d,58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=H(),null!==m?g=[g,m]:(g=null,d=v)):(g=null,d=v),g=null!==g?g:"",null!==g?(v=d,58===a.charCodeAt(d)?(m=":",d++):(m=null,0===n&&e('":"')),null!==m?(c=H(),null!==c?m=[m,c]:(m=null,d=v)):(m=null,d=v),m=null!==m?m:"",null!==m?(v=d,58===a.charCodeAt(d)?(c=":",d++):(c=null,0===n&&e('":"')),null!==c?(k=H(),null!==k?c=[c,k]:(c=null,d=v)):(c=null,d=v),c=null!==c?c:"",null!==c?(v=d,58===
a.charCodeAt(d)?(k=":",d++):(k=null,0===n&&e('":"')),null!==k?(h=H(),null!==h?k=[k,h]:(k=null,d=v)):(k=null,d=v),k=null!==k?k:"",null!==k?(v=d,58===a.charCodeAt(d)?(h=":",d++):(h=null,0===n&&e('":"')),null!==h?(f=H(),null!==f?h=[h,f]:(h=null,d=v)):(h=null,d=v),h=null!==h?h:"",null!==h?(v=d,58===a.charCodeAt(d)?(f=":",d++):(f=null,0===n&&e('":"')),null!==f?(l=H(),null!==l?f=[f,l]:(f=null,d=v)):(f=null,d=v),f=null!==f?f:"",null!==f?("::"===a.substr(d,2)?(l="::",d+=2):(l=null,0===n&&e('"::"')),null!==
l?b=[b,g,m,c,k,h,f,l]:(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)):(b=null,d=C)))))))))))))));null!==b&&(A.host_type="IPv6",b=a.substring(d,w));null===b&&(d=w);return b}function H(){var b,g,a,e,c;c=d;b=h();null!==b?(g=h(),g=null!==g?g:"",null!==g?(a=h(),a=null!==a?a:"",null!==a?(e=h(),e=null!==e?e:"",null!==e?b=[b,g,a,e]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c)):(b=null,d=c);return b}function W(){var b,g,m,c;c=d;b=H();null!==b?(58===a.charCodeAt(d)?
(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=H(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);null===b&&(b=ma());return b}function ma(){var b,g,m,c,k,h,f,v,l;l=v=d;b=na();null!==b?(46===a.charCodeAt(d)?(g=".",d++):(g=null,0===n&&e('"."')),null!==g?(m=na(),null!==m?(46===a.charCodeAt(d)?(c=".",d++):(c=null,0===n&&e('"."')),null!==c?(k=na(),null!==k?(46===a.charCodeAt(d)?(h=".",d++):(h=null,0===n&&e('"."')),null!==h?(f=na(),null!==f?b=[b,g,m,c,k,h,f]:(b=null,d=l)):(b=null,d=l)):(b=
null,d=l)):(b=null,d=l)):(b=null,d=l)):(b=null,d=l)):(b=null,d=l);null!==b&&(A.host_type="IPv4",b=a.substring(d,v));null===b&&(d=v);return b}function na(){var b,g,m,c;c=d;"25"===a.substr(d,2)?(b="25",d+=2):(b=null,0===n&&e('"25"'));null!==b?(/^[0-5]/.test(a.charAt(d))?(g=a.charAt(d),d++):(g=null,0===n&&e("[0-5]")),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);null===b&&(c=d,50===a.charCodeAt(d)?(b="2",d++):(b=null,0===n&&e('"2"')),null!==b?(/^[0-4]/.test(a.charAt(d))?(g=a.charAt(d),d++):(g=null,0===
n&&e("[0-4]")),null!==g?(m=l(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c),null===b&&(c=d,49===a.charCodeAt(d)?(b="1",d++):(b=null,0===n&&e('"1"')),null!==b?(g=l(),null!==g?(m=l(),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c),null===b&&(c=d,/^[1-9]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[1-9]")),null!==b?(g=l(),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c),null===b&&(b=l()))));return b}function yb(){var b,g,a,e,c,k,h;h=k=d;b=l();b=null!==b?b:"";null!==
b?(g=l(),g=null!==g?g:"",null!==g?(a=l(),a=null!==a?a:"",null!==a?(e=l(),e=null!==e?e:"",null!==e?(c=l(),c=null!==c?c:"",null!==c?b=[b,g,a,e,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h)):(b=null,d=h)):(b=null,d=h);null!==b&&(b=parseInt(b.join("")),A.port=b);null===b&&(d=k);return b}function rb(){var b,g,m,c;b=[];c=d;59===a.charCodeAt(d)?(g=";",d++):(g=null,0===n&&e('";"'));null!==g?(m=Xa(),null!==m?g=[g,m]:(g=null,d=c)):(g=null,d=c);for(;null!==g;)b.push(g),c=d,59===a.charCodeAt(d)?(g=";",d++):(g=
null,0===n&&e('";"')),null!==g?(m=Xa(),null!==m?g=[g,m]:(g=null,d=c)):(g=null,d=c);return b}function Xa(){var b;b=Ab();null===b&&(b=Bb(),null===b&&(b=Cb(),null===b&&(b=Db(),null===b&&(b=Eb(),null===b&&(b=Fb(),null===b&&(b=Gb()))))));return b}function Ab(){var b,g,m,c;c=m=d;"transport="===a.substr(d,10).toLowerCase()?(b=a.substr(d,10),d+=10):(b=null,0===n&&e('"transport="'));null!==b?("udp"===a.substr(d,3).toLowerCase()?(g=a.substr(d,3),d+=3):(g=null,0===n&&e('"udp"')),null===g&&("tcp"===a.substr(d,
3).toLowerCase()?(g=a.substr(d,3),d+=3):(g=null,0===n&&e('"tcp"')),null===g&&("sctp"===a.substr(d,4).toLowerCase()?(g=a.substr(d,4),d+=4):(g=null,0===n&&e('"sctp"')),null===g&&("tls"===a.substr(d,3).toLowerCase()?(g=a.substr(d,3),d+=3):(g=null,0===n&&e('"tls"')),null===g&&(g=k())))),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);null!==b&&(b=b[1],A.uri_params||(A.uri_params={}),A.uri_params.transport=b.toLowerCase(),b=void 0);null===b&&(d=m);return b}function Bb(){var b,g,m,c;c=m=d;"user="===a.substr(d,
5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"user="'));null!==b?("phone"===a.substr(d,5).toLowerCase()?(g=a.substr(d,5),d+=5):(g=null,0===n&&e('"phone"')),null===g&&("ip"===a.substr(d,2).toLowerCase()?(g=a.substr(d,2),d+=2):(g=null,0===n&&e('"ip"')),null===g&&(g=k())),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);null!==b&&(b=b[1],A.uri_params||(A.uri_params={}),A.uri_params.user=b.toLowerCase(),b=void 0);null===b&&(d=m);return b}function Cb(){var b,g,m,c;c=m=d;"method="===a.substr(d,
7).toLowerCase()?(b=a.substr(d,7),d+=7):(b=null,0===n&&e('"method="'));null!==b?(g=za(),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);null!==b&&(b=b[1],A.uri_params||(A.uri_params={}),A.uri_params.method=b,b=void 0);null===b&&(d=m);return b}function Db(){var b,g,m,c;c=m=d;"ttl="===a.substr(d,4).toLowerCase()?(b=a.substr(d,4),d+=4):(b=null,0===n&&e('"ttl="'));null!==b?(g=Ya(),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);null!==b&&(b=b[1],A.params||(A.params={}),A.params.ttl=b,b=void 0);null===b&&(d=m);
return b}function Eb(){var b,g,m,c;c=m=d;"maddr="===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"maddr="'));null!==b?(g=la(),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);null!==b&&(b=b[1],A.uri_params||(A.uri_params={}),A.uri_params.maddr=b,b=void 0);null===b&&(d=m);return b}function Fb(){var b,g,m,c,h,f;h=c=d;"lr"===a.substr(d,2).toLowerCase()?(b=a.substr(d,2),d+=2):(b=null,0===n&&e('"lr"'));null!==b?(f=d,61===a.charCodeAt(d)?(g="=",d++):(g=null,0===n&&e('"="')),null!==g?
(m=k(),null!==m?g=[g,m]:(g=null,d=f)):(g=null,d=f),g=null!==g?g:"",null!==g?b=[b,g]:(b=null,d=h)):(b=null,d=h);null!==b&&(A.uri_params||(A.uri_params={}),b=A.uri_params.lr=void 0);null===b&&(d=c);return b}function Gb(){var b,g,m,c,k,h;k=c=d;b=Hb();null!==b?(h=d,61===a.charCodeAt(d)?(g="=",d++):(g=null,0===n&&e('"="')),null!==g?(m=Ib(),null!==m?g=[g,m]:(g=null,d=h)):(g=null,d=h),g=null!==g?g:"",null!==g?b=[b,g]:(b=null,d=k)):(b=null,d=k);null!==b&&(g=b[0],b=b[1],A.uri_params||(A.uri_params={}),b="undefined"===
typeof b?void 0:b[1],A.uri_params[g.toLowerCase()]=b,b=void 0);null===b&&(d=c);return b}function Hb(){var b,g,a;a=d;g=oa();if(null!==g)for(b=[];null!==g;)b.push(g),g=oa();else b=null;null!==b&&(b=b.join(""));null===b&&(d=a);return b}function Ib(){var b,g,a;a=d;g=oa();if(null!==g)for(b=[];null!==g;)b.push(g),g=oa();else b=null;null!==b&&(b=b.join(""));null===b&&(d=a);return b}function oa(){var b;b=Jb();null===b&&(b=G(),null===b&&(b=P()));return b}function Jb(){var b;91===a.charCodeAt(d)?(b="[",d++):
(b=null,0===n&&e('"["'));null===b&&(93===a.charCodeAt(d)?(b="]",d++):(b=null,0===n&&e('"]"')),null===b&&(47===a.charCodeAt(d)?(b="/",d++):(b=null,0===n&&e('"/"')),null===b&&(58===a.charCodeAt(d)?(b=":",d++):(b=null,0===n&&e('":"')),null===b&&(38===a.charCodeAt(d)?(b="&",d++):(b=null,0===n&&e('"&"')),null===b&&(43===a.charCodeAt(d)?(b="+",d++):(b=null,0===n&&e('"+"')),null===b&&(36===a.charCodeAt(d)?(b="$",d++):(b=null,0===n&&e('"$"'))))))));return b}function sb(){var b,g,m,c,k,h,f;h=d;63===a.charCodeAt(d)?
(b="?",d++):(b=null,0===n&&e('"?"'));if(null!==b)if(g=Aa(),null!==g){m=[];f=d;38===a.charCodeAt(d)?(c="&",d++):(c=null,0===n&&e('"&"'));null!==c?(k=Aa(),null!==k?c=[c,k]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)m.push(c),f=d,38===a.charCodeAt(d)?(c="&",d++):(c=null,0===n&&e('"&"')),null!==c?(k=Aa(),null!==k?c=[c,k]:(c=null,d=f)):(c=null,d=f);null!==m?b=[b,g,m]:(b=null,d=h)}else b=null,d=h;else b=null,d=h;return b}function Aa(){var b,g,m,c,k;k=c=d;b=Kb();null!==b?(61===a.charCodeAt(d)?(g="=",d++):
(g=null,0===n&&e('"="')),null!==g?(m=Lb(),null!==m?b=[b,g,m]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);null!==b&&(g=b[0],b=b[2],g=g.join("").toLowerCase(),b=b.join(""),A.uri_headers||(A.uri_headers={}),A.uri_headers[g]?A.uri_headers[g].push(b):A.uri_headers[g]=[b],b=void 0);null===b&&(d=c);return b}function Kb(){var b,d;d=pa();null===d&&(d=G(),null===d&&(d=P()));if(null!==d)for(b=[];null!==d;)b.push(d),d=pa(),null===d&&(d=G(),null===d&&(d=P()));else b=null;return b}function Lb(){var b,d;b=[];d=pa();
null===d&&(d=G(),null===d&&(d=P()));for(;null!==d;)b.push(d),d=pa(),null===d&&(d=G(),null===d&&(d=P()));return b}function pa(){var b;91===a.charCodeAt(d)?(b="[",d++):(b=null,0===n&&e('"["'));null===b&&(93===a.charCodeAt(d)?(b="]",d++):(b=null,0===n&&e('"]"')),null===b&&(47===a.charCodeAt(d)?(b="/",d++):(b=null,0===n&&e('"/"')),null===b&&(63===a.charCodeAt(d)?(b="?",d++):(b=null,0===n&&e('"?"')),null===b&&(58===a.charCodeAt(d)?(b=":",d++):(b=null,0===n&&e('":"')),null===b&&(43===a.charCodeAt(d)?(b=
"+",d++):(b=null,0===n&&e('"+"')),null===b&&(36===a.charCodeAt(d)?(b="$",d++):(b=null,0===n&&e('"$"'))))))));return b}function Mb(){var b,g,a,e,c,k;k=d;b=za();null!==b?(g=M(),null!==g?(a=Nb(),null!==a?(e=M(),null!==e?(c=Za(),null!==c?b=[b,g,a,e,c]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k)):(b=null,d=k)):(b=null,d=k);return b}function Nb(){var b;b=ya();null===b&&(b=$a());return b}function $a(){var b,g,m,c;c=d;b=Ob();null!==b?(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null!==g?(m=Pb(),
null===m&&(m=Qb()),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);return b}function Pb(){var b,g,m,c,k;c=d;b=Rb();null===b&&(b=Ba());null!==b?(k=d,63===a.charCodeAt(d)?(g="?",d++):(g=null,0===n&&e('"?"')),null!==g?(m=Sb(),null!==m?g=[g,m]:(g=null,d=k)):(g=null,d=k),g=null!==g?g:"",null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);return b}function Rb(){var b,g,m,c;c=d;"//"===a.substr(d,2)?(b="//",d+=2):(b=null,0===n&&e('"//"'));null!==b?(g=Tb(),null!==g?(m=Ba(),m=null!==m?m:"",null!==m?b=[b,
g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);return b}function Ba(){var b,g,m;m=d;47===a.charCodeAt(d)?(b="/",d++):(b=null,0===n&&e('"/"'));null!==b?(g=Ub(),null!==g?b=[b,g]:(b=null,d=m)):(b=null,d=m);return b}function Qb(){var b,g,a,c;c=d;b=Vb();if(null!==b){g=[];for(a=qa();null!==a;)g.push(a),a=qa();null!==g?b=[b,g]:(b=null,d=c)}else b=null,d=c;return b}function qa(){var b;b=K();null===b&&(b=G(),null===b&&(b=P()));return b}function Vb(){var b;b=G();null===b&&(b=P(),null===b&&(59===a.charCodeAt(d)?
(b=";",d++):(b=null,0===n&&e('";"')),null===b&&(63===a.charCodeAt(d)?(b="?",d++):(b=null,0===n&&e('"?"')),null===b&&(58===a.charCodeAt(d)?(b=":",d++):(b=null,0===n&&e('":"')),null===b&&(64===a.charCodeAt(d)?(b="@",d++):(b=null,0===n&&e('"@"')),null===b&&(38===a.charCodeAt(d)?(b="&",d++):(b=null,0===n&&e('"&"')),null===b&&(61===a.charCodeAt(d)?(b="=",d++):(b=null,0===n&&e('"="')),null===b&&(43===a.charCodeAt(d)?(b="+",d++):(b=null,0===n&&e('"+"')),null===b&&(36===a.charCodeAt(d)?(b="$",d++):(b=null,
0===n&&e('"$"')),null===b&&(44===a.charCodeAt(d)?(b=",",d++):(b=null,0===n&&e('","'))))))))))));return b}function Ub(){var b,g,m,c,k,h;k=d;b=Ca();if(null!==b){g=[];h=d;47===a.charCodeAt(d)?(m="/",d++):(m=null,0===n&&e('"/"'));null!==m?(c=Ca(),null!==c?m=[m,c]:(m=null,d=h)):(m=null,d=h);for(;null!==m;)g.push(m),h=d,47===a.charCodeAt(d)?(m="/",d++):(m=null,0===n&&e('"/"')),null!==m?(c=Ca(),null!==c?m=[m,c]:(m=null,d=h)):(m=null,d=h);null!==g?b=[b,g]:(b=null,d=k)}else b=null,d=k;return b}function Ca(){var b,
g,m,c,k,h;k=d;b=[];for(g=ra();null!==g;)b.push(g),g=ra();if(null!==b){g=[];h=d;59===a.charCodeAt(d)?(m=";",d++):(m=null,0===n&&e('";"'));null!==m?(c=ab(),null!==c?m=[m,c]:(m=null,d=h)):(m=null,d=h);for(;null!==m;)g.push(m),h=d,59===a.charCodeAt(d)?(m=";",d++):(m=null,0===n&&e('";"')),null!==m?(c=ab(),null!==c?m=[m,c]:(m=null,d=h)):(m=null,d=h);null!==g?b=[b,g]:(b=null,d=k)}else b=null,d=k;return b}function ab(){var b,d;b=[];for(d=ra();null!==d;)b.push(d),d=ra();return b}function ra(){var b;b=G();
null===b&&(b=P(),null===b&&(58===a.charCodeAt(d)?(b=":",d++):(b=null,0===n&&e('":"')),null===b&&(64===a.charCodeAt(d)?(b="@",d++):(b=null,0===n&&e('"@"')),null===b&&(38===a.charCodeAt(d)?(b="&",d++):(b=null,0===n&&e('"&"')),null===b&&(61===a.charCodeAt(d)?(b="=",d++):(b=null,0===n&&e('"="')),null===b&&(43===a.charCodeAt(d)?(b="+",d++):(b=null,0===n&&e('"+"')),null===b&&(36===a.charCodeAt(d)?(b="$",d++):(b=null,0===n&&e('"$"')),null===b&&(44===a.charCodeAt(d)?(b=",",d++):(b=null,0===n&&e('","'))))))))));
return b}function Ob(){var b,g,m,k,h;h=k=d;b=c();if(null!==b){g=[];m=c();null===m&&(m=l(),null===m&&(43===a.charCodeAt(d)?(m="+",d++):(m=null,0===n&&e('"+"')),null===m&&(45===a.charCodeAt(d)?(m="-",d++):(m=null,0===n&&e('"-"')),null===m&&(46===a.charCodeAt(d)?(m=".",d++):(m=null,0===n&&e('"."'))))));for(;null!==m;)g.push(m),m=c(),null===m&&(m=l(),null===m&&(43===a.charCodeAt(d)?(m="+",d++):(m=null,0===n&&e('"+"')),null===m&&(45===a.charCodeAt(d)?(m="-",d++):(m=null,0===n&&e('"-"')),null===m&&(46===
a.charCodeAt(d)?(m=".",d++):(m=null,0===n&&e('"."'))))));null!==g?b=[b,g]:(b=null,d=h)}else b=null,d=h;null!==b&&(A.scheme=a.substring(d,k),b=void 0);null===b&&(d=k);return b}function Tb(){var b;b=Wb();null===b&&(b=Xb());return b}function Wb(){var b,g,m,c;c=m=d;b=wa();null!==b?(64===a.charCodeAt(d)?(g="@",d++):(g=null,0===n&&e('"@"')),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);b=null!==b?b:"";null!==b?(g=xa(),null!==g?b=[b,g]:(b=null,d=m)):(b=null,d=m);return null!==b?b:""}function Xb(){var b,g;
g=G();null===g&&(g=P(),null===g&&(36===a.charCodeAt(d)?(g="$",d++):(g=null,0===n&&e('"$"')),null===g&&(44===a.charCodeAt(d)?(g=",",d++):(g=null,0===n&&e('","')),null===g&&(59===a.charCodeAt(d)?(g=";",d++):(g=null,0===n&&e('";"')),null===g&&(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null===g&&(64===a.charCodeAt(d)?(g="@",d++):(g=null,0===n&&e('"@"')),null===g&&(38===a.charCodeAt(d)?(g="&",d++):(g=null,0===n&&e('"&"')),null===g&&(61===a.charCodeAt(d)?(g="=",d++):(g=null,0===n&&e('"="')),
null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')))))))))));if(null!==g)for(b=[];null!==g;)b.push(g),g=G(),null===g&&(g=P(),null===g&&(36===a.charCodeAt(d)?(g="$",d++):(g=null,0===n&&e('"$"')),null===g&&(44===a.charCodeAt(d)?(g=",",d++):(g=null,0===n&&e('","')),null===g&&(59===a.charCodeAt(d)?(g=";",d++):(g=null,0===n&&e('";"')),null===g&&(58===a.charCodeAt(d)?(g=":",d++):(g=null,0===n&&e('":"')),null===g&&(64===a.charCodeAt(d)?(g="@",d++):(g=null,0===n&&e('"@"')),null===g&&(38===
a.charCodeAt(d)?(g="&",d++):(g=null,0===n&&e('"&"')),null===g&&(61===a.charCodeAt(d)?(g="=",d++):(g=null,0===n&&e('"="')),null===g&&(43===a.charCodeAt(d)?(g="+",d++):(g=null,0===n&&e('"+"')))))))))));else b=null;return b}function Sb(){var b,d;b=[];for(d=qa();null!==d;)b.push(d),d=qa();return b}function Za(){var b,g,m,c,k,h,f,v;v=f=d;"sip"===a.substr(d,3).toLowerCase()?(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"SIP"'));if(null!==b)if(47===a.charCodeAt(d)?(g="/",d++):(g=null,0===n&&e('"/"')),null!==
g){c=l();if(null!==c)for(m=[];null!==c;)m.push(c),c=l();else m=null;if(null!==m)if(46===a.charCodeAt(d)?(c=".",d++):(c=null,0===n&&e('"."')),null!==c){h=l();if(null!==h)for(k=[];null!==h;)k.push(h),h=l();else k=null;null!==k?b=[b,g,m,c,k]:(b=null,d=v)}else b=null,d=v;else b=null,d=v}else b=null,d=v;else b=null,d=v;null!==b&&(A.sip_version=a.substring(d,f),b=void 0);null===b&&(d=f);return b}function Yb(){var b;"INVITE"===a.substr(d,6)?(b="INVITE",d+=6):(b=null,0===n&&e('"INVITE"'));return b}function Zb(){var b;
"ACK"===a.substr(d,3)?(b="ACK",d+=3):(b=null,0===n&&e('"ACK"'));return b}function $b(){var b;"OPTIONS"===a.substr(d,7)?(b="OPTIONS",d+=7):(b=null,0===n&&e('"OPTIONS"'));return b}function ac(){var b;"BYE"===a.substr(d,3)?(b="BYE",d+=3):(b=null,0===n&&e('"BYE"'));return b}function bc(){var b;"CANCEL"===a.substr(d,6)?(b="CANCEL",d+=6):(b=null,0===n&&e('"CANCEL"'));return b}function cc(){var b;"REGISTER"===a.substr(d,8)?(b="REGISTER",d+=8):(b=null,0===n&&e('"REGISTER"'));return b}function dc(){var b;
"SUBSCRIBE"===a.substr(d,9)?(b="SUBSCRIBE",d+=9):(b=null,0===n&&e('"SUBSCRIBE"'));return b}function ec(){var b;"NOTIFY"===a.substr(d,6)?(b="NOTIFY",d+=6):(b=null,0===n&&e('"NOTIFY"'));return b}function fc(){var b;"REFER"===a.substr(d,5)?(b="REFER",d+=5):(b=null,0===n&&e('"REFER"'));return b}function za(){var b,g;g=d;b=Yb();null===b&&(b=Zb(),null===b&&(b=$b(),null===b&&(b=ac(),null===b&&(b=bc(),null===b&&(b=cc(),null===b&&(b=dc(),null===b&&(b=ec(),null===b&&(b=fc(),null===b&&(b=k())))))))));null!==
b&&(A.method=a.substring(d,g),b=A.method);null===b&&(d=g);return b}function gc(){var b,g,a,c,e,k;k=d;b=Za();null!==b?(g=M(),null!==g?(a=hc(),null!==a?(c=M(),null!==c?(e=ic(),null!==e?b=[b,g,a,c,e]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k)):(b=null,d=k)):(b=null,d=k);return b}function hc(){var b,g;g=d;b=jc();null!==b&&(A.status_code=parseInt(b.join("")),b=void 0);null===b&&(d=g);return b}function jc(){var b,g,a,c;c=d;b=l();null!==b?(g=l(),null!==g?(a=l(),null!==a?b=[b,g,a]:(b=null,d=c)):(b=null,d=c)):
(b=null,d=c);return b}function ic(){var b,g,m;m=d;b=[];g=K();null===g&&(g=G(),null===g&&(g=P(),null===g&&(g=x(),null===g&&(g=V(),null===g&&(g=M(),null===g&&(g=I()))))));for(;null!==g;)b.push(g),g=K(),null===g&&(g=G(),null===g&&(g=P(),null===g&&(g=x(),null===g&&(g=V(),null===g&&(g=M(),null===g&&(g=I()))))));null!==b&&(A.reason_phrase=a.substring(d,m),b=void 0);null===b&&(d=m);return b}function Da(){var b,g,a,c,e,k,h;k=e=d;b=ka();null===b&&(b=aa());if(null!==b){g=[];h=d;a=Q();null!==a?(c=bb(),null!==
c?a=[a,c]:(a=null,d=h)):(a=null,d=h);for(;null!==a;)g.push(a),h=d,a=Q(),null!==a?(c=bb(),null!==c?a=[a,c]:(a=null,d=h)):(a=null,d=h);null!==g?b=[b,g]:(b=null,d=k)}else b=null,d=k;if(null!==b){var f;A.multi_header||(A.multi_header=[]);try{f=new da(A.uri,A.display_name,A.params),delete A.uri,delete A.display_name,delete A.params}catch(tb){f=null}A.multi_header.push({possition:d,offset:e,parsed:f});b=void 0}null===b&&(d=e);return b}function aa(){var b,g,a,c,e;e=d;b=Ea();b=null!==b?b:"";null!==b?(g=Oa(),
null!==g?(a=ya(),null!==a?(c=Na(),null!==c?b=[b,g,a,c]:(b=null,d=e)):(b=null,d=e)):(b=null,d=e)):(b=null,d=e);return b}function Ea(){var b,g,a,c,e,h,f;h=e=d;b=k();if(null!==b){g=[];f=d;a=D();null!==a?(c=k(),null!==c?a=[a,c]:(a=null,d=f)):(a=null,d=f);for(;null!==a;)g.push(a),f=d,a=D(),null!==a?(c=k(),null!==c?a=[a,c]:(a=null,d=f)):(a=null,d=f);null!==g?b=[b,g]:(b=null,d=h)}else b=null,d=h;null===b&&(b=ja());null!==b&&(b=function(b,d){A.display_name="string"===typeof d?d:d[1].reduce(function(b,d){return b+
d[0]+d[1]},d[0])}(e,b));null===b&&(d=e);return b}function bb(){var b;b=kc();null===b&&(b=lc(),null===b&&(b=T()));return b}function kc(){var b,g,m,c,k;k=c=d;"q"===a.substr(d,1).toLowerCase()?(b=a.substr(d,1),d++):(b=null,0===n&&e('"q"'));null!==b?(g=S(),null!==g?(m=mc(),null!==m?b=[b,g,m]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);null!==b&&(b=b[2],A.params||(A.params={}),A.params.q=b,b=void 0);null===b&&(d=c);return b}function lc(){var b,g,m,c,k;k=c=d;"expires"===a.substr(d,7).toLowerCase()?(b=a.substr(d,
7),d+=7):(b=null,0===n&&e('"expires"'));null!==b?(g=S(),null!==g?(m=ba(),null!==m?b=[b,g,m]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);null!==b&&(b=b[2],A.params||(A.params={}),A.params.expires=b,b=void 0);null===b&&(d=c);return b}function ba(){var b,g,a;a=d;g=l();if(null!==g)for(b=[];null!==g;)b.push(g),g=l();else b=null;null!==b&&(b=parseInt(b.join("")));null===b&&(d=a);return b}function mc(){var b,g,m,c,k,h,f,v;f=h=d;48===a.charCodeAt(d)?(b="0",d++):(b=null,0===n&&e('"0"'));null!==b?(v=d,46===a.charCodeAt(d)?
(g=".",d++):(g=null,0===n&&e('"."')),null!==g?(m=l(),m=null!==m?m:"",null!==m?(c=l(),c=null!==c?c:"",null!==c?(k=l(),k=null!==k?k:"",null!==k?g=[g,m,c,k]:(g=null,d=v)):(g=null,d=v)):(g=null,d=v)):(g=null,d=v),g=null!==g?g:"",null!==g?b=[b,g]:(b=null,d=f)):(b=null,d=f);null!==b&&(b=parseFloat(a.substring(d,h)));null===b&&(d=h);return b}function T(){var b,g,a,c,e,h;e=c=d;b=k();null!==b?(h=d,g=S(),null!==g?(a=nc(),null!==a?g=[g,a]:(g=null,d=h)):(g=null,d=h),g=null!==g?g:"",null!==g?b=[b,g]:(b=null,d=
e)):(b=null,d=e);null!==b&&(g=b[0],b=b[1],A.params||(A.params={}),b="undefined"===typeof b?void 0:b[1],A.params[g.toLowerCase()]=b,b=void 0);null===b&&(d=c);return b}function nc(){var b;b=k();null===b&&(b=la(),null===b&&(b=va()));return b}function oc(){var b;"render"===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"render"'));null===b&&("session"===a.substr(d,7).toLowerCase()?(b=a.substr(d,7),d+=7):(b=null,0===n&&e('"session"')),null===b&&("icon"===a.substr(d,4).toLowerCase()?
(b=a.substr(d,4),d+=4):(b=null,0===n&&e('"icon"')),null===b&&("alert"===a.substr(d,5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"alert"')),null===b&&(b=k()))));return b}function cb(){var b;b=pc();null===b&&(b=T());return b}function pc(){var b,g,m,c;c=d;"handling"===a.substr(d,8).toLowerCase()?(b=a.substr(d,8),d+=8):(b=null,0===n&&e('"handling"'));null!==b?(g=S(),null!==g?("optional"===a.substr(d,8).toLowerCase()?(m=a.substr(d,8),d+=8):(m=null,0===n&&e('"optional"')),null===m&&("required"===
a.substr(d,8).toLowerCase()?(m=a.substr(d,8),d+=8):(m=null,0===n&&e('"required"')),null===m&&(m=k())),null!==m?b=[b,g,m]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);return b}function qc(){var b,g,a,c,e,k,h,f;h=d;b=rc();if(null!==b)if(g=ua(),null!==g)if(a=sc(),null!==a){c=[];f=d;e=Q();null!==e?(k=db(),null!==k?e=[e,k]:(e=null,d=f)):(e=null,d=f);for(;null!==e;)c.push(e),f=d,e=Q(),null!==e?(k=db(),null!==k?e=[e,k]:(e=null,d=f)):(e=null,d=f);null!==c?b=[b,g,a,c]:(b=null,d=h)}else b=null,d=h;else b=null,
d=h;else b=null,d=h;return b}function rc(){var b;b=tc();null===b&&(b=uc());return b}function tc(){var b;"text"===a.substr(d,4).toLowerCase()?(b=a.substr(d,4),d+=4):(b=null,0===n&&e('"text"'));null===b&&("image"===a.substr(d,5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"image"')),null===b&&("audio"===a.substr(d,5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"audio"')),null===b&&("video"===a.substr(d,5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"video"')),null===
b&&("application"===a.substr(d,11).toLowerCase()?(b=a.substr(d,11),d+=11):(b=null,0===n&&e('"application"')),null===b&&(b=Fa())))));return b}function uc(){var b;"message"===a.substr(d,7).toLowerCase()?(b=a.substr(d,7),d+=7):(b=null,0===n&&e('"message"'));null===b&&("multipart"===a.substr(d,9).toLowerCase()?(b=a.substr(d,9),d+=9):(b=null,0===n&&e('"multipart"')),null===b&&(b=Fa()));return b}function Fa(){var b;b=k();null===b&&(b=vc());return b}function vc(){var b,g,c;c=d;"x-"===a.substr(d,2).toLowerCase()?
(b=a.substr(d,2),d+=2):(b=null,0===n&&e('"x-"'));null!==b?(g=k(),null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);return b}function sc(){var b;b=Fa();null===b&&(b=k());return b}function db(){var b,g,a,c;c=d;b=k();null!==b?(g=S(),null!==g?(a=wc(),null!==a?b=[b,g,a]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);return b}function wc(){var b;b=k();null===b&&(b=va());return b}function xc(){var b,g,a;a=d;g=l();if(null!==g)for(b=[];null!==g;)b.push(g),g=l();else b=null;null!==b&&(A.value=parseInt(b.join("")),b=void 0);
null===b&&(d=a);return b}function sa(){var b,g,c,k,h,f;h=d;b=v();if(null!==b){g=[];f=d;46===a.charCodeAt(d)?(c=".",d++):(c=null,0===n&&e('"."'));null!==c?(k=v(),null!==k?c=[c,k]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)g.push(c),f=d,46===a.charCodeAt(d)?(c=".",d++):(c=null,0===n&&e('"."')),null!==c?(k=v(),null!==k?c=[c,k]:(c=null,d=f)):(c=null,d=f);null!==g?b=[b,g]:(b=null,d=h)}else b=null,d=h;return b}function eb(){var b;b=fb();null===b&&(b=T());return b}function fb(){var b,g,c,h,f;f=h=d;"tag"===
a.substr(d,3).toLowerCase()?(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"tag"'));null!==b?(g=S(),null!==g?(c=k(),null!==c?b=[b,g,c]:(b=null,d=f)):(b=null,d=f)):(b=null,d=f);null!==b&&(A.tag=b[2],b=void 0);null===b&&(d=h);return b}function gb(){var b,g,c,k,h,f,v,l;v=d;"digest"===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"Digest"'));if(null!==b)if(g=D(),null!==g)if(c=Ga(),null!==c){k=[];l=d;h=N();null!==h?(f=Ga(),null!==f?h=[h,f]:(h=null,d=l)):(h=null,d=l);for(;null!==h;)k.push(h),
l=d,h=N(),null!==h?(f=Ga(),null!==f?h=[h,f]:(h=null,d=l)):(h=null,d=l);null!==k?b=[b,g,c,k]:(b=null,d=v)}else b=null,d=v;else b=null,d=v;else b=null,d=v;null===b&&(b=yc());return b}function yc(){var b,g,a,c,e,h,f,v;f=d;b=k();if(null!==b)if(g=D(),null!==g)if(a=ta(),null!==a){c=[];v=d;e=N();null!==e?(h=ta(),null!==h?e=[e,h]:(e=null,d=v)):(e=null,d=v);for(;null!==e;)c.push(e),v=d,e=N(),null!==e?(h=ta(),null!==h?e=[e,h]:(e=null,d=v)):(e=null,d=v);null!==c?b=[b,g,a,c]:(b=null,d=f)}else b=null,d=f;else b=
null,d=f;else b=null,d=f;return b}function ta(){var b,g,a,c;c=d;b=k();null!==b?(g=S(),null!==g?(a=k(),null===a&&(a=va()),null!==a?b=[b,g,a]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);return b}function Ga(){var b;b=zc();null===b&&(b=Ac(),null===b&&(b=Bc(),null===b&&(b=Cc(),null===b&&(b=Dc(),null===b&&(b=Ec(),null===b&&(b=Fc(),null===b&&(b=ta())))))));return b}function zc(){var b,g,c,k;k=d;"realm"===a.substr(d,5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"realm"'));null!==b?(g=S(),null!==
g?(c=Gc(),null!==c?b=[b,g,c]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);return b}function Gc(){var b,g;g=d;b=ja();null!==b&&(A.realm=b,b=void 0);null===b&&(d=g);return b}function Ac(){var b,g,c,k,h,f,v,l,C;l=d;"domain"===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"domain"'));if(null!==b)if(g=S(),null!==g)if(c=Pa(),null!==c)if(k=Ha(),null!==k){h=[];C=d;v=M();if(null!==v)for(f=[];null!==v;)f.push(v),v=M();else f=null;null!==f?(v=Ha(),null!==v?f=[f,v]:(f=null,d=C)):(f=null,d=
C);for(;null!==f;){h.push(f);C=d;v=M();if(null!==v)for(f=[];null!==v;)f.push(v),v=M();else f=null;null!==f?(v=Ha(),null!==v?f=[f,v]:(f=null,d=C)):(f=null,d=C)}null!==h?(f=ha(),null!==f?b=[b,g,c,k,h,f]:(b=null,d=l)):(b=null,d=l)}else b=null,d=l;else b=null,d=l;else b=null,d=l;else b=null,d=l;return b}function Ha(){var b;b=$a();null===b&&(b=Ba());return b}function Bc(){var b,g,c,k;k=d;"nonce"===a.substr(d,5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"nonce"'));null!==b?(g=S(),null!==g?
(c=Hc(),null!==c?b=[b,g,c]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);return b}function Hc(){var b,g;g=d;b=ja();null!==b&&(A.nonce=b,b=void 0);null===b&&(d=g);return b}function Cc(){var b,g,c,k,h;h=k=d;"opaque"===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"opaque"'));null!==b?(g=S(),null!==g?(c=ja(),null!==c?b=[b,g,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h);null!==b&&(A.opaque=b[2],b=void 0);null===b&&(d=k);return b}function Dc(){var b,g,c,k,h;k=d;"stale"===a.substr(d,5).toLowerCase()?
(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"stale"'));null!==b?(g=S(),null!==g?(h=d,"true"===a.substr(d,4).toLowerCase()?(c=a.substr(d,4),d+=4):(c=null,0===n&&e('"true"')),null!==c&&(A.stale=!0,c=void 0),null===c&&(d=h),null===c&&(h=d,"false"===a.substr(d,5).toLowerCase()?(c=a.substr(d,5),d+=5):(c=null,0===n&&e('"false"')),null!==c&&(A.stale=!1,c=void 0),null===c&&(d=h)),null!==c?b=[b,g,c]:(b=null,d=k)):(b=null,d=k)):(b=null,d=k);return b}function Ec(){var b,g,c,h,f;f=h=d;"algorithm"===a.substr(d,9).toLowerCase()?
(b=a.substr(d,9),d+=9):(b=null,0===n&&e('"algorithm"'));null!==b?(g=S(),null!==g?("md5"===a.substr(d,3).toLowerCase()?(c=a.substr(d,3),d+=3):(c=null,0===n&&e('"MD5"')),null===c&&("md5-sess"===a.substr(d,8).toLowerCase()?(c=a.substr(d,8),d+=8):(c=null,0===n&&e('"MD5-sess"')),null===c&&(c=k())),null!==c?b=[b,g,c]:(b=null,d=f)):(b=null,d=f)):(b=null,d=f);null!==b&&(A.algorithm=b[2].toUpperCase(),b=void 0);null===b&&(d=h);return b}function Fc(){var b,g,c,k,h,f,v,l,C,r;l=d;"qop"===a.substr(d,3).toLowerCase()?
(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"qop"'));if(null!==b)if(g=S(),null!==g)if(c=Pa(),null!==c){C=d;k=Ia();if(null!==k){h=[];r=d;44===a.charCodeAt(d)?(f=",",d++):(f=null,0===n&&e('","'));null!==f?(v=Ia(),null!==v?f=[f,v]:(f=null,d=r)):(f=null,d=r);for(;null!==f;)h.push(f),r=d,44===a.charCodeAt(d)?(f=",",d++):(f=null,0===n&&e('","')),null!==f?(v=Ia(),null!==v?f=[f,v]:(f=null,d=r)):(f=null,d=r);null!==h?k=[k,h]:(k=null,d=C)}else k=null,d=C;null!==k?(h=ha(),null!==h?b=[b,g,c,k,h]:(b=null,d=l)):(b=
null,d=l)}else b=null,d=l;else b=null,d=l;else b=null,d=l;return b}function Ia(){var b,g;g=d;"auth-int"===a.substr(d,8).toLowerCase()?(b=a.substr(d,8),d+=8):(b=null,0===n&&e('"auth-int"'));null===b&&("auth"===a.substr(d,4).toLowerCase()?(b=a.substr(d,4),d+=4):(b=null,0===n&&e('"auth"')),null===b&&(b=k()));null!==b&&(A.qop||(A.qop=[]),A.qop.push(b.toLowerCase()),b=void 0);null===b&&(d=g);return b}function Ja(){var b,g,a,c,e,k,h;k=e=d;b=aa();if(null!==b){g=[];h=d;a=Q();null!==a?(c=T(),null!==c?a=[a,
c]:(a=null,d=h)):(a=null,d=h);for(;null!==a;)g.push(a),h=d,a=Q(),null!==a?(c=T(),null!==c?a=[a,c]:(a=null,d=h)):(a=null,d=h);null!==g?b=[b,g]:(b=null,d=k)}else b=null,d=k;if(null!==b){var f;A.multi_header||(A.multi_header=[]);try{f=new da(A.uri,A.display_name,A.params),delete A.uri,delete A.display_name,delete A.params}catch(tb){f=null}A.multi_header.push({possition:d,offset:e,parsed:f});b=void 0}null===b&&(d=e);return b}function hb(){var b;b=Ic();null===b&&(b=T());return b}function Ic(){var b,g,
c,k,h,f;f=h=d;"cause"===a.substr(d,5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"cause"'));if(null!==b)if(g=S(),null!==g){k=l();if(null!==k)for(c=[];null!==k;)c.push(k),k=l();else c=null;null!==c?b=[b,g,c]:(b=null,d=f)}else b=null,d=f;else b=null,d=f;null!==b&&(A.cause=parseInt(b[2].join("")),b=void 0);null===b&&(d=h);return b}function Ka(){var b,g,a,c,e,k;e=d;b=aa();if(null!==b){g=[];k=d;a=Q();null!==a?(c=T(),null!==c?a=[a,c]:(a=null,d=k)):(a=null,d=k);for(;null!==a;)g.push(a),k=d,a=
Q(),null!==a?(c=T(),null!==c?a=[a,c]:(a=null,d=k)):(a=null,d=k);null!==g?b=[b,g]:(b=null,d=e)}else b=null,d=e;return b}function Jc(){var b,g;g=d;"active"===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"active"'));null===b&&("pending"===a.substr(d,7).toLowerCase()?(b=a.substr(d,7),d+=7):(b=null,0===n&&e('"pending"')),null===b&&("terminated"===a.substr(d,10).toLowerCase()?(b=a.substr(d,10),d+=10):(b=null,0===n&&e('"terminated"')),null===b&&(b=k())));null!==b&&(A.state=a.substring(d,
g),b=void 0);null===b&&(d=g);return b}function ib(){var b,g,c,k,h;h=k=d;"reason"===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"reason"'));null!==b?(g=S(),null!==g?(c=Kc(),null!==c?b=[b,g,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h);null!==b&&(b=function(b,d){"undefined"!==typeof d&&(A.reason=d)}(k,b[2]));null===b&&(d=k);null===b&&(h=k=d,"expires"===a.substr(d,7).toLowerCase()?(b=a.substr(d,7),d+=7):(b=null,0===n&&e('"expires"')),null!==b?(g=S(),null!==g?(c=ba(),null!==c?b=
[b,g,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h),null!==b&&(b=function(b,d){"undefined"!==typeof d&&(A.expires=d)}(k,b[2])),null===b&&(d=k),null===b&&(h=k=d,"retry_after"===a.substr(d,11).toLowerCase()?(b=a.substr(d,11),d+=11):(b=null,0===n&&e('"retry_after"')),null!==b?(g=S(),null!==g?(c=ba(),null!==c?b=[b,g,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h),null!==b&&(b=function(b,d){"undefined"!==typeof d&&(A.retry_after=d)}(k,b[2])),null===b&&(d=k),null===b&&(b=T())));return b}function Kc(){var b;"deactivated"===
a.substr(d,11).toLowerCase()?(b=a.substr(d,11),d+=11):(b=null,0===n&&e('"deactivated"'));null===b&&("probation"===a.substr(d,9).toLowerCase()?(b=a.substr(d,9),d+=9):(b=null,0===n&&e('"probation"')),null===b&&("rejected"===a.substr(d,8).toLowerCase()?(b=a.substr(d,8),d+=8):(b=null,0===n&&e('"rejected"')),null===b&&("timeout"===a.substr(d,7).toLowerCase()?(b=a.substr(d,7),d+=7):(b=null,0===n&&e('"timeout"')),null===b&&("giveup"===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"giveup"')),
null===b&&("noresource"===a.substr(d,10).toLowerCase()?(b=a.substr(d,10),d+=10):(b=null,0===n&&e('"noresource"')),null===b&&("invariant"===a.substr(d,9).toLowerCase()?(b=a.substr(d,9),d+=9):(b=null,0===n&&e('"invariant"')),null===b&&(b=k())))))));return b}function jb(){var b;b=fb();null===b&&(b=T());return b}function La(){var b,g,a,c,e,k,h,f;h=d;b=Lc();if(null!==b)if(g=D(),null!==g)if(a=Mc(),null!==a){c=[];f=d;e=Q();null!==e?(k=kb(),null!==k?e=[e,k]:(e=null,d=f)):(e=null,d=f);for(;null!==e;)c.push(e),
f=d,e=Q(),null!==e?(k=kb(),null!==k?e=[e,k]:(e=null,d=f)):(e=null,d=f);null!==c?b=[b,g,a,c]:(b=null,d=h)}else b=null,d=h;else b=null,d=h;else b=null,d=h;return b}function kb(){var b;b=Nc();null===b&&(b=Oc(),null===b&&(b=Pc(),null===b&&(b=Qc(),null===b&&(b=Rc(),null===b&&(b=T())))));return b}function Nc(){var b,g,c,k,h;h=k=d;"ttl"===a.substr(d,3).toLowerCase()?(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"ttl"'));null!==b?(g=S(),null!==g?(c=Ya(),null!==c?b=[b,g,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=
h);null!==b&&(A.ttl=b[2],b=void 0);null===b&&(d=k);return b}function Oc(){var b,g,c,k,h;h=k=d;"maddr"===a.substr(d,5).toLowerCase()?(b=a.substr(d,5),d+=5):(b=null,0===n&&e('"maddr"'));null!==b?(g=S(),null!==g?(c=la(),null!==c?b=[b,g,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h);null!==b&&(A.maddr=b[2],b=void 0);null===b&&(d=k);return b}function Pc(){var b,g,c,k,h;h=k=d;"received"===a.substr(d,8).toLowerCase()?(b=a.substr(d,8),d+=8):(b=null,0===n&&e('"received"'));null!==b?(g=S(),null!==g?(c=ma(),null===
c&&(c=Wa()),null!==c?b=[b,g,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h);null!==b&&(A.received=b[2],b=void 0);null===b&&(d=k);return b}function Qc(){var b,g,c,h,f;f=h=d;"branch"===a.substr(d,6).toLowerCase()?(b=a.substr(d,6),d+=6):(b=null,0===n&&e('"branch"'));null!==b?(g=S(),null!==g?(c=k(),null!==c?b=[b,g,c]:(b=null,d=f)):(b=null,d=f)):(b=null,d=f);null!==b&&(A.branch=b[2],b=void 0);null===b&&(d=h);return b}function Rc(){var b,g,c,k,h,f,v;f=h=d;"rport"===a.substr(d,5).toLowerCase()?(b=a.substr(d,
5),d+=5):(b=null,0===n&&e('"rport"'));if(null!==b){v=d;g=S();if(null!==g){c=[];for(k=l();null!==k;)c.push(k),k=l();null!==c?g=[g,c]:(g=null,d=v)}else g=null,d=v;g=null!==g?g:"";null!==g?b=[b,g]:(b=null,d=f)}else b=null,d=f;null!==b&&("undefined"!==typeof response_port&&(A.rport=response_port.join("")),b=void 0);null===b&&(d=h);return b}function Lc(){var b,g,a,c,e,h;h=d;b=Sc();null!==b?(g=ua(),null!==g?(a=k(),null!==a?(c=ua(),null!==c?(e=Tc(),null!==e?b=[b,g,a,c,e]:(b=null,d=h)):(b=null,d=h)):(b=null,
d=h)):(b=null,d=h)):(b=null,d=h);return b}function Sc(){var b,g;g=d;"sip"===a.substr(d,3).toLowerCase()?(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"SIP"'));null===b&&(b=k());null!==b&&(A.protocol=b,b=void 0);null===b&&(d=g);return b}function Tc(){var b,g;g=d;"udp"===a.substr(d,3).toLowerCase()?(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"UDP"'));null===b&&("tcp"===a.substr(d,3).toLowerCase()?(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"TCP"')),null===b&&("tls"===a.substr(d,3).toLowerCase()?(b=a.substr(d,
3),d+=3):(b=null,0===n&&e('"TLS"')),null===b&&("sctp"===a.substr(d,4).toLowerCase()?(b=a.substr(d,4),d+=4):(b=null,0===n&&e('"SCTP"')),null===b&&(b=k()))));null!==b&&(A.transport=b,b=void 0);null===b&&(d=g);return b}function Mc(){var b,g,a,c,e;c=d;b=Uc();null!==b?(e=d,g=ob(),null!==g?(a=Vc(),null!==a?g=[g,a]:(g=null,d=e)):(g=null,d=e),g=null!==g?g:"",null!==g?b=[b,g]:(b=null,d=c)):(b=null,d=c);return b}function Uc(){var b,g;g=d;b=ma();null===b&&(b=Ua(),null===b&&(b=Ta()));null!==b&&(A.host=a.substring(d,
g),b=void 0);null===b&&(d=g);return b}function Vc(){var b,g,a,c,e,k,h;h=k=d;b=l();b=null!==b?b:"";null!==b?(g=l(),g=null!==g?g:"",null!==g?(a=l(),a=null!==a?a:"",null!==a?(c=l(),c=null!==c?c:"",null!==c?(e=l(),e=null!==e?e:"",null!==e?b=[b,g,a,c,e]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h)):(b=null,d=h)):(b=null,d=h);null!==b&&(A.port=parseInt(b.join("")),b=void 0);null===b&&(d=k);return b}function Ya(){var b,g,a,c,e;e=c=d;b=l();null!==b?(g=l(),g=null!==g?g:"",null!==g?(a=l(),a=null!==a?a:"",null!==
a?b=[b,g,a]:(b=null,d=e)):(b=null,d=e)):(b=null,d=e);null!==b&&(b=parseInt(b.join("")));null===b&&(d=c);return b}function Wc(){var b,g;g=d;b=ba();null!==b&&(A.expires=b,b=void 0);null===b&&(d=g);return b}function lb(){var b;b=Xc();null===b&&(b=T());return b}function Xc(){var b,g,c,k,h;h=k=d;"refresher"===a.substr(d,9).toLowerCase()?(b=a.substr(d,9),d+=9):(b=null,0===n&&e('"refresher"'));null!==b?(g=S(),null!==g?("uac"===a.substr(d,3).toLowerCase()?(c=a.substr(d,3),d+=3):(c=null,0===n&&e('"uac"')),
null===c&&("uas"===a.substr(d,3).toLowerCase()?(c=a.substr(d,3),d+=3):(c=null,0===n&&e('"uas"'))),null!==c?b=[b,g,c]:(b=null,d=h)):(b=null,d=h)):(b=null,d=h);null!==b&&(A.refresher=b[2].toLowerCase(),b=void 0);null===b&&(d=k);return b}function Yc(){var b,d;b=[];d=q();null===d&&(d=V(),null===d&&(d=D()));for(;null!==d;)b.push(d),d=q(),null===d&&(d=V(),null===d&&(d=D()));return b}function Zc(){var b,g,c,k,h,f,v,l,C,r,t;t=r=d;b=$c();null!==b?(45===a.charCodeAt(d)?(g="-",d++):(g=null,0===n&&e('"-"')),
null!==g?(c=Y(),null!==c?(45===a.charCodeAt(d)?(k="-",d++):(k=null,0===n&&e('"-"')),null!==k?(h=Y(),null!==h?(45===a.charCodeAt(d)?(f="-",d++):(f=null,0===n&&e('"-"')),null!==f?(v=Y(),null!==v?(45===a.charCodeAt(d)?(l="-",d++):(l=null,0===n&&e('"-"')),null!==l?(C=ad(),null!==C?b=[b,g,c,k,h,f,v,l,C]:(b=null,d=t)):(b=null,d=t)):(b=null,d=t)):(b=null,d=t)):(b=null,d=t)):(b=null,d=t)):(b=null,d=t)):(b=null,d=t)):(b=null,d=t);null!==b&&(A=a.substring(d+5,r),b=void 0);null===b&&(d=r);return b}function Y(){var b,
g,a,c,e;e=d;b=h();null!==b?(g=h(),null!==g?(a=h(),null!==a?(c=h(),null!==c?b=[b,g,a,c]:(b=null,d=e)):(b=null,d=e)):(b=null,d=e)):(b=null,d=e);return b}function $c(){var b,g,a;a=d;b=Y();null!==b?(g=Y(),null!==g?b=[b,g]:(b=null,d=a)):(b=null,d=a);return b}function ad(){var b,g,a,c;c=d;b=Y();null!==b?(g=Y(),null!==g?(a=Y(),null!==a?b=[b,g,a]:(b=null,d=c)):(b=null,d=c)):(b=null,d=c);return b}function bd(){var b,g,c,k,h,f;h=k=d;b=fa();null!==b?(f=d,64===a.charCodeAt(d)?(g="@",d++):(g=null,0===n&&e('"@"')),
null!==g?(c=fa(),null!==c?g=[g,c]:(g=null,d=f)):(g=null,d=f),g=null!==g?g:"",null!==g?b=[b,g]:(b=null,d=h)):(b=null,d=h);null!==b&&(A.call_id=a.substring(d,k),b=void 0);null===b&&(d=k);return b}function mb(){var b;b=cd();null===b&&(b=dd(),null===b&&(b=ed(),null===b&&(b=T())));return b}function cd(){var b,g,c,h,f;f=h=d;"to-tag"===a.substr(d,6)?(b="to-tag",d+=6):(b=null,0===n&&e('"to-tag"'));null!==b?(g=S(),null!==g?(c=k(),null!==c?b=[b,g,c]:(b=null,d=f)):(b=null,d=f)):(b=null,d=f);null!==b&&(A.to_tag=
b[2],b=void 0);null===b&&(d=h);return b}function dd(){var b,g,c,h,f;f=h=d;"from-tag"===a.substr(d,8)?(b="from-tag",d+=8):(b=null,0===n&&e('"from-tag"'));null!==b?(g=S(),null!==g?(c=k(),null!==c?b=[b,g,c]:(b=null,d=f)):(b=null,d=f)):(b=null,d=f);null!==b&&(A.from_tag=b[2],b=void 0);null===b&&(d=h);return b}function ed(){var b,g;g=d;"early-only"===a.substr(d,10)?(b="early-only",d+=10):(b=null,0===n&&e('"early-only"'));null!==b&&(A.early_only=!0,b=void 0);null===b&&(d=g);return b}function hd(b){b.sort();
for(var d=null,a=[],c=0;c<b.length;c++)b[c]!==d&&(a.push(b[c]),d=b[c]);return a}function id(){for(var b=1,g=1,c=!1,e=0;e<Math.max(d,ea);e++){var k=a.charAt(e);"\n"===k?(c||b++,g=1,c=!1):"\r"===k||"\u2028"===k||"\u2029"===k?(b++,g=1,c=!0):(g++,c=!1)}return{line:b,column:g}}var fd={CRLF:E,DIGIT:l,ALPHA:c,HEXDIG:h,WSP:z,OCTET:B,DQUOTE:F,SP:M,HTAB:I,alphanum:L,reserved:K,unreserved:G,mark:r,escaped:P,LWS:D,SWS:t,HCOLON:O,TEXT_UTF8_TRIM:w,TEXT_UTF8char:q,UTF8_NONASCII:x,UTF8_CONT:V,LHEX:function(){var b;
b=l();null===b&&(/^[a-f]/.test(a.charAt(d))?(b=a.charAt(d),d++):(b=null,0===n&&e("[a-f]")));return b},token:k,token_nodot:v,separators:function(){var b;40===a.charCodeAt(d)?(b="(",d++):(b=null,0===n&&e('"("'));null===b&&(41===a.charCodeAt(d)?(b=")",d++):(b=null,0===n&&e('")"')),null===b&&(60===a.charCodeAt(d)?(b="<",d++):(b=null,0===n&&e('"<"')),null===b&&(62===a.charCodeAt(d)?(b=">",d++):(b=null,0===n&&e('">"')),null===b&&(64===a.charCodeAt(d)?(b="@",d++):(b=null,0===n&&e('"@"')),null===b&&(44===
a.charCodeAt(d)?(b=",",d++):(b=null,0===n&&e('","')),null===b&&(59===a.charCodeAt(d)?(b=";",d++):(b=null,0===n&&e('";"')),null===b&&(58===a.charCodeAt(d)?(b=":",d++):(b=null,0===n&&e('":"')),null===b&&(92===a.charCodeAt(d)?(b="\\",d++):(b=null,0===n&&e('"\\\\"')),null===b&&(b=F(),null===b&&(47===a.charCodeAt(d)?(b="/",d++):(b=null,0===n&&e('"/"')),null===b&&(91===a.charCodeAt(d)?(b="[",d++):(b=null,0===n&&e('"["')),null===b&&(93===a.charCodeAt(d)?(b="]",d++):(b=null,0===n&&e('"]"')),null===b&&(63===
a.charCodeAt(d)?(b="?",d++):(b=null,0===n&&e('"?"')),null===b&&(61===a.charCodeAt(d)?(b="=",d++):(b=null,0===n&&e('"="')),null===b&&(123===a.charCodeAt(d)?(b="{",d++):(b=null,0===n&&e('"{"')),null===b&&(125===a.charCodeAt(d)?(b="}",d++):(b=null,0===n&&e('"}"')),null===b&&(b=M(),null===b&&(b=I()))))))))))))))))));return b},word:fa,STAR:C,SLASH:ua,EQUAL:S,LPAREN:ca,RPAREN:u,RAQUOT:Na,LAQUOT:Oa,COMMA:N,SEMI:Q,COLON:ob,LDQUOT:Pa,RDQUOT:ha,comment:Qa,ctext:Ra,quoted_string:va,quoted_string_clean:ja,qdtext:ia,
quoted_pair:Z,SIP_URI_noparams:ka,SIP_URI:ya,uri_scheme:X,uri_scheme_sips:ub,uri_scheme_sip:vb,userinfo:wa,user:wb,user_unreserved:Sa,password:xb,hostport:xa,host:la,hostname:Ta,domainlabel:Va,toplabel:zb,IPv6reference:Ua,IPv6address:Wa,h16:H,ls32:W,IPv4address:ma,dec_octet:na,port:yb,uri_parameters:rb,uri_parameter:Xa,transport_param:Ab,user_param:Bb,method_param:Cb,ttl_param:Db,maddr_param:Eb,lr_param:Fb,other_param:Gb,pname:Hb,pvalue:Ib,paramchar:oa,param_unreserved:Jb,headers:sb,header:Aa,hname:Kb,
hvalue:Lb,hnv_unreserved:pa,Request_Response:function(){var b;b=gc();null===b&&(b=Mb());return b},Request_Line:Mb,Request_URI:Nb,absoluteURI:$a,hier_part:Pb,net_path:Rb,abs_path:Ba,opaque_part:Qb,uric:qa,uric_no_slash:Vb,path_segments:Ub,segment:Ca,param:ab,pchar:ra,scheme:Ob,authority:Tb,srvr:Wb,reg_name:Xb,query:Sb,SIP_Version:Za,INVITEm:Yb,ACKm:Zb,OPTIONSm:$b,BYEm:ac,CANCELm:bc,REGISTERm:cc,SUBSCRIBEm:dc,NOTIFYm:ec,REFERm:fc,Method:za,Status_Line:gc,Status_Code:hc,extension_code:jc,Reason_Phrase:ic,
Allow_Events:function(){var b,g,a,c,e,k;e=d;b=sa();if(null!==b){g=[];k=d;a=N();null!==a?(c=sa(),null!==c?a=[a,c]:(a=null,d=k)):(a=null,d=k);for(;null!==a;)g.push(a),k=d,a=N(),null!==a?(c=sa(),null!==c?a=[a,c]:(a=null,d=k)):(a=null,d=k);null!==g?b=[b,g]:(b=null,d=e)}else b=null,d=e;return b},Call_ID:function(){var b,g,c,k,h,f;h=k=d;b=fa();null!==b?(f=d,64===a.charCodeAt(d)?(g="@",d++):(g=null,0===n&&e('"@"')),null!==g?(c=fa(),null!==c?g=[g,c]:(g=null,d=f)):(g=null,d=f),g=null!==g?g:"",null!==g?b=[b,
g]:(b=null,d=h)):(b=null,d=h);null!==b&&(A=a.substring(d,k),b=void 0);null===b&&(d=k);return b},Contact:function(){var b,a,c,e,k,h,f;k=d;b=C();if(null===b)if(h=d,b=Da(),null!==b){a=[];f=d;c=N();null!==c?(e=Da(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),f=d,c=N(),null!==c?(e=Da(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;if(null!==b){a=A.multi_header.length;for(b=0;b<a;b++)if(null===A.multi_header[b].parsed){A=null;break}A=
null!==A?A.multi_header:-1;b=void 0}null===b&&(d=k);return b},contact_param:Da,name_addr:aa,display_name:Ea,contact_params:bb,c_p_q:kc,c_p_expires:lc,delta_seconds:ba,qvalue:mc,generic_param:T,gen_value:nc,Content_Disposition:function(){var b,a,c,e,k,h;k=d;b=oc();if(null!==b){a=[];h=d;c=Q();null!==c?(e=cb(),null!==e?c=[c,e]:(c=null,d=h)):(c=null,d=h);for(;null!==c;)a.push(c),h=d,c=Q(),null!==c?(e=cb(),null!==e?c=[c,e]:(c=null,d=h)):(c=null,d=h);null!==a?b=[b,a]:(b=null,d=k)}else b=null,d=k;return b},
disp_type:oc,disp_param:cb,handling_param:pc,Content_Encoding:function(){var b,a,c,e,h,f;h=d;b=k();if(null!==b){a=[];f=d;c=N();null!==c?(e=k(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),f=d,c=N(),null!==c?(e=k(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;return b},Content_Length:function(){var b,a,c;c=d;a=l();if(null!==a)for(b=[];null!==a;)b.push(a),a=l();else b=null;null!==b&&(A=parseInt(b.join("")),b=void 0);null===b&&(d=c);
return b},Content_Type:function(){var b,g;g=d;b=qc();null!==b&&(A=a.substring(d,g),b=void 0);null===b&&(d=g);return b},media_type:qc,m_type:rc,discrete_type:tc,composite_type:uc,extension_token:Fa,x_token:vc,m_subtype:sc,m_parameter:db,m_value:wc,CSeq:function(){var b,a,c,e;e=d;b=xc();null!==b?(a=D(),null!==a?(c=za(),null!==c?b=[b,a,c]:(b=null,d=e)):(b=null,d=e)):(b=null,d=e);return b},CSeq_value:xc,Expires:function(){var b,a;a=d;b=ba();null!==b&&(A=b,b=void 0);null===b&&(d=a);return b},Event:function(){var b,
a,c,e,k,h,f;h=k=d;b=sa();if(null!==b){a=[];f=d;c=Q();null!==c?(e=T(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),f=d,c=Q(),null!==c?(e=T(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;null!==b&&(A.event=b[0].join("").toLowerCase(),b=void 0);null===b&&(d=k);return b},event_type:sa,From:function(){var b,a,c,e,k,h,f;h=k=d;b=ka();null===b&&(b=aa());if(null!==b){a=[];f=d;c=Q();null!==c?(e=eb(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,
d=f);for(;null!==c;)a.push(c),f=d,c=Q(),null!==c?(e=eb(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;if(null!==b){b=A.tag;try{A=new da(A.uri,A.display_name,A.params),b&&A.setParam("tag",b)}catch(qb){A=-1}b=void 0}null===b&&(d=k);return b},from_param:eb,tag_param:fb,Max_Forwards:function(){var b,a,c;c=d;a=l();if(null!==a)for(b=[];null!==a;)b.push(a),a=l();else b=null;null!==b&&(A=parseInt(b.join("")),b=void 0);null===b&&(d=c);return b},Min_Expires:function(){var b,
a;a=d;b=ba();null!==b&&(A=b,b=void 0);null===b&&(d=a);return b},Name_Addr_Header:function(){var b,a,c,e,k,h,f,v,l,C;l=v=d;b=[];for(a=Ea();null!==a;)b.push(a),a=Ea();if(null!==b)if(a=Oa(),null!==a)if(c=ya(),null!==c)if(e=Na(),null!==e){k=[];C=d;h=Q();null!==h?(f=T(),null!==f?h=[h,f]:(h=null,d=C)):(h=null,d=C);for(;null!==h;)k.push(h),C=d,h=Q(),null!==h?(f=T(),null!==f?h=[h,f]:(h=null,d=C)):(h=null,d=C);null!==k?b=[b,a,c,e,k]:(b=null,d=l)}else b=null,d=l;else b=null,d=l;else b=null,d=l;else b=null,
d=l;if(null!==b){try{A=new da(A.uri,A.display_name,A.params)}catch(ld){A=-1}b=void 0}null===b&&(d=v);return b},Proxy_Authenticate:function(){return gb()},challenge:gb,other_challenge:yc,auth_param:ta,digest_cln:Ga,realm:zc,realm_value:Gc,domain:Ac,URI:Ha,nonce:Bc,nonce_value:Hc,opaque:Cc,stale:Dc,algorithm:Ec,qop_options:Fc,qop_value:Ia,Proxy_Require:function(){var b,a,c,e,h,f;h=d;b=k();if(null!==b){a=[];f=d;c=N();null!==c?(e=k(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),
f=d,c=N(),null!==c?(e=k(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;return b},Record_Route:function(){var b,a,c,e,k,h,f;h=k=d;b=Ja();if(null!==b){a=[];f=d;c=N();null!==c?(e=Ja(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),f=d,c=N(),null!==c?(e=Ja(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;if(null!==b){a=A.multi_header.length;for(b=0;b<a;b++)if(null===A.multi_header[b].parsed){A=
null;break}A=null!==A?A.multi_header:-1;b=void 0}null===b&&(d=k);return b},rec_route:Ja,Reason:function(){var b,c,h,f,v,l,C;l=v=d;"sip"===a.substr(d,3).toLowerCase()?(b=a.substr(d,3),d+=3):(b=null,0===n&&e('"SIP"'));null===b&&(b=k());if(null!==b){c=[];C=d;h=Q();null!==h?(f=hb(),null!==f?h=[h,f]:(h=null,d=C)):(h=null,d=C);for(;null!==h;)c.push(h),C=d,h=Q(),null!==h?(f=hb(),null!==f?h=[h,f]:(h=null,d=C)):(h=null,d=C);null!==c?b=[b,c]:(b=null,d=l)}else b=null,d=l;null!==b&&(A.protocol=b[0].toLowerCase(),
A.params||(A.params={}),A.params.text&&'"'===A.params.text[0]&&(b=A.params.text,A.text=b.substring(1,b.length-1),delete A.params.text),b=void 0);null===b&&(d=v);return b},reason_param:hb,reason_cause:Ic,Require:function(){var b,a,c,e,h,f;h=d;b=k();if(null!==b){a=[];f=d;c=N();null!==c?(e=k(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),f=d,c=N(),null!==c?(e=k(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;return b},Route:function(){var b,
a,c,e,k,h;k=d;b=Ka();if(null!==b){a=[];h=d;c=N();null!==c?(e=Ka(),null!==e?c=[c,e]:(c=null,d=h)):(c=null,d=h);for(;null!==c;)a.push(c),h=d,c=N(),null!==c?(e=Ka(),null!==e?c=[c,e]:(c=null,d=h)):(c=null,d=h);null!==a?b=[b,a]:(b=null,d=k)}else b=null,d=k;return b},route_param:Ka,Subscription_State:function(){var b,a,c,e,h,k;h=d;b=Jc();if(null!==b){a=[];k=d;c=Q();null!==c?(e=ib(),null!==e?c=[c,e]:(c=null,d=k)):(c=null,d=k);for(;null!==c;)a.push(c),k=d,c=Q(),null!==c?(e=ib(),null!==e?c=[c,e]:(c=null,d=
k)):(c=null,d=k);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;return b},substate_value:Jc,subexp_params:ib,event_reason_value:Kc,Subject:function(){var b;b=w();return null!==b?b:""},Supported:function(){var b,a,c,e,h,f;h=d;b=k();if(null!==b){a=[];f=d;c=N();null!==c?(e=k(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),f=d,c=N(),null!==c?(e=k(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;return null!==b?b:""},To:function(){var b,
a,c,e,h,k,f;k=h=d;b=ka();null===b&&(b=aa());if(null!==b){a=[];f=d;c=Q();null!==c?(e=jb(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),f=d,c=Q(),null!==c?(e=jb(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,d=k)}else b=null,d=k;if(null!==b){b=A.tag;try{A=new da(A.uri,A.display_name,A.params),b&&A.setParam("tag",b)}catch(qb){A=-1}b=void 0}null===b&&(d=h);return b},to_param:jb,Via:function(){var b,a,c,e,h,k;h=d;b=La();if(null!==b){a=[];k=d;c=N();null!==
c?(e=La(),null!==e?c=[c,e]:(c=null,d=k)):(c=null,d=k);for(;null!==c;)a.push(c),k=d,c=N(),null!==c?(e=La(),null!==e?c=[c,e]:(c=null,d=k)):(c=null,d=k);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;return b},via_param:La,via_params:kb,via_ttl:Nc,via_maddr:Oc,via_received:Pc,via_branch:Qc,response_port:Rc,sent_protocol:Lc,protocol_name:Sc,transport:Tc,sent_by:Mc,via_host:Uc,via_port:Vc,ttl:Ya,WWW_Authenticate:function(){return gb()},Session_Expires:function(){var b,a,c,e,k,h;k=d;b=Wc();if(null!==b){a=
[];h=d;c=Q();null!==c?(e=lb(),null!==e?c=[c,e]:(c=null,d=h)):(c=null,d=h);for(;null!==c;)a.push(c),h=d,c=Q(),null!==c?(e=lb(),null!==e?c=[c,e]:(c=null,d=h)):(c=null,d=h);null!==a?b=[b,a]:(b=null,d=k)}else b=null,d=k;return b},s_e_expires:Wc,s_e_params:lb,s_e_refresher:Xc,extension_header:function(){var b,a,c,e;e=d;b=k();null!==b?(a=O(),null!==a?(c=Yc(),null!==c?b=[b,a,c]:(b=null,d=e)):(b=null,d=e)):(b=null,d=e);return b},header_value:Yc,message_body:function(){var b,d;b=[];for(d=B();null!==d;)b.push(d),
d=B();return b},uuid_URI:function(){var b,c,h;h=d;"uuid:"===a.substr(d,5)?(b="uuid:",d+=5):(b=null,0===n&&e('"uuid:"'));null!==b?(c=Zc(),null!==c?b=[b,c]:(b=null,d=h)):(b=null,d=h);return b},uuid:Zc,hex4:Y,hex8:$c,hex12:ad,Refer_To:function(){var b,a,c,e,h,k,f;k=h=d;b=ka();null===b&&(b=aa());if(null!==b){a=[];f=d;c=Q();null!==c?(e=T(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);for(;null!==c;)a.push(c),f=d,c=Q(),null!==c?(e=T(),null!==e?c=[c,e]:(c=null,d=f)):(c=null,d=f);null!==a?b=[b,a]:(b=null,
d=k)}else b=null,d=k;if(null!==b){try{A=new da(A.uri,A.display_name,A.params)}catch(qb){A=-1}b=void 0}null===b&&(d=h);return b},Replaces:function(){var b,a,c,e,h,k;h=d;b=bd();if(null!==b){a=[];k=d;c=Q();null!==c?(e=mb(),null!==e?c=[c,e]:(c=null,d=k)):(c=null,d=k);for(;null!==c;)a.push(c),k=d,c=Q(),null!==c?(e=mb(),null!==e?c=[c,e]:(c=null,d=k)):(c=null,d=k);null!==a?b=[b,a]:(b=null,d=h)}else b=null,d=h;return b},call_id:bd,replaces_param:mb,to_tag:cd,from_tag:dd,early_flag:ed};if(void 0!==y){if(void 0===
fd[y])throw Error("Invalid rule name: "+p(y)+".");}else y="CRLF";var d=0,n=0,ea=0,Ma=[],pb=f("./URI"),da=f("./NameAddrHeader"),A={};if(null===fd[y]()||d!==a.length){var nb=Math.max(d,ea),jd=nb<a.length?a.charAt(nb):null,gd=id();new this.SyntaxError(hd(Ma),jd,nb,gd.line,gd.column);return-1}return A},toSource:function(){return this._source},SyntaxError:function(a,f,e,E,l){this.name="SyntaxError";this.expected=a;this.found=f;switch(a.length){case 0:a="end of input";break;case 1:a=a[0];break;default:a=
a.slice(0,a.length-1).join(", ")+" or "+a[a.length-1]}f=f?p(f):"end of input";this.message="Expected "+a+" but "+f+" found.";this.offset=e;this.line=E;this.column=l}};q.SyntaxError.prototype=Error.prototype;return q}()},{"./NameAddrHeader":10,"./URI":25}],8:[function(f,u,x){var p=f("../package.json");x=f("./Constants");var q=f("./Exceptions"),a=f("./Utils"),y=f("./UA"),e=f("./URI"),E=f("./NameAddrHeader"),l=f("./Grammar"),c=f("./WebSocketInterface");f("debug")("JsSIP")("version %s",p.version);u.exports=
{C:x,Exceptions:q,Utils:a,UA:y,URI:e,NameAddrHeader:E,WebSocketInterface:c,Grammar:l,debug:f("debug"),get name(){return p.title},get version(){return p.version}}},{"../package.json":38,"./Constants":2,"./Exceptions":6,"./Grammar":7,"./NameAddrHeader":10,"./UA":24,"./URI":25,"./Utils":26,"./WebSocketInterface":27,debug:30}],9:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:
function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};return p(a)}function q(a,c){for(var e=0;e<c.length;e++){var h=c[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function a(a,c,e){c&&q(a.prototype,c);e&&q(a,e);return a}function y(a){y=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||
Object.getPrototypeOf(a)};return y(a)}function e(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}});c&&E(a,c)}function E(a,c){E=Object.setPrototypeOf||function(a,c){a.__proto__=c;return a};return E(a,c)}x=f("events").EventEmitter;var l=f("./Constants"),c=f("./SIPMessage"),h=f("./Utils"),z=f("./RequestSender"),B=f("./Exceptions"),F=f("debug")("JsSIP:Message");
u.exports=function(f){function E(a){var c;if(!(this instanceof E))throw new TypeError("Cannot call a class as a function");c=y(E).call(this);if(!c||"object"!==p(c)&&"function"!==typeof c){if(void 0===this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=this}c._ua=a;c._request=null;c._closed=!1;c._direction=null;c._local_identity=null;c._remote_identity=null;c._is_replied=!1;c._data={};return c}e(E,f);a(E,[{key:"send",value:function(a,e){var f=this,r=2<arguments.length&&
void 0!==arguments[2]?arguments[2]:{},B=a;if(void 0===a||void 0===e)throw new TypeError("Not enough arguments");a=this._ua.normalizeTarget(a);if(!a)throw new TypeError("Invalid target: ".concat(B));var B=h.cloneArray(r.extraHeaders),F=r.eventHandlers||{},r=r.contentType||"text/plain",t;for(t in F)if(Object.prototype.hasOwnProperty.call(F,t))this.on(t,F[t]);B.push("Content-Type: ".concat(r));this._request=new c.OutgoingRequest(l.MESSAGE,a,this._ua,null,B);e&&(this._request.body=e);t=new z(this._ua,
this._request,{onRequestTimeout:function(){f._onRequestTimeout()},onTransportError:function(){f._onTransportError()},onReceiveResponse:function(a){f._receiveResponse(a)}});this._newMessage("local",this._request);t.send()}},{key:"init_incoming",value:function(a){this._request=a;this._newMessage("remote",a);this._is_replied||(this._is_replied=!0,a.reply(200));this._close()}},{key:"accept",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=h.cloneArray(a.extraHeaders),
a=a.body;if("incoming"!==this._direction)throw new B.NotSupportedError('"accept" not supported for outgoing Message');if(this._is_replied)throw Error("incoming Message already replied");this._is_replied=!0;this._request.reply(200,null,c,a)}},{key:"reject",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=a.status_code||480,e=a.reason_phrase,f=h.cloneArray(a.extraHeaders),a=a.body;if("incoming"!==this._direction)throw new B.NotSupportedError('"reject" not supported for outgoing Message');
if(this._is_replied)throw Error("incoming Message already replied");if(300>c||700<=c)throw new TypeError("Invalid status_code: ".concat(c));this._is_replied=!0;this._request.reply(c,e,f,a)}},{key:"_receiveResponse",value:function(a){if(!this._closed)switch(!0){case /^1[0-9]{2}$/.test(a.status_code):break;case /^2[0-9]{2}$/.test(a.status_code):this._succeeded("remote",a);break;default:var c=h.sipErrorCause(a.status_code);this._failed("remote",a,c)}}},{key:"_onRequestTimeout",value:function(){this._closed||
this._failed("system",null,l.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,l.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0;this._ua.destroyMessage(this)}},{key:"_newMessage",value:function(a,c){"remote"===a?(this._direction="incoming",this._local_identity=c.to,this._remote_identity=c.from):"local"===a&&(this._direction="outgoing",this._local_identity=c.from,this._remote_identity=c.to);this._ua.newMessage(this,
{originator:a,message:this,request:c})}},{key:"_failed",value:function(a,c,e){F("MESSAGE failed");this._close();F('emit "failed"');this.emit("failed",{originator:a,response:c||null,cause:e})}},{key:"_succeeded",value:function(a,c){F("MESSAGE succeeded");this._close();F('emit "succeeded"');this.emit("succeeded",{originator:a,response:c})}},{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}}]);
return E}(x)},{"./Constants":2,"./Exceptions":6,"./RequestSender":18,"./SIPMessage":19,"./Utils":26,debug:30,events:29}],10:[function(f,u,x){function p(a,f){for(var e=0;e<f.length;e++){var c=f[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}function q(a,f,l){f&&p(a.prototype,f);l&&p(a,l);return a}var a=f("./URI"),y=f("./Grammar");u.exports=function(){function e(f,l,c){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");
if(!(f&&f instanceof a))throw new TypeError('missing or invalid "uri" parameter');this._uri=f;this._parameters={};this.display_name=l;for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&this.setParam(h,c[h])}q(e,null,[{key:"parse",value:function(a){a=y.parse(a,"Name_Addr_Header");if(-1!==a)return a}}]);q(e,[{key:"setParam",value:function(a,e){a&&(this._parameters[a.toLowerCase()]="undefined"===typeof e||null===e?null:e.toString())}},{key:"getParam",value:function(a){if(a)return this._parameters[a.toLowerCase()]}},
{key:"hasParam",value:function(a){if(a)return this._parameters.hasOwnProperty(a.toLowerCase())&&!0||!1}},{key:"deleteParam",value:function(a){a=a.toLowerCase();if(this._parameters.hasOwnProperty(a)){var e=this._parameters[a];delete this._parameters[a];return e}}},{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(a){return a.replace(/\\/g,
"\\\\").replace(/"/g,'\\"')}},{key:"toString",value:function(){var a=this._display_name?'"'.concat(this._quote(this._display_name),'" '):"",a=a+"<".concat(this._uri.toString(),">"),e;for(e in this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(a+=";".concat(e),null!==this._parameters[e]&&(a+="=".concat(this._parameters[e])));return a}},{key:"uri",get:function(){return this._uri}},{key:"display_name",get:function(){return this._display_name},set:function(a){this._display_name=
0===a?"0":a}}]);return e}()},{"./Grammar":7,"./URI":25}],11:[function(f,u,x){var p=f("./Grammar"),q=f("./SIPMessage"),a=f("debug")("JsSIP:ERROR:Parser");a.log=console.warn.bind(console);x.parseMessage=function(f,e){var E,l=f.indexOf("\r\n");if(-1===l)a("parseMessage() | no CRLF found, not a SIP message");else{var c=f.substring(0,l),h=p.parse(c,"Request_Response");if(-1===h)a('parseMessage() | error parsing first line of SIP message: "'.concat(c,'"'));else{h.status_code?(e=new q.IncomingResponse,e.status_code=
h.status_code,e.reason_phrase=h.reason_phrase):(e=new q.IncomingRequest(e),e.method=h.method,e.ruri=h.uri);e.data=f;for(c=l+2;;){a:{var l=f,h=c,z=0,B;if(l.substring(h,h+2).match(/(^\r\n)/))l=-2;else{for(;0===z;){B=l.indexOf("\r\n",h);if(-1===B){l=B;break a}!l.substring(B+2,B+4).match(/(^\r\n)/)&&l.charAt(B+2).match(/(^\s+)/)?h=B+2:z=B}l=z}}if(-2===l){E=c+2;break}else if(-1===l){a("parseMessage() | malformed message");return}h=e;z=f;B=l;var F=z.indexOf(":",c),c=z.substring(c,F).trim();B=z.substring(F+
1,B).trim();switch(c.toLowerCase()){case "via":case "v":h.addHeader("via",B);if(1===h.getHeaders("via").length){if(z=h.parseHeader("Via"))h.via=z,h.via_branch=z.branch}else z=0;break;case "from":case "f":h.setHeader("from",B);if(z=h.parseHeader("from"))h.from=z,h.from_tag=z.getParam("tag");break;case "to":case "t":h.setHeader("to",B);if(z=h.parseHeader("to"))h.to=z,h.to_tag=z.getParam("tag");break;case "record-route":z=p.parse(B,"Record_Route");if(-1===z)z=void 0;else{var F=!0,M=!1,y=void 0;try{$jscompjssip.initSymbol();
$jscompjssip.initSymbolIterator();E=z[Symbol.iterator]();for(var L=void 0;!(F=(L=E.next()).done);F=!0){var x=L.value;h.addHeader("record-route",B.substring(x.possition,x.offset));h.headers["Record-Route"][h.getHeaders("record-route").length-1].parsed=x.parsed}}catch(P){M=!0,y=P}finally{try{F||null==E.return||E.return()}finally{if(M)throw y;}}}break;case "call-id":case "i":h.setHeader("call-id",B);if(z=h.parseHeader("call-id"))h.call_id=B;break;case "contact":case "m":z=p.parse(B,"Contact");if(-1===z)z=
void 0;else{F=!0;M=!1;y=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var G=z[Symbol.iterator](),L=void 0;!(F=(L=G.next()).done);F=!0){var r=L.value;h.addHeader("contact",B.substring(r.possition,r.offset));h.headers.Contact[h.getHeaders("contact").length-1].parsed=r.parsed}}catch(P){M=!0,y=P}finally{try{F||null==G.return||G.return()}finally{if(M)throw y;}}}break;case "content-length":case "l":h.setHeader("content-length",B);z=h.parseHeader("content-length");break;case "content-type":case "c":h.setHeader("content-type",
B);z=h.parseHeader("content-type");break;case "cseq":h.setHeader("cseq",B);if(z=h.parseHeader("cseq"))h.cseq=z.value;h instanceof q.IncomingResponse&&(h.method=z.method);break;case "max-forwards":h.setHeader("max-forwards",B);z=h.parseHeader("max-forwards");break;case "www-authenticate":h.setHeader("www-authenticate",B);z=h.parseHeader("www-authenticate");break;case "proxy-authenticate":h.setHeader("proxy-authenticate",B);z=h.parseHeader("proxy-authenticate");break;case "session-expires":case "x":h.setHeader("session-expires",
B);if(z=h.parseHeader("session-expires"))h.session_expires=z.expires,h.session_expires_refresher=z.refresher;break;case "refer-to":case "r":h.setHeader("refer-to",B);if(z=h.parseHeader("refer-to"))h.refer_to=z;break;case "replaces":h.setHeader("replaces",B);if(z=h.parseHeader("replaces"))h.replaces=z;break;case "event":case "o":h.setHeader("event",B);if(z=h.parseHeader("event"))h.event=z;break;default:h.addHeader(c,B),z=0}h=void 0===z?{error:'error parsing header "'.concat(c,'"')}:!0;if(!0!==h){a("parseMessage() |",
h.error);return}c=l+2}e.hasHeader("content-length")?(x=e.getHeader("content-length"),e.body=f.substr(E,x)):e.body=f.substring(E);return e}}}},{"./Grammar":7,"./SIPMessage":19,debug:30}],12:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===
Symbol&&a!==Symbol.prototype?"symbol":typeof a};return p(a)}function q(a){q=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return q(a)}function a(a,c){for(var e=0;e<c.length;e++){var h=c[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function y(c,e,h){e&&a(c.prototype,e);h&&a(c,h);return c}function e(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function");
a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}});c&&E(a,c)}function E(a,c){E=Object.setPrototypeOf||function(a,c){a.__proto__=c;return a};return E(a,c)}x=f("events").EventEmitter;var l=f("sdp-transform"),c=f("./Constants"),h=f("./Exceptions"),z=f("./Transactions"),B=f("./Utils"),F=f("./Timers"),M=f("./SIPMessage"),I=f("./Dialog"),L=f("./RequestSender"),K=f("./RTCSession/DTMF"),G=f("./RTCSession/Info"),r=f("./RTCSession/ReferNotifier"),P=f("./RTCSession/ReferSubscriber"),
D=f("./URI"),t=f("debug")("JsSIP:RTCSession"),O=f("debug")("JsSIP:ERROR:RTCSession");O.log=console.warn.bind(console);var w={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},U=["audio","video"];u.exports=function(a){function f(a){var e;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");t("new");e=q(f).call(this);
if(!e||"object"!==p(e)&&"function"!==typeof e){if(void 0===this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");e=this}e._id=null;e._ua=a;e._status=w.STATUS_NULL;e._dialog=null;e._earlyDialogs={};e._contact=null;e._from_tag=null;e._to_tag=null;e._connection=null;e._connectionPromiseQueue=Promise.resolve();e._request=null;e._is_canceled=!1;e._cancel_reason="";e._is_confirmed=!1;e._late_sdp=!1;e._rtcOfferConstraints=null;e._rtcAnswerConstraints=null;e._localMediaStream=
null;e._localMediaStreamLocallyGenerated=!1;e._rtcReady=!0;e._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null};e._direction=null;e._local_identity=null;e._remote_identity=null;e._start_time=null;e._end_time=null;e._tones=null;e._audioMuted=!1;e._videoMuted=!1;e._localHold=!1;e._remoteHold=!1;e._sessionTimers={enabled:e._ua.configuration.session_timers,refreshMethod:e._ua.configuration.session_timers_refresh_method,defaultExpires:c.SESSION_EXPIRES,currentExpires:null,
running:!1,refresher:!1,timer:null};e._referSubscribers={};e._data={};return e}e(f,a);y(f,null,[{key:"C",get:function(){return w}}]);y(f,[{key:"isInProgress",value:function(){switch(this._status){case w.STATUS_NULL:case w.STATUS_INVITE_SENT:case w.STATUS_1XX_RECEIVED:case w.STATUS_INVITE_RECEIVED:case w.STATUS_WAITING_FOR_ANSWER:return!0;default:return!1}}},{key:"isEstablished",value:function(){switch(this._status){case w.STATUS_ANSWERED:case w.STATUS_WAITING_FOR_ACK:case w.STATUS_CONFIRMED:return!0;
default:return!1}}},{key:"isEnded",value:function(){switch(this._status){case w.STATUS_CANCELED:case w.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(a){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},k=2<arguments.length?arguments[2]:void 0;t("connect()");var f=a,l=e.eventHandlers||
{},r=B.cloneArray(e.extraHeaders),z=e.mediaConstraints||{audio:!0,video:!0},F=e.mediaStream||null,p=e.pcConfig||{iceServers:[]},G=e.rtcConstraints||null,L=e.rtcOfferConstraints||null;this._rtcOfferConstraints=L;this._rtcAnswerConstraints=e.rtcAnswerConstraints||null;this._data=e.data||this._data;if(void 0===a)throw new TypeError("Not enough arguments");if(this._status!==w.STATUS_NULL)throw new h.InvalidStateError(this._status);if(!window.RTCPeerConnection)throw new h.NotSupportedError("WebRTC not supported");
a=this._ua.normalizeTarget(a);if(!a)throw new TypeError("Invalid target: ".concat(f));this._sessionTimers.enabled&&B.isDecimal(e.sessionTimersExpires)&&(this._sessionTimers.defaultExpires=e.sessionTimersExpires>=c.MIN_SESSION_EXPIRES?e.sessionTimersExpires:c.SESSION_EXPIRES);for(var O in l)if(Object.prototype.hasOwnProperty.call(l,O))this.on(O,l[O]);this._from_tag=B.newTag();e=e.anonymous||!1;f={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:e,outbound:!0});e&&(f.from_display_name=
"Anonymous",f.from_uri=new D("sip","anonymous","anonymous.invalid"),r.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),r.push("Privacy: id"));r.push("Contact: ".concat(this._contact));r.push("Content-Type: application/sdp");this._sessionTimers.enabled&&r.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires));this._request=new M.InitialOutgoingInviteRequest(a,this._ua,f,r);this._id=this._request.call_id+this._from_tag;this._createRTCConnection(p,G);this._direction=
"outgoing";this._local_identity=this._request.from;this._remote_identity=this._request.to;k&&k(this);this._newRTCSession("local",this._request);this._sendInitialRequest(z,L,F)}},{key:"init_incoming",value:function(a,e){var h=this;t("init_incoming()");var k,f=a.getHeader("Content-Type");a.body&&"application/sdp"!==f?a.reply(415):(this._status=w.STATUS_INVITE_RECEIVED,this._from_tag=a.from_tag,this._id=a.call_id+this._from_tag,this._request=a,this._contact=this._ua.contact.toString(),a.hasHeader("expires")&&
(k=1E3*a.getHeader("expires")),a.to_tag=B.newTag(),this._createDialog(a,"UAS",!0)?(this._late_sdp=a.body?!1:!0,this._status=w.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){a.reply(408);h._failed("local",null,c.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),k&&(this._timers.expiresTimer=setTimeout(function(){h._status===w.STATUS_WAITING_FOR_ANSWER&&(a.reply(487),h._failed("system",null,c.causes.EXPIRES))},k)),this._direction="incoming",this._local_identity=
a.to,this._remote_identity=a.from,e&&e(this),this._newRTCSession("remote",a),this._status!==w.STATUS_TERMINATED&&(a.reply(180,null,["Contact: ".concat(this._contact)]),this._progress("local",null))):a.reply(500,"Missing Contact header field"))}},{key:"answer",value:function(){var a=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};t("answer()");var f=this._request,l=B.cloneArray(e.extraHeaders),r=e.mediaConstraints||{},z=e.mediaStream||null,F=e.pcConfig||{iceServers:[]},D=e.rtcConstraints||
null,p=e.rtcAnswerConstraints||null,G,L=!1,M=!1,P=!1,y=!1;this._rtcAnswerConstraints=p;this._rtcOfferConstraints=e.rtcOfferConstraints||null;this._data=e.data||this._data;if("incoming"!==this._direction)throw new h.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==w.STATUS_WAITING_FOR_ANSWER)throw new h.InvalidStateError(this._status);this._sessionTimers.enabled&&B.isDecimal(e.sessionTimersExpires)&&(this._sessionTimers.defaultExpires=e.sessionTimersExpires>=c.MIN_SESSION_EXPIRES?
e.sessionTimersExpires:c.SESSION_EXPIRES);this._status=w.STATUS_ANSWERED;if(this._createDialog(f,"UAS")){clearTimeout(this._timers.userNoAnswerTimer);l.unshift("Contact: ".concat(this._contact));e=f.parseSDP();Array.isArray(e.media)||(e.media=[e.media]);var E=!0,q=!1,x=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();G=e.media[Symbol.iterator]();for(var K;!(E=(K=G.next()).done);E=!0){var I=K.value;"audio"===I.type&&(L=!0,I.direction&&"sendrecv"!==I.direction||(P=!0));"video"===I.type&&
(M=!0,I.direction&&"sendrecv"!==I.direction||(y=!0))}}catch(X){q=!0,x=X}finally{try{E||null==G.return||G.return()}finally{if(q)throw x;}}if(z&&!1===r.audio){G=z.getAudioTracks();K=!0;I=!1;e=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var U=G[Symbol.iterator](),R;!(K=(R=U.next()).done);K=!0)z.removeTrack(R.value)}catch(X){I=!0,e=X}finally{try{K||null==U.return||U.return()}finally{if(I)throw e;}}}if(z&&!1===r.video){G=z.getVideoTracks();U=!0;R=!1;K=void 0;try{$jscompjssip.initSymbol();
$jscompjssip.initSymbolIterator();for(var u=G[Symbol.iterator](),V;!(U=(V=u.next()).done);U=!0)z.removeTrack(V.value)}catch(X){R=!0,K=X}finally{try{U||null==u.return||u.return()}finally{if(R)throw K;}}}z||void 0!==r.audio||(r.audio=P);z||void 0!==r.video||(r.video=y);z||L||(r.audio=!1);z||M||(r.video=!1);this._createRTCConnection(F,D);Promise.resolve().then(function(){if(z)return z;if(r.audio||r.video)return a._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(r).catch(function(e){if(a._status===
w.STATUS_TERMINATED)throw Error("terminated");f.reply(480);a._failed("local",null,c.causes.USER_DENIED_MEDIA_ACCESS);O('emit "getusermediafailed" [error:%o]',e);a.emit("getusermediafailed",e);throw Error("getUserMedia() failed");})}).then(function(c){if(a._status===w.STATUS_TERMINATED)throw Error("terminated");(a._localMediaStream=c)&&c.getTracks().forEach(function(e){a._connection.addTrack(e,c)})}).then(function(){if(!a._late_sdp){var e={originator:"remote",type:"offer",sdp:f.body};t('emit "sdp"');
a.emit("sdp",e);var h=new RTCSessionDescription({type:"offer",sdp:e.sdp});a._connectionPromiseQueue=a._connectionPromiseQueue.then(function(){return a._connection.setRemoteDescription(h)}).catch(function(e){f.reply(488);a._failed("system",null,c.causes.WEBRTC_ERROR);O('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e);a.emit("peerconnection:setremotedescriptionfailed",e);throw Error("peerconnection.setRemoteDescription() failed");});return a._connectionPromiseQueue}}).then(function(){if(a._status===
w.STATUS_TERMINATED)throw Error("terminated");a._connecting(f);return a._late_sdp?a._createLocalDescription("offer",a._rtcOfferConstraints).catch(function(){f.reply(500);throw Error("_createLocalDescription() failed");}):a._createLocalDescription("answer",p).catch(function(){f.reply(500);throw Error("_createLocalDescription() failed");})}).then(function(e){if(a._status===w.STATUS_TERMINATED)throw Error("terminated");a._handleSessionTimersInIncomingRequest(f,l);f.reply(200,null,l,e,function(){a._status=
w.STATUS_WAITING_FOR_ACK;a._setInvite2xxTimer(f,e);a._setACKTimer();a._accepted("local")},function(){a._failed("system",null,c.causes.CONNECTION_ERROR)})}).catch(function(c){a._status!==w.STATUS_TERMINATED&&O(c)})}else f.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var a=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};t("terminate()");var f=e.cause||c.causes.BYE,l=B.cloneArray(e.extraHeaders),r=e.body,F,D=e.status_code,p=e.reason_phrase;if(this._status===
w.STATUS_TERMINATED)throw new h.InvalidStateError(this._status);switch(this._status){case w.STATUS_NULL:case w.STATUS_INVITE_SENT:case w.STATUS_1XX_RECEIVED:t("canceling session");if(D&&(200>D||700<=D))throw new TypeError("Invalid status_code: ".concat(D));D&&(p=p||c.REASON_PHRASE[D]||"",F="SIP ;cause=".concat(D,' ;text="').concat(p,'"'));this._status===w.STATUS_NULL||this._status===w.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=F):this._status===w.STATUS_1XX_RECEIVED&&this._request.cancel(F);
this._status=w.STATUS_CANCELED;this._failed("local",null,c.causes.CANCELED);break;case w.STATUS_WAITING_FOR_ANSWER:case w.STATUS_ANSWERED:t("rejecting session");D=D||480;if(300>D||700<=D)throw new TypeError("Invalid status_code: ".concat(D));this._request.reply(D,p,l,r);this._failed("local",null,c.causes.REJECTED);break;case w.STATUS_WAITING_FOR_ACK:case w.STATUS_CONFIRMED:t("terminating session");p=e.reason_phrase||c.REASON_PHRASE[D]||"";if(D&&(200>D||700<=D))throw new TypeError("Invalid status_code: ".concat(D));
D&&l.push("Reason: SIP ;cause=".concat(D,'; text="').concat(p,'"'));if(this._status===w.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==z.C.STATUS_TERMINATED){var G=this._dialog;this.receiveRequest=function(e){e.method===c.ACK&&(a.sendRequest(c.BYE,{extraHeaders:l,body:r}),G.terminate())};this._request.server_transaction.on("stateChanged",function(){a._request.server_transaction.state===z.C.STATUS_TERMINATED&&(a.sendRequest(c.BYE,{extraHeaders:l,body:r}),
G.terminate())});this._ended("local",null,f);this._dialog=G;this._ua.newDialog(G)}else this.sendRequest(c.BYE,{extraHeaders:l,body:r}),this._ended("local",null,f)}}},{key:"sendDTMF",value:function(a){function c(){var a=this,h;if(this._status===w.STATUS_TERMINATED||!this._tones||f>=this._tones.length)this._tones=null;else{h=this._tones[f];f+=1;if(","===h)h=2E3;else{var v=new K(this);e.eventHandlers={onFailed:function(){a._tones=null}};v.send(h,e);h=k+l}setTimeout(c.bind(this),h)}}var e=1<arguments.length&&
void 0!==arguments[1]?arguments[1]:{};t("sendDTMF() | tones: %s",a);var f=0,k=e.duration||null,l=e.interToneGap||null;if(void 0===a)throw new TypeError("Not enough arguments");if(this._status!==w.STATUS_CONFIRMED&&this._status!==w.STATUS_WAITING_FOR_ACK)throw new h.InvalidStateError(this._status);"number"===typeof a&&(a=a.toString());if(!a||"string"!==typeof a||!a.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(a));if(k&&!B.isDecimal(k))throw new TypeError("Invalid tone duration: ".concat(k));
k?k<K.C.MIN_DURATION?(t('"duration" value is lower than the minimum allowed, setting it to '.concat(K.C.MIN_DURATION," milliseconds")),k=K.C.MIN_DURATION):k>K.C.MAX_DURATION?(t('"duration" value is greater than the maximum allowed, setting it to '.concat(K.C.MAX_DURATION," milliseconds")),k=K.C.MAX_DURATION):k=Math.abs(k):k=K.C.DEFAULT_DURATION;e.duration=k;if(l&&!B.isDecimal(l))throw new TypeError("Invalid interToneGap: ".concat(l));l?l<K.C.MIN_INTER_TONE_GAP?(t('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(K.C.MIN_INTER_TONE_GAP,
" milliseconds")),l=K.C.MIN_INTER_TONE_GAP):l=Math.abs(l):l=K.C.DEFAULT_INTER_TONE_GAP;this._tones?this._tones+=a:(this._tones=a,c.call(this))}},{key:"sendInfo",value:function(a,c){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};t("sendInfo()");if(this._status!==w.STATUS_CONFIRMED&&this._status!==w.STATUS_WAITING_FOR_ACK)throw new h.InvalidStateError(this._status);(new G(this)).send(a,c,e)}},{key:"mute",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:
{audio:!0,video:!1};t("mute()");var c=!1,e=!1;!1===this._audioMuted&&a.audio&&(this._audioMuted=c=!0,this._toggleMuteAudio(!0));!1===this._videoMuted&&a.video&&(this._videoMuted=e=!0,this._toggleMuteVideo(!0));!0!==c&&!0!==e||this._onmute({audio:c,video:e})}},{key:"unmute",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0};t("unmute()");var c=!1,e=!1;!0===this._audioMuted&&a.audio&&(c=!0,this._audioMuted=!1,!1===this._localHold&&this._toggleMuteAudio(!1));
!0===this._videoMuted&&a.video&&(e=!0,this._videoMuted=!1,!1===this._localHold&&this._toggleMuteVideo(!1));!0!==c&&!0!==e||this._onunmute({audio:c,video:e})}},{key:"hold",value:function(){var a=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},h=1<arguments.length?arguments[1]:void 0;t("hold()");if(this._status!==w.STATUS_WAITING_FOR_ACK&&this._status!==w.STATUS_CONFIRMED||!0===this._localHold||!this._isReadyToReOffer())return!1;this._localHold=!0;this._onhold("local");var f={succeeded:function(){h&&
h();console.log("reset RTCConnection.");var c=a._localMediaStream,f=a._connection.getTransceivers(),k="inactive",l="inactive",v;for(v in f)f[v].sender&&f[v].sender.track&&("audio"==f[v].sender.track.kind?k=f[v].direction:"video"==f[v].sender.track.kind&&(l=f[v].direction));a._connection.close();delete a._connection;a._createRTCConnection(e.pcConfig||{iceServers:[]},e.rtcConstraints||null);if(c)for(v in c.getAudioTracks().forEach(function(e){a._connection.addTrack(e,c)}),"sendrecv"!=l&&"sendonly"!=
l||c.getVideoTracks().forEach(function(e){a._connection.addTrack(e,c)}),f=a._connection.getTransceivers(),f)f[v].sender&&f[v].sender.track&&("audio"==f[v].sender.track.kind?f[v].direction=k:"video"==f[v].sender.track.kind&&(f[v].direction=l))},failed:function(){a.terminate({cause:c.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};e.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:f,extraHeaders:e.extraHeaders}):this._sendReinvite({eventHandlers:f,extraHeaders:e.extraHeaders});
return!0}},{key:"unhold",value:function(){var a=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},h=1<arguments.length?arguments[1]:void 0;t("unhold()");if(this._status!==w.STATUS_WAITING_FOR_ACK&&this._status!==w.STATUS_CONFIRMED||!1===this._localHold||!this._isReadyToReOffer())return!1;this._localHold=!1;console.log("reset RTCConnection.");var f=a._localMediaStream,l=a._connection.getTransceivers(),r="inactive",z="inactive",B;for(B in l)l[B].sender&&l[B].sender.track&&("audio"==l[B].sender.track.kind?
r=l[B].direction:"video"==l[B].sender.track.kind&&(z=l[B].direction));a._connection.close();delete a._connection;a._createRTCConnection(e.pcConfig||{iceServers:[]},e.rtcConstraints||null);if(f)for(B in f.getAudioTracks().forEach(function(c){a._connection.addTrack(c,f)}),"sendrecv"!=z&&"sendonly"!=z||f.getVideoTracks().forEach(function(c){a._connection.addTrack(c,f)}),l=a._connection.getTransceivers(),l)l[B].sender&&l[B].sender.track&&("audio"==l[B].sender.track.kind?l[B].direction=r:"video"==l[B].sender.track.kind&&
(l[B].direction=z));this._onunhold("local",null);r={succeeded:function(){h&&h()},failed:function(){a.terminate({cause:c.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};e.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:e.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:e.extraHeaders});return!0}},{key:"renegotiate",value:function(){var a=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},h=1<arguments.length?arguments[1]:void 0;
t("renegotiate()");var f=e.rtcOfferConstraints||null;if(this._status!==w.STATUS_WAITING_FOR_ACK&&this._status!==w.STATUS_CONFIRMED||!this._isReadyToReOffer())return!1;var l={succeeded:function(){h&&h()},failed:function(){a.terminate({cause:c.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}};this._setLocalMediaStatus();e.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:l,rtcOfferConstraints:f,extraHeaders:e.extraHeaders}):this._sendReinvite({eventHandlers:l,rtcOfferConstraints:f,
extraHeaders:e.extraHeaders});return!0}},{key:"refer",value:function(a,c){var e=this;t("refer()");var h=a;if(this._status!==w.STATUS_WAITING_FOR_ACK&&this._status!==w.STATUS_CONFIRMED)return!1;a=this._ua.normalizeTarget(a);if(!a)throw new TypeError("Invalid target: ".concat(h));h=new P(this);h.sendRefer(a,c);var f=h.id;this._referSubscribers[f]=h;h.on("requestFailed",function(){delete e._referSubscribers[f]});h.on("accepted",function(){delete e._referSubscribers[f]});h.on("failed",function(){delete e._referSubscribers[f]});
return h}},{key:"sendRequest",value:function(a,c){t("sendRequest()");return this._dialog.sendRequest(a,c)}},{key:"receiveRequest",value:function(a){var e=this;t("receiveRequest()");if(a.method===c.CANCEL){if(this._status===w.STATUS_WAITING_FOR_ANSWER||this._status===w.STATUS_ANSWERED)this._status=w.STATUS_CANCELED,this._request.reply(487),this._failed("remote",a,c.causes.CANCELED)}else switch(a.method){case c.ACK:if(this._status!==w.STATUS_WAITING_FOR_ACK)break;this._status=w.STATUS_CONFIRMED;clearTimeout(this._timers.ackTimer);
clearTimeout(this._timers.invite2xxTimer);if(this._late_sdp)if(a.body){var h={originator:"remote",type:"answer",sdp:a.body};t('emit "sdp"');this.emit("sdp",h);var f=new RTCSessionDescription({type:"answer",sdp:h.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return e._connection.setRemoteDescription(f)}).then(function(){e._is_confirmed||e._confirmed("remote",a)}).catch(function(a){e.terminate({cause:c.causes.BAD_MEDIA_DESCRIPTION,status_code:488});O('emit "peerconnection:setremotedescriptionfailed" [error:%o]',
a);e.emit("peerconnection:setremotedescriptionfailed",a)})}else this.terminate({cause:c.causes.MISSING_SDP,status_code:400});else this._is_confirmed||this._confirmed("remote",a);break;case c.BYE:this._status===w.STATUS_CONFIRMED?(a.reply(200),this._ended("remote",a,c.causes.BYE)):this._status===w.STATUS_INVITE_RECEIVED?(a.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",a,c.causes.BYE)):a.reply(403,"Wrong Status");break;case c.INVITE:this._status===w.STATUS_CONFIRMED?a.hasHeader("replaces")?
this._receiveReplaces(a):this._receiveReinvite(a):a.reply(403,"Wrong Status");break;case c.INFO:this._status===w.STATUS_1XX_RECEIVED||this._status===w.STATUS_WAITING_FOR_ANSWER||this._status===w.STATUS_ANSWERED||this._status===w.STATUS_WAITING_FOR_ACK||this._status===w.STATUS_CONFIRMED?(h=a.getHeader("content-type"))&&h.match(/^application\/dtmf-relay/i)?(new K(this)).init_incoming(a):void 0!==h?(new G(this)).init_incoming(a):a.reply(415):a.reply(403,"Wrong Status");break;case c.UPDATE:this._status===
w.STATUS_CONFIRMED?this._receiveUpdate(a):a.reply(403,"Wrong Status");break;case c.REFER:this._status===w.STATUS_CONFIRMED?this._receiveRefer(a):a.reply(403,"Wrong Status");break;case c.NOTIFY:this._status===w.STATUS_CONFIRMED?this._receiveNotify(a):a.reply(403,"Wrong Status");break;default:a.reply(501)}}},{key:"onTransportError",value:function(){O("onTransportError()");this._status!==w.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:c.causes.CONNECTION_ERROR,cause:c.causes.CONNECTION_ERROR})}},
{key:"onRequestTimeout",value:function(){O("onRequestTimeout()");this._status!==w.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:c.causes.REQUEST_TIMEOUT,cause:c.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){O("onDialogError()");this._status!==w.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:c.causes.DIALOG_ERROR,cause:c.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(a){t("newDTMF()");this.emit("newDTMF",a)}},{key:"newInfo",value:function(a){t("newInfo()");
this.emit("newInfo",a)}},{key:"_isReadyToReOffer",value:function(){return this._rtcReady?this._dialog?!0===this._dialog.uac_pending_reply||!0===this._dialog.uas_pending_reply?(t("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):!0:(t("_isReadyToReOffer() | session not established yet"),!1):(t("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){t("close()");if(this._status!==w.STATUS_TERMINATED){this._status=w.STATUS_TERMINATED;
if(this._connection){try{this._connection.close()}catch(C){O("close() | error closing the RTCPeerConnection: %o",C)}delete this._connection}this._localMediaStream&&this._localMediaStreamLocallyGenerated&&(t("close() | closing local MediaStream"),B.closeMediaStream(this._localMediaStream),delete this._localMediaStream);for(var a in this._timers)Object.prototype.hasOwnProperty.call(this._timers,a)&&clearTimeout(this._timers[a]),delete this._timers[a];clearTimeout(this._sessionTimers.timer);this._dialog&&
(this._dialog.terminate(),delete this._dialog);for(var c in this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,c)&&(this._earlyDialogs[c].terminate(),delete this._earlyDialogs[c]);for(var e in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,e)&&delete this._referSubscribers[e];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(a,c){function e(){this._status===w.STATUS_WAITING_FOR_ACK&&(a.reply(200,null,["Contact: ".concat(this._contact)],
c),h<F.T2&&(h*=2,h>F.T2&&(h=F.T2)),this._timers.invite2xxTimer=setTimeout(e.bind(this),h))}var h=F.T1;this._timers.invite2xxTimer=setTimeout(e.bind(this),h)}},{key:"_setACKTimer",value:function(){var a=this;this._timers.ackTimer=setTimeout(function(){a._status===w.STATUS_WAITING_FOR_ACK&&(t("no ACK received, terminating the session"),clearTimeout(a._timers.invite2xxTimer),a.sendRequest(c.BYE),a._ended("remote",null,c.causes.NO_ACK))},F.TIMER_H)}},{key:"_createRTCConnection",value:function(a,e){var h=
this;this._connection=new RTCPeerConnection(a,e);this._connection.addEventListener("iceconnectionstatechange",function(){void 0!==h._connection&&"failed"===h._connection.iceConnectionState&&h.terminate({cause:c.causes.RTP_TIMEOUT,status_code:408,reason_phrase:c.causes.RTP_TIMEOUT})});t('emit "peerconnection"');this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(a,c){var e=this;t("createLocalDescription()");if("offer"!==a&&"answer"!==a)throw Error('createLocalDescription() | invalid type "'.concat(a,
'"'));var h=this._connection;this._rtcReady=!1;return Promise.resolve().then(function(){return"offer"===a?h.createOffer(c).catch(function(a){O('emit "peerconnection:createofferfailed" [error:%o]',a);e.emit("peerconnection:createofferfailed",a);return Promise.reject(a)}):h.createAnswer(c).catch(function(a){O('emit "peerconnection:createanswerfailed" [error:%o]',a);e.emit("peerconnection:createanswerfailed",a);return Promise.reject(a)})}).then(function(a){return h.setLocalDescription(a).catch(function(a){e._rtcReady=
!0;O('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',a);e.emit("peerconnection:setlocaldescriptionfailed",a);return Promise.reject(a)})}).then(function(){if("complete"===h.iceGatheringState){e._rtcReady=!0;var c={originator:"local",type:a,sdp:h.localDescription.sdp};t('emit "sdp"');e.emit("sdp",c);return Promise.resolve(c.sdp)}return new Promise(function(c){var f=!1,k,l=function(){h.removeEventListener("icecandidate",k);f=!0;e._rtcReady=!0;var l={originator:"local",type:a,sdp:h.localDescription.sdp};
t('emit "sdp"');e.emit("sdp",l);c(l.sdp)};h.addEventListener("icecandidate",k=function(a){(a=a.candidate)?e.emit("icecandidate",{candidate:a,ready:l}):f||l()})})})}},{key:"_createDialog",value:function(a,e,h){var f=a.call_id+("UAS"===e?a.to_tag:a.from_tag)+("UAS"===e?a.from_tag:a.to_tag),k=this._earlyDialogs[f];if(h){if(k)return!0;k=new I(this,a,e,I.C.STATUS_EARLY);if(k.error)return t(k.error),this._failed("remote",a,c.causes.INTERNAL_ERROR),!1;this._earlyDialogs[f]=k;return!0}this._from_tag=a.from_tag;
this._to_tag=a.to_tag;if(k)return k.update(a,e),this._dialog=k,delete this._earlyDialogs[f],!0;e=new I(this,a,e);if(e.error)return t(e.error),this._failed("remote",a,c.causes.INTERNAL_ERROR),!1;this._dialog=e;return!0}},{key:"_receiveReinvite",value:function(a){function c(c){var e=this,h=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(a,h);this._late_sdp&&(c=this._mangleOffer(c));a.reply(200,null,h,c,function(){e._status=w.STATUS_WAITING_FOR_ACK;e._setInvite2xxTimer(a,
c);e._setACKTimer();if(1==e._remoteHold){console.log("reset RTCConnection.");var h=e._localMediaStream,f=e._connection.getTransceivers(),k="inactive",l="inactive",v;for(v in f)f[v].sender&&f[v].sender.track&&("audio"==f[v].sender.track.kind?k=f[v].direction:"video"==f[v].sender.track.kind&&(l=f[v].direction));e._connection.close();delete e._connection;f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};e._createRTCConnection(f.pcConfig||{iceServers:[]},f.rtcConstraints||null);if(h)for(v in h.getAudioTracks().forEach(function(a){e._connection.addTrack(a,
h)}),"sendrecv"!=l&&"sendonly"!=l||h.getVideoTracks().forEach(function(a){e._connection.addTrack(a,h)}),f=e._connection.getTransceivers(),f)f[v].sender&&f[v].sender.track&&("audio"==f[v].sender.track.kind?f[v].direction=k:"video"==f[v].sender.track.kind&&(f[v].direction=l))}});"function"===typeof f.callback&&f.callback()}var e=this;t("receiveReinvite()");var h=a.getHeader("Content-Type"),f={request:a,callback:void 0,reject:function(){var c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};
k=!0;var e=c.status_code||403,h=c.reason_phrase||"",c=B.cloneArray(c.extraHeaders);if(this._status!==w.STATUS_CONFIRMED)return!1;if(300>e||700<=e)throw new TypeError("Invalid status_code: ".concat(e));a.reply(e,h,c)}.bind(this)},k=!1;this.emit("reinvite",f);k||(this._late_sdp=!1,a.body?"application/sdp"!==h?(t("invalid Content-Type"),a.reply(415)):this._processInDialogSdpOffer(a).then(function(a){e._status!==w.STATUS_TERMINATED&&c.call(e,a)}).catch(function(a){O(a)}):(this._late_sdp=!0,this._connectionPromiseQueue=
this._connectionPromiseQueue.then(function(){return e._createLocalDescription("offer",e._rtcOfferConstraints)}).then(function(a){c.call(e,a)}).catch(function(){a.reply(500)})))}},{key:"_receiveUpdate",value:function(a){function c(c){var e=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(a,e);a.reply(200,null,e,c);"function"===typeof f.callback&&f.callback()}var e=this;t("receiveUpdate()");var h=a.getHeader("Content-Type"),f={request:a,callback:void 0,reject:function(){var c=
0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};k=!0;var e=c.status_code||403,h=c.reason_phrase||"",c=B.cloneArray(c.extraHeaders);if(this._status!==w.STATUS_CONFIRMED)return!1;if(300>e||700<=e)throw new TypeError("Invalid status_code: ".concat(e));a.reply(e,h,c)}.bind(this)},k=!1;this.emit("update",f);k||(a.body?"application/sdp"!==h?(t("invalid Content-Type"),a.reply(415)):this._processInDialogSdpOffer(a).then(function(a){e._status!==w.STATUS_TERMINATED&&c.call(e,a)}).catch(function(a){O(a)}):
c.call(this,null))}},{key:"_processInDialogSdpOffer",value:function(a){var c=this;t("_processInDialogSdpOffer()");var e=a.parseSDP(),h=!1,f=!0,k=!1,l=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var r=e.media[Symbol.iterator](),z;!(f=(z=r.next()).done);f=!0){var B=z.value;if(-1!==U.indexOf(B.type)){var F=B.direction||e.direction||"sendrecv";if("sendonly"===F||"inactive"===F)h=!0;else{h=!1;break}}}}catch(ha){k=!0,l=ha}finally{try{f||null==r.return||r.return()}finally{if(k)throw l;
}}1==c._localHold&&(h=!1);if(0==h&&(null==c.connection.remoteDescription||-1==c.connection.remoteDescription.sdp.indexOf(e.connection.ip)||-1==c.connection.remoteDescription.sdp.indexOf(e.media[0].iceUfrag))){console.log("reset RTCConnection.");var D=c._localMediaStream,k=c._connection.getTransceivers(),f=e="inactive",p;for(p in k)k[p].sender&&k[p].sender.track&&("audio"==k[p].sender.track.kind?e=k[p].currentDirection?k[p].currentDirection:k[p].direction:"video"==k[p].sender.track.kind&&(f=k[p].currentDirection?
k[p].currentDirection:k[p].direction));c.connection.close();delete c.connection;l=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};k=l.pcConfig||{iceServers:[]};r=l.rtcConstraints||null;l=-1!=a.body.indexOf("m=video")&&-1==a.body.indexOf("m=video 0");c._createRTCConnection(k,r);if(D)for(p in D.getAudioTracks().forEach(function(a){c._connection.addTrack(a,D)}),l&&D.getVideoTracks().forEach(function(a){c._connection.addTrack(a,D)}),k=c._connection.getTransceivers(),k)k[p].sender&&k[p].sender.track&&
("audio"==k[p].sender.track.kind?k[p].direction=!0===c._remoteHold?"sendrecv":e:"video"==k[p].sender.track.kind&&(k[p].direction=!0===c._remoteHold&&l?"inactive"==f?"recvonly":"sendrecv":f))}p={originator:"remote",type:"offer",sdp:a.body};t('emit "sdp"');this.emit("sdp",p);var G=new RTCSessionDescription({type:"offer",sdp:p.sdp});return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(c._status===w.STATUS_TERMINATED)throw Error("terminated");return c._connection.setRemoteDescription(G).catch(function(e){a.reply(488);
O('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e);c.emit("peerconnection:setremotedescriptionfailed",e);throw Error("peerconnection.setRemoteDescription() failed");})}).then(function(){if(c._status===w.STATUS_TERMINATED)throw Error("terminated");!0===c._remoteHold&&!1===h?(c._remoteHold=!1,c._onunhold("remote",a)):!1===c._remoteHold&&!0===h&&(c._remoteHold=!0,c._onhold("remote"))}).then(function(){if(c._status===w.STATUS_TERMINATED)throw Error("terminated");return c._createLocalDescription("answer",
c._rtcAnswerConstraints).catch(function(){a.reply(500);throw Error("_createLocalDescription() failed");})})}},{key:"_receiveRefer",value:function(a){function e(c){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};c="function"===typeof c?c:null;if(this._status!==w.STATUS_WAITING_FOR_ACK&&this._status!==w.STATUS_CONFIRMED)return!1;var h=new f(this._ua);h.on("progress",function(a){a=a.response;l.notify(a.status_code,a.reason_phrase)});h.on("accepted",function(a){a=a.response;l.notify(a.status_code,
a.reason_phrase)});h.on("_failed",function(a){var c=a.message;a=a.cause;c?l.notify(c.status_code,c.reason_phrase):l.notify(487,a)});if(a.refer_to.uri.hasHeader("replaces")){var k=decodeURIComponent(a.refer_to.uri.getHeader("replaces"));e.extraHeaders=B.cloneArray(e.extraHeaders);e.extraHeaders.push("Replaces: ".concat(k))}h.connect(a.refer_to.uri.toAor(),e,c)}function h(){l.notify(603)}var k=this;t("receiveRefer()");if(a.refer_to)if(a.refer_to.uri.scheme!==c.SIP)t("Refer-To header field points to a non-SIP URI scheme"),
a.reply(416);else{a.reply(202);var l=new r(this,a.cseq);t('emit "refer"');this.emit("refer",{request:a,accept:function(a,c){e.call(k,a,c)},reject:function(){h.call(k)}})}else t("no Refer-To header field present in REFER"),a.reply(400)}},{key:"_receiveNotify",value:function(a){t("receiveNotify()");a.event||a.reply(400);switch(a.event.event){case "refer":var c;if(a.event.params&&a.event.params.id)c=a.event.params.id,c=this._referSubscribers[c];else if(1===Object.keys(this._referSubscribers).length)c=
this._referSubscribers[Object.keys(this._referSubscribers)[0]];else{a.reply(400,"Missing event id parameter");break}if(!c){a.reply(481,"Subscription does not exist");break}c.receiveNotify(a);a.reply(200);break;default:a.reply(489)}}},{key:"_receiveReplaces",value:function(a){function c(c){var e=this;if(this._status!==w.STATUS_WAITING_FOR_ACK&&this._status!==w.STATUS_CONFIRMED)return!1;var h=new f(this._ua);h.on("confirmed",function(){e.terminate()});h.init_incoming(a,c)}function e(){t("Replaced INVITE rejected by the user");
a.reply(486)}var h=this;t("receiveReplaces()");this.emit("replaces",{request:a,accept:function(a){c.call(h,a)},reject:function(){e.call(h)}})}},{key:"_sendInitialRequest",value:function(a,e,h){var f=this,k=new L(this._ua,this._request,{onRequestTimeout:function(){f.onRequestTimeout()},onTransportError:function(){f.onTransportError()},onAuthenticated:function(a){f._request=a},onReceiveResponse:function(a){f._receiveInviteResponse(a)}});Promise.resolve().then(function(){if(h)return h;if(a.audio||a.video)return f._localMediaStreamLocallyGenerated=
!0,navigator.mediaDevices.getUserMedia(a).catch(function(a){if(f._status===w.STATUS_TERMINATED)throw Error("terminated");f._failed("local",null,c.causes.USER_DENIED_MEDIA_ACCESS);O('emit "getusermediafailed" [error:%o]',a);f.emit("getusermediafailed",a);throw a;})}).then(function(a){if(f._status===w.STATUS_TERMINATED)throw Error("terminated");(f._localMediaStream=a)&&a.getTracks().forEach(function(c){f._connection.addTrack(c,a)});f._connecting(f._request);return f._createLocalDescription("offer",
e).catch(function(a){f._failed("local",null,c.causes.WEBRTC_ERROR);throw a;})}).then(function(a){if(f._is_canceled||f._status===w.STATUS_TERMINATED)throw Error("terminated");f._request.body=a;f._status=w.STATUS_INVITE_SENT;t('emit "sending" [request:%o]',f._request);f.emit("sending",{request:f._request});k.send()}).catch(function(a){f._status!==w.STATUS_TERMINATED&&O(a)})}},{key:"_receiveInviteResponse",value:function(a){var e=this;t("receiveInviteResponse()");if(this._dialog&&200<=a.status_code&&
299>=a.status_code)if(this._dialog.id.call_id===a.call_id&&this._dialog.id.local_tag===a.from_tag&&this._dialog.id.remote_tag===a.to_tag)this.sendRequest(c.ACK);else{var h=new I(this,a,"UAC");void 0!==h.error?t(h.error):(this.sendRequest(c.ACK),this.sendRequest(c.BYE))}else if(this._is_canceled)100<=a.status_code&&200>a.status_code?this._request.cancel(this._cancel_reason):200<=a.status_code&&299>a.status_code&&this._acceptAndTerminate(a);else if(this._status===w.STATUS_INVITE_SENT||this._status===
w.STATUS_1XX_RECEIVED)switch(!0){case /^100$/.test(a.status_code):this._status=w.STATUS_1XX_RECEIVED;break;case /^1[0-9]{2}$/.test(a.status_code):if(!a.to_tag){t("1xx response received without to tag");break}if(a.hasHeader("contact")&&!this._createDialog(a,"UAC",!0))break;this._status=w.STATUS_1XX_RECEIVED;this._progress("remote",a);if(!a.body)break;h={originator:"remote",type:"answer",sdp:a.body};t('emit "sdp"');this.emit("sdp",h);var f=new RTCSessionDescription({type:"answer",sdp:h.sdp});this._connectionPromiseQueue=
this._connectionPromiseQueue.then(function(){return e._connection.setRemoteDescription(f)}).catch(function(a){O('emit "peerconnection:setremotedescriptionfailed" [error:%o]',a);e.emit("peerconnection:setremotedescriptionfailed",a)});break;case /^2[0-9]{2}$/.test(a.status_code):this._status=w.STATUS_CONFIRMED;if(!a.body){this._acceptAndTerminate(a,400,c.causes.MISSING_SDP);this._failed("remote",a,c.causes.BAD_MEDIA_DESCRIPTION);break}if(!this._createDialog(a,"UAC"))break;h={originator:"remote",type:"answer",
sdp:a.body};t('emit "sdp"');this.emit("sdp",h);var k=new RTCSessionDescription({type:"answer",sdp:h.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if("stable"===e._connection.signalingState)return e._connection.createOffer(e._rtcOfferConstraints).then(function(a){return e._connection.setLocalDescription(a)}).catch(function(h){e._acceptAndTerminate(a,500,h.toString());e._failed("local",a,c.causes.WEBRTC_ERROR)})}).then(function(){e._connection.setRemoteDescription(k).then(function(){e._handleSessionTimersInIncomingResponse(a);
e._accepted("remote",a);e.sendRequest(c.ACK);e._confirmed("local",null)}).catch(function(h){e._acceptAndTerminate(a,488,"Not Acceptable Here");e._failed("remote",a,c.causes.BAD_MEDIA_DESCRIPTION);O('emit "peerconnection:setremotedescriptionfailed" [error:%o]',h);e.emit("peerconnection:setremotedescriptionfailed",h)})});break;default:h=B.sipErrorCause(a.status_code),this._failed("remote",a,h)}}},{key:"_sendReinvite",value:function(){function a(a){var h=this;if(this._status!==w.STATUS_TERMINATED&&(this.sendRequest(c.ACK),
!F))if(this._handleSessionTimersInIncomingResponse(a),a.body)if("application/sdp"!==a.getHeader("Content-Type"))e.call(this);else{var f={originator:"remote",type:"answer",sdp:a.body};t('emit "sdp"');this.emit("sdp",f);var k=new RTCSessionDescription({type:"answer",sdp:f.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return h._connection.setRemoteDescription(k)}).then(function(){r.succeeded&&r.succeeded(a)}).catch(function(a){e.call(h);O('emit "peerconnection:setremotedescriptionfailed" [error:%o]',
a);h.emit("peerconnection:setremotedescriptionfailed",a)})}else e.call(this)}function e(a){r.failed&&r.failed(a)}var h=this,f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};t("sendReinvite()");var l=B.cloneArray(f.extraHeaders),r=f.eventHandlers||{},z=f.rtcOfferConstraints||this._rtcOfferConstraints||null,F=!1;l.push("Contact: ".concat(this._contact));l.push("Content-Type: application/sdp");this._sessionTimers.running&&l.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,
";refresher=").concat(this._sessionTimers.refresher?"uac":"uas"));this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return h._createLocalDescription("offer",z)}).then(function(f){f=h._mangleOffer(f);var k={originator:"local",type:"offer",sdp:f};t('emit "sdp"');h.emit("sdp",k);h.sendRequest(c.INVITE,{extraHeaders:l,body:f,eventHandlers:{onSuccessResponse:function(c){a.call(h,c);F=!0},onErrorResponse:function(a){e.call(h,a)},onTransportError:function(){h.onTransportError()},
onRequestTimeout:function(){h.onRequestTimeout()},onDialogError:function(){h.onDialogError()}}})}).catch(function(){e()})}},{key:"_sendUpdate",value:function(){function a(a){var c=this;if(this._status!==w.STATUS_TERMINATED&&!D)if(this._handleSessionTimersInIncomingResponse(a),F)if(a.body)if("application/sdp"!==a.getHeader("Content-Type"))e.call(this);else{var h={originator:"remote",type:"answer",sdp:a.body};t('emit "sdp"');this.emit("sdp",h);var f=new RTCSessionDescription({type:"answer",sdp:h.sdp});
this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return c._connection.setRemoteDescription(f)}).then(function(){r.succeeded&&r.succeeded(a)}).catch(function(a){e.call(c);O('emit "peerconnection:setremotedescriptionfailed" [error:%o]',a);c.emit("peerconnection:setremotedescriptionfailed",a)})}else e.call(this);else r.succeeded&&r.succeeded(a)}function e(a){r.failed&&r.failed(a)}var h=this,f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};t("sendUpdate()");var l=B.cloneArray(f.extraHeaders),
r=f.eventHandlers||{},z=f.rtcOfferConstraints||this._rtcOfferConstraints||null,F=f.sdpOffer||!1,D=!1;l.push("Contact: ".concat(this._contact));this._sessionTimers.running&&l.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas"));F?(l.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return h._createLocalDescription("offer",z)}).then(function(f){f=h._mangleOffer(f);
var k={originator:"local",type:"offer",sdp:f};t('emit "sdp"');h.emit("sdp",k);h.sendRequest(c.UPDATE,{extraHeaders:l,body:f,eventHandlers:{onSuccessResponse:function(c){a.call(h,c);D=!0},onErrorResponse:function(a){e.call(h,a)},onTransportError:function(){h.onTransportError()},onRequestTimeout:function(){h.onRequestTimeout()},onDialogError:function(){h.onDialogError()}}})}).catch(function(){e.call(h)})):this.sendRequest(c.UPDATE,{extraHeaders:l,eventHandlers:{onSuccessResponse:function(c){a.call(h,
c)},onErrorResponse:function(a){e.call(h,a)},onTransportError:function(){h.onTransportError()},onRequestTimeout:function(){h.onRequestTimeout()},onDialogError:function(){h.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(a,e,h){t("acceptAndTerminate()");var f=[];e&&(h=h||c.REASON_PHRASE[e]||"",f.push("Reason: SIP ;cause=".concat(e,'; text="').concat(h,'"')));if(this._dialog||this._createDialog(a,"UAC"))this.sendRequest(c.ACK),this.sendRequest(c.BYE,{extraHeaders:f});this._status=w.STATUS_TERMINATED}},
{key:"_mangleOffer",value:function(a){if(!this._localHold&&!this._remoteHold)return a;a=l.parse(a);if(this._localHold&&!this._remoteHold){t("mangleOffer() | me on hold, mangling offer");var c=!0,e=!1,h=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var f=a.media[Symbol.iterator](),k;!(c=(k=f.next()).done);c=!0){var r=k.value;-1!==U.indexOf(r.type)&&(r.direction?"sendrecv"===r.direction?r.direction="sendonly":"recvonly"===r.direction&&(r.direction="inactive"):r.direction="sendonly")}}catch(N){e=
!0,h=N}finally{try{c||null==f.return||f.return()}finally{if(e)throw h;}}}else if(this._localHold&&this._remoteHold){t("mangleOffer() | both on hold, mangling offer");f=!0;k=!1;r=void 0;try{for($jscompjssip.initSymbol(),$jscompjssip.initSymbolIterator(),c=a.media[Symbol.iterator]();!(f=(e=c.next()).done);f=!0)h=e.value,-1!==U.indexOf(h.type)&&(h.direction="inactive")}catch(N){k=!0,r=N}finally{try{f||null==c.return||c.return()}finally{if(k)throw r;}}}else if(this._remoteHold){t("mangleOffer() | remote on hold, mangling offer");
f=!0;k=!1;r=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var z=a.media[Symbol.iterator](),B;!(f=(B=z.next()).done);f=!0){var F=B.value;-1!==U.indexOf(F.type)&&(F.direction?"sendrecv"===F.direction?F.direction="recvonly":"recvonly"===F.direction&&(F.direction="inactive"):F.direction="recvonly")}}catch(N){k=!0,r=N}finally{try{f||null==z.return||z.return()}finally{if(k)throw r;}}}return l.write(a)}},{key:"_setLocalMediaStatus",value:function(){var a=!0,c=!0;if(this._localHold||this._remoteHold)c=
a=!1;this._audioMuted&&(a=!1);this._videoMuted&&(c=!1);this._toggleMuteAudio(!a);this._toggleMuteVideo(!c)}},{key:"_handleSessionTimersInIncomingRequest",value:function(a,e){this._sessionTimers.enabled&&(a.session_expires&&a.session_expires>=c.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=a.session_expires,a=a.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,a="uas"),e.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,
";refresher=").concat(a)),this._sessionTimers.refresher="uas"===a,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(a){this._sessionTimers.enabled&&(a.session_expires&&a.session_expires>=c.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=a.session_expires,a=a.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,a="uac"),this._sessionTimers.refresher="uac"===a,this._runSessionTimer())}},{key:"_runSessionTimer",
value:function(){var a=this,e=this._sessionTimers.currentExpires;this._sessionTimers.running=!0;clearTimeout(this._sessionTimers.timer);this._sessionTimers.timer=this._sessionTimers.refresher?setTimeout(function(){a._status!==w.STATUS_TERMINATED&&(t("runSessionTimer() | sending session refresh request"),a._sessionTimers.refreshMethod===c.UPDATE?a._sendUpdate():a._sendReinvite())},500*e):setTimeout(function(){a._status!==w.STATUS_TERMINATED&&(O("runSessionTimer() | timer expired, terminating the session"),
a.terminate({cause:c.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*e)}},{key:"_toggleMuteAudio",value:function(a){var c=this._connection.getSenders().filter(function(a){return a.track&&"audio"===a.track.kind}),e=!0,h=!1,f=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var k=c[Symbol.iterator](),l;!(e=(l=k.next()).done);e=!0)l.value.track.enabled=!a}catch(ga){h=!0,f=ga}finally{try{e||null==k.return||k.return()}finally{if(h)throw f;}}}},{key:"_toggleMuteVideo",
value:function(a){var c=this._connection.getSenders().filter(function(a){return a.track&&"video"===a.track.kind}),e=!0,h=!1,f=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var k=c[Symbol.iterator](),l;!(e=(l=k.next()).done);e=!0)l.value.track.enabled=!a}catch(ga){h=!0,f=ga}finally{try{e||null==k.return||k.return()}finally{if(h)throw f;}}}},{key:"_newRTCSession",value:function(a,c){t("newRTCSession()");this._ua.newRTCSession(this,{originator:a,session:this,request:c})}},{key:"_connecting",
value:function(a){t("session connecting");t('emit "connecting"');this.emit("connecting",{request:a})}},{key:"_progress",value:function(a,c){t("session progress");t('emit "progress"');this.emit("progress",{originator:a,response:c||null})}},{key:"_accepted",value:function(a,c){t("session accepted");this._start_time=new Date;t('emit "accepted"');this.emit("accepted",{originator:a,response:c||null})}},{key:"_confirmed",value:function(a,c){t("session confirmed");this._is_confirmed=!0;t('emit "confirmed"');
this.emit("confirmed",{originator:a,ack:c||null})}},{key:"_ended",value:function(a,c,e){t("session ended");this._end_time=new Date;this._close();t('emit "ended"');this.emit("ended",{originator:a,message:c||null,cause:e})}},{key:"_failed",value:function(a,c,e){t("session failed");t('emit "_failed"');this.emit("_failed",{originator:a,message:c||null,cause:e});this._close();t('emit "failed"');this.emit("failed",{originator:a,message:c||null,cause:e})}},{key:"_onhold",value:function(a){t("session onhold");
this._setLocalMediaStatus();t('emit "hold"');this.emit("hold",{originator:a})}},{key:"_onunhold",value:function(a,c){t("session onunhold");this._setLocalMediaStatus();t('emit "unhold"');this.emit("unhold",{originator:a,request:c})}},{key:"_onmute",value:function(a){var c=a.audio;a=a.video;t("session onmute");this._setLocalMediaStatus();t('emit "muted"');this.emit("muted",{audio:c,video:a})}},{key:"_onunmute",value:function(a){var c=a.audio;a=a.video;t("session onunmute");this._setLocalMediaStatus();
t('emit "unmuted"');this.emit("unmuted",{audio:c,video:a})}},{key:"C",get:function(){return w}},{key:"causes",get:function(){return c.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(a){this._data=a}},{key:"status",get:function(){return this._status}}]);return f}(x)},{"./Constants":2,"./Dialog":3,"./Exceptions":6,"./RTCSession/DTMF":13,"./RTCSession/Info":14,"./RTCSession/ReferNotifier":15,"./RTCSession/ReferSubscriber":16,"./RequestSender":18,"./SIPMessage":19,"./Timers":21,"./Transactions":22,"./URI":25,"./Utils":26,debug:30,
events:29,"sdp-transform":35}],13:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};return p(a)}function q(a,c){for(var e=0;e<c.length;e++){var h=c[e];h.enumerable=h.enumerable||!1;
h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function a(a,c,e){c&&q(a.prototype,c);e&&q(a,e);return a}function y(a){y=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return y(a)}function e(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}});c&&E(a,c)}function E(a,
c){E=Object.setPrototypeOf||function(a,c){a.__proto__=c;return a};return E(a,c)}x=f("events").EventEmitter;var l=f("../Constants"),c=f("../Exceptions"),h=f("../Utils"),z=f("debug")("JsSIP:RTCSession:DTMF");f("debug")("JsSIP:ERROR:RTCSession:DTMF").log=console.warn.bind(console);var B={MIN_DURATION:70,MAX_DURATION:6E3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500};u.exports=function(f){function F(a){var c;if(!(this instanceof F))throw new TypeError("Cannot call a class as a function");
c=y(F).call(this);if(!c||"object"!==p(c)&&"function"!==typeof c){if(void 0===this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=this}c._session=a;c._direction=null;c._tone=null;c._duration=null;c._request=null;return c}e(F,f);a(F,[{key:"send",value:function(a){var e=this,f=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===a)throw new TypeError("Not enough arguments");this._direction="outgoing";if(this._session.status!==this._session.C.STATUS_CONFIRMED&&
this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new c.InvalidStateError(this._session.status);var z=h.cloneArray(f.extraHeaders);this.eventHandlers=f.eventHandlers||{};if("string"===typeof a)a=a.toUpperCase();else if("number"===typeof a)a=a.toString();else throw new TypeError("Invalid tone: ".concat(a));if(a.match(/^[0-9A-DR#*]$/))this._tone=a;else throw new TypeError("Invalid tone: ".concat(a));this._duration=f.duration;z.push("Content-Type: application/dtmf-relay");f="Signal=".concat(this._tone,
"\r\n");f+="Duration=".concat(this._duration);this._session.newDTMF({originator:"local",dtmf:this,request:this._request});this._session.sendRequest(l.INFO,{extraHeaders:z,eventHandlers:{onSuccessResponse:function(a){e.emit("succeeded",{originator:"remote",response:a})},onErrorResponse:function(a){if(e.eventHandlers.onFailed)e.eventHandlers.onFailed();e.emit("failed",{originator:"remote",response:a})},onRequestTimeout:function(){e._session.onRequestTimeout()},onTransportError:function(){e._session.onTransportError()},
onDialogError:function(){e._session.onDialogError()}},body:f})}},{key:"init_incoming",value:function(a){var c=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,e=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;this._direction="incoming";this._request=a;a.reply(200);if(a.body){var h=a.body.split("\n");1<=h.length&&c.test(h[0])&&(this._tone=h[0].replace(c,"$2"));2<=h.length&&e.test(h[1])&&(this._duration=parseInt(h[1].replace(e,"$2"),10))}this._duration||(this._duration=B.DEFAULT_DURATION);this._tone?this._session.newDTMF({originator:"remote",
dtmf:this,request:a}):z("invalid INFO DTMF received, discarded")}},{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}}]);return F}(x);u.exports.C=B},{"../Constants":2,"../Exceptions":6,"../Utils":26,debug:30,events:29}],14:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();
$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};return p(a)}function q(a,c){for(var e=0;e<c.length;e++){var h=c[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function a(a,c,e){c&&q(a.prototype,c);e&&q(a,e);return a}function y(a){y=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return y(a)}
function e(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}});c&&E(a,c)}function E(a,c){E=Object.setPrototypeOf||function(a,c){a.__proto__=c;return a};return E(a,c)}x=f("events").EventEmitter;f("debug")("JsSIP:ERROR:RTCSession:Info").log=console.warn.bind(console);var l=f("../Constants"),c=f("../Exceptions"),h=f("../Utils");u.exports=function(f){function z(a){var c;
if(!(this instanceof z))throw new TypeError("Cannot call a class as a function");c=y(z).call(this);if(!c||"object"!==p(c)&&"function"!==typeof c){if(void 0===this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=this}c._session=a;c._direction=null;c._contentType=null;c._body=null;return c}e(z,f);a(z,[{key:"send",value:function(a,e){var f=this,z=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};this._direction="outgoing";if(void 0===a)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 c.InvalidStateError(this._session.status);this._contentType=a;this._body=e;z=h.cloneArray(z.extraHeaders);z.push("Content-Type: ".concat(a));this._session.newInfo({originator:"local",info:this,request:this.request});this._session.sendRequest(l.INFO,{extraHeaders:z,eventHandlers:{onSuccessResponse:function(a){f.emit("succeeded",{originator:"remote",response:a})},onErrorResponse:function(a){f.emit("failed",
{originator:"remote",response:a})},onTransportError:function(){f._session.onTransportError()},onRequestTimeout:function(){f._session.onRequestTimeout()},onDialogError:function(){f._session.onDialogError()}},body:e})}},{key:"init_incoming",value:function(a){this._direction="incoming";this.request=a;a.reply(200);this._contentType=a.getHeader("content-type");this._body=a.body;this._session.newInfo({originator:"remote",info:this,request:a})}},{key:"contentType",get:function(){return this._contentType}},
{key:"body",get:function(){return this._body}}]);return z}(x)},{"../Constants":2,"../Exceptions":6,"../Utils":26,debug:30,events:29}],15:[function(f,u,x){function p(a,f){for(var e=0;e<f.length;e++){var c=f[e];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}function q(a,f,l){f&&p(a.prototype,f);l&&p(a,l);return a}var a=f("../Constants"),y=f("debug")("JsSIP:RTCSession:ReferNotifier");u.exports=function(){function e(a,f,c){if(!(this instanceof
e))throw new TypeError("Cannot call a class as a function");this._session=a;this._id=f;this._expires=c||300;this._active=!0;this.notify(100)}q(e,[{key:"notify",value:function(e,f){y("notify()");if(!1!==this._active){f=f||a.REASON_PHRASE[e]||"";var c;c=200<=e?"terminated;reason=noresource":"active;expires=".concat(this._expires);this._session.sendRequest(a.NOTIFY,{extraHeaders:["Event: ".concat("refer",";id=").concat(this._id),"Subscription-State: ".concat(c),"Content-Type: ".concat("message/sipfrag;version=2.0")],
body:"SIP/2.0 ".concat(e," ").concat(f),eventHandlers:{onErrorResponse:function(){this._active=!1}}})}}}]);return e}()},{"../Constants":2,debug:30}],16:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?
"symbol":typeof a};return p(a)}function q(a,c){for(var e=0;e<c.length;e++){var h=c[e];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function a(a,c,e){c&&q(a.prototype,c);e&&q(a,e);return a}function y(a){y=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return y(a)}function e(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function");
a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}});c&&E(a,c)}function E(a,c){E=Object.setPrototypeOf||function(a,c){a.__proto__=c;return a};return E(a,c)}x=f("events").EventEmitter;var l=f("../Constants"),c=f("../Grammar"),h=f("../Utils"),z=f("debug")("JsSIP:RTCSession:ReferSubscriber");u.exports=function(f){function B(a){var c;if(!(this instanceof B))throw new TypeError("Cannot call a class as a function");c=y(B).call(this);if(!c||"object"!==p(c)&&"function"!==
typeof c){if(void 0===this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=this}c._id=null;c._session=a;return c}e(B,f);a(B,[{key:"sendRefer",value:function(a){var c=this,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};z("sendRefer()");var f=h.cloneArray(e.extraHeaders),B=e.eventHandlers||{},r;for(r in B)if(Object.prototype.hasOwnProperty.call(B,r))this.on(r,B[r]);B=null;e.replaces&&(B=e.replaces._request.call_id,B+=";to-tag=".concat(e.replaces._to_tag),
B+=";from-tag=".concat(e.replaces._from_tag),B=encodeURIComponent(B));e="Refer-To: <".concat(a).concat(B?"?Replaces=".concat(B):"",">");f.push(e);e="Referred-By: <".concat(this._session._ua._configuration.uri._scheme,":").concat(this._session._ua._configuration.uri._user,"@").concat(this._session._ua._configuration.uri._host,">");f.push(e);f.push("Contact: ".concat(this._session.contact));this._id=this._session.sendRequest(l.REFER,{extraHeaders:f,eventHandlers:{onSuccessResponse:function(a){c._requestSucceeded(a)},
onErrorResponse:function(a){c._requestFailed(a,l.causes.REJECTED)},onTransportError:function(){c._requestFailed(null,l.causes.CONNECTION_ERROR)},onRequestTimeout:function(){c._requestFailed(null,l.causes.REQUEST_TIMEOUT)},onDialogError:function(){c._requestFailed(null,l.causes.DIALOG_ERROR)}}}).cseq}},{key:"receiveNotify",value:function(a){z("receiveNotify()");if(a.body){var e=c.parse(a.body.trim(),"Status_Line");if(-1===e)z('receiveNotify() | error parsing NOTIFY body: "'.concat(a.body,'"'));else switch(!0){case /^100$/.test(e.status_code):this.emit("trying",
{request:a,status_line:e});break;case /^1[0-9]{2}$/.test(e.status_code):this.emit("progress",{request:a,status_line:e});break;case /^2[0-9]{2}$/.test(e.status_code):this.emit("accepted",{request:a,status_line:e});break;default:this.emit("failed",{request:a,status_line:e})}}}},{key:"_requestSucceeded",value:function(a){z("REFER succeeded");z('emit "requestSucceeded"');this.emit("requestSucceeded",{response:a})}},{key:"_requestFailed",value:function(a,c){z("REFER failed");z('emit "requestFailed"');
this.emit("requestFailed",{response:a||null,cause:c})}},{key:"id",get:function(){return this._id}}]);return B}(x)},{"../Constants":2,"../Grammar":7,"../Utils":26,debug:30,events:29}],17:[function(f,u,x){function p(a,e){for(var c=0;c<e.length;c++){var h=e[c];h.enumerable=h.enumerable||!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function q(a,e,f){e&&p(a.prototype,e);f&&p(a,f);return a}var a=f("./Utils"),y=f("./Constants"),e=f("./SIPMessage"),E=f("./RequestSender"),
l=f("debug")("JsSIP:Registrator");u.exports=function(){function c(e,f){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this._ua=e;this._transport=f;this._registrar=e.configuration.registrar_server;this._expires=e.configuration.register_expires;this._call_id=a.createRandomToken(22);this._cseq=0;this._to_uri=e.configuration.uri;this._registrationTimer=null;this._registered=this._registering=!1;this._contact=this._ua.contact.toString();this._contact+=";+sip.ice";this._extraHeaders=
[];this._extraContactParams="";this._contact+=";reg-id=".concat(1);this._contact+=';+sip.instance="<urn:uuid:'.concat(this._ua.configuration.instance_id,'>"')}q(c,[{key:"setExtraHeaders",value:function(a){Array.isArray(a)||(a=[]);this._extraHeaders=a.slice()}},{key:"setExtraContactParams",value:function(a){a instanceof Object||(a={});this._extraContactParams="";for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var e=a[c];this._extraContactParams+=";".concat(c);e&&(this._extraContactParams+=
"=".concat(e))}}},{key:"register",value:function(){var c=this;if(this._registering)l("Register request in progress...");else{var f=this._extraHeaders.slice();f.push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams));f.push("Expires: ".concat(this._expires));f=new e.OutgoingRequest(y.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},f);f=new E(this._ua,f,{onRequestTimeout:function(){c._registrationFailure(null,
y.causes.REQUEST_TIMEOUT)},onTransportError:function(){c._registrationFailure(null,y.causes.CONNECTION_ERROR)},onAuthenticated:function(){c._cseq+=1},onReceiveResponse:function(e){if(e.cseq===c._cseq)switch(null!==c._registrationTimer&&(clearTimeout(c._registrationTimer),c._registrationTimer=null),!0){case /^1[0-9]{2}$/.test(e.status_code):break;case /^2[0-9]{2}$/.test(e.status_code):c._registering=!1;if(!e.hasHeader("Contact")){l("no Contact header in response to REGISTER, response ignored");break}var h=
e.headers.Contact.reduce(function(a,c){return a.concat(c.parsed)},[]).find(function(a){return a.uri.user===c._ua.contact.uri.user});if(!h){l("no Contact header pointing to us, response ignored");break}var f=h.getParam("expires");!f&&e.hasHeader("expires")&&(f=e.getHeader("expires"));f||(f=c._expires);f=Number(f);10>f&&(f=10);c._registrationTimer=setTimeout(function(){c._registrationTimer=null;0===c._ua.listeners("registrationExpiring").length?c.register():c._ua.emit("registrationExpiring")},1E3*f/
2);h.hasParam("temp-gruu")&&(c._ua.contact.temp_gruu=h.getParam("temp-gruu").replace(/"/g,""));h.hasParam("pub-gruu")&&(c._ua.contact.pub_gruu=h.getParam("pub-gruu").replace(/"/g,""));c._registered||(c._registered=!0,c._ua.registered({response:e}));break;case /^423$/.test(e.status_code):e.hasHeader("min-expires")?(c._expires=Number(e.getHeader("min-expires")),10>c._expires&&(c._expires=10),c.register()):(l("423 response received for REGISTER without Min-Expires"),c._registrationFailure(e,y.causes.SIP_FAILURE_CODE));
break;default:h=a.sipErrorCause(e.status_code),c._registrationFailure(e,h)}}});this._registering=!0;f.send()}}},{key:"unregister",value:function(){var c=this,f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(this._registered){this._registered=!1;null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null);var B=this._extraHeaders.slice();f.all?B.push("Contact: *".concat(this._extraContactParams)):B.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams));
B.push("Expires: 0");f=new e.OutgoingRequest(y.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},B);(new E(this._ua,f,{onRequestTimeout:function(){c._unregistered(null,y.causes.REQUEST_TIMEOUT)},onTransportError:function(){c._unregistered(null,y.causes.CONNECTION_ERROR)},onAuthenticated:function(){c._cseq+=1},onReceiveResponse:function(e){switch(!0){case /^1[0-9]{2}$/.test(e.status_code):break;case /^2[0-9]{2}$/.test(e.status_code):c._unregistered(e);
break;default:var h=a.sipErrorCause(e.status_code);c._unregistered(e,h)}}})).send()}else l("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(a,c){this._registering=!1;this._ua.registrationFailed({response:a||
null,cause:c});this._registered&&(this._registered=!1,this._ua.unregistered({response:a||null,cause:c}))}},{key:"_unregistered",value:function(a,c){this._registered=this._registering=!1;this._ua.unregistered({response:a||null,cause:c||null})}},{key:"registered",get:function(){return this._registered}}]);return c}()},{"./Constants":2,"./RequestSender":18,"./SIPMessage":19,"./Utils":26,debug:30}],18:[function(f,u,x){function p(a,e){for(var c=0;c<e.length;c++){var h=e[c];h.enumerable=h.enumerable||!1;
h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}function q(a,e,f){e&&p(a.prototype,e);f&&p(a,f);return a}var a=f("./Constants"),y=f("./DigestAuthentication"),e=f("./Transactions"),E=f("debug")("JsSIP:RequestSender"),l={onRequestTimeout:function(){},onTransportError:function(){},onReceiveResponse:function(){},onAuthenticated:function(){}};u.exports=function(){function c(e,f,B){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this._ua=
e;this._eventHandlers=B;this._method=f.method;this._request=f;this._auth=null;this._staled=this._challenged=!1;for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&(this._eventHandlers[h]||(this._eventHandlers[h]=l[h]));if(e.status===e.C.STATUS_USER_CLOSED&&(this._method!==a.BYE||this._method!==a.ACK))this._eventHandlers.onTransportError()}q(c,[{key:"send",value:function(){var a=this,c={onRequestTimeout:function(){a._eventHandlers.onRequestTimeout()},onTransportError:function(){a._eventHandlers.onTransportError()},
onReceiveResponse:function(c){a._receiveResponse(c)}};switch(this._method){case "INVITE":this.clientTransaction=new e.InviteClientTransaction(this._ua,this._ua.transport,this._request,c);break;case "ACK":this.clientTransaction=new e.AckClientTransaction(this._ua,this._ua.transport,this._request,c);break;default:this.clientTransaction=new e.NonInviteClientTransaction(this._ua,this._ua.transport,this._request,c)}this.clientTransaction.send()}},{key:"_receiveResponse",value:function(a){var c,e;c=a.status_code;
if(401!==c&&407!==c||null===this._ua.configuration.password&&null===this._ua.configuration.ha1)this._eventHandlers.onReceiveResponse(a);else if(401===a.status_code?(c=a.parseHeader("www-authenticate"),e="authorization"):(c=a.parseHeader("proxy-authenticate"),e="proxy-authorization"),c)if(!this._challenged||!this._staled&&!0===c.stale)if(this._auth||(this._auth=new y({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,c))this._challenged=!0,this._ua.set("realm",this._auth.get("realm")),this._ua.set("ha1",this._auth.get("ha1")),c.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(e,this._auth.toString()),this._eventHandlers.onAuthenticated(this._request),this.send();else this._eventHandlers.onReceiveResponse(a);else this._eventHandlers.onReceiveResponse(a);
else E("".concat(a.status_code," with wrong or missing challenge, cannot authenticate")),this._eventHandlers.onReceiveResponse(a)}}]);return c}()},{"./Constants":2,"./DigestAuthentication":5,"./Transactions":22,debug:30}],19:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&
"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};return p(a)}function q(a,c){if(c&&("object"===p(c)||"function"===typeof c))return c;if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function a(c){a=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return a(c)}function y(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function");
a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}});c&&e(a,c)}function e(a,c){e=Object.setPrototypeOf||function(a,c){a.__proto__=c;return a};return e(a,c)}function E(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function l(a,c){for(var e=0;e<c.length;e++){var f=c[e];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}function c(a,c,e){c&&l(a.prototype,c);e&&l(a,
e);return a}var h=f("sdp-transform"),z=f("./Constants"),B=f("./Utils"),F=f("./NameAddrHeader"),M=f("./Grammar"),I=f("debug")("JsSIP:SIPMessage");f=function(){function a(c,e,f,h,l,w){E(this,a);if(!c||!e||!f)return null;h=h||{};this.ua=f;this.headers={};this.method=c;this.ruri=e;this.body=w;this.extraHeaders=B.cloneArray(l);h.route_set?this.setHeader("route",h.route_set):f.configuration.use_preloaded_route&&this.setHeader("route","<".concat(f.transport.sip_uri,";lr>"));this.setHeader("via","");this.setHeader("max-forwards",
z.MAX_FORWARDS);this.to=new F(h.to_uri||e,"undefined"!==typeof h.to_display_name?h.to_display_name:null,h.to_tag?{tag:h.to_tag}:null);this.setHeader("to",this.to.toString());e=h.from_uri||f.configuration.uri;l={tag:h.from_tag||B.newTag()};this.from=new F(e,"undefined"!==typeof h.from_display_name?h.from_display_name:f.configuration.display_name?f.configuration.display_name:null,l);this.setHeader("from",this.from.toString());this.call_id=f=h.call_id||f.configuration.jssip_id+B.createRandomToken(15);
this.setHeader("call-id",f);this.cseq=h=h.cseq||Math.floor(1E4*Math.random());this.setHeader("cseq","".concat(h," ").concat(c))}c(a,[{key:"setHeader",value:function(a,c){for(var e=new RegExp("^\\s*".concat(a,"\\s*:"),"i"),f=0;f<this.extraHeaders.length;f++)e.test(this.extraHeaders[f])&&this.extraHeaders.splice(f,1);this.headers[B.headerize(a)]=Array.isArray(c)?c:[c]}},{key:"getHeader",value:function(a){var c=this.headers[B.headerize(a)];if(c){if(c[0])return c[0]}else{a=new RegExp("^\\s*".concat(a,
"\\s*:"),"i");var c=!0,e=!1,f=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var h=this.extraHeaders[Symbol.iterator](),l;!(c=(l=h.next()).done);c=!0){var r=l.value;if(a.test(r))return r.substring(r.indexOf(":")+1).trim()}}catch(R){e=!0,f=R}finally{try{c||null==h.return||h.return()}finally{if(e)throw f;}}}}},{key:"getHeaders",value:function(a){var c=this.headers[B.headerize(a)],e=[];if(c){var f=!0,h=!1,l=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var r=c[Symbol.iterator](),
z;!(f=(z=r.next()).done);f=!0)e.push(z.value)}catch(V){h=!0,l=V}finally{try{f||null==r.return||r.return()}finally{if(h)throw l;}}}else{c=new RegExp("^\\s*".concat(a,"\\s*:"),"i");r=!0;z=!1;a=void 0;try{for($jscompjssip.initSymbol(),$jscompjssip.initSymbolIterator(),f=this.extraHeaders[Symbol.iterator]();!(r=(h=f.next()).done);r=!0)l=h.value,c.test(l)&&e.push(l.substring(l.indexOf(":")+1).trim())}catch(V){z=!0,a=V}finally{try{r||null==f.return||f.return()}finally{if(z)throw a;}}}return e}},{key:"hasHeader",
value:function(a){if(this.headers[B.headerize(a)])return!0;a=new RegExp("^\\s*".concat(a,"\\s*:"),"i");var c=!0,e=!1,f=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var h=this.extraHeaders[Symbol.iterator](),l;!(c=(l=h.next()).done);c=!0)if(a.test(l.value))return!0}catch(U){e=!0,f=U}finally{try{c||null==h.return||h.return()}finally{if(e)throw f;}}return!1}},{key:"parseSDP",value:function(a){if(a||!this.sdp)this.sdp=h.parse(this.body||"");return this.sdp}},{key:"toString",value:function(){var a=
"".concat(this.method," ").concat(this.ruri," SIP/2.0\r\n"),c;for(c in this.headers)if(Object.prototype.hasOwnProperty.call(this.headers,c)){var e=!0,f=!1,h=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var l=this.headers[c][Symbol.iterator](),p;!(e=(p=l.next()).done);e=!0)var F=p.value,a=a+"".concat(c,": ").concat(F,"\r\n")}catch(v){f=!0,h=v}finally{try{e||null==l.return||l.return()}finally{if(f)throw h;}}}c=!0;e=!1;f=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();
for(var y=this.extraHeaders[Symbol.iterator](),k;!(c=(k=y.next()).done);c=!0)a+="".concat(k.value.trim(),"\r\n")}catch(v){e=!0,f=v}finally{try{c||null==y.return||y.return()}finally{if(e)throw f;}}y=[];switch(this.method){case z.REGISTER:y.push("path","gruu");break;case z.INVITE:this.ua.configuration.session_timers&&y.push("timer");(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&y.push("gruu");y.push("ice","replaces");break;case z.UPDATE:this.ua.configuration.session_timers&&y.push("timer"),
y.push("ice")}y.push("outbound");k=this.ua.configuration.user_agent||z.USER_AGENT;a+="Allow: ".concat(z.ALLOWED_METHODS,"\r\n");a+="Supported: ".concat(y,"\r\n");a+="User-Agent: ".concat(k,"\r\n");this.body?(y=B.str_utf8_length(this.body),a+="Content-Length: ".concat(y,"\r\n\r\n"),a+=this.body):a+="Content-Length: 0\r\n\r\n";return a}},{key:"clone",value:function(){var c=new a(this.method,this.ruri,this.ua);Object.keys(this.headers).forEach(function(a){c.headers[a]=this.headers[a].slice()},this);
c.body=this.body;c.extraHeaders=B.cloneArray(this.extraHeaders);c.to=this.to;c.from=this.from;c.call_id=this.call_id;c.cseq=this.cseq;return c}}]);return a}();x=function(e){function f(c,e,h,l,r){E(this,f);c=q(this,a(f).call(this,z.INVITE,c,e,h,l,r));c.transaction=null;return c}y(f,e);c(f,[{key:"cancel",value:function(a){this.transaction.cancel(a)}},{key:"clone",value:function(){var a=new f(this.ruri,this.ua);Object.keys(this.headers).forEach(function(c){a.headers[c]=this.headers[c].slice()},this);
a.body=this.body;a.extraHeaders=B.cloneArray(this.extraHeaders);a.to=this.to;a.from=this.from;a.call_id=this.call_id;a.cseq=this.cseq;a.transaction=this.transaction;return a}}]);return f}(f);var L=function(){function a(){E(this,a);this.sdp=this.body=this.to_tag=this.to=this.from_tag=this.from=this.cseq=this.call_id=this.via_branch=this.via=this.method=this.headers=this.data=null}c(a,[{key:"addHeader",value:function(a,c){c={raw:c};a=B.headerize(a);this.headers[a]?this.headers[a].push(c):this.headers[a]=
[c]}},{key:"getHeader",value:function(a){if((a=this.headers[B.headerize(a)])&&a[0])return a[0].raw}},{key:"getHeaders",value:function(a){a=this.headers[B.headerize(a)];var c=[];if(!a)return[];var e=!0,f=!1,h=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var l=a[Symbol.iterator](),r;!(e=(r=l.next()).done);e=!0)c.push(r.value.raw)}catch(R){f=!0,h=R}finally{try{e||null==l.return||l.return()}finally{if(f)throw h;}}return c}},{key:"hasHeader",value:function(a){return this.headers[B.headerize(a)]?
!0:!1}},{key:"parseHeader",value:function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;a=B.headerize(a);if(this.headers[a])if(c>=this.headers[a].length)I('not so many "'.concat(a,'" headers present'));else{var e=this.headers[a][c],f=e.raw;if(e.parsed)return e.parsed;var h=M.parse(f,a.replace(/-/g,"_"));if(-1===h)this.headers[a].splice(c,1),I('error parsing "'.concat(a,'" header field with value "').concat(f,'"'));else return e.parsed=h}else I('header "'.concat(a,'" not present'))}},
{key:"s",value:function(a,c){return this.parseHeader(a,c)}},{key:"setHeader",value:function(a,c){c={raw:c};this.headers[B.headerize(a)]=[c]}},{key:"parseSDP",value:function(a){if(a||!this.sdp)this.sdp=h.parse(this.body||"");return this.sdp}},{key:"toString",value:function(){return this.data}}]);return a}(),K=function(e){function f(c){var e;E(this,f);e=q(this,a(f).call(this));e.ua=c;e.headers={};e.ruri=null;e.transport=null;e.server_transaction=null;return e}y(f,e);c(f,[{key:"reply",value:function(a,
c,e,f,h,l){var r=[],t=this.getHeader("To");a=a||null;c=c||null;if(!a||100>a||699<a)throw new TypeError("Invalid status_code: ".concat(a));if(c&&"string"!==typeof c&&!(c instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(c));c=c||z.REASON_PHRASE[a]||"";e=B.cloneArray(e);c="SIP/2.0 ".concat(a," ").concat(c,"\r\n");if(this.method===z.INVITE&&100<a&&200>=a){var k=this.getHeaders("record-route"),v=!0,w=!1,C=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var p=k[Symbol.iterator](),
F;!(v=(F=p.next()).done);v=!0)c+="Record-Route: ".concat(F.value,"\r\n")}catch(N){w=!0,C=N}finally{try{v||null==p.return||p.return()}finally{if(w)throw C;}}}p=this.getHeaders("via");F=!0;k=!1;v=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var y=p[Symbol.iterator](),q;!(F=(q=y.next()).done);F=!0)c+="Via: ".concat(q.value,"\r\n")}catch(N){k=!0,v=N}finally{try{F||null==y.return||y.return()}finally{if(k)throw v;}}!this.to_tag&&100<a?t+=";tag=".concat(B.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&
(t+=";tag=".concat(this.to_tag));c+="To: ".concat(t,"\r\n");c+="From: ".concat(this.getHeader("From"),"\r\n");c+="Call-ID: ".concat(this.call_id,"\r\n");c+="CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");t=!0;y=!1;q=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var G=e[Symbol.iterator](),D;!(t=(D=G.next()).done);t=!0)c+="".concat(D.value.trim(),"\r\n")}catch(N){y=!0,q=N}finally{try{t||null==G.return||G.return()}finally{if(y)throw q;}}switch(this.method){case z.INVITE:this.ua.configuration.session_timers&&
r.push("timer");(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&r.push("gruu");r.push("ice","replaces");break;case z.UPDATE:this.ua.configuration.session_timers&&r.push("timer"),f&&r.push("ice"),r.push("replaces")}r.push("outbound");this.method===z.OPTIONS?(c+="Allow: ".concat(z.ALLOWED_METHODS,"\r\n"),c+="Accept: ".concat(z.ACCEPTED_BODY_TYPES,"\r\n")):405===a?c+="Allow: ".concat(z.ALLOWED_METHODS,"\r\n"):415===a?c+="Accept: ".concat(z.ACCEPTED_BODY_TYPES,"\r\n"):this.method===z.INVITE&&(c+=
"Allow: ".concat(z.ALLOWED_METHODS,"\r\n"));c+="Supported: ".concat(r,"\r\n");f?(e=B.str_utf8_length(f),c=c+"Content-Type: application/sdp\r\n"+"Content-Length: ".concat(e,"\r\n\r\n"),c+=f):c+="Content-Length: ".concat(0,"\r\n\r\n");this.server_transaction.receiveResponse(a,c,h,l)}},{key:"reply_sl",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,e=this.getHeaders("via");if(!a||100>a||699<a)throw new TypeError("Invalid status_code: ".concat(a));
if(c&&"string"!==typeof c&&!(c instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(c));var c=c||z.REASON_PHRASE[a]||"",c="SIP/2.0 ".concat(a," ").concat(c,"\r\n"),f=!0,h=!1,l=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var r=e[Symbol.iterator](),p;!(f=(p=r.next()).done);f=!0)c+="Via: ".concat(p.value,"\r\n")}catch(k){h=!0,l=k}finally{try{f||null==r.return||r.return()}finally{if(h)throw l;}}e=this.getHeader("To");!this.to_tag&&100<a?e+=";tag=".concat(B.newTag()):
this.to_tag&&!this.s("to").hasParam("tag")&&(e+=";tag=".concat(this.to_tag));c+="To: ".concat(e,"\r\n");c+="From: ".concat(this.getHeader("From"),"\r\n");c+="Call-ID: ".concat(this.call_id,"\r\n");c+="CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");c+="Content-Length: ".concat(0,"\r\n\r\n");this.transport.send(c)}}]);return f}(L),L=function(c){function e(){var c;E(this,e);c=q(this,a(e).call(this));c.headers={};c.status_code=null;c.reason_phrase=null;return c}y(e,c);return e}(L);u.exports=
{OutgoingRequest:f,InitialOutgoingInviteRequest:x,IncomingRequest:K,IncomingResponse:L}},{"./Constants":2,"./Grammar":7,"./NameAddrHeader":10,"./Utils":26,debug:30,"sdp-transform":35}],20:[function(f,u,x){var p=f("./Utils"),q=f("./Grammar"),a=f("debug")("JsSIP:ERROR:Socket");a.log=console.warn.bind(console);x.isSocket=function(f){if(Array.isArray(f))return!1;if("undefined"===typeof f)return a("undefined JsSIP.Socket instance"),!1;try{if(!p.isString(f.url))throw a("missing or invalid JsSIP.Socket url property"),
Error();if(!p.isString(f.via_transport))throw a("missing or invalid JsSIP.Socket via_transport property"),Error();if(-1===q.parse(f.sip_uri,"SIP_URI"))throw a("missing or invalid JsSIP.Socket sip_uri property"),Error();}catch(e){return!1}try{["connect","disconnect","send"].forEach(function(e){if(!p.isFunction(f[e]))throw a("missing or invalid JsSIP.Socket method: ".concat(e)),Error();})}catch(e){return!1}return!0}},{"./Grammar":7,"./Utils":26,debug:30}],21:[function(f,u,x){u.exports={T1:500,T2:4E3,
T4:5E3,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}},{}],22:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?
"symbol":typeof a};return p(a)}function q(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}function a(a,c){for(var e=0;e<c.length;e++){var f=c[e];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}function y(c,e,f){e&&a(c.prototype,e);f&&a(c,f);return c}function e(a,c){return!c||"object"!==p(c)&&"function"!==typeof c?h(a):c}function E(a){E=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||
Object.getPrototypeOf(a)};return E(a)}function l(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}});e&&c(a,e)}function c(a,e){c=Object.setPrototypeOf||function(a,c){a.__proto__=c;return a};return c(a,e)}function h(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}x=f("events").EventEmitter;
var z=f("./Constants"),B=f("./SIPMessage"),F=f("./Timers"),M=f("debug")("JsSIP:NonInviteClientTransaction"),I=f("debug")("JsSIP:InviteClientTransaction"),L=f("debug")("JsSIP:AckClientTransaction"),K=f("debug")("JsSIP:NonInviteServerTransaction"),G=f("debug")("JsSIP:InviteServerTransaction"),r={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"};
f=function(a){function c(a,f,l,k){var v;q(this,c);v=e(this,E(c).call(this));v.type=r.NON_INVITE_CLIENT;v.id="z9hG4bK".concat(Math.floor(1E7*Math.random()));v.ua=a;v.transport=f;v.request=l;v.eventHandlers=k;f="SIP/2.0/".concat(f.via_transport);f+=" ".concat(a.configuration.via_host,";branch=").concat(v.id);v.request.setHeader("via",f);v.ua.newTransaction(h(h(v)));return v}l(c,a);y(c,[{key:"stateChanged",value:function(a){this.state=a;this.emit("stateChanged")}},{key:"send",value:function(){var a=
this;this.stateChanged(r.STATUS_TRYING);this.F=setTimeout(function(){a.timer_F()},F.TIMER_F);if(!this.transport.send(this.request))this.onTransportError()}},{key:"onTransportError",value:function(){M("transport error occurred, deleting transaction ".concat(this.id));clearTimeout(this.F);clearTimeout(this.K);this.stateChanged(r.STATUS_TERMINATED);this.ua.destroyTransaction(this);this.eventHandlers.onTransportError()}},{key:"timer_F",value:function(){M("Timer F expired for transaction ".concat(this.id));
this.stateChanged(r.STATUS_TERMINATED);this.ua.destroyTransaction(this);this.eventHandlers.onRequestTimeout()}},{key:"timer_K",value:function(){this.stateChanged(r.STATUS_TERMINATED);this.ua.destroyTransaction(this)}},{key:"receiveResponse",value:function(a){var c=this,e=a.status_code;if(200>e)switch(this.state){case r.STATUS_TRYING:case r.STATUS_PROCEEDING:this.stateChanged(r.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(a)}else switch(this.state){case r.STATUS_TRYING:case r.STATUS_PROCEEDING:this.stateChanged(r.STATUS_COMPLETED);
clearTimeout(this.F);if(408===e)this.eventHandlers.onRequestTimeout();else this.eventHandlers.onReceiveResponse(a);this.K=setTimeout(function(){c.timer_K()},F.TIMER_K)}}},{key:"C",get:function(){return r}}]);return c}(x);var P=function(a){function c(a,f,l,k){var v;q(this,c);v=e(this,E(c).call(this));v.type=r.INVITE_CLIENT;v.id="z9hG4bK".concat(Math.floor(1E7*Math.random()));v.ua=a;v.transport=f;v.request=l;v.eventHandlers=k;l.transaction=h(h(v));f="SIP/2.0/".concat(f.via_transport);f+=" ".concat(a.configuration.via_host,
";branch=").concat(v.id);v.request.setHeader("via",f);v.ua.newTransaction(h(h(v)));return v}l(c,a);y(c,[{key:"stateChanged",value:function(a){this.state=a;this.emit("stateChanged")}},{key:"send",value:function(){var a=this;this.stateChanged(r.STATUS_CALLING);this.B=setTimeout(function(){a.timer_B()},F.TIMER_B);if(!this.transport.send(this.request))this.onTransportError()}},{key:"onTransportError",value:function(){clearTimeout(this.B);clearTimeout(this.D);clearTimeout(this.M);this.state!==r.STATUS_ACCEPTED&&
(I("transport error occurred, deleting transaction ".concat(this.id)),this.eventHandlers.onTransportError());this.stateChanged(r.STATUS_TERMINATED);this.ua.destroyTransaction(this)}},{key:"timer_M",value:function(){I("Timer M expired for transaction ".concat(this.id));this.state===r.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(r.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"timer_B",value:function(){I("Timer B expired for transaction ".concat(this.id));this.state===r.STATUS_CALLING&&
(this.stateChanged(r.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout())}},{key:"timer_D",value:function(){I("Timer D expired for transaction ".concat(this.id));clearTimeout(this.B);this.stateChanged(r.STATUS_TERMINATED);this.ua.destroyTransaction(this)}},{key:"sendACK",value:function(a){var c=this,e=new B.OutgoingRequest(z.ACK,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});
e.setHeader("from",this.request.getHeader("from"));e.setHeader("via",this.request.getHeader("via"));e.setHeader("to",a.getHeader("to"));this.D=setTimeout(function(){c.timer_D()},F.TIMER_D);this.transport.send(e)}},{key:"cancel",value:function(a){if(this.state===r.STATUS_PROCEEDING){var c=new B.OutgoingRequest(z.CANCEL,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});c.setHeader("from",this.request.getHeader("from"));
c.setHeader("via",this.request.getHeader("via"));c.setHeader("to",this.request.getHeader("to"));a&&c.setHeader("reason",a);this.transport.send(c)}}},{key:"receiveResponse",value:function(a){var c=this,e=a.status_code;if(100<=e&&199>=e)switch(this.state){case r.STATUS_CALLING:this.stateChanged(r.STATUS_PROCEEDING);this.eventHandlers.onReceiveResponse(a);break;case r.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(a)}else if(200<=e&&299>=e)switch(this.state){case r.STATUS_CALLING:case r.STATUS_PROCEEDING:this.stateChanged(r.STATUS_ACCEPTED);
this.M=setTimeout(function(){c.timer_M()},F.TIMER_M);this.eventHandlers.onReceiveResponse(a);break;case r.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(a)}else if(300<=e&&699>=e)switch(this.state){case r.STATUS_CALLING:case r.STATUS_PROCEEDING:this.stateChanged(r.STATUS_COMPLETED);this.sendACK(a);this.eventHandlers.onReceiveResponse(a);break;case r.STATUS_COMPLETED:this.sendACK(a)}}},{key:"C",get:function(){return r}}]);return c}(x),D=function(a){function c(a,f,h,k){var l;q(this,c);l=e(this,
E(c).call(this));l.id="z9hG4bK".concat(Math.floor(1E7*Math.random()));l.transport=f;l.request=h;l.eventHandlers=k;f="SIP/2.0/".concat(f.via_transport);f+=" ".concat(a.configuration.via_host,";branch=").concat(l.id);l.request.setHeader("via",f);return l}l(c,a);y(c,[{key:"send",value:function(){if(!this.transport.send(this.request))this.onTransportError()}},{key:"onTransportError",value:function(){L("transport error occurred for transaction ".concat(this.id));this.eventHandlers.onTransportError()}},
{key:"C",get:function(){return r}}]);return c}(x),t=function(a){function c(a,f,l){var k;q(this,c);k=e(this,E(c).call(this));k.type=r.NON_INVITE_SERVER;k.id=l.via_branch;k.ua=a;k.transport=f;k.request=l;k.last_response="";l.server_transaction=h(h(k));k.state=r.STATUS_TRYING;a.newTransaction(h(h(k)));return k}l(c,a);y(c,[{key:"stateChanged",value:function(a){this.state=a;this.emit("stateChanged")}},{key:"timer_J",value:function(){K("Timer J expired for transaction ".concat(this.id));this.stateChanged(r.STATUS_TERMINATED);
this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,K("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(r.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(a,c,e,f){var h=this;if(100===a)switch(this.state){case r.STATUS_TRYING:this.stateChanged(r.STATUS_PROCEEDING);if(!this.transport.send(c))this.onTransportError();break;case r.STATUS_PROCEEDING:this.last_response=
c,this.transport.send(c)?e&&e():(this.onTransportError(),f&&f())}else if(200<=a&&699>=a)switch(this.state){case r.STATUS_TRYING:case r.STATUS_PROCEEDING:this.stateChanged(r.STATUS_COMPLETED),this.last_response=c,this.J=setTimeout(function(){h.timer_J()},F.TIMER_J),this.transport.send(c)?e&&e():(this.onTransportError(),f&&f())}}},{key:"C",get:function(){return r}}]);return c}(x);x=function(a){function c(a,f,l){var k;q(this,c);k=e(this,E(c).call(this));k.type=r.INVITE_SERVER;k.id=l.via_branch;k.ua=
a;k.transport=f;k.request=l;k.last_response="";l.server_transaction=h(h(k));k.state=r.STATUS_PROCEEDING;a.newTransaction(h(h(k)));k.resendProvisionalTimer=null;l.reply(100);return k}l(c,a);y(c,[{key:"stateChanged",value:function(a){this.state=a;this.emit("stateChanged")}},{key:"timer_H",value:function(){G("Timer H expired for transaction ".concat(this.id));this.state===r.STATUS_COMPLETED&&G("ACK not received, dialog will be terminated");this.stateChanged(r.STATUS_TERMINATED);this.ua.destroyTransaction(this)}},
{key:"timer_I",value:function(){this.stateChanged(r.STATUS_TERMINATED)}},{key:"timer_L",value:function(){G("Timer L expired for transaction ".concat(this.id));this.state===r.STATUS_ACCEPTED&&(this.stateChanged(r.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,G("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(r.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"resend_provisional",value:function(){if(!this.transport.send(this.last_response))this.onTransportError()}},{key:"receiveResponse",value:function(a,c,e,f){var h=this;if(100<=a&&199>=a)switch(this.state){case r.STATUS_PROCEEDING:if(!this.transport.send(c))this.onTransportError();this.last_response=c}if(100<a&&199>=a&&this.state===
r.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){h.resend_provisional()},F.PROVISIONAL_RESPONSE_INTERVAL));else if(200<=a&&299>=a)switch(this.state){case r.STATUS_PROCEEDING:this.stateChanged(r.STATUS_ACCEPTED),this.last_response=c,this.L=setTimeout(function(){h.timer_L()},F.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case r.STATUS_ACCEPTED:this.transport.send(c)?
e&&e():(this.onTransportError(),f&&f())}else if(300<=a&&699>=a)switch(this.state){case r.STATUS_PROCEEDING:null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(c)?(this.stateChanged(r.STATUS_COMPLETED),this.H=setTimeout(function(){h.timer_H()},F.TIMER_H),e&&e()):(this.onTransportError(),f&&f())}}},{key:"C",get:function(){return r}}]);return c}(x);u.exports={C:r,NonInviteClientTransaction:f,InviteClientTransaction:P,AckClientTransaction:D,
NonInviteServerTransaction:t,InviteServerTransaction:x,checkTransaction:function(a,c){a=a._transactions;var e;switch(c.method){case z.INVITE:if(e=a.ist[c.via_branch]){switch(e.state){case r.STATUS_PROCEEDING:e.transport.send(e.last_response)}return!0}break;case z.ACK:if(e=a.ist[c.via_branch]){if(e.state===r.STATUS_ACCEPTED)return!1;if(e.state===r.STATUS_COMPLETED)return e.state=r.STATUS_CONFIRMED,e.I=setTimeout(function(){e.timer_I()},F.TIMER_I),!0}else return!1;break;case z.CANCEL:if(e=a.ist[c.via_branch])return c.reply_sl(200),
e.state===r.STATUS_PROCEEDING?!1:!0;c.reply_sl(481);return!0;default:if(e=a.nist[c.via_branch]){switch(e.state){case r.STATUS_PROCEEDING:case r.STATUS_COMPLETED:e.transport.send(e.last_response)}return!0}}}}},{"./Constants":2,"./SIPMessage":19,"./Timers":21,debug:30,events:29}],23:[function(f,u,x){function p(a,c){for(var e=0;e<c.length;e++){var f=c[e];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}function q(a,c,e){c&&p(a.prototype,c);
e&&p(a,e);return a}var a=f("./Socket"),y=f("debug")("JsSIP:Transport"),e=f("debug")("JsSIP:ERROR:Transport");e.log=console.warn.bind(console);var E={min_interval:2,max_interval:30};u.exports=function(){function f(c){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:E;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");y("new()");this.status=2;this.socket=null;this.sockets=[];this.recovery_options=e;this.recover_attempts=0;this.recovery_timer=null;this.close_requested=
!1;if("undefined"===typeof c)throw new TypeError("Invalid argument. undefined 'sockets' argument");c instanceof Array||(c=[c]);c.forEach(function(c){if(!a.isSocket(c.socket))throw new TypeError("Invalid argument. invalid 'JsSIP.Socket' instance");if(c.weight&&!Number(c.weight))throw new TypeError("Invalid argument. 'weight' attribute is not a number");this.sockets.push({socket:c.socket,weight:c.weight||0,status:0})},this);this._getSocket()}q(f,[{key:"connect",value:function(){y("connect()");this.isConnected()?
y("Transport is already connected"):this.isConnecting()?y("Transport is connecting"):(this.close_requested=!1,this.status=1,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(){y("close()");this.close_requested=!0;this.recover_attempts=0;this.status=2;
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(a){y("send()");if(!this.isConnected())return e("unable to send message, transport is not connected"),!1;a=a.toString();y("sending message:\n\n".concat(a,"\n"));return this.socket.send(a)}},{key:"isConnected",
value:function(){return 0===this.status}},{key:"isConnecting",value:function(){return 1===this.status}},{key:"_reconnect",value:function(){var a=this;this.recover_attempts+=1;var e=Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1);e<this.recovery_options.min_interval?e=this.recovery_options.min_interval:e>this.recovery_options.max_interval&&(e=this.recovery_options.max_interval);y("reconnection attempt: ".concat(this.recover_attempts,". next connection attempt in ").concat(e," seconds"));
this.recovery_timer=setTimeout(function(){a.close_requested||a.isConnected()||a.isConnecting()||(a._getSocket(),a.connect())},1E3*e)}},{key:"_getSocket",value:function(){var a=[];this.sockets.forEach(function(c){1!==c.status&&(0===a.length?a.push(c):c.weight>a[0].weight?a=[c]:c.weight===a[0].weight&&a.push(c))});0===a.length?(this.sockets.forEach(function(a){a.status=0}),this._getSocket()):this.socket=a[Math.floor(Math.random()*a.length)].socket}},{key:"_onConnect",value:function(){this.status=this.recover_attempts=
0;null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null);this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(a,e,f){this.status=2;this.ondisconnect({socket:this.socket,error:a,code:e,reason:f});this.close_requested||(this.sockets.forEach(function(a){this.socket===a.socket&&(a.status=1)},this),this._reconnect(a))}},{key:"_onData",value:function(a){if("\r\n"===a)y("received message with CRLF Keep Alive response");else{if("string"!==typeof a){try{a=String.fromCharCode.apply(null,
new Uint8Array(a))}catch(h){y("received binary message failed to be converted into string, message discarded");return}y("received binary message:\n\n".concat(a,"\n"))}else y("received text message:\n\n".concat(a,"\n"));this.ondata({transport:this,message:a})}}},{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}}]);return f}()},{"./Socket":20,debug:30}],24:[function(f,u,
x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};return p(a)}function q(a){q=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return q(a)}function a(a,
c){for(var e=0;e<c.length;e++){var f=c[e];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}function y(c,e,f){e&&a(c.prototype,e);f&&a(c,f);return c}function e(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}});c&&E(a,c)}function E(a,c){E=Object.setPrototypeOf||function(a,c){a.__proto__=
c;return a};return E(a,c)}function l(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function c(a){this.emit("connecting",a)}function h(a){this._status!==k.STATUS_USER_CLOSED&&(this._status=k.STATUS_READY,this._error=null,this.emit("connected",a),this._dynConfiguration.register&&this._registrator.register())}function z(a){for(var c=["nict","ict","nist","ist"],e=0;e<c.length;e++){var f=c[e],h;for(h in this._transactions[f])if(Object.prototype.hasOwnProperty.call(this._transactions[f],
h))this._transactions[f][h].onTransportError()}this.emit("disconnected",a);this._registrator.onTransportClosed();this._status!==k.STATUS_USER_CLOSED&&(this._status=k.STATUS_NOT_READY,this._error=k.NETWORK_ERROR)}function B(a){var c=a.transport;a=a.message;if((a=t.parseMessage(a,this))&&!(this._status===k.STATUS_USER_CLOSED&&a instanceof O.IncomingRequest)&&w(a,this,c))if(a instanceof O.IncomingRequest)a.transport=c,this.receiveRequest(a);else if(a instanceof O.IncomingResponse)switch(a.method){case F.INVITE:(c=
this._transactions.ict[a.via_branch])&&c.receiveResponse(a);break;case F.ACK:break;default:(c=this._transactions.nict[a.via_branch])&&c.receiveResponse(a)}}x=f("events").EventEmitter;var F=f("./Constants"),M=f("./Registrator"),I=f("./RTCSession"),L=f("./Message"),K=f("./Transactions"),G=f("./Transport"),r=f("./Utils"),P=f("./Exceptions"),D=f("./URI"),t=f("./Parser"),O=f("./SIPMessage"),w=f("./sanityCheck"),U=f("./Config"),R=f("debug")("JsSIP:UA"),V=f("debug")("JsSIP:ERROR:UA");V.log=console.warn.bind(console);
var k={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2};u.exports=function(a){function f(a){var c;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");R("new() [configuration:%o]",a);c=q(f).call(this);c=!c||"object"!==p(c)&&"function"!==typeof c?l(this):c;c._cache={credentials:{}};c._configuration=Object.assign({},U.settings);c._dynConfiguration={};c._dialogs={};c._applicants={};c._sessions={};c._transport=null;
c._contact=null;c._status=k.STATUS_INIT;c._error=null;c._transactions={nist:{},nict:{},ist:{},ict:{}};c._data={};c._closeTimer=null;if(void 0===a)throw new TypeError("Not enough arguments");try{c._loadConfig(a)}catch(S){throw c._status=k.STATUS_NOT_READY,c._error=k.CONFIGURATION_ERROR,S;}c._registrator=new M(l(l(c)));return c}e(f,a);y(f,null,[{key:"C",get:function(){return k}}]);y(f,[{key:"start",value:function(){R("start()");this._status===k.STATUS_INIT?this._transport.connect():this._status===k.STATUS_USER_CLOSED?
(R("restarting UA"),null!==this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null,this._transport.disconnect()),this._status=k.STATUS_INIT,this._transport.connect()):this._status===k.STATUS_READY?R("UA is in READY status, not restarted"):R("ERROR: connection is down, Auto-Recovery system is trying to reconnect");this._dynConfiguration.register=this._configuration.register}},{key:"register",value:function(){R("register()");this._dynConfiguration.register=!0;this._registrator.register()}},
{key:"unregister",value:function(a){R("unregister()");this._dynConfiguration.register=!1;this._registrator.unregister(a)}},{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(a,c){R("call()");var e=new I(this);e.connect(a,c);return e}},{key:"sendMessage",value:function(a,c,e){R("sendMessage()");var f=new L(this);
f.send(a,c,e);return f}},{key:"terminateSessions",value:function(a){R("terminateSessions()");for(var c in this._sessions)this._sessions[c].isEnded()||this._sessions[c].terminate(a)}},{key:"stop",value:function(){var a=this;R("stop()");this._dynConfiguration={};if(this._status===k.STATUS_USER_CLOSED)R("UA already closed");else{this._registrator.close();var c=Object.keys(this._sessions).length,e;for(e in this._sessions)if(Object.prototype.hasOwnProperty.call(this._sessions,e)){R("closing session ".concat(e));
try{this._sessions[e].terminate()}catch(ga){}}for(var f in this._applicants)if(Object.prototype.hasOwnProperty.call(this._applicants,f))try{this._applicants[f].close()}catch(ga){}this._status=k.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===c?this._transport.disconnect():this._closeTimer=setTimeout(function(){a._closeTimer=null;a._transport.disconnect()},
2E3)}}},{key:"normalizeTarget",value:function(a){return r.normalizeTarget(a,this._configuration.hostport_params)}},{key:"get",value:function(a){switch(a){case "realm":return this._configuration.realm;case "ha1":return this._configuration.ha1;default:V('get() | cannot get "%s" parameter in runtime',a)}}},{key:"set",value:function(a,c){switch(a){case "password":this._configuration.password=String(c);break;case "realm":this._configuration.realm=String(c);break;case "ha1":this._configuration.ha1=String(c);
this._configuration.password=null;break;case "display_name":this._configuration.display_name=c;break;default:return V('set() | cannot set "%s" parameter in runtime',a),!1}return!0}},{key:"newTransaction",value:function(a){this._transactions[a.type][a.id]=a;this.emit("newTransaction",{transaction:a})}},{key:"destroyTransaction",value:function(a){delete this._transactions[a.type][a.id];this.emit("transactionDestroyed",{transaction:a})}},{key:"newDialog",value:function(a){this._dialogs[a.id]=a}},{key:"destroyDialog",
value:function(a){delete this._dialogs[a.id]}},{key:"newMessage",value:function(a,c){this._applicants[a]=a;this.emit("newMessage",c)}},{key:"destroyMessage",value:function(a){delete this._applicants[a]}},{key:"newRTCSession",value:function(a,c){this._sessions[a.id]=a;this.emit("newRTCSession",c)}},{key:"destroyRTCSession",value:function(a){delete this._sessions[a.id]}},{key:"registered",value:function(a){this.emit("registered",a)}},{key:"unregistered",value:function(a){this.emit("unregistered",a)}},
{key:"registrationFailed",value:function(a){this.emit("registrationFailed",a)}},{key:"receiveRequest",value:function(a){var c=a.method;if(a.ruri.user!==this._configuration.uri.user&&a.ruri.user!==this._contact.uri.user)R("Request-URI does not point to us"),a.method!==F.ACK&&a.reply_sl(404);else if(a.ruri.scheme===F.SIPS)a.reply_sl(416);else if(!K.checkTransaction(this,a)){c===F.INVITE?new K.InviteServerTransaction(this,this._transport,a):c!==F.ACK&&c!==F.CANCEL&&new K.NonInviteServerTransaction(this,
this._transport,a);if(c===F.OPTIONS)a.reply(200);else if(c===F.MESSAGE){if(0===this.listeners("newMessage").length){a.reply(405);return}(new L(this)).init_incoming(a)}else if(c===F.INVITE&&!a.to_tag&&0===this.listeners("newRTCSession").length){a.reply(405);return}var e;if(a.to_tag)(e=this._findDialog(a.call_id,a.from_tag,a.to_tag))?e.receiveRequest(a):c===F.NOTIFY?(c=this._findSession(a))?c.receiveRequest(a):(R("received NOTIFY request for a non existent subscription"),a.reply(481,"Subscription does not exist")):
c!==F.ACK&&a.reply(481);else switch(c){case F.INVITE:window.RTCPeerConnection?a.hasHeader("replaces")?(c=a.replaces,(e=this._findDialog(c.call_id,c.from_tag,c.to_tag))?(c=e.owner,c.isEnded()?a.reply(603):c.receiveRequest(a)):a.reply(481)):(c=new I(this),c.init_incoming(a)):(V("INVITE received but WebRTC is not supported"),a.reply(488));break;case F.BYE:a.reply(481);break;case F.CANCEL:(c=this._findSession(a))?c.receiveRequest(a):R("received CANCEL request for a non existent session");break;case F.ACK:break;
case F.NOTIFY:this.emit("sipEvent",{event:a.event,request:a});a.reply(200);break;default:a.reply(405)}}}},{key:"_findSession",value:function(a){var c=a.call_id,e=this._sessions[c+a.from_tag];a=this._sessions[c+a.to_tag];return e?e:a?a:null}},{key:"_findDialog",value:function(a,c,e){var f=this._dialogs[a+c+e];return f?f:(f=this._dialogs[a+e+c])?f:null}},{key:"_loadConfig",value:function(a){try{U.load(this._configuration,a)}catch(ca){throw ca;}0===this._configuration.display_name&&(this._configuration.display_name=
"0");this._configuration.instance_id||(this._configuration.instance_id=r.newUUID());this._configuration.jssip_id=r.createRandomToken(5);a=this._configuration.uri.clone();a.user=null;this._configuration.hostport_params=a.toString().replace(/^sip:/i,"");try{this._transport=new G(this._configuration.sockets,{max_interval:this._configuration.connection_recovery_max_interval,min_interval:this._configuration.connection_recovery_min_interval}),this._transport.onconnecting=c.bind(this),this._transport.onconnect=
h.bind(this),this._transport.ondisconnect=z.bind(this),this._transport.ondata=B.bind(this)}catch(ca){throw V(ca),new P.ConfigurationError("sockets",this._configuration.sockets);}delete this._configuration.sockets;this._configuration.authorization_user||(this._configuration.authorization_user=this._configuration.uri.user);this._configuration.registrar_server||(a=this._configuration.uri.clone(),a.user=null,a.clearParams(),a.clearHeaders(),this._configuration.registrar_server=a);this._configuration.no_answer_timeout*=
1E3;this._configuration.contact_uri?this._configuration.via_host=this._configuration.contact_uri.host:this._configuration.contact_uri=new D("sip",r.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 a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=a.anonymous||null,a=a.outbound||null,e="<",e=c?e+(this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws"):
e+(this.pub_gruu||this.uri.toString());!a||(c?this.temp_gruu:this.pub_gruu)||(e+=";ob");return e+">"}};a=["password","realm","ha1","display_name","register"];for(var e in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,e)&&(-1!==a.indexOf(e)?Object.defineProperty(this._configuration,e,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,e,{writable:!1,configurable:!1}));R("configuration parameters after validation:");for(var f in this._configuration)if(Object.prototype.hasOwnProperty.call(U.settings,
f))switch(f){case "uri":case "registrar_server":R("- ".concat(f,": ").concat(this._configuration[f]));break;case "password":case "ha1":R("- ".concat(f,": NOT SHOWN"));break;default:R("- ".concat(f,": ").concat(JSON.stringify(this._configuration[f])))}}},{key:"C",get:function(){return k}},{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}}]);
return f}(x)},{"./Config":1,"./Constants":2,"./Exceptions":6,"./Message":9,"./Parser":11,"./RTCSession":12,"./Registrator":17,"./SIPMessage":19,"./Transactions":22,"./Transport":23,"./URI":25,"./Utils":26,"./sanityCheck":28,debug:30,events:29}],25:[function(f,u,x){function p(a,e){for(var c=0;c<e.length;c++){var f=e[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}function q(a,e,c){e&&p(a.prototype,e);c&&p(a,c);return a}var a=f("./Constants"),
y=f("./Utils"),e=f("./Grammar");u.exports=function(){function f(e,c,h,z){var l=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},p=5<arguments.length&&void 0!==arguments[5]?arguments[5]:{};if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");if(!h)throw new TypeError('missing or invalid "host" parameter');this._parameters={};this._headers={};this._scheme=e||a.SIP;this._user=c;this._host=h;this._port=z;for(var y in l)Object.prototype.hasOwnProperty.call(l,y)&&this.setParam(y,
l[y]);for(var q in p)Object.prototype.hasOwnProperty.call(p,q)&&this.setHeader(q,p[q])}q(f,null,[{key:"parse",value:function(a){a=e.parse(a,"SIP_URI");if(-1!==a)return a}}]);q(f,[{key:"setParam",value:function(a,c){a&&(this._parameters[a.toLowerCase()]="undefined"===typeof c||null===c?null:c.toString())}},{key:"getParam",value:function(a){if(a)return this._parameters[a.toLowerCase()]}},{key:"hasParam",value:function(a){if(a)return this._parameters.hasOwnProperty(a.toLowerCase())&&!0||!1}},{key:"deleteParam",
value:function(a){a=a.toLowerCase();if(this._parameters.hasOwnProperty(a)){var c=this._parameters[a];delete this._parameters[a];return c}}},{key:"clearParams",value:function(){this._parameters={}}},{key:"setHeader",value:function(a,c){this._headers[y.headerize(a)]=Array.isArray(c)?c:[c]}},{key:"getHeader",value:function(a){if(a)return this._headers[y.headerize(a)]}},{key:"hasHeader",value:function(a){if(a)return this._headers.hasOwnProperty(y.headerize(a))&&!0||!1}},{key:"deleteHeader",value:function(a){a=
y.headerize(a);if(this._headers.hasOwnProperty(a)){var c=this._headers[a];delete this._headers[a];return c}}},{key:"clearHeaders",value:function(){this._headers={}}},{key:"clone",value:function(){return new f(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 a=[],c="".concat(this._scheme,":");this._user&&(c+="".concat(y.escapeUser(this._user),"@"));c+=this._host;if(this._port||
0===this._port)c+=":".concat(this._port);for(var e in this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(c+=";".concat(e),null!==this._parameters[e]&&(c+="=".concat(this._parameters[e])));for(var f in this._headers)if(Object.prototype.hasOwnProperty.call(this._headers,f)){e=!0;var p=!1,F=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var q=this._headers[f][Symbol.iterator](),x;!(e=(x=q.next()).done);e=!0){var E=x.value;a.push("".concat(f,"=").concat(E))}}catch(K){p=
!0,F=K}finally{try{e||null==q.return||q.return()}finally{if(p)throw F;}}}0<a.length&&(c+="?".concat(a.join("&")));return c}},{key:"toAor",value:function(a){var c="".concat(this._scheme,":");this._user&&(c+="".concat(y.escapeUser(this._user),"@"));c+=this._host;a&&(this._port||0===this._port)&&(c+=":".concat(this._port));return c}},{key:"scheme",get:function(){return this._scheme},set:function(a){this._scheme=a.toLowerCase()}},{key:"user",get:function(){return this._user},set:function(a){this._user=
a}},{key:"host",get:function(){return this._host},set:function(a){this._host=a.toLowerCase()}},{key:"port",get:function(){return this._port},set:function(a){this._port=0===a?a:parseInt(a,10)||null}}]);return f}()},{"./Constants":2,"./Grammar":7,"./Utils":26}],26:[function(f,u,x){function p(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(a){return typeof a}:function(a){$jscompjssip.initSymbol();$jscompjssip.initSymbol();
$jscompjssip.initSymbol();return a&&"function"===typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};return p(a)}var q=f("./Constants"),a=f("./URI"),y=f("./Grammar");x.str_utf8_length=function(a){return unescape(encodeURIComponent(a)).length};var e=x.isFunction=function(a){return void 0!==a?"[object Function]"===Object.prototype.toString.call(a)?!0:!1:!1};x.isString=function(a){return void 0!==a?"[object String]"===Object.prototype.toString.call(a)?!0:!1:!1};x.isDecimal=function(a){return!isNaN(a)&&
parseFloat(a)===parseInt(a,10)};x.isEmpty=function(a){return null===a||""===a||void 0===a||Array.isArray(a)&&0===a.length||"number"===typeof a&&isNaN(a)};x.hasMethods=function(a){for(var c=arguments.length,f=Array(1<c?c-1:0),l=1;l<c;l++)f[l-1]=arguments[l];for(c=0;c<f.length;c++)if(e(a[f[c]]))return!1;return!0};var E=x.createRandomToken=function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:32,e,f,l="";for(e=0;e<a;e++)f=Math.random()*c|0,l+=f.toString(c);return l};x.newTag=function(){return E(10)};
x.newUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var c=16*Math.random()|0;return("x"===a?c:c&3|8).toString(16)})};x.hostType=function(a){if(a&&(a=y.parse(a,"host"),-1!==a))return a.host_type};var l=x.escapeUser=function(a){return encodeURIComponent(decodeURIComponent(a)).replace(/%3A/ig,":").replace(/%2B/ig,"+").replace(/%3F/ig,"?").replace(/%2F/ig,"/")};x.normalizeTarget=function(c,e){if(c){if(c instanceof a)return c;if("string"===typeof c){var f=c.split("@");
switch(f.length){case 1:if(!e)return;break;case 2:c=f[0];e=f[1];break;default:c=f.slice(0,f.length-1).join("@"),e=f[f.length-1]}c=c.replace(/^(sips?|tel):/i,"");/^[-.()]*\+?[0-9\-.()]+$/.test(c)&&(c=c.replace(/[-.()]/g,""));c="".concat(q.SIP,":").concat(l(c),"@").concat(e);if(e=a.parse(c))return e}}};x.headerize=function(a){var c={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"};a=a.toLowerCase().replace(/_/g,"-").split("-");var e="",f=a.length,l;for(l=0;l<f;l++)0!==l&&(e+="-"),
e+=a[l].charAt(0).toUpperCase()+a[l].substring(1);c[e]&&(e=c[e]);return e};x.sipErrorCause=function(a){for(var c in q.SIP_ERROR_CAUSES)if(-1!==q.SIP_ERROR_CAUSES[c].indexOf(a))return q.causes[c];return q.causes.SIP_FAILURE_CODE};x.getRandomTestNetIP=function(){return"192.0.2.".concat(Math.floor(254*Math.random()+1))};x.calculateMD5=function(a){function c(a,c){var e=a&2147483648,f=c&2147483648,h=a&1073741824,l=c&1073741824;a=(a&1073741823)+(c&1073741823);return h&l?a^2147483648^e^f:h|l?a&1073741824?
a^3221225472^e^f:a^1073741824^e^f:a^e^f}function e(a,e,f,h,l,r,p){a=c(a,c(c(e&f|~e&h,l),p));return c(a<<r|a>>>32-r,e)}function f(a,e,f,h,l,r,p){a=c(a,c(c(e&h|f&~h,l),p));return c(a<<r|a>>>32-r,e)}function l(a,e,f,h,l,r,p){a=c(a,c(c(e^f^h,l),p));return c(a<<r|a>>>32-r,e)}function p(a,e,f,h,l,r,p){a=c(a,c(c(f^(e|~h),l),p));return c(a<<r|a>>>32-r,e)}function y(a){var c="",e,f;for(f=0;3>=f;f++)e=a>>>8*f&255,e="0".concat(e.toString(16)),c+=e.substr(e.length-2,2);return c}var q=[],x,G,r,E,D,t,u,w;a=function(a){a=
a.replace(/\r\n/g,"\n");for(var c="",e=0;e<a.length;e++){var f=a.charCodeAt(e);128>f?c+=String.fromCharCode(f):(127<f&&2048>f?c+=String.fromCharCode(f>>6|192):(c+=String.fromCharCode(f>>12|224),c+=String.fromCharCode(f>>6&63|128)),c+=String.fromCharCode(f&63|128))}return c}(a);q=function(a){var c,e=a.length;c=e+8;for(var f=16*((c-c%64)/64+1),h=Array(f-1),l,r=0;r<e;)c=(r-r%4)/4,l=r%4*8,h[c]|=a.charCodeAt(r)<<l,r++;c=(r-r%4)/4;h[c]|=128<<r%4*8;h[f-2]=e<<3;h[f-1]=e>>>29;return h}(a);D=1732584193;t=4023233417;
u=2562383102;w=271733878;for(a=0;a<q.length;a+=16)x=D,G=t,r=u,E=w,D=e(D,t,u,w,q[a+0],7,3614090360),w=e(w,D,t,u,q[a+1],12,3905402710),u=e(u,w,D,t,q[a+2],17,606105819),t=e(t,u,w,D,q[a+3],22,3250441966),D=e(D,t,u,w,q[a+4],7,4118548399),w=e(w,D,t,u,q[a+5],12,1200080426),u=e(u,w,D,t,q[a+6],17,2821735955),t=e(t,u,w,D,q[a+7],22,4249261313),D=e(D,t,u,w,q[a+8],7,1770035416),w=e(w,D,t,u,q[a+9],12,2336552879),u=e(u,w,D,t,q[a+10],17,4294925233),t=e(t,u,w,D,q[a+11],22,2304563134),D=e(D,t,u,w,q[a+12],7,1804603682),
w=e(w,D,t,u,q[a+13],12,4254626195),u=e(u,w,D,t,q[a+14],17,2792965006),t=e(t,u,w,D,q[a+15],22,1236535329),D=f(D,t,u,w,q[a+1],5,4129170786),w=f(w,D,t,u,q[a+6],9,3225465664),u=f(u,w,D,t,q[a+11],14,643717713),t=f(t,u,w,D,q[a+0],20,3921069994),D=f(D,t,u,w,q[a+5],5,3593408605),w=f(w,D,t,u,q[a+10],9,38016083),u=f(u,w,D,t,q[a+15],14,3634488961),t=f(t,u,w,D,q[a+4],20,3889429448),D=f(D,t,u,w,q[a+9],5,568446438),w=f(w,D,t,u,q[a+14],9,3275163606),u=f(u,w,D,t,q[a+3],14,4107603335),t=f(t,u,w,D,q[a+8],20,1163531501),
D=f(D,t,u,w,q[a+13],5,2850285829),w=f(w,D,t,u,q[a+2],9,4243563512),u=f(u,w,D,t,q[a+7],14,1735328473),t=f(t,u,w,D,q[a+12],20,2368359562),D=l(D,t,u,w,q[a+5],4,4294588738),w=l(w,D,t,u,q[a+8],11,2272392833),u=l(u,w,D,t,q[a+11],16,1839030562),t=l(t,u,w,D,q[a+14],23,4259657740),D=l(D,t,u,w,q[a+1],4,2763975236),w=l(w,D,t,u,q[a+4],11,1272893353),u=l(u,w,D,t,q[a+7],16,4139469664),t=l(t,u,w,D,q[a+10],23,3200236656),D=l(D,t,u,w,q[a+13],4,681279174),w=l(w,D,t,u,q[a+0],11,3936430074),u=l(u,w,D,t,q[a+3],16,3572445317),
t=l(t,u,w,D,q[a+6],23,76029189),D=l(D,t,u,w,q[a+9],4,3654602809),w=l(w,D,t,u,q[a+12],11,3873151461),u=l(u,w,D,t,q[a+15],16,530742520),t=l(t,u,w,D,q[a+2],23,3299628645),D=p(D,t,u,w,q[a+0],6,4096336452),w=p(w,D,t,u,q[a+7],10,1126891415),u=p(u,w,D,t,q[a+14],15,2878612391),t=p(t,u,w,D,q[a+5],21,4237533241),D=p(D,t,u,w,q[a+12],6,1700485571),w=p(w,D,t,u,q[a+3],10,2399980690),u=p(u,w,D,t,q[a+10],15,4293915773),t=p(t,u,w,D,q[a+1],21,2240044497),D=p(D,t,u,w,q[a+8],6,1873313359),w=p(w,D,t,u,q[a+15],10,4264355552),
u=p(u,w,D,t,q[a+6],15,2734768916),t=p(t,u,w,D,q[a+13],21,1309151649),D=p(D,t,u,w,q[a+4],6,4149444226),w=p(w,D,t,u,q[a+11],10,3174756917),u=p(u,w,D,t,q[a+2],15,718787259),t=p(t,u,w,D,q[a+9],21,3951481745),D=c(D,x),t=c(t,G),u=c(u,r),w=c(w,E);return(y(D)+y(t)+y(u)+y(w)).toLowerCase()};x.closeMediaStream=function(a){if(a)try{var c;if(a.getTracks){c=a.getTracks();var e=!0,f=!1,l=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var q=c[Symbol.iterator](),u;!(e=(u=q.next()).done);e=!0)u.value.stop()}catch(G){f=
!0,l=G}finally{try{e||null==q.return||q.return()}finally{if(f)throw l;}}}else{c=a.getAudioTracks();q=!0;u=!1;var y=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var l=c[Symbol.iterator](),x;!(q=(x=l.next()).done);q=!0)x.value.stop()}catch(G){u=!0,y=G}finally{try{q||null==l.return||l.return()}finally{if(u)throw y;}}c=a.getVideoTracks();q=!0;u=!1;l=void 0;try{for($jscompjssip.initSymbol(),$jscompjssip.initSymbolIterator(),e=c[Symbol.iterator]();!(q=(f=e.next()).done);q=!0)f.value.stop()}catch(G){u=
!0,l=G}finally{try{q||null==e.return||e.return()}finally{if(u)throw l;}}}}catch(G){"function"!==typeof a.stop&&"object"!==p(a.stop)||a.stop()}};x.cloneArray=function(a){return a&&a.slice()||[]}},{"./Constants":2,"./Grammar":7,"./URI":25}],27:[function(f,u,x){function p(a,e){for(var c=0;c<e.length;c++){var f=e[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}function q(a,e,c){e&&p(a.prototype,e);c&&p(a,c);return a}var a=f("./Grammar"),
y=f("debug")("JsSIP:WebSocketInterface"),e=f("debug")("JsSIP:ERROR:WebSocketInterface");e.log=console.warn.bind(console);u.exports=function(){function f(l){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");y('new() [url:"%s"]',l);this._url=l;this._ws=this._via_transport=this._sip_uri=null;var c=a.parse(l,"absoluteURI");if(-1===c)throw e("invalid WebSocket URI: ".concat(l)),new TypeError("Invalid argument: ".concat(l));if("wss"!==c.scheme&&"ws"!==c.scheme)throw e("invalid WebSocket URI scheme: ".concat(c.scheme)),
new TypeError("Invalid argument: ".concat(l));this._sip_uri="sip:".concat(c.host).concat(c.port?":".concat(c.port):"",";transport=ws");this._via_transport=c.scheme.toUpperCase()}q(f,[{key:"connect",value:function(){y("connect()");if(this.isConnected())y("WebSocket ".concat(this._url," is already connected"));else if(this.isConnecting())y("WebSocket ".concat(this._url," is connecting"));else{this._ws&&this.disconnect();y("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(l){this._onError(l)}}}},{key:"disconnect",value:function(){y("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(a){y("send()");
if(this.isConnected())return this._ws.send(a),!0;e("unable to send message, WebSocket is not open");return!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(){y("WebSocket ".concat(this._url," connected"));this.onconnect()}},{key:"_onClose",value:function(a){var c=a.wasClean,e=a.code;a=a.reason;y("WebSocket ".concat(this._url,
" closed"));!1===c&&y("WebSocket abrupt disconnection");this.ondisconnect({socket:this,error:!c,code:e,reason:a})}},{key:"_onMessage",value:function(a){a=a.data;y("received WebSocket message");this.ondata(a)}},{key:"_onError",value:function(a){e("WebSocket ".concat(this._url," error: ").concat(a))}},{key:"via_transport",get:function(){return this._via_transport},set:function(a){this._via_transport=a.toUpperCase()}},{key:"sip_uri",get:function(){return this._sip_uri}},{key:"url",get:function(){return this._url}}]);
return f}()},{"./Grammar":7,debug:30}],28:[function(f,u,x){function p(a){var c=h.getHeaders("via");a="SIP/2.0 ".concat(a," ").concat(q.REASON_PHRASE[a],"\r\n");var e=!0,f=!1,l=void 0;try{$jscompjssip.initSymbol();$jscompjssip.initSymbolIterator();for(var p=c[Symbol.iterator](),r;!(e=(r=p.next()).done);e=!0)a+="Via: ".concat(r.value,"\r\n")}catch(P){f=!0,l=P}finally{try{e||null==p.return||p.return()}finally{if(f)throw l;}}c=h.getHeader("To");h.to_tag||(c+=";tag=".concat(y.newTag()));a+="To: ".concat(c,"\r\n");
a+="From: ".concat(h.getHeader("From"),"\r\n");a+="Call-ID: ".concat(h.call_id,"\r\n");a+="CSeq: ".concat(h.cseq," ").concat(h.method,"\r\n");B.send(a+"\r\n")}var q=f("./Constants"),a=f("./SIPMessage"),y=f("./Utils"),e=f("debug")("JsSIP:sanityCheck"),E=[function(){for(var a=["from","to","call_id","cseq","via"],c=0;c<a.length;c++){var f=a[c];if(!h.hasHeader(f))return e("missing mandatory header field : ".concat(f,", dropping the response")),!1}}],l=[function(){if("sip"!==h.s("to").uri.scheme)return p(416),
!1},function(){if(!h.to_tag&&h.call_id.substr(0,5)===z.configuration.jssip_id)return p(482),!1},function(){var a=y.str_utf8_length(h.body),c=h.getHeader("content-length");if(a<c)return p(400),!1},function(){var a=h.from_tag,c=h.call_id,e=h.cseq,f;if(!h.to_tag)if(h.method===q.INVITE){if(z._transactions.ist[h.via_branch])return!1;for(var l in z._transactions.ist)if(Object.prototype.hasOwnProperty.call(z._transactions.ist,l)&&(f=z._transactions.ist[l],f.request.from_tag===a&&f.request.call_id===c&&f.request.cseq===
e))return p(482),!1}else{if(z._transactions.nist[h.via_branch])return!1;for(var u in z._transactions.nist)if(Object.prototype.hasOwnProperty.call(z._transactions.nist,u)&&(f=z._transactions.nist[u],f.request.from_tag===a&&f.request.call_id===c&&f.request.cseq===e))return p(482),!1}}],c=[function(){if(1<h.getHeaders("via").length)return e("more than one Via header field present in the response, dropping the response"),!1},function(){var a=y.str_utf8_length(h.body),c=h.getHeader("content-length");if(a<
c)return e("message body length is lower than the value in Content-Length header field, dropping the response"),!1}],h,z,B;u.exports=function(e,f,p){h=e;z=f;B=p;for(e=0;e<E.length;e++)if(!1===(0,E[e])())return!1;if(h instanceof a.IncomingRequest)for(e=0;e<l.length;e++){if(!1===(0,l[e])())return!1}else if(h instanceof a.IncomingResponse)for(e=0;e<c.length;e++)if(!1===(0,c[e])())return!1;return!0}},{"./Constants":2,"./SIPMessage":19,"./Utils":26,debug:30}],29:[function(f,u,x){function p(){this._events&&
Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=B(null),this._eventsCount=0);this._maxListeners=this._maxListeners||void 0}function q(a,c,e,f){var h,l;if("function"!==typeof e)throw new TypeError('"listener" argument must be a function');(h=a._events)?(h.newListener&&(a.emit("newListener",c,e.listener?e.listener:e),h=a._events),l=h[c]):(h=a._events=B(null),a._eventsCount=0);l?("function"===typeof l?l=h[c]=f?[e,l]:[l,e]:f?l.unshift(e):l.push(e),l.warned||(e=void 0===a._maxListeners?
p.defaultMaxListeners:a._maxListeners)&&0<e&&l.length>e&&(l.warned=!0,e=Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(c)+'" listeners added. Use emitter.setMaxListeners() to increase limit.'),e.name="MaxListenersExceededWarning",e.emitter=a,e.type=c,e.count=l.length,"object"===typeof console&&console.warn&&console.warn("%s: %s",e.name,e.message))):(h[c]=e,++a._eventsCount);return a}function a(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=
!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var a=Array(arguments.length),c=0;c<a.length;++c)a[c]=arguments[c];this.listener.apply(this.target,a)}}function y(c,e,f){c={fired:!1,wrapFn:void 0,target:c,type:e,listener:f};e=M.call(a,c);e.listener=f;return c.wrapFn=
e}function e(a,c,e){a=a._events;if(!a)return[];c=a[c];if(!c)return[];if("function"===typeof c)return e?[c.listener||c]:[c];if(e)for(e=Array(c.length),a=0;a<e.length;++a)e[a]=c[a].listener||c[a];else e=l(c,c.length);return e}function E(a){var c=this._events;if(c){a=c[a];if("function"===typeof a)return 1;if(a)return a.length}return 0}function l(a,c){for(var e=Array(c),f=0;f<c;++f)e[f]=a[f];return e}function c(a){var c=function(){};c.prototype=a;return new c}function h(a){var c=[],e;for(e in a)Object.prototype.hasOwnProperty.call(a,
e)&&c.push(e);return e}function z(a){var c=this;return function(){return c.apply(a,arguments)}}var B=Object.create||c,F=Object.keys||h,M=Function.prototype.bind||z;u.exports=p;p.EventEmitter=p;p.prototype._events=void 0;p.prototype._maxListeners=void 0;var I=10,L;try{f={},Object.defineProperty&&Object.defineProperty(f,"x",{value:0}),L=0===f.x}catch(K){L=!1}L?Object.defineProperty(p,"defaultMaxListeners",{enumerable:!0,get:function(){return I},set:function(a){if("number"!==typeof a||0>a||a!==a)throw new TypeError('"defaultMaxListeners" must be a positive number');
I=a}}):p.defaultMaxListeners=I;p.prototype.setMaxListeners=function(a){if("number"!==typeof a||0>a||isNaN(a))throw new TypeError('"n" argument must be a positive number');this._maxListeners=a;return this};p.prototype.getMaxListeners=function(){return void 0===this._maxListeners?p.defaultMaxListeners:this._maxListeners};p.prototype.emit=function(a){var c,e,f,h,p;f="error"===a;if(p=this._events)f=f&&null==p.error;else if(!f)return!1;if(f){1<arguments.length&&(c=arguments[1]);if(c instanceof Error)throw c;
p=Error('Unhandled "error" event. ('+c+")");p.context=c;throw p;}c=p[a];if(!c)return!1;p="function"===typeof c;e=arguments.length;switch(e){case 1:if(p)c.call(this);else for(p=c.length,c=l(c,p),f=0;f<p;++f)c[f].call(this);break;case 2:f=arguments[1];if(p)c.call(this,f);else for(p=c.length,c=l(c,p),e=0;e<p;++e)c[e].call(this,f);break;case 3:f=arguments[1];e=arguments[2];if(p)c.call(this,f,e);else for(p=c.length,c=l(c,p),h=0;h<p;++h)c[h].call(this,f,e);break;case 4:f=arguments[1];e=arguments[2];h=arguments[3];
if(p)c.call(this,f,e,h);else{p=c.length;c=l(c,p);for(var q=0;q<p;++q)c[q].call(this,f,e,h)}break;default:f=Array(e-1);for(h=1;h<e;h++)f[h-1]=arguments[h];if(p)c.apply(this,f);else for(p=c.length,c=l(c,p),e=0;e<p;++e)c[e].apply(this,f)}return!0};p.prototype.addListener=function(a,c){return q(this,a,c,!1)};p.prototype.on=p.prototype.addListener;p.prototype.prependListener=function(a,c){return q(this,a,c,!0)};p.prototype.once=function(a,c){if("function"!==typeof c)throw new TypeError('"listener" argument must be a function');
this.on(a,y(this,a,c));return this};p.prototype.prependOnceListener=function(a,c){if("function"!==typeof c)throw new TypeError('"listener" argument must be a function');this.prependListener(a,y(this,a,c));return this};p.prototype.removeListener=function(a,c){var e,f,h,l,p;if("function"!==typeof c)throw new TypeError('"listener" argument must be a function');f=this._events;if(!f)return this;e=f[a];if(!e)return this;if(e===c||e.listener===c)0===--this._eventsCount?this._events=B(null):(delete f[a],
f.removeListener&&this.emit("removeListener",a,e.listener||c));else if("function"!==typeof e){h=-1;for(l=e.length-1;0<=l;l--)if(e[l]===c||e[l].listener===c){p=e[l].listener;h=l;break}if(0>h)return this;if(0===h)e.shift();else{l=h+1;for(var q=e.length;l<q;h+=1,l+=1)e[h]=e[l];e.pop()}1===e.length&&(f[a]=e[0]);f.removeListener&&this.emit("removeListener",a,p||c)}return this};p.prototype.removeAllListeners=function(a){var c,e;e=this._events;if(!e)return this;if(!e.removeListener)return 0===arguments.length?
(this._events=B(null),this._eventsCount=0):e[a]&&(0===--this._eventsCount?this._events=B(null):delete e[a]),this;if(0===arguments.length){c=F(e);var f;for(e=0;e<c.length;++e)f=c[e],"removeListener"!==f&&this.removeAllListeners(f);this.removeAllListeners("removeListener");this._events=B(null);this._eventsCount=0;return this}c=e[a];if("function"===typeof c)this.removeListener(a,c);else if(c)for(e=c.length-1;0<=e;e--)this.removeListener(a,c[e]);return this};p.prototype.listeners=function(a){return e(this,
a,!0)};p.prototype.rawListeners=function(a){return e(this,a,!1)};p.listenerCount=function(a,c){return"function"===typeof a.listenerCount?a.listenerCount(c):E.call(a,c)};p.prototype.listenerCount=E;p.prototype.eventNames=function(){return 0<this._eventsCount?Reflect.ownKeys(this._events):[]}},{}],30:[function(f,u,x){(function(p){x.log=function(a){for(var f=[],e=0;e<arguments.length;++e)f[e-0]=arguments[e];return"object"===typeof console&&console.log&&console.log.apply(console,[].concat($jscompjssip.arrayFromIterable(f)))};
x.formatArgs=function(a){a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+u.exports.humanize(this.diff);if(this.useColors){var f="color: "+this.color;a.splice(1,0,f,"color: inherit");var e=0,p=0;a[0].replace(/%[a-zA-Z%]/g,function(a){"%%"!==a&&(e++,"%c"===a&&(p=e))});a.splice(p,0,f)}};x.save=function(a){try{a?x.storage.setItem("debug",a):x.storage.removeItem("debug")}catch(y){}};x.load=function(){var a;try{a=x.storage.getItem("debug")}catch(y){}!a&&
"undefined"!==typeof p&&"env"in p&&(a=p.env.DEBUG);return a};x.useColors=function(){return"undefined"!==typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs)?!0:"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:"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&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)};var q;a:{try{q=localStorage;break a}catch(a){}q=void 0}x.storage=q;x.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".split(" ");
u.exports=f("./common")(x);u.exports.formatters.j=function(a){try{return JSON.stringify(a)}catch(y){return"[UnexpectedJSONParseError]: "+y.message}}}).call(this,f("_process"))},{"./common":31,_process:33}],31:[function(f,u,x){u.exports=function(p){function q(e){for(var c=0,f=0;f<e.length;f++)c=(c<<5)-c+e.charCodeAt(f),c|=0;return a.colors[Math.abs(c)%a.colors.length]}function a(f){function c(e){for(var f=[],l=0;l<arguments.length;++l)f[l-0]=arguments[l];if(c.enabled){l=Number(new Date);c.diff=l-(h||
l);c.prev=h;h=c.curr=l;f[0]=a.coerce(f[0]);"string"!==typeof f[0]&&f.unshift("%O");var p=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,function(e,h){if("%%"===e)return e;p++;h=a.formatters[h];"function"===typeof h&&(e=h.call(c,f[p]),f.splice(p,1),p--);return e});a.formatArgs.call(c,f);(c.log||a.log).apply(c,f)}}var h;c.namespace=f;c.enabled=a.enabled(f);c.useColors=a.useColors();c.color=q(f);c.destroy=u;c.extend=e;"function"===typeof a.init&&a.init(c);a.instances.push(c);return c}function u(){var e=a.instances.indexOf(this);
return-1!==e?(a.instances.splice(e,1),!0):!1}function e(e,c){return a(this.namespace+("undefined"===typeof c?":":c)+e)}function x(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}a.debug=a;a.default=a;a.coerce=function(a){return a instanceof Error?a.stack||a.message:a};a.disable=function(){var e=[].concat($jscompjssip.arrayFromIterable(a.names.map(x)),$jscompjssip.arrayFromIterable(a.skips.map(x).map(function(a){return"-"+a}))).join(",");a.enable("");return e};a.enable=function(e){a.save(e);
a.names=[];a.skips=[];var c,f=("string"===typeof e?e:"").split(/[\s,]+/),l=f.length;for(c=0;c<l;c++)f[c]&&(e=f[c].replace(/\*/g,".*?"),"-"===e[0]?a.skips.push(new RegExp("^"+e.substr(1)+"$")):a.names.push(new RegExp("^"+e+"$")));for(c=0;c<a.instances.length;c++)e=a.instances[c],e.enabled=a.enabled(e.namespace)};a.enabled=function(e){if("*"===e[e.length-1])return!0;var c,f;c=0;for(f=a.skips.length;c<f;c++)if(a.skips[c].test(e))return!1;c=0;for(f=a.names.length;c<f;c++)if(a.names[c].test(e))return!0;
return!1};a.humanize=f("ms");Object.keys(p).forEach(function(e){a[e]=p[e]});a.instances=[];a.names=[];a.skips=[];a.formatters={};a.selectColor=q;a.enable(a.load());return a}},{ms:32}],32:[function(f,u,x){function p(a){a=String(a);if(!(100<a.length)&&(a=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a))){var f=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case "years":case "year":case "yrs":case "yr":case "y":return 315576E5*
f;case "weeks":case "week":case "w":return 6048E5*f;case "days":case "day":case "d":return 864E5*f;case "hours":case "hour":case "hrs":case "hr":case "h":return 36E5*f;case "minutes":case "minute":case "mins":case "min":case "m":return 6E4*f;case "seconds":case "second":case "secs":case "sec":case "s":return 1E3*f;case "milliseconds":case "millisecond":case "msecs":case "msec":case "ms":return f}}}function q(a,f,e,p){return Math.round(a/e)+" "+p+(f>=1.5*e?"s":"")}u.exports=function(a,f){f=f||{};var e=
typeof a;if("string"===e&&0<a.length)return p(a);if("number"===e&&!1===isNaN(a))return f.long?(f=Math.abs(a),a=864E5<=f?q(a,f,864E5,"day"):36E5<=f?q(a,f,36E5,"hour"):6E4<=f?q(a,f,6E4,"minute"):1E3<=f?q(a,f,1E3,"second"):a+" ms"):(f=Math.abs(a),a=864E5<=f?Math.round(a/864E5)+"d":36E5<=f?Math.round(a/36E5)+"h":6E4<=f?Math.round(a/6E4)+"m":1E3<=f?Math.round(a/1E3)+"s":a+"ms"),a;throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a));}},{}],33:[function(f,u,x){function p(){throw Error("setTimeout has not been defined");
}function q(){throw Error("clearTimeout has not been defined");}function a(a){if(h===setTimeout)return setTimeout(a,0);if((h===p||!h)&&setTimeout)return h=setTimeout,setTimeout(a,0);try{return h(a,0)}catch(K){try{return h.call(null,a,0)}catch(G){return h.call(this,a,0)}}}function y(a){if(z===clearTimeout)return clearTimeout(a);if((z===q||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(a);try{return z(a)}catch(K){try{return z.call(null,a)}catch(G){return z.call(this,a)}}}function e(){F&&M&&(F=
!1,M.length?B=M.concat(B):I=-1,B.length&&E())}function E(){if(!F){var c=a(e);F=!0;for(var f=B.length;f;){M=B;for(B=[];++I<f;)M&&M[I].run();I=-1;f=B.length}M=null;F=!1;y(c)}}function l(a,c){this.fun=a;this.array=c}function c(){}f=u.exports={};var h,z;try{h="function"===typeof setTimeout?setTimeout:p}catch(L){h=p}try{z="function"===typeof clearTimeout?clearTimeout:q}catch(L){z=q}var B=[],F=!1,M,I=-1;f.nextTick=function(c){var e=Array(arguments.length-1);if(1<arguments.length)for(var f=1;f<arguments.length;f++)e[f-
1]=arguments[f];B.push(new l(c,e));1!==B.length||F||a(E)};l.prototype.run=function(){this.fun.apply(null,this.array)};f.title="browser";f.browser=!0;f.env={};f.argv=[];f.version="";f.versions={};f.on=c;f.addListener=c;f.once=c;f.off=c;f.removeListener=c;f.removeAllListeners=c;f.emit=c;f.prependListener=c;f.prependOnceListener=c;f.listeners=function(a){return[]};f.binding=function(a){throw Error("process.binding is not supported");};f.cwd=function(){return"/"};f.chdir=function(a){throw Error("process.chdir is not supported");
};f.umask=function(){return 0}},{}],34:[function(f,u,x){var p=u.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:"username sessionId sessionVersion netType ipVer address".split(" "),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(f){return f.encoding?"rtpmap:%d %s/%s/%s":f.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(f){return null!=f.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%d trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload",
"type","subtype"],format:function(f){return null!=f.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))? (\S*)(?: (\S*))?/,names:["value","direction","uri","config"],format:function(f){return"extmap:%d"+(f.direction?"/%s":"%v")+" %s"+(f.config?" %s":"")}},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(f){return null!=f.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",
reg:/^setup:(\w*)/,format:"setup:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\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".split(" "),format:function(f){var a;a="candidate:%s %d %s %d %s %d typ %s"+(null!=f.raddr?" raddr %s rport %d":"%v%v");a+=null!=f.tcptype?
" tcptype %s":"%v";null!=f.generation&&(a+=" generation %d");a+=null!=f["network-id"]?" network-id %d":"%v";return a+=null!=f["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(f){var a="ssrc:%d";null!=
f.attribute&&(a+=" %s",null!=f.value&&(a+=":%s"));return a}},{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(f){return null!=f.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(f){return f.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:/^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(f){return"imageattr:%s %s %s"+(f.dir2?" %s %s":"")}},{name:"simulcast",reg:/^simulcast:(send|recv) ([a-zA-Z0-9\-_~;,]+)(?:\s?(send|recv) ([a-zA-Z0-9\-_~;,]+))?$/,names:["dir1","list1","dir2","list2"],format:function(f){return"simulcast:%s %s"+(f.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:"invalid",names:["value"]}]};Object.keys(p).forEach(function(f){p[f].forEach(function(a){a.reg||
(a.reg=/(.*)/);a.format||(a.format="%s")})})},{}],35:[function(f,u,x){u=f("./parser");f=f("./writer");x.write=f;x.parse=u.parse;x.parseFmtpConfig=u.parseFmtpConfig;x.parseParams=u.parseParams;x.parsePayloads=u.parsePayloads;x.parseRemoteCandidates=u.parseRemoteCandidates;x.parseImageAttributes=u.parseImageAttributes;x.parseSimulcastStreamList=u.parseSimulcastStreamList},{"./parser":36,"./writer":37}],36:[function(f,u,x){var p=function(a){return String(Number(a))===a?Number(a):a},q=f("./grammar"),
a=RegExp.prototype.test.bind(/^([a-z])=(.*)/);x.parse=function(e){var f={},l=[],c=f;e.split(/(\r\n|\r|\n)/).filter(a).forEach(function(a){var e=a[0],f=a.slice(2);"m"===e&&(l.push({rtp:[],fmtp:[]}),c=l[l.length-1]);for(a=0;a<(q[e]||[]).length;a+=1){var h=q[e][a];if(h.reg.test(f)){e=h;a=c;h=f;f=e.name&&e.names;e.push&&!a[e.push]?a[e.push]=[]:f&&!a[e.name]&&(a[e.name]={});var f=e.push?{}:f?a[e.name]:a,h=h.match(e.reg),u=f,x=e.names,y=e.name;if(y&&!x)u[y]=p(h[1]);else for(y=0;y<x.length;y+=1)null!=h[y+
1]&&(u[x[y]]=p(h[y+1]));e.push&&a[e.push].push(f);break}}});f.media=l;return f};var y=function(a,f){var e=f.split(/=(.+)/,2);2===e.length?a[e[0]]=p(e[1]):1===e.length&&1<f.length&&(a[e[0]]=void 0);return a};x.parseParams=function(a){return a.split(/\;\s?/).reduce(y,{})};x.parseFmtpConfig=x.parseParams;x.parsePayloads=function(a){return a.split(" ").map(Number)};x.parseRemoteCandidates=function(a){var e=[];a=a.split(" ").map(p);for(var f=0;f<a.length;f+=3)e.push({component:a[f],ip:a[f+1],port:a[f+
2]});return e};x.parseImageAttributes=function(a){return a.split(" ").map(function(a){return a.substring(1,a.length-1).split(",").reduce(y,{})})};x.parseSimulcastStreamList=function(a){return a.split(";").map(function(a){return a.split(",").map(function(a){var c=!1;"~"!==a[0]?a=p(a):(a=p(a.substring(1,a.length)),c=!0);return{scid:a,paused:c}})})}},{"./grammar":34}],37:[function(f,u,x){var p=f("./grammar"),q=/%[sdv%]/g,a=function(a){var c=1,e=arguments,f=e.length;return a.replace(q,function(a){if(c>=
f)return a;var h=e[c];c+=1;switch(a){case "%%":return"%";case "%s":return String(h);case "%d":return Number(h);case "%v":return""}})},y=function(e,c,f){var h=c.format instanceof Function?c.format(c.push?f:f[c.name]):c.format;e=[e+"="+h];if(c.names)for(h=0;h<c.names.length;h+=1){var l=c.names[h];c.name?e.push(f[c.name][l]):e.push(f[c.names[h]])}else e.push(f[c.name]);return a.apply(null,e)},e="vosiuepcbtrza".split(""),E=["i","c","b","a"];u.exports=function(a,c){c=c||{};null==a.version&&(a.version=
0);null==a.name&&(a.name=" ");a.media.forEach(function(a){null==a.payloads&&(a.payloads="")});var f=c.innerOrder||E,l=[];(c.outerOrder||e).forEach(function(c){p[c].forEach(function(e){e.name in a&&null!=a[e.name]?l.push(y(c,e,a)):e.push in a&&null!=a[e.push]&&a[e.push].forEach(function(a){l.push(y(c,e,a))})})});a.media.forEach(function(a){l.push(y("m",p.m[0],a));f.forEach(function(c){p[c].forEach(function(e){e.name in a&&null!=a[e.name]?l.push(y(c,e,a)):e.push in a&&null!=a[e.push]&&a[e.push].forEach(function(a){l.push(y(c,
e,a))})})})});return l.join("\r\n")+"\r\n"}},{"./grammar":34}],38:[function(f,u,x){u.exports={name:"jssip",title:"JsSIP",description:"the Javascript SIP library",version:"3.3.7",homepage:"https://jssip.net",author:"Jos\u00e9 Luis Mill\u00e1n <jmillan@aliax.net> (https://github.com/jmillan)",contributors:["I\u00f1aki Baz Castillo <ibc@aliax.net> (https://github.com/ibc)"],main:"lib-es5/JsSIP.js",keywords:"sip websocket webrtc node browser library".split(" "),license:"MIT",repository:{type:"git",url:"https://github.com/versatica/JsSIP.git"},
bugs:{url:"https://github.com/versatica/JsSIP/issues"},dependencies:{debug:"^4.1.1",events:"^3.0.0","sdp-transform":"^2.7.0"},devDependencies:{"@babel/core":"^7.4.3","@babel/preset-env":"^7.4.3","ansi-colors":"^3.2.4",browserify:"^16.2.3",eslint:"^5.16.0","fancy-log":"^1.3.3",gulp:"^4.0.0","gulp-babel":"^8.0.0","gulp-eslint":"^5.0.0","gulp-expect-file":"^1.0.1","gulp-header":"^2.0.7","gulp-nodeunit-runner":"^0.2.2","gulp-plumber":"^1.2.1","gulp-rename":"^1.4.0","gulp-uglify-es":"^1.0.4",pegjs:"^0.7.0",
"vinyl-buffer":"^1.0.1","vinyl-source-stream":"^2.0.0"},scripts:{lint:"gulp lint",test:"gulp test",prepublishOnly:"gulp babel"}}},{}]},{},[8])(8)});
