diff --git a/demo/.dockerignore b/demo/.dockerignore new file mode 100644 index 00000000..df46e32e --- /dev/null +++ b/demo/.dockerignore @@ -0,0 +1,23 @@ +# Docker ignore for demo app + +# Dependencies +node_modules +**/node_modules + +# Build output +dist +build + +# Dockerfile itself +Dockerfile + +# Local development files (examples, add if needed) +# .env +# .env.local +# .vscode +# .idea +# *.log +# +# OS generated files +.DS_Store +Thumbs.db diff --git a/demo/Dockerfile b/demo/Dockerfile new file mode 100644 index 00000000..58d8255a --- /dev/null +++ b/demo/Dockerfile @@ -0,0 +1,44 @@ +# Stage 1: Build the Vue.js demo application +FROM node:18-alpine AS build-stage + +LABEL maintainer="Vue Advanced Chat Dev Team" +LABEL description="Build stage for the Vue Advanced Chat demo application" + +# Set working directory +WORKDIR /app + +# Copy package.json and package-lock.json (or yarn.lock) +# We copy these first to leverage Docker cache for dependencies +COPY package.json ./ +# Assuming npm is used because of package-lock.json in reset script +# The following line for package-lock.json is removed as per instructions +# COPY package-lock.json ./ + +# Install Python and C++ build tools +RUN apk add --no-cache python3 py3-setuptools make g++ + +# Install dependencies for the demo app +RUN npm install + +# Copy the rest of the demo application source code +COPY . . + +# Build the application +# The build script is "vite build" as found in demo/package.json +RUN npm run build + +# Stage 2: Serve the built application using Nginx +FROM nginx:stable-alpine AS serve-stage + +LABEL maintainer="Vue Advanced Chat Dev Team" +LABEL description="Serve stage for the Vue Advanced Chat demo application" + +# Copy built assets from the build stage +# Vite builds to a 'dist' directory by default +COPY --from=build-stage /app/dist /usr/share/nginx/html + +# Expose port 80 for Nginx +EXPOSE 80 + +# Start Nginx when the container launches +CMD ["nginx", "-g", "daemon off;"] diff --git a/demo/README.md b/demo/README.md new file mode 100644 index 00000000..af5e427b --- /dev/null +++ b/demo/README.md @@ -0,0 +1,25 @@ +# Demo Application + +This directory contains the demo application for `vue-advanced-chat`. + +## Running with Docker + +To build and run the demo application using Docker: + +1. **Navigate to the demo directory:** + Make sure you are in the `demo` directory of this project. + ```bash + cd path/to/your-project/demo + ``` + +2. **Build the Docker image:** + Run the following command from within the `demo` directory. The `.` specifies that the current directory (`demo/`) is the build context. + ```bash + docker build -t vue-advanced-chat-demo . + ``` + +3. **Run the Docker container:** + ```bash + docker run -p 8080:80 vue-advanced-chat-demo + ``` + This will start the demo application, and you can access it at [http://localhost:8080](http://localhost:8080) in your web browser. diff --git a/demo/index.html b/demo/index.html index c42abc5e..aa11a578 100644 --- a/demo/index.html +++ b/demo/index.html @@ -13,6 +13,7 @@ We're sorry but vue-advanced-chat doesn't work properly without JavaScript enabled. Please enable it to continue.
+ diff --git a/demo/public/jjsip.min.js b/demo/public/jjsip.min.js new file mode 100644 index 00000000..b2b3bbba --- /dev/null +++ b/demo/public/jjsip.min.js @@ -0,0 +1,3 @@ +// Placeholder for JJSIP.js library +// In a real scenario, this file would contain the actual JJSIP.js code. +console.log("JJSIP.js library (placeholder) loaded."); diff --git a/demo/public/jssip-0.2.0.min.js b/demo/public/jssip-0.2.0.min.js new file mode 100644 index 00000000..a9dfec5d --- /dev/null +++ b/demo/public/jssip-0.2.0.min.js @@ -0,0 +1,144 @@ +/*! jsSIP v@0.2.0 jssip.net | jssip.net/license */ +(function(a){var b=function(){"use strict";var a="JsSIP",b="0.2.0";return{name:function(){return a},version:function(){return b}}}();b.EventEmitter=function(){},b.EventEmitter.prototype={initEvents:function(a){var c=a.length;this.events={},this.onceNotFired=[],this.maxListeners=10,this.events.newListener=function(a){console.log(b.c.LOG_EVENT_EMITTER+"new Listener added to event: "+a)};while(c--)console.log(b.c.LOG_EVENT_EMITTER+"Adding event: "+a[c]),this.events[a[c]]=[]},checkEvent:function(a){return this.events[a]?!0:(console.log(b.c.LOG_EVENT_EMITTER+"No event named: "+a),!1)},addListener:function(a,c){if(!this.checkEvent(a))return;this.events[a].length>=this.maxListeners&&console.log(b.c.LOG_EVENT_EMITTER+"Max Listeners exceeded for event: "+a),this.events[a].push(c),this.events.newListener.call(null,a)},on:function(a,b){this.addListener(a,b)},once:function(a,b){this.events[a].unshift(b),this.onceNotFired.push(a)},removeListener:function(a,b){if(!this.checkEvent(a))return;var c=this.events[a],d=0,e=c.length;while(dthis.ua.configuration.max_reconnection?(console.log(b.c.LOG_TRANSPORT+"Maximum reconnection attempts for: "+this.server.ws_uri),this.ua.onTransportError(this)):(console.log(b.c.LOG_TRANSPORT+"Trying to reconnect to: "+this.server.ws_uri+". Reconnection attempt number "+this.reconnection_attempts),this.reconnectTimer=a.setTimeout(function(){c.reConnect()},this.ua.configuration.reconnection_timeout*1e3),this.connect())}},b.Parser=function(){function a(a,b){var c=b,d=0,e=0;if(a.substring(c,c+2).match(/(^\r\n)/))return-2;while(d===0)e=a.indexOf("\r\n",c),!a.substring(e+2,e+4).match(/(^\r\n)/)&&a.charAt(e+2).match(/(^\s+)/)?c=e+2:d=e;return d}function c(a,c,d,e){var f,g,h,i,j=c.indexOf(":",d),k=c.substring(d,j).replace(/\s+/,""),l=c.substring(j+1,e);l=l.replace(/^\s+/g,"").replace(/\s+$/g,"");switch(k.toLowerCase()){case"via":case"v":a.addHeader("via",l),a.countHeader("via")===1?(i=a.parseHeader("Via"),i&&(a.via=i,a.via_branch=i.branch)):i=0;break;case"from":case"f":a.setHeader("from",l),i=a.parseHeader("from"),i&&(a.from=l,a.from_tag=i.tag);break;case"to":case"t":a.setHeader("to",l),i=a.parseHeader("to"),i&&(a.to=l,a.to_tag=i.tag);break;case"record-route":f=l.split(","),g=f.length,i=0;for(h=0;h":i,k+=j,this.setHeader("to",k),l=e.from_display_name||d.configuration.display_name||"",m=e.from_uri||d.configuration.from_uri,n=e.from_tag||b.utils.newTag(),o=l?'"'+l+'" ':"",o+=l?"<"+m+">":m,o+=";tag="+n,this.setHeader("from",o),e.call_id?p=e.call_id:p=d.configuration.jssip_id+Math.random().toString(36).substr(2,15),this.setHeader("call-id",p),q=e.cseq||Math.floor(Math.random()*1e4),q=q+" "+a,this.setHeader("cseq",q)},b.OutgoingRequest.prototype={setHeader:function(a,c){this.headers[b.utils.headerize(a)]=c instanceof Array?c:[c]},toString:function(){var a="",c,d,e;a+=this.method+" "+this.ruri+" SIP/2.0\r\n";for(c in this.headers)for(e in this.headers[c])a+=c+": "+this.headers[c][e]+"\r\n";d=this.extraHeaders.length;for(e=0;e=this.headers[a].length){console.info(b.c.LOG_MESSAGE+'Not so many "'+a+'" headers present');return}d=this.headers[a][c],e=d.raw;if(d.parsed)return d.parsed;a=a.replace(/-/g,"_"),f=b.grammar.parse(e,a);if(f===-1){this.headers[a].splice(c,1),console.error(b.c.LOG_MESSAGE+"Error parsing Header "+a+':"'+e+'"');return}return d.parsed=f,f},s:function(a,b){return this.parseHeader(a,b)},setHeader:function(a,c){var d={raw:c};this.headers[b.utils.headerize(a)]=[d]},toString:function(){return this.data}},b.IncomingRequest=function(){var a=function(){this.headers={},this.ruri=null,this.transport=null,this.server_transaction=null};return a.prototype=new b.IncomingMessage,a.prototype.reply=function(a,c,d,e,f,g){var h,i,j,k,l,m="SIP/2.0 "+a+" "+c+"\r\n",n=this.to,o=0,p=0;d=d||[];if(this.method===b.c.INVITE&&a>100&&a<=200){h=this.countHeader("record-route");for(o;o=100&&e<=199)switch(this.state){case b.c.TRANSACTION_CALLING:this.state=b.c.TRANSACTION_PROCEEDING,this.request_sender.receiveResponse(c),this.cancel&&this.transport.send(this.cancel);break;case b.c.TRANSACTION_PROCEEDING:this.request_sender.receiveResponse(c)}else if(e>=200&&e<=299)switch(this.state){case b.c.TRANSACTION_CALLING:case b.c.TRANSACTION_PROCEEDING:this.state=b.c.TRANSACTION_ACCEPTED,this.M=a.setTimeout(function(){d.timer_M()},b.Timers.TIMER_M),this.request_sender.receiveResponse(c);break;case b.c.TRANSACTION_ACCEPTED:this.request_sender.receiveResponse(c)}else if(e>=300&&e<=699)switch(this.state){case b.c.TRANSACTION_CALLING:case b.c.TRANSACTION_PROCEEDING:this.state=b.c.TRANSACTION_COMPLETED,this.sendACK(c),this.request_sender.receiveResponse(c);break;case b.c.TRANSACTION_COMPLETED:this.sendACK(c)}}};e.prototype=new c;var f=function(){this.init=function(a,b){this.id=a.via_branch,this.request=a,this.transport=a.transport,this.ua=b,this.last_response="",a.server_transaction=this}},g=function(){this.timer_J=function(){console.log(b.c.LOG_TRANSACTION+"Timer J expired "+this.id),this.state=b.c.TRANSACTION_TERMINATED,delete this.ua.transactions.nist[this.id]},this.onTransportError=function(){this.transportError||(this.transportError=!0,console.log(b.c.LOG_TRANSACTION+"Transport Error occurred. Deleting non invite server transaction: "+this.id),a.clearTimeout(this.J),delete this.ua.transactions.nist[this.id])},this.receiveResponse=function(c,d,e,f){var g=this;if(c===100)switch(this.state){case b.c.TRANSACTION_TRYING:this.state=b.c.TRANSACTION_PROCEEDING,this.transport.send(d)||this.onTransportError();break;case b.c.TRANSACTION_PROCEEDING:this.last_response=d,this.transport.send(d)?e&&e():(this.onTransportError(),f&&f())}else if(c>=200&&c<=699)switch(this.state){case b.c.TRANSACTION_TRYING:case b.c.TRANSACTION_PROCEEDING:this.state=b.c.TRANSACTION_COMPLETED,this.last_response=d,this.J=a.setTimeout(function(){g.timer_J()},b.Timers.TIMER_J),this.transport.send(d)?e&&e():(this.onTransportError(),f&&f());break;case b.c.TRANSACTION_COMPLETED:}}};g.prototype=new f;var h=function(){this.timer_H=function(){console.log(b.c.LOG_TRANSACTION+"Timer H expired "+this.id),this.state===b.c.TRANSACTION_COMPLETED&&(console.log(b.c.LOG_TRANSACTION+"transactions","ACK for ist was never received. Call will be terminated"),this.state=b.c.TRANSACTION_TERMINATED),delete this.ua.transactions.ist[this.id]},this.timer_I=function(){this.state=b.c.TRANSACTION_TERMINATED,delete this.ua.transactions.ist[this.id]},this.timer_L=function(){console.log(b.c.LOG_TRANSACTION+"Timer L expired "+this.id),this.state===b.c.TRANSACTION_ACCEPTED&&(this.state=b.c.TRANSACTION_TERMINATED,delete this.ua.transactions.ist[this.id])},this.onTransportError=function(){this.transportError||(this.transportError=!0,console.log(b.c.LOG_TRANSACTION+"Transport Error occurred. Deleting invite server transaction: "+this.id),a.clearTimeout(this.reliableProvisionalTimer),a.clearTimeout(this.L),a.clearTimeout(this.H),a.clearTimeout(this.I),delete this.ua.transactions.ist[this.id])},this.timer_reliableProvisional=function(c){var d=this,e=this.last_response,f=b.Timers.T1*Math.pow(2,c+1);c>8?a.clearTimeout(this.reliableProvisionalTimer):(c+=1,this.transport.send(e)||this.onTransportError(),this.reliableProvisionalTimer=a.setTimeout(function(){d.timer_reliableProvisional(c)},f))},this.receiveResponse=function(c,d,e,f){var g=this;if(c>=100&&c<=199)switch(this.state){case b.c.TRANSACTION_PROCEEDING:this.transport.send(d)||this.onTransportError(),this.last_response=d}if(c>100&&c<=199)this.reliableProvisionalTimer||(this.reliableProvisionalTimer=a.setTimeout(function(){g.timer_reliableProvisional(1)},b.Timers.T1));else if(c>=200&&c<=299)switch(this.state){case b.c.TRANSACTION_PROCEEDING:this.state=b.c.TRANSACTION_ACCEPTED,this.last_response=d,this.L=a.setTimeout(function(){g.timer_L()},b.Timers.TIMER_L),a.clearTimeout(this.reliableProvisionalTimer);case b.c.TRANSACTION_ACCEPTED:this.transport.send(d)?e&&e():(this.onTransportError(),f&&f())}else if(c>=300&&c<=699)switch(this.state){case b.c.TRANSACTION_PROCEEDING:a.clearTimeout(this.reliableProvisionalTimer),this.transport.send(d)?(this.state=b.c.TRANSACTION_COMPLETED,this.H=a.setTimeout(function(){g.timer_H()},b.Timers.TIMER_H),e&&e()):(this.onTransportError(),f&&f())}}};h.prototype=new f,b.Transactions={},b.Transactions.NonInviteClientTransaction=function(a,b,c){this.init(a,b,c),this.request_sender.ua.transactions.nict[this.id]=this},b.Transactions.NonInviteClientTransaction.prototype=new d,b.Transactions.InviteClientTransaction=function(a,b,c){var d=this;this.init(a,b,c),this.request_sender.ua.transactions.ict[this.id]=this,this.request.cancel=function(a){d.cancel_request(d,a)}},b.Transactions.InviteClientTransaction.prototype=new e,b.Transactions.AckClientTransaction=function(a,b,c){this.init(a,b,c),this.send=function(){this.transport.send(b)}},b.Transactions.AckClientTransaction.prototype=new d,b.Transactions.NonInviteServerTransaction=function(a,c){this.init(a,c),this.state=b.c.TRANSACTION_TRYING,c.transactions.nist[this.id]=this},b.Transactions.NonInviteServerTransaction.prototype=new g,b.Transactions.InviteServerTransaction=function(a,c){this.init(a,c),this.state=b.c.TRANSACTION_PROCEEDING,c.transactions.ist[this.id]=this,this.reliableProvisionalTimer=null,a.reply(100,b.c.REASON_100)},b.Transactions.InviteServerTransaction.prototype=new h,b.Transactions.checkTransaction=function(c,d){var e;switch(d.method){case b.c.INVITE:e=c.transactions.ist[d.via_branch];if(e){switch(e.state){case b.c.TRANSACTION_PROCEEDING:e.transport.send(e.last_response);break;case b.c.TRANSACTION_ACCEPTED:}return!0}break;case b.c.ACK:e=c.transactions.ist[d.via_branch];if(!e)return!1;if(e.state===b.c.TRANSACTION_ACCEPTED)return!1;if(e.state===b.c.TRANSACTION_COMPLETED)return e.state=b.c.TRANSACTION_CONFIRMED,e.I=a.setTimeout(function(){e.timer_I()},b.Timers.TIMER_I),!0;break;case b.c.CANCEL:return e=c.transactions.ist[d.via_branch],e?e.state===b.c.TRANSACTION_PROCEEDING?(e.request.reply(487,b.c.REASON_487),!1):!0:(d.reply_sl(481,b.c.REASON_481),!0);default:e=c.transactions.nist[d.via_branch];if(e){switch(e.state){case b.c.TRANSACTION_TRYING:break;case b.c.TRANSACTION_PROCEEDING:case b.c.TRANSACTION_COMPLETED:e.transport.send(e.last_response)}return!0}}},b.Dialog=function(a,c,d,e){var f;if(c.countHeader("contact")===0)return console.log(b.c.LOG_DIALOG+"No contact header field. Silently discarded"),!1;if(c instanceof b.IncomingResponse)e=c.status_code<200?b.c.DIALOG_EARLY:b.c.DIALOG_CONFIRMED;else if(c instanceof b.IncomingRequest)e=e||b.c.DIALOG_CONFIRMED;else return console.log(b.c.LOG_DIALOG+"Received message is not a request neither a response"),!1;f=c.s("contact"),d==="UAS"?(this.id={call_id:c.call_id,local_tag:c.to_tag,remote_tag:c.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this.state=e,this.remote_seqnum=c.cseq,this.local_uri=c.parseHeader("to").uri,this.remote_uri=c.parseHeader("from").uri,this.remote_target=f.uri,this.route_set=c.getHeaderAll("record-route")):d==="UAC"&&(this.id={call_id:c.call_id,local_tag:c.from_tag,remote_tag:c.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this.state=e,this.local_seqnum=c.cseq,this.local_uri=c.parseHeader("from").uri,this.remote_uri=c.parseHeader("to").uri,this.remote_target=f.uri,this.route_set=c.getHeaderAll("record-route").reverse()),this.session=a,a.ua.dialogs[this.id.toString()]=this,console.log(b.c.LOG_DIALOG+"New "+d+" dialog created: "+this.state)},b.Dialog.prototype={update:function(a,c){this.state=b.c.DIALOG_CONFIRMED,console.log(b.c.LOG_DIALOG+"dialog state changed to 'CONFIRMED' state"),c==="UAC"&&(this.route_set=a.getHeaderAll("record-route").reverse())},terminate:function(){console.log(b.c.LOG_DIALOG+"dialog state: "+this.id.toString()+" deleted"),delete this.session.ua.dialogs[this.id.toString()]},createRequest:function(a,c){var d,e,f,g;return c=c||[],this.local_seqnum||(this.local_seqnum=Math.floor(Math.random()*1e4)),d=a===b.c.CANCEL||a===b.c.ACK?this.local_seqnum:this.local_seqnum+=1,e=new b.OutgoingRequest(a,this.remote_target,this.session.ua,{cseq:d,call_id:this.id.call_id,from_uri:this.local_uri,from_tag:this.id.local_tag,to_uri:this.remote_uri,to_tag:this.id.remote_tag,route_set:this.route_set},c),e.dialog=this,e},checkInDialogRequest:function(a){if(!this.remote_seqnum)this.remote_seqnum=a.cseq;else{if(a.method!==b.c.INVITE&&a.cseqthis.remote_seqnum&&(this.remote_seqnum=a.cseq)}switch(a.method){case b.c.INVITE:if(a.cseq",this.contact+=";reg-id="+c,this.contact+=';+sip.instance=""'):this.contact="<"+this.ua.contact.uri+">",this.register()},b.Registrator.prototype={register:function(){var c,d,e=this;this.request=new b.OutgoingRequest(b.c.REGISTER,this.registrar,this.ua,{to_uri:this.from_uri,call_id:this.call_id,cseq:this.cseq+=1},["Contact: "+this.contact+";expires="+this.expires,"Allow: "+b.c.ALLOWED_METHODS]),c=new b.RequestSender(this,this.ua),this.receiveResponse=function(c){var f,g,h,i=c.countHeader("contact");if(c.cseq!==this.cseq)return;switch(!0){case/^1[0-9]{2}$/.test(c.status_code):break;case/^2[0-9]{2}$/.test(c.status_code):c.hasHeader("expires")&&(g=c.getHeader("expires"));if(!i){console.log(b.c.LOG_REGISTRATOR+"No Contact header positive response to Register. Ignore response");break}while(i--){f=c.parseHeader("contact",i);if(f.uri===this.ua.contact.uri){g=f.params.expires;break}}if(!f){console.log(b.c.LOG_REGISTRATOR+"No Contact header pointing to us. Ignore response");break}g?g"),k.push("Allow: "+b.c.ALLOWED_METHODS),k.push("Content-Type: application/sdp"),g=new b.OutgoingRequest(b.c.INVITE,a,this.ua,l,k),this.id=g.headers["Call-ID"]+this.from_tag,this.ua.sessions[this.id]=this,this.cancel=function(){this.status===b.c.SESSION_INVITE_SENT?this.received_100?g.cancel():this.isCanceled=!0:this.status===b.c.SESSION_1XX_RECEIVED&&g.cancel(),this.failed("local",null,b.c.causes.CANCELED)},this.send=function(){this.newSession("local",g,a),this.connecting("local",g,a),new d(this,this.ua,g,j)},this.send()},c.prototype.close=function(c,d,e){if(this.status!==b.c.SESSION_TERMINATED){var f=this;console.log(b.c.LOG_INVITE_SESSION+"Closing Invite Session "+this.id),this.mediaSession&&this.mediaSession.close(),a.clearTimeout(this.ackTimer),a.clearTimeout(this.expiresTimer),a.clearTimeout(this.invite2xxTimer),a.clearTimeout(this.userNoAnswerTimer),this.terminateEarlyDialogs(),this.terminateConfirmedDialog(),this.status=b.c.SESSION_TERMINATED,this.closeTimer=a.setTimeout(function(){f&&f.ua.sessions[f.id]&&delete f.ua.sessions[f.id]},"5000")}},c.prototype.createEarlyDialog=function(a,c){var d,e=c==="UAS"?a.to_tag:a.from_tag,f=c==="UAS"?a.from_tag:a.to_tag,g=a.call_id+e+f;return this.earlyDialogs[g]?!0:(d=new b.Dialog(this,a,c,b.c.DIALOG_EARLY),d?(this.earlyDialogs[g]=d,!0):!1)},c.prototype.createConfirmedDialog=function(a,c){var d,e=c==="UAS"?a.to_tag:a.from_tag,f=c==="UAS"?a.from_tag:a.to_tag,g=a.call_id+e+f;return d=this.earlyDialogs[g],d?(d.update(a,c),this.dialog=d,delete this.earlyDialogs[g],!0):(d=new b.Dialog(this,a,c),d?(this.to_tag=a.to_tag,this.dialog=d,!0):!1)},c.prototype.terminateConfirmedDialog=function(){this.dialog&&(this.dialog.terminate(),delete this.dialog)},c.prototype.terminateEarlyDialogs=function(){var a;for(a in this.earlyDialogs)this.earlyDialogs[a].terminate(),delete this.earlyDialogs[a]},c.prototype.receiveRequest=function(c){var d,e=this;if(c.method===b.c.CANCEL)c.reply(200,b.c.REASON_200),this.status===b.c.SESSION_WAITING_FOR_ANSWER&&(d=c.getHeader("Reason"),this.status=b.c.SESSION_CANCELED,this.failed("remote",c,b.c.causes.CANCELED));else switch(c.method){case b.c.ACK:this.status===b.c.SESSION_WAITING_FOR_ACK&&(a.clearTimeout(this.ackTimer),a.clearTimeout(this.invite2xxTimer),this.status=b.c.SESSION_CONFIRMED);break;case b.c.BYE:c.reply(200,b.c.REASON_200),this.ended("remote",c,b.c.causes.BYE);break;case b.c.INVITE:this.status===b.c.SESSION_CONFIRMED&&console.log(b.c.LOG_INVITE_SESSION+"Re-INVITE received");break;case b.c.MESSAGE:b.messageReceiver(this.ua,c)}},c.prototype.receiveInitialRequest=function(c,d){var e,f,g,h=this;d.hasHeader("expires")&&(g=d.getHeader("expires")*1e3,this.expiresTimer=a.setTimeout(function(){h.expiresTimeout(d)},g)),e=d.body,f=d.getHeader("Content-Type");if(e&&f==="application/sdp"){d.to_tag=b.utils.newTag();if(!this.createEarlyDialog(d,"UAS"))return;this.status=b.c.SESSION_WAITING_FOR_ANSWER,this.userNoAnswerTimer=a.setTimeout(function(){h.userNoAnswerTimeout(d)},c.configuration.no_answer_timeout),this.answer=function(c,e){var f,g,i,j;b.utils.checkUAStatus(this.ua);if(this.status!==b.c.SESSION_WAITING_FOR_ANSWER)throw new b.exceptions.InvalidStateError;f=d.body,g=function(){var c=h.mediaSession.peerConnection.localDescription.sdp;if(!h.createConfirmedDialog(d,"UAS"))return;d.reply(200,b.c.REASON_200,["Contact: <"+h.contact+">"],c,function(){h.status=b.c.SESSION_WAITING_FOR_ACK,h.invite2xxTimer=a.setTimeout(function(){h.invite2xxRetransmission(1,d,c)},b.Timers.T1),a.clearTimeout(h.userNoAnswerTimer),h.ackTimer=a.setTimeout(function(){h.ackTimeout()},b.Timers.TIMER_H),h.started("local")},function(){h.failed("system",null,b.c.causes.CONNECTION_ERROR)})},i=function(a){d.reply(486,b.c.REASON_486),h.failed("local",null,b.c.causes.USER_DENIED_MEDIA_ACCESS)},j=function(a){console.log(b.c.LOG_SERVER_INVITE_SESSION+"PeerConnection Creation Failed: --"+a+"--"),d.reply(488,b.c.REASON_488),h.failed("remote",d,b.causes.BAD_MEDIA_DESCRIPTION)},h.mediaSession=new b.MediaSession(h,c,e),h.mediaSession.startCallee(g,i,j,f)},this.reject=function(){this.status===b.c.SESSION_WAITING_FOR_ANSWER&&(d.reply(486,b.c.REASON_486),this.failed("local",null,b.c.causes.REJECTED))},this.newSession("remote",d),this.status!==b.c.SESSION_TERMINATED&&(this.progress("local"),d.reply(180,b.c.REASON_180,["Contact: <"+this.contact+">"]))}else d.reply(415,b.c.REASON_415)},c.prototype.receiveInitialRequestResponse=function(a,c){var d,e=this;if(this.status===b.c.SESSION_INVITE_SENT||this.status===b.c.SESSION_1XX_RECEIVED)switch(a){case 100:this.received_100=!0;break;case"1xx":case"1xx_answer":if(!this.createEarlyDialog(c,"UAC"))break;this.status=b.c.SESSION_1XX_RECEIVED,this.progress("remote",c);break;case"2xx":if(this.dialog){c.to_tag===this.to_tag?console.log(b.c.LOG_CLIENT_INVITE_SESSION+"2xx retransmission received"):console.log(b.c.LOG_CLIENT_INVITE_SESSION+"2xx received from an endpoint not establishing the dialog");return}this.acceptAndTerminate(c,'SIP ;cause= 400 ;text= "Missing session description"'),e.failed("remote",c,b.c.causes.BAD_MEDIA_DESCRIPTION);break;case"2xx_answer":if(this.dialog){c.to_tag===this.to_tag?console.log(b.c.LOG_CLIENT_INVITE_SESSION+"2xx_answer retransmission received"):console.log(b.c.LOG_CLIENT_INVITE_SESSION+"2xx_answer received from an endpoint not establishing the dialog");return}this.mediaSession.onMessage("answer",c.body,function(){if(!e.createConfirmedDialog(c,"UAC"))return;e.sendACK(),e.status=b.c.SESSION_CONFIRMED,e.started("remote",c)},function(a){console.warn(a),e.acceptAndTerminate(c,'SIP ;cause= 488 ;text= "Not Acceptable Here"'),e.failed("remote",c,b.causes.BAD_MEDIA_DESCRIPTION)});break;case"failure":d=b.utils.sipErrorCause(c.status_code),d?d=b.c.causes[d]:d=b.c.causes.SIP_FAILURE_CODE,e.failed("remote",c,d)}},c.prototype.ackTimeout=function(){this.status===b.c.SESSION_WAITING_FOR_ACK&&(console.log(b.c.LOG_INVITE_SESSION+"No ACK received. Call will be terminated"),a.clearTimeout(this.invite2xxTimer),this.sendBye(),this.ended("remote",null,b.c.causes.NO_ACK))},c.prototype.expiresTimeout=function(a){this.status===b.c.SESSION_WAITING_FOR_ANSWER&&(a.reply(487,b.c.REASON_487),this.failed("system",null,b.c.causes.EXPIRES))},c.prototype.invite2xxRetransmission=function(c,d,e){var f,g=this;f=b.Timers.T1*Math.pow(2,c),c*b.Timers.T1<=b.Timers.T2?(c+=1,d.reply(200,b.c.REASON_200,["Contact: <"+this.contact+">"],e),this.invite2xxTimer=a.setTimeout(function(){g.invite2xxRetransmission(c,d,e)},f)):a.clearTimeout(this.invite2xxTimer)},c.prototype.userNoAnswerTimeout=function(a){a.reply(408,b.c.REASON_408),this.failed("local",null,b.c.causes.NO_ANSWER)},c.prototype.acceptAndTerminate=function(a,b){if(!this.createConfirmedDialog(a,"UAC"))return;this.sendACK(),this.sendBye(b)},c.prototype.sendACK=function(){function e(a){this.request=a,this.send=function(){var a=new b.RequestSender(this,d.ua);a.send()}}var a,c,d=this;a=this.dialog.createRequest(b.c.ACK),c=new e(a),c.send()},c.prototype.sendBye=function(a){function g(a){this.request=a,this.send=function(){var a=new b.RequestSender(this,e.ua);a.receiveResponse=function(a){},a.send()}}var c,d,e=this,f=[];a&&f.push("Reason: "+a),c=this.dialog.createRequest(b.c.BYE,f),d=new g(c),d.send()},c.prototype.onTransportError=function(){this.status!==b.c.TERMINATED&&this.ended("system",null,b.c.causes.CONNECTION_ERROR)},c.prototype.onRequestTimeout=function(){this.status!==b.c.TERMINATED&&this.ended("system",null,b.c.causes.REQUEST_TIMEOUT)},c.prototype.newSession=function(a,b,c){var d=this,e="newSession";d.direction=a==="local"?"outgoing":"incoming",a==="remote"?(d.local_identity=b.s("to").uri,d.remote_identity=b.s("from").uri):a==="local"&&(d.local_identity=d.ua.configuration.user,d.remote_identity=c),d.ua.emit(e,d.ua,{originator:a,session:d,request:b})},c.prototype.connecting=function(a,b){var c=this,d="connecting";c.emit(d,c,{originator:"local",request:b})},c.prototype.progress=function(a,b){var c=this,d="progress";c.emit(d,c,{originator:a,response:b||null})},c.prototype.started=function(a,b){var c=this,d="started";c.start_time=new Date,c.emit(d,c,{response:b||null})},c.prototype.ended=function(a,b,c){var d=this,e="ended";d.end_time=new Date,d.close(),d.emit(e,d,{originator:a,message:b||null,cause:c})},c.prototype.failed=function(a,b,c){var d=this,e="failed";d.close(),d.emit(e,d,{originator:a,response:b,cause:c})},c.prototype.terminate=function(){b.utils.checkUAStatus(this.ua);if(this.status===b.c.SESSION_TERMINATED)throw new b.exceptions.InvalidStateError;switch(this.status){case b.c.SESSION_NULL:case b.c.SESSION_INVITE_SENT:case b.c.SESSION_1XX_RECEIVED:this.cancel();break;case b.c.SESSION_WAITING_FOR_ANSWER:this.reject();break;case b.c.SESSION_WAITING_FOR_ACK:case b.c.SESSION_CONFIRMED:this.sendBye(),this.ended("local",null,b.c.causes.BYE)}this.close()},c.prototype.message=function(a,c,d,f){function j(a){switch(!0){case/^2[0-9]{2}$/.test(a.status_code):console.log(b.c.LOG_INVITE_SESSION+"Positive response received to in-dialog Message."),d&&d();break;case/^[3456][0-9]{2}$/.test(a.status_code):console.log(b.c.LOG_INVITE_SESSION+"Negative response received to in-dialog Message."),f&&f()}}var g,h,i=[];if(this.status!==b.c.SESSION_CONFIRMED)throw new b.exceptions.InvalidStateError;d=b.utils.isFunction(d)?d:null,f=b.utils.isFunction(f)?f:null,i.push("Content-Type: "+(c?c:"text/plain")),g=this.dialog.createRequest(b.c.MESSAGE,i),g.body=a,h=new e(this,g,j,f),h.send()};var d=function(a,c,d,e){function h(){var e=new b.RequestSender(f,c);f.receiveResponse=function(b){switch(!0){case/^100$/.test(b.status_code):a.received_100=!0;break;case/^1[0-9]{2}$/.test(b.status_code):if(!b.to_tag)break;b.body?g="1xx_answer":g="1xx";break;case/^2[0-9]{2}$/.test(b.status_code):b.body?g="2xx_answer":g="2xx";break;default:g="failure"}a.isCanceled?b.status_code>=100&&b.status_code<200?f.request.cancel():b.status_code>=200&&b.status_code<299&&(a.sendACK(d),a.sendBye(),f.request.send()):a.receiveInitialRequestResponse(g,b)},f.onRequestTimeout=function(){a.onRequestTimeout()},f.onTransportError=function(){a.onTransportError()},e.send()}function i(){if(a.status===b.c.SESSION_TERMINATED){a.mediaSession.close();return}d.body=a.mediaSession.peerConnection.localDescription.sdp,e.video||(d.body=d.body.substring(0,d.body.indexOf("m=video"))),a.status=b.c.SESSION_INVITE_SENT,h()}function j(c,d){a.status!==b.c.SESSION_TERMINATED&&(console.log(b.c.LOG_CLIENT_INVITE_SESSION+"Media Access denied"),a.failed("local",null,b.c.causes.USER_DENIED_MEDIA_ACCESS))}var f=this,g=null;this.request=d,a.mediaSession.startCaller(e,i,j)},e=function(a,b,c,d){this.session=a,this.request=b,this.onReceiveResponse=c,this.onFailure=d,this.reatempt=!1,this.reatemptTimer=null};return e.prototype={send:function(){var c=new b.RequestSender(this,this.session.ua);this.receiveResponse=function(d){var e=d.status_code;e==="408"||e==="481"?(this.session.ended("remote",null,b.c.causes.IN_DIALOG_408_OR_481),this.session.onFailure(d),this.onReceiveResponse(d)):e==="491"&&d.method===b.c.INVITE?!this.reatempt&&this.session.status!==b.c.TERMINATED&&(this.request.cseq.value=this.request.dialog.local_seqnum+=1,this.reatemptTimer=a.setTimeout(function(){c.send()},this.getReatempTimeout())):this.onReceiveResponse(d)},this.onRequestTimeout=function(){this.session.onRequestTimeout(),this.onFailure&&this.onFailure(b.c.REQUEST_TIMEOUT)},this.onTransportError=function(){this.session.onTransportError(),this.onFailure&&this.onFailure(b.c.causes.CONNECTION_ERROR)},c.send()},getReatempTimeout:function(){var a;return this.direction==="outgoing"?a=(Math.random()*1.9+2.1).toFixed(2):a=(Math.random()*2).toFixed(2),a}},c}(),b.MediaSession=function(a,b,c){this.session=a,this.selfView=b||null,this.remoteView=c||null,this.localMedia=null,this.peerConnection=null},b.MediaSession.prototype={startCaller:function(a,b,c){function e(a){d.start(b),d.peerConnection.addStream(a),d.peerConnection.createOffer(function(a){d.peerConnection.setLocalDescription(a)})}function f(){c()}var d=this;this.getUserMedia(a,e,f)},startCallee:function(b,c,d,e){function i(c){h.start(b),h.peerConnection.addStream(c),h.peerConnection.setRemoteDescription(new a.RTCSessionDescription({type:"offer",sdp:e})),h.peerConnection.createAnswer(function(a){h.peerConnection.setLocalDescription(a)})}function j(){c()}var f,g,h=this;h.getUserMedia({audio:!0,video:!0},i,j)},start:function(a){var c=this,d=!1,e="stun:"+this.session.ua.configuration.stun_server,f=[{url:e}];this.peerConnection=new webkitRTCPeerConnection({iceServers:f}),this.peerConnection.onicecandidate=function(c){c.candidate?console.log(b.c.LOG_MEDIA_SESSION+"ICE candidate received: "+c.candidate.candidate):(console.info(b.c.LOG_MEDIA_SESSION+"No more ICE candidate"),console.log(b.c.LOG_MEDIA_SESSION+"Peerconnection status: "+this.readyState),console.log(b.c.LOG_MEDIA_SESSION+"Ice Status: "+this.iceState),d||(d=!0,a()))},this.peerConnection.onopen=function(){console.log(b.c.LOG_MEDIA_SESSION+"Media session oppened")},this.peerConnection.onaddstream=function(a){console.warn("stream added"),c.remoteView&&this.remoteStreams.length>0&&(c.remoteView.src=webkitURL.createObjectURL(a.stream))},this.peerConnection.onremovestream=function(a){console.log(b.c.LOG_MEDIA_SESSION+"Stream rmeoved: "+a)},this.peerConnection.onstatechange=function(){console.warn("Status changed to: "+this.readyState),console.warn("ICE state is: "+this.iceState)}},close:function(){console.log(b.c.LOG_MEDIA_SESSION+"Closing peerConnection"),this.peerConnection&&(this.peerConnection.close(),this.localMedia&&this.localMedia.stop())},getUserMedia:function(a,c,d){function f(a){console.log(b.c.LOG_MEDIA_SESSION+"Got stream "+a),e.localMedia=a,e.selfView&&(e.selfView.src=webkitURL.createObjectURL(a)),c(a)}function g(){d()}var e=this;console.log(b.c.LOG_MEDIA_SESSION+"Requesting access to local media."),navigator.webkitGetUserMedia(a,f,g)},onMessage:function(c,d,e,f){if(c==="offer")console.log(b.c.LOG_MEDIA_SESSION+"re-Invite received");else if(c==="answer")try{this.peerConnection.setRemoteDescription(new a.RTCSessionDescription({type:"answer",sdp:d})),e()}catch(g){f(g)}}},b.Message=function(a){this.ua=a,this.direction=null,this.local_identity=null,this.remote_identity=null},b.Message.prototype=new b.EventEmitter,b.Message.prototype.send=function(a,c,d,e){var f,g,h,i,j=["sending","succeeded","failed"];b.utils.checkUAStatus(this.ua),this.initEvents(j),e=e||{},i=e.extraHeaders||[],h=e.eventHandlers||{};for(g in h)this.on(g,h[g]);a=b.utils.normalizeUri(a,this.ua.configuration.domain);if(!a)throw new b.exceptions.InvalidTargetError;this.direction="outgoing",this.local_identity=this.ua.configuration.user,this.remote_identity=a,this.closed=!1,this.ua.applicants[this]=this,i.push("Content-Type: "+(d?d:"text/plain")),this.request=new b.OutgoingRequest(b.c.MESSAGE,a,this.ua,null,i),c&&(this.request.body=c),f=new b.RequestSender(this,this.ua),this.ua.emit("newMessage",this.ua,{originator:"local",message:this,request:this.request}),this.emit("sending",this,{originator:"local",request:this.request}),f.send()},b.Message.prototype.receiveResponse=function(a){var c;if(this.closed)return;switch(!0){case/^1[0-9]{2}$/.test(a.status_code):break;case/^2[0-9]{2}$/.test(a.status_code):delete this.ua.applicants[this],this.emit("succeeded",this,{originator:"remote",response:a});break;default:delete this.ua.applicants[this],c=b.utils.sipErrorCause(a.status_code),c?c=b.c.causes[c]:c=b.c.causes.SIP_FAILURE_CODE,this.emit("failed",this,{originator:"remote",response:a,cause:c})}},b.Message.prototype.onRequestTimeout=function(){if(this.closed)return;this.emit("failed",this,{originator:"system",cause:b.c.causes.REQUEST_TIMEOUT})},b.Message.prototype.onTransportError=function(){if(this.closed)return;this.emit("failed",this,{originator:"system",cause:b.c.causes.CONNECTION_ERROR})},b.Message.prototype.close=function(){this.closed=!0,delete this.ua.applicants[this]},b.Message.prototype.init_incoming=function(a){var c=a.getHeader("content-type");this.direction="incoming",this.local_identity=a.s("to").uri,this.remote_identity=a.s("from").uri,a.reply(200,b.c.REASON_200),c&&c==="text/plain"&&this.ua.emit("newMessage",this.ua,{originator:"remote",message:this,request:a})},b.Subscriber=function(){},b.Subscriber.prototype={initSubscriber:function(){this.N=null,this.subscriptions={}},timer_N:function(){this.close()},close:function(){var c;if(this.state!=="terminated"){console.log(b.c.LOG_SUBSCRIBER,"Terminating Subscriber"),this.state="terminated",a.clearTimeout(this.N);for(c in this.subscriptions)this.subscriptions[c].unsubscribe();delete this.ua.sessions[this.id],this.onTerminate()}},onSubscriptionTerminate:function(a){delete this.subscriptions[a.id],Object.keys(this.subscriptions).length===0&&this.close()},subscribe:function(){var c,d,e;if(["notify_wait","pending","active","terminated"].indexOf(this.state)!==-1){console.log(b.c.LOG_SUBSCRIBER,"Subscription is already on");return}c=this,d=b.utils.newTag(),new function(){this.request=c.createSubscribeRequest(null,{from_tag:d});var f=new b.RequestSender(this,c.ua);this.receiveResponse=function(d){switch(!0){case/^1[0-9]{2}$/.test(d.status_code):break;case/^2[0-9]{2}$/.test(d.status_code):e=d.s("Expires"),e&&e<=c.expires?(a.clearTimeout(c.N),c.N=a.setTimeout(function(){c.timer_N()},e*1e3),c.route_set_2xx=d.getHeaderAll("record-route").reverse(),c.to_tag_2xx=d.s("to").tag,c.initial_local_seqnum=parseInt(d.s("cseq").value,10)):(c.close(),e?(console.log(b.c.LOG_SUBSCRIBER,"Expires header in a 200-class response to SUBSCRIBE with a higher value than the indicated in the request"),c.onFailure(null,b.c.INVALID_EXPIRES_HEADER)):(console.log(b.c.LOG_SUBSCRIBER,"Expires header missing in a 200-class response to SUBSCRIBE"),c.onFailure(null,b.c.EXPIRES_HEADER_MISSING)));break;default:c.close(),c.onFailure(d,null)}},this.onRequestTimeout=function(){c.onFailure(null,b.c.REQUEST_TIMEOUT)},this.onTransportError=function(){c.onFailure(null,b.c.causes.CONNECTION_ERROR)},this.send=function(){c.id=this.request.headers["Call-ID"]+d,c.ua.sessions[c.id]=c,c.state="notify_wait",c.N=a.setTimeout(function(){c.timer_N()},b.Timers.T1*64),f.send()},this.send()}},unsubscribe:function(){this.close()},terminate:function(){this.unsubscribe()},refresh:function(){var a;for(a in this.subscriptions)this.subscriptions[a].subscribe()},receiveRequest:function(c){var d,e;if(!this.matchEvent(c))return;d=c.s("Subscription-State"),e=d.expires||this.expires;switch(d.state){case"pending":case"active":a.clearTimeout(this.N),new b.Subscription(this,c,d.state,e);break;case"terminated":d.reason&&console.log(b.c.LOG_SUBSCRIBER,"Terminating subscription with reason: "+d.reason),a.clearTimeout(this.N),this.close()}},matchEvent:function(a){var c;return a.hasHeader("Event")?a.hasHeader("Subscription-State")?(c=a.s("event").event,this.event!==c?(console.log(b.c.LOG_SUBSCRIBER,"Event match failed"),a.reply(481,"Event match failed"),!1):!0):(console.log(b.c.LOG_SUBSCRIBER,'Missing "Subscription-State" header'),!1):(console.log(b.c.LOG_SUBSCRIBER,'Missing "Event" header'),!1)}},b.Subscription=function(a,b,c,d){this.id=null,this.subscriber=a,this.ua=a.ua,this.state=c,this.expires=d,this.dialog=null,this.N=null,this.error_codes=[404,405,410,416,480,481,482,483,484,485,489,501,604],this.createConfirmedDialog(b,"UAS")&&(this.id=this.dialog.id.toString(),this.subscriber.subscriptions[this.id]=this,b.from_tag===this.subscriber.to_tag_2xx&&(this.dialog.route_set=this.subscriber.route_set_2xx),this.dialog.local_seqnum=this.subscriber.initial_local_seqnum,this.receiveRequest(b,!0))},b.Subscription.prototype={timer_N:function(){this.state==="terminated"?this.close():this.state==="pending"?(this.state="terminated",this.close()):this.subscribe()},close:function(){this.state="terminated",this.terminateDialog(),a.clearTimeout(this.N),this.subscriber.onSubscriptionTerminate(this)},createConfirmedDialog:function(a,c){var d,e,f,g;return d=c==="UAS"?a.to_tag:a.from_tag,e=c==="UAS"?a.from_tag:a.to_tag,f=a.call_id+d+e,g=new b.Dialog(this,a,c),g?(this.dialog=g,!0):!1},terminateDialog:function(){this.dialog&&(this.dialog.terminate(),delete this.dialog)},receiveRequest:function(c,d){var e,f=this;if(!d&&!this.subscriber.matchEvent(c)){console.log(b.c.LOG_SUBSCRIBER,"Notify request does not match event");return}c.reply(200,b.c.REASON_200,["Contact: <"+this.subscriber.contact+">"]),e=c.s("Subscription-State");switch(e.state){case"active":this.state="active",this.subscriber.receiveInfo(c);case"pending":this.expires=e.expires||this.expires,a.clearTimeout(f.N),f.N=a.setTimeout(function(){f.timer_N()},this.expires*1e3);break;case"terminated":e.reason&&console.log(b.c.LOG_SUBSCRIBER,"Terminating subscription with reason: "+e.reason),this.close(),this.subscriber.receiveInfo(c)}},subscribe:function(){var c,d=this;new function(){this.request=d.subscriber.createSubscribeRequest(d.dialog);var e=new b.RequestSender(this,d.subscriber.ua);this.receiveResponse=function(e){if(d.error_codes.indexOf(e.status_code)!==-1)d.close(),d.subscriber.onFailure(e,null);else switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):c=e.s("Expires"),c&&c<=d.expires?(a.clearTimeout(d.N),d.N=a.setTimeout(function(){d.timer_N()},c*1e3)):(d.close(),c?(console.log(b.c.LOG_SUBSCRIBER,"Expires header in a 200-class response to SUBSCRIBE with a higher value than the indicated in the request"),d.subscriber.onFailure(null,b.c.INVALID_EXPIRES_HEADER)):(console.log(b.c.LOG_SUBSCRIBER,"Expires header missing in a 200-class response to SUBSCRIBE"),d.subscriber.onFailure(null,b.c.EXPIRES_HEADER_MISSING)));break;default:d.close(),d.subscriber.onFailure(e,null)}},this.send=function(){a.clearTimeout(d.N),d.N=a.setTimeout(function(){d.timer_N()},b.Timers.T1*64),e.send()},this.onRequestTimeout=function(){d.subscriber.onFailure(null,b.c.REQUEST_TIMEOUT)},this.onTransportError=function(){d.subscriber.onFailure(null,b.c.causes.CONNECTION_ERROR)},this.send()}},unsubscribe:function(){var c=this;this.state="terminated",new function(){this.request=c.subscriber.createSubscribeRequest(c.dialog),this.request.setHeader("Expires",0);var d=new b.RequestSender(this,c.subscriber.ua);this.receiveResponse=function(){},this.send=function(){a.clearTimeout(c.N),c.N=a.setTimeout(function(){c.timer_N()},b.Timers.T1*64),d.send()},this.onRequestTimeout=function(){c.subscriber.onFailure(null,b.c.REQUEST_TIMEOUT)},this.onTransportError=function(){c.subscriber.onFailure(null,b.c.causes.CONNECTION_ERROR)},this.send()}}},b.UA=function(a){var c=["connected","disconnected","registered","unregistered","registrationFailed","newSession","newMessage"];this.configuration={},this.dialogs={},this.registrator=null,this.applicants={},this.sessions={},this.transport=null,this.contact={},this.status=b.c.UA_STATUS_INIT,this.error=null,this.transactions={nist:{},nict:{},ist:{},ict:{}};if(!a||!this.loadConfig(a))throw this.status=b.c.UA_STATUS_NOT_READY,this.error=b.c.UA_CONFIGURATION_ERROR,new b.exceptions.ConfigurationError;this.initEvents(c)},b.UA.prototype=new b.EventEmitter,b.UA.prototype.networkIsReady=function(){console.log("Network Ready notification received"),this.status===b.c.UA_STATUS_NOT_READY&&this.error===b.c.UA_NETWORK_ERROR&&this.transport.connect()},b.UA.prototype.register=function(){if(this.status===b.c.UA_STATUS_READY)this.configuration.register=!0,this.registrator.register();else throw new b.exceptions.NotReadyError},b.UA.prototype.unregister=function(a){if(this.status===b.c.UA_STATUS_READY)this.configuration.register=!1,this.registrator.unregister(a);else throw new b.exceptions.NotReadyError},b.UA.prototype.isRegistered=function(){return this.registrator&&this.registrator.registered?!0:!1},b.UA.prototype.isConnected=function(){return this.transport?this.transport.connected:!1},b.UA.prototype.call=function(a,c,d,e,f){var g,h;h={views:f,mediaType:{audio:c,video:d},eventHandlers:e},g=new b.Session(this),g.connect(a,h)},b.UA.prototype.sendMessage=function(a,c,d,e){var f,g;g={eventHandlers:e},f=new b.Message(this),f.send(a,c,d,g)},b.UA.prototype.stop=function(){var c,d,e=this;if(this.status!==b.c.UA_STATUS_READY)throw new b.exceptions.NotReadyError;console.log(b.c.LOG_UA+"User requested closure."),this.registrator&&(console.log(b.c.LOG_UA+"Closing registrator"),this.registrator.close());for(c in this.sessions)console.log(b.c.LOG_UA+"Closing session"+c),this.sessions[c].terminate();for(d in this.applicants)this.applicants[d].close();this.status=b.c.UA_STATUS_USER_CLOSED,this.shutdownGraceTimer=a.setTimeout(function(){e.transport.disconnect()},"5000")},b.UA.prototype.start=function(){var a;if(this.status===b.c.UA_STATUS_INIT)a=this.getNextWsServer(),new b.Transport(this,a);else if(this.status===b.c.UA_STATUS_USER_CLOSED)console.log(b.c.LOG_UA+"Resuming.."),this.status=b.c.UA_STATUS_READY,this.transport.connect();else if(this.status===b.c.UA_STATUS_READY)console.log(b.c.LOG_UA+"UA is in ready status. Not resuming");else throw new b.exceptions.NotReadyError},b.UA.prototype.onTransportClosed=function(a){var c,d,e=["nict","ict","nist","ist"];a.server.status=b.c.WS_SERVER_DISCONNECTED,console.log(b.c.LOG_UA+"connection status set to: "+b.c.WS_SERVER_DISCONNECTED);for(c in e)for(d in this.transactions[e[c]])this.transactions[e[c]][d].onTransportError();this.contact.pub_gruu||this.closeSessionsOnTransportError()},b.UA.prototype.onTransportError=function(a){var c;console.log(b.c.LOG_UA+"Transport "+a.server.ws_uri+" failed"),a.server.status=b.c.WS_SERVER_ERROR,console.log(b.c.LOG_UA+"connection status set to: "+b.c.WS_SERVER_ERROR),c=this.getNextWsServer(),c?new b.Transport(this,c):(this.closeSessionsOnTransportError(),this.status=b.c.UA_STATUS_NOT_READY,this.error=b.c.UA_NETWORK_ERROR,this.emit("disconnected"))},b.UA.prototype.onTransportConnected=function(a){this.transport=a,a.server.status=b.c.WS_SERVER_READY,console.log(b.c.LOG_UA+"connection status set to: "+b.c.WS_SERVER_READY);if(this.status===b.c.UA_STATUS_USER_CLOSED)return;this.configuration.register&&(this.registrator?this.registrator.onTransportConnected():this.registrator=new b.Registrator(this,a)),this.status=b.c.UA_STATUS_READY,this.error=null,this.emit("connected",this)},b.UA.prototype.receiveRequest=function(a){var c,d,e,f=a.method;if(a.ruri.user!==this.configuration.user){console.log(b.c.LOG_UA+"Request URI does not point to us"),a.reply_sl(404,b.c.REASON_404);return}if(b.Transactions.checkTransaction(this,a))return;f===b.c.INVITE?new b.Transactions.InviteServerTransaction(a,this):f!==b.c.ACK&&new b.Transactions.NonInviteServerTransaction(a,this),f===b.c.OPTIONS&&a.reply(200,b.c.REASON_200,["Allow: "+b.c.ALLOWED_METHODS,"Accept: "+b.c.ACCEPTED_BODY_TYPES]);if(!a.to_tag){if(!this.registrator||this.registrator&&!this.registrator.registered){a.reply(410,b.c.REASON_410);return}switch(f){case b.c.MESSAGE:e=new b.Message(this),e.init_incoming(a);break;case b.c.INVITE:b.utils.isWebRtcSupported()?(d=new b.Session(this),d.init_incoming(a)):console.warn(b.c.LOG_UA+"Call invitation received but rtcweb is not supported");break;case b.c.BYE:a.reply(481,b.c.REASON_481);break;case b.c.CANCEL:d=this.findSession(a),d?d.receiveRequest(a):console.warn(b.c.LOG_UA+"Received CANCEL request for a non existent session");break;case b.c.ACK:break;default:a.reply(405,b.c.REASON_405)}}else c=this.findDialog(a),c?c.receiveRequest(a):f===b.c.NOTIFY?(d=this.findSession(a),d?d.receiveRequest(a):(console.warn(b.c.LOG_UA+"Received a NOTIFY request for a non existent session"),a.reply(481,"Subscription does not exist"))):f!==b.c.ACK&&a.reply(481,b.c.REASON_481)},b.UA.prototype.findSession=function(a){var b=a.call_id+a.from_tag,c=this.sessions[b],d=a.call_id+a.to_tag,e=this.sessions[d];return c?c:e?e:null},b.UA.prototype.findDialog=function(a){var c=a.call_id+a.from_tag+a.to_tag,d=this.dialogs[c];return d?(console.log(b.c.LOG_UA+"dialogs","dialog found"),d):(c=a.call_id+a.to_tag+a.from_tag,d=this.dialogs[c],d?(console.log(b.c.LOG_UA+"dialogs","dialog found"),d):(console.log(b.c.LOG_UA+"dialogs","No dialog found"),null))},b.UA.prototype.getNextWsServer=function(){var a,b,c=[];for(a in this.configuration.outbound_proxy_set){b=this.configuration.outbound_proxy_set[a];if(b.status===2)continue;c.length===0?c.push(b):b.weight>c[0].weight?(c=[],c.push(b)):b.weight===c[0].weight&&c.push(b)}return a=Math.floor(Math.random()*c.length),c[a]},b.UA.prototype.closeSessionsOnTransportError=function(){var a;for(a in this.sessions)this.sessions[a].onTransportError();this.registrator&&this.registrator.onTransportClosed()},b.UA.prototype.loadConfig=function(a){var c,d,e,f,g,h,i,j,k={via_host:Math.random().toString(36).substr(2,12)+".invalid",password:null,register_expires:600,register_min_expires:120,register:!0,max_reconnection:3,reconnection_timeout:4,no_answer_timeout:60,stun_server:"stun.l.google.com:19302",trace_sip:!1,hack_via_tcp:!1,hack_ip_in_contact:!1};if(typeof a.outbound_proxy_set=="string")a.outbound_proxy_set=[{ws_uri:a.outbound_proxy_set}];else if(a.outbound_proxy_set instanceof Array)for(f in a.outbound_proxy_set)typeof a.outbound_proxy_set[f]=="string"&&(a.outbound_proxy_set[f]={ws_uri:a.outbound_proxy_set[f]});for(c in b.UA.configuration_check.mandatory){d=a[c];if(!d)return console.error("Missing config parameter: "+c),!1;if(b.UA.configuration_check.mandatory[c](d))k[c]=d;else return console.error("Bad configuration parameter: "+c),!1}for(c in b.UA.configuration_check.optional){d=a[c];if(d)if(b.UA.configuration_check.optional[c](d))k[c]=d;else return console.error("Bad configuration parameter: "+c),!1}k.instance_id=b.utils.newUUID(),k.jssip_id=Math.random().toString(36).substr(2,5),g=b.grammar.parse(k.uri,"lazy_uri"),k.user=g.user,k.domain=g.host,k.authorization_user||(k.authorization_user=k.user),k.from_uri=(g.scheme?"":"sip:")+k.uri,k.display_name&&(k.from_uri='"'+k.display_name+'" <'+k.from_uri+">"),k.no_answer_timeout=k.no_answer_timeout*1e3,k.hack_ip_in_contact&&(k.via_host=b.utils.getRandomIP());for(f in a.outbound_proxy_set)i=b.grammar.parse(k.outbound_proxy_set[f].ws_uri,"absoluteURI"),k.outbound_proxy_set[f].sip_uri="",k.outbound_proxy_set[f].weight||(k.outbound_proxy_set[f].weight=0),k.outbound_proxy_set[f].status=0,k.outbound_proxy_set[f].scheme=i.scheme.toUpperCase();j={uri:{value:"sip:"+g.user+"@"+k.via_host+";transport=ws",writable:!1,configurable:!1}},Object.defineProperties(this.contact,j);for(e in k)b.UA.configuration_skeleton[e].value=k[e];Object.defineProperties(this.configuration,b.UA.configuration_skeleton);for(e in k)b.UA.configuration_skeleton[e].value="";return!0},b.UA.configuration_skeleton=function(){var a,b,c={},d=["instance_id","jssip_id","max_reconnection","reconnection_timeout","register_min_expires","outbound_proxy_set","uri","authorization_user","display_name","hack_via_tcp","hack_ip_in_contact","password","stun_server","no_answer_timeout","register_expires","trace_sip","via_host","domain","from_uri","via_core_value","user"];for(a in d)b=d[a],c[b]={value:"",writable:!1,configurable:!1};return c.register={value:"",writable:!0,configurable:!1},c}(),b.UA.configuration_check={mandatory:{outbound_proxy_set:function(a){var c,d;if(a.length===0)return!1;for(c in a){if(!a[c].ws_uri)return console.log(b.c.LOG_UA+'Missing "ws_uri" attribute in outbound_proxy_set parameter'),!1;if(a[c].weight&&!Number(a[c].weight))return console.log(b.c.LOG_UA+'"weight" attribute in outbound_proxy_set parameter must be a Number'),!1;d=b.grammar.parse(a[c].ws_uri,"absoluteURI");if(d===-1)return console.log(b.c.LOG_UA+'Invalid "ws_uri" attribute in outbound_proxy_set parameter: '+a[c].ws_uri),!1;if(d.scheme!=="wss"&&d.scheme!=="ws")return console.log(b.c.LOG_UA+"Invalid url scheme: "+d.scheme),!1}return!0},uri:function(a){var c;return c=b.grammar.parse(a,"lazy_uri"),c===-1?(console.log(b.c.LOG_UA+"Invalid uri: "+a),!1):c.host?!0:(console.log(b.c.LOG_UA+"Invalid uri. Missing uri domain."),!1)}},optional:{authorization_user:function(a){return b.grammar.parse('"'+a+'"',"quoted_string")===-1?!1:!0},register:function(a){return typeof a!="boolean"?(console.log(b.c.LOG_UA+"register must be true or false"),!1):!0},display_name:function(a){return b.grammar.parse(a,"display_name")===-1?!1:!0},register_expires:function(a){return Number(a)?!0:!1},trace_sip:function(a){return typeof a!="boolean"?!1:!0},password:function(a){return b.grammar.parse(a,"password")===-1?!1:!0},stun_server:function(a){var c;return c=b.grammar.parse(a,"hostport"),c===-1?(console.log(b.c.LOG_UA+"Invalid stun_server: "+a),!1):!0},no_answer_timeout:function(a){return Number(a)?a<0||a>600?!1:!0:!1},hack_via_tcp:function(a){return typeof a!="boolean"?!1:!0},hack_ip_in_contact:function(a){return typeof a!="boolean"?!1:!0}}},b.utils={str_utf8_length:function(b){return a.unescape(encodeURIComponent(b)).length},isFunction:function(a){return a!==undefined?Object.prototype.toString.call(a)==="[object Function]"?!0:!1:!1},newTag:function(){return Math.random().toString(36).substr(2,b.c.TAG_LENGTH)},newUUID:function(){var a="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a==="x"?b:b&3|8;return c.toString(16)});return a},checkUri:function(a){return a?b.grammar.parse(a,"lazy_uri")===-1?!1:!0:!1},normalizeUri:function(a,c){var d,e,f;if(!b.utils.checkUri(a)){console.log("Invalid target: "+a);return}d=b.grammar.parse(a,"lazy_uri");if(!d.host&&!c){console.log("No domain specified in target nor as function parameter");return}f=d.scheme?d.scheme+":":"sip:",f+=d.user,f+="@"+(d.host?d.host:c),f+=d.port?":"+d.port:"";for(e in d.params)f+=";"+e,f+=d.params[e]===!0?"":"="+d.params[e];return f},headerize:function(a){var b={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},c=a.toLowerCase().replace(/_/g,"-").split("-"),d="",e;for(e in c)e!=="0"&&(d+="-"),d+=c[e].charAt(0).toUpperCase()+c[e].substring(1);return b[d]&&(d=b[d]),d},isWebRtcSupported:function(){var b=!1;try{navigator.webkitGetUserMedia&&a.webkitRTCPeerConnection&&(b=!0)}catch(c){}return function(){return b}}(),sipErrorCause:function(a){var c;for(c in b.c.SIP_ERROR_CAUSES)if(b.c.SIP_ERROR_CAUSES[c].indexOf(parseInt(a,10))!==-1)return c;return},getRandomIP:function(){function a(){return(Math.random()*255|0)+1}return a()+"."+a()+"."+a()+"."+a()},checkUAStatus:function(a){if(a.status!==b.c.UA_STATUS_READY)throw new b.exceptions.NotReadyError},MD5:function(a){function b(a,b){return a<>>32-b}function c(a,b){var c,d,e,f,g;return e=a&2147483648,f=b&2147483648,c=a&1073741824,d=b&1073741824,g=(a&1073741823)+(b&1073741823),c&d?g^2147483648^e^f:c|d?g&1073741824?g^3221225472^e^f:g^1073741824^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){var b,c=a.length,d=c+8,e=(d-d%64)/64,f=(e+1)*16,g=Array(f-1),h=0,i=0;while(i>>29,g}function m(a){var b="",c="",d,e;for(e=0;e<=3;e++)d=a>>>e*8&255,c="0"+d.toString(16),b=b+c.substr(c.length-2,2);return b}function n(a){a=a.replace(/\r\n/g,"\n");var b="";for(var c=0;c127&&d<2048?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(d&63|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(d&63|128))}return b}var o=[],p,q,r,s,t,u,v,w,x,y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;a=n(a),o=l(a),u=1732584193,v=4023233417,w=2562383102,x=271733878;for(p=0;p1)return!1}function m(){var a=f.configuration.via_host;if(e.via.host!==a)return!1}function n(){var a=b.utils.str_utf8_length(e.body),c=e.getHeader("content-length");if(aN&&(N=b,ta=[]),ta.push(a))}function ab(){var a;"\r\n"===f.substr(b,2)?(a="\r\n",b+=2):(a=null,0===g&&h('"\\r\\n"'));return a}function p(){var a;/^[0-9]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a= +null,0===g&&h("[0-9]"));return a}function ba(){var a;/^[a-zA-Z]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[a-zA-Z]"));return a}function G(){var a;/^[0-9a-fA-F]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[0-9a-fA-F]"));return a}function O(){var a;a=z();null===a&&(a=H());return a}function ua(){var a;/^[\0-\xFF]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[\\0-\\xFF]"));return a}function D(){var a;/^["]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h('["]')); +return a}function z(){var a;32===f.charCodeAt(b)?(a=" ",b++):(a=null,0===g&&h('" "'));return a}function H(){var a;9===f.charCodeAt(b)?(a="\t",b++):(a=null,0===g&&h('"\\t"'));return a}function E(){var a;/^[a-zA-Z0-9]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[a-zA-Z0-9]"));return a}function ca(){var a;59===f.charCodeAt(b)?(a=";",b++):(a=null,0===g&&h('";"'));if(null===a&&(47===f.charCodeAt(b)?(a="/",b++):(a=null,0===g&&h('"/"')),null===a))if(63===f.charCodeAt(b)?(a="?",b++):(a=null, +0===g&&h('"?"')),null===a)if(58===f.charCodeAt(b)?(a=":",b++):(a=null,0===g&&h('":"')),null===a)if(64===f.charCodeAt(b)?(a="@",b++):(a=null,0===g&&h('"@"')),null===a)if(38===f.charCodeAt(b)?(a="&",b++):(a=null,0===g&&h('"&"')),null===a)if(61===f.charCodeAt(b)?(a="=",b++):(a=null,0===g&&h('"="')),null===a)if(43===f.charCodeAt(b)?(a="+",b++):(a=null,0===g&&h('"+"')),null===a)if(36===f.charCodeAt(b)?(a="$",b++):(a=null,0===g&&h('"$"')),null===a)44===f.charCodeAt(b)?(a=",",b++):(a=null,0===g&&h('","')); +return a}function w(){var a;a=E();null===a&&(a=J());return a}function J(){var a;45===f.charCodeAt(b)?(a="-",b++):(a=null,0===g&&h('"-"'));if(null===a&&(95===f.charCodeAt(b)?(a="_",b++):(a=null,0===g&&h('"_"')),null===a))if(46===f.charCodeAt(b)?(a=".",b++):(a=null,0===g&&h('"."')),null===a)if(33===f.charCodeAt(b)?(a="!",b++):(a=null,0===g&&h('"!"')),null===a)if(126===f.charCodeAt(b)?(a="~",b++):(a=null,0===g&&h('"~"')),null===a)if(42===f.charCodeAt(b)?(a="*",b++):(a=null,0===g&&h('"*"')),null===a)if(39=== +f.charCodeAt(b)?(a="'",b++):(a=null,0===g&&h('"\'"')),null===a)if(40===f.charCodeAt(b)?(a="(",b++):(a=null,0===g&&h('"("')),null===a)41===f.charCodeAt(b)?(a=")",b++):(a=null,0===g&&h('")"'));return a}function x(){var a,c,d,e;e=b;37===f.charCodeAt(b)?(a="%",b++):(a=null,0===g&&h('"%"'));null!==a?(c=G(),null!==c?(d=G(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function y(){var a,c,d,e,f;d=f=e=b;a=[];for(c=O();null!==c;)a.push(c),c=O();null!==a?(c=ab(),null!==c?a=[a,c]:(a= +null,b=d)):(a=null,b=d);a=null!==a?a:"";if(null!==a){d=O();if(null!==d)for(c=[];null!==d;)c.push(d),d=O();else c=null;null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;null!==a&&(a=" ");null===a&&(b=e);return a}function s(){var a;a=y();return null!==a?a:""}function bb(){var a,c,d,e,i;i=e=b;a=[];c=z();for(null===c&&(c=H());null!==c;)a.push(c),c=z(),null===c&&(c=H());null!==a?(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null, +b=i);null!==a&&(a=":");null===a&&(b=e);return a}function cb(){var a,c,d,e,i,h,g;h=i=b;c=I();if(null!==c)for(a=[];null!==c;)a.push(c),c=I();else a=null;if(null!==a){c=[];g=b;d=[];for(e=y();null!==e;)d.push(e),e=y();null!==d?(e=I(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;){c.push(d);g=b;d=[];for(e=y();null!==e;)d.push(e),e=y();null!==d?(e=I(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g)}null!==c?a=[a,c]:(a=null,b=h)}else a=null,b=h;null!==a&&(a=f.substring(b,i));null===a&&(b=i);return a} +function I(){var a;/^[!-~]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[!-~]"));null===a&&(a=K());return a}function K(){var a;/^[\x80-\xFF]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[\\x80-\\xFF]"));return a}function P(){var a;/^[\x80-\xBF]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[\\x80-\\xBF]"));return a}function r(){var a,c,d;d=b;c=E();if(null===c&&(45===f.charCodeAt(b)?(c="-",b++):(c=null,0===g&&h('"-"')),null===c))if(46===f.charCodeAt(b)?(c=".",b++): +(c=null,0===g&&h('"."')),null===c)if(33===f.charCodeAt(b)?(c="!",b++):(c=null,0===g&&h('"!"')),null===c)if(37===f.charCodeAt(b)?(c="%",b++):(c=null,0===g&&h('"%"')),null===c)if(42===f.charCodeAt(b)?(c="*",b++):(c=null,0===g&&h('"*"')),null===c)if(95===f.charCodeAt(b)?(c="_",b++):(c=null,0===g&&h('"_"')),null===c)if(43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"')),null===c)if(96===f.charCodeAt(b)?(c="`",b++):(c=null,0===g&&h('"`"')),null===c)if(39===f.charCodeAt(b)?(c="'",b++):(c=null,0=== +g&&h('"\'"')),null===c)126===f.charCodeAt(b)?(c="~",b++):(c=null,0===g&&h('"~"'));if(null!==c)for(a=[];null!==c;){if(a.push(c),c=E(),null===c&&(45===f.charCodeAt(b)?(c="-",b++):(c=null,0===g&&h('"-"')),null===c))if(46===f.charCodeAt(b)?(c=".",b++):(c=null,0===g&&h('"."')),null===c)if(33===f.charCodeAt(b)?(c="!",b++):(c=null,0===g&&h('"!"')),null===c)if(37===f.charCodeAt(b)?(c="%",b++):(c=null,0===g&&h('"%"')),null===c)if(42===f.charCodeAt(b)?(c="*",b++):(c=null,0===g&&h('"*"')),null===c)if(95===f.charCodeAt(b)? +(c="_",b++):(c=null,0===g&&h('"_"')),null===c)if(43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"')),null===c)if(96===f.charCodeAt(b)?(c="`",b++):(c=null,0===g&&h('"`"')),null===c)if(39===f.charCodeAt(b)?(c="'",b++):(c=null,0===g&&h('"\'"')),null===c)126===f.charCodeAt(b)?(c="~",b++):(c=null,0===g&&h('"~"'))}else a=null;null!==a&&(a=f.substring(b,d));null===a&&(b=d);return a}function da(){var a,c,d;d=b;c=E();if(null===c&&(45===f.charCodeAt(b)?(c="-",b++):(c=null,0===g&&h('"-"')),null===c))if(33=== +f.charCodeAt(b)?(c="!",b++):(c=null,0===g&&h('"!"')),null===c)if(37===f.charCodeAt(b)?(c="%",b++):(c=null,0===g&&h('"%"')),null===c)if(42===f.charCodeAt(b)?(c="*",b++):(c=null,0===g&&h('"*"')),null===c)if(95===f.charCodeAt(b)?(c="_",b++):(c=null,0===g&&h('"_"')),null===c)if(43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"')),null===c)if(96===f.charCodeAt(b)?(c="`",b++):(c=null,0===g&&h('"`"')),null===c)if(39===f.charCodeAt(b)?(c="'",b++):(c=null,0===g&&h('"\'"')),null===c)126===f.charCodeAt(b)? +(c="~",b++):(c=null,0===g&&h('"~"'));if(null!==c)for(a=[];null!==c;){if(a.push(c),c=E(),null===c&&(45===f.charCodeAt(b)?(c="-",b++):(c=null,0===g&&h('"-"')),null===c))if(33===f.charCodeAt(b)?(c="!",b++):(c=null,0===g&&h('"!"')),null===c)if(37===f.charCodeAt(b)?(c="%",b++):(c=null,0===g&&h('"%"')),null===c)if(42===f.charCodeAt(b)?(c="*",b++):(c=null,0===g&&h('"*"')),null===c)if(95===f.charCodeAt(b)?(c="_",b++):(c=null,0===g&&h('"_"')),null===c)if(43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"')), +null===c)if(96===f.charCodeAt(b)?(c="`",b++):(c=null,0===g&&h('"`"')),null===c)if(39===f.charCodeAt(b)?(c="'",b++):(c=null,0===g&&h('"\'"')),null===c)126===f.charCodeAt(b)?(c="~",b++):(c=null,0===g&&h('"~"'))}else a=null;null!==a&&(a=f.substring(b,d));null===a&&(b=d);return a}function va(){var a,c,d;d=b;c=E();if(null===c&&(45===f.charCodeAt(b)?(c="-",b++):(c=null,0===g&&h('"-"')),null===c))if(46===f.charCodeAt(b)?(c=".",b++):(c=null,0===g&&h('"."')),null===c)if(33===f.charCodeAt(b)?(c="!",b++):(c= +null,0===g&&h('"!"')),null===c)if(37===f.charCodeAt(b)?(c="%",b++):(c=null,0===g&&h('"%"')),null===c)if(42===f.charCodeAt(b)?(c="*",b++):(c=null,0===g&&h('"*"')),null===c)if(95===f.charCodeAt(b)?(c="_",b++):(c=null,0===g&&h('"_"')),null===c)if(43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"')),null===c)if(96===f.charCodeAt(b)?(c="`",b++):(c=null,0===g&&h('"`"')),null===c)if(39===f.charCodeAt(b)?(c="'",b++):(c=null,0===g&&h('"\'"')),null===c)if(126===f.charCodeAt(b)?(c="~",b++):(c=null,0=== +g&&h('"~"')),null===c)if(40===f.charCodeAt(b)?(c="(",b++):(c=null,0===g&&h('"("')),null===c)if(41===f.charCodeAt(b)?(c=")",b++):(c=null,0===g&&h('")"')),null===c)if(60===f.charCodeAt(b)?(c="<",b++):(c=null,0===g&&h('"<"')),null===c)if(62===f.charCodeAt(b)?(c=">",b++):(c=null,0===g&&h('">"')),null===c)if(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null===c)if(92===f.charCodeAt(b)?(c="\\",b++):(c=null,0===g&&h('"\\\\"')),null===c)if(c=D(),null===c&&(47===f.charCodeAt(b)?(c="/",b++):(c= +null,0===g&&h('"/"')),null===c))if(91===f.charCodeAt(b)?(c="[",b++):(c=null,0===g&&h('"["')),null===c)if(93===f.charCodeAt(b)?(c="]",b++):(c=null,0===g&&h('"]"')),null===c)if(63===f.charCodeAt(b)?(c="?",b++):(c=null,0===g&&h('"?"')),null===c)if(123===f.charCodeAt(b)?(c="{",b++):(c=null,0===g&&h('"{"')),null===c)125===f.charCodeAt(b)?(c="}",b++):(c=null,0===g&&h('"}"'));if(null!==c)for(a=[];null!==c;){if(a.push(c),c=E(),null===c&&(45===f.charCodeAt(b)?(c="-",b++):(c=null,0===g&&h('"-"')),null===c))if(46=== +f.charCodeAt(b)?(c=".",b++):(c=null,0===g&&h('"."')),null===c)if(33===f.charCodeAt(b)?(c="!",b++):(c=null,0===g&&h('"!"')),null===c)if(37===f.charCodeAt(b)?(c="%",b++):(c=null,0===g&&h('"%"')),null===c)if(42===f.charCodeAt(b)?(c="*",b++):(c=null,0===g&&h('"*"')),null===c)if(95===f.charCodeAt(b)?(c="_",b++):(c=null,0===g&&h('"_"')),null===c)if(43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"')),null===c)if(96===f.charCodeAt(b)?(c="`",b++):(c=null,0===g&&h('"`"')),null===c)if(39===f.charCodeAt(b)? +(c="'",b++):(c=null,0===g&&h('"\'"')),null===c)if(126===f.charCodeAt(b)?(c="~",b++):(c=null,0===g&&h('"~"')),null===c)if(40===f.charCodeAt(b)?(c="(",b++):(c=null,0===g&&h('"("')),null===c)if(41===f.charCodeAt(b)?(c=")",b++):(c=null,0===g&&h('")"')),null===c)if(60===f.charCodeAt(b)?(c="<",b++):(c=null,0===g&&h('"<"')),null===c)if(62===f.charCodeAt(b)?(c=">",b++):(c=null,0===g&&h('">"')),null===c)if(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null===c)if(92===f.charCodeAt(b)?(c="\\",b++): +(c=null,0===g&&h('"\\\\"')),null===c)if(c=D(),null===c&&(47===f.charCodeAt(b)?(c="/",b++):(c=null,0===g&&h('"/"')),null===c))if(91===f.charCodeAt(b)?(c="[",b++):(c=null,0===g&&h('"["')),null===c)if(93===f.charCodeAt(b)?(c="]",b++):(c=null,0===g&&h('"]"')),null===c)if(63===f.charCodeAt(b)?(c="?",b++):(c=null,0===g&&h('"?"')),null===c)if(123===f.charCodeAt(b)?(c="{",b++):(c=null,0===g&&h('"{"')),null===c)125===f.charCodeAt(b)?(c="}",b++):(c=null,0===g&&h('"}"'))}else a=null;null!==a&&(a=f.substring(b, +d));null===a&&(b=d);return a}function db(){var a,c,d,e,i;i=e=b;a=s();null!==a?(42===f.charCodeAt(b)?(c="*",b++):(c=null,0===g&&h('"*"')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null,b=i);null!==a&&(a="*");null===a&&(b=e);return a}function ea(){var a,c,d,e,i;i=e=b;a=s();null!==a?(47===f.charCodeAt(b)?(c="/",b++):(c=null,0===g&&h('"/"')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null,b=i);null!==a&&(a="/");null===a&&(b=e);return a}function t(){var a, +c,d,e,i;i=e=b;a=s();null!==a?(61===f.charCodeAt(b)?(c="=",b++):(c=null,0===g&&h('"="')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null,b=i);null!==a&&(a="=");null===a&&(b=e);return a}function eb(){var a,c,d,e,i;i=e=b;a=s();null!==a?(40===f.charCodeAt(b)?(c="(",b++):(c=null,0===g&&h('"("')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null,b=i);null!==a&&(a="(");null===a&&(b=e);return a}function fb(){var a,c,d,e,i;i=e=b;a=s();null!==a?(41===f.charCodeAt(b)? +(c=")",b++):(c=null,0===g&&h('")"')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null,b=i);null!==a&&(a=")");null===a&&(b=e);return a}function gb(){var a,c,d,e;e=d=b;62===f.charCodeAt(b)?(a=">",b++):(a=null,0===g&&h('">"'));null!==a?(c=s(),null!==c?a=[a,c]:(a=null,b=e)):(a=null,b=e);null!==a&&(a=">");null===a&&(b=d);return a}function hb(){var a,c,d,e;e=d=b;a=s();null!==a?(60===f.charCodeAt(b)?(c="<",b++):(c=null,0===g&&h('"<"')),null!==c)?a=[a,c]:(a=null,b=e):(a=null,b=e);null!== +a&&(a="<");null===a&&(b=d);return a}function u(){var a,c,d,e,i;i=e=b;a=s();null!==a?(44===f.charCodeAt(b)?(c=",",b++):(c=null,0===g&&h('","')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null,b=i);null!==a&&(a=",");null===a&&(b=e);return a}function v(){var a,c,d,e,i;i=e=b;a=s();null!==a?(59===f.charCodeAt(b)?(c=";",b++):(c=null,0===g&&h('";"')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null,b=i);null!==a&&(a=";");null===a&&(b=e);return a}function ib(){var a, +c,d,e,i;i=e=b;a=s();null!==a?(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c)?(d=s(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i):(a=null,b=i);null!==a&&(a=":");null===a&&(b=e);return a}function wa(){var a,c,d,e;e=d=b;a=s();null!==a?(c=D(),null!==c?a=[a,c]:(a=null,b=e)):(a=null,b=e);null!==a&&(a='"');null===a&&(b=d);return a}function xa(){var a,c,d,e;e=d=b;a=D();null!==a?(c=s(),null!==c?a=[a,c]:(a=null,b=e)):(a=null,b=e);null!==a&&(a='"');null===a&&(b=d);return a}function ya(){var a, +c,d,e;e=b;a=eb();if(null!==a){c=[];d=za();null===d&&(d=Q(),null===d&&(d=ya()));for(;null!==d;)c.push(d),d=za(),null===d&&(d=Q(),null===d&&(d=ya()));null!==c?(d=fb(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)}else a=null,b=e;return a}function za(){var a;/^[!-']/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[!-']"));if(null===a&&(/^[*-[]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[*-[]")),null===a))if(/^[\]-~]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[\\]-~]")), +null===a)a=K(),null===a&&(a=y());return a}function F(){var a,c,d,e,i,g;g=i=b;a=s();if(null!==a)if(c=D(),null!==c){d=[];e=Aa();for(null===e&&(e=Q());null!==e;)d.push(e),e=Aa(),null===e&&(e=Q());null!==d?(e=D(),null!==e?a=[a,c,d,e]:(a=null,b=g)):(a=null,b=g)}else a=null,b=g;else a=null,b=g;null!==a&&(a=f.substring(b,i));null===a&&(b=i);return a}function Aa(){var a;a=y();if(null===a&&(33===f.charCodeAt(b)?(a="!",b++):(a=null,0===g&&h('"!"')),null===a))if(/^[#-[]/.test(f.charAt(b))?(a=f.charAt(b),b++): +(a=null,0===g&&h("[#-[]")),null===a)/^[\]-~]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[\\]-~]")),null===a&&(a=K());return a}function Q(){var a,c,d;d=b;92===f.charCodeAt(b)?(a="\\",b++):(a=null,0===g&&h('"\\\\"'));if(null!==a){/^[\0-\t]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null,0===g&&h("[\\0-\\t]"));if(null===c&&(/^[\x0B-\f]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null,0===g&&h("[\\x0B-\\f]")),null===c))/^[\x0E-\u007f]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null,0===g&&h("[\\x0E-\u007f]")); +null!==c?a=[a,c]:(a=null,b=d)}else a=null,b=d;return a}function jb(){var a,c,d,e,i,j;j=i=b;a=fa();null!==a?(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c)?(d=ga(),d=null!==d?d:"",null!==d?(e=R(),null!==e?a=[a,c,d,e]:(a=null,b=j)):(a=null,b=j)):(a=null,b=j):(a=null,b=j);null!==a&&(o.uri=f.substring(b,i),a=void 0);null===a&&(b=i);return a}function Ba(){var a,c,d,e,i,j,l,n;n=l=b;a=fa();null!==a?(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c)?(d=ga(),d=null!== +d?d:"",null!==d?(e=R(),null!==e?(i=Ca(),null!==i?(j=kb(),j=null!==j?j:"",null!==j?a=[a,c,d,e,i,j]:(a=null,b=n)):(a=null,b=n)):(a=null,b=n)):(a=null,b=n)):(a=null,b=n):(a=null,b=n);null!==a&&(o.uri=f.substring(b,l),a=void 0);null===a&&(b=l);return a}function fa(){var a,c;c=b;"sip"===f.substr(b,3)?(a="sip",b+=3):(a=null,0===g&&h('"sip"'));null!==a&&(o.scheme=a,a=void 0);null===a&&(b=c);return a}function ga(){var a,c,d;d=b;a=Da();null!==a?(64===f.charCodeAt(b)?(c="@",b++):(c=null,0===g&&h('"@"')),null!== +c)?a=[a,c]:(a=null,b=d):(a=null,b=d);return a}function Da(){var a,c,d;d=b;c=w();null===c&&(c=x(),null===c&&(c=Ea()));if(null!==c)for(a=[];null!==c;)a.push(c),c=w(),null===c&&(c=x(),null===c&&(c=Ea()));else a=null;null!==a&&(o.user=f.substring(b,d),a=void 0);null===a&&(b=d);return a}function Ea(){var a;38===f.charCodeAt(b)?(a="&",b++):(a=null,0===g&&h('"&"'));if(null===a&&(61===f.charCodeAt(b)?(a="=",b++):(a=null,0===g&&h('"="')),null===a))if(43===f.charCodeAt(b)?(a="+",b++):(a=null,0===g&&h('"+"')), +null===a)if(36===f.charCodeAt(b)?(a="$",b++):(a=null,0===g&&h('"$"')),null===a)if(44===f.charCodeAt(b)?(a=",",b++):(a=null,0===g&&h('","')),null===a)if(59===f.charCodeAt(b)?(a=";",b++):(a=null,0===g&&h('";"')),null===a)if(63===f.charCodeAt(b)?(a="?",b++):(a=null,0===g&&h('"?"')),null===a)47===f.charCodeAt(b)?(a="/",b++):(a=null,0===g&&h('"/"'));return a}function R(){var a,c,d,e,i;e=b;a=S();null!==a?(i=b,58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c?(d=lb(),null!==d?c=[c,d]:(c= +null,b=i)):(c=null,b=i),c=null!==c?c:"",null!==c)?a=[a,c]:(a=null,b=e):(a=null,b=e);return a}function S(){var a,c;c=b;a=Fa();null===a&&(a=T(),null===a&&(a=Ga()));null!==a&&(o.host=f.substring(b,c),a=void 0);null===a&&(b=c);return a}function Fa(){var a,c,d,e,i,j;i=e=b;a=[];j=b;c=Ha();null!==c?(46===f.charCodeAt(b)?(d=".",b++):(d=null,0===g&&h('"."')),null!==d)?c=[c,d]:(c=null,b=j):(c=null,b=j);for(;null!==c;)(a.push(c),j=b,c=Ha(),null!==c)?(46===f.charCodeAt(b)?(d=".",b++):(d=null,0===g&&h('"."')), +null!==d)?c=[c,d]:(c=null,b=j):(c=null,b=j);null!==a?(c=mb(),null!==c)?(46===f.charCodeAt(b)?(d=".",b++):(d=null,0===g&&h('"."')),d=null!==d?d:"",null!==d)?a=[a,c,d]:(a=null,b=i):(a=null,b=i):(a=null,b=i);null!==a&&(o.host_type="domain",a=f.substring(b,e));null===a&&(b=e);return a}function Ha(){var a,c;/^[a-zA-Z0-9_\-]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null,0===g&&h("[a-zA-Z0-9_\\-]"));if(null!==c)for(a=[];null!==c;)a.push(c),/^[a-zA-Z0-9_\-]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null, +0===g&&h("[a-zA-Z0-9_\\-]"));else a=null;return a}function mb(){var a,c;/^[a-zA-Z_\-]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null,0===g&&h("[a-zA-Z_\\-]"));if(null!==c)for(a=[];null!==c;)a.push(c),/^[a-zA-Z_\-]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null,0===g&&h("[a-zA-Z_\\-]"));else a=null;return a}function Ga(){var a,c,d,e,i;i=e=b;91===f.charCodeAt(b)?(a="[",b++):(a=null,0===g&&h('"["'));null!==a?(c=Ia(),null!==c)?(93===f.charCodeAt(b)?(d="]",b++):(d=null,0===g&&h('"]"')),null!==d)?a=[a, +c,d]:(a=null,b=i):(a=null,b=i):(a=null,b=i);null!==a&&(o.host_type="IPv6",a=f.substring(b,e));null===a&&(b=e);return a}function Ia(){var a,c,d,e,i,j,l,n,m,p,r,s,t,u,k;k=u=b;a=q();null!==a?(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c)?(d=q(),null!==d)?(58===f.charCodeAt(b)?(e=":",b++):(e=null,0===g&&h('":"')),null!==e)?(i=q(),null!==i)?(58===f.charCodeAt(b)?(j=":",b++):(j=null,0===g&&h('":"')),null!==j)?(l=q(),null!==l)?(58===f.charCodeAt(b)?(n=":",b++):(n=null,0===g&&h('":"')), +null!==n)?(m=q(),null!==m)?(58===f.charCodeAt(b)?(p=":",b++):(p=null,0===g&&h('":"')),null!==p)?(r=q(),null!==r)?(58===f.charCodeAt(b)?(s=":",b++):(s=null,0===g&&h('":"')),null!==s)?(t=A(),null!==t?a=[a,c,d,e,i,j,l,n,m,p,r,s,t]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k);if(null===a&&(k=b,"::"===f.substr(b,2)?(a="::",b+=2):(a=null,0===g&&h('"::"')),null!==a?(c=q(),null!==c)? +(58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d)?(e=q(),null!==e)?(58===f.charCodeAt(b)?(i=":",b++):(i=null,0===g&&h('":"')),null!==i)?(j=q(),null!==j)?(58===f.charCodeAt(b)?(l=":",b++):(l=null,0===g&&h('":"')),null!==l)?(n=q(),null!==n)?(58===f.charCodeAt(b)?(m=":",b++):(m=null,0===g&&h('":"')),null!==m)?(p=q(),null!==p)?(58===f.charCodeAt(b)?(r=":",b++):(r=null,0===g&&h('":"')),null!==r)?(s=A(),null!==s?a=[a,c,d,e,i,j,l,n,m,p,r,s]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null, +b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a))if(k=b,"::"===f.substr(b,2)?(a="::",b+=2):(a=null,0===g&&h('"::"')),null!==a?(c=q(),null!==c)?(58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d)?(e=q(),null!==e)?(58===f.charCodeAt(b)?(i=":",b++):(i=null,0===g&&h('":"')),null!==i)?(j=q(),null!==j)?(58===f.charCodeAt(b)?(l=":",b++):(l=null,0===g&&h('":"')),null!==l)?(n=q(),null!==n)?(58===f.charCodeAt(b)?(m=":",b++): +(m=null,0===g&&h('":"')),null!==m)?(p=A(),null!==p?a=[a,c,d,e,i,j,l,n,m,p]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,"::"===f.substr(b,2)?(a="::",b+=2):(a=null,0===g&&h('"::"')),null!==a?(c=q(),null!==c)?(58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d)?(e=q(),null!==e)?(58===f.charCodeAt(b)?(i=":",b++):(i=null,0===g&&h('":"')),null!==i)?(j=q(),null!==j)?(58===f.charCodeAt(b)? +(l=":",b++):(l=null,0===g&&h('":"')),null!==l)?(n=A(),null!==n?a=[a,c,d,e,i,j,l,n]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,"::"===f.substr(b,2)?(a="::",b+=2):(a=null,0===g&&h('"::"')),null!==a?(c=q(),null!==c)?(58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d)?(e=q(),null!==e)?(58===f.charCodeAt(b)?(i=":",b++):(i=null,0===g&&h('":"')),null!==i)?(j=A(),null!==j?a=[a,c,d,e,i,j]:(a=null,b=k)):(a=null,b= +k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,"::"===f.substr(b,2)?(a="::",b+=2):(a=null,0===g&&h('"::"')),null!==a?(c=q(),null!==c)?(58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d)?(e=A(),null!==e?a=[a,c,d,e]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,"::"===f.substr(b,2)?(a="::",b+=2):(a=null,0===g&&h('"::"')),null!==a?(c=A(),null!==c?a=[a,c]:(a=null,b=k)):(a=null,b=k),null===a)if(k=b,"::"===f.substr(b,2)?(a="::",b+=2):(a=null, +0===g&&h('"::"')),null!==a?(c=q(),null!==c?a=[a,c]:(a=null,b=k)):(a=null,b=k),null===a)if(k=b,a=q(),null!==a?("::"===f.substr(b,2)?(c="::",b+=2):(c=null,0===g&&h('"::"')),null!==c)?(d=q(),null!==d)?(58===f.charCodeAt(b)?(e=":",b++):(e=null,0===g&&h('":"')),null!==e)?(i=q(),null!==i)?(58===f.charCodeAt(b)?(j=":",b++):(j=null,0===g&&h('":"')),null!==j)?(l=q(),null!==l)?(58===f.charCodeAt(b)?(n=":",b++):(n=null,0===g&&h('":"')),null!==n)?(m=q(),null!==m)?(58===f.charCodeAt(b)?(p=":",b++):(p=null,0=== +g&&h('":"')),null!==p)?(r=A(),null!==r?a=[a,c,d,e,i,j,l,n,m,p,r]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,a=q(),null!==a?(m=b,58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c?(d=q(),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c)?("::"===f.substr(b,2)?(d="::",b+=2):(d=null,0===g&&h('"::"')),null!==d)?(e=q(),null!==e)?(58===f.charCodeAt(b)?(i= +":",b++):(i=null,0===g&&h('":"')),null!==i)?(j=q(),null!==j)?(58===f.charCodeAt(b)?(l=":",b++):(l=null,0===g&&h('":"')),null!==l)?(n=q(),null!==n)?(58===f.charCodeAt(b)?(m=":",b++):(m=null,0===g&&h('":"')),null!==m)?(p=A(),null!==p?a=[a,c,d,e,i,j,l,n,m,p]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,a=q(),null!==a?(m=b,58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c?(d=q(),null!== +d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c)?(m=b,58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d?(e=q(),null!==e?d=[d,e]:(d=null,b=m)):(d=null,b=m),d=null!==d?d:"",null!==d)?("::"===f.substr(b,2)?(e="::",b+=2):(e=null,0===g&&h('"::"')),null!==e)?(i=q(),null!==i)?(58===f.charCodeAt(b)?(j=":",b++):(j=null,0===g&&h('":"')),null!==j)?(l=q(),null!==l)?(58===f.charCodeAt(b)?(n=":",b++):(n=null,0===g&&h('":"')),null!==n)?(m=A(),null!==m?a=[a,c,d,e,i,j,l,n,m]:(a=null, +b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,a=q(),null!==a?(m=b,58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c?(d=q(),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c)?(m=b,58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d?(e=q(),null!==e?d=[d,e]:(d=null,b=m)):(d=null,b=m),d=null!==d?d:"",null!==d)?(m=b,58===f.charCodeAt(b)?(e=":",b++):(e=null,0===g&&h('":"')), +null!==e?(i=q(),null!==i?e=[e,i]:(e=null,b=m)):(e=null,b=m),e=null!==e?e:"",null!==e)?("::"===f.substr(b,2)?(i="::",b+=2):(i=null,0===g&&h('"::"')),null!==i)?(j=q(),null!==j)?(58===f.charCodeAt(b)?(l=":",b++):(l=null,0===g&&h('":"')),null!==l)?(n=A(),null!==n?a=[a,c,d,e,i,j,l,n]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,a=q(),null!==a?(m=b,58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c?(d=q(),null!== +d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c)?(m=b,58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d?(e=q(),null!==e?d=[d,e]:(d=null,b=m)):(d=null,b=m),d=null!==d?d:"",null!==d)?(m=b,58===f.charCodeAt(b)?(e=":",b++):(e=null,0===g&&h('":"')),null!==e?(i=q(),null!==i?e=[e,i]:(e=null,b=m)):(e=null,b=m),e=null!==e?e:"",null!==e)?(m=b,58===f.charCodeAt(b)?(i=":",b++):(i=null,0===g&&h('":"')),null!==i?(j=q(),null!==j?i=[i,j]:(i=null,b=m)):(i=null,b=m),i=null!==i?i:"",null!== +i)?("::"===f.substr(b,2)?(j="::",b+=2):(j=null,0===g&&h('"::"')),null!==j)?(l=A(),null!==l?a=[a,c,d,e,i,j,l]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)if(k=b,a=q(),null!==a?(m=b,58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c?(d=q(),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c)?(m=b,58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d?(e=q(),null!==e?d=[d,e]:(d=null,b=m)):(d=null,b= +m),d=null!==d?d:"",null!==d)?(m=b,58===f.charCodeAt(b)?(e=":",b++):(e=null,0===g&&h('":"')),null!==e?(i=q(),null!==i?e=[e,i]:(e=null,b=m)):(e=null,b=m),e=null!==e?e:"",null!==e)?(m=b,58===f.charCodeAt(b)?(i=":",b++):(i=null,0===g&&h('":"')),null!==i?(j=q(),null!==j?i=[i,j]:(i=null,b=m)):(i=null,b=m),i=null!==i?i:"",null!==i)?(m=b,58===f.charCodeAt(b)?(j=":",b++):(j=null,0===g&&h('":"')),null!==j?(l=q(),null!==l?j=[j,l]:(j=null,b=m)):(j=null,b=m),j=null!==j?j:"",null!==j)?("::"===f.substr(b,2)?(l= +"::",b+=2):(l=null,0===g&&h('"::"')),null!==l)?(n=q(),null!==n?a=[a,c,d,e,i,j,l,n]:(a=null,b=k)):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k),null===a)(k=b,a=q(),null!==a)?(m=b,58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c?(d=q(),null!==d?c=[c,d]:(c=null,b=m)):(c=null,b=m),c=null!==c?c:"",null!==c)?(m=b,58===f.charCodeAt(b)?(d=":",b++):(d=null,0===g&&h('":"')),null!==d?(e=q(),null!==e?d=[d,e]:(d=null,b=m)):(d=null,b=m),d=null!==d? +d:"",null!==d)?(m=b,58===f.charCodeAt(b)?(e=":",b++):(e=null,0===g&&h('":"')),null!==e?(i=q(),null!==i?e=[e,i]:(e=null,b=m)):(e=null,b=m),e=null!==e?e:"",null!==e)?(m=b,58===f.charCodeAt(b)?(i=":",b++):(i=null,0===g&&h('":"')),null!==i?(j=q(),null!==j?i=[i,j]:(i=null,b=m)):(i=null,b=m),i=null!==i?i:"",null!==i)?(m=b,58===f.charCodeAt(b)?(j=":",b++):(j=null,0===g&&h('":"')),null!==j?(l=q(),null!==l?j=[j,l]:(j=null,b=m)):(j=null,b=m),j=null!==j?j:"",null!==j)?(m=b,58===f.charCodeAt(b)?(l=":",b++):(l= +null,0===g&&h('":"')),null!==l?(n=q(),null!==n?l=[l,n]:(l=null,b=m)):(l=null,b=m),l=null!==l?l:"",null!==l)?("::"===f.substr(b,2)?(n="::",b+=2):(n=null,0===g&&h('"::"')),null!==n)?a=[a,c,d,e,i,j,l,n]:(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k):(a=null,b=k);null!==a&&(o.host_type="IPv6",a=f.substring(b,u));null===a&&(b=u);return a}function q(){var a,c,d,e,f;f=b;a=G();null!==a?(c=G(),c=null!==c?c:"",null!==c?(d=G(),d=null!==d?d:"",null!==d?(e=G(),e=null!== +e?e:"",null!==e?a=[a,c,d,e]:(a=null,b=f)):(a=null,b=f)):(a=null,b=f)):(a=null,b=f);return a}function A(){var a,c,d,e;e=b;a=q();null!==a?(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c)?(d=q(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e):(a=null,b=e);null===a&&(a=T());return a}function T(){var a,c,d,e,i,j,l,n,m;m=n=b;a=U();null!==a?(46===f.charCodeAt(b)?(c=".",b++):(c=null,0===g&&h('"."')),null!==c)?(d=U(),null!==d)?(46===f.charCodeAt(b)?(e=".",b++):(e=null,0===g&&h('"."')),null!== +e)?(i=U(),null!==i)?(46===f.charCodeAt(b)?(j=".",b++):(j=null,0===g&&h('"."')),null!==j)?(l=U(),null!==l?a=[a,c,d,e,i,j,l]:(a=null,b=m)):(a=null,b=m):(a=null,b=m):(a=null,b=m):(a=null,b=m):(a=null,b=m):(a=null,b=m);null!==a&&(o.host_type="IPv4",a=f.substring(b,n));null===a&&(b=n);return a}function U(){var a,c,d,e;e=b;"25"===f.substr(b,2)?(a="25",b+=2):(a=null,0===g&&h('"25"'));null!==a?(/^[0-5]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null,0===g&&h("[0-5]")),null!==c)?a=[a,c]:(a=null,b=e):(a=null, +b=e);if(null===a&&(e=b,50===f.charCodeAt(b)?(a="2",b++):(a=null,0===g&&h('"2"')),null!==a?(/^[0-4]/.test(f.charAt(b))?(c=f.charAt(b),b++):(c=null,0===g&&h("[0-4]")),null!==c)?(d=p(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e):(a=null,b=e),null===a))if(e=b,49===f.charCodeAt(b)?(a="1",b++):(a=null,0===g&&h('"1"')),null!==a?(c=p(),null!==c?(d=p(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e),null===a)e=b,/^[1-9]/.test(f.charAt(b))?(a=f.charAt(b),b++):(a=null,0===g&&h("[1-9]")),null!== +a?(c=p(),null!==c?a=[a,c]:(a=null,b=e)):(a=null,b=e),null===a&&(a=p());return a}function lb(){var a,c,d,e,f,g,h;h=g=b;a=p();a=null!==a?a:"";null!==a?(c=p(),c=null!==c?c:"",null!==c?(d=p(),d=null!==d?d:"",null!==d?(e=p(),e=null!==e?e:"",null!==e?(f=p(),f=null!==f?f:"",null!==f?a=[a,c,d,e,f]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h)):(a=null,b=h)):(a=null,b=h);null!==a&&(a=parseInt(a.join("")),o.port=a);null===a&&(b=g);return a}function Ca(){var a,c,d,e;a=[];e=b;59===f.charCodeAt(b)?(c=";",b++):(c=null, +0===g&&h('";"'));null!==c?(d=Ja(),null!==d?c=[c,d]:(c=null,b=e)):(c=null,b=e);for(;null!==c;)(a.push(c),e=b,59===f.charCodeAt(b)?(c=";",b++):(c=null,0===g&&h('";"')),null!==c)?(d=Ja(),null!==d?c=[c,d]:(c=null,b=e)):(c=null,b=e);return a}function Ja(){var a;a=nb();null===a&&(a=ob(),null===a&&(a=pb(),null===a&&(a=qb(),null===a&&(a=rb(),null===a&&(a=sb(),null===a&&(a=tb()))))));return a}function nb(){var a,c,d,e;e=d=b;"transport="===f.substr(b,10)?(a="transport=",b+=10):(a=null,0===g&&h('"transport="')); +if(null!==a){"udp"===f.substr(b,3)?(c="udp",b+=3):(c=null,0===g&&h('"udp"'));if(null===c&&("tcp"===f.substr(b,3)?(c="tcp",b+=3):(c=null,0===g&&h('"tcp"')),null===c))if("sctp"===f.substr(b,4)?(c="sctp",b+=4):(c=null,0===g&&h('"sctp"')),null===c)"tls"===f.substr(b,3)?(c="tls",b+=3):(c=null,0===g&&h('"tls"')),null===c&&(c=r());null!==c?a=[a,c]:(a=null,b=e)}else a=null,b=e;null!==a&&(a=a[1],o.params||(o.params={}),o.params.transport=a,a=void 0);null===a&&(b=d);return a}function ob(){var a,c,d,e;e=d=b; +"user="===f.substr(b,5)?(a="user=",b+=5):(a=null,0===g&&h('"user="'));null!==a?("phone"===f.substr(b,5)?(c="phone",b+=5):(c=null,0===g&&h('"phone"')),null===c&&("ip"===f.substr(b,2)?(c="ip",b+=2):(c=null,0===g&&h('"ip"')),null===c&&(c=r())),null!==c)?a=[a,c]:(a=null,b=e):(a=null,b=e);null!==a&&(a=a[1],o.params||(o.params={}),o.params.user=a,a=void 0);null===a&&(b=d);return a}function pb(){var a,c,d,e;e=d=b;"method="===f.substr(b,7)?(a="method=",b+=7):(a=null,0===g&&h('"method="'));null!==a?(c=ha(), +null!==c?a=[a,c]:(a=null,b=e)):(a=null,b=e);null!==a&&(a=a[1],o.params||(o.params={}),o.params.method=a,a=void 0);null===a&&(b=d);return a}function qb(){var a,c,d,e;e=d=b;"ttl="===f.substr(b,4)?(a="ttl=",b+=4):(a=null,0===g&&h('"ttl="'));null!==a?(c=Ka(),null!==c?a=[a,c]:(a=null,b=e)):(a=null,b=e);null!==a&&(a=a[1],o.params||(o.params={}),o.params.ttl=a,a=void 0);null===a&&(b=d);return a}function rb(){var a,c,d,e;e=d=b;"maddr="===f.substr(b,6)?(a="maddr=",b+=6):(a=null,0===g&&h('"maddr="'));null!== +a?(c=S(),null!==c?a=[a,c]:(a=null,b=e)):(a=null,b=e);null!==a&&(a=a[1],o.params||(o.params={}),o.params.maddr=a,a=void 0);null===a&&(b=d);return a}function sb(){var a,c;c=b;"lr"===f.substr(b,2)?(a="lr",b+=2):(a=null,0===g&&h('"lr"'));null!==a&&(o.params||(o.params={}),o.params.lr=!0,a=void 0);null===a&&(b=c);return a}function tb(){var a,c,d,e,i,j;i=e=b;a=ub();null!==a?(j=b,61===f.charCodeAt(b)?(c="=",b++):(c=null,0===g&&h('"="')),null!==c?(d=vb(),null!==d?c=[c,d]:(c=null,b=j)):(c=null,b=j),c=null!== +c?c:"",null!==c)?a=[a,c]:(a=null,b=i):(a=null,b=i);null!==a&&(a=a[0],o.params||(o.params={}),o.params[a]=a.length===b-e?!0:f.substring(b,e+a.length+1),a=void 0);null===a&&(b=e);return a}function ub(){var a,c,d;d=b;c=V();if(null!==c)for(a=[];null!==c;)a.push(c),c=V();else a=null;null!==a&&(a=a.join(""));null===a&&(b=d);return a}function vb(){var a,c,d;d=b;c=V();if(null!==c)for(a=[];null!==c;)a.push(c),c=V();else a=null;null!==a&&(a=a.join(""));null===a&&(b=d);return a}function V(){var a;a=wb();null=== +a&&(a=w(),null===a&&(a=x()));return a}function wb(){var a;91===f.charCodeAt(b)?(a="[",b++):(a=null,0===g&&h('"["'));if(null===a&&(93===f.charCodeAt(b)?(a="]",b++):(a=null,0===g&&h('"]"')),null===a))if(47===f.charCodeAt(b)?(a="/",b++):(a=null,0===g&&h('"/"')),null===a)if(58===f.charCodeAt(b)?(a=":",b++):(a=null,0===g&&h('":"')),null===a)if(38===f.charCodeAt(b)?(a="&",b++):(a=null,0===g&&h('"&"')),null===a)if(43===f.charCodeAt(b)?(a="+",b++):(a=null,0===g&&h('"+"')),null===a)36===f.charCodeAt(b)?(a= +"$",b++):(a=null,0===g&&h('"$"'));return a}function kb(){var a,c,d,e,i,j,l;j=b;63===f.charCodeAt(b)?(a="?",b++):(a=null,0===g&&h('"?"'));if(null!==a)if(c=ia(),null!==c){d=[];l=b;38===f.charCodeAt(b)?(e="&",b++):(e=null,0===g&&h('"&"'));null!==e?(i=ia(),null!==i?e=[e,i]:(e=null,b=l)):(e=null,b=l);for(;null!==e;)(d.push(e),l=b,38===f.charCodeAt(b)?(e="&",b++):(e=null,0===g&&h('"&"')),null!==e)?(i=ia(),null!==i?e=[e,i]:(e=null,b=l)):(e=null,b=l);null!==d?a=[a,c,d]:(a=null,b=j)}else a=null,b=j;else a= +null,b=j;return a}function ia(){var a,c,d,e;e=b;a=xb();null!==a?(61===f.charCodeAt(b)?(c="=",b++):(c=null,0===g&&h('"="')),null!==c)?(d=yb(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e):(a=null,b=e);return a}function xb(){var a,b;b=W();null===b&&(b=w(),null===b&&(b=x()));if(null!==b)for(a=[];null!==b;)a.push(b),b=W(),null===b&&(b=w(),null===b&&(b=x()));else a=null;return a}function yb(){var a,b;a=[];b=W();null===b&&(b=w(),null===b&&(b=x()));for(;null!==b;)a.push(b),b=W(),null===b&&(b=w(),null=== +b&&(b=x()));return a}function W(){var a;91===f.charCodeAt(b)?(a="[",b++):(a=null,0===g&&h('"["'));if(null===a&&(93===f.charCodeAt(b)?(a="]",b++):(a=null,0===g&&h('"]"')),null===a))if(47===f.charCodeAt(b)?(a="/",b++):(a=null,0===g&&h('"/"')),null===a)if(63===f.charCodeAt(b)?(a="?",b++):(a=null,0===g&&h('"?"')),null===a)if(58===f.charCodeAt(b)?(a=":",b++):(a=null,0===g&&h('":"')),null===a)if(43===f.charCodeAt(b)?(a="+",b++):(a=null,0===g&&h('"+"')),null===a)36===f.charCodeAt(b)?(a="$",b++):(a=null, +0===g&&h('"$"'));return a}function zb(){var a,c,d,e,f,g;g=b;a=ha();null!==a?(c=z(),null!==c?(d=Ab(),null!==d?(e=z(),null!==e?(f=La(),null!==f?a=[a,c,d,e,f]:(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g);return a}function Ab(){var a;a=Ba();null===a&&(a=X());return a}function X(){var a,c,d,e;e=b;a=Bb();null!==a?(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c)?(d=Cb(),null===d&&(d=Db()),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e):(a=null,b=e);return a}function Cb(){var a, +c,d,e,i;e=b;a=Eb();null===a&&(a=ja());null!==a?(i=b,63===f.charCodeAt(b)?(c="?",b++):(c=null,0===g&&h('"?"')),null!==c?(d=Fb(),null!==d?c=[c,d]:(c=null,b=i)):(c=null,b=i),c=null!==c?c:"",null!==c)?a=[a,c]:(a=null,b=e):(a=null,b=e);return a}function Eb(){var a,c,d,e;e=b;"//"===f.substr(b,2)?(a="//",b+=2):(a=null,0===g&&h('"//"'));null!==a?(c=Gb(),null!==c?(d=ja(),d=null!==d?d:"",null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function ja(){var a,c,d;d=b;47===f.charCodeAt(b)?(a= +"/",b++):(a=null,0===g&&h('"/"'));null!==a?(c=Hb(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return a}function Db(){var a,c,d,e;e=b;a=Ib();if(null!==a){c=[];for(d=Y();null!==d;)c.push(d),d=Y();null!==c?a=[a,c]:(a=null,b=e)}else a=null,b=e;return a}function Y(){var a;a=ca();null===a&&(a=w(),null===a&&(a=x()));return a}function Ib(){var a;a=w();if(null===a&&(a=x(),null===a&&(59===f.charCodeAt(b)?(a=";",b++):(a=null,0===g&&h('";"')),null===a)))if(63===f.charCodeAt(b)?(a="?",b++):(a=null,0===g&&h('"?"')), +null===a)if(58===f.charCodeAt(b)?(a=":",b++):(a=null,0===g&&h('":"')),null===a)if(64===f.charCodeAt(b)?(a="@",b++):(a=null,0===g&&h('"@"')),null===a)if(38===f.charCodeAt(b)?(a="&",b++):(a=null,0===g&&h('"&"')),null===a)if(61===f.charCodeAt(b)?(a="=",b++):(a=null,0===g&&h('"="')),null===a)if(43===f.charCodeAt(b)?(a="+",b++):(a=null,0===g&&h('"+"')),null===a)if(36===f.charCodeAt(b)?(a="$",b++):(a=null,0===g&&h('"$"')),null===a)44===f.charCodeAt(b)?(a=",",b++):(a=null,0===g&&h('","'));return a}function Hb(){var a, +c,d,e,i,j;i=b;a=ka();if(null!==a){c=[];j=b;47===f.charCodeAt(b)?(d="/",b++):(d=null,0===g&&h('"/"'));null!==d?(e=ka(),null!==e?d=[d,e]:(d=null,b=j)):(d=null,b=j);for(;null!==d;)(c.push(d),j=b,47===f.charCodeAt(b)?(d="/",b++):(d=null,0===g&&h('"/"')),null!==d)?(e=ka(),null!==e?d=[d,e]:(d=null,b=j)):(d=null,b=j);null!==c?a=[a,c]:(a=null,b=i)}else a=null,b=i;return a}function ka(){var a,c,d,e,i,j;i=b;a=[];for(c=Z();null!==c;)a.push(c),c=Z();if(null!==a){c=[];j=b;59===f.charCodeAt(b)?(d=";",b++):(d=null, +0===g&&h('";"'));null!==d?(e=Ma(),null!==e?d=[d,e]:(d=null,b=j)):(d=null,b=j);for(;null!==d;)(c.push(d),j=b,59===f.charCodeAt(b)?(d=";",b++):(d=null,0===g&&h('";"')),null!==d)?(e=Ma(),null!==e?d=[d,e]:(d=null,b=j)):(d=null,b=j);null!==c?a=[a,c]:(a=null,b=i)}else a=null,b=i;return a}function Ma(){var a,b;a=[];for(b=Z();null!==b;)a.push(b),b=Z();return a}function Z(){var a;a=w();if(null===a&&(a=x(),null===a&&(58===f.charCodeAt(b)?(a=":",b++):(a=null,0===g&&h('":"')),null===a)))if(64===f.charCodeAt(b)? +(a="@",b++):(a=null,0===g&&h('"@"')),null===a)if(38===f.charCodeAt(b)?(a="&",b++):(a=null,0===g&&h('"&"')),null===a)if(61===f.charCodeAt(b)?(a="=",b++):(a=null,0===g&&h('"="')),null===a)if(43===f.charCodeAt(b)?(a="+",b++):(a=null,0===g&&h('"+"')),null===a)if(36===f.charCodeAt(b)?(a="$",b++):(a=null,0===g&&h('"$"')),null===a)44===f.charCodeAt(b)?(a=",",b++):(a=null,0===g&&h('","'));return a}function Bb(){var a,c,d,e,i;i=e=b;a=ba();if(null!==a){c=[];d=ba();if(null===d&&(d=p(),null===d&&(43===f.charCodeAt(b)? +(d="+",b++):(d=null,0===g&&h('"+"')),null===d)))if(45===f.charCodeAt(b)?(d="-",b++):(d=null,0===g&&h('"-"')),null===d)46===f.charCodeAt(b)?(d=".",b++):(d=null,0===g&&h('"."'));for(;null!==d;)if(c.push(d),d=ba(),null===d&&(d=p(),null===d&&(43===f.charCodeAt(b)?(d="+",b++):(d=null,0===g&&h('"+"')),null===d)))if(45===f.charCodeAt(b)?(d="-",b++):(d=null,0===g&&h('"-"')),null===d)46===f.charCodeAt(b)?(d=".",b++):(d=null,0===g&&h('"."'));null!==c?a=[a,c]:(a=null,b=i)}else a=null,b=i;null!==a&&(o.scheme= +f.substring(b,e),a=void 0);null===a&&(b=e);return a}function Gb(){var a;a=Jb();null===a&&(a=Kb());return a}function Jb(){var a,c,d,e;e=d=b;a=ga();null!==a?(64===f.charCodeAt(b)?(c="@",b++):(c=null,0===g&&h('"@"')),null!==c)?a=[a,c]:(a=null,b=e):(a=null,b=e);a=null!==a?a:"";null!==a?(c=R(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return null!==a?a:""}function Kb(){var a,c;c=w();if(null===c&&(c=x(),null===c&&(36===f.charCodeAt(b)?(c="$",b++):(c=null,0===g&&h('"$"')),null===c)))if(44===f.charCodeAt(b)? +(c=",",b++):(c=null,0===g&&h('","')),null===c)if(59===f.charCodeAt(b)?(c=";",b++):(c=null,0===g&&h('";"')),null===c)if(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null===c)if(64===f.charCodeAt(b)?(c="@",b++):(c=null,0===g&&h('"@"')),null===c)if(38===f.charCodeAt(b)?(c="&",b++):(c=null,0===g&&h('"&"')),null===c)if(61===f.charCodeAt(b)?(c="=",b++):(c=null,0===g&&h('"="')),null===c)43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"'));if(null!==c)for(a=[];null!==c;){if(a.push(c),c= +w(),null===c&&(c=x(),null===c&&(36===f.charCodeAt(b)?(c="$",b++):(c=null,0===g&&h('"$"')),null===c)))if(44===f.charCodeAt(b)?(c=",",b++):(c=null,0===g&&h('","')),null===c)if(59===f.charCodeAt(b)?(c=";",b++):(c=null,0===g&&h('";"')),null===c)if(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null===c)if(64===f.charCodeAt(b)?(c="@",b++):(c=null,0===g&&h('"@"')),null===c)if(38===f.charCodeAt(b)?(c="&",b++):(c=null,0===g&&h('"&"')),null===c)if(61===f.charCodeAt(b)?(c="=",b++):(c=null,0===g&& +h('"="')),null===c)43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"'))}else a=null;return a}function Fb(){var a,b;a=[];for(b=Y();null!==b;)a.push(b),b=Y();return a}function La(){var a,c,d,e,i,j,l,n;n=l=b;"SIP"===f.substr(b,3)?(a="SIP",b+=3):(a=null,0===g&&h('"SIP"'));if(null!==a)if(47===f.charCodeAt(b)?(c="/",b++):(c=null,0===g&&h('"/"')),null!==c){e=p();if(null!==e)for(d=[];null!==e;)d.push(e),e=p();else d=null;if(null!==d)if(46===f.charCodeAt(b)?(e=".",b++):(e=null,0===g&&h('"."')),null!== +e){j=p();if(null!==j)for(i=[];null!==j;)i.push(j),j=p();else i=null;null!==i?a=[a,c,d,e,i]:(a=null,b=n)}else a=null,b=n;else a=null,b=n}else a=null,b=n;else a=null,b=n;null!==a&&(o.sip_version=f.substring(b,l),a=void 0);null===a&&(b=l);return a}function Lb(){var a;"INVITE"===f.substr(b,6)?(a="INVITE",b+=6):(a=null,0===g&&h('"INVITE"'));return a}function Mb(){var a;"ACK"===f.substr(b,3)?(a="ACK",b+=3):(a=null,0===g&&h('"ACK"'));return a}function Nb(){var a;"OPTIONS"===f.substr(b,7)?(a="OPTIONS",b+= +7):(a=null,0===g&&h('"OPTIONS"'));return a}function Ob(){var a;"BYE"===f.substr(b,3)?(a="BYE",b+=3):(a=null,0===g&&h('"BYE"'));return a}function Pb(){var a;"CANCEL"===f.substr(b,6)?(a="CANCEL",b+=6):(a=null,0===g&&h('"CANCEL"'));return a}function Qb(){var a;"REGISTER"===f.substr(b,8)?(a="REGISTER",b+=8):(a=null,0===g&&h('"REGISTER"'));return a}function Rb(){var a;"SUBSCRIBE"===f.substr(b,9)?(a="SUBSCRIBE",b+=9):(a=null,0===g&&h('"SUBSCRIBE"'));return a}function Sb(){var a;"NOTIFY"===f.substr(b,6)? +(a="NOTIFY",b+=6):(a=null,0===g&&h('"NOTIFY"'));return a}function ha(){var a,c;c=b;a=Lb();null===a&&(a=Mb(),null===a&&(a=Nb(),null===a&&(a=Ob(),null===a&&(a=Pb(),null===a&&(a=Qb(),null===a&&(a=Rb(),null===a&&(a=Sb(),null===a&&(a=r()))))))));null!==a&&(o.method=f.substring(b,c),a=void 0);null===a&&(b=c);return a}function Tb(){var a,c,d,e,f,g;g=b;a=La();null!==a?(c=z(),null!==c?(d=Ub(),null!==d?(e=z(),null!==e?(f=Vb(),null!==f?a=[a,c,d,e,f]:(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a= +null,b=g);return a}function Ub(){var a,c;c=b;a=Wb();null!==a&&(o.status_code=f.substring(b,c),a=void 0);null===a&&(b=c);return a}function Wb(){var a,c,d,e;e=b;a=p();null!==a?(c=p(),null!==c?(d=p(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function Vb(){var a,c,d;d=b;a=[];c=ca();null===c&&(c=w(),null===c&&(c=x(),null===c&&(c=K(),null===c&&(c=P(),null===c&&(c=z(),null===c&&(c=H()))))));for(;null!==c;)a.push(c),c=ca(),null===c&&(c=w(),null===c&&(c=x(),null===c&&(c=K(),null=== +c&&(c=P(),null===c&&(c=z(),null===c&&(c=H()))))));null!==a&&(o.reason_phrase=f.substring(b,d),a=void 0);null===a&&(b=d);return a}function la(){var a,c,d,e,f,g;f=b;a=Na();null===a&&(a=L());if(null!==a){c=[];g=b;d=v();null!==d?(e=Oa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=v(),null!==d?(e=Oa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a}function L(){var a,c,d,e,f;f=b;a=Xb();a=null!==a?a:"";null!==a?(c=hb(),null!== +c?(d=Na(),null!==d?(e=gb(),null!==e?a=[a,c,d,e]:(a=null,b=f)):(a=null,b=f)):(a=null,b=f)):(a=null,b=f);return a}function Na(){var a;a=Ba();null===a&&(a=X());return a}function Pa(){var a;a=jb();null===a&&(a=X());return a}function Xb(){var a,c,d,e,f,g,h;g=f=b;a=r();if(null!==a){c=[];h=b;d=y();null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=h)):(d=null,b=h);for(;null!==d;)c.push(d),h=b,d=y(),null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=h)):(d=null,b=h);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;null===a&& +(a=F());null!==a&&(o.display_name=a,a=void 0);null===a&&(b=f);return a}function Oa(){var a;a=Yb();null===a&&(a=Zb(),null===a&&(a=$b()));return a}function Yb(){var a,c,d,e,i;i=e=b;113===f.charCodeAt(b)?(a="q",b++):(a=null,0===g&&h('"q"'));null!==a?(c=t(),null!==c?(d=ac(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(a=a[2],o.params||(o.params={}),o.params.q=a,a=void 0);null===a&&(b=e);return a}function Zb(){var a,c,d,e,i;i=e=b;"expires"===f.substr(b,7)?(a="expires",b+=7):(a= +null,0===g&&h('"expires"'));null!==a?(c=t(),null!==c?(d=M(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(a=a[2],o.params||(o.params={}),o.params.expires=a,a=void 0);null===a&&(b=e);return a}function $b(){var a,c;c=b;a=B();null!==a&&(o.params||(o.params={}),o.params[a[0]]=a[1]?a[1]:!0,a=void 0);null===a&&(b=c);return a}function M(){var a,c,d;d=b;c=p();if(null!==c)for(a=[];null!==c;)a.push(c),c=p();else a=null;null!==a&&(a=parseInt(a.join("")));null===a&&(b=d);return a}function ac(){var a, +c,d,e,i,j,l,n;l=j=b;48===f.charCodeAt(b)?(a="0",b++):(a=null,0===g&&h('"0"'));null!==a?(n=b,46===f.charCodeAt(b)?(c=".",b++):(c=null,0===g&&h('"."')),null!==c?(d=p(),d=null!==d?d:"",null!==d?(e=p(),e=null!==e?e:"",null!==e?(i=p(),i=null!==i?i:"",null!==i?c=[c,d,e,i]:(c=null,b=n)):(c=null,b=n)):(c=null,b=n)):(c=null,b=n),c=null!==c?c:"",null!==c)?a=[a,c]:(a=null,b=l):(a=null,b=l);null!==a&&(a=parseFloat(f.substring(b,j)));null===a&&(b=j);return a}function B(){var a,c,d,e,f,g;f=e=b;a=r();null!==a?(g= +b,c=t(),null!==c?(d=bc(),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=f):(a=null,b=f);null!==a&&(c=a[1],c="undefined"===typeof c?null:c[1],a=[a[0],c]);null===a&&(b=e);return a}function bc(){var a;a=r();null===a&&(a=S(),null===a&&(a=F()));return a}function cc(){var a;"render"===f.substr(b,6)?(a="render",b+=6):(a=null,0===g&&h('"render"'));if(null===a&&("session"===f.substr(b,7)?(a="session",b+=7):(a=null,0===g&&h('"session"')),null===a))if("icon"===f.substr(b, +4)?(a="icon",b+=4):(a=null,0===g&&h('"icon"')),null===a)"alert"===f.substr(b,5)?(a="alert",b+=5):(a=null,0===g&&h('"alert"')),null===a&&(a=r());return a}function Qa(){var a;a=dc();null===a&&(a=B());return a}function dc(){var a,c,d,e;e=b;"handling"===f.substr(b,8)?(a="handling",b+=8):(a=null,0===g&&h('"handling"'));null!==a?(c=t(),null!==c)?("optional"===f.substr(b,8)?(d="optional",b+=8):(d=null,0===g&&h('"optional"')),null===d&&("required"===f.substr(b,8)?(d="required",b+=8):(d=null,0===g&&h('"required"')), +null===d&&(d=r())),null!==d)?a=[a,c,d]:(a=null,b=e):(a=null,b=e):(a=null,b=e);return a}function ec(){var a,c,d,e,f,g,h,n;h=b;a=fc();if(null!==a)if(c=ea(),null!==c)if(d=gc(),null!==d){e=[];n=b;f=v();null!==f?(g=Ra(),null!==g?f=[f,g]:(f=null,b=n)):(f=null,b=n);for(;null!==f;)e.push(f),n=b,f=v(),null!==f?(g=Ra(),null!==g?f=[f,g]:(f=null,b=n)):(f=null,b=n);null!==e?a=[a,c,d,e]:(a=null,b=h)}else a=null,b=h;else a=null,b=h;else a=null,b=h;return a}function fc(){var a;a=hc();null===a&&(a=ic());return a} +function hc(){var a;"text"===f.substr(b,4)?(a="text",b+=4):(a=null,0===g&&h('"text"'));if(null===a&&("image"===f.substr(b,5)?(a="image",b+=5):(a=null,0===g&&h('"image"')),null===a))if("audio"===f.substr(b,5)?(a="audio",b+=5):(a=null,0===g&&h('"audio"')),null===a)if("video"===f.substr(b,5)?(a="video",b+=5):(a=null,0===g&&h('"video"')),null===a)"application"===f.substr(b,11)?(a="application",b+=11):(a=null,0===g&&h('"application"')),null===a&&(a=ma());return a}function ic(){var a;"message"===f.substr(b, +7)?(a="message",b+=7):(a=null,0===g&&h('"message"'));null===a&&("multipart"===f.substr(b,9)?(a="multipart",b+=9):(a=null,0===g&&h('"multipart"')),null===a&&(a=ma()));return a}function ma(){var a;a=r();null===a&&(a=jc());return a}function jc(){var a,c,d;d=b;"x-"===f.substr(b,2)?(a="x-",b+=2):(a=null,0===g&&h('"x-"'));null!==a?(c=r(),null!==c?a=[a,c]:(a=null,b=d)):(a=null,b=d);return a}function gc(){var a;a=ma();null===a&&(a=r());return a}function Ra(){var a,c,d,e;e=b;a=r();null!==a?(c=t(),null!==c? +(d=kc(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function kc(){var a;a=r();null===a&&(a=F());return a}function lc(){var a,c,d;d=b;c=p();if(null!==c)for(a=[];null!==c;)a.push(c),c=p();else a=null;null!==a&&(o.value=parseInt(a.join("")),a=void 0);null===a&&(b=d);return a}function $(){var a,c,d,e,i,j;i=b;a=da();if(null!==a){c=[];j=b;46===f.charCodeAt(b)?(d=".",b++):(d=null,0===g&&h('"."'));null!==d?(e=da(),null!==e?d=[d,e]:(d=null,b=j)):(d=null,b=j);for(;null!==d;)(c.push(d), +j=b,46===f.charCodeAt(b)?(d=".",b++):(d=null,0===g&&h('"."')),null!==d)?(e=da(),null!==e?d=[d,e]:(d=null,b=j)):(d=null,b=j);null!==c?a=[a,c]:(a=null,b=i)}else a=null,b=i;return a}function Sa(){var a,c;c=b;a=B();null!==a&&(o.params||(o.params={}),o.params[a[0]]=a[1]?a[1]:!0,a=void 0);null===a&&(b=c);return a}function Ta(){var a;a=Ua();null===a&&(a=B());return a}function Ua(){var a,c,d,e,i;i=e=b;"tag"===f.substr(b,3)?(a="tag",b+=3):(a=null,0===g&&h('"tag"'));null!==a?(c=t(),null!==c?(d=r(),null!==d? +a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(o.tag=a[2],a=void 0);null===a&&(b=e);return a}function Va(){var a,c,d,e,i,j,l,n;l=b;"Digest"===f.substr(b,6)?(a="Digest",b+=6):(a=null,0===g&&h('"Digest"'));if(null!==a)if(c=y(),null!==c)if(d=na(),null!==d){e=[];n=b;i=u();null!==i?(j=na(),null!==j?i=[i,j]:(i=null,b=n)):(i=null,b=n);for(;null!==i;)e.push(i),n=b,i=u(),null!==i?(j=na(),null!==j?i=[i,j]:(i=null,b=n)):(i=null,b=n);null!==e?a=[a,c,d,e]:(a=null,b=l)}else a=null,b=l;else a=null, +b=l;else a=null,b=l;null===a&&(a=mc());return a}function mc(){var a,c,d,e,f,g,h,n;h=b;a=r();if(null!==a)if(c=y(),null!==c)if(d=aa(),null!==d){e=[];n=b;f=u();null!==f?(g=aa(),null!==g?f=[f,g]:(f=null,b=n)):(f=null,b=n);for(;null!==f;)e.push(f),n=b,f=u(),null!==f?(g=aa(),null!==g?f=[f,g]:(f=null,b=n)):(f=null,b=n);null!==e?a=[a,c,d,e]:(a=null,b=h)}else a=null,b=h;else a=null,b=h;else a=null,b=h;return a}function aa(){var a,c,d,e;e=b;a=r();null!==a?(c=t(),null!==c?(d=r(),null===d&&(d=F()),null!==d?a= +[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function na(){var a;a=nc();null===a&&(a=oc(),null===a&&(a=pc(),null===a&&(a=qc(),null===a&&(a=rc(),null===a&&(a=sc(),null===a&&(a=tc(),null===a&&(a=aa())))))));return a}function nc(){var a,c,d,e;e=b;"realm"===f.substr(b,5)?(a="realm",b+=5):(a=null,0===g&&h('"realm"'));null!==a?(c=t(),null!==c?(d=uc(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function uc(){var a,c;c=b;a=F();null!==a&&(o.realm=a,a=void 0);null===a&& +(b=c);return a}function oc(){var a,c,d,e,i,j,l,n,m;n=b;"domain"===f.substr(b,6)?(a="domain",b+=6):(a=null,0===g&&h('"domain"'));if(null!==a)if(c=t(),null!==c)if(d=wa(),null!==d)if(e=oa(),null!==e){i=[];m=b;l=z();if(null!==l)for(j=[];null!==l;)j.push(l),l=z();else j=null;null!==j?(l=oa(),null!==l?j=[j,l]:(j=null,b=m)):(j=null,b=m);for(;null!==j;){i.push(j);m=b;l=z();if(null!==l)for(j=[];null!==l;)j.push(l),l=z();else j=null;null!==j?(l=oa(),null!==l?j=[j,l]:(j=null,b=m)):(j=null,b=m)}null!==i?(j=xa(), +null!==j?a=[a,c,d,e,i,j]:(a=null,b=n)):(a=null,b=n)}else a=null,b=n;else a=null,b=n;else a=null,b=n;else a=null,b=n;return a}function oa(){var a;a=X();null===a&&(a=ja());return a}function pc(){var a,c,d,e;e=b;"nonce"===f.substr(b,5)?(a="nonce",b+=5):(a=null,0===g&&h('"nonce"'));null!==a?(c=t(),null!==c?(d=vc(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a}function vc(){var a,c;c=b;a=F();null!==a&&(o.nonce=a,a=void 0);null===a&&(b=c);return a}function qc(){var a,c,d,e,i;i=e= +b;"opaque"===f.substr(b,6)?(a="opaque",b+=6):(a=null,0===g&&h('"opaque"'));null!==a?(c=t(),null!==c?(d=F(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(o.opaque=a[2],a=void 0);null===a&&(b=e);return a}function rc(){var a,c,d,e,i;i=e=b;"stale"===f.substr(b,5)?(a="stale",b+=5):(a=null,0===g&&h('"stale"'));null!==a?(c=t(),null!==c)?("true"===f.substr(b,4)?(d="true",b+=4):(d=null,0===g&&h('"true"')),null===d&&("false"===f.substr(b,5)?(d="false",b+=5):(d=null,0===g&&h('"false"'))), +null!==d)?a=[a,c,d]:(a=null,b=i):(a=null,b=i):(a=null,b=i);null!==a&&(o.stale=a[2],a=void 0);null===a&&(b=e);return a}function sc(){var a,c,d,e,i;i=e=b;"algorithm"===f.substr(b,9)?(a="algorithm",b+=9):(a=null,0===g&&h('"algorithm"'));null!==a?(c=t(),null!==c)?("MD5"===f.substr(b,3)?(d="MD5",b+=3):(d=null,0===g&&h('"MD5"')),null===d&&("MD5-sess"===f.substr(b,8)?(d="MD5-sess",b+=8):(d=null,0===g&&h('"MD5-sess"')),null===d&&(d=r())),null!==d)?a=[a,c,d]:(a=null,b=i):(a=null,b=i):(a=null,b=i);null!==a&& +(o.algorithm=a[2],a=void 0);null===a&&(b=e);return a}function tc(){var a,c,d,e,i,j,l,n,m,q,p;m=n=b;"qop"===f.substr(b,3)?(a="qop",b+=3):(a=null,0===g&&h('"qop"'));if(null!==a)if(c=t(),null!==c)if(d=wa(),null!==d){q=b;e=pa();if(null!==e){i=[];p=b;44===f.charCodeAt(b)?(j=",",b++):(j=null,0===g&&h('","'));null!==j?(l=pa(),null!==l?j=[j,l]:(j=null,b=p)):(j=null,b=p);for(;null!==j;)(i.push(j),p=b,44===f.charCodeAt(b)?(j=",",b++):(j=null,0===g&&h('","')),null!==j)?(l=pa(),null!==l?j=[j,l]:(j=null,b=p)): +(j=null,b=p);null!==i?e=[e,i]:(e=null,b=q)}else e=null,b=q;null!==e?(i=xa(),null!==i?a=[a,c,d,e,i]:(a=null,b=m)):(a=null,b=m)}else a=null,b=m;else a=null,b=m;else a=null,b=m;null!==a&&(o.qop=f.substring(b-1,n+5),a=void 0);null===a&&(b=n);return a}function pa(){var a;"auth-int"===f.substr(b,8)?(a="auth-int",b+=8):(a=null,0===g&&h('"auth-int"'));null===a&&("auth"===f.substr(b,4)?(a="auth",b+=4):(a=null,0===g&&h('"auth"')),null===a&&(a=r()));return a}function qa(){var a,c,d,e,f,g;f=b;a=L();if(null!== +a){c=[];g=b;d=v();null!==d?(e=B(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=v(),null!==d?(e=B(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a}function ra(){var a,c,d,e,f,g;f=b;a=L();if(null!==a){c=[];g=b;d=v();null!==d?(e=B(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=v(),null!==d?(e=B(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a} +function wc(){var a,c;c=b;"active"===f.substr(b,6)?(a="active",b+=6):(a=null,0===g&&h('"active"'));if(null===a&&("pending"===f.substr(b,7)?(a="pending",b+=7):(a=null,0===g&&h('"pending"')),null===a))"terminated"===f.substr(b,10)?(a="terminated",b+=10):(a=null,0===g&&h('"terminated"')),null===a&&(a=r());null!==a&&(o.state=f.substring(b,c),a=void 0);null===a&&(b=c);return a}function Wa(){var a,c,d,e,i;i=e=b;"reason"===f.substr(b,6)?(a="reason",b+=6):(a=null,0===g&&h('"reason"'));null!==a?(c=t(),null!== +c?(d=xc(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(a=function(a,b){if(typeof b!=="undefined")o.reason=b}(e,a[2]));null===a&&(b=e);if(null===a&&(i=e=b,"expires"===f.substr(b,7)?(a="expires",b+=7):(a=null,0===g&&h('"expires"')),null!==a?(c=t(),null!==c?(d=M(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i),null!==a&&(a=function(a,b){if(typeof b!=="undefined")o.expires=b}(e,a[2])),null===a&&(b=e),null===a))if(i=e=b,"retry_after"===f.substr(b,11)?(a="retry_after", +b+=11):(a=null,0===g&&h('"retry_after"')),null!==a?(c=t(),null!==c?(d=M(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i),null!==a&&(a=function(a,b){if(typeof b!=="undefined")o.retry_after=b}(e,a[2])),null===a&&(b=e),null===a)e=b,a=B(),null!==a&&(a=function(a,b){if(typeof b!=="undefined"){if(!o.params)o.params={};o.params[b[0]]=b[1]?b[1]:true}}(e,a)),null===a&&(b=e);return a}function xc(){var a;"deactivated"===f.substr(b,11)?(a="deactivated",b+=11):(a=null,0===g&&h('"deactivated"'));if(null=== +a&&("probation"===f.substr(b,9)?(a="probation",b+=9):(a=null,0===g&&h('"probation"')),null===a))if("rejected"===f.substr(b,8)?(a="rejected",b+=8):(a=null,0===g&&h('"rejected"')),null===a)if("timeout"===f.substr(b,7)?(a="timeout",b+=7):(a=null,0===g&&h('"timeout"')),null===a)if("giveup"===f.substr(b,6)?(a="giveup",b+=6):(a=null,0===g&&h('"giveup"')),null===a)if("noresource"===f.substr(b,10)?(a="noresource",b+=10):(a=null,0===g&&h('"noresource"')),null===a)"invariant"===f.substr(b,9)?(a="invariant", +b+=9):(a=null,0===g&&h('"invariant"')),null===a&&(a=r());return a}function Xa(){var a;a=Ua();null===a&&(a=B());return a}function sa(){var a,c,d,e,f,g,h,n;h=b;a=yc();if(null!==a)if(c=y(),null!==c)if(d=zc(),null!==d){e=[];n=b;f=v();null!==f?(g=Ya(),null!==g?f=[f,g]:(f=null,b=n)):(f=null,b=n);for(;null!==f;)e.push(f),n=b,f=v(),null!==f?(g=Ya(),null!==g?f=[f,g]:(f=null,b=n)):(f=null,b=n);null!==e?a=[a,c,d,e]:(a=null,b=h)}else a=null,b=h;else a=null,b=h;else a=null,b=h;return a}function Ya(){var a;a=Ac(); +null===a&&(a=Bc(),null===a&&(a=Cc(),null===a&&(a=Dc(),null===a&&(a=Ec(),null===a&&(a=B())))));return a}function Ac(){var a,c,d,e,i;i=e=b;"ttl"===f.substr(b,3)?(a="ttl",b+=3):(a=null,0===g&&h('"ttl"'));null!==a?(c=t(),null!==c?(d=Ka(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(o.ttl=a[2],a=void 0);null===a&&(b=e);return a}function Bc(){var a,c,d,e,i;i=e=b;"maddr"===f.substr(b,5)?(a="maddr",b+=5):(a=null,0===g&&h('"maddr"'));null!==a?(c=t(),null!==c?(d=S(),null!==d?a=[a, +c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(o.maddr=a[2],a=void 0);null===a&&(b=e);return a}function Cc(){var a,c,d,e,i;i=e=b;"received"===f.substr(b,8)?(a="received",b+=8):(a=null,0===g&&h('"received"'));null!==a?(c=t(),null!==c?(d=T(),null===d&&(d=Ia()),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(o.received=a[2],a=void 0);null===a&&(b=e);return a}function Dc(){var a,c,d,e,i;i=e=b;"branch"===f.substr(b,6)?(a="branch",b+=6):(a=null,0===g&&h('"branch"'));null!== +a?(c=t(),null!==c?(d=r(),null!==d?a=[a,c,d]:(a=null,b=i)):(a=null,b=i)):(a=null,b=i);null!==a&&(o.branch=a[2],a=void 0);null===a&&(b=e);return a}function Ec(){var a,c,d,e,i,j,l;j=i=b;"rport"===f.substr(b,5)?(a="rport",b+=5):(a=null,0===g&&h('"rport"'));if(null!==a){l=b;c=t();if(null!==c){d=[];for(e=p();null!==e;)d.push(e),e=p();null!==d?c=[c,d]:(c=null,b=l)}else c=null,b=l;c=null!==c?c:"";null!==c?a=[a,c]:(a=null,b=j)}else a=null,b=j;null!==a&&("undefined"!==typeof response_port&&(o.rport=response_port.join("")), +a=void 0);null===a&&(b=i);return a}function yc(){var a,c,d,e,f,g;g=b;a=Fc();null!==a?(c=ea(),null!==c?(d=r(),null!==d?(e=ea(),null!==e?(f=Gc(),null!==f?a=[a,c,d,e,f]:(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g)):(a=null,b=g);return a}function Fc(){var a,c;c=b;"SIP"===f.substr(b,3)?(a="SIP",b+=3):(a=null,0===g&&h('"SIP"'));null===a&&(a=r());null!==a&&(o.protocol=a,a=void 0);null===a&&(b=c);return a}function Gc(){var a,c;c=b;"UDP"===f.substr(b,3)?(a="UDP",b+=3):(a=null,0===g&&h('"UDP"')); +if(null===a&&("TCP"===f.substr(b,3)?(a="TCP",b+=3):(a=null,0===g&&h('"TCP"')),null===a))if("TLS"===f.substr(b,3)?(a="TLS",b+=3):(a=null,0===g&&h('"TLS"')),null===a)"SCTP"===f.substr(b,4)?(a="SCTP",b+=4):(a=null,0===g&&h('"SCTP"')),null===a&&(a=r());null!==a&&(o.transport=a,a=void 0);null===a&&(b=c);return a}function zc(){var a,c,d,e,f;e=b;a=Hc();null!==a?(f=b,c=ib(),null!==c?(d=Ic(),null!==d?c=[c,d]:(c=null,b=f)):(c=null,b=f),c=null!==c?c:"",null!==c)?a=[a,c]:(a=null,b=e):(a=null,b=e);return a}function Hc(){var a, +c;c=b;a=Fa();null===a&&(a=T(),null===a&&(a=Ga()));null!==a&&(o.host=f.substring(b,c),a=void 0);null===a&&(b=c);return a}function Ic(){var a,c,d,e,f,g,h;h=g=b;a=p();a=null!==a?a:"";null!==a?(c=p(),c=null!==c?c:"",null!==c?(d=p(),d=null!==d?d:"",null!==d?(e=p(),e=null!==e?e:"",null!==e?(f=p(),f=null!==f?f:"",null!==f?a=[a,c,d,e,f]:(a=null,b=h)):(a=null,b=h)):(a=null,b=h)):(a=null,b=h)):(a=null,b=h);null!==a&&(o.port=parseInt(a.join("")),a=void 0);null===a&&(b=g);return a}function Ka(){var a,c,d,e,f; +f=e=b;a=p();null!==a?(c=p(),c=null!==c?c:"",null!==c?(d=p(),d=null!==d?d:"",null!==d?a=[a,c,d]:(a=null,b=f)):(a=null,b=f)):(a=null,b=f);null!==a&&(a=parseInt(a.join("")));null===a&&(b=e);return a}function Jc(){var a,b;a=[];b=I();null===b&&(b=P(),null===b&&(b=y()));for(;null!==b;)a.push(b),b=I(),null===b&&(b=P(),null===b&&(b=y()));return a}function Mc(a){a.sort();for(var b=null,d=[],e=0;e",b++):(a=null,0===g&&h('">"')),null===a)if(64===f.charCodeAt(b)?(a="@",b++):(a=null,0===g&&h('"@"')),null===a)if(44===f.charCodeAt(b)?(a=",",b++):(a=null,0===g&&h('","')),null===a)if(59===f.charCodeAt(b)?(a=";",b++):(a=null,0===g&&h('";"')),null===a)if(58===f.charCodeAt(b)? +(a=":",b++):(a=null,0===g&&h('":"')),null===a)if(92===f.charCodeAt(b)?(a="\\",b++):(a=null,0===g&&h('"\\\\"')),null===a)if(a=D(),null===a&&(47===f.charCodeAt(b)?(a="/",b++):(a=null,0===g&&h('"/"')),null===a))if(91===f.charCodeAt(b)?(a="[",b++):(a=null,0===g&&h('"["')),null===a)if(93===f.charCodeAt(b)?(a="]",b++):(a=null,0===g&&h('"]"')),null===a)if(63===f.charCodeAt(b)?(a="?",b++):(a=null,0===g&&h('"?"')),null===a)if(61===f.charCodeAt(b)?(a="=",b++):(a=null,0===g&&h('"="')),null===a)if(123===f.charCodeAt(b)? +(a="{",b++):(a=null,0===g&&h('"{"')),null===a)if(125===f.charCodeAt(b)?(a="}",b++):(a=null,0===g&&h('"}"')),null===a)a=z(),null===a&&(a=H());return a},word:va,STAR:db,SLASH:ea,EQUAL:t,LPAREN:eb,RPAREN:fb,RAQUOT:gb,LAQUOT:hb,COMMA:u,SEMI:v,COLON:ib,LDQUOT:wa,RDQUOT:xa,comment:ya,ctext:za,quoted_string:F,qdtext:Aa,quoted_pair:Q,SIP_URI_simple:jb,SIP_URI:Ba,uri_scheme:fa,userinfo:ga,user:Da,user_unreserved:Ea,password:function(){var a,c;a=[];c=w();if(null===c&&(c=x(),null===c&&(38===f.charCodeAt(b)? +(c="&",b++):(c=null,0===g&&h('"&"')),null===c)))if(61===f.charCodeAt(b)?(c="=",b++):(c=null,0===g&&h('"="')),null===c)if(43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"')),null===c)if(36===f.charCodeAt(b)?(c="$",b++):(c=null,0===g&&h('"$"')),null===c)44===f.charCodeAt(b)?(c=",",b++):(c=null,0===g&&h('","'));for(;null!==c;)if(a.push(c),c=w(),null===c&&(c=x(),null===c&&(38===f.charCodeAt(b)?(c="&",b++):(c=null,0===g&&h('"&"')),null===c)))if(61===f.charCodeAt(b)?(c="=",b++):(c=null,0===g&&h('"="')), +null===c)if(43===f.charCodeAt(b)?(c="+",b++):(c=null,0===g&&h('"+"')),null===c)if(36===f.charCodeAt(b)?(c="$",b++):(c=null,0===g&&h('"$"')),null===c)44===f.charCodeAt(b)?(c=",",b++):(c=null,0===g&&h('","'));return a},hostport:R,host:S,hostname:Fa,domainlabel:Ha,toplabel:mb,IPv6reference:Ga,IPv6address:Ia,h16:q,ls32:A,IPv4address:T,dec_octet:U,port:lb,uri_parameters:Ca,uri_parameter:Ja,transport_param:nb,user_param:ob,method_param:pb,ttl_param:qb,maddr_param:rb,lr_param:sb,other_param:tb,pname:ub, +pvalue:vb,paramchar:V,param_unreserved:wb,headers:kb,header:ia,hname:xb,hvalue:yb,hnv_unreserved:W,Request_Response:function(){var a;a=Tb();null===a&&(a=zb());return a},Request_Line:zb,Request_URI:Ab,absoluteURI:X,hier_part:Cb,net_path:Eb,abs_path:ja,opaque_part:Db,uric:Y,uric_no_slash:Ib,path_segments:Hb,segment:ka,param:Ma,pchar:Z,scheme:Bb,authority:Gb,srvr:Jb,reg_name:Kb,query:Fb,SIP_Version:La,INVITEm:Lb,ACKm:Mb,OPTIONSm:Nb,BYEm:Ob,CANCELm:Pb,REGISTERm:Qb,SUBSCRIBEm:Rb,NOTIFYm:Sb,Method:ha,Status_Line:Tb, +Status_Code:Ub,extension_code:Wb,Reason_Phrase:Vb,Allow_Events:function(){var a,c,d,e,f,g;f=b;a=$();if(null!==a){c=[];g=b;d=u();null!==d?(e=$(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=$(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},Call_ID:function(){var a,c,d,e,i,j;i=e=b;a=va();null!==a?(j=b,64===f.charCodeAt(b)?(c="@",b++):(c=null,0===g&&h('"@"')),null!==c?(d=va(),null!==d?c=[c,d]:(c=null, +b=j)):(c=null,b=j),c=null!==c?c:"",null!==c)?a=[a,c]:(a=null,b=i):(a=null,b=i);null!==a&&(o=f.substring(b,e),a=void 0);null===a&&(b=e);return a},Contact:function(){var a,c,d,e,f,g;a=db();if(null===a)if(f=b,a=la(),null!==a){c=[];g=b;d=u();null!==d?(e=la(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=la(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},contact_param:la,name_addr:L,addr_spec:Na,addr_spec_simple:Pa, +display_name:Xb,contact_params:Oa,c_p_q:Yb,c_p_expires:Zb,contact_extension:$b,delta_seconds:M,qvalue:ac,generic_param:B,gen_value:bc,Content_Disposition:function(){var a,c,d,e,f,g;f=b;a=cc();if(null!==a){c=[];g=b;d=v();null!==d?(e=Qa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=v(),null!==d?(e=Qa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},disp_type:cc,disp_param:Qa,handling_param:dc,Content_Encoding:function(){var a, +c,d,e,f,g;f=b;a=r();if(null!==a){c=[];g=b;d=u();null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},Content_Length:function(){var a,c,d;d=b;c=p();if(null!==c)for(a=[];null!==c;)a.push(c),c=p();else a=null;null!==a&&(o=parseInt(a.join("")),a=void 0);null===a&&(b=d);return a},Content_Type:function(){var a,c;c=b;a=ec();null!==a&&(o=f.substring(b, +c),a=void 0);null===a&&(b=c);return a},media_type:ec,m_type:fc,discrete_type:hc,composite_type:ic,extension_token:ma,x_token:jc,m_subtype:gc,m_parameter:Ra,m_value:kc,CSeq:function(){var a,c,d,e;e=b;a=lc();null!==a?(c=y(),null!==c?(d=ha(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a},CSeq_value:lc,Expires:function(){var a,c;c=b;a=M();null!==a&&(o=a,a=void 0);null===a&&(b=c);return a},Event:function(){var a,c,d,e,f,g,h;g=f=b;a=$();if(null!==a){c=[];h=b;d=v();null!==d?(e=Sa(), +null!==e?d=[d,e]:(d=null,b=h)):(d=null,b=h);for(;null!==d;)c.push(d),h=b,d=v(),null!==d?(e=Sa(),null!==e?d=[d,e]:(d=null,b=h)):(d=null,b=h);null!==c?a=[a,c]:(a=null,b=g)}else a=null,b=g;null!==a&&(o.event=a[0].join(""),a=void 0);null===a&&(b=f);return a},event_type:$,event_param:Sa,From:function(){var a,c,d,e,f,g;f=b;a=Pa();null===a&&(a=L());if(null!==a){c=[];g=b;d=v();null!==d?(e=Ta(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=v(),null!==d?(e=Ta(),null!==e?d=[d,e]: +(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},from_param:Ta,tag_param:Ua,Max_Forwards:function(){var a,c,d;d=b;c=p();if(null!==c)for(a=[];null!==c;)a.push(c),c=p();else a=null;null!==a&&(o=parseInt(a.join("")),a=void 0);null===a&&(b=d);return a},Min_Expires:function(){var a,c;c=b;a=M();null!==a&&(o=a,a=void 0);null===a&&(b=c);return a},Proxy_Authenticate:function(){return Va()},challenge:Va,other_challenge:mc,auth_param:aa,digest_cln:na,realm:nc,realm_value:uc, +domain:oc,URI:oa,nonce:pc,nonce_value:vc,opaque:qc,stale:rc,algorithm:sc,qop_options:tc,qop_value:pa,Proxy_Require:function(){var a,c,d,e,f,g;f=b;a=r();if(null!==a){c=[];g=b;d=u();null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},Record_Route:function(){var a,c,d,e,f,g;f=b;a=qa();if(null!==a){c=[];g=b;d=u();null!==d?(e=qa(),null!==e?d=[d, +e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=qa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},rec_route:qa,Require:function(){var a,c,d,e,f,g;f=b;a=r();if(null!==a){c=[];g=b;d=u();null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},Route:function(){var a, +c,d,e,f,g;f=b;a=ra();if(null!==a){c=[];g=b;d=u();null!==d?(e=ra(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=ra(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},route_param:ra,Subscription_State:function(){var a,c,d,e,f,g;f=b;a=wc();if(null!==a){c=[];g=b;d=v();null!==d?(e=Wa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=v(),null!==d?(e=Wa(),null!==e?d=[d,e]:(d=null,b= +g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},substate_value:wc,subexp_params:Wa,event_reason_value:xc,Subject:function(){var a;a=cb();return null!==a?a:""},Supported:function(){var a,c,d,e,f,g;f=b;a=r();if(null!==a){c=[];g=b;d=u();null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=r(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return null!==a?a:""},To:function(){var a, +c,d,e,f,g;f=b;a=Pa();null===a&&(a=L());if(null!==a){c=[];g=b;d=v();null!==d?(e=Xa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=v(),null!==d?(e=Xa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},to_param:Xa,Via:function(){var a,c,d,e,f,g;f=b;a=sa();if(null!==a){c=[];g=b;d=u();null!==d?(e=sa(),null!==e?d=[d,e]:(d=null,b=g)):(d=null,b=g);for(;null!==d;)c.push(d),g=b,d=u(),null!==d?(e=sa(),null!==e?d=[d,e]:(d=null,b= +g)):(d=null,b=g);null!==c?a=[a,c]:(a=null,b=f)}else a=null,b=f;return a},via_parm:sa,via_params:Ya,via_ttl:Ac,via_maddr:Bc,via_received:Cc,via_branch:Dc,response_port:Ec,sent_protocol:yc,protocol_name:Fc,transport:Gc,sent_by:zc,via_host:Hc,via_port:Ic,ttl:Ka,WWW_Authenticate:function(){return Va()},extension_header:function(){var a,c,d,e;e=b;a=r();null!==a?(c=bb(),null!==c?(d=Jc(),null!==d?a=[a,c,d]:(a=null,b=e)):(a=null,b=e)):(a=null,b=e);return a},header_value:Jc,message_body:function(){var a,b; +a=[];for(b=ua();null!==b;)a.push(b),b=ua();return a},lazy_uri:function(){var a,c,d,e,i,j;j=i=b;a=fa();null!==a?(58===f.charCodeAt(b)?(c=":",b++):(c=null,0===g&&h('":"')),null!==c)?a=[a,c]:(a=null,b=j):(a=null,b=j);a=null!==a?a:"";null!==a?(c=Da(),null!==c)?(j=b,64===f.charCodeAt(b)?(d="@",b++):(d=null,0===g&&h('"@"')),null!==d?(e=R(),null!==e?d=[d,e]:(d=null,b=j)):(d=null,b=j),d=null!==d?d:"",null!==d)?(e=Ca(),null!==e?a=[a,c,d,e]:(a=null,b=i)):(a=null,b=i):(a=null,b=i):(a=null,b=i);return a}};if(void 0!== +C){if(void 0===Kc[C])throw Error("Invalid rule name: "+$a(C)+".");}else C="CRLF";var b=0,g=0,N=0,ta=[],o={};if(null===Kc[C]()||b!==f.length){var Za=Math.max(b,N),Oc=Za - - - @@ -90,7 +82,13 @@ export default { currentUserId: '6R0MijpK6M4AIrwaaCY2', isDevice: false, showDemoOptions: true, - updatingData: false + updatingData: false, + + // JJSIP Demo Credentials to be passed to ChatContainer + demoJjsipSipUri: 'sip:demouser@example.com', + demoJjsipPassword: 'demopassword', + demoJjsipWebSocketServer: 'wss://demows.example.com', + demoJjsipDisplayName: 'Demo User from App.vue' } }, diff --git a/demo/src/ChatContainer.vue b/demo/src/ChatContainer.vue index 8fafc8c0..9e92853a 100644 --- a/demo/src/ChatContainer.vue +++ b/demo/src/ChatContainer.vue @@ -1,133 +1,166 @@ - diff --git a/demo/vite.config.js b/demo/vite.config.js index 1fe355bf..b8f55174 100644 --- a/demo/vite.config.js +++ b/demo/vite.config.js @@ -23,5 +23,5 @@ export default defineConfig({ server: { open: '/' }, - base: process.env.NODE_ENV === 'production' ? '/vue-advanced-chat/' : '/' + base: '/' }) diff --git a/src/lib/ChatWindow.vue b/src/lib/ChatWindow.vue index 49bcdc5c..db0ccbd5 100644 --- a/src/lib/ChatWindow.vue +++ b/src/lib/ChatWindow.vue @@ -70,6 +70,10 @@ :templates-text="templatesTextCasted" :username-options="usernameOptionsCasted" :emoji-data-source="emojiDataSource" + :jjsip-sip-uri="jjsipSipUri" + :jjsip-password="jjsipPassword" + :jjsip-web-socket-server="jjsipWebSocketServer" + :jjsip-display-name="jjsipDisplayName" @toggle-rooms-list="toggleRoomsList" @room-info="roomInfo" @fetch-messages="fetchMessages" @@ -118,7 +122,7 @@ import { } from '../utils/data-validation' export default { - name: 'ChatContainer', + name: 'ChatContainer', // This should ideally be ChatWindow, but the file is ChatWindow.vue components: { RoomsList, Room, @@ -207,7 +211,13 @@ export default { type: [Object, String], default: () => ({ minUsers: 3, currentUser: false }) }, - emojiDataSource: { type: String, default: undefined } + emojiDataSource: { type: String, default: undefined }, + + // JJSIP Props to pass down to Room.vue + jjsipSipUri: { type: String, default: 'sip:defaultwindowuser@example.com' }, + jjsipPassword: { type: String, default: 'windowpassword' }, + jjsipWebSocketServer: { type: String, default: 'wss://defaultwindowws.example.com' }, + jjsipDisplayName: { type: String, default: 'Default Window User' } }, emits: [ diff --git a/src/lib/Room/Room.vue b/src/lib/Room/Room.vue index 0c57fde1..633d554a 100644 --- a/src/lib/Room/Room.vue +++ b/src/lib/Room/Room.vue @@ -8,6 +8,37 @@ @dragleave.prevent @touchstart="touchStart" > + + + + +
+ Error: {{ callError }} +
+ + +
+
+ Incoming call from: {{ (incomingCallData.session && incomingCallData.session.remote_identity) ? incomingCallData.session.remote_identity.uri.toString() : 'Unknown' }} +
+ + +
+ + +
+
+ Call in progress with: {{ (jjsip_currentSession && jjsip_currentSession.remote_identity) ? jjsip_currentSession.remote_identity.uri.toString() : 'Unknown' }} +
+ +
+
{{ textMessages.ROOM_EMPTY }}
@@ -32,6 +63,7 @@ @menu-action-handler="$emit('menu-action-handler', $event)" @message-selection-action-handler="messageSelectionActionHandler" @cancel-message-selection="messageSelectionEnabled = false" + @start-call="startCall" >