This file is indexed.

/usr/share/javascript/jssip/JsSIP.min.js is in libjs-jssip 0.4.0.20140212.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*global console: false*//**
 * @name JsSIP
 * @namespace
 */(function(e){var t=function(){"use strict";var e={};return Object.defineProperties(e,{version:{get:function(){return"<%= pkg.version %>"}},name:{get:function(){return"<%= pkg.title %>"}}}),e}();(function(t){var n=function(){var e=function(e,t,n){this.logger=e,this.category=t,this.label=n};return e.prototype.debug=function(e){this.logger.debug(this.category,this.label,e)},e.prototype.log=function(e){this.logger.log(this.category,this.label,e)},e.prototype.warn=function(e){this.logger.warn(this.category,this.label,e)},e.prototype.error=function(e){this.logger.error(this.category,this.label,e)},e}(),r=function(){var t,n={error:0,warn:1,log:2,debug:3},r=2,i=!0,s=null;this.loggers={},t=this.getLogger("jssip.loggerfactory"),Object.defineProperties(this,{builtinEnabled:{get:function(){return i},set:function(n){typeof n=="boolean"?i=n:t.error('invalid "builtinEnabled" parameter value: '+e.JSON.stringify(n))}},level:{get:function(){return r},set:function(i){i>=0&&i<=3?r=i:i>3?r=3:n.hasOwnProperty(i)?r=n[i]:t.error('invalid "level" parameter value: '+e.JSON.stringify(i))}},connector:{get:function(){return s},set:function(n){n===null||n===""||n===undefined?s=null:typeof n=="function"?s=n:t.error('invalid "connector" parameter value: '+e.JSON.stringify(n))}}})};r.prototype.print=function(e,t,n,r){var i=[];i.push(new Date),i.push(t),n&&i.push(n),i.push(""),typeof r=="string"?e.call(console,i.join(" | ")+r):e.call(console,r)},r.prototype.debug=function(e,t,n){this.level===3&&(this.builtinEnabled&&this.print(console.debug,e,t,n),this.connector&&this.connector("debug",e,t,n))},r.prototype.log=function(e,t,n){this.level>=2&&(this.builtinEnabled&&this.print(console.log,e,t,n),this.connector&&this.connector("log",e,t,n))},r.prototype.warn=function(e,t,n){this.level>=1&&(this.builtinEnabled&&this.print(console.warn,e,t,n),this.connector&&this.connector("warn",e,t,n))},r.prototype.error=function(e,t,n){this.builtinEnabled&&this.print(console.error,e,t,n),this.connector&&this.connector("error",e,t,n)},r.prototype.getLogger=function(e,t){var r;return t&&this.level===3?new n(this,e,t):this.loggers[e]?this.loggers[e]:(r=new n(this,e),this.loggers[e]=r,r)},t.LoggerFactory=r})(t),function(e){var t,n,r=(new e.LoggerFactory).getLogger("jssip.eventemitter"),i={MAX_LISTENERS:10};t=function(){},t.prototype={initEvents:function(e){var t;this.logger||(this.logger=r),this.maxListeners=i.MAX_LISTENERS,this.events={},this.oneTimeListeners={};for(t in e)this.logger.log("adding event "+e[t]),this.events[e[t]]=[],this.oneTimeListeners[e[t]]=[]},checkEvent:function(e){return!!this.events[e]},addListener:function(e,t){if(t===undefined)return;if(typeof t!="function"){this.logger.error("listener must be a function");return}if(!this.checkEvent(e)){this.logger.error("unable to add a listener to a nonexistent event"+e);return}this.events[e].length>=this.maxListeners&&this.logger.warn("max listeners exceeded for event "+e),this.events[e].push(t),this.logger.log("new listener added to event "+e)},on:function(e,t){this.addListener(e,t)},once:function(e,t){this.on(e,t),this.oneTimeListeners[e].push(t)},removeListener:function(e,t){var n,r,i=0;if(t===undefined)return;if(typeof t!="function")this.logger.error("listener must be a function");else if(!this.checkEvent(e)){this.logger.error("unable to remove a listener from a nonexistent event"+e);return}n=this.events[e],r=n.length;while(i<r)n[i]===t?n.splice(i,1):i++},removeAllListener:function(e){if(!this.checkEvent(e)){this.logger.error("unable to remove listeners from a nonexistent event"+e);return}this.events[e]=[],this.oneTimeListeners[e]=[]},setMaxListeners:function(e){if(typeof e!="number"||e<0){this.logger.error("listeners must be a positive number");return}this.maxListeners=e},listeners:function(e){if(!this.checkEvent(e)){this.logger.error("no event "+e);return}return this.events[e]},emit:function(t,n,r){var i,s,o,u;if(!this.checkEvent(t)){this.logger.error("unable to emit a nonexistent event"+t);return}this.logger.log("emitting event "+t),i=this.events[t],s=i.length,o=new e.Event(t,n,r);for(u=0;u<s;u++)try{i[u].call(null,o)}catch(a){this.logger.error(a.stack)}for(u in this.oneTimeListeners[t])this.removeListener(t,this.oneTimeListeners[t][u]);this.oneTimeListeners[t]=[]}},n=function(e,t,n){this.type=e,this.sender=t,this.data=n},t.C=i,e.EventEmitter=t,e.Event=n}(t),t.C={USER_AGENT:t.name+" "+t.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",AUTHENTICATION_ERROR:"Authentication Error",DIALOG_ERROR:"Dialog Error",WEBRTC_NOT_SUPPORTED:"WebRTC Not Supported",WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",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],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",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",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:"Server 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"}},function(t){var n;n={ConfigurationError:function(){var t=function(t,n){this.code=1,this.name="CONFIGURATION_ERROR",this.parameter=t,this.value=n,this.message=this.value?"Invalid value "+e.JSON.stringify(this.value)+' for parameter "'+this.parameter+'"':"Missing parameter: "+this.parameter};return t.prototype=new Error,t}(),InvalidStateError:function(){var e=function(e){this.code=2,this.name="INVALID_STATE_ERROR",this.status=e,this.message="Invalid status: "+e};return e.prototype=new Error,e}(),NotSupportedError:function(){var e=function(e){this.code=3,this.name="NOT_SUPPORTED_ERROR",this.message=e};return e.prototype=new Error,e}()},t.Exceptions=n}(t),function(e){var t,n=500,r=4e3,i=5e3;t={T1:n,T2:r,T4:i,TIMER_B:64*n,TIMER_D:0*n,TIMER_F:64*n,TIMER_H:64*n,TIMER_I:0*n,TIMER_J:0*n,TIMER_K:0*i,TIMER_L:64*n,TIMER_M:64*n,PROVISIONAL_RESPONSE_INTERVAL:6e4},e.Timers=t}(t),function(t){var n,r={STATUS_READY:0,STATUS_DISCONNECTED:1,STATUS_ERROR:2};n=function(e,t){this.logger=e.getLogger("jssip.transport"),this.ua=e,this.ws=null,this.server=t,this.reconnection_attempts=0,this.closed=!1,this.connected=!1,this.reconnectTimer=null,this.lastTransportError={},this.ua.transport=this,this.connect()},n.prototype={send:function(e){var t=e.toString();return this.ws&&this.ws.readyState===WebSocket.OPEN?(this.ua.configuration.trace_sip===!0&&this.logger.log("sending WebSocket message:\n\n"+t+"\n"),this.ws.send(t),!0):(this.logger.warn("unable to send message, WebSocket is not open"),!1)},disconnect:function(){this.ws&&(e.clearTimeout(this.reconnectTimer),this.closed=!0,this.logger.log("closing WebSocket "+this.server.ws_uri),this.ws.close()),this.reconnectTimer!==null&&(e.clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.ua.emit("disconnected",this.ua,{transport:this,code:this.lastTransportError.code,reason:this.lastTransportError.reason}))},connect:function(){var e=this;if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN&&this.ws.readyState!==WebSocket.CONNECTING))return this.logger.log("WebSocket "+this.server.ws_uri+" is already connected"),!1;this.ws&&this.ws.close(),this.logger.log("connecting to WebSocket "+this.server.ws_uri),this.ua.onTransportConnecting(this,this.reconnection_attempts===0?1:this.reconnection_attempts);try{this.ws=new WebSocket(this.server.ws_uri,"sip"),this.ws.binaryType="arraybuffer",this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(t){e.onClose(t)},this.ws.onmessage=function(t){e.onMessage(t)},this.ws.onerror=function(t){e.onError(t)}}catch(t){this.logger.warn("error connecting to WebSocket "+this.server.ws_uri+": "+t),this.lastTransportError.code=null,this.lastTransportError.reason=t.message,this.ua.onTransportError(this)}},onOpen:function(){this.connected=!0,this.logger.log("WebSocket "+this.server.ws_uri+" connected"),this.reconnectTimer!==null&&(e.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnection_attempts=0,this.closed=!1,this.ua.onTransportConnected(this)},onClose:function(e){var t=this.connected;this.connected=!1,this.lastTransportError.code=e.code,this.lastTransportError.reason=e.reason,this.logger.log("WebSocket disconnected (code: "+e.code+(e.reason?"| reason: "+e.reason:"")+")"),e.wasClean===!1&&this.logger.warn("WebSocket abrupt disconnection"),t===!0?(this.ua.onTransportClosed(this),this.closed?this.ua.emit("disconnected",this.ua,{transport:this,code:this.lastTransportError.code,reason:this.lastTransportError.reason}):this.reConnect()):this.ua.onTransportError(this)},onMessage:function(e){var n,r,i=e.data;if(i==="\r\n"){this.ua.configuration.trace_sip===!0&&this.logger.log("received WebSocket message with CRLF Keep Alive response");return}if(typeof i!="string"){try{i=String.fromCharCode.apply(null,new Uint8Array(i))}catch(s){this.logger.warn("received WebSocket binary message failed to be converted into string, message discarded");return}this.ua.configuration.trace_sip===!0&&this.logger.log("received WebSocket binary message:\n\n"+i+"\n")}else this.ua.configuration.trace_sip===!0&&this.logger.log("received WebSocket text message:\n\n"+i+"\n");n=t.Parser.parseMessage(i,this.ua);if(!n)return;if(this.ua.status===t.UA.C.STATUS_USER_CLOSED&&n instanceof t.IncomingRequest)return;if(t.sanityCheck(n,this.ua,this))if(n instanceof t.IncomingRequest)n.transport=this,this.ua.receiveRequest(n);else if(n instanceof t.IncomingResponse)switch(n.method){case t.C.INVITE:r=this.ua.transactions.ict[n.via_branch],r&&r.receiveResponse(n);break;case t.C.ACK:break;default:r=this.ua.transactions.nict[n.via_branch],r&&r.receiveResponse(n)}},onError:function(e){this.logger.warn("WebSocket connection error: "+e)},reConnect:function(){var t=this;this.reconnection_attempts+=1,this.reconnection_attempts>this.ua.configuration.ws_server_max_reconnection?(this.logger.warn("maximum reconnection attempts for WebSocket "+this.server.ws_uri),this.ua.onTransportError(this)):(this.logger.log("trying to reconnect to WebSocket "+this.server.ws_uri+" (reconnection attempt "+this.reconnection_attempts+")"),this.reconnectTimer=e.setTimeout(function(){t.connect(),t.reconnectTimer=null},this.ua.configuration.ws_server_reconnection_timeout*1e3))}},n.C=r,t.Transport=n}(t),function(e){function n(e,t){var n=t,r=0,i=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;while(r===0){i=e.indexOf("\r\n",n);if(i===-1)return i;!e.substring(i+2,i+4).match(/(^\r\n)/)&&e.charAt(i+2).match(/(^\s+)/)?n=i+2:r=i}return r}function r(t,n,r,i){var s,o,u,a,f=n.indexOf(":",r),l=n.substring(r,f).trim(),c=n.substring(f+1,i).trim();switch(l.toLowerCase()){case"via":case"v":t.addHeader("via",c),t.getHeaders("via").length===1?(a=t.parseHeader("Via"),a&&(t.via=a,t.via_branch=a.branch)):a=0;break;case"from":case"f":t.setHeader("from",c),a=t.parseHeader("from"),a&&(t.from=a,t.from_tag=a.getParam("tag"));break;case"to":case"t":t.setHeader("to",c),a=t.parseHeader("to"),a&&(t.to=a,t.to_tag=a.getParam("tag"));break;case"record-route":a=e.Grammar.parse(c,"Record_Route"),a===-1&&(a=undefined),u=a.length;for(o=0;o<u;o++)s=a[o],t.addHeader("record-route",c.substring(s.possition,s.offset)),t.headers["Record-Route"][t.getHeaders("record-route").length-1].parsed=s.parsed;break;case"call-id":case"i":t.setHeader("call-id",c),a=t.parseHeader("call-id"),a&&(t.call_id=c);break;case"contact":case"m":a=e.Grammar.parse(c,"Contact"),a===-1&&(a=undefined),u=a.length;for(o=0;o<u;o++)s=a[o],t.addHeader("contact",c.substring(s.possition,s.offset)),t.headers.Contact[t.getHeaders("contact").length-1].parsed=s.parsed;break;case"content-length":case"l":t.setHeader("content-length",c),a=t.parseHeader("content-length");break;case"content-type":case"c":t.setHeader("content-type",c),a=t.parseHeader("content-type");break;case"cseq":t.setHeader("cseq",c),a=t.parseHeader("cseq"),a&&(t.cseq=a.value),t instanceof e.IncomingResponse&&(t.method=a.method);break;case"max-forwards":t.setHeader("max-forwards",c),a=t.parseHeader("max-forwards");break;case"www-authenticate":t.setHeader("www-authenticate",c),a=t.parseHeader("www-authenticate");break;case"proxy-authenticate":t.setHeader("proxy-authenticate",c),a=t.parseHeader("proxy-authenticate");break;default:t.setHeader(l,c),a=0}return a===undefined?{error:'error parsing header "'+l+'"'}:!0}var t;t={},t.parseMessage=function(t,i){var s,o,u,a,f,l=0,c=t.indexOf("\r\n"),h=i.getLogger("jssip.parser");if(c===-1){h.warn("no CRLF found, not a SIP message, discarded");return}o=t.substring(0,c),f=e.Grammar.parse(o,"Request_Response");if(f===-1){h.warn('error parsing first line of SIP message: "'+o+'"');return}f.status_code?(s=new e.IncomingResponse(i),s.status_code=f.status_code,s.reason_phrase=f.reason_phrase):(s=new e.IncomingRequest(i),s.method=f.method,s.ruri=f.uri),s.data=t,l=c+2;for(;;){c=n(t,l);if(c===-2){a=l+2;break}if(c===-1){f.error("malformed message");return}f=r(s,t,l,c);if(f!==!0){h.error(f.error);return}l=c+2}return s.hasHeader("content-length")?(u=s.getHeader("content-length"),s.body=t.substr(a,u)):s.body=t.substring(a),s},e.Parser=t}(t),function(e){var t,n,r,i;t=function(t,n,r,i,s,o){var u,a,f,l;i=i||{};if(!t||!n||!r)return null;this.logger=r.getLogger("jssip.sipmessage"),this.ua=r,this.headers={},this.method=t,this.ruri=n,this.body=o,this.extraHeaders=s&&s.slice()||[],i.route_set?this.setHeader("route",i.route_set):r.configuration.use_preloaded_route&&this.setHeader("route",r.transport.server.sip_uri),this.setHeader("via",""),this.setHeader("max-forwards",e.UA.C.MAX_FORWARDS),u=i.to_display_name||i.to_display_name===0?'"'+i.to_display_name+'" ':"",u+="<"+(i.to_uri||n)+">",u+=i.to_tag?";tag="+i.to_tag:"",this.to=new e.NameAddrHeader.parse(u),this.setHeader("to",u),i.from_display_name||i.from_display_name===0?a='"'+i.from_display_name+'" ':r.configuration.display_name?a='"'+r.configuration.display_name+'" ':a="",a+="<"+(i.from_uri||r.configuration.uri)+">;tag=",a+=i.from_tag||e.Utils.newTag(),this.from=new e.NameAddrHeader.parse(a),this.setHeader("from",a),f=i.call_id||r.configuration.jssip_id+e.Utils.createRandomToken(15),this.call_id=f,this.setHeader("call-id",f),l=i.cseq||Math.floor(Math.random()*1e4),this.cseq=l,this.setHeader("cseq",l+" "+t)},t.prototype={setHeader:function(t,n){this.headers[e.Utils.headerize(t)]=n instanceof Array?n:[n]},getHeader:function(t){var n,r,i=this.extraHeaders.length,s=this.headers[e.Utils.headerize(t)];if(s){if(s[0])return s[0]}else{n=new RegExp("^\\s*"+t+"\\s*:","i");for(r=0;r<i;r++){s=this.extraHeaders[r];if(n.test(s))return s.substring(s.indexOf(":")+1).trim()}}return},getHeaders:function(t){var n,r,i,s=this.headers[e.Utils.headerize(t)],o=[];if(s){r=s.length;for(n=0;n<r;n++)o.push(s[n]);return o}r=this.extraHeaders.length,i=new RegExp("^\\s*"+t+"\\s*:","i");for(n=0;n<r;n++)s=this.extraHeaders[n],i.test(s)&&o.push(s.substring(s.indexOf(":")+1).trim());return o},hasHeader:function(t){var n,r,i=this.extraHeaders.length;if(this.headers[e.Utils.headerize(t)])return!0;n=new RegExp("^\\s*"+t+"\\s*:","i");for(r=0;r<i;r++)if(n.test(this.extraHeaders[r]))return!0;return!1},toString:function(){var t="",n,r,i,s=[];t+=this.method+" "+this.ruri+" SIP/2.0\r\n";for(n in this.headers){r=this.headers[n].length;for(i=0;i<r;i++)t+=n+": "+this.headers[n][i]+"\r\n"}r=this.extraHeaders.length;for(i=0;i<r;i++)t+=this.extraHeaders[i].trim()+"\r\n";switch(this.method){case e.C.REGISTER:s.push("path","gruu");break;case e.C.INVITE:(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&s.push("gruu")}return s.push("outbound"),t+="Allow: "+e.Utils.getAllowedMethods(this.ua)+"\r\n",t+="Supported: "+s+"\r\n",t+="User-Agent: "+e.C.USER_AGENT+"\r\n",this.body?(r=e.Utils.str_utf8_length(this.body),t+="Content-Length: "+r+"\r\n\r\n",t+=this.body):t+="Content-Length: 0\r\n\r\n",t}},n=function(){this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null},n.prototype={addHeader:function(t,n){var r={raw:n};t=e.Utils.headerize(t),this.headers[t]?this.headers[t].push(r):this.headers[t]=[r]},getHeader:function(t){var n=this.headers[e.Utils.headerize(t)];if(!n)return;if(n[0])return n[0].raw},getHeaders:function(t){var n,r,i=this.headers[e.Utils.headerize(t)],s=[];if(!i)return[];r=i.length;for(n=0;n<r;n++)s.push(i[n].raw);return s},hasHeader:function(t){return this.headers[e.Utils.headerize(t)]?!0:!1},parseHeader:function(t,n){var r,i,s;t=e.Utils.headerize(t),n=n||0;if(!this.headers[t]){this.logger.log('header "'+t+'" not present');return}if(n>=this.headers[t].length){this.logger.log('not so many "'+t+'" headers present');return}r=this.headers[t][n],i=r.raw;if(r.parsed)return r.parsed;s=e.Grammar.parse(i,t.replace(/-/g,"_"));if(s===-1){this.headers[t].splice(n,1),this.logger.warn('error parsing "'+t+'" header field with value "'+i+'"');return}return r.parsed=s,s},s:function(e,t){return this.parseHeader(e,t)},setHeader:function(t,n){var r={raw:n};this.headers[e.Utils.headerize(t)]=[r]},toString:function(){return this.data}},r=function(e){this.logger=e.getLogger("jssip.sipmessage"),this.ua=e,this.headers={},this.ruri=null,this.transport=null,this.server_transaction=null},r.prototype=new n,r.prototype.reply=function(t,n,r,i,s,o){var u,a,f,l,c,h=[],p=this.getHeader("To"),d=0,v=0;t=t||null,n=n||null;if(!t||t<100||t>699)throw new TypeError("Invalid status_code: "+t);if(!(!n||typeof n=="string"||n instanceof String))throw new TypeError("Invalid reason_phrase: "+n);n=n||e.C.REASON_PHRASE[t]||"",r=r&&r.slice()||[],c="SIP/2.0 "+t+" "+n+"\r\n";if(this.method===e.C.INVITE&&t>100&&t<=200){u=this.getHeaders("record-route"),f=u.length;for(d;d<f;d++)c+="Record-Route: "+u[d]+"\r\n"}a=this.getHeaders("via"),f=a.length;for(v;v<f;v++)c+="Via: "+a[v]+"\r\n";!this.to_tag&&t>100?p+=";tag="+e.Utils.newTag():this.to_tag&&!this.s("to").hasParam("tag")&&(p+=";tag="+this.to_tag),c+="To: "+p+"\r\n",c+="From: "+this.getHeader("From")+"\r\n",c+="Call-ID: "+this.call_id+"\r\n",c+="CSeq: "+this.cseq+" "+this.method+"\r\n",f=r.length;for(l=0;l<f;l++)c+=r[l].trim()+"\r\n";switch(this.method){case e.C.INVITE:(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&h.push("gruu")}h.push("outbound"),this.method===e.C.OPTIONS?(c+="Allow: "+e.Utils.getAllowedMethods(this.ua)+"\r\n",c+="Accept: "+e.UA.C.ACCEPTED_BODY_TYPES+"\r\n"):t===405&&(c+="Allow: "+e.Utils.getAllowedMethods(this.ua)+"\r\n"),c+="Supported: "+h+"\r\n",i?(f=e.Utils.str_utf8_length(i),c+="Content-Type: application/sdp\r\n",c+="Content-Length: "+f+"\r\n\r\n",c+=i):c+="Content-Length: 0\r\n\r\n",this.server_transaction.receiveResponse(t,c,s,o)},r.prototype.reply_sl=function(t,n){var r,i,s=0,o=this.getHeaders("via"),u=o.length;t=t||null,n=n||null;if(!t||t<100||t>699)throw new TypeError("Invalid status_code: "+t);if(!(!n||typeof n=="string"||n instanceof String))throw new TypeError("Invalid reason_phrase: "+n);n=n||e.C.REASON_PHRASE[t]||"",i="SIP/2.0 "+t+" "+n+"\r\n";for(s;s<u;s++)i+="Via: "+o[s]+"\r\n";r=this.getHeader("To"),!this.to_tag&&t>100?r+=";tag="+e.Utils.newTag():this.to_tag&&!this.s("to").hasParam("tag")&&(r+=";tag="+this.to_tag),i+="To: "+r+"\r\n",i+="From: "+this.getHeader("From")+"\r\n",i+="Call-ID: "+this.call_id+"\r\n",i+="CSeq: "+this.cseq+" "+this.method+"\r\n",i+="Content-Length: 0\r\n\r\n",this.transport.send(i)},i=function(e){this.logger=e.getLogger("jssip.sipmessage"),this.headers={},this.status_code=null,this.reason_phrase=null},i.prototype=new n,e.OutgoingRequest=t,e.IncomingRequest=r,e.IncomingResponse=i}(t),function(t){var n;n=function(e,n,r,i,s,o){var u,a;if(!r)throw new TypeError('missing or invalid "host" parameter');e=e||t.C.SIP,this.parameters={},this.headers={};for(u in s)this.setParam(u,s[u]);for(a in o)this.setHeader(a,o[a]);Object.defineProperties(this,{scheme:{get:function(){return e},set:function(t){e=t.toLowerCase()}},user:{get:function(){return n},set:function(e){n=e}},host:{get:function(){return r},set:function(e){r=e.toLowerCase()}},port:{get:function(){return i},set:function(e){i=e===0?e:parseInt(e,10)||null}}})},n.prototype={setParam:function(e,t){e&&(this.parameters[e.toLowerCase()]=typeof t=="undefined"||t===null?null:t.toString().toLowerCase())},getParam:function(e){if(e)return this.parameters[e.toLowerCase()]},hasParam:function(e){if(e)return this.parameters.hasOwnProperty(e.toLowerCase())&&!0||!1},deleteParam:function(e){var t;e=e.toLowerCase();if(this.parameters.hasOwnProperty(e))return t=this.parameters[e],delete this.parameters[e],t},clearParams:function(){this.parameters={}},setHeader:function(e,n){this.headers[t.Utils.headerize(e)]=n instanceof Array?n:[n]},getHeader:function(e){if(e)return this.headers[t.Utils.headerize(e)]},hasHeader:function(e){if(e)return this.headers.hasOwnProperty(t.Utils.headerize(e))&&!0||!1},deleteHeader:function(e){var n;e=t.Utils.headerize(e);if(this.headers.hasOwnProperty(e))return n=this.headers[e],delete this.headers[e],n},clearHeaders:function(){this.headers={}},clone:function(){return new n(this.scheme,this.user,this.host,this.port,e.JSON.parse(e.JSON.stringify(this.parameters)),e.JSON.parse(e.JSON.stringify(this.headers)))},toString:function(){var e,n,r,i,s=[];i=this.scheme+":",this.user&&(i+=t.Utils.escapeUser(this.user)+"@"),i+=this.host;if(this.port||this.port===0)i+=":"+this.port;for(n in this.parameters)i+=";"+n,this.parameters[n]!==null&&(i+="="+this.parameters[n]);for(e in this.headers)for(r in this.headers[e])s.push(e+"="+this.headers[e][r]);return s.length>0&&(i+="?"+s.join("&")),i},toAor:function(e){var n;return n=this.scheme+":",this.user&&(n+=t.Utils.escapeUser(this.user)+"@"),n+=this.host,e&&(this.port||this.port===0)&&(n+=":"+this.port),n}},n.parse=function(e){return e=t.Grammar.parse(e,"SIP_URI"),e!==-1?e:undefined},t.URI=n}(t),function(t){var n;n=function(e,n,r){var i;if(!e||!(e instanceof t.URI))throw new TypeError('missing or invalid "uri" parameter');this.uri=e,this.parameters={};for(i in r)this.setParam(i,r[i]);Object.defineProperties(this,{display_name:{get:function(){return n},set:function(e){n=e===0?"0":e}}})},n.prototype={setParam:function(e,t){e&&(this.parameters[e.toLowerCase()]=typeof t=="undefined"||t===null?null:t.toString())},getParam:function(e){if(e)return this.parameters[e.toLowerCase()]},hasParam:function(e){if(e)return this.parameters.hasOwnProperty(e.toLowerCase())&&!0||!1},deleteParam:function(e){var t;e=e.toLowerCase();if(this.parameters.hasOwnProperty(e))return t=this.parameters[e],delete this.parameters[e],t},clearParams:function(){this.parameters={}},clone:function(){return new n(this.uri.clone(),this.display_name,e.JSON.parse(e.JSON.stringify(this.parameters)))},toString:function(){var e,t;e=this.display_name||this.display_name===0?'"'+this.display_name+'" ':"",e+="<"+this.uri.toString()+">";for(t in this.parameters)e+=";"+t,this.parameters[t]!==null&&(e+="="+this.parameters[t]);return e}},n.parse=function(e){return e=t.Grammar.parse(e,"Name_Addr_Header"),e!==-1?e:undefined},t.NameAddrHeader=n}(t),function(t){var n={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"},r=function(e,t,r){var i,s=["stateChanged"];this.type=n.NON_INVITE_CLIENT,this.transport=r,this.id="z9hG4bK"+Math.floor(Math.random()*1e7),this.request_sender=e,this.request=t,this.logger=e.ua.getLogger("jssip.transaction.nict",this.id),i="SIP/2.0/"+(e.ua.configuration.hack_via_tcp?"TCP":r.server.scheme),i+=" "+e.ua.configuration.via_host+";branch="+this.id,this.request.setHeader("via",i),this.request_sender.ua.newTransaction(this),this.initEvents(s)};r.prototype=new t.EventEmitter,r.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged",this)},r.prototype.send=function(){var r=this;this.stateChanged(n.STATUS_TRYING),this.F=e.setTimeout(function(){r.timer_F()},t.Timers.TIMER_F),this.transport.send(this.request)||this.onTransportError()},r.prototype.onTransportError=function(){this.logger.log("transport error occurred, deleting non-INVITE client transaction "+this.id),e.clearTimeout(this.F),e.clearTimeout(this.K),this.request_sender.ua.destroyTransaction(this),this.request_sender.onTransportError()},r.prototype.timer_F=function(){this.logger.log("Timer F expired for non-INVITE client transaction "+this.id),this.stateChanged(n.STATUS_TERMINATED),this.request_sender.onRequestTimeout(),this.request_sender.ua.destroyTransaction(this)},r.prototype.timer_K=function(){this.stateChanged(n.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this)},r.prototype.receiveResponse=function(r){var i=this,s=r.status_code;if(s<200)switch(this.state){case n.STATUS_TRYING:case n.STATUS_PROCEEDING:this.stateChanged(n.STATUS_PROCEEDING),this.request_sender.receiveResponse(r)}else switch(this.state){case n.STATUS_TRYING:case n.STATUS_PROCEEDING:this.stateChanged(n.STATUS_COMPLETED),e.clearTimeout(this.F),s===408?this.request_sender.onRequestTimeout():this.request_sender.receiveResponse(r),this.K=e.setTimeout(function(){i.timer_K()},t.Timers.TIMER_K);break;case n.STATUS_COMPLETED:}};var i=function(e,t,r){var i,s=this,o=["stateChanged"];this.type=n.INVITE_CLIENT,this.transport=r,this.id="z9hG4bK"+Math.floor(Math.random()*1e7),this.request_sender=e,this.request=t,this.logger=e.ua.getLogger("jssip.transaction.ict",this.id),i="SIP/2.0/"+(e.ua.configuration.hack_via_tcp?"TCP":r.server.scheme),i+=" "+e.ua.configuration.via_host+";branch="+this.id,this.request.setHeader("via",i),this.request_sender.ua.newTransaction(this),this.request.cancel=function(e){s.cancel_request(s,e)},this.initEvents(o)};i.prototype=new t.EventEmitter,i.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged",this)},i.prototype.send=function(){var r=this;this.stateChanged(n.STATUS_CALLING),this.B=e.setTimeout(function(){r.timer_B()},t.Timers.TIMER_B),this.transport.send(this.request)||this.onTransportError()},i.prototype.onTransportError=function(){this.logger.log("transport error occurred, deleting INVITE client transaction "+this.id),e.clearTimeout(this.B),e.clearTimeout(this.D),e.clearTimeout(this.M),this.request_sender.ua.destroyTransaction(this),this.state!==n.STATUS_ACCEPTED&&this.request_sender.onTransportError()},i.prototype.timer_M=function(){this.logger.log("Timer M expired for INVITE client transaction "+this.id),this.state===n.STATUS_ACCEPTED&&(this.stateChanged(n.STATUS_TERMINATED),e.clearTimeout(this.B),this.request_sender.ua.destroyTransaction(this))},i.prototype.timer_B=function(){this.logger.log("Timer B expired for INVITE client transaction "+this.id),this.state===n.STATUS_CALLING&&(this.stateChanged(n.STATUS_TERMINATED),this.request_sender.onRequestTimeout(),this.request_sender.ua.destroyTransaction(this))},i.prototype.timer_D=function(){this.logger.log("Timer D expired for INVITE client transaction "+this.id),this.stateChanged(n.STATUS_TERMINATED),e.clearTimeout(this.B),this.request_sender.ua.destroyTransaction(this)},i.prototype.sendACK=function(n){var r=this;this.ack="ACK "+this.request.ruri+" SIP/2.0\r\n",this.ack+="Via: "+this.request.headers.Via.toString()+"\r\n",this.request.headers.Route&&(this.ack+="Route: "+this.request.headers.Route.toString()+"\r\n"),this.ack+="To: "+n.getHeader("to")+"\r\n",this.ack+="From: "+this.request.headers.From.toString()+"\r\n",this.ack+="Call-ID: "+this.request.headers["Call-ID"].toString()+"\r\n",this.ack+="CSeq: "+this.request.headers.CSeq.toString().split(" ")[0],this.ack+=" ACK\r\n\r\n",this.D=e.setTimeout(function(){r.timer_D()},t.Timers.TIMER_D),this.transport.send(this.ack)},i.prototype.cancel_request=function(e,r){var i=e.request;this.cancel=t.C.CANCEL+" "+i.ruri+" SIP/2.0\r\n",this.cancel+="Via: "+i.headers.Via.toString()+"\r\n",this.request.headers.Route&&(this.cancel+="Route: "+i.headers.Route.toString()+"\r\n"),this.cancel+="To: "+i.headers.To.toString()+"\r\n",this.cancel+="From: "+i.headers.From.toString()+"\r\n",this.cancel+="Call-ID: "+i.headers["Call-ID"].toString()+"\r\n",this.cancel+="CSeq: "+i.headers.CSeq.toString().split(" ")[0]+" CANCEL\r\n",r&&(this.cancel+="Reason: "+r+"\r\n"),this.cancel+="Content-Length: 0\r\n\r\n",this.state===n.STATUS_PROCEEDING&&this.transport.send(this.cancel)},i.prototype.receiveResponse=function(r){var i=this,s=r.status_code;if(s>=100&&s<=199)switch(this.state){case n.STATUS_CALLING:this.stateChanged(n.STATUS_PROCEEDING),this.request_sender.receiveResponse(r),this.cancel&&this.transport.send(this.cancel);break;case n.STATUS_PROCEEDING:this.request_sender.receiveResponse(r)}else if(s>=200&&s<=299)switch(this.state){case n.STATUS_CALLING:case n.STATUS_PROCEEDING:this.stateChanged(n.STATUS_ACCEPTED),this.M=e.setTimeout(function(){i.timer_M()},t.Timers.TIMER_M),this.request_sender.receiveResponse(r);break;case n.STATUS_ACCEPTED:this.request_sender.receiveResponse(r)}else if(s>=300&&s<=699)switch(this.state){case n.STATUS_CALLING:case n.STATUS_PROCEEDING:this.stateChanged(n.STATUS_COMPLETED),this.sendACK(r),this.request_sender.receiveResponse(r);break;case n.STATUS_COMPLETED:this.sendACK(r)}};var s=function(e,t,n){var r;this.transport=n,this.id="z9hG4bK"+Math.floor(Math.random()*1e7),this.request_sender=e,this.request=t,this.logger=e.ua.getLogger("jssip.transaction.nict",this.id),r="SIP/2.0/"+(e.ua.configuration.hack_via_tcp?"TCP":n.server.scheme),r+=" "+e.ua.configuration.via_host+";branch="+this.id,this.request.setHeader("via",r)};s.prototype=new t.EventEmitter,s.prototype.send=function(){this.transport.send(this.request)||this.onTransportError()},s.prototype.onTransportError=function(){this.logger.log("transport error occurred, for an ACK client transaction "+this.id),this.request_sender.onTransportError()};var o=function(e,t){var r=["stateChanged"];this.type=n.NON_INVITE_SERVER,this.id=e.via_branch,this.request=e,this.transport=e.transport,this.ua=t,this.last_response="",e.server_transaction=this,this.logger=t.getLogger("jssip.transaction.nist",this.id),this.state=n.STATUS_TRYING,t.newTransaction(this),this.initEvents(r)};o.prototype=new t.EventEmitter,o.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged",this)},o.prototype.timer_J=function(){this.logger.log("Timer J expired for non-INVITE server transaction "+this.id),this.stateChanged(n.STATUS_TERMINATED),this.ua.destroyTransaction(this)},o.prototype.onTransportError=function(){this.transportError||(this.transportError=!0,this.logger.log("transport error occurred, deleting non-INVITE server transaction "+this.id),e.clearTimeout(this.J),this.ua.destroyTransaction(this
))},o.prototype.receiveResponse=function(r,i,s,o){var u=this;if(r===100)switch(this.state){case n.STATUS_TRYING:this.stateChanged(n.STATUS_PROCEEDING),this.transport.send(i)||this.onTransportError();break;case n.STATUS_PROCEEDING:this.last_response=i,this.transport.send(i)?s&&s():(this.onTransportError(),o&&o())}else if(r>=200&&r<=699)switch(this.state){case n.STATUS_TRYING:case n.STATUS_PROCEEDING:this.stateChanged(n.STATUS_COMPLETED),this.last_response=i,this.J=e.setTimeout(function(){u.timer_J()},t.Timers.TIMER_J),this.transport.send(i)?s&&s():(this.onTransportError(),o&&o());break;case n.STATUS_COMPLETED:}};var u=function(e,t){var r=["stateChanged"];this.type=n.INVITE_SERVER,this.id=e.via_branch,this.request=e,this.transport=e.transport,this.ua=t,this.last_response="",e.server_transaction=this,this.logger=t.getLogger("jssip.transaction.ist",this.id),this.state=n.STATUS_PROCEEDING,t.newTransaction(this),this.resendProvisionalTimer=null,e.reply(100),this.initEvents(r)};u.prototype=new t.EventEmitter,u.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged",this)},u.prototype.timer_H=function(){this.logger.log("Timer H expired for INVITE server transaction "+this.id),this.state===n.STATUS_COMPLETED&&(this.logger.warn("transactions","ACK for INVITE server transaction was never received, call will be terminated"),this.stateChanged(n.STATUS_TERMINATED)),this.ua.destroyTransaction(this)},u.prototype.timer_I=function(){this.stateChanged(n.STATUS_TERMINATED),this.ua.destroyTransaction(this)},u.prototype.timer_L=function(){this.logger.log("Timer L expired for INVITE server transaction "+this.id),this.state===n.STATUS_ACCEPTED&&(this.stateChanged(n.STATUS_TERMINATED),this.ua.destroyTransaction(this))},u.prototype.onTransportError=function(){this.transportError||(this.transportError=!0,this.logger.log("transport error occurred, deleting INVITE server transaction "+this.id),this.resendProvisionalTimer!==null&&(e.clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),e.clearTimeout(this.L),e.clearTimeout(this.H),e.clearTimeout(this.I),this.ua.destroyTransaction(this))},u.prototype.resend_provisional=function(){this.transport.send(this.last_response)||this.onTransportError()},u.prototype.receiveResponse=function(r,i,s,o){var u=this;if(r>=100&&r<=199)switch(this.state){case n.STATUS_PROCEEDING:this.transport.send(i)||this.onTransportError(),this.last_response=i}if(r>100&&r<=199&&this.state===n.STATUS_PROCEEDING)this.resendProvisionalTimer===null&&(this.resendProvisionalTimer=e.setInterval(function(){u.resend_provisional()},t.Timers.PROVISIONAL_RESPONSE_INTERVAL));else if(r>=200&&r<=299)switch(this.state){case n.STATUS_PROCEEDING:this.stateChanged(n.STATUS_ACCEPTED),this.last_response=i,this.L=e.setTimeout(function(){u.timer_L()},t.Timers.TIMER_L),this.resendProvisionalTimer!==null&&(e.clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case n.STATUS_ACCEPTED:this.transport.send(i)?s&&s():(this.onTransportError(),o&&o())}else if(r>=300&&r<=699)switch(this.state){case n.STATUS_PROCEEDING:this.resendProvisionalTimer!==null&&(e.clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(i)?(this.stateChanged(n.STATUS_COMPLETED),this.H=e.setTimeout(function(){u.timer_H()},t.Timers.TIMER_H),s&&s()):(this.onTransportError(),o&&o())}};var a=function(r,i){var s;switch(i.method){case t.C.INVITE:s=r.transactions.ist[i.via_branch];if(s){switch(s.state){case n.STATUS_PROCEEDING:s.transport.send(s.last_response);break;case n.STATUS_ACCEPTED:}return!0}break;case t.C.ACK:s=r.transactions.ist[i.via_branch];if(!s)return!1;if(s.state===n.STATUS_ACCEPTED)return!1;if(s.state===n.STATUS_COMPLETED)return s.state=n.STATUS_CONFIRMED,s.I=e.setTimeout(function(){s.timer_I()},t.Timers.TIMER_I),!0;break;case t.C.CANCEL:return s=r.transactions.ist[i.via_branch],s?(i.reply_sl(200),s.state===n.STATUS_PROCEEDING?!1:!0):(i.reply_sl(481),!0);default:s=r.transactions.nist[i.via_branch];if(s){switch(s.state){case n.STATUS_TRYING:break;case n.STATUS_PROCEEDING:case n.STATUS_COMPLETED:s.transport.send(s.last_response)}return!0}}};t.Transactions={C:n,checkTransaction:a,NonInviteClientTransaction:r,InviteClientTransaction:i,AckClientTransaction:s,NonInviteServerTransaction:o,InviteServerTransaction:u}}(t),function(t){var n=function(t){var n;return n=function(e,t,n){this.dialog=e,this.applicant=t,this.request=n,this.reattempt=!1,this.reattemptTimer=null},n.prototype={send:function(){var e=new t.RequestSender(this,this.dialog.owner.ua);e.send()},onRequestTimeout:function(){this.applicant.onRequestTimeout()},onTransportError:function(){this.applicant.onTransportError()},receiveResponse:function(n){var r=this;n.status_code===408||n.status_code===481?this.applicant.onDialogError(n):n.method===t.C.INVITE&&n.status_code===491?this.reattempt?this.applicant.receiveResponse(n):(this.request.cseq.value=this.dialog.local_seqnum+=1,this.reattemptTimer=e.setTimeout(function(){r.applicant.owner.status!==t.RTCSession.C.STATUS_TERMINATED&&(r.reattempt=!0,r.request_sender.send())},this.getReattemptTimeout())):this.applicant.receiveResponse(n)}},n}(t),r,i={STATUS_EARLY:1,STATUS_CONFIRMED:2};r=function(e,n,r,s){var o;if(!n.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};n instanceof t.IncomingResponse?s=n.status_code<200?i.STATUS_EARLY:i.STATUS_CONFIRMED:s=s||i.STATUS_CONFIRMED,o=n.parseHeader("contact"),r==="UAS"?(this.id={call_id:n.call_id,local_tag:n.to_tag,remote_tag:n.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this.state=s,this.remote_seqnum=n.cseq,this.local_uri=n.parseHeader("to").uri,this.remote_uri=n.parseHeader("from").uri,this.remote_target=o.uri,this.route_set=n.getHeaders("record-route")):r==="UAC"&&(this.id={call_id:n.call_id,local_tag:n.from_tag,remote_tag:n.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this.state=s,this.local_seqnum=n.cseq,this.local_uri=n.parseHeader("from").uri,this.remote_uri=n.parseHeader("to").uri,this.remote_target=o.uri,this.route_set=n.getHeaders("record-route").reverse()),this.logger=e.ua.getLogger("jssip.dialog",this.id.toString()),this.owner=e,e.ua.dialogs[this.id.toString()]=this,this.logger.log("new "+r+" dialog created with status "+(this.state===i.STATUS_EARLY?"EARLY":"CONFIRMED"))},r.prototype={update:function(e,t){this.state=i.STATUS_CONFIRMED,this.logger.log("dialog "+this.id.toString()+"  changed to CONFIRMED state"),t==="UAC"&&(this.route_set=e.getHeaders("record-route").reverse())},terminate:function(){this.logger.log("dialog "+this.id.toString()+" deleted"),delete this.owner.ua.dialogs[this.id.toString()]},createRequest:function(e,n,r){var i,s;return n=n&&n.slice()||[],this.local_seqnum||(this.local_seqnum=Math.floor(Math.random()*1e4)),i=e===t.C.CANCEL||e===t.C.ACK?this.local_seqnum:this.local_seqnum+=1,s=new t.OutgoingRequest(e,this.remote_target,this.owner.ua,{cseq:i,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},n,r),s.dialog=this,s},checkInDialogRequest:function(e){var n=this;if(!this.remote_seqnum)this.remote_seqnum=e.cseq;else{if(e.method!==t.C.INVITE&&e.cseq<this.remote_seqnum)return e.method!==t.C.ACK&&e.reply(500),!1;e.cseq>this.remote_seqnum&&(this.remote_seqnum=e.cseq)}switch(e.method){case t.C.INVITE:if(e.cseq<this.remote_seqnum){if(this.state===i.STATUS_EARLY){var r=(Math.random()*10|0)+1;e.reply(500,null,["Retry-After:"+r])}else e.reply(500);return!1}if(this.state===i.STATUS_EARLY)return e.reply(491),!1;e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(r){r.sender.state===t.Transactions.C.STATUS_ACCEPTED&&(n.remote_target=e.parseHeader("contact").uri)});break;case t.C.NOTIFY:e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(r){r.sender.state===t.Transactions.C.STATUS_COMPLETED&&(n.remote_target=e.parseHeader("contact").uri)})}return!0},sendRequest:function(e,t,r){r=r||{};var i=r.extraHeaders&&r.extraHeaders.slice()||[],s=r.body||null,o=this.createRequest(t,i,s),u=new n(this,e,o);u.send()},receiveRequest:function(e){if(!this.checkInDialogRequest(e))return;this.owner.receiveRequest(e)}},r.C=i,t.Dialog=r}(t),function(e){var t;t=function(t,n){this.logger=n.getLogger("jssip.requestsender"),this.ua=n,this.applicant=t,this.method=t.request.method,this.request=t.request,this.credentials=null,this.challenged=!1,this.staled=!1,n.status===e.UA.C.STATUS_USER_CLOSED&&(this.method!==e.C.BYE||this.method!==e.C.ACK)&&this.onTransportError()},t.prototype={send:function(){switch(this.method){case"INVITE":this.clientTransaction=new e.Transactions.InviteClientTransaction(this,this.request,this.ua.transport);break;case"ACK":this.clientTransaction=new e.Transactions.AckClientTransaction(this,this.request,this.ua.transport);break;default:this.clientTransaction=new e.Transactions.NonInviteClientTransaction(this,this.request,this.ua.transport)}this.clientTransaction.send()},onRequestTimeout:function(){this.applicant.onRequestTimeout()},onTransportError:function(){this.applicant.onTransportError()},receiveResponse:function(t){var n,r,i,s=t.status_code;if(s!==401&&s!==407||this.ua.configuration.password===null)this.applicant.receiveResponse(t);else{t.status_code===401?(r=t.parseHeader("www-authenticate"),i="authorization"):(r=t.parseHeader("proxy-authenticate"),i="proxy-authorization");if(!r){this.logger.warn(t.status_code+" with wrong or missing challenge, cannot authenticate"),this.applicant.receiveResponse(t);return}if(!this.challenged||!this.staled&&r.stale===!0){this.credentials||(this.credentials=new e.DigestAuthentication(this.ua));if(!this.credentials.authenticate(this.request,r)){this.applicant.receiveResponse(t);return}this.challenged=!0,r.stale&&(this.staled=!0),t.method===e.C.REGISTER?n=this.applicant.cseq+=1:this.request.dialog?n=this.request.dialog.local_seqnum+=1:(n=this.request.cseq+1,this.request.cseq=n),this.request.setHeader("cseq",n+" "+this.method),this.request.setHeader(i,this.credentials.toString()),this.send()}else this.applicant.receiveResponse(t)}}},e.RequestSender=t}(t),function(t){var n;n=function(e,n){var r=1;this.logger=e.getLogger("jssip.registrator"),this.ua=e,this.transport=n,this.registrar=e.configuration.registrar_server,this.expires=e.configuration.register_expires,this.call_id=t.Utils.createRandomToken(22),this.cseq=80,this.to_uri=e.configuration.uri,this.registrationTimer=null,this.registered=this.registered_before=!1,this.ua.registrator=this,this.contact=this.ua.contact.toString(),this.extraHeaders=[],r&&(this.contact+=";reg-id="+r,this.contact+=';+sip.instance="<urn:uuid:'+this.ua.configuration.instance_id+'>"')},n.prototype={register:function(n){var r,i,s,o=this;n=n||{},n.extraHeaders&&Object.keys(n.extraHeaders).length!==0&&(this.extraHeaders=n.extraHeaders&&n.extraHeaders.slice()),s=this.extraHeaders.slice(),s.push("Contact: "+this.contact+";expires="+this.expires),this.request=new t.OutgoingRequest(t.C.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},s),r=new t.RequestSender(this,this.ua),this.receiveResponse=function(n){var r,s,u=n.getHeaders("contact").length;if(n.cseq!==this.cseq)return;this.registrationTimer!==null&&(e.clearTimeout(this.registrationTimer),this.registrationTimer=null);switch(!0){case/^1[0-9]{2}$/.test(n.status_code):break;case/^2[0-9]{2}$/.test(n.status_code):n.hasHeader("expires")&&(s=n.getHeader("expires"));if(!u){this.logger.warn("no Contact header in response to REGISTER, response ignored");break}while(u--){r=n.parseHeader("contact",u);if(r.uri.user===this.ua.contact.uri.user){s=r.getParam("expires");break}r=null}if(!r){this.logger.warn("no Contact header pointing to us, response ignored");break}s||(s=this.expires),this.registrationTimer=e.setTimeout(function(){o.registrationTimer=null,o.register()},s*1e3-3e3),r.hasParam("temp-gruu")&&(this.ua.contact.temp_gruu=r.getParam("temp-gruu").replace(/"/g,"")),r.hasParam("pub-gruu")&&(this.ua.contact.pub_gruu=r.getParam("pub-gruu").replace(/"/g,"")),this.registered=!0,this.ua.emit("registered",this.ua,{response:n});break;case/^423$/.test(n.status_code):n.hasHeader("min-expires")?(this.expires=n.getHeader("min-expires"),this.register()):(this.logger.warn("423 response received for REGISTER without Min-Expires"),this.registrationFailure(n,t.C.causes.SIP_FAILURE_CODE));break;default:i=t.Utils.sipErrorCause(n.status_code),this.registrationFailure(n,i)}},this.onRequestTimeout=function(){this.registrationFailure(null,t.C.causes.REQUEST_TIMEOUT)},this.onTransportError=function(){this.registrationFailure(null,t.C.causes.CONNECTION_ERROR)},r.send()},unregister:function(n){var r;if(!this.registered){this.logger.warn("already unregistered");return}n=n||{},n.extraHeaders&&Object.keys(n.extraHeaders).length!==0&&(this.extraHeaders=n.extraHeaders&&n.extraHeaders.slice()),r=this.extraHeaders.slice(),this.registered=!1,this.registrationTimer!==null&&(e.clearTimeout(this.registrationTimer),this.registrationTimer=null),n.all?(r.push("Contact: *"),r.push("Expires: 0"),this.request=new t.OutgoingRequest(t.C.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},r)):(r.push("Contact: "+this.contact+";expires=0"),this.request=new t.OutgoingRequest(t.C.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},r));var i=new t.RequestSender(this,this.ua);this.receiveResponse=function(e){var n;switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this.unregistered(e);break;default:n=t.Utils.sipErrorCause(e.status_code),this.unregistered(e,n)}},this.onRequestTimeout=function(){this.unregistered(null,t.C.causes.REQUEST_TIMEOUT)},this.onTransportError=function(){this.unregistered(null,t.C.causes.CONNECTION_ERROR)},i.send()},registrationFailure:function(e,t){this.ua.emit("registrationFailed",this.ua,{response:e||null,cause:t}),this.registered&&(this.registered=!1,this.ua.emit("unregistered",this.ua,{response:e||null,cause:t}))},unregistered:function(e,t){this.registered=!1,this.ua.emit("unregistered",this.ua,{response:e||null,cause:t||null})},onTransportClosed:function(){this.registered_before=this.registered,this.registrationTimer!==null&&(e.clearTimeout(this.registrationTimer),this.registrationTimer=null),this.registered&&(this.registered=!1,this.ua.emit("unregistered",this.ua))},onTransportConnected:function(){this.register()},close:function(){this.registered_before=this.registered,this.unregister()}},t.Registrator=n}(t),function(t){var n=function(e){var t=function(e){var t=["progress","succeeded","failed"];this.owner=e,this.logger=e.ua.getLogger("jssip.rtcsession.request",e.id),this.initEvents(t)};return t.prototype=new e.EventEmitter,t.prototype.send=function(t,n){n=n||{};var r,i=n.extraHeaders&&n.extraHeaders.slice()||[],s=n.eventHandlers||{},u=n.body||null;if(t===undefined)throw new TypeError("Not enough arguments");if(this.owner.status!==e.RTCSession.C.STATUS_1XX_RECEIVED&&this.owner.status!==e.RTCSession.C.STATUS_WAITING_FOR_ANSWER&&this.owner.status!==e.RTCSession.C.STATUS_WAITING_FOR_ACK&&this.owner.status!==e.RTCSession.C.STATUS_CONFIRMED&&this.owner.status!==e.RTCSession.C.STATUS_TERMINATED)throw new e.Exceptions.InvalidStateError(this.owner.status);if(this.owner.status===o.STATUS_TERMINATED&&t!==e.C.BYE)throw new e.Exceptions.InvalidStateError(this.owner.status);for(r in s)this.on(r,s[r]);this.owner.dialog.sendRequest(this,t,{extraHeaders:i,body:u})},t.prototype.receiveResponse=function(t){var n;switch(!0){case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",this,{originator:"remote",response:t});break;case/^2[0-9]{2}$/.test(t.status_code):this.emit("succeeded",this,{originator:"remote",response:t});break;default:n=e.Utils.sipErrorCause(t.status_code),this.emit("failed",this,{originator:"remote",response:t,cause:n})}},t.prototype.onRequestTimeout=function(){this.emit("failed",this,{originator:"system",cause:e.C.causes.REQUEST_TIMEOUT}),this.owner.onRequestTimeout()},t.prototype.onTransportError=function(){this.emit("failed",this,{originator:"system",cause:e.C.causes.CONNECTION_ERROR}),this.owner.onTransportError()},t.prototype.onDialogError=function(t){this.emit("failed",this,{originator:"remote",response:t,cause:e.C.causes.DIALOG_ERROR}),this.owner.onDialogError(t)},t}(t),r=function(e){var t=function(e,t){t=t||{},this.logger=e.ua.getLogger("jssip.rtcsession.rtcmediahandler",e.id),this.session=e,this.localMedia=null,this.peerConnection=null,this.init(t)};return t.prototype={createOffer:function(e,t,n){var r=this,i=!1;this.onIceCompleted=function(){i||(i=!0,e(r.peerConnection.localDescription.sdp))},this.peerConnection.createOffer(function(e){r.setLocalDescription(e,t)},function(e){r.logger.error("unable to create offer"),r.logger.error(e),t()},n)},createAnswer:function(e,t,n){var r=this,i=!1;this.onIceCompleted=function(){i||(i=!0,e(r.peerConnection.localDescription.sdp))},this.peerConnection.createAnswer(function(e){r.setLocalDescription(e,t)},function(e){r.logger.error("unable to create answer"),r.logger.error(e),t()},n)},setLocalDescription:function(e,t){var n=this;this.peerConnection.setLocalDescription(e,function(){},function(e){n.logger.error("unable to set local description"),n.logger.error(e),t()})},addStream:function(e,t,n,r){try{this.peerConnection.addStream(e,r)}catch(i){this.logger.error("error adding stream"),this.logger.error(i),n();return}t()},init:function(t){t=t||{};var n,r,i,s=this,o=[],u=t.constraints||{},a=t.stun_servers||null,f=t.turn_servers||null,l=this.session.ua.configuration;a||(a=l.stun_servers),f||(f=l.turn_servers),a.length>0&&o.push({url:a}),r=f.length;for(n=0;n<r;n++)i=f[n],o.push({url:i.urls,username:i.username,credential:i.credential});this.peerConnection=new e.WebRTC.RTCPeerConnection({iceServers:o},u),this.peerConnection.onaddstream=function(e){s.logger.log("stream added: "+e.stream.id)},this.peerConnection.onremovestream=function(e){s.logger.log("stream removed: "+e.stream.id)},this.peerConnection.onicecandidate=function(e){e.candidate?s.logger.log("ICE candidate received: "+e.candidate.candidate):s.onIceCompleted!==undefined&&s.onIceCompleted()},this.peerConnection.oniceconnectionstatechange=function(t){s.logger.log('ICE connection state changed to "'+this.iceConnectionState+'"'),this.iceConnectionState==="disconnected"?s.session.terminate({cause:e.C.causes.RTP_TIMEOUT,status_code:200,reason_phrase:e.C.causes.RTP_TIMEOUT}):t.currentTarget.iceGatheringState==="complete"&&this.iceConnectionState!=="closed"&&s.onIceCompleted()},this.peerConnection.onstatechange=function(){s.logger.log('PeerConnection state changed to "'+this.readyState+'"')}},close:function(){this.logger.log("closing PeerConnection"),this.peerConnection&&(this.peerConnection.close(),this.localMedia&&this.localMedia.stop())},getUserMedia:function(t,n,r){var i=this;this.logger.log("requesting access to local media"),e.WebRTC.getUserMedia(r,function(e){i.logger.log("got local media stream"),i.localMedia=e,t(e)},function(e){i.logger.error("unable to get user media"),i.logger.error(e),n()})},onMessage:function(t,n,r,i){this.peerConnection.setRemoteDescription(new e.WebRTC.RTCSessionDescription({type:t,sdp:n}),r,i)}},t}(t),i=function(e){var t,n={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500};return t=function(e){var t=["succeeded","failed"];this.logger=e.ua.getLogger("jssip.rtcsession.dtmf",e.id),this.owner=e,this.direction=null,this.tone=null,this.duration=null,this.initEvents(t)},t.prototype=new e.EventEmitter,t.prototype.send=function(t,n){var r,i,s,o;if(t===undefined)throw new TypeError("Not enough arguments");this.direction="outgoing";if(this.owner.status!==e.RTCSession.C.STATUS_CONFIRMED&&this.owner.status!==e.RTCSession.C.STATUS_WAITING_FOR_ACK)throw new e.Exceptions.InvalidStateError(this.owner.status);n=n||{},s=n.extraHeaders?n.extraHeaders.slice():[],i=n.eventHandlers||{};if(typeof t=="string")t=t.toUpperCase();else{if(typeof t!="number")throw new TypeError("Invalid tone: "+t);t=t.toString()}if(!t.match(/^[0-9A-D#*]$/))throw new TypeError("Invalid tone: "+t);this.tone=t,this.duration=n.duration;for(r in i)this.on(r,i[r]);s.push("Content-Type: application/dtmf-relay"),o="Signal= "+this.tone+"\r\n",o+="Duration= "+this.duration,this.owner.emit("newDTMF",this.owner,{originator:"local",dtmf:this,request:this.request}),this.owner.dialog.sendRequest(this,e.C.INFO,{extraHeaders:s,body:o})},t.prototype.receiveResponse=function(t){var n;switch(!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):this.emit("succeeded",this,{originator:"remote",response:t});break;default:n=e.Utils.sipErrorCause(t.status_code),this.emit("failed",this,{originator:"remote",response:t,cause:n})}},t.prototype.onRequestTimeout=function(){this.emit("failed",this,{originator:"system",cause:e.C.causes.REQUEST_TIMEOUT}),this.owner.onRequestTimeout()},t.prototype.onTransportError=function(){this.emit("failed",this,{originator:"system",cause:e.C.causes.CONNECTION_ERROR}),this.owner.onTransportError()},t.prototype.onDialogError=function(t){this.emit("failed",this,{originator:"remote",response:t,cause:e.C.causes.DIALOG_ERROR}),this.owner.onDialogError(t)},t.prototype.init_incoming=function(e){var t,n=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,r=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;this.direction="incoming",this.request=e,e.reply(200),e.body&&(t=e.body.split("\r\n"),t.length===2&&(n.test(t[0])&&(this.tone=t[0].replace(n,"$2")),r.test(t[1])&&(this.duration=parseInt(t[1].replace(r,"$2"),10)))),!this.tone||!this.duration?this.logger.warn("invalid INFO DTMF received, discarded"):this.owner.emit("newDTMF",this.owner,{originator:"remote",dtmf:this,request:e})},t.C=n,t}(t),s,o={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};s=function(e){var t=["connecting","progress","failed","started","ended","newDTMF"];this.ua=e,this.status=o.STATUS_NULL,this.dialog=null,this.earlyDialogs={},this.rtcMediaHandler=null,this.timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},this.direction=null,this.local_identity=null,this.remote_identity=null,this.start_time=null,this.end_time=null,this.tones=null,this.data={},this.initEvents(t)},s.prototype=new t.EventEmitter,s.prototype.terminate=function(e){e=e||{};var n,r,i=e.cause||t.C.causes.BYE,s=e.status_code,u=e.reason_phrase,a=e.extraHeaders&&e.extraHeaders.slice()||[],f=e.body,l=this;if(this.status===o.STATUS_TERMINATED)throw new t.Exceptions.InvalidStateError(this.status);switch(this.status){case o.STATUS_NULL:case o.STATUS_INVITE_SENT:case o.STATUS_1XX_RECEIVED:this.logger.log("canceling RTCSession");if(s&&(s<200||s>=700))throw new TypeError("Invalid status_code: "+s);s&&(u=u||t.C.REASON_PHRASE[s]||"",n="SIP ;cause="+s+' ;text="'+u+'"'),this.status===o.STATUS_NULL?(this.isCanceled=!0,this.cancelReason=n):this.status===o.STATUS_INVITE_SENT?this.received_100?this.request.cancel(n):(this.isCanceled=!0,this.cancelReason=n):this.status===o.STATUS_1XX_RECEIVED&&this.request.cancel(n),this.failed("local",null,t.C.causes.CANCELED);break;case o.STATUS_WAITING_FOR_ANSWER:case o.STATUS_ANSWERED:this.logger.log("rejecting RTCSession"),s=s||480;if(s<300||s>=700)throw new TypeError("Invalid status_code: "+s);this.request.reply(s,u,a,f),this.failed("local",null,t.C.causes.REJECTED);break;case o.STATUS_WAITING_FOR_ACK:case o.STATUS_CONFIRMED:this.logger.log("terminating RTCSession"),u=e.reason_phrase||t.C.REASON_PHRASE[s]||"";if(s&&(s<200||s>=700))throw new TypeError("Invalid status_code: "+s);s&&a.push("Reason: SIP ;cause="+s+'; text="'+u+'"'),this.status===o.STATUS_WAITING_FOR_ACK&&this.direction==="incoming"&&this.request.server_transaction.state!==t.Transactions.C.STATUS_TERMINATED?(r=this.dialog,this.receiveRequest=function(e){e.method===t.C.ACK&&(this.sendRequest(t.C.BYE,{extraHeaders:a,body:f}),r.terminate())},this.request.server_transaction.on("stateChanged",function(e){e.sender.state===t.Transactions.C.STATUS_TERMINATED&&(l.sendRequest(t.C.BYE,{extraHeaders:a,body:f}),r.terminate())}),this.ended("local",null,i),this.dialog=r,this.ua.dialogs[r.id.toString()]=r):(this.sendRequest(t.C.BYE,{extraHeaders:a,body:f}),this.ended("local",null,i))}this.close()},s.prototype.answer=function(n){n=n||{};var r=this,i=this.request,s=n.extraHeaders&&n.extraHeaders.slice()||[],u=n.mediaConstraints||{audio:!0,video:!0},a=n.RTCAnswerConstraints||{},f=n.mediaStream||null,l=function(e){r.rtcMediaHandler.addStream(e,h,p)},c=function(){i.reply(480),r.failed("local",null,t.C.causes.USER_DENIED_MEDIA_ACCESS)},h=function(){r.connecting(i);if(r.status===o.STATUS_TERMINATED)return;r.rtcMediaHandler.createAnswer(d,v,a)},p=function(){if(r.status===o.STATUS_TERMINATED)return;r.failed("system",null,t.C.causes.WEBRTC_ERROR)},d=function(n){var u=function(){var u=t.Timers.T1;r.status=o.STATUS_WAITING_FOR_ACK,r.timers.invite2xxTimer=e.setTimeout(function a(){if(r.status!==o.STATUS_WAITING_FOR_ACK)return;i.reply(200,null,s,n),u<t.Timers.T2&&(u*=2,u>t.Timers.T2&&(u=t.Timers.T2)),r.timers.invite2xxTimer=e.setTimeout(a,u)},u),r.timers.ackTimer=e.setTimeout(function(){r.status===o.STATUS_WAITING_FOR_ACK&&(r.logger.log("no ACK received, terminating the call"),e.clearTimeout(r.timers.invite2xxTimer),r.sendRequest(t.C.BYE),r.ended("remote",null,t.C.causes.NO_ACK))},t.Timers.TIMER_H),r.started("local")},a=function(){r.failed("system",null,t.C.causes.CONNECTION_ERROR)};i.reply(200,null,s,n,u,a)},v=function(){if(r.status===o.STATUS_TERMINATED)return;r.failed("system",null,t.C.causes.WEBRTC_ERROR)};if(this.direction!=="incoming")throw new t.Exceptions.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this.status!==o.STATUS_WAITING_FOR_ANSWER)throw new t.Exceptions.InvalidStateError(this.status);this.status=o.STATUS_ANSWERED;if(!this.createDialog(i,"UAS")){i.reply(500,"Missing Contact header field");return}e.clearTimeout(this.timers.userNoAnswerTimer),s.unshift("Contact: "+r.contact),f?l(f):this.rtcMediaHandler.getUserMedia(l,c,u)},s.prototype.sendDTMF=function(n,r){var s,u,a=0,f=this;r=r||{},s=r.duration||null,u=r.interToneGap||null;if(n===undefined)throw new TypeError("Not enough arguments");if(this.status!==o.STATUS_CONFIRMED&&this.status!==o.STATUS_WAITING_FOR_ACK)throw new t.Exceptions.InvalidStateError(this.status);if(!n||typeof n!="string"&&typeof n!="number"||!n.toString().match(/^[0-9A-D#*,]+$/i))throw new TypeError("Invalid tones: "+n);n=n.toString();if(s&&!t.Utils.isDecimal(s))throw new TypeError("Invalid tone duration: "+s);s?s<i.C.MIN_DURATION?(this.logger.warn('"duration" value is lower than the minimum allowed, setting it to '+i.C.MIN_DURATION+" milliseconds"),s=i.C.MIN_DURATION):s>i.C.MAX_DURATION?(this.logger.warn('"duration" value is greater than the maximum allowed, setting it to '+i.C.MAX_DURATION+" milliseconds"),s=i.C.MAX_DURATION):s=Math.abs(s):s=i.C.DEFAULT_DURATION,r.duration=s;if(u&&!t.Utils.isDecimal(u))throw new TypeError("Invalid interToneGap: "+u);u?u<i.C.MIN_INTER_TONE_GAP?(this.logger.warn('"interToneGap" value is lower than the minimum allowed, setting it to '+i.C.MIN_INTER_TONE_GAP+" milliseconds"),u=i.C.MIN_INTER_TONE_GAP):u=Math.abs(u):u=i.C.DEFAULT_INTER_TONE_GAP;if(this.tones){this.tones+=n;return}this.tones=n;var l=function(){var t,n,c=f.tones;if(f.status===o.STATUS_TERMINATED||!c||a>=c.length){f.tones=null;return}t=c[a],a+=1;if(t===",")n=2e3;else{var h=new i(f);h.on("failed",function(){f.tones=null}),h.send(t,r),n=s+u}e.setTimeout(l,n)};l()},s.prototype.sendRequest=function(e,t){var r=new n(this);r.send(e,t)},s.prototype.getLocalStreams=function(){return this.rtcMediaHandler&&this.rtcMediaHandler.peerConnection&&this.rtcMediaHandler.peerConnection.getLocalStreams()||[]},s.prototype.getRemoteStreams=function(){return this.rtcMediaHandler&&this.rtcMediaHandler.peerConnection&&this.rtcMediaHandler.peerConnection.getRemoteStreams()||[]},s.prototype.init_incoming=function(n){var i,s=this,u=n.getHeader("Content-Type");if(!n.body||u!=="application/sdp"){n.reply(415);return}this.status=o.STATUS_INVITE_RECEIVED,this.from_tag=n.from_tag,this.id=n.call_id+this.from_tag,this.request=n,this.contact=this.ua.contact.toString(),this.logger=this.ua.getLogger("jssip.rtcsession",this.id),this.ua.sessions[this.id]=this,n.hasHeader("expires")&&(i=n.getHeader("expires")*1e3),n.to_tag=t.Utils.newTag();if(!this.createDialog(n,"UAS",!0)){n.reply(500,"Missing Contact header field");return}this.rtcMediaHandler=new r(this,{RTCConstraints:{optional:[{DtlsSrtpKeyAgreement:"true"}]}}),this.rtcMediaHandler.onMessage("offer",n.body,function(){n.reply(180,null,["Contact: "+s.contact]),s.status=o.STATUS_WAITING_FOR_ANSWER,s.timers.userNoAnswerTimer=e.setTimeout(function(){n.reply(408),s.failed("local",null,t.C.causes.NO_ANSWER)},s.ua.configuration.no_answer_timeout),i&&(s.timers.expiresTimer=e.setTimeout(function(){s.status===o.STATUS_WAITING_FOR_ANSWER&&(n.reply(487),s.failed("system",null,t.C.causes.EXPIRES))},i)),s.newRTCSession("remote",n)},function(e){s.logger.warn("invalid SDP"),s.logger.warn(e),n.reply(488)})},s.prototype.connect=function(e,n){n=n||{};var i,s,u,a=e,f=n.eventHandlers||{},l=n.extraHeaders&&n.extraHeaders.slice()||[],c=n.mediaConstraints||{audio:!0,video:!0},h=n.mediaStream||null,p=n.RTCConstraints||{},d=n.RTCOfferConstraints||{},v=n.stun_servers||null,m=n.turn_servers||null;if(v){u=t.UA.configuration_check.optional.stun_servers(v);if(!u)throw new TypeError("Invalid stun_servers: "+v);v=u}if(m){u=t.UA.configuration_check.optional.turn_servers(m);if(!u)throw new TypeError("Invalid turn_servers: "+m);m=u}if(e===undefined)throw new TypeError("Not enough arguments");if(!t.WebRTC.isSupported)throw new t.Exceptions.NotSupportedError("WebRTC not supported");e=this.ua.normalizeTarget(e);if(!e)throw new TypeError("Invalid target: "+a);if(this.status!==o.STATUS_NULL)throw new t.Exceptions.InvalidStateError(this.status);for(i in f)this.on(i,f[i]);this.from_tag=t.Utils.newTag(),this.anonymous=n.anonymous||!1,this.isCanceled=!1,this.received_100=!1,s={from_tag:this.from_tag},this.contact=this.ua.contact.toString({anonymous:this.anonymous,outbound:!0}),this.anonymous&&(s.from_display_name="Anonymous",s.from_uri="sip:anonymous@anonymous.invalid",l.push("P-Preferred-Identity: "+this.ua.configuration.uri.toString()),l.push("Privacy: id")),l.push("Contact: "+this.contact),l.push("Content-Type: application/sdp"),this.request=new t.OutgoingRequest(t.C.INVITE,e,this.ua,s,l),this.id=this.request.call_id+this.from_tag,this.logger=this.ua.getLogger("jssip.rtcsession",this.id),this.rtcMediaHandler=new r(this,{RTCConstraints:p,stun_servers:v,turn_servers:m}),this.ua.sessions[this.id]=this,this.newRTCSession("local",this.request),this.sendInitialRequest(c,d,h)},s.prototype.close=function(){var t;if(this.status===o.STATUS_TERMINATED)return;this.logger.log("closing INVITE session "+this.id),this.rtcMediaHandler&&this.rtcMediaHandler.close();for(t in this.timers)e.clearTimeout(this.timers[t]);this.dialog&&(this.dialog.terminate(),delete this.dialog);for(t in this.earlyDialogs)this.earlyDialogs[t].terminate(),delete this.earlyDialogs[t];this.status=o.STATUS_TERMINATED,delete this.ua.sessions[this.id]},s.prototype.createDialog=function(e,n,r){var i,s,o=n==="UAS"?e.to_tag:e.from_tag,u=n==="UAS"?e.from_tag:e.to_tag,a=e.call_id+o+u;return s=this.earlyDialogs[a],r?s?!0:(s=new t.Dialog(this,e,n,t.Dialog.C.STATUS_EARLY),s.error?(this.logger.error(i.error),this.failed("remote",e,t.C.causes.INTERNAL_ERROR),!1):(this.earlyDialogs[a]=s,!0)):s?(s.update(e,n),this.dialog=s,delete this.earlyDialogs[a],!0):(i=new t.Dialog(this,e,n),i.error?(this.logger.error(i.error),this.failed("remote",e,t.C.causes.INTERNAL_ERROR),!1):(this.to_tag=e.to_tag,this.dialog=i,!0))},s.prototype.receiveRequest=function(n){var r;if(n.method===t.C.CANCEL){if(this.status===o.STATUS_WAITING_FOR_ANSWER||this.status===o.STATUS_ANSWERED)this.status=o.STATUS_CANCELED,this.request.reply(487),this.failed("remote",n,t.C.causes.CANCELED)}else switch(n.method){case t.C.ACK:this.status===o.STATUS_WAITING_FOR_ACK&&(e.clearTimeout(this.timers.ackTimer),e.clearTimeout(this.timers.invite2xxTimer),this.status=o.STATUS_CONFIRMED);break;case t.C.BYE:this.status===o.STATUS_CONFIRMED&&(n.reply(200),this.ended("remote",n,t.C.causes.BYE));break;case t.C.INVITE:this.status===o.STATUS_CONFIRMED&&this.logger.log("re-INVITE received");break;case t.C.INFO:if(this.status===o.STATUS_CONFIRMED||
this.status===o.STATUS_WAITING_FOR_ACK)r=n.getHeader("content-type"),r&&r.match(/^application\/dtmf-relay/i)&&(new i(this)).init_incoming(n)}},s.prototype.sendInitialRequest=function(e,n,r){var i=this,s=new t.RequestSender(i,this.ua),u=function(e){i.rtcMediaHandler.addStream(e,f,l)},a=function(){if(i.status===o.STATUS_TERMINATED)return;i.failed("local",null,t.C.causes.USER_DENIED_MEDIA_ACCESS)},f=function(){i.connecting(i.request);if(i.status===o.STATUS_TERMINATED)return;i.rtcMediaHandler.createOffer(c,h,n)},l=function(){if(i.status===o.STATUS_TERMINATED)return;i.failed("system",null,t.C.causes.WEBRTC_ERROR)},c=function(e){if(i.isCanceled||i.status===o.STATUS_TERMINATED)return;i.request.body=e,i.status=o.STATUS_INVITE_SENT,s.send()},h=function(){if(i.status===o.STATUS_TERMINATED)return;i.failed("system",null,t.C.causes.WEBRTC_ERROR)};r?u(r):this.rtcMediaHandler.getUserMedia(u,a,e)},s.prototype.receiveResponse=function(e){var n,r,i=this;if(this.dialog&&e.status_code>=200&&e.status_code<=299){if(this.dialog.id.call_id===e.call_id&&this.dialog.id.local_tag===e.from_tag&&this.dialog.id.remote_tag===e.to_tag){this.sendRequest(t.C.ACK);return}r=new t.Dialog(this,e,"UAC");if(r.error!==undefined){this.logger.error(r.error);return}r.sendRequest({owner:{status:o.STATUS_TERMINATED},onRequestTimeout:function(){},onTransportError:function(){},onDialogError:function(){},receiveResponse:function(){}},t.C.ACK),r.sendRequest({owner:{status:o.STATUS_TERMINATED},onRequestTimeout:function(){},onTransportError:function(){},onDialogError:function(){},receiveResponse:function(){}},t.C.BYE);return}if(this.status!==o.STATUS_INVITE_SENT&&this.status!==o.STATUS_1XX_RECEIVED)return;if(this.isCanceled){e.status_code>=100&&e.status_code<200?this.request.cancel(this.cancelReason):e.status_code>=200&&e.status_code<299&&this.acceptAndTerminate(e);return}switch(!0){case/^100$/.test(e.status_code):this.received_100=!0;break;case/^1[0-9]{2}$/.test(e.status_code):if(this.status!==o.STATUS_INVITE_SENT&&this.status!==o.STATUS_1XX_RECEIVED)break;if(!e.to_tag){this.logger.warn("1xx response received without to tag");break}if(e.hasHeader("contact")&&!this.createDialog(e,"UAC",!0))break;if(!e.body){i.status=o.STATUS_1XX_RECEIVED,i.progress("remote",e);break}this.rtcMediaHandler.onMessage("pranswer",e.body,function(){i.status=o.STATUS_1XX_RECEIVED,i.progress("remote",e)},function(t){i.logger.warn(t),this.earlyDialogs[e.call_id+e.from_tag+e.to_tag].terminate()});break;case/^2[0-9]{2}$/.test(e.status_code):if(!e.body){this.acceptAndTerminate(e,400,"Missing session description"),this.failed("remote",e,t.C.causes.BAD_MEDIA_DESCRIPTION);break}if(!this.createDialog(e,"UAC"))break;this.rtcMediaHandler.onMessage("answer",e.body,function(){i.status=o.STATUS_CONFIRMED,i.sendRequest(t.C.ACK),i.started("remote",e)},function(n){i.logger.warn(n),i.acceptAndTerminate(e,488,"Not Acceptable Here"),i.failed("remote",e,t.C.causes.BAD_MEDIA_DESCRIPTION)});break;default:n=t.Utils.sipErrorCause(e.status_code),this.failed("remote",e,n)}},s.prototype.acceptAndTerminate=function(e,n,r){var i=[];n&&(r=r||t.C.REASON_PHRASE[n]||"",i.push("Reason: SIP ;cause="+n+'; text="'+r+'"'));if(this.dialog||this.createDialog(e,"UAC"))this.sendRequest(t.C.ACK),this.sendRequest(t.C.BYE,{extraHeaders:i})},s.prototype.onTransportError=function(){this.status!==o.STATUS_TERMINATED&&(this.status===o.STATUS_CONFIRMED?this.ended("system",null,t.C.causes.CONNECTION_ERROR):this.failed("system",null,t.C.causes.CONNECTION_ERROR))},s.prototype.onRequestTimeout=function(){this.status!==o.STATUS_TERMINATED&&(this.status===o.STATUS_CONFIRMED?this.ended("system",null,t.C.causes.REQUEST_TIMEOUT):this.failed("system",null,t.C.causes.REQUEST_TIMEOUT))},s.prototype.onDialogError=function(e){this.status!==o.STATUS_TERMINATED&&(this.status===o.STATUS_CONFIRMED?this.ended("remote",e,t.C.causes.DIALOG_ERROR):this.failed("remote",e,t.C.causes.DIALOG_ERROR))},s.prototype.newRTCSession=function(e,t){var n=this,r="newRTCSession";e==="remote"?(n.direction="incoming",n.local_identity=t.to,n.remote_identity=t.from):e==="local"&&(n.direction="outgoing",n.local_identity=t.from,n.remote_identity=t.to),n.ua.emit(r,n.ua,{originator:e,session:n,request:t})},s.prototype.connecting=function(e){var t=this,n="connecting";t.emit(n,t,{request:e})},s.prototype.progress=function(e,t){var n=this,r="progress";n.emit(r,n,{originator:e,response:t||null})},s.prototype.started=function(e,t){var n=this,r="started";n.start_time=new Date,n.emit(r,n,{originator:e,response:t||null})},s.prototype.ended=function(e,t,n){var r=this,i="ended";r.end_time=new Date,r.close(),r.emit(i,r,{originator:e,message:t||null,cause:n})},s.prototype.failed=function(e,t,n){var r=this,i="failed";r.close(),r.emit(i,r,{originator:e,message:t||null,cause:n})},s.C=o,t.RTCSession=s}(t),function(e){var t;t=function(e){this.ua=e,this.logger=e.getLogger("jssip.message"),this.data={}},t.prototype=new e.EventEmitter,t.prototype.send=function(t,n,r){var i,s,o,u,a,f=["succeeded","failed"],l=t;if(t===undefined||n===undefined)throw new TypeError("Not enough arguments");t=this.ua.normalizeTarget(t);if(!t)throw new TypeError("Invalid target: "+l);this.initEvents(f),r=r||{},a=r.extraHeaders&&r.extraHeaders.slice()||[],u=r.eventHandlers||{},o=r.contentType||"text/plain";for(s in u)this.on(s,u[s]);this.closed=!1,this.ua.applicants[this]=this,a.push("Content-Type: "+o),this.request=new e.OutgoingRequest(e.C.MESSAGE,t,this.ua,null,a),n&&(this.request.body=n),i=new e.RequestSender(this,this.ua),this.newMessage("local",this.request),i.send()},t.prototype.receiveResponse=function(t){var n;if(this.closed)return;switch(!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):delete this.ua.applicants[this],this.emit("succeeded",this,{originator:"remote",response:t});break;default:delete this.ua.applicants[this],n=e.Utils.sipErrorCause(t.status_code),this.emit("failed",this,{originator:"remote",response:t,cause:n})}},t.prototype.onRequestTimeout=function(){if(this.closed)return;this.emit("failed",this,{originator:"system",cause:e.C.causes.REQUEST_TIMEOUT})},t.prototype.onTransportError=function(){if(this.closed)return;this.emit("failed",this,{originator:"system",cause:e.C.causes.CONNECTION_ERROR})},t.prototype.close=function(){this.closed=!0,delete this.ua.applicants[this]},t.prototype.init_incoming=function(t){var n;this.request=t,this.newMessage("remote",t),n=this.ua.transactions.nist[t.via_branch],n&&(n.state===e.Transactions.C.STATUS_TRYING||n.state===e.Transactions.C.STATUS_PROCEEDING)&&t.reply(200)},t.prototype.accept=function(t){t=t||{};var n=t.extraHeaders&&t.extraHeaders.slice()||[],r=t.body;if(this.direction!=="incoming")throw new e.Exceptions.NotSupportedError('"accept" not supported for outgoing Message');this.request.reply(200,null,n,r)},t.prototype.reject=function(t){t=t||{};var n=t.status_code||480,r=t.reason_phrase,i=t.extraHeaders&&t.extraHeaders.slice()||[],s=t.body;if(this.direction!=="incoming")throw new e.Exceptions.NotSupportedError('"reject" not supported for outgoing Message');if(n<300||n>=700)throw new TypeError("Invalid status_code: "+n);this.request.reply(n,r,i,s)},t.prototype.newMessage=function(e,t){var n=this,r="newMessage";e==="remote"?(n.direction="incoming",n.local_identity=t.to,n.remote_identity=t.from):e==="local"&&(n.direction="outgoing",n.local_identity=t.from,n.remote_identity=t.to),n.ua.emit(r,n.ua,{originator:e,message:n,request:t})},e.Message=t}(t),function(t){var n,r={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2,EVENT_METHODS:{newRTCSession:"INVITE",newMessage:"MESSAGE"},ALLOWED_METHODS:["ACK","CANCEL","BYE","OPTIONS"],ACCEPTED_BODY_TYPES:["application/sdp","application/dtmf-relay"],MAX_FORWARDS:69,TAG_LENGTH:10};n=function(e){var n=["connecting","connected","disconnected","newTransaction","transactionDestroyed","registered","unregistered","registrationFailed","newRTCSession","newMessage"];r.ACCEPTED_BODY_TYPES=r.ACCEPTED_BODY_TYPES.toString(),this.log=new t.LoggerFactory,this.logger=this.getLogger("jssip.ua"),this.cache={credentials:{}},this.configuration={},this.dialogs={},this.applicants={},this.sessions={},this.transport=null,this.contact=null,this.status=r.STATUS_INIT,this.error=null,this.transactions={nist:{},nict:{},ist:{},ict:{}},this.transportRecoverAttempts=0,this.transportRecoveryTimer=null,Object.defineProperties(this,{transactionsCount:{get:function(){var e,t=["nist","nict","ist","ict"],n=0;for(e in t)n+=Object.keys(this.transactions[t[e]]).length;return n}},nictTransactionsCount:{get:function(){return Object.keys(this.transactions.nict).length}},nistTransactionsCount:{get:function(){return Object.keys(this.transactions.nist).length}},ictTransactionsCount:{get:function(){return Object.keys(this.transactions.ict).length}},istTransactionsCount:{get:function(){return Object.keys(this.transactions.ist).length}}});if(e===undefined)throw new TypeError("Not enough arguments");e.log&&(e.log.hasOwnProperty("builtinEnabled")&&(this.log.builtinEnabled=e.log.builtinEnabled),e.log.hasOwnProperty("level")&&(this.log.level=e.log.level),e.log.hasOwnProperty("connector")&&(this.log.connector=e.log.connector));try{this.loadConfig(e),this.initEvents(n)}catch(i){throw this.status=r.STATUS_NOT_READY,this.error=r.CONFIGURATION_ERROR,i}this.registrator=new t.Registrator(this)},n.prototype=new t.EventEmitter,n.prototype.register=function(e){this.configuration.register=!0,this.registrator.register(e)},n.prototype.unregister=function(e){this.configuration.register=!1,this.registrator.unregister(e)},n.prototype.isRegistered=function(){return this.registrator.registered?!0:!1},n.prototype.isConnected=function(){return this.transport?this.transport.connected:!1},n.prototype.call=function(e,n){var r;r=new t.RTCSession(this),r.connect(e,n)},n.prototype.sendMessage=function(e,n,r){var i;i=new t.Message(this),i.send(e,n,r)},n.prototype.stop=function(){function s(){i.nistTransactionsCount===0&&i.nictTransactionsCount===0&&(i.removeListener("transactionDestroyed",s),i.transport.disconnect())}var t,n,i=this;this.logger.log("user requested closure...");if(this.status===r.STATUS_USER_CLOSED){this.logger.warn("UA already closed");return}e.clearTimeout(this.transportRecoveryTimer),this.logger.log("closing registrator"),this.registrator.close();for(t in this.sessions)this.logger.log("closing session "+t),this.sessions[t].terminate();for(n in this.applicants)this.applicants[n].close();this.status=r.STATUS_USER_CLOSED,this.nistTransactionsCount===0&&this.nictTransactionsCount===0?this.transport.disconnect():this.on("transactionDestroyed",s)},n.prototype.start=function(){var e;this.logger.log("user requested startup..."),this.status===r.STATUS_INIT?(e=this.getNextWsServer(),new t.Transport(this,e)):this.status===r.STATUS_USER_CLOSED?(this.logger.log("resuming"),this.status=r.STATUS_READY,this.transport.connect()):this.status===r.STATUS_READY?this.logger.log("UA is in READY status, not resuming"):this.logger.error("Connection is down. Auto-Recovery system is trying to connect")},n.prototype.normalizeTarget=function(e){return t.Utils.normalizeTarget(e,this.configuration.hostport_params)},n.prototype.saveCredentials=function(e){this.cache.credentials[e.realm]=this.cache.credentials[e.realm]||{},this.cache.credentials[e.realm][e.uri]=e},n.prototype.getCredentials=function(e){var t,n;return t=e.ruri.host,this.cache.credentials[t]&&this.cache.credentials[t][e.ruri]&&(n=this.cache.credentials[t][e.ruri],n.method=e.method),n},n.prototype.getLogger=function(e,t){return this.log.getLogger(e,t)},n.prototype.onTransportClosed=function(e){var n,r,i,s=["nict","ict","nist","ist"];e.server.status=t.Transport.C.STATUS_DISCONNECTED,this.logger.log("connection state set to "+t.Transport.C.STATUS_DISCONNECTED),i=s.length;for(n=0;n<i;n++)for(r in this.transactions[s[n]])this.transactions[s[n]][r].onTransportError();this.contact.pub_gruu||this.closeSessionsOnTransportError()},n.prototype.onTransportError=function(e){var n;this.logger.log("transport "+e.server.ws_uri+" failed | connection state set to "+t.Transport.C.STATUS_ERROR),e.server.status=t.Transport.C.STATUS_ERROR,this.emit("disconnected",this,{transport:e,code:e.lastTransportError.code,reason:e.lastTransportError.reason}),n=this.getNextWsServer();if(n)new t.Transport(this,n);else{this.closeSessionsOnTransportError();if(!this.error||this.error!==r.NETWORK_ERROR)this.status=r.STATUS_NOT_READY,this.error=r.NETWORK_ERROR;this.recoverTransport()}},n.prototype.onTransportConnected=function(e){this.transport=e,this.transportRecoverAttempts=0,e.server.status=t.Transport.C.STATUS_READY,this.logger.log("connection state set to "+t.Transport.C.STATUS_READY);if(this.status===r.STATUS_USER_CLOSED)return;this.status=r.STATUS_READY,this.error=null,this.configuration.register&&this.registrator.onTransportConnected(),this.emit("connected",this,{transport:e})},n.prototype.onTransportConnecting=function(e,t){this.emit("connecting",this,{transport:e,attempts:t})},n.prototype.newTransaction=function(e){this.transactions[e.type][e.id]=e,this.emit("newTransaction",this,{transaction:e})},n.prototype.destroyTransaction=function(e){delete this.transactions[e.type][e.id],this.emit("transactionDestroyed",this,{transaction:e})},n.prototype.receiveRequest=function(e){var n,r,i,s=e.method;if(e.ruri.user!==this.configuration.uri.user&&e.ruri.user!==this.contact.uri.user){this.logger.warn("Request-URI does not point to us"),e.method!==t.C.ACK&&e.reply_sl(404);return}if(e.ruri.scheme===t.C.SIPS){e.reply_sl(416);return}if(t.Transactions.checkTransaction(this,e))return;s===t.C.INVITE?new t.Transactions.InviteServerTransaction(e,this):s!==t.C.ACK&&new t.Transactions.NonInviteServerTransaction(e,this);if(s===t.C.OPTIONS)e.reply(200);else if(s===t.C.MESSAGE){if(!this.checkEvent("newMessage")||this.listeners("newMessage").length===0){e.reply(405);return}i=new t.Message(this),i.init_incoming(e)}else if(s===t.C.INVITE)if(!this.checkEvent("newRTCSession")||this.listeners("newRTCSession").length===0){e.reply(405);return}if(!e.to_tag)switch(s){case t.C.INVITE:t.WebRTC.isSupported?(r=new t.RTCSession(this),r.init_incoming(e)):(this.logger.warn("INVITE received but WebRTC is not supported"),e.reply(488));break;case t.C.BYE:e.reply(481);break;case t.C.CANCEL:r=this.findSession(e),r?r.receiveRequest(e):this.logger.warn("received CANCEL request for a non existent session");break;case t.C.ACK:break;default:e.reply(405)}else n=this.findDialog(e),n?n.receiveRequest(e):s===t.C.NOTIFY?(r=this.findSession(e),r?r.receiveRequest(e):(this.logger.warn("received NOTIFY request for a non existent session"),e.reply(481,"Subscription does not exist"))):s!==t.C.ACK&&e.reply(481)},n.prototype.findSession=function(e){var t=e.call_id+e.from_tag,n=this.sessions[t],r=e.call_id+e.to_tag,i=this.sessions[r];return n?n:i?i:null},n.prototype.findDialog=function(e){var t=e.call_id+e.from_tag+e.to_tag,n=this.dialogs[t];return n?n:(t=e.call_id+e.to_tag+e.from_tag,n=this.dialogs[t],n?n:null)},n.prototype.getNextWsServer=function(){var e,n,r,i=[];n=this.configuration.ws_servers.length;for(e=0;e<n;e++){r=this.configuration.ws_servers[e];if(r.status===t.Transport.C.STATUS_ERROR)continue;i.length===0?i.push(r):r.weight>i[0].weight?i=[r]:r.weight===i[0].weight&&i.push(r)}return e=Math.floor(Math.random()*i.length),i[e]},n.prototype.closeSessionsOnTransportError=function(){var e;for(e in this.sessions)this.sessions[e].onTransportError();this.registrator.onTransportClosed()},n.prototype.recoverTransport=function(n){var r,i,s,o,u,a;n=n||this,u=n.transportRecoverAttempts,i=n.configuration.ws_servers.length;for(r=0;r<i;r++)n.configuration.ws_servers[r].status=0;a=n.getNextWsServer(),s=Math.floor(Math.random()*Math.pow(2,u)+1),o=s*n.configuration.connection_recovery_min_interval,o>n.configuration.connection_recovery_max_interval&&(this.logger.log("time for next connection attempt exceeds connection_recovery_max_interval, resetting counter"),o=n.configuration.connection_recovery_min_interval,u=0),this.logger.log("next connection attempt in "+o+" seconds"),this.transportRecoveryTimer=e.setTimeout(function(){n.transportRecoverAttempts=u+1,new t.Transport(n,a)},o*1e3)},n.prototype.loadConfig=function(r){var i,s,o,u,a,f={via_host:t.Utils.createRandomToken(12)+".invalid",password:null,register_expires:600,register:!0,registrar_server:null,ws_server_max_reconnection:3,ws_server_reconnection_timeout:4,connection_recovery_min_interval:2,connection_recovery_max_interval:30,use_preloaded_route:!1,no_answer_timeout:60,stun_servers:["stun:stun.l.google.com:19302"],turn_servers:[],trace_sip:!1,hack_via_tcp:!1,hack_ip_in_contact:!1};for(i in n.configuration_check.mandatory){if(!r.hasOwnProperty(i))throw new t.Exceptions.ConfigurationError(i);s=r[i],o=n.configuration_check.mandatory[i](s);if(o===undefined)throw new t.Exceptions.ConfigurationError(i,s);f[i]=o}for(i in n.configuration_check.optional)if(r.hasOwnProperty(i)){s=r[i];if(t.Utils.isEmpty(s))continue;o=n.configuration_check.optional[i](s);if(o===undefined)throw new t.Exceptions.ConfigurationError(i,s);f[i]=o}if(f.connection_recovery_max_interval<f.connection_recovery_min_interval)throw new t.Exceptions.ConfigurationError("connection_recovery_max_interval",f.connection_recovery_max_interval);f.display_name===0&&(f.display_name="0"),f.instance_id||(f.instance_id=t.Utils.newUUID()),f.jssip_id=t.Utils.createRandomToken(5),u=f.uri.clone(),u.user=null,f.hostport_params=u.toString().replace(/^sip:/i,""),f.authorization_user||(f.authorization_user=f.uri.user),f.registrar_server||(a=f.uri.clone(),a.user=null,f.registrar_server=a),f.no_answer_timeout=f.no_answer_timeout*1e3,f.hack_ip_in_contact&&(f.via_host=t.Utils.getRandomTestNetIP()),s=r.stun_servers,s instanceof Array&&s.length===0&&(f.stun_servers=[]),this.contact={pub_gruu:null,temp_gruu:null,uri:new t.URI("sip",t.Utils.createRandomToken(8),f.via_host,null,{transport:"ws"}),toString:function(e){e=e||{};var t=e.anonymous||null,n=e.outbound||null,r="<";return t?r+=this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":r+=this.pub_gruu||this.uri.toString(),n&&(t?!this.temp_gruu:!this.pub_gruu)&&(r+=";ob"),r+=">",r}};for(i in f)n.configuration_skeleton[i].value=f[i];Object.defineProperties(this.configuration,n.configuration_skeleton);for(i in f)n.configuration_skeleton[i].value="";this.logger.log("configuration parameters after validation:");for(i in f)switch(i){case"uri":case"registrar_server":this.logger.log("· "+i+": "+f[i]);break;case"password":this.logger.log("· "+i+": "+"NOT SHOWN");break;default:this.logger.log("· "+i+": "+e.JSON.stringify(f[i]))}return},n.configuration_skeleton=function(){var e,t,n={},r=["jssip_id","ws_server_max_reconnection","ws_server_reconnection_timeout","hostport_params","uri","ws_servers","authorization_user","connection_recovery_max_interval","connection_recovery_min_interval","display_name","hack_via_tcp","hack_ip_in_contact","instance_id","no_answer_timeout","password","register_expires","registrar_server","stun_servers","trace_sip","turn_servers","use_preloaded_route","via_core_value","via_host"];for(e in r)t=r[e],n[t]={value:"",writable:!1,configurable:!1};return n.register={value:"",writable:!0,configurable:!1},n}(),n.configuration_check={mandatory:{uri:function(e){var n;/^sip:/i.test(e)||(e=t.C.SIP+":"+e),n=t.URI.parse(e);if(!n)return;if(!n.user)return;return n},ws_servers:function(e){var n,r,i;if(typeof e=="string")e=[{ws_uri:e}];else{if(!(e instanceof Array))return;r=e.length;for(n=0;n<r;n++)typeof e[n]=="string"&&(e[n]={ws_uri:e[n]})}if(e.length===0)return!1;r=e.length;for(n=0;n<r;n++){if(!e[n].ws_uri){this.logger.error('missing "ws_uri" attribute in ws_servers parameter');return}if(e[n].weight&&!Number(e[n].weight)){this.logger.error('"weight" attribute in ws_servers parameter must be a Number');return}i=t.Grammar.parse(e[n].ws_uri,"absoluteURI");if(i===-1){this.logger.error('invalid "ws_uri" attribute in ws_servers parameter: '+e[n].ws_uri);return}if(i.scheme!=="wss"&&i.scheme!=="ws"){this.logger.error("invalid URI scheme in ws_servers parameter: "+i.scheme);return}e[n].sip_uri="<sip:"+i.host+(i.port?":"+i.port:"")+";transport=ws;lr>",e[n].weight||(e[n].weight=0),e[n].status=0,e[n].scheme=i.scheme.toUpperCase()}return e}},optional:{authorization_user:function(e){if(t.Grammar.parse('"'+e+'"',"quoted_string")===-1)return;return e},connection_recovery_max_interval:function(n){var r;if(t.Utils.isDecimal(n)){r=e.Number(n);if(r>0)return r}},connection_recovery_min_interval:function(n){var r;if(t.Utils.isDecimal(n)){r=e.Number(n);if(r>0)return r}},display_name:function(e){if(t.Grammar.parse('"'+e+'"',"display_name")===-1)return;return e},hack_via_tcp:function(e){if(typeof e=="boolean")return e},hack_ip_in_contact:function(e){if(typeof e=="boolean")return e},instance_id:function(e){/^uuid:/i.test(e)&&(e=e.substr(5));if(t.Grammar.parse(e,"uuid")===-1)return;return e},no_answer_timeout:function(n){var r;if(t.Utils.isDecimal(n)){r=e.Number(n);if(r>0)return r}},password:function(e){return String(e)},register:function(e){if(typeof e=="boolean")return e},register_expires:function(n){var r;if(t.Utils.isDecimal(n)){r=e.Number(n);if(r>0)return r}},registrar_server:function(e){var n;/^sip:/i.test(e)||(e=t.C.SIP+":"+e),n=t.URI.parse(e);if(!n)return;if(n.user)return;return n},stun_servers:function(e){var n,r,i;if(typeof e=="string")e=[e];else if(!(e instanceof Array))return;r=e.length;for(n=0;n<r;n++){i=e[n],/^stuns?:/.test(i)||(i="stun:"+i);if(t.Grammar.parse(i,"stun_URI")===-1)return;e[n]=i}return e},trace_sip:function(e){if(typeof e=="boolean")return e},turn_servers:function(e){var n,r,i,s,o,u;e instanceof Array||(e=[e]),i=e.length;for(n=0;n<i;n++){o=e[n],o.server&&(o.urls=[o.server]),o.password&&(o.credential=[o.password]);if(!o.urls||!o.username||!o.credential)return;o.urls instanceof Array||(o.urls=[o.urls]),s=o.urls.length;for(r=0;r<s;r++){u=o.urls[r],/^turns?:/.test(u)||(u="turn:"+u);if(t.Grammar.parse(u,"turn_URI")===-1)return}}return e},use_preloaded_route:function(e){if(typeof e=="boolean")return e}}},n.C=r,t.UA=n}(t),function(t){var n;n={str_utf8_length:function(t){return e.unescape(encodeURIComponent(t)).length},isFunction:function(e){return e!==undefined?Object.prototype.toString.call(e)==="[object Function]"?!0:!1:!1},isDecimal:function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},isEmpty:function(t){if(t===null||t===""||t===undefined||t instanceof Array&&t.length===0||typeof t=="number"&&e.isNaN(t))return!0},createRandomToken:function(e,t){var n,r,i="";t=t||32;for(n=0;n<e;n++)r=Math.random()*t|0,i+=r.toString(t);return i},newTag:function(){return t.Utils.createRandomToken(t.UA.C.TAG_LENGTH)},newUUID:function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,n=e==="x"?t:t&3|8;return n.toString(16)});return e},hostType:function(e){if(!e)return;e=t.Grammar.parse(e,"host");if(e!==-1)return e.host_type},normalizeTarget:function(e,n){var r,i,s,o;if(!e)return;if(e instanceof t.URI)return e;if(typeof e=="string"){i=e.split("@");switch(i.length){case 1:if(!n)return;s=e,o=n;break;case 2:s=i[0],o=i[1];break;default:s=i.slice(0,i.length-1).join("@"),o=i[i.length-1]}s=s.replace(/^(sips?|tel):/i,""),/^[\-\.\(\)]*\+?[0-9\-\.\(\)]+$/.test(s)&&(s=s.replace(/[\-\.\(\)]/g,"")),e=t.C.SIP+":"+t.Utils.escapeUser(s)+"@"+o;if(r=t.URI.parse(e))return r;return}return},escapeUser:function(t){return e.encodeURIComponent(e.decodeURIComponent(t)).replace(/%3A/ig,":").replace(/%2B/ig,"+").replace(/%3F/ig,"?").replace(/%2F/ig,"/")},headerize:function(e){var t={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},n=e.toLowerCase().replace(/_/g,"-").split("-"),r="",i=n.length,s;for(s=0;s<i;s++)s!==0&&(r+="-"),r+=n[s].charAt(0).toUpperCase()+n[s].substring(1);return t[r]&&(r=t[r]),r},sipErrorCause:function(e){var n;for(n in t.C.SIP_ERROR_CAUSES)if(t.C.SIP_ERROR_CAUSES[n].indexOf(e)!==-1)return t.C.causes[n];return t.C.causes.SIP_FAILURE_CODE},getRandomTestNetIP:function(){function t(t,n){return e.Math.floor(e.Math.random()*(n-t+1)+t)}return"192.0.2."+t(1,254)},getAllowedMethods:function(e){var n,r=t.UA.C.ALLOWED_METHODS.toString();for(n in t.UA.C.EVENT_METHODS)e.checkEvent(n)&&e.listeners(n).length>0&&(r+=","+t.UA.C.EVENT_METHODS[n]);return r},calculateMD5:function(e){function t(e,t){return e<<t|e>>>32-t}function n(e,t){var n,r,i,s,o;return i=e&2147483648,s=t&2147483648,n=e&1073741824,r=t&1073741824,o=(e&1073741823)+(t&1073741823),n&r?o^2147483648^i^s:n|r?o&1073741824?o^3221225472^i^s:o^1073741824^i^s:o^i^s}function r(e,t,n){return e&t|~e&n}function i(e,t,n){return e&n|t&~n}function s(e,t,n){return e^t^n}function o(e,t,n){return t^(e|~n)}function u(e,i,s,o,u,a,f){return e=n(e,n(n(r(i,s,o),u),f)),n(t(e,a),i)}function a(e,r,s,o,u,a,f){return e=n(e,n(n(i(r,s,o),u),f)),n(t(e,a),r)}function f(e,r,i,o,u,a,f){return e=n(e,n(n(s(r,i,o),u),f)),n(t(e,a),r)}function l(e,r,i,s,u,a,f){return e=n(e,n(n(o(r,i,s),u),f)),n(t(e,a),r)}function c(e){var t,n=e.length,r=n+8,i=(r-r%64)/64,s=(i+1)*16,o=Array(s-1),u=0,a=0;while(a<n)t=(a-a%4)/4,u=a%4*8,o[t]=o[t]|e.charCodeAt(a)<<u,a++;return t=(a-a%4)/4,u=a%4*8,o[t]=o[t]|128<<u,o[s-2]=n<<3,o[s-1]=n>>>29,o}function h(e){var t="",n="",r,i;for(i=0;i<=3;i++)r=e>>>i*8&255,n="0"+r.toString(16),t+=n.substr(n.length-2,2);return t}function p(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(r&63|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(r&63|128))}return t}var d=[],v,m,g,y,b,w,E,S,x,T=7,N=12,C=17,k=22,L=5,A=9,O=14,M=20,_=4,D=11,P=16,H=23,B=6,j=10,F=15,I=21;e=p(e),d=c(e),w=1732584193,E=4023233417,S=2562383102,x=271733878;for(v=0;v<d.length;v+=16)m=w,g=E,y=S,b=x,w=u(w,E,S,x,d[v+0],T,3614090360),x=u(x,w,E,S,d[v+1],N,3905402710),S=u(S,x,w,E,d[v+2],C,606105819),E=u(E,S,x,w,d[v+3],k,3250441966),w=u(w,E,S,x,d[v+4],T,4118548399),x=u(x,w,E,S,d[v+5],N,1200080426),S=u(S,x,w,E,d[v+6],C,2821735955),E=u(E,S,x,w,d[v+7],k,4249261313),w=u(w,E,S,x,d[v+8],T,1770035416),x=u(x,w,E,S,d[v+9],N,2336552879),S=u(S,x,w,E,d[v+10],C,4294925233),E=u(E,S,x,w,d[v+11],k,2304563134),w=u(w,E,S,x,d[v+12],T,1804603682),x=u(x,w,E,S,d[v+13],N,4254626195),S=u(S,x,w,E,d[v+14],C,2792965006),E=u(E,S,x,w,d[v+15],k,1236535329),w=a(w,E,S,x,d[v+1],L,4129170786),x=a(x,w,E,S,d[v+6],A,3225465664),S=a(S,x,w,E,d[v+11],O,643717713),E=a(E,S,x,w,d[v+0],M,3921069994),w=a(w,E,S,x,d[v+5],L,3593408605),x=a(x,w,E,S,d[v+10],A,38016083),S=a(S,x,w,E,d[v+15],O,3634488961),E=a(E,S,x,w,d[v+4],M,3889429448),w=a(w,E,S,x,d[v+9],L,568446438),x=a(x,w,E,S,d[v+14],A,3275163606),S=a(S,x,w,E,d[v+3],O,4107603335),E=a(E,S,x,w,d[v+8],M,1163531501),w=a(w,E,S,x,d[v+13],L,2850285829),x=a(x,w,E,S,d[v+2],A,4243563512),S=a(S,x,w,E,d[v+7],O,1735328473),E=a(E,S,x,w,d[v+12],M,2368359562),w=f(w,E,S,x,d[v+5],_,4294588738),x=f(x,w,E,S,d[v+8],D,2272392833),S=f(S,x,w,E,d[v+11],P,1839030562),E=f(E,S,x,w,d[v+14],H,4259657740),w=f(w,E,S,x,d[v+1],_,2763975236),x=f(x,w,E,S,d[v+4],D,1272893353),S=f(S,x,w,E,d[v+7],P,4139469664),E=f(E,S,x,w,d[v+10],H,3200236656),w=f(w,E,S,x,d[v+13],_,681279174),x=f(x,w,E,S,d[v+0],D,3936430074),S=f(S,x,w,E,d[v+3],P,3572445317),E=f(E,S,x,w,d[v+6],H,76029189),w=f(w,E,S,x,d[v+9],_,3654602809),x=f(x,w,E,S,d[v+12],D,3873151461),S=f(S,x,w,E,d[v+15],P,530742520),E=f(E,S,x,w,d[v+2],H,3299628645),w=l(w,E,S,x,d[v+0],B,4096336452),x=l(x,w,E,S,d[v+7],j,1126891415),S=l(S,x,w,E,d[v+14],F,2878612391),E=l(E,S,x,w,d[v+5],I,4237533241),w=l(w,E,S,x,d[v+12],B,1700485571),x=l(x,w,E,S,d[v+3],j,2399980690),S=l(S,x,w,E,d[v+10],F,4293915773),E=l(E,S,x,w,d[v+1],I,2240044497),w=l(w,E,S,x,d[v+8],B,1873313359),x=l(x,w,E,S,d[v+15],j,4264355552),S=l(S,x,w,E,d[v+6],F,2734768916),E=l(E,S,x,w,d[v+13],I,1309151649),w=l(w,E,S,x,d[v+4],B,4149444226),x=l(x,w,E,S,d[v+11],j,3174756917),S=l(S,x,w,E,d[v+2],F,718787259),E=l(E,S,x,w,d[v+9],I,3951481745),w=n(w,m),E=n(E,g),S=n(S,y),x=n(x,b);var q=h(w)+h(E)+h(S)+h(x);return q.toLowerCase()}},t.Utils=n}(t),function(e){function f(){if(r.s("to").uri.scheme!=="sip")return g(416),!1}function l(){if(!r.to_tag&&r.call_id.substr(0,5)===i.configuration.jssip_id)return g(482),!1}function c(){var t=e.Utils.str_utf8_length(r.body),n=r.getHeader("content-length");if(t<n)return g(400),!1}function h(){var t,n,s=r.from_tag,o=r.call_id,u=r.cseq;if(!r.to_tag)if(r.method===e.C.INVITE){t=i.transactions.ist[r.via_branch];if(!t)return;for(n in i.transactions.ist){t=i.transactions.ist[n];if(t.request.from_tag===s&&t.request.call_id===o&&t.request.cseq===u)return g(482),!1}}else{t=i.transactions.nist[r.via_branch];if(!t)return;for(n in i.transactions.nist){t=i.transactions.nist[n];if(t.request.from_tag===s&&t.request.call_id===o&&t.request.cseq===u)return g(482),!1}}}function p(){if(r.getHeaders("via").length>1)return n.warn("More than one Via header field present in the response. Dropping the response"),!1}function d(){var e=i.configuration.via_host;if(r.via.host!==e)return n.warn("Via host in the response does not match UA Via host value. Dropping the response"),!1}function v(){var t=e.Utils.str_utf8_length(r.body),i=r.getHeader("content-length");if(t<i)return n.warn("Message body length is lower than the value in Content-Length header field. Dropping the response"),!1}function m(){var e=["from","to","call_id","cseq","via"],t=e.length;while(t--)if(!r.hasHeader(e[t]))return n.warn("Missing mandatory header field : "+e[t]+". Dropping the response"),!1}function g(t){var n,i="SIP/2.0 "+t+" "+e.C.REASON_PHRASE[t]+"\r\n",o=r.getHeaders("via"),u=o.length,a=0;for(a;a<u;a++)i+="Via: "+o[a]+"\r\n";n=r.getHeader("To"),r.to_tag||(n+=";tag="+e.Utils.newTag()),i+="To: "+n+"\r\n",i+="From: "+r.getHeader("From")+"\r\n",i+="Call-ID: "+r.call_id+"\r\n",i+="CSeq: "+r.cseq+" "+r.method+"\r\n",i+="\r\n",s.send(i)}var t,n,r,i,s,o=[],u=[],a=[];o.push(f),o.push(l),o.push(c),o.push(h),u.push(p),u.push(d),u.push(v),a.push(m),t=function(t,f,l){var c,h;r=t,i=f,s=l,n=i.getLogger("jssip.sanitycheck"),c=a.length;while(c--){h=a[c](r);if(h===!1)return!1}if(r instanceof e.IncomingRequest){c=o.length;while(c--){h=o[c](r);if(h===!1)return!1}}else if(r instanceof e.IncomingResponse){c=u.length;while(c--){h=u[c](r);if(h===!1)return!1}}return!0},e.sanityCheck=t}(t),function(e){var t;t=function(e){this.logger=e.getLogger("jssip.digestauthentication"),this.username=e.configuration.authorization_user,this.password=e.configuration.password,this.cnonce=null,this.nc=0,this.ncHex="00000000",this.response=null},t.prototype.authenticate=function(t,n){this.algorithm=n.algorithm,this.realm=n.realm,this.nonce=n.nonce,this.opaque=n.opaque,this.stale=n.stale;if(this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn('challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(n.qop)if(n.qop.indexOf("auth")>-1)this.qop="auth";else{if(!(n.qop.indexOf("auth-int")>-1))return this.logger.warn('challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this.qop="auth-int"}else this.qop=null;return this.method=t.method,this.uri=t.ruri,this.cnonce=e.Utils.createRandomToken(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(),!0},t.prototype.calculateResponse=function(){var t,n;t=e.Utils.calculateMD5(this.username+":"+this.realm+":"+this.password),this.qop==="auth"?(n=e.Utils.calculateMD5(this.method+":"+this.uri),this.response=e.Utils.calculateMD5(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+n)):this.qop==="auth-int"?(n=e.Utils.calculateMD5(this.method+":"+this.uri+":"+e.Utils.calculateMD5(this.body?this.body:"")),this.response=e.Utils.calculateMD5(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+n)):this.qop===null&&(n=e.Utils.calculateMD5(this.method+":"+this.uri),this.response=e.Utils.calculateMD5(t+":"+this.nonce+":"+n))},t.prototype.toString=function(){var e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")},t.prototype
.updateNcHex=function(){var e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e},e.DigestAuthentication=t}(t),function(t){var n;n={},e.navigator.webkitGetUserMedia?n.getUserMedia=e.navigator.webkitGetUserMedia.bind(navigator):e.navigator.mozGetUserMedia?n.getUserMedia=e.navigator.mozGetUserMedia.bind(navigator):e.navigator.getUserMedia&&(n.getUserMedia=e.navigator.getUserMedia.bind(navigator)),e.webkitRTCPeerConnection?n.RTCPeerConnection=e.webkitRTCPeerConnection:e.mozRTCPeerConnection?n.RTCPeerConnection=e.mozRTCPeerConnection:e.RTCPeerConnection&&(n.RTCPeerConnection=e.RTCPeerConnection),e.webkitRTCSessionDescription?n.RTCSessionDescription=e.webkitRTCSessionDescription:e.mozRTCSessionDescription?n.RTCSessionDescription=e.mozRTCSessionDescription:e.RTCSessionDescription&&(n.RTCSessionDescription=e.RTCSessionDescription),n.RTCPeerConnection&&n.RTCPeerConnection.prototype&&(n.RTCPeerConnection.prototype.getLocalStreams||(n.RTCPeerConnection.prototype.getLocalStreams=function(){return this.localStreams},n.RTCPeerConnection.prototype.getRemoteStreams=function(){return this.remoteStreams})),n.getUserMedia&&n.RTCPeerConnection&&n.RTCSessionDescription?n.isSupported=!0:n.isSupported=!1,t.WebRTC=n}(t),typeof module=="object"&&module&&typeof module.exports=="object"?module.exports=t:(e.JsSIP=t,typeof define=="function"&&define.amd&&define("jssip",[],function(){return t}))})(window);JsSIP.Grammar=function(){function jb(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var N={parse:function(e,F){function f(a){b<S||(b>S&&(S=b,Da=[]),Da.push(a))}function kb(){var a;"\r\n"===e.substr(b,2)?(a="\r\n",b+=2):(a=null,0===g&&f('"\\r\\n"'));return a}function t(){var a;/^[0-9]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=
null,0===g&&f("[0-9]"));return a}function T(){var a;/^[a-zA-Z]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[a-zA-Z]"));return a}function G(){var a;/^[0-9a-fA-F]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[0-9a-fA-F]"));return a}function U(){var a;a=C();null===a&&(a=K());return a}function Ea(){var a;/^[\0-\xFF]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[\\0-\\xFF]"));return a}function H(){var a;/^["]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f('["]'));
return a}function C(){var a;32===e.charCodeAt(b)?(a=" ",b++):(a=null,0===g&&f('" "'));return a}function K(){var a;9===e.charCodeAt(b)?(a="\t",b++):(a=null,0===g&&f('"\\t"'));return a}function J(){var a;/^[a-zA-Z0-9]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[a-zA-Z0-9]"));return a}function ga(){var a;59===e.charCodeAt(b)?(a=";",b++):(a=null,0===g&&f('";"'));null===a&&(47===e.charCodeAt(b)?(a="/",b++):(a=null,0===g&&f('"/"')),null===a&&(63===e.charCodeAt(b)?(a="?",b++):(a=null,0===g&&
f('"?"')),null===a&&(58===e.charCodeAt(b)?(a=":",b++):(a=null,0===g&&f('":"')),null===a&&(64===e.charCodeAt(b)?(a="@",b++):(a=null,0===g&&f('"@"')),null===a&&(38===e.charCodeAt(b)?(a="&",b++):(a=null,0===g&&f('"&"')),null===a&&(61===e.charCodeAt(b)?(a="=",b++):(a=null,0===g&&f('"="')),null===a&&(43===e.charCodeAt(b)?(a="+",b++):(a=null,0===g&&f('"+"')),null===a&&(36===e.charCodeAt(b)?(a="$",b++):(a=null,0===g&&f('"$"')),null===a&&(44===e.charCodeAt(b)?(a=",",b++):(a=null,0===g&&f('","')))))))))));
return a}function z(){var a;a=J();null===a&&(a=N());return a}function N(){var a;45===e.charCodeAt(b)?(a="-",b++):(a=null,0===g&&f('"-"'));null===a&&(95===e.charCodeAt(b)?(a="_",b++):(a=null,0===g&&f('"_"')),null===a&&(46===e.charCodeAt(b)?(a=".",b++):(a=null,0===g&&f('"."')),null===a&&(33===e.charCodeAt(b)?(a="!",b++):(a=null,0===g&&f('"!"')),null===a&&(126===e.charCodeAt(b)?(a="~",b++):(a=null,0===g&&f('"~"')),null===a&&(42===e.charCodeAt(b)?(a="*",b++):(a=null,0===g&&f('"*"')),null===a&&(39===e.charCodeAt(b)?
(a="'",b++):(a=null,0===g&&f('"\'"')),null===a&&(40===e.charCodeAt(b)?(a="(",b++):(a=null,0===g&&f('"("')),null===a&&(41===e.charCodeAt(b)?(a=")",b++):(a=null,0===g&&f('")"'))))))))));return a}function A(){var a,c,d,h,k;k=h=b;37===e.charCodeAt(b)?(a="%",b++):(a=null,0===g&&f('"%"'));null!==a?(c=G(),null!==c?(d=G(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=a.join(""));null===a&&(b=h);return a}function B(){var a,c,d,h,e;d=e=h=b;a=[];for(c=U();null!==c;)a.push(c),c=U();
null!==a?(c=kb(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);a=null!==a?a:"";if(null!==a){d=U();if(null!==d)for(c=[];null!==d;)c.push(d),d=U();else c=null;null!==c?a=[a,c]:(a=null,b=e)}else a=null,b=e;null!==a&&(a=" ");null===a&&(b=h);return a}function v(){var a;a=B();return null!==a?a:""}function lb(){var a,c,d,h,k;k=h=b;a=[];c=C();for(null===c&&(c=K());null!==c;)a.push(c),c=C(),null===c&&(c=K());null!==a?(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=v(),null!==d?a=[a,c,
d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=":");null===a&&(b=h);return a}function mb(){var a,c,d,h,k,f,g;f=k=b;c=L();if(null!==c)for(a=[];null!==c;)a.push(c),c=L();else a=null;if(null!==a){c=[];g=b;d=[];for(h=B();null!==h;)d.push(h),h=B();null!==d?(h=L(),null!==h?d=[d,h]:(d=null,b=g)):(d=null,b=g);for(;null!==d;){c.push(d);g=b;d=[];for(h=B();null!==h;)d.push(h),h=B();null!==d?(h=L(),null!==h?d=[d,h]:(d=null,b=g)):(d=null,b=g)}null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;null!==a&&(a=
e.substring(b,k));null===a&&(b=k);return a}function L(){var a;/^[!-~]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[!-~]"));null===a&&(a=O());return a}function O(){var a;/^[\x80-\uFFFF]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[\\x80-\\uFFFF]"));return a}function V(){var a;/^[\x80-\xBF]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[\\x80-\\xBF]"));return a}function u(){var a,c,d;d=b;c=J();null===c&&(45===e.charCodeAt(b)?(c="-",b++):(c=null,0===g&&f('"-"')),
null===c&&(46===e.charCodeAt(b)?(c=".",b++):(c=null,0===g&&f('"."')),null===c&&(33===e.charCodeAt(b)?(c="!",b++):(c=null,0===g&&f('"!"')),null===c&&(37===e.charCodeAt(b)?(c="%",b++):(c=null,0===g&&f('"%"')),null===c&&(42===e.charCodeAt(b)?(c="*",b++):(c=null,0===g&&f('"*"')),null===c&&(95===e.charCodeAt(b)?(c="_",b++):(c=null,0===g&&f('"_"')),null===c&&(43===e.charCodeAt(b)?(c="+",b++):(c=null,0===g&&f('"+"')),null===c&&(96===e.charCodeAt(b)?(c="`",b++):(c=null,0===g&&f('"`"')),null===c&&(39===e.charCodeAt(b)?
(c="'",b++):(c=null,0===g&&f('"\'"')),null===c&&(126===e.charCodeAt(b)?(c="~",b++):(c=null,0===g&&f('"~"'))))))))))));if(null!==c)for(a=[];null!==c;)a.push(c),c=J(),null===c&&(45===e.charCodeAt(b)?(c="-",b++):(c=null,0===g&&f('"-"')),null===c&&(46===e.charCodeAt(b)?(c=".",b++):(c=null,0===g&&f('"."')),null===c&&(33===e.charCodeAt(b)?(c="!",b++):(c=null,0===g&&f('"!"')),null===c&&(37===e.charCodeAt(b)?(c="%",b++):(c=null,0===g&&f('"%"')),null===c&&(42===e.charCodeAt(b)?(c="*",b++):(c=null,0===g&&f('"*"')),
null===c&&(95===e.charCodeAt(b)?(c="_",b++):(c=null,0===g&&f('"_"')),null===c&&(43===e.charCodeAt(b)?(c="+",b++):(c=null,0===g&&f('"+"')),null===c&&(96===e.charCodeAt(b)?(c="`",b++):(c=null,0===g&&f('"`"')),null===c&&(39===e.charCodeAt(b)?(c="'",b++):(c=null,0===g&&f('"\'"')),null===c&&(126===e.charCodeAt(b)?(c="~",b++):(c=null,0===g&&f('"~"'))))))))))));else a=null;null!==a&&(a=e.substring(b,d));null===a&&(b=d);return a}function ha(){var a,c,d;d=b;c=J();null===c&&(45===e.charCodeAt(b)?(c="-",b++):
(c=null,0===g&&f('"-"')),null===c&&(33===e.charCodeAt(b)?(c="!",b++):(c=null,0===g&&f('"!"')),null===c&&(37===e.charCodeAt(b)?(c="%",b++):(c=null,0===g&&f('"%"')),null===c&&(42===e.charCodeAt(b)?(c="*",b++):(c=null,0===g&&f('"*"')),null===c&&(95===e.charCodeAt(b)?(c="_",b++):(c=null,0===g&&f('"_"')),null===c&&(43===e.charCodeAt(b)?(c="+",b++):(c=null,0===g&&f('"+"')),null===c&&(96===e.charCodeAt(b)?(c="`",b++):(c=null,0===g&&f('"`"')),null===c&&(39===e.charCodeAt(b)?(c="'",b++):(c=null,0===g&&f('"\'"')),
null===c&&(126===e.charCodeAt(b)?(c="~",b++):(c=null,0===g&&f('"~"')))))))))));if(null!==c)for(a=[];null!==c;)a.push(c),c=J(),null===c&&(45===e.charCodeAt(b)?(c="-",b++):(c=null,0===g&&f('"-"')),null===c&&(33===e.charCodeAt(b)?(c="!",b++):(c=null,0===g&&f('"!"')),null===c&&(37===e.charCodeAt(b)?(c="%",b++):(c=null,0===g&&f('"%"')),null===c&&(42===e.charCodeAt(b)?(c="*",b++):(c=null,0===g&&f('"*"')),null===c&&(95===e.charCodeAt(b)?(c="_",b++):(c=null,0===g&&f('"_"')),null===c&&(43===e.charCodeAt(b)?
(c="+",b++):(c=null,0===g&&f('"+"')),null===c&&(96===e.charCodeAt(b)?(c="`",b++):(c=null,0===g&&f('"`"')),null===c&&(39===e.charCodeAt(b)?(c="'",b++):(c=null,0===g&&f('"\'"')),null===c&&(126===e.charCodeAt(b)?(c="~",b++):(c=null,0===g&&f('"~"')))))))))));else a=null;null!==a&&(a=e.substring(b,d));null===a&&(b=d);return a}function Fa(){var a,c,d;d=b;c=J();null===c&&(45===e.charCodeAt(b)?(c="-",b++):(c=null,0===g&&f('"-"')),null===c&&(46===e.charCodeAt(b)?(c=".",b++):(c=null,0===g&&f('"."')),null===
c&&(33===e.charCodeAt(b)?(c="!",b++):(c=null,0===g&&f('"!"')),null===c&&(37===e.charCodeAt(b)?(c="%",b++):(c=null,0===g&&f('"%"')),null===c&&(42===e.charCodeAt(b)?(c="*",b++):(c=null,0===g&&f('"*"')),null===c&&(95===e.charCodeAt(b)?(c="_",b++):(c=null,0===g&&f('"_"')),null===c&&(43===e.charCodeAt(b)?(c="+",b++):(c=null,0===g&&f('"+"')),null===c&&(96===e.charCodeAt(b)?(c="`",b++):(c=null,0===g&&f('"`"')),null===c&&(39===e.charCodeAt(b)?(c="'",b++):(c=null,0===g&&f('"\'"')),null===c&&(126===e.charCodeAt(b)?
(c="~",b++):(c=null,0===g&&f('"~"')),null===c&&(40===e.charCodeAt(b)?(c="(",b++):(c=null,0===g&&f('"("')),null===c&&(41===e.charCodeAt(b)?(c=")",b++):(c=null,0===g&&f('")"')),null===c&&(60===e.charCodeAt(b)?(c="<",b++):(c=null,0===g&&f('"<"')),null===c&&(62===e.charCodeAt(b)?(c=">",b++):(c=null,0===g&&f('">"')),null===c&&(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null===c&&(92===e.charCodeAt(b)?(c="\\",b++):(c=null,0===g&&f('"\\\\"')),null===c&&(c=H(),null===c&&(47===e.charCodeAt(b)?
(c="/",b++):(c=null,0===g&&f('"/"')),null===c&&(91===e.charCodeAt(b)?(c="[",b++):(c=null,0===g&&f('"["')),null===c&&(93===e.charCodeAt(b)?(c="]",b++):(c=null,0===g&&f('"]"')),null===c&&(63===e.charCodeAt(b)?(c="?",b++):(c=null,0===g&&f('"?"')),null===c&&(123===e.charCodeAt(b)?(c="{",b++):(c=null,0===g&&f('"{"')),null===c&&(125===e.charCodeAt(b)?(c="}",b++):(c=null,0===g&&f('"}"')))))))))))))))))))))))));if(null!==c)for(a=[];null!==c;)a.push(c),c=J(),null===c&&(45===e.charCodeAt(b)?(c="-",b++):(c=
null,0===g&&f('"-"')),null===c&&(46===e.charCodeAt(b)?(c=".",b++):(c=null,0===g&&f('"."')),null===c&&(33===e.charCodeAt(b)?(c="!",b++):(c=null,0===g&&f('"!"')),null===c&&(37===e.charCodeAt(b)?(c="%",b++):(c=null,0===g&&f('"%"')),null===c&&(42===e.charCodeAt(b)?(c="*",b++):(c=null,0===g&&f('"*"')),null===c&&(95===e.charCodeAt(b)?(c="_",b++):(c=null,0===g&&f('"_"')),null===c&&(43===e.charCodeAt(b)?(c="+",b++):(c=null,0===g&&f('"+"')),null===c&&(96===e.charCodeAt(b)?(c="`",b++):(c=null,0===g&&f('"`"')),
null===c&&(39===e.charCodeAt(b)?(c="'",b++):(c=null,0===g&&f('"\'"')),null===c&&(126===e.charCodeAt(b)?(c="~",b++):(c=null,0===g&&f('"~"')),null===c&&(40===e.charCodeAt(b)?(c="(",b++):(c=null,0===g&&f('"("')),null===c&&(41===e.charCodeAt(b)?(c=")",b++):(c=null,0===g&&f('")"')),null===c&&(60===e.charCodeAt(b)?(c="<",b++):(c=null,0===g&&f('"<"')),null===c&&(62===e.charCodeAt(b)?(c=">",b++):(c=null,0===g&&f('">"')),null===c&&(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null===c&&(92===
e.charCodeAt(b)?(c="\\",b++):(c=null,0===g&&f('"\\\\"')),null===c&&(c=H(),null===c&&(47===e.charCodeAt(b)?(c="/",b++):(c=null,0===g&&f('"/"')),null===c&&(91===e.charCodeAt(b)?(c="[",b++):(c=null,0===g&&f('"["')),null===c&&(93===e.charCodeAt(b)?(c="]",b++):(c=null,0===g&&f('"]"')),null===c&&(63===e.charCodeAt(b)?(c="?",b++):(c=null,0===g&&f('"?"')),null===c&&(123===e.charCodeAt(b)?(c="{",b++):(c=null,0===g&&f('"{"')),null===c&&(125===e.charCodeAt(b)?(c="}",b++):(c=null,0===g&&f('"}"')))))))))))))))))))))))));
else a=null;null!==a&&(a=e.substring(b,d));null===a&&(b=d);return a}function nb(){var a,c,d,h,k;k=h=b;a=v();null!==a?(42===e.charCodeAt(b)?(c="*",b++):(c=null,0===g&&f('"*"')),null!==c?(d=v(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a="*");null===a&&(b=h);return a}function ia(){var a,c,d,h,k;k=h=b;a=v();null!==a?(47===e.charCodeAt(b)?(c="/",b++):(c=null,0===g&&f('"/"')),null!==c?(d=v(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a="/");null===
a&&(b=h);return a}function w(){var a,c,d,h,k;k=h=b;a=v();null!==a?(61===e.charCodeAt(b)?(c="=",b++):(c=null,0===g&&f('"="')),null!==c?(d=v(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a="=");null===a&&(b=h);return a}function ob(){var a,c,d,h,k;k=h=b;a=v();null!==a?(40===e.charCodeAt(b)?(c="(",b++):(c=null,0===g&&f('"("')),null!==c?(d=v(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a="(");null===a&&(b=h);return a}function pb(){var a,c,d,h,k;k=
h=b;a=v();null!==a?(41===e.charCodeAt(b)?(c=")",b++):(c=null,0===g&&f('")"')),null!==c?(d=v(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=")");null===a&&(b=h);return a}function Ga(){var a,c,d,h;h=d=b;62===e.charCodeAt(b)?(a=">",b++):(a=null,0===g&&f('">"'));null!==a?(c=v(),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==a&&(a=">");null===a&&(b=d);return a}function Ha(){var a,c,d,h;h=d=b;a=v();null!==a?(60===e.charCodeAt(b)?(c="<",b++):(c=null,0===g&&f('"<"')),null!==
c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==a&&(a="<");null===a&&(b=d);return a}function x(){var a,c,d,h,k;k=h=b;a=v();null!==a?(44===e.charCodeAt(b)?(c=",",b++):(c=null,0===g&&f('","')),null!==c?(d=v(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=",");null===a&&(b=h);return a}function y(){var a,c,d,h,k;k=h=b;a=v();null!==a?(59===e.charCodeAt(b)?(c=";",b++):(c=null,0===g&&f('";"')),null!==c?(d=v(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=
";");null===a&&(b=h);return a}function qb(){var a,c,d,h,k;k=h=b;a=v();null!==a?(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=v(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=":");null===a&&(b=h);return a}function Ia(){var a,c,d,h;h=d=b;a=v();null!==a?(c=H(),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==a&&(a='"');null===a&&(b=d);return a}function Ja(){var a,c,d,h;h=d=b;a=H();null!==a?(c=v(),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==
a&&(a='"');null===a&&(b=d);return a}function Ka(){var a,c,d,h;h=b;a=ob();if(null!==a){c=[];d=La();null===d&&(d=M(),null===d&&(d=Ka()));for(;null!==d;)c.push(d),d=La(),null===d&&(d=M(),null===d&&(d=Ka()));null!==c?(d=pb(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)}else a=null,b=h;return a}function La(){var a;/^[!-']/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[!-']"));null===a&&(/^[*-[]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[*-[]")),null===a&&(/^[\]-~]/.test(e.charAt(b))?
(a=e.charAt(b),b++):(a=null,0===g&&f("[\\]-~]")),null===a&&(a=O(),null===a&&(a=B()))));return a}function W(){var a,c,d,h,k,g;g=k=b;a=v();if(null!==a)if(c=H(),null!==c){d=[];h=X();for(null===h&&(h=M());null!==h;)d.push(h),h=X(),null===h&&(h=M());null!==d?(h=H(),null!==h?a=[a,c,d,h]:(a=null,b=g)):(a=null,b=g)}else a=null,b=g;else a=null,b=g;null!==a&&(a=e.substring(b,k));null===a&&(b=k);return a}function ja(){var a,c,d,h,k,g;g=k=b;a=v();if(null!==a)if(c=H(),null!==c){d=[];h=X();for(null===h&&(h=M());null!==
h;)d.push(h),h=X(),null===h&&(h=M());null!==d?(h=H(),null!==h?a=[a,c,d,h]:(a=null,b=g)):(a=null,b=g)}else a=null,b=g;else a=null,b=g;null!==a&&(a=e.substring(b-1,k+1));null===a&&(b=k);return a}function X(){var a;a=B();null===a&&(33===e.charCodeAt(b)?(a="!",b++):(a=null,0===g&&f('"!"')),null===a&&(/^[#-[]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[#-[]")),null===a&&(/^[\]-~]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[\\]-~]")),null===a&&(a=O()))));return a}function M(){var a,
c,d;d=b;92===e.charCodeAt(b)?(a="\\",b++):(a=null,0===g&&f('"\\\\"'));null!==a?(/^[\0-\t]/.test(e.charAt(b))?(c=e.charAt(b),b++):(c=null,0===g&&f("[\\0-\\t]")),null===c&&(/^[\x0B-\f]/.test(e.charAt(b))?(c=e.charAt(b),b++):(c=null,0===g&&f("[\\x0B-\\f]")),null===c&&(/^[\x0E-\u007f]/.test(e.charAt(b))?(c=e.charAt(b),b++):(c=null,0===g&&f("[\\x0E-\u007f]")))),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return a}function ka(){var a,c,d,h,k,m;m=k=b;a=Ma();null!==a?(58===e.charCodeAt(b)?(c=":",b++):(c=
null,0===g&&f('":"')),null!==c?(d=la(),d=null!==d?d:"",null!==d?(h=ma(),null!==h?a=[a,c,d,h]:(a=null,b=m)):(a=null,b=m)):(a=null,b=m)):(a=null,b=m);if(null!==a){try{l.uri=new JsSIP.URI(l.scheme,l.user,l.host,l.port),delete l.scheme,delete l.user,delete l.host,delete l.host_type,delete l.port}catch(n){l=-1}a=void 0}null===a&&(b=k);return a}function na(){var a,c,d,h,k,m,n,r;r=n=b;a=Ma();null!==a?(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=la(),d=null!==d?d:"",null!==d?(h=
ma(),null!==h?(k=rb(),null!==k?(m=sb(),m=null!==m?m:"",null!==m?a=[a,c,d,h,k,m]:(a=null,b=r)):(a=null,b=r)):(a=null,b=r)):(a=null,b=r)):(a=null,b=r)):(a=null,b=r);if(null!==a){try{l.uri=new JsSIP.URI(l.scheme,l.user,l.host,l.port,l.uri_params,l.uri_headers),delete l.scheme,delete l.user,delete l.host,delete l.host_type,delete l.port,delete l.uri_params,"SIP_URI"===F&&(l=l.uri)}catch(q){l=-1}a=void 0}null===a&&(b=n);return a}function Ma(){var a,c;"sip"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),
b+=3):(a=null,0===g&&f('"sip"'));null===a&&(c=b,"sips"===e.substr(b,4).toLowerCase()?(a=e.substr(b,4),b+=4):(a=null,0===g&&f('"sips"')),null!==a&&(l.scheme=uri_scheme.toLowerCase(),a=void 0),null===a&&(b=c));return a}function la(){var a,c,d,h,k,m;k=h=b;a=tb();null!==a?(m=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=ub(),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c?(64===e.charCodeAt(b)?(d="@",b++):(d=null,0===g&&f('"@"')),null!==d?a=[a,c,d]:(a=null,
b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.user=window.decodeURIComponent(e.substring(b-1,h)),a=void 0);null===a&&(b=h);return a}function tb(){var a,b;b=z();null===b&&(b=A(),null===b&&(b=Na()));if(null!==b)for(a=[];null!==b;)a.push(b),b=z(),null===b&&(b=A(),null===b&&(b=Na()));else a=null;return a}function Na(){var a;38===e.charCodeAt(b)?(a="&",b++):(a=null,0===g&&f('"&"'));null===a&&(61===e.charCodeAt(b)?(a="=",b++):(a=null,0===g&&f('"="')),null===a&&(43===e.charCodeAt(b)?(a="+",b++):(a=null,
0===g&&f('"+"')),null===a&&(36===e.charCodeAt(b)?(a="$",b++):(a=null,0===g&&f('"$"')),null===a&&(44===e.charCodeAt(b)?(a=",",b++):(a=null,0===g&&f('","')),null===a&&(59===e.charCodeAt(b)?(a=";",b++):(a=null,0===g&&f('";"')),null===a&&(63===e.charCodeAt(b)?(a="?",b++):(a=null,0===g&&f('"?"')),null===a&&(47===e.charCodeAt(b)?(a="/",b++):(a=null,0===g&&f('"/"')))))))));return a}function ub(){var a,c,d;d=b;a=[];c=z();null===c&&(c=A(),null===c&&(38===e.charCodeAt(b)?(c="&",b++):(c=null,0===g&&f('"&"')),
null===c&&(61===e.charCodeAt(b)?(c="=",b++):(c=null,0===g&&f('"="')),null===c&&(43===e.charCodeAt(b)?(c="+",b++):(c=null,0===g&&f('"+"')),null===c&&(36===e.charCodeAt(b)?(c="$",b++):(c=null,0===g&&f('"$"')),null===c&&(44===e.charCodeAt(b)?(c=",",b++):(c=null,0===g&&f('","'))))))));for(;null!==c;)a.push(c),c=z(),null===c&&(c=A(),null===c&&(38===e.charCodeAt(b)?(c="&",b++):(c=null,0===g&&f('"&"')),null===c&&(61===e.charCodeAt(b)?(c="=",b++):(c=null,0===g&&f('"="')),null===c&&(43===e.charCodeAt(b)?(c=
"+",b++):(c=null,0===g&&f('"+"')),null===c&&(36===e.charCodeAt(b)?(c="$",b++):(c=null,0===g&&f('"$"')),null===c&&(44===e.charCodeAt(b)?(c=",",b++):(c=null,0===g&&f('","'))))))));null!==a&&(l.password=e.substring(b,d),a=void 0);null===a&&(b=d);return a}function ma(){var a,c,d,h,k;h=b;a=Y();null!==a?(k=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=Oa(),null!==d?c=[c,d]:(c=null,b=k)):(c=null,b=k),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);return a}function Y(){var a,
c;c=b;a=P();null===a&&(a=oa(),null===a&&(a=Pa()));null!==a&&(l.host=e.substring(b,c).toLowerCase(),a=l.host);null===a&&(b=c);return a}function Pa(){var a,c,d,h,k,m;k=h=b;a=[];m=b;c=Qa();null!==c?(46===e.charCodeAt(b)?(d=".",b++):(d=null,0===g&&f('"."')),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m);for(;null!==c;)a.push(c),m=b,c=Qa(),null!==c?(46===e.charCodeAt(b)?(d=".",b++):(d=null,0===g&&f('"."')),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m);null!==a?(c=vb(),null!==c?(46===e.charCodeAt(b)?(d=".",
b++):(d=null,0===g&&f('"."')),d=null!==d?d:"",null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.host_type="domain",a=e.substring(b,h));null===a&&(b=h);return a}function Qa(){var a,c;/^[a-zA-Z0-9_\-]/.test(e.charAt(b))?(c=e.charAt(b),b++):(c=null,0===g&&f("[a-zA-Z0-9_\\-]"));if(null!==c)for(a=[];null!==c;)a.push(c),/^[a-zA-Z0-9_\-]/.test(e.charAt(b))?(c=e.charAt(b),b++):(c=null,0===g&&f("[a-zA-Z0-9_\\-]"));else a=null;return a}function vb(){var a,c;/^[a-zA-Z0-9_\-]/.test(e.charAt(b))?
(c=e.charAt(b),b++):(c=null,0===g&&f("[a-zA-Z0-9_\\-]"));if(null!==c)for(a=[];null!==c;)a.push(c),/^[a-zA-Z0-9_\-]/.test(e.charAt(b))?(c=e.charAt(b),b++):(c=null,0===g&&f("[a-zA-Z0-9_\\-]"));else a=null;return a}function oa(){var a,c,d,h,k;k=h=b;91===e.charCodeAt(b)?(a="[",b++):(a=null,0===g&&f('"["'));null!==a?(c=Ra(),null!==c?(93===e.charCodeAt(b)?(d="]",b++):(d=null,0===g&&f('"]"')),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.host_type="IPv6",a=e.substring(b,h));null===
a&&(b=h);return a}function Ra(){var a,c,d,h,k,m,n,r,q,t,u,v,w,x,p;p=x=b;a=s();null!==a?(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=s(),null!==d?(58===e.charCodeAt(b)?(h=":",b++):(h=null,0===g&&f('":"')),null!==h?(k=s(),null!==k?(58===e.charCodeAt(b)?(m=":",b++):(m=null,0===g&&f('":"')),null!==m?(n=s(),null!==n?(58===e.charCodeAt(b)?(r=":",b++):(r=null,0===g&&f('":"')),null!==r?(q=s(),null!==q?(58===e.charCodeAt(b)?(t=":",b++):(t=null,0===g&&f('":"')),null!==t?(u=s(),null!==
u?(58===e.charCodeAt(b)?(v=":",b++):(v=null,0===g&&f('":"')),null!==v?(w=E(),null!==w?a=[a,c,d,h,k,m,n,r,q,t,u,v,w]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p);null===a&&(p=b,"::"===e.substr(b,2)?(a="::",b+=2):(a=null,0===g&&f('"::"')),null!==a?(c=s(),null!==c?(58===e.charCodeAt(b)?(d=":",b++):(d=null,0===g&&f('":"')),null!==d?(h=s(),null!==h?(58===e.charCodeAt(b)?
(k=":",b++):(k=null,0===g&&f('":"')),null!==k?(m=s(),null!==m?(58===e.charCodeAt(b)?(n=":",b++):(n=null,0===g&&f('":"')),null!==n?(r=s(),null!==r?(58===e.charCodeAt(b)?(q=":",b++):(q=null,0===g&&f('":"')),null!==q?(t=s(),null!==t?(58===e.charCodeAt(b)?(u=":",b++):(u=null,0===g&&f('":"')),null!==u?(v=E(),null!==v?a=[a,c,d,h,k,m,n,r,q,t,u,v]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,
b=p),null===a&&(p=b,"::"===e.substr(b,2)?(a="::",b+=2):(a=null,0===g&&f('"::"')),null!==a?(c=s(),null!==c?(58===e.charCodeAt(b)?(d=":",b++):(d=null,0===g&&f('":"')),null!==d?(h=s(),null!==h?(58===e.charCodeAt(b)?(k=":",b++):(k=null,0===g&&f('":"')),null!==k?(m=s(),null!==m?(58===e.charCodeAt(b)?(n=":",b++):(n=null,0===g&&f('":"')),null!==n?(r=s(),null!==r?(58===e.charCodeAt(b)?(q=":",b++):(q=null,0===g&&f('":"')),null!==q?(t=E(),null!==t?a=[a,c,d,h,k,m,n,r,q,t]:(a=null,b=p)):(a=null,b=p)):(a=null,
b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,"::"===e.substr(b,2)?(a="::",b+=2):(a=null,0===g&&f('"::"')),null!==a?(c=s(),null!==c?(58===e.charCodeAt(b)?(d=":",b++):(d=null,0===g&&f('":"')),null!==d?(h=s(),null!==h?(58===e.charCodeAt(b)?(k=":",b++):(k=null,0===g&&f('":"')),null!==k?(m=s(),null!==m?(58===e.charCodeAt(b)?(n=":",b++):(n=null,0===g&&f('":"')),null!==n?(r=E(),null!==r?a=[a,c,d,h,k,m,n,r]:(a=null,b=p)):(a=null,b=p)):
(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,"::"===e.substr(b,2)?(a="::",b+=2):(a=null,0===g&&f('"::"')),null!==a?(c=s(),null!==c?(58===e.charCodeAt(b)?(d=":",b++):(d=null,0===g&&f('":"')),null!==d?(h=s(),null!==h?(58===e.charCodeAt(b)?(k=":",b++):(k=null,0===g&&f('":"')),null!==k?(m=E(),null!==m?a=[a,c,d,h,k,m]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,"::"===e.substr(b,2)?(a="::",b+=2):
(a=null,0===g&&f('"::"')),null!==a?(c=s(),null!==c?(58===e.charCodeAt(b)?(d=":",b++):(d=null,0===g&&f('":"')),null!==d?(h=E(),null!==h?a=[a,c,d,h]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,"::"===e.substr(b,2)?(a="::",b+=2):(a=null,0===g&&f('"::"')),null!==a?(c=E(),null!==c?a=[a,c]:(a=null,b=p)):(a=null,b=p),null===a&&(p=b,"::"===e.substr(b,2)?(a="::",b+=2):(a=null,0===g&&f('"::"')),null!==a?(c=s(),null!==c?a=[a,c]:(a=null,b=p)):(a=null,b=p),null===a&&(p=b,a=s(),null!==
a?("::"===e.substr(b,2)?(c="::",b+=2):(c=null,0===g&&f('"::"')),null!==c?(d=s(),null!==d?(58===e.charCodeAt(b)?(h=":",b++):(h=null,0===g&&f('":"')),null!==h?(k=s(),null!==k?(58===e.charCodeAt(b)?(m=":",b++):(m=null,0===g&&f('":"')),null!==m?(n=s(),null!==n?(58===e.charCodeAt(b)?(r=":",b++):(r=null,0===g&&f('":"')),null!==r?(q=s(),null!==q?(58===e.charCodeAt(b)?(t=":",b++):(t=null,0===g&&f('":"')),null!==t?(u=E(),null!==u?a=[a,c,d,h,k,m,n,r,q,t,u]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,
b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,a=s(),null!==a?(q=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=s(),null!==d?c=[c,d]:(c=null,b=q)):(c=null,b=q),c=null!==c?c:"",null!==c?("::"===e.substr(b,2)?(d="::",b+=2):(d=null,0===g&&f('"::"')),null!==d?(h=s(),null!==h?(58===e.charCodeAt(b)?(k=":",b++):(k=null,0===g&&f('":"')),null!==k?(m=s(),null!==m?(58===e.charCodeAt(b)?(n=":",b++):(n=null,0===g&&
f('":"')),null!==n?(r=s(),null!==r?(58===e.charCodeAt(b)?(q=":",b++):(q=null,0===g&&f('":"')),null!==q?(t=E(),null!==t?a=[a,c,d,h,k,m,n,r,q,t]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,a=s(),null!==a?(q=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=s(),null!==d?c=[c,d]:(c=null,b=q)):(c=null,b=q),c=null!==c?c:"",null!==c?(q=b,58===e.charCodeAt(b)?(d=":",b++):(d=
null,0===g&&f('":"')),null!==d?(h=s(),null!==h?d=[d,h]:(d=null,b=q)):(d=null,b=q),d=null!==d?d:"",null!==d?("::"===e.substr(b,2)?(h="::",b+=2):(h=null,0===g&&f('"::"')),null!==h?(k=s(),null!==k?(58===e.charCodeAt(b)?(m=":",b++):(m=null,0===g&&f('":"')),null!==m?(n=s(),null!==n?(58===e.charCodeAt(b)?(r=":",b++):(r=null,0===g&&f('":"')),null!==r?(q=E(),null!==q?a=[a,c,d,h,k,m,n,r,q]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,
b=p),null===a&&(p=b,a=s(),null!==a?(q=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=s(),null!==d?c=[c,d]:(c=null,b=q)):(c=null,b=q),c=null!==c?c:"",null!==c?(q=b,58===e.charCodeAt(b)?(d=":",b++):(d=null,0===g&&f('":"')),null!==d?(h=s(),null!==h?d=[d,h]:(d=null,b=q)):(d=null,b=q),d=null!==d?d:"",null!==d?(q=b,58===e.charCodeAt(b)?(h=":",b++):(h=null,0===g&&f('":"')),null!==h?(k=s(),null!==k?h=[h,k]:(h=null,b=q)):(h=null,b=q),h=null!==h?h:"",null!==h?("::"===e.substr(b,2)?
(k="::",b+=2):(k=null,0===g&&f('"::"')),null!==k?(m=s(),null!==m?(58===e.charCodeAt(b)?(n=":",b++):(n=null,0===g&&f('":"')),null!==n?(r=E(),null!==r?a=[a,c,d,h,k,m,n,r]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,a=s(),null!==a?(q=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=s(),null!==d?c=[c,d]:(c=null,b=q)):(c=null,b=q),c=null!==c?c:"",null!==c?(q=b,58===e.charCodeAt(b)?(d=":",b++):(d=null,
0===g&&f('":"')),null!==d?(h=s(),null!==h?d=[d,h]:(d=null,b=q)):(d=null,b=q),d=null!==d?d:"",null!==d?(q=b,58===e.charCodeAt(b)?(h=":",b++):(h=null,0===g&&f('":"')),null!==h?(k=s(),null!==k?h=[h,k]:(h=null,b=q)):(h=null,b=q),h=null!==h?h:"",null!==h?(q=b,58===e.charCodeAt(b)?(k=":",b++):(k=null,0===g&&f('":"')),null!==k?(m=s(),null!==m?k=[k,m]:(k=null,b=q)):(k=null,b=q),k=null!==k?k:"",null!==k?("::"===e.substr(b,2)?(m="::",b+=2):(m=null,0===g&&f('"::"')),null!==m?(n=E(),null!==n?a=[a,c,d,h,k,m,n]:
(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,a=s(),null!==a?(q=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=s(),null!==d?c=[c,d]:(c=null,b=q)):(c=null,b=q),c=null!==c?c:"",null!==c?(q=b,58===e.charCodeAt(b)?(d=":",b++):(d=null,0===g&&f('":"')),null!==d?(h=s(),null!==h?d=[d,h]:(d=null,b=q)):(d=null,b=q),d=null!==d?d:"",null!==d?(q=b,58===e.charCodeAt(b)?(h=":",b++):(h=null,0===g&&f('":"')),null!==h?(k=s(),
null!==k?h=[h,k]:(h=null,b=q)):(h=null,b=q),h=null!==h?h:"",null!==h?(q=b,58===e.charCodeAt(b)?(k=":",b++):(k=null,0===g&&f('":"')),null!==k?(m=s(),null!==m?k=[k,m]:(k=null,b=q)):(k=null,b=q),k=null!==k?k:"",null!==k?(q=b,58===e.charCodeAt(b)?(m=":",b++):(m=null,0===g&&f('":"')),null!==m?(n=s(),null!==n?m=[m,n]:(m=null,b=q)):(m=null,b=q),m=null!==m?m:"",null!==m?("::"===e.substr(b,2)?(n="::",b+=2):(n=null,0===g&&f('"::"')),null!==n?(r=s(),null!==r?a=[a,c,d,h,k,m,n,r]:(a=null,b=p)):(a=null,b=p)):(a=
null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p),null===a&&(p=b,a=s(),null!==a?(q=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=s(),null!==d?c=[c,d]:(c=null,b=q)):(c=null,b=q),c=null!==c?c:"",null!==c?(q=b,58===e.charCodeAt(b)?(d=":",b++):(d=null,0===g&&f('":"')),null!==d?(h=s(),null!==h?d=[d,h]:(d=null,b=q)):(d=null,b=q),d=null!==d?d:"",null!==d?(q=b,58===e.charCodeAt(b)?(h=":",b++):(h=null,0===g&&f('":"')),null!==h?(k=s(),null!==k?h=[h,k]:
(h=null,b=q)):(h=null,b=q),h=null!==h?h:"",null!==h?(q=b,58===e.charCodeAt(b)?(k=":",b++):(k=null,0===g&&f('":"')),null!==k?(m=s(),null!==m?k=[k,m]:(k=null,b=q)):(k=null,b=q),k=null!==k?k:"",null!==k?(q=b,58===e.charCodeAt(b)?(m=":",b++):(m=null,0===g&&f('":"')),null!==m?(n=s(),null!==n?m=[m,n]:(m=null,b=q)):(m=null,b=q),m=null!==m?m:"",null!==m?(q=b,58===e.charCodeAt(b)?(n=":",b++):(n=null,0===g&&f('":"')),null!==n?(r=s(),null!==r?n=[n,r]:(n=null,b=q)):(n=null,b=q),n=null!==n?n:"",null!==n?("::"===
e.substr(b,2)?(r="::",b+=2):(r=null,0===g&&f('"::"')),null!==r?a=[a,c,d,h,k,m,n,r]:(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)):(a=null,b=p)))))))))))))));null!==a&&(l.host_type="IPv6",a=e.substring(b,x));null===a&&(b=x);return a}function s(){var a,c,d,h,e;e=b;a=G();null!==a?(c=G(),c=null!==c?c:"",null!==c?(d=G(),d=null!==d?d:"",null!==d?(h=G(),h=null!==h?h:"",null!==h?a=[a,c,d,h]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}
function E(){var a,c,d,h;h=b;a=s();null!==a?(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=s(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);null===a&&(a=P());return a}function P(){var a,c,d,h,k,m,n,r,q;q=r=b;a=Z();null!==a?(46===e.charCodeAt(b)?(c=".",b++):(c=null,0===g&&f('"."')),null!==c?(d=Z(),null!==d?(46===e.charCodeAt(b)?(h=".",b++):(h=null,0===g&&f('"."')),null!==h?(k=Z(),null!==k?(46===e.charCodeAt(b)?(m=".",b++):(m=null,0===g&&f('"."')),null!==m?(n=
Z(),null!==n?a=[a,c,d,h,k,m,n]:(a=null,b=q)):(a=null,b=q)):(a=null,b=q)):(a=null,b=q)):(a=null,b=q)):(a=null,b=q)):(a=null,b=q);null!==a&&(l.host_type="IPv4",a=e.substring(b,r));null===a&&(b=r);return a}function Z(){var a,c,d,h;h=b;"25"===e.substr(b,2)?(a="25",b+=2):(a=null,0===g&&f('"25"'));null!==a?(/^[0-5]/.test(e.charAt(b))?(c=e.charAt(b),b++):(c=null,0===g&&f("[0-5]")),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null===a&&(h=b,50===e.charCodeAt(b)?(a="2",b++):(a=null,0===g&&f('"2"')),null!==
a?(/^[0-4]/.test(e.charAt(b))?(c=e.charAt(b),b++):(c=null,0===g&&f("[0-4]")),null!==c?(d=t(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h),null===a&&(h=b,49===e.charCodeAt(b)?(a="1",b++):(a=null,0===g&&f('"1"')),null!==a?(c=t(),null!==c?(d=t(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h),null===a&&(h=b,/^[1-9]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[1-9]")),null!==a?(c=t(),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h),null===a&&(a=t()))));return a}function Oa(){var a,
c,d,h,e,g,f;f=g=b;a=t();a=null!==a?a:"";null!==a?(c=t(),c=null!==c?c:"",null!==c?(d=t(),d=null!==d?d:"",null!==d?(h=t(),h=null!==h?h:"",null!==h?(e=t(),e=null!==e?e:"",null!==e?a=[a,c,d,h,e]:(a=null,b=f)):(a=null,b=f)):(a=null,b=f)):(a=null,b=f)):(a=null,b=f);null!==a&&(a=parseInt(a.join("")),l.port=a);null===a&&(b=g);return a}function rb(){var a,c,d,h;a=[];h=b;59===e.charCodeAt(b)?(c=";",b++):(c=null,0===g&&f('";"'));null!==c?(d=Sa(),null!==d?c=[c,d]:(c=null,b=h)):(c=null,b=h);for(;null!==c;)a.push(c),
h=b,59===e.charCodeAt(b)?(c=";",b++):(c=null,0===g&&f('";"')),null!==c?(d=Sa(),null!==d?c=[c,d]:(c=null,b=h)):(c=null,b=h);return a}function Sa(){var a;a=wb();null===a&&(a=xb(),null===a&&(a=yb(),null===a&&(a=zb(),null===a&&(a=Ab(),null===a&&(a=Bb(),null===a&&(a=Cb()))))));return a}function wb(){var a,c,d,h;h=d=b;"transport="===e.substr(b,10).toLowerCase()?(a=e.substr(b,10),b+=10):(a=null,0===g&&f('"transport="'));null!==a?("udp"===e.substr(b,3).toLowerCase()?(c=e.substr(b,3),b+=3):(c=null,0===g&&
f('"udp"')),null===c&&("tcp"===e.substr(b,3).toLowerCase()?(c=e.substr(b,3),b+=3):(c=null,0===g&&f('"tcp"')),null===c&&("sctp"===e.substr(b,4).toLowerCase()?(c=e.substr(b,4),b+=4):(c=null,0===g&&f('"sctp"')),null===c&&("tls"===e.substr(b,3).toLowerCase()?(c=e.substr(b,3),b+=3):(c=null,0===g&&f('"tls"')),null===c&&(c=u())))),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==a&&(a=a[1],l.uri_params||(l.uri_params={}),l.uri_params.transport=a.toLowerCase(),a=void 0);null===a&&(b=d);return a}function xb(){var a,
c,d,h;h=d=b;"user="===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"user="'));null!==a?("phone"===e.substr(b,5).toLowerCase()?(c=e.substr(b,5),b+=5):(c=null,0===g&&f('"phone"')),null===c&&("ip"===e.substr(b,2).toLowerCase()?(c=e.substr(b,2),b+=2):(c=null,0===g&&f('"ip"')),null===c&&(c=u())),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==a&&(a=a[1],l.uri_params||(l.uri_params={}),l.uri_params.user=a.toLowerCase(),a=void 0);null===a&&(b=d);return a}function yb(){var a,c,
d,h;h=d=b;"method="===e.substr(b,7).toLowerCase()?(a=e.substr(b,7),b+=7):(a=null,0===g&&f('"method="'));null!==a?(c=pa(),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==a&&(a=a[1],l.uri_params||(l.uri_params={}),l.uri_params.method=a,a=void 0);null===a&&(b=d);return a}function zb(){var a,c,d,h;h=d=b;"ttl="===e.substr(b,4).toLowerCase()?(a=e.substr(b,4),b+=4):(a=null,0===g&&f('"ttl="'));null!==a?(c=Ta(),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==a&&(a=a[1],l.params||(l.params={}),l.params.ttl=
a,a=void 0);null===a&&(b=d);return a}function Ab(){var a,c,d,h;h=d=b;"maddr="===e.substr(b,6).toLowerCase()?(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"maddr="'));null!==a?(c=Y(),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);null!==a&&(a=a[1],l.uri_params||(l.uri_params={}),l.uri_params.maddr=a,a=void 0);null===a&&(b=d);return a}function Bb(){var a,c,d,h,k,m;k=h=b;"lr"===e.substr(b,2).toLowerCase()?(a=e.substr(b,2),b+=2):(a=null,0===g&&f('"lr"'));null!==a?(m=b,61===e.charCodeAt(b)?(c="=",b++):(c=null,
0===g&&f('"="')),null!==c?(d=u(),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=k)):(a=null,b=k);null!==a&&(l.uri_params||(l.uri_params={}),a=l.uri_params.lr=void 0);null===a&&(b=h);return a}function Cb(){var a,c,d,h,k,m;k=h=b;a=Db();null!==a?(m=b,61===e.charCodeAt(b)?(c="=",b++):(c=null,0===g&&f('"="')),null!==c?(d=Eb(),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=k)):(a=null,b=k);null!==a&&(c=a[0],a=a[1],l.uri_params||
(l.uri_params={}),a="undefined"===typeof a?void 0:a[1],l.uri_params[c.toLowerCase()]=a&&a.toLowerCase(),a=void 0);null===a&&(b=h);return a}function Db(){var a,c,d;d=b;c=$();if(null!==c)for(a=[];null!==c;)a.push(c),c=$();else a=null;null!==a&&(a=a.join(""));null===a&&(b=d);return a}function Eb(){var a,c,d;d=b;c=$();if(null!==c)for(a=[];null!==c;)a.push(c),c=$();else a=null;null!==a&&(a=a.join(""));null===a&&(b=d);return a}function $(){var a;a=Fb();null===a&&(a=z(),null===a&&(a=A()));return a}function Fb(){var a;
91===e.charCodeAt(b)?(a="[",b++):(a=null,0===g&&f('"["'));null===a&&(93===e.charCodeAt(b)?(a="]",b++):(a=null,0===g&&f('"]"')),null===a&&(47===e.charCodeAt(b)?(a="/",b++):(a=null,0===g&&f('"/"')),null===a&&(58===e.charCodeAt(b)?(a=":",b++):(a=null,0===g&&f('":"')),null===a&&(38===e.charCodeAt(b)?(a="&",b++):(a=null,0===g&&f('"&"')),null===a&&(43===e.charCodeAt(b)?(a="+",b++):(a=null,0===g&&f('"+"')),null===a&&(36===e.charCodeAt(b)?(a="$",b++):(a=null,0===g&&f('"$"'))))))));return a}function sb(){var a,
c,d,h,k,m,n;m=b;63===e.charCodeAt(b)?(a="?",b++):(a=null,0===g&&f('"?"'));if(null!==a)if(c=qa(),null!==c){d=[];n=b;38===e.charCodeAt(b)?(h="&",b++):(h=null,0===g&&f('"&"'));null!==h?(k=qa(),null!==k?h=[h,k]:(h=null,b=n)):(h=null,b=n);for(;null!==h;)d.push(h),n=b,38===e.charCodeAt(b)?(h="&",b++):(h=null,0===g&&f('"&"')),null!==h?(k=qa(),null!==k?h=[h,k]:(h=null,b=n)):(h=null,b=n);null!==d?a=[a,c,d]:(a=null,b=m)}else a=null,b=m;else a=null,b=m;return a}function qa(){var a,c,d,h,k;k=h=b;a=Gb();null!==
a?(61===e.charCodeAt(b)?(c="=",b++):(c=null,0===g&&f('"="')),null!==c?(d=Hb(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(c=a[0],a=a[2],c=c.join("").toLowerCase(),a=a.join(""),l.uri_headers||(l.uri_headers={}),l.uri_headers[c]?l.uri_headers[c].push(a):l.uri_headers[c]=[a],a=void 0);null===a&&(b=h);return a}function Gb(){var a,b;b=aa();null===b&&(b=z(),null===b&&(b=A()));if(null!==b)for(a=[];null!==b;)a.push(b),b=aa(),null===b&&(b=z(),null===b&&(b=A()));else a=null;return a}
function Hb(){var a,b;a=[];b=aa();null===b&&(b=z(),null===b&&(b=A()));for(;null!==b;)a.push(b),b=aa(),null===b&&(b=z(),null===b&&(b=A()));return a}function aa(){var a;91===e.charCodeAt(b)?(a="[",b++):(a=null,0===g&&f('"["'));null===a&&(93===e.charCodeAt(b)?(a="]",b++):(a=null,0===g&&f('"]"')),null===a&&(47===e.charCodeAt(b)?(a="/",b++):(a=null,0===g&&f('"/"')),null===a&&(63===e.charCodeAt(b)?(a="?",b++):(a=null,0===g&&f('"?"')),null===a&&(58===e.charCodeAt(b)?(a=":",b++):(a=null,0===g&&f('":"')),
null===a&&(43===e.charCodeAt(b)?(a="+",b++):(a=null,0===g&&f('"+"')),null===a&&(36===e.charCodeAt(b)?(a="$",b++):(a=null,0===g&&f('"$"'))))))));return a}function Ib(){var a,c,d,h,e,g;g=b;a=pa();null!==a?(c=C(),null!==c?(d=Jb(),null!==d?(h=C(),null!==h?(e=Ua(),null!==e?a=[a,c,d,h,e]:(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g);return a}function Jb(){var a;a=na();null===a&&(a=Va());return a}function Va(){var a,c,d,h;h=b;a=Kb();null!==a?(58===e.charCodeAt(b)?(c=":",b++):(c=null,
0===g&&f('":"')),null!==c?(d=Lb(),null===d&&(d=Mb()),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);return a}function Lb(){var a,c,d,h,k;h=b;a=Nb();null===a&&(a=ra());null!==a?(k=b,63===e.charCodeAt(b)?(c="?",b++):(c=null,0===g&&f('"?"')),null!==c?(d=Ob(),null!==d?c=[c,d]:(c=null,b=k)):(c=null,b=k),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);return a}function Nb(){var a,c,d,h;h=b;"//"===e.substr(b,2)?(a="//",b+=2):(a=null,0===g&&f('"//"'));null!==a?(c=Pb(),null!==c?(d=
ra(),d=null!==d?d:"",null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);return a}function ra(){var a,c,d;d=b;47===e.charCodeAt(b)?(a="/",b++):(a=null,0===g&&f('"/"'));null!==a?(c=Qb(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return a}function Mb(){var a,c,d,h;h=b;a=Rb();if(null!==a){c=[];for(d=ba();null!==d;)c.push(d),d=ba();null!==c?a=[a,c]:(a=null,b=h)}else a=null,b=h;return a}function ba(){var a;a=ga();null===a&&(a=z(),null===a&&(a=A()));return a}function Rb(){var a;a=z();null===a&&
(a=A(),null===a&&(59===e.charCodeAt(b)?(a=";",b++):(a=null,0===g&&f('";"')),null===a&&(63===e.charCodeAt(b)?(a="?",b++):(a=null,0===g&&f('"?"')),null===a&&(58===e.charCodeAt(b)?(a=":",b++):(a=null,0===g&&f('":"')),null===a&&(64===e.charCodeAt(b)?(a="@",b++):(a=null,0===g&&f('"@"')),null===a&&(38===e.charCodeAt(b)?(a="&",b++):(a=null,0===g&&f('"&"')),null===a&&(61===e.charCodeAt(b)?(a="=",b++):(a=null,0===g&&f('"="')),null===a&&(43===e.charCodeAt(b)?(a="+",b++):(a=null,0===g&&f('"+"')),null===a&&(36===
e.charCodeAt(b)?(a="$",b++):(a=null,0===g&&f('"$"')),null===a&&(44===e.charCodeAt(b)?(a=",",b++):(a=null,0===g&&f('","'))))))))))));return a}function Qb(){var a,c,d,h,k,m;k=b;a=sa();if(null!==a){c=[];m=b;47===e.charCodeAt(b)?(d="/",b++):(d=null,0===g&&f('"/"'));null!==d?(h=sa(),null!==h?d=[d,h]:(d=null,b=m)):(d=null,b=m);for(;null!==d;)c.push(d),m=b,47===e.charCodeAt(b)?(d="/",b++):(d=null,0===g&&f('"/"')),null!==d?(h=sa(),null!==h?d=[d,h]:(d=null,b=m)):(d=null,b=m);null!==c?a=[a,c]:(a=null,b=k)}else a=
null,b=k;return a}function sa(){var a,c,d,h,k,m;k=b;a=[];for(c=ca();null!==c;)a.push(c),c=ca();if(null!==a){c=[];m=b;59===e.charCodeAt(b)?(d=";",b++):(d=null,0===g&&f('";"'));null!==d?(h=Wa(),null!==h?d=[d,h]:(d=null,b=m)):(d=null,b=m);for(;null!==d;)c.push(d),m=b,59===e.charCodeAt(b)?(d=";",b++):(d=null,0===g&&f('";"')),null!==d?(h=Wa(),null!==h?d=[d,h]:(d=null,b=m)):(d=null,b=m);null!==c?a=[a,c]:(a=null,b=k)}else a=null,b=k;return a}function Wa(){var a,b;a=[];for(b=ca();null!==b;)a.push(b),b=ca();
return a}function ca(){var a;a=z();null===a&&(a=A(),null===a&&(58===e.charCodeAt(b)?(a=":",b++):(a=null,0===g&&f('":"')),null===a&&(64===e.charCodeAt(b)?(a="@",b++):(a=null,0===g&&f('"@"')),null===a&&(38===e.charCodeAt(b)?(a="&",b++):(a=null,0===g&&f('"&"')),null===a&&(61===e.charCodeAt(b)?(a="=",b++):(a=null,0===g&&f('"="')),null===a&&(43===e.charCodeAt(b)?(a="+",b++):(a=null,0===g&&f('"+"')),null===a&&(36===e.charCodeAt(b)?(a="$",b++):(a=null,0===g&&f('"$"')),null===a&&(44===e.charCodeAt(b)?(a=
",",b++):(a=null,0===g&&f('","'))))))))));return a}function Kb(){var a,c,d,h,k;k=h=b;a=T();if(null!==a){c=[];d=T();null===d&&(d=t(),null===d&&(43===e.charCodeAt(b)?(d="+",b++):(d=null,0===g&&f('"+"')),null===d&&(45===e.charCodeAt(b)?(d="-",b++):(d=null,0===g&&f('"-"')),null===d&&(46===e.charCodeAt(b)?(d=".",b++):(d=null,0===g&&f('"."'))))));for(;null!==d;)c.push(d),d=T(),null===d&&(d=t(),null===d&&(43===e.charCodeAt(b)?(d="+",b++):(d=null,0===g&&f('"+"')),null===d&&(45===e.charCodeAt(b)?(d="-",b++):
(d=null,0===g&&f('"-"')),null===d&&(46===e.charCodeAt(b)?(d=".",b++):(d=null,0===g&&f('"."'))))));null!==c?a=[a,c]:(a=null,b=k)}else a=null,b=k;null!==a&&(l.scheme=e.substring(b,h),a=void 0);null===a&&(b=h);return a}function Pb(){var a;a=Sb();null===a&&(a=da());return a}function Sb(){var a,c,d,h;h=d=b;a=la();null!==a?(64===e.charCodeAt(b)?(c="@",b++):(c=null,0===g&&f('"@"')),null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);a=null!==a?a:"";null!==a?(c=ma(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return null!==
a?a:""}function da(){var a,c;c=z();null===c&&(c=A(),null===c&&(36===e.charCodeAt(b)?(c="$",b++):(c=null,0===g&&f('"$"')),null===c&&(44===e.charCodeAt(b)?(c=",",b++):(c=null,0===g&&f('","')),null===c&&(59===e.charCodeAt(b)?(c=";",b++):(c=null,0===g&&f('";"')),null===c&&(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null===c&&(64===e.charCodeAt(b)?(c="@",b++):(c=null,0===g&&f('"@"')),null===c&&(38===e.charCodeAt(b)?(c="&",b++):(c=null,0===g&&f('"&"')),null===c&&(61===e.charCodeAt(b)?(c=
"=",b++):(c=null,0===g&&f('"="')),null===c&&(43===e.charCodeAt(b)?(c="+",b++):(c=null,0===g&&f('"+"')))))))))));if(null!==c)for(a=[];null!==c;)a.push(c),c=z(),null===c&&(c=A(),null===c&&(36===e.charCodeAt(b)?(c="$",b++):(c=null,0===g&&f('"$"')),null===c&&(44===e.charCodeAt(b)?(c=",",b++):(c=null,0===g&&f('","')),null===c&&(59===e.charCodeAt(b)?(c=";",b++):(c=null,0===g&&f('";"')),null===c&&(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null===c&&(64===e.charCodeAt(b)?(c="@",b++):(c=null,
0===g&&f('"@"')),null===c&&(38===e.charCodeAt(b)?(c="&",b++):(c=null,0===g&&f('"&"')),null===c&&(61===e.charCodeAt(b)?(c="=",b++):(c=null,0===g&&f('"="')),null===c&&(43===e.charCodeAt(b)?(c="+",b++):(c=null,0===g&&f('"+"')))))))))));else a=null;return a}function Ob(){var a,b;a=[];for(b=ba();null!==b;)a.push(b),b=ba();return a}function Ua(){var a,c,d,h,k,m,n,r;r=n=b;"sip"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),b+=3):(a=null,0===g&&f('"SIP"'));if(null!==a)if(47===e.charCodeAt(b)?(c="/",b++):
(c=null,0===g&&f('"/"')),null!==c){h=t();if(null!==h)for(d=[];null!==h;)d.push(h),h=t();else d=null;if(null!==d)if(46===e.charCodeAt(b)?(h=".",b++):(h=null,0===g&&f('"."')),null!==h){m=t();if(null!==m)for(k=[];null!==m;)k.push(m),m=t();else k=null;null!==k?a=[a,c,d,h,k]:(a=null,b=r)}else a=null,b=r;else a=null,b=r}else a=null,b=r;else a=null,b=r;null!==a&&(l.sip_version=e.substring(b,n),a=void 0);null===a&&(b=n);return a}function Tb(){var a;"INVITE"===e.substr(b,6)?(a="INVITE",b+=6):(a=null,0===g&&
f('"INVITE"'));return a}function Ub(){var a;"ACK"===e.substr(b,3)?(a="ACK",b+=3):(a=null,0===g&&f('"ACK"'));return a}function Vb(){var a;"OPTIONS"===e.substr(b,7)?(a="OPTIONS",b+=7):(a=null,0===g&&f('"OPTIONS"'));return a}function Wb(){var a;"BYE"===e.substr(b,3)?(a="BYE",b+=3):(a=null,0===g&&f('"BYE"'));return a}function Xb(){var a;"CANCEL"===e.substr(b,6)?(a="CANCEL",b+=6):(a=null,0===g&&f('"CANCEL"'));return a}function Yb(){var a;"REGISTER"===e.substr(b,8)?(a="REGISTER",b+=8):(a=null,0===g&&f('"REGISTER"'));
return a}function Zb(){var a;"SUBSCRIBE"===e.substr(b,9)?(a="SUBSCRIBE",b+=9):(a=null,0===g&&f('"SUBSCRIBE"'));return a}function $b(){var a;"NOTIFY"===e.substr(b,6)?(a="NOTIFY",b+=6):(a=null,0===g&&f('"NOTIFY"'));return a}function pa(){var a,c;c=b;a=Tb();null===a&&(a=Ub(),null===a&&(a=Vb(),null===a&&(a=Wb(),null===a&&(a=Xb(),null===a&&(a=Yb(),null===a&&(a=Zb(),null===a&&(a=$b(),null===a&&(a=u()))))))));null!==a&&(l.method=e.substring(b,c),a=l.method);null===a&&(b=c);return a}function ac(){var a,c,
d,h,e,g;g=b;a=Ua();null!==a?(c=C(),null!==c?(d=bc(),null!==d?(h=C(),null!==h?(e=cc(),null!==e?a=[a,c,d,h,e]:(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g);return a}function bc(){var a,c;c=b;a=dc();null!==a&&(l.status_code=parseInt(a.join("")),a=void 0);null===a&&(b=c);return a}function dc(){var a,c,d,h;h=b;a=t();null!==a?(c=t(),null!==c?(d=t(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);return a}function cc(){var a,c,d;d=b;a=[];c=ga();null===c&&(c=z(),null===
c&&(c=A(),null===c&&(c=O(),null===c&&(c=V(),null===c&&(c=C(),null===c&&(c=K()))))));for(;null!==c;)a.push(c),c=ga(),null===c&&(c=z(),null===c&&(c=A(),null===c&&(c=O(),null===c&&(c=V(),null===c&&(c=C(),null===c&&(c=K()))))));null!==a&&(l.reason_phrase=e.substring(b,d),a=void 0);null===a&&(b=d);return a}function ta(){var a,c,d,h,e,g,f;g=e=b;a=ka();null===a&&(a=Q());if(null!==a){c=[];f=b;d=y();null!==d?(h=Xa(),null!==h?d=[d,h]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=y(),null!==d?(h=
Xa(),null!==h?d=[d,h]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;if(null!==a){var r;l.multi_header||(l.multi_header=[]);try{r=new JsSIP.NameAddrHeader(l.uri,l.display_name,l.params),delete l.uri,delete l.display_name,delete l.params}catch(q){r=null}l.multi_header.push({possition:b,offset:e,parsed:r});a=void 0}null===a&&(b=e);return a}function Q(){var a,c,d,h,e;e=b;a=ua();a=null!==a?a:"";null!==a?(c=Ha(),null!==c?(d=na(),null!==d?(h=Ga(),null!==h?a=[a,c,d,h]:(a=null,b=
e)):(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function ua(){var a,c,d,h,k,g,f;g=k=b;a=u();if(null!==a){c=[];f=b;d=B();null!==d?(h=u(),null!==h?d=[d,h]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=B(),null!==d?(h=u(),null!==h?d=[d,h]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;null===a&&(a=W());null!==a&&(a=e.substring(b,k).trim(),'"'===a[0]&&(a=a.substring(1,a.length-1)),l.display_name=a,a=void 0);null===a&&(b=k);return a}function Xa(){var a;a=ec();
null===a&&(a=fc(),null===a&&(a=D()));return a}function ec(){var a,c,d,h,k;k=h=b;"q"===e.substr(b,1).toLowerCase()?(a=e.substr(b,1),b++):(a=null,0===g&&f('"q"'));null!==a?(c=w(),null!==c?(d=gc(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=a[2],l.params||(l.params={}),l.params.q=a,a=void 0);null===a&&(b=h);return a}function fc(){var a,c,d,h,k;k=h=b;"expires"===e.substr(b,7).toLowerCase()?(a=e.substr(b,7),b+=7):(a=null,0===g&&f('"expires"'));null!==a?(c=w(),null!==c?(d=R(),
null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=a[2],l.params||(l.params={}),l.params.expires=a,a=void 0);null===a&&(b=h);return a}function R(){var a,c,d;d=b;c=t();if(null!==c)for(a=[];null!==c;)a.push(c),c=t();else a=null;null!==a&&(a=parseInt(a.join("")));null===a&&(b=d);return a}function gc(){var a,c,d,h,k,m,n,l;n=m=b;48===e.charCodeAt(b)?(a="0",b++):(a=null,0===g&&f('"0"'));null!==a?(l=b,46===e.charCodeAt(b)?(c=".",b++):(c=null,0===g&&f('"."')),null!==c?(d=t(),d=null!==
d?d:"",null!==d?(h=t(),h=null!==h?h:"",null!==h?(k=t(),k=null!==k?k:"",null!==k?c=[c,d,h,k]:(c=null,b=l)):(c=null,b=l)):(c=null,b=l)):(c=null,b=l),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=n)):(a=null,b=n);null!==a&&(a=parseFloat(e.substring(b,m)));null===a&&(b=m);return a}function D(){var a,c,d,h,e,g;e=h=b;a=u();null!==a?(g=b,c=w(),null!==c?(d=hc(),null!==d?c=[c,d]:(c=null,b=g)):(c=null,b=g),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=e)):(a=null,b=e);null!==a&&(c=a[0],a=a[1],l.params||(l.params=
{}),a="undefined"===typeof a?void 0:a[1],l.params[c.toLowerCase()]=a,a=void 0);null===a&&(b=h);return a}function hc(){var a;a=u();null===a&&(a=Y(),null===a&&(a=W()));return a}function ic(){var a;"render"===e.substr(b,6).toLowerCase()?(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"render"'));null===a&&("session"===e.substr(b,7).toLowerCase()?(a=e.substr(b,7),b+=7):(a=null,0===g&&f('"session"')),null===a&&("icon"===e.substr(b,4).toLowerCase()?(a=e.substr(b,4),b+=4):(a=null,0===g&&f('"icon"')),null===a&&
("alert"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"alert"')),null===a&&(a=u()))));return a}function Ya(){var a;a=jc();null===a&&(a=D());return a}function jc(){var a,c,d,h;h=b;"handling"===e.substr(b,8).toLowerCase()?(a=e.substr(b,8),b+=8):(a=null,0===g&&f('"handling"'));null!==a?(c=w(),null!==c?("optional"===e.substr(b,8).toLowerCase()?(d=e.substr(b,8),b+=8):(d=null,0===g&&f('"optional"')),null===d&&("required"===e.substr(b,8).toLowerCase()?(d=e.substr(b,8),b+=8):(d=
null,0===g&&f('"required"')),null===d&&(d=u())),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);return a}function kc(){var a,c,d,h,e,g,f,l;f=b;a=lc();if(null!==a)if(c=ia(),null!==c)if(d=mc(),null!==d){h=[];l=b;e=y();null!==e?(g=Za(),null!==g?e=[e,g]:(e=null,b=l)):(e=null,b=l);for(;null!==e;)h.push(e),l=b,e=y(),null!==e?(g=Za(),null!==g?e=[e,g]:(e=null,b=l)):(e=null,b=l);null!==h?a=[a,c,d,h]:(a=null,b=f)}else a=null,b=f;else a=null,b=f;else a=null,b=f;return a}function lc(){var a;a=nc();
null===a&&(a=oc());return a}function nc(){var a;"text"===e.substr(b,4).toLowerCase()?(a=e.substr(b,4),b+=4):(a=null,0===g&&f('"text"'));null===a&&("image"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"image"')),null===a&&("audio"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"audio"')),null===a&&("video"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"video"')),null===a&&("application"===e.substr(b,11).toLowerCase()?(a=e.substr(b,
11),b+=11):(a=null,0===g&&f('"application"')),null===a&&(a=va())))));return a}function oc(){var a;"message"===e.substr(b,7).toLowerCase()?(a=e.substr(b,7),b+=7):(a=null,0===g&&f('"message"'));null===a&&("multipart"===e.substr(b,9).toLowerCase()?(a=e.substr(b,9),b+=9):(a=null,0===g&&f('"multipart"')),null===a&&(a=va()));return a}function va(){var a;a=u();null===a&&(a=pc());return a}function pc(){var a,c,d;d=b;"x-"===e.substr(b,2).toLowerCase()?(a=e.substr(b,2),b+=2):(a=null,0===g&&f('"x-"'));null!==
a?(c=u(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return a}function mc(){var a;a=va();null===a&&(a=u());return a}function Za(){var a,c,d,h;h=b;a=u();null!==a?(c=w(),null!==c?(d=qc(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);return a}function qc(){var a;a=u();null===a&&(a=W());return a}function rc(){var a,c,d;d=b;c=t();if(null!==c)for(a=[];null!==c;)a.push(c),c=t();else a=null;null!==a&&(l.value=parseInt(a.join("")),a=void 0);null===a&&(b=d);return a}function ea(){var a,c,d,h,
k,m;k=b;a=ha();if(null!==a){c=[];m=b;46===e.charCodeAt(b)?(d=".",b++):(d=null,0===g&&f('"."'));null!==d?(h=ha(),null!==h?d=[d,h]:(d=null,b=m)):(d=null,b=m);for(;null!==d;)c.push(d),m=b,46===e.charCodeAt(b)?(d=".",b++):(d=null,0===g&&f('"."')),null!==d?(h=ha(),null!==h?d=[d,h]:(d=null,b=m)):(d=null,b=m);null!==c?a=[a,c]:(a=null,b=k)}else a=null,b=k;return a}function $a(){var a;a=ab();null===a&&(a=D());return a}function ab(){var a,c,d,h,k;k=h=b;"tag"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),b+=
3):(a=null,0===g&&f('"tag"'));null!==a?(c=w(),null!==c?(d=u(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.tag=a[2],a=void 0);null===a&&(b=h);return a}function bb(){var a,c,d,h,k,m,n,l;n=b;"digest"===e.substr(b,6).toLowerCase()?(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"Digest"'));if(null!==a)if(c=B(),null!==c)if(d=wa(),null!==d){h=[];l=b;k=x();null!==k?(m=wa(),null!==m?k=[k,m]:(k=null,b=l)):(k=null,b=l);for(;null!==k;)h.push(k),l=b,k=x(),null!==k?(m=wa(),null!==m?k=[k,
m]:(k=null,b=l)):(k=null,b=l);null!==h?a=[a,c,d,h]:(a=null,b=n)}else a=null,b=n;else a=null,b=n;else a=null,b=n;null===a&&(a=sc());return a}function sc(){var a,c,d,h,e,g,f,l;f=b;a=u();if(null!==a)if(c=B(),null!==c)if(d=fa(),null!==d){h=[];l=b;e=x();null!==e?(g=fa(),null!==g?e=[e,g]:(e=null,b=l)):(e=null,b=l);for(;null!==e;)h.push(e),l=b,e=x(),null!==e?(g=fa(),null!==g?e=[e,g]:(e=null,b=l)):(e=null,b=l);null!==h?a=[a,c,d,h]:(a=null,b=f)}else a=null,b=f;else a=null,b=f;else a=null,b=f;return a}function fa(){var a,
c,d,h;h=b;a=u();null!==a?(c=w(),null!==c?(d=u(),null===d&&(d=W()),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);return a}function wa(){var a;a=tc();null===a&&(a=uc(),null===a&&(a=vc(),null===a&&(a=wc(),null===a&&(a=xc(),null===a&&(a=yc(),null===a&&(a=zc(),null===a&&(a=fa())))))));return a}function tc(){var a,c,d,h;h=b;"realm"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"realm"'));null!==a?(c=w(),null!==c?(d=Ac(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):
(a=null,b=h);return a}function Ac(){var a,c;c=b;a=ja();null!==a&&(l.realm=a,a=void 0);null===a&&(b=c);return a}function uc(){var a,c,d,h,k,m,l,r,q;r=b;"domain"===e.substr(b,6).toLowerCase()?(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"domain"'));if(null!==a)if(c=w(),null!==c)if(d=Ia(),null!==d)if(h=xa(),null!==h){k=[];q=b;l=C();if(null!==l)for(m=[];null!==l;)m.push(l),l=C();else m=null;null!==m?(l=xa(),null!==l?m=[m,l]:(m=null,b=q)):(m=null,b=q);for(;null!==m;){k.push(m);q=b;l=C();if(null!==l)for(m=
[];null!==l;)m.push(l),l=C();else m=null;null!==m?(l=xa(),null!==l?m=[m,l]:(m=null,b=q)):(m=null,b=q)}null!==k?(m=Ja(),null!==m?a=[a,c,d,h,k,m]:(a=null,b=r)):(a=null,b=r)}else a=null,b=r;else a=null,b=r;else a=null,b=r;else a=null,b=r;return a}function xa(){var a;a=Va();null===a&&(a=ra());return a}function vc(){var a,c,d,h;h=b;"nonce"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"nonce"'));null!==a?(c=w(),null!==c?(d=Bc(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=
null,b=h);return a}function Bc(){var a,c;c=b;a=ja();null!==a&&(l.nonce=a,a=void 0);null===a&&(b=c);return a}function wc(){var a,c,d,h,k;k=h=b;"opaque"===e.substr(b,6).toLowerCase()?(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"opaque"'));null!==a?(c=w(),null!==c?(d=ja(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.opaque=a[2],a=void 0);null===a&&(b=h);return a}function xc(){var a,c,d,h,k;h=b;"stale"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"stale"'));
null!==a?(c=w(),null!==c?(k=b,"true"===e.substr(b,4).toLowerCase()?(d=e.substr(b,4),b+=4):(d=null,0===g&&f('"true"')),null!==d&&(l.stale=!0,d=void 0),null===d&&(b=k),null===d&&(k=b,"false"===e.substr(b,5).toLowerCase()?(d=e.substr(b,5),b+=5):(d=null,0===g&&f('"false"')),null!==d&&(l.stale=!1,d=void 0),null===d&&(b=k)),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);return a}function yc(){var a,c,d,h,k;k=h=b;"algorithm"===e.substr(b,9).toLowerCase()?(a=e.substr(b,9),b+=9):(a=null,0===g&&
f('"algorithm"'));null!==a?(c=w(),null!==c?("md5"===e.substr(b,3).toLowerCase()?(d=e.substr(b,3),b+=3):(d=null,0===g&&f('"MD5"')),null===d&&("md5-sess"===e.substr(b,8).toLowerCase()?(d=e.substr(b,8),b+=8):(d=null,0===g&&f('"MD5-sess"')),null===d&&(d=u())),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.algorithm=a[2].toUpperCase(),a=void 0);null===a&&(b=h);return a}function zc(){var a,c,d,h,k,m,l,r,q,s;r=b;"qop"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),b+=3):(a=null,
0===g&&f('"qop"'));if(null!==a)if(c=w(),null!==c)if(d=Ia(),null!==d){q=b;h=ya();if(null!==h){k=[];s=b;44===e.charCodeAt(b)?(m=",",b++):(m=null,0===g&&f('","'));null!==m?(l=ya(),null!==l?m=[m,l]:(m=null,b=s)):(m=null,b=s);for(;null!==m;)k.push(m),s=b,44===e.charCodeAt(b)?(m=",",b++):(m=null,0===g&&f('","')),null!==m?(l=ya(),null!==l?m=[m,l]:(m=null,b=s)):(m=null,b=s);null!==k?h=[h,k]:(h=null,b=q)}else h=null,b=q;null!==h?(k=Ja(),null!==k?a=[a,c,d,h,k]:(a=null,b=r)):(a=null,b=r)}else a=null,b=r;else a=
null,b=r;else a=null,b=r;return a}function ya(){var a,c;c=b;"auth-int"===e.substr(b,8).toLowerCase()?(a=e.substr(b,8),b+=8):(a=null,0===g&&f('"auth-int"'));null===a&&("auth"===e.substr(b,4).toLowerCase()?(a=e.substr(b,4),b+=4):(a=null,0===g&&f('"auth"')),null===a&&(a=u()));null!==a&&(l.qop||(l.qop=[]),l.qop.push(a.toLowerCase()),a=void 0);null===a&&(b=c);return a}function za(){var a,c,d,h,e,g,f;g=e=b;a=Q();if(null!==a){c=[];f=b;d=y();null!==d?(h=D(),null!==h?d=[d,h]:(d=null,b=f)):(d=null,b=f);for(;null!==
d;)c.push(d),f=b,d=y(),null!==d?(h=D(),null!==h?d=[d,h]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;if(null!==a){var r;l.multi_header||(l.multi_header=[]);try{r=new JsSIP.NameAddrHeader(l.uri,l.display_name,l.params),delete l.uri,delete l.display_name,delete l.params}catch(q){r=null}l.multi_header.push({possition:b,offset:e,parsed:r});a=void 0}null===a&&(b=e);return a}function Aa(){var a,c,d,h,e,g;e=b;a=Q();if(null!==a){c=[];g=b;d=y();null!==d?(h=D(),null!==h?d=[d,h]:
(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=y(),null!==d?(h=D(),null!==h?d=[d,h]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=e)}else a=null,b=e;return a}function Cc(){var a,c;c=b;"active"===e.substr(b,6).toLowerCase()?(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"active"'));null===a&&("pending"===e.substr(b,7).toLowerCase()?(a=e.substr(b,7),b+=7):(a=null,0===g&&f('"pending"')),null===a&&("terminated"===e.substr(b,10).toLowerCase()?(a=e.substr(b,10),b+=10):(a=null,0===g&&f('"terminated"')),
null===a&&(a=u())));null!==a&&(l.state=e.substring(b,c),a=void 0);null===a&&(b=c);return a}function cb(){var a,c,d,h,k;k=h=b;"reason"===e.substr(b,6).toLowerCase()?(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"reason"'));null!==a?(c=w(),null!==c?(d=Dc(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(a=function(a,b){"undefined"!==typeof b&&(l.reason=b)}(h,a[2]));null===a&&(b=h);null===a&&(k=h=b,"expires"===e.substr(b,7).toLowerCase()?(a=e.substr(b,7),b+=7):(a=null,0===g&&f('"expires"')),
null!==a?(c=w(),null!==c?(d=R(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k),null!==a&&(a=function(a,b){"undefined"!==typeof b&&(l.expires=b)}(h,a[2])),null===a&&(b=h),null===a&&(k=h=b,"retry_after"===e.substr(b,11).toLowerCase()?(a=e.substr(b,11),b+=11):(a=null,0===g&&f('"retry_after"')),null!==a?(c=w(),null!==c?(d=R(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k),null!==a&&(a=function(a,b){"undefined"!==typeof b&&(l.retry_after=b)}(h,a[2])),null===a&&(b=h),null===a&&
(a=D())));return a}function Dc(){var a;"deactivated"===e.substr(b,11).toLowerCase()?(a=e.substr(b,11),b+=11):(a=null,0===g&&f('"deactivated"'));null===a&&("probation"===e.substr(b,9).toLowerCase()?(a=e.substr(b,9),b+=9):(a=null,0===g&&f('"probation"')),null===a&&("rejected"===e.substr(b,8).toLowerCase()?(a=e.substr(b,8),b+=8):(a=null,0===g&&f('"rejected"')),null===a&&("timeout"===e.substr(b,7).toLowerCase()?(a=e.substr(b,7),b+=7):(a=null,0===g&&f('"timeout"')),null===a&&("giveup"===e.substr(b,6).toLowerCase()?
(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"giveup"')),null===a&&("noresource"===e.substr(b,10).toLowerCase()?(a=e.substr(b,10),b+=10):(a=null,0===g&&f('"noresource"')),null===a&&("invariant"===e.substr(b,9).toLowerCase()?(a=e.substr(b,9),b+=9):(a=null,0===g&&f('"invariant"')),null===a&&(a=u())))))));return a}function db(){var a;a=ab();null===a&&(a=D());return a}function Ba(){var a,c,d,h,e,g,f,l;f=b;a=Ec();if(null!==a)if(c=B(),null!==c)if(d=Fc(),null!==d){h=[];l=b;e=y();null!==e?(g=eb(),null!==g?e=
[e,g]:(e=null,b=l)):(e=null,b=l);for(;null!==e;)h.push(e),l=b,e=y(),null!==e?(g=eb(),null!==g?e=[e,g]:(e=null,b=l)):(e=null,b=l);null!==h?a=[a,c,d,h]:(a=null,b=f)}else a=null,b=f;else a=null,b=f;else a=null,b=f;return a}function eb(){var a;a=Gc();null===a&&(a=Hc(),null===a&&(a=Ic(),null===a&&(a=Jc(),null===a&&(a=Kc(),null===a&&(a=D())))));return a}function Gc(){var a,c,d,h,k;k=h=b;"ttl"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),b+=3):(a=null,0===g&&f('"ttl"'));null!==a?(c=w(),null!==c?(d=Ta(),
null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.ttl=a[2],a=void 0);null===a&&(b=h);return a}function Hc(){var a,c,d,h,k;k=h=b;"maddr"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"maddr"'));null!==a?(c=w(),null!==c?(d=Y(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.maddr=a[2],a=void 0);null===a&&(b=h);return a}function Ic(){var a,c,d,h,k;k=h=b;"received"===e.substr(b,8).toLowerCase()?(a=e.substr(b,8),b+=8):(a=null,0===
g&&f('"received"'));null!==a?(c=w(),null!==c?(d=P(),null===d&&(d=Ra()),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.received=a[2],a=void 0);null===a&&(b=h);return a}function Jc(){var a,c,d,h,k;k=h=b;"branch"===e.substr(b,6).toLowerCase()?(a=e.substr(b,6),b+=6):(a=null,0===g&&f('"branch"'));null!==a?(c=w(),null!==c?(d=u(),null!==d?a=[a,c,d]:(a=null,b=k)):(a=null,b=k)):(a=null,b=k);null!==a&&(l.branch=a[2],a=void 0);null===a&&(b=h);return a}function Kc(){var a,c,d,h,k,m,
n;m=k=b;"rport"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"rport"'));if(null!==a){n=b;c=w();if(null!==c){d=[];for(h=t();null!==h;)d.push(h),h=t();null!==d?c=[c,d]:(c=null,b=n)}else c=null,b=n;c=null!==c?c:"";null!==c?a=[a,c]:(a=null,b=m)}else a=null,b=m;null!==a&&("undefined"!==typeof response_port&&(l.rport=response_port.join("")),a=void 0);null===a&&(b=k);return a}function Ec(){var a,c,d,h,e,g;g=b;a=Lc();null!==a?(c=ia(),null!==c?(d=u(),null!==d?(h=ia(),null!==h?(e=
Ca(),null!==e?a=[a,c,d,h,e]:(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g);return a}function Lc(){var a,c;c=b;"sip"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),b+=3):(a=null,0===g&&f('"SIP"'));null===a&&(a=u());null!==a&&(l.protocol=a,a=void 0);null===a&&(b=c);return a}function Ca(){var a,c;c=b;"udp"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),b+=3):(a=null,0===g&&f('"UDP"'));null===a&&("tcp"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),b+=3):(a=null,0===g&&f('"TCP"')),
null===a&&("tls"===e.substr(b,3).toLowerCase()?(a=e.substr(b,3),b+=3):(a=null,0===g&&f('"TLS"')),null===a&&("sctp"===e.substr(b,4).toLowerCase()?(a=e.substr(b,4),b+=4):(a=null,0===g&&f('"SCTP"')),null===a&&(a=u()))));null!==a&&(l.transport=a,a=void 0);null===a&&(b=c);return a}function Fc(){var a,c,d,h,e;h=b;a=Mc();null!==a?(e=b,c=qb(),null!==c?(d=Nc(),null!==d?c=[c,d]:(c=null,b=e)):(c=null,b=e),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);return a}function Mc(){var a,c;c=b;a=P();null===
a&&(a=oa(),null===a&&(a=Pa()));null!==a&&(l.host=e.substring(b,c),a=void 0);null===a&&(b=c);return a}function Nc(){var a,c,d,h,e,g,f;f=g=b;a=t();a=null!==a?a:"";null!==a?(c=t(),c=null!==c?c:"",null!==c?(d=t(),d=null!==d?d:"",null!==d?(h=t(),h=null!==h?h:"",null!==h?(e=t(),e=null!==e?e:"",null!==e?a=[a,c,d,h,e]:(a=null,b=f)):(a=null,b=f)):(a=null,b=f)):(a=null,b=f)):(a=null,b=f);null!==a&&(l.port=parseInt(a.join("")),a=void 0);null===a&&(b=g);return a}function Ta(){var a,c,d,h,e;e=h=b;a=t();null!==
a?(c=t(),c=null!==c?c:"",null!==c?(d=t(),d=null!==d?d:"",null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);null!==a&&(a=parseInt(a.join("")));null===a&&(b=h);return a}function Oc(){var a,b;a=[];b=L();null===b&&(b=V(),null===b&&(b=B()));for(;null!==b;)a.push(b),b=L(),null===b&&(b=V(),null===b&&(b=B()));return a}function Pc(){var a,c;c=b;"stuns"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"stuns"'));null===a&&("stun"===e.substr(b,4).toLowerCase()?(a=e.substr(b,4),
b+=4):(a=null,0===g&&f('"stun"')));null!==a&&(l.scheme=a,a=void 0);null===a&&(b=c);return a}function fb(){var a,c,d,h,k;h=b;a=Qc();null!==a?(k=b,58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=Oa(),null!==d?c=[c,d]:(c=null,b=k)):(c=null,b=k),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=h)):(a=null,b=h);return a}function Qc(){var a,c;c=b;a=P();null===a&&(a=oa(),null===a&&(a=da()));null!==a&&(l.host=a,a=void 0);null===a&&(b=c);return a}function da(){var a,c,d;d=b;a=[];c=gb();null===
c&&(c=A(),null===c&&(c=hb()));for(;null!==c;)a.push(c),c=gb(),null===c&&(c=A(),null===c&&(c=hb()));null!==a&&(a=e.substring(b,d));null===a&&(b=d);return a}function gb(){var a;a=T();null===a&&(a=t(),null===a&&(45===e.charCodeAt(b)?(a="-",b++):(a=null,0===g&&f('"-"')),null===a&&(46===e.charCodeAt(b)?(a=".",b++):(a=null,0===g&&f('"."')),null===a&&(95===e.charCodeAt(b)?(a="_",b++):(a=null,0===g&&f('"_"')),null===a&&(126===e.charCodeAt(b)?(a="~",b++):(a=null,0===g&&f('"~"')))))));return a}function hb(){var a;
33===e.charCodeAt(b)?(a="!",b++):(a=null,0===g&&f('"!"'));null===a&&(36===e.charCodeAt(b)?(a="$",b++):(a=null,0===g&&f('"$"')),null===a&&(38===e.charCodeAt(b)?(a="&",b++):(a=null,0===g&&f('"&"')),null===a&&(39===e.charCodeAt(b)?(a="'",b++):(a=null,0===g&&f('"\'"')),null===a&&(40===e.charCodeAt(b)?(a="(",b++):(a=null,0===g&&f('"("')),null===a&&(41===e.charCodeAt(b)?(a=")",b++):(a=null,0===g&&f('")"')),null===a&&(42===e.charCodeAt(b)?(a="*",b++):(a=null,0===g&&f('"*"')),null===a&&(43===e.charCodeAt(b)?
(a="+",b++):(a=null,0===g&&f('"+"')),null===a&&(44===e.charCodeAt(b)?(a=",",b++):(a=null,0===g&&f('","')),null===a&&(59===e.charCodeAt(b)?(a=";",b++):(a=null,0===g&&f('";"')),null===a&&(61===e.charCodeAt(b)?(a="=",b++):(a=null,0===g&&f('"="'))))))))))));return a}function Rc(){var a,c;c=b;"turns"===e.substr(b,5).toLowerCase()?(a=e.substr(b,5),b+=5):(a=null,0===g&&f('"turns"'));null===a&&("turn"===e.substr(b,4).toLowerCase()?(a=e.substr(b,4),b+=4):(a=null,0===g&&f('"turn"')));null!==a&&(l.scheme=a,
a=void 0);null===a&&(b=c);return a}function Sc(){var a,c,d,h,k,m,n,r,q,s,t;t=s=b;a=Tc();null!==a?(45===e.charCodeAt(b)?(c="-",b++):(c=null,0===g&&f('"-"')),null!==c?(d=I(),null!==d?(45===e.charCodeAt(b)?(h="-",b++):(h=null,0===g&&f('"-"')),null!==h?(k=I(),null!==k?(45===e.charCodeAt(b)?(m="-",b++):(m=null,0===g&&f('"-"')),null!==m?(n=I(),null!==n?(45===e.charCodeAt(b)?(r="-",b++):(r=null,0===g&&f('"-"')),null!==r?(q=Uc(),null!==q?a=[a,c,d,h,k,m,n,r,q]:(a=null,b=t)):(a=null,b=t)):(a=null,b=t)):(a=
null,b=t)):(a=null,b=t)):(a=null,b=t)):(a=null,b=t)):(a=null,b=t)):(a=null,b=t);null!==a&&(l=e.substring(b+5,s),a=void 0);null===a&&(b=s);return a}function I(){var a,c,d,e,g;g=b;a=G();null!==a?(c=G(),null!==c?(d=G(),null!==d?(e=G(),null!==e?a=[a,c,d,e]:(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g);return a}function Tc(){var a,c,d;d=b;a=I();null!==a?(c=I(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return a}function Uc(){var a,c,d,e;e=b;a=I();null!==a?(c=I(),null!==c?(d=I(),null!==d?a=[a,
c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function Xc(a){a.sort();for(var b=null,d=[],e=0;e<a.length;e++)a[e]!==b&&(d.push(a[e]),b=a[e]);return d}function Yc(){for(var a=1,c=1,d=!1,h=0;h<Math.max(b,S);h++){var g=e.charAt(h);"\n"===g?(d||a++,c=1,d=!1):"\r"===g||"\u2028"===g||"\u2029"===g?(a++,c=1,d=!0):(c++,d=!1)}return{line:a,column:c}}var Vc={CRLF:kb,DIGIT:t,ALPHA:T,HEXDIG:G,WSP:U,OCTET:Ea,DQUOTE:H,SP:C,HTAB:K,alphanum:J,reserved:ga,unreserved:z,mark:N,escaped:A,LWS:B,SWS:v,HCOLON:lb,
TEXT_UTF8_TRIM:mb,TEXT_UTF8char:L,UTF8_NONASCII:O,UTF8_CONT:V,LHEX:function(){var a;a=t();null===a&&(/^[a-f]/.test(e.charAt(b))?(a=e.charAt(b),b++):(a=null,0===g&&f("[a-f]")));return a},token:u,token_nodot:ha,separators:function(){var a;40===e.charCodeAt(b)?(a="(",b++):(a=null,0===g&&f('"("'));null===a&&(41===e.charCodeAt(b)?(a=")",b++):(a=null,0===g&&f('")"')),null===a&&(60===e.charCodeAt(b)?(a="<",b++):(a=null,0===g&&f('"<"')),null===a&&(62===e.charCodeAt(b)?(a=">",b++):(a=null,0===g&&f('">"')),
null===a&&(64===e.charCodeAt(b)?(a="@",b++):(a=null,0===g&&f('"@"')),null===a&&(44===e.charCodeAt(b)?(a=",",b++):(a=null,0===g&&f('","')),null===a&&(59===e.charCodeAt(b)?(a=";",b++):(a=null,0===g&&f('";"')),null===a&&(58===e.charCodeAt(b)?(a=":",b++):(a=null,0===g&&f('":"')),null===a&&(92===e.charCodeAt(b)?(a="\\",b++):(a=null,0===g&&f('"\\\\"')),null===a&&(a=H(),null===a&&(47===e.charCodeAt(b)?(a="/",b++):(a=null,0===g&&f('"/"')),null===a&&(91===e.charCodeAt(b)?(a="[",b++):(a=null,0===g&&f('"["')),
null===a&&(93===e.charCodeAt(b)?(a="]",b++):(a=null,0===g&&f('"]"')),null===a&&(63===e.charCodeAt(b)?(a="?",b++):(a=null,0===g&&f('"?"')),null===a&&(61===e.charCodeAt(b)?(a="=",b++):(a=null,0===g&&f('"="')),null===a&&(123===e.charCodeAt(b)?(a="{",b++):(a=null,0===g&&f('"{"')),null===a&&(125===e.charCodeAt(b)?(a="}",b++):(a=null,0===g&&f('"}"')),null===a&&(a=C(),null===a&&(a=K()))))))))))))))))));return a},word:Fa,STAR:nb,SLASH:ia,EQUAL:w,LPAREN:ob,RPAREN:pb,RAQUOT:Ga,LAQUOT:Ha,COMMA:x,SEMI:y,COLON:qb,
LDQUOT:Ia,RDQUOT:Ja,comment:Ka,ctext:La,quoted_string:W,quoted_string_clean:ja,qdtext:X,quoted_pair:M,SIP_URI_noparams:ka,SIP_URI:na,uri_scheme:Ma,userinfo:la,user:tb,user_unreserved:Na,password:ub,hostport:ma,host:Y,hostname:Pa,domainlabel:Qa,toplabel:vb,IPv6reference:oa,IPv6address:Ra,h16:s,ls32:E,IPv4address:P,dec_octet:Z,port:Oa,uri_parameters:rb,uri_parameter:Sa,transport_param:wb,user_param:xb,method_param:yb,ttl_param:zb,maddr_param:Ab,lr_param:Bb,other_param:Cb,pname:Db,pvalue:Eb,paramchar:$,
param_unreserved:Fb,headers:sb,header:qa,hname:Gb,hvalue:Hb,hnv_unreserved:aa,Request_Response:function(){var a;a=ac();null===a&&(a=Ib());return a},Request_Line:Ib,Request_URI:Jb,absoluteURI:Va,hier_part:Lb,net_path:Nb,abs_path:ra,opaque_part:Mb,uric:ba,uric_no_slash:Rb,path_segments:Qb,segment:sa,param:Wa,pchar:ca,scheme:Kb,authority:Pb,srvr:Sb,reg_name:da,query:Ob,SIP_Version:Ua,INVITEm:Tb,ACKm:Ub,OPTIONSm:Vb,BYEm:Wb,CANCELm:Xb,REGISTERm:Yb,SUBSCRIBEm:Zb,NOTIFYm:$b,Method:pa,Status_Line:ac,Status_Code:bc,
extension_code:dc,Reason_Phrase:cc,Allow_Events:function(){var a,c,d,e,g,f;g=b;a=ea();if(null!==a){c=[];f=b;d=x();null!==d?(e=ea(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=x(),null!==d?(e=ea(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;return a},Call_ID:function(){var a,c,d,h,k,m;k=h=b;a=Fa();null!==a?(m=b,64===e.charCodeAt(b)?(c="@",b++):(c=null,0===g&&f('"@"')),null!==c?(d=Fa(),null!==d?c=[c,d]:(c=null,b=m)):(c=null,
b=m),c=null!==c?c:"",null!==c?a=[a,c]:(a=null,b=k)):(a=null,b=k);null!==a&&(l=e.substring(b,h),a=void 0);null===a&&(b=h);return a},Contact:function(){var a,c,d,e,g,f,n;g=b;a=nb();if(null===a)if(f=b,a=ta(),null!==a){c=[];n=b;d=x();null!==d?(e=ta(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);for(;null!==d;)c.push(d),n=b,d=x(),null!==d?(e=ta(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;if(null!==a){c=l.multi_header.length;for(a=0;a<c;a++)if(null===l.multi_header[a].parsed){l=
null;break}l=null!==l?l.multi_header:-1;a=void 0}null===a&&(b=g);return a},contact_param:ta,name_addr:Q,display_name:ua,contact_params:Xa,c_p_q:ec,c_p_expires:fc,delta_seconds:R,qvalue:gc,generic_param:D,gen_value:hc,Content_Disposition:function(){var a,c,d,e,g,f;g=b;a=ic();if(null!==a){c=[];f=b;d=y();null!==d?(e=Ya(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=y(),null!==d?(e=Ya(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,
b=g;return a},disp_type:ic,disp_param:Ya,handling_param:jc,Content_Encoding:function(){var a,c,d,e,g,f;g=b;a=u();if(null!==a){c=[];f=b;d=x();null!==d?(e=u(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=x(),null!==d?(e=u(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;return a},Content_Length:function(){var a,c,d;d=b;c=t();if(null!==c)for(a=[];null!==c;)a.push(c),c=t();else a=null;null!==a&&(l=parseInt(a.join("")),a=void 0);
null===a&&(b=d);return a},Content_Type:function(){var a,c;c=b;a=kc();null!==a&&(l=e.substring(b,c),a=void 0);null===a&&(b=c);return a},media_type:kc,m_type:lc,discrete_type:nc,composite_type:oc,extension_token:va,x_token:pc,m_subtype:mc,m_parameter:Za,m_value:qc,CSeq:function(){var a,c,d,e;e=b;a=rc();null!==a?(c=B(),null!==c?(d=pa(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a},CSeq_value:rc,Expires:function(){var a,c;c=b;a=R();null!==a&&(l=a,a=void 0);null===a&&(b=c);return a},
Event:function(){var a,c,d,e,g,f,n;f=g=b;a=ea();if(null!==a){c=[];n=b;d=y();null!==d?(e=D(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);for(;null!==d;)c.push(d),n=b,d=y(),null!==d?(e=D(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;null!==a&&(l.event=a[0].join("").toLowerCase(),a=void 0);null===a&&(b=g);return a},event_type:ea,From:function(){var a,c,d,e,g,f,n;f=g=b;a=ka();null===a&&(a=Q());if(null!==a){c=[];n=b;d=y();null!==d?(e=$a(),null!==e?d=[d,e]:
(d=null,b=n)):(d=null,b=n);for(;null!==d;)c.push(d),n=b,d=y(),null!==d?(e=$a(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;if(null!==a){a=l.tag;try{l=new JsSIP.NameAddrHeader(l.uri,l.display_name,l.params),a&&l.setParam("tag",a)}catch(r){l=-1}a=void 0}null===a&&(b=g);return a},from_param:$a,tag_param:ab,Max_Forwards:function(){var a,c,d;d=b;c=t();if(null!==c)for(a=[];null!==c;)a.push(c),c=t();else a=null;null!==a&&(l=parseInt(a.join("")),a=void 0);null===
a&&(b=d);return a},Min_Expires:function(){var a,c;c=b;a=R();null!==a&&(l=a,a=void 0);null===a&&(b=c);return a},Name_Addr_Header:function(){var a,c,d,e,g,f,n,r,q,s;q=r=b;a=[];for(c=ua();null!==c;)a.push(c),c=ua();if(null!==a)if(c=Ha(),null!==c)if(d=na(),null!==d)if(e=Ga(),null!==e){g=[];s=b;f=y();null!==f?(n=D(),null!==n?f=[f,n]:(f=null,b=s)):(f=null,b=s);for(;null!==f;)g.push(f),s=b,f=y(),null!==f?(n=D(),null!==n?f=[f,n]:(f=null,b=s)):(f=null,b=s);null!==g?a=[a,c,d,e,g]:(a=null,b=q)}else a=null,b=
q;else a=null,b=q;else a=null,b=q;else a=null,b=q;if(null!==a){try{l=new JsSIP.NameAddrHeader(l.uri,l.display_name,l.params)}catch(t){l=-1}a=void 0}null===a&&(b=r);return a},Proxy_Authenticate:function(){return bb()},challenge:bb,other_challenge:sc,auth_param:fa,digest_cln:wa,realm:tc,realm_value:Ac,domain:uc,URI:xa,nonce:vc,nonce_value:Bc,opaque:wc,stale:xc,algorithm:yc,qop_options:zc,qop_value:ya,Proxy_Require:function(){var a,c,d,e,g,f;g=b;a=u();if(null!==a){c=[];f=b;d=x();null!==d?(e=u(),null!==
e?d=[d,e]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=x(),null!==d?(e=u(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;return a},Record_Route:function(){var a,c,d,e,g,f,n;f=g=b;a=za();if(null!==a){c=[];n=b;d=x();null!==d?(e=za(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);for(;null!==d;)c.push(d),n=b,d=x(),null!==d?(e=za(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;if(null!==a){c=l.multi_header.length;
for(a=0;a<c;a++)if(null===l.multi_header[a].parsed){l=null;break}l=null!==l?l.multi_header:-1;a=void 0}null===a&&(b=g);return a},rec_route:za,Require:function(){var a,c,d,e,g,f;g=b;a=u();if(null!==a){c=[];f=b;d=x();null!==d?(e=u(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=x(),null!==d?(e=u(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;return a},Route:function(){var a,c,d,e,g,f;g=b;a=Aa();if(null!==a){c=[];f=b;d=x();null!==
d?(e=Aa(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=x(),null!==d?(e=Aa(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;return a},route_param:Aa,Subscription_State:function(){var a,c,d,e,g,f;g=b;a=Cc();if(null!==a){c=[];f=b;d=y();null!==d?(e=cb(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=y(),null!==d?(e=cb(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,
b=g;return a},substate_value:Cc,subexp_params:cb,event_reason_value:Dc,Subject:function(){var a;a=mb();return null!==a?a:""},Supported:function(){var a,c,d,e,g,f;g=b;a=u();if(null!==a){c=[];f=b;d=x();null!==d?(e=u(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=x(),null!==d?(e=u(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;return null!==a?a:""},To:function(){var a,c,d,e,g,f,n;f=g=b;a=ka();null===a&&(a=Q());if(null!==a){c=
[];n=b;d=y();null!==d?(e=db(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);for(;null!==d;)c.push(d),n=b,d=y(),null!==d?(e=db(),null!==e?d=[d,e]:(d=null,b=n)):(d=null,b=n);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;if(null!==a){a=l.tag;try{l=new JsSIP.NameAddrHeader(l.uri,l.display_name,l.params),a&&l.setParam("tag",a)}catch(r){l=-1}a=void 0}null===a&&(b=g);return a},to_param:db,Via:function(){var a,c,d,e,g,f;g=b;a=Ba();if(null!==a){c=[];f=b;d=x();null!==d?(e=Ba(),null!==e?d=[d,e]:(d=null,b=f)):
(d=null,b=f);for(;null!==d;)c.push(d),f=b,d=x(),null!==d?(e=Ba(),null!==e?d=[d,e]:(d=null,b=f)):(d=null,b=f);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;return a},via_parm:Ba,via_params:eb,via_ttl:Gc,via_maddr:Hc,via_received:Ic,via_branch:Jc,response_port:Kc,sent_protocol:Ec,protocol_name:Lc,transport:Ca,sent_by:Fc,via_host:Mc,via_port:Nc,ttl:Ta,WWW_Authenticate:function(){return bb()},extension_header:function(){var a,c,d,e;e=b;a=u();null!==a?(c=lb(),null!==c?(d=Oc(),null!==d?a=[a,c,d]:(a=null,
b=e)):(a=null,b=e)):(a=null,b=e);return a},header_value:Oc,message_body:function(){var a,b;a=[];for(b=Ea();null!==b;)a.push(b),b=Ea();return a},stun_URI:function(){var a,c,d,h;h=b;a=Pc();null!==a?(58===e.charCodeAt(b)?(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=fb(),null!==d?a=[a,c,d]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h);return a},stun_scheme:Pc,stun_host_port:fb,stun_host:Qc,reg_name:da,stun_unreserved:gb,sub_delims:hb,turn_URI:function(){var a,c,d,h,k,l,n;l=b;a=Rc();null!==a?(58===e.charCodeAt(b)?
(c=":",b++):(c=null,0===g&&f('":"')),null!==c?(d=fb(),null!==d?(n=b,"?transport="===e.substr(b,11)?(h="?transport=",b+=11):(h=null,0===g&&f('"?transport="')),null!==h?(k=Ca(),null!==k?h=[h,k]:(h=null,b=n)):(h=null,b=n),h=null!==h?h:"",null!==h?a=[a,c,d,h]:(a=null,b=l)):(a=null,b=l)):(a=null,b=l)):(a=null,b=l);return a},turn_scheme:Rc,turn_transport:function(){var a,c,d,h,k;k=h=b;a=Ca();if(null!==a){"udp"===e.substr(b,3).toLowerCase()?(c=e.substr(b,3),b+=3):(c=null,0===g&&f('"udp"'));if(null===c&&
("tcp"===e.substr(b,3).toLowerCase()?(c=e.substr(b,3),b+=3):(c=null,0===g&&f('"tcp"')),null===c)){c=[];for(d=z();null!==d;)c.push(d),d=z()}null!==c?a=[a,c]:(a=null,b=k)}else a=null,b=k;null!==a&&(l.transport=transport,a=void 0);null===a&&(b=h);return a},uuid_URI:function(){var a,c,d;d=b;"uuid:"===e.substr(b,5)?(a="uuid:",b+=5):(a=null,0===g&&f('"uuid:"'));null!==a?(c=Sc(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return a},uuid:Sc,hex4:I,hex8:Tc,hex12:Uc};if(void 0!==F){if(void 0===Vc[F])throw Error("Invalid rule name: "+
jb(F)+".");}else F="CRLF";var b=0,g=0,S=0,Da=[],l={};if(null===Vc[F]()||b!==e.length){var ib=Math.max(b,S),Zc=ib<e.length?e.charAt(ib):null,Wc=Yc();new this.SyntaxError(Xc(Da),Zc,ib,Wc.line,Wc.column);return-1}return l},toSource:function(){return this._source},SyntaxError:function(e,F,f,N,t){this.name="SyntaxError";this.expected=e;this.found=F;switch(e.length){case 0:e="end of input";break;case 1:e=e[0];break;default:e=e.slice(0,e.length-1).join(", ")+" or "+e[e.length-1]}F=F?jb(F):"end of input";
this.message="Expected "+e+" but "+F+" found.";this.offset=f;this.line=N;this.column=t}};N.SyntaxError.prototype=Error.prototype;return N}();