diff --git a/bower.json b/bower.json index a3df991..483b3f4 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "jssip", "description": "the Javascript SIP library", - "main": "dist/jssip.js", + "main": "dist/jssip-rtcninja.js", "homepage": "http://jssip.net", "authors": [ "José Luis Millán (https://github.com/jmillan)", diff --git a/dist/jssip.js b/dist/jssip-rtcninja.js similarity index 99% rename from dist/jssip.js rename to dist/jssip-rtcninja.js index b6f1a61..d148a49 100644 --- a/dist/jssip.js +++ b/dist/jssip-rtcninja.js @@ -1,5 +1,5 @@ /* - * JsSIP v2.0.6 + * JsSIP v2.0.7 * the Javascript SIP library * Copyright: 2012-2016 José Luis Millán (https://github.com/jmillan) * Homepage: http://jssip.net @@ -24964,6 +24964,8 @@ module.exports={ "jshint-stylish": "^2.2.1", "vinyl-source-stream": "^1.1.0" }, + "readme": "# rtcninja.js \n\nWebRTC API wrapper to deal with different browsers transparently, [eventually](http://iswebrtcreadyyet.com/) this library shouldn't be needed. We only have to wait until W3C group in charge [finishes the specification](https://tools.ietf.org/wg/rtcweb/) and the different browsers implement it correctly :sweat_smile:.\n\n\n\nSupported environments:\n* [Google Chrome](https://www.google.com/chrome/browser/desktop/index.html) (desktop & mobile)\n* [Google Canary](https://www.google.com/chrome/browser/canary.html) (desktop & mobile)\n* [Mozilla Firefox](https://www.mozilla.org/en-GB/firefox/new) (desktop & mobile)\n* [Firefox Nigthly](https://nightly.mozilla.org/) (desktop & mobile)\n* [Opera](http://www.opera.com/)\n* [Vivaldi](https://vivaldi.com/)\n* [CrossWalk](https://crosswalk-project.org/)\n* [Cordova](http://cordova.apache.org/): iOS support, you only have to use our plugin [following these steps](https://github.com/eface2face/cordova-plugin-iosrtc#usage).\n* [NW.js](https://github.com/nwjs/nw.js/)\n* [Electron](https://github.com/atom/electron)\n\n\n## Installation\n\n### **npm**:\n\n```bash\n$ npm install rtcninja\n```\n\nand then:\n\n```javascript\nvar rtcninja = require('rtcninja');\n```\n\n### **bower**:\n\n```bash\n$ bower install rtcninja\n```\n\n\n## Browserified library\n\nTake a browserified version of the library from the `dist/` folder:\n\n* `dist/rtcninja.js`: The uncompressed version.\n* `dist/rtcninja.min.js`: The compressed production-ready version.\n\nThey expose the global `window.rtcninja` module.\n\n\n## Usage\n\nIn the [examples](./examples/) folder we provide a complete one.\n\n```javascript\n// Must first call it.\nrtcninja();\n\n// Then check.\nif (rtcninja.hasWebRTC()) {\n // Do something.\n}\nelse {\n // Do something.\n}\n```\n\n\n## Documentation\n\nYou can read the full [API documentation](docs/index.md) in the docs folder.\n\n\n## Issues\n\nhttps://github.com/eface2face/rtcninja.js/issues\n\n\n## Developer guide\n\n* Create a branch with a name including your user and a meaningful word about the fix/feature you're going to implement, ie: \"jesusprubio/fixstuff\"\n* Use [GitHub pull requests](https://help.github.com/articles/using-pull-requests).\n* Conventions:\n * We use [JSHint](http://jshint.com/) and [Crockford's Styleguide](http://javascript.crockford.com/code.html).\n * Please run `grunt lint` to be sure your code fits with them.\n\n\n### Debugging\n\nThe library includes the Node [debug](https://github.com/visionmedia/debug) module. In order to enable debugging:\n\nIn Node set the `DEBUG=rtcninja*` environment variable before running the application, or set it at the top of the script:\n\n```javascript\nprocess.env.DEBUG = 'rtcninja*';\n```\n\nIn the browser run `rtcninja.debug.enable('rtcninja*');` and reload the page. Note that the debugging settings are stored into the browser LocalStorage. To disable it run `rtcninja.debug.disable('rtcninja*');`.\n\n\n## Copyright & License\n\n* eFace2Face Inc.\n* [MIT](./LICENSE)\n", + "readmeFilename": "README.md", "gitHead": "7160d2718fcf4a2ca0f90641456f35aa7294b837", "bugs": { "url": "https://github.com/eface2face/rtcninja.js/issues" @@ -24971,29 +24973,7 @@ module.exports={ "_id": "rtcninja@0.7.0", "scripts": {}, "_shasum": "8a57d8e51ef0777f16105a33ac99e4de515cd540", - "_from": "rtcninja@>=0.7.0 <0.8.0", - "_npmVersion": "2.15.9", - "_nodeVersion": "4.5.0", - "_npmUser": { - "name": "ibc", - "email": "ibc@aliax.net" - }, - "dist": { - "shasum": "8a57d8e51ef0777f16105a33ac99e4de515cd540", - "tarball": "https://registry.npmjs.org/rtcninja/-/rtcninja-0.7.0.tgz" - }, - "maintainers": [ - { - "name": "ibc", - "email": "ibc@aliax.net" - } - ], - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/rtcninja-0.7.0.tgz_1475058681576_0.9719346789643168" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/rtcninja/-/rtcninja-0.7.0.tgz" + "_from": "rtcninja@>=0.7.0 <0.8.0" } },{}],43:[function(require,module,exports){ @@ -25488,10 +25468,10 @@ module.exports = function (session, opts) { },{"./grammar":43}],47:[function(require,module,exports){ module.exports={ - "name": "jssip", + "name": "jssip-rtcninja", "title": "JsSIP", "description": "the Javascript SIP library", - "version": "2.0.6", + "version": "2.0.7", "homepage": "http://jssip.net", "author": "José Luis Millán (https://github.com/jmillan)", "contributors": [ @@ -25516,7 +25496,7 @@ module.exports={ "url": "https://github.com/versatica/JsSIP/issues" }, "dependencies": { - "debug": "^2.2.0", + "debug": "2.3.0", "rtcninja": "^0.7.0", "sdp-transform": "^1.6.2" }, diff --git a/dist/jssip.min.js b/dist/jssip-rtcninja.min.js similarity index 90% rename from dist/jssip.min.js rename to dist/jssip-rtcninja.min.js index be91980..7336efa 100644 --- a/dist/jssip.min.js +++ b/dist/jssip-rtcninja.min.js @@ -1,16 +1,16 @@ /* - * JsSIP v2.0.6 + * JsSIP v2.0.7 * the Javascript SIP library * Copyright: 2012-2016 José Luis Millán (https://github.com/jmillan) * Homepage: http://jssip.net * License: MIT */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.JsSIP=e()}}(function(){var e;return function e(t,n,r){function s(i,o){if(!n[i]){if(!t[i]){var u="function"==typeof require&&require;if(!o&&u)return u(i,!0);if(l)return l(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return s(n?n:e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var l="function"==typeof require&&require,i=0;ithis.remote_seqnum&&(this.remote_seqnum=e.cseq)}else this.remote_seqnum=e.cseq;if(e.method===o.INVITE||e.method===o.UPDATE&&e.body){if(this.uac_pending_reply===!0)e.reply(491);else{if(this.uas_pending_reply===!0){var n=(10*Math.random()|0)+1;return e.reply(500,null,["Retry-After:"+n]),!1}this.uas_pending_reply=!0,e.server_transaction.on("stateChanged",function n(){this.state!==u.C.STATUS_ACCEPTED&&this.state!==u.C.STATUS_COMPLETED&&this.state!==u.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),t.uas_pending_reply=!1)})}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){this.state===u.C.STATUS_ACCEPTED&&(t.remote_target=e.parseHeader("contact").uri)})}else e.method===o.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){this.state===u.C.STATUS_COMPLETED&&(t.remote_target=e.parseHeader("contact").uri)});return!0},sendRequest:function(e,t,n){n=n||{};var r=n.extraHeaders&&n.extraHeaders.slice()||[],s=n.body||null,l=this.createRequest(t,r,s),i=new a(this,e,l);return i.send(),l},receiveRequest:function(e){this.checkInDialogRequest(e)&&this.owner.receiveRequest(e)}}},{"./Constants":1,"./Dialog/RequestSender":3,"./SIPMessage":18,"./Transactions":21,debug:33}],3:[function(e,t,n){function r(e,t,n){this.dialog=e,this.applicant=t,this.request=n,this.reattempt=!1,this.reattemptTimer=null}t.exports=r;var s=e("../Constants"),l=e("../Transactions"),i=e("../RTCSession"),o=e("../RequestSender");r.prototype={send:function(){var e=this,t=new o(this,this.dialog.owner.ua);t.send(),(this.request.method===s.INVITE||this.request.method===s.UPDATE&&this.request.body)&&t.clientTransaction.state!==l.C.STATUS_TERMINATED&&(this.dialog.uac_pending_reply=!0,t.clientTransaction.on("stateChanged",function n(){this.state!==l.C.STATUS_ACCEPTED&&this.state!==l.C.STATUS_COMPLETED&&this.state!==l.C.STATUS_TERMINATED||(t.clientTransaction.removeListener("stateChanged",n),e.dialog.uac_pending_reply=!1)}))},onRequestTimeout:function(){this.applicant.onRequestTimeout()},onTransportError:function(){this.applicant.onTransportError()},receiveResponse:function(e){var t=this;408===e.status_code||481===e.status_code?this.applicant.onDialogError(e):e.method===s.INVITE&&491===e.status_code?this.reattempt?this.applicant.receiveResponse(e):(this.request.cseq.value=this.dialog.local_seqnum+=1,this.reattemptTimer=setTimeout(function(){t.applicant.owner.status!==i.C.STATUS_TERMINATED&&(t.reattempt=!0,t.request_sender.send())},1e3)):this.applicant.receiveResponse(e)}}},{"../Constants":1,"../RTCSession":11,"../RequestSender":17,"../Transactions":21}],4:[function(e,t,n){function r(e){this.credentials=e,this.cnonce=null,this.nc=0,this.ncHex="00000000",this.algorithm=null,this.realm=null,this.nonce=null,this.opaque=null,this.stale=null,this.qop=null,this.method=null,this.uri=null,this.ha1=null,this.response=null}t.exports=r;var s=e("debug")("JsSIP:DigestAuthentication"),l=e("debug")("JsSIP:ERROR:DigestAuthentication");l.log=console.warn.bind(console);var i=e("./Utils");r.prototype.get=function(e){switch(e){case"realm":return this.realm;case"ha1":return this.ha1;default:return void l('get() | cannot get "%s" parameter',e)}},r.prototype.authenticate=function(e,t){var n,r;if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if("MD5"!==this.algorithm)return l('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this.algorithm="MD5";if(!this.nonce)return l("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this.realm)return l("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this.credentials.password){if(!this.credentials.ha1)return l("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this.credentials.realm!==this.realm)return l('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]',this.credentials.realm,this.realm),!1}if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else{if(!(t.qop.indexOf("auth-int")>-1))return l('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this.qop="auth-int"}else this.qop=null;return this.method=e.method,this.uri=e.ruri,this.cnonce=i.createRandomToken(12),this.nc+=1,r=Number(this.nc).toString(16),this.ncHex="00000000".substr(0,8-r.length)+r,4294967296===this.nc&&(this.nc=1,this.ncHex="00000001"),this.credentials.password?this.ha1=i.calculateMD5(this.credentials.username+":"+this.realm+":"+this.credentials.password):this.ha1=this.credentials.ha1,"auth"===this.qop?(n=i.calculateMD5(this.method+":"+this.uri),this.response=i.calculateMD5(this.ha1+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+n)):"auth-int"===this.qop?(n=i.calculateMD5(this.method+":"+this.uri+":"+i.calculateMD5(this.body?this.body:"")),this.response=i.calculateMD5(this.ha1+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+n)):null===this.qop&&(n=i.calculateMD5(this.method+":"+this.uri),this.response=i.calculateMD5(this.ha1+":"+this.nonce+":"+n)),s("authenticate() | response generated"),!0},r.prototype.toString=function(){var e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.credentials.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}},{"./Utils":25,debug:33}],5:[function(e,t,n){var r={ConfigurationError:function(){var e=function(e,t){this.code=1,this.name="CONFIGURATION_ERROR",this.parameter=e,this.value=t,this.message=this.value?"Invalid value "+JSON.stringify(this.value)+' for parameter "'+this.parameter+'"':"Missing parameter: "+this.parameter};return e.prototype=new Error,e}(),InvalidStateError:function(){var e=function(e){this.code=2,this.name="INVALID_STATE_ERROR",this.status=e,this.message="Invalid status: "+e};return e.prototype=new Error,e}(),NotSupportedError:function(){var e=function(e){this.code=3,this.name="NOT_SUPPORTED_ERROR",this.message=e};return e.prototype=new Error,e}(),NotReadyError:function(){var e=function(e){this.code=4,this.name="NOT_READY_ERROR",this.message=e};return e.prototype=new Error,e}()};t.exports=r},{}],6:[function(e,t,n){t.exports=function(){function t(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var n={parse:function(n,r){function s(e){_rCr&&(Cr=_r,Sr=[]),Sr.push(e))}function l(){var e;return"\r\n"===n.substr(_r,2)?(e="\r\n",_r+=2):(e=null,0===vr&&s('"\\r\\n"')),e}function i(){var e;return/^[0-9]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[0-9]")),e}function o(){var e;return/^[a-zA-Z]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[a-zA-Z]")),e}function u(){var e;return/^[0-9a-fA-F]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[0-9a-fA-F]")),e}function a(){var e;return e=d(),null===e&&(e=p()),e}function c(){var e;return/^[\0-\xFF]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\0-\\xFF]")),e}function h(){var e;return/^["]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s('["]')),e}function d(){var e;return 32===n.charCodeAt(_r)?(e=" ",_r++):(e=null,0===vr&&s('" "')),e}function p(){var e;return 9===n.charCodeAt(_r)?(e="\t",_r++):(e=null,0===vr&&s('"\\t"')),e}function f(){var e;return/^[a-zA-Z0-9]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[a-zA-Z0-9]")),e}function m(){var e;return 59===n.charCodeAt(_r)?(e=";",_r++):(e=null,0===vr&&s('";"')),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(64===n.charCodeAt(_r)?(e="@",_r++):(e=null,0===vr&&s('"@"')),null===e&&(38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","'))))))))))),e}function g(){var e;return e=f(),null===e&&(e=T()),e}function T(){var e;return 45===n.charCodeAt(_r)?(e="-",_r++):(e=null,0===vr&&s('"-"')),null===e&&(95===n.charCodeAt(_r)?(e="_",_r++):(e=null,0===vr&&s('"_"')),null===e&&(46===n.charCodeAt(_r)?(e=".",_r++):(e=null,0===vr&&s('"."')),null===e&&(33===n.charCodeAt(_r)?(e="!",_r++):(e=null,0===vr&&s('"!"')),null===e&&(126===n.charCodeAt(_r)?(e="~",_r++):(e=null,0===vr&&s('"~"')),null===e&&(42===n.charCodeAt(_r)?(e="*",_r++):(e=null,0===vr&&s('"*"')),null===e&&(39===n.charCodeAt(_r)?(e="'",_r++):(e=null,0===vr&&s('"\'"')),null===e&&(40===n.charCodeAt(_r)?(e="(",_r++):(e=null,0===vr&&s('"("')),null===e&&(41===n.charCodeAt(_r)?(e=")",_r++):(e=null,0===vr&&s('")"')))))))))),e}function _(){var e,t,r,l,i;return l=_r,i=_r,37===n.charCodeAt(_r)?(e="%",_r++):(e=null,0===vr&&s('"%"')),null!==e?(t=u(),null!==t?(r=u(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e,t){return t.join("")}(l,e)),null===e&&(_r=l),e}function v(){var e,t,n,r,s,i;for(r=_r,s=_r,i=_r,e=[],t=a();null!==t;)e.push(t),t=a();if(null!==e?(t=l(),null!==t?e=[e,t]:(e=null,_r=i)):(e=null,_r=i),e=null!==e?e:"",null!==e){if(n=a(),null!==n)for(t=[];null!==n;)t.push(n),n=a();else t=null;null!==t?e=[e,t]:(e=null,_r=s)}else e=null,_r=s;return null!==e&&(e=function(e){return" "}(r)),null===e&&(_r=r),e}function C(){var e;return e=v(),e=null!==e?e:""}function S(){var e,t,r,l,i;for(l=_r,i=_r,e=[],t=d(),null===t&&(t=p());null!==t;)e.push(t),t=d(),null===t&&(t=p());return null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return":"}(l)),null===e&&(_r=l),e}function E(){var e,t,r,s,l,i,o;if(l=_r,i=_r,t=A(),null!==t)for(e=[];null!==t;)e.push(t),t=A();else e=null;if(null!==e){for(t=[],o=_r,r=[],s=v();null!==s;)r.push(s),s=v();for(null!==r?(s=A(),null!==s?r=[r,s]:(r=null,_r=o)):(r=null,_r=o);null!==r;){for(t.push(r),o=_r,r=[],s=v();null!==s;)r.push(s),s=v();null!==r?(s=A(),null!==s?r=[r,s]:(r=null,_r=o)):(r=null,_r=o)}null!==t?e=[e,t]:(e=null,_r=i)}else e=null,_r=i;return null!==e&&(e=function(e){return n.substring(_r,e)}(l)),null===e&&(_r=l),e}function A(){var e;return/^[!-~]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[!-~]")),null===e&&(e=y()),e}function y(){var e;return/^[\x80-\uFFFF]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\x80-\\uFFFF]")),e}function R(){var e;return/^[\x80-\xBF]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\x80-\\xBF]")),e}function b(){var e;return e=i(),null===e&&(/^[a-f]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[a-f]"))),e}function I(){var e,t,r;if(r=_r,t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"')))))))))))),null!==t)for(e=[];null!==t;)e.push(t),t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"'))))))))))));else e=null;return null!==e&&(e=function(e){return n.substring(_r,e)}(r)),null===e&&(_r=r),e}function w(){var e,t,r;if(r=_r,t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"'))))))))))),null!==t)for(e=[];null!==t;)e.push(t),t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"')))))))))));else e=null;return null!==e&&(e=function(e){return n.substring(_r,e)}(r)),null===e&&(_r=r),e}function N(){var e;return 40===n.charCodeAt(_r)?(e="(",_r++):(e=null,0===vr&&s('"("')),null===e&&(41===n.charCodeAt(_r)?(e=")",_r++):(e=null,0===vr&&s('")"')),null===e&&(60===n.charCodeAt(_r)?(e="<",_r++):(e=null,0===vr&&s('"<"')),null===e&&(62===n.charCodeAt(_r)?(e=">",_r++):(e=null,0===vr&&s('">"')),null===e&&(64===n.charCodeAt(_r)?(e="@",_r++):(e=null,0===vr&&s('"@"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","')),null===e&&(59===n.charCodeAt(_r)?(e=";",_r++):(e=null,0===vr&&s('";"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(92===n.charCodeAt(_r)?(e="\\",_r++):(e=null,0===vr&&s('"\\\\"')),null===e&&(e=h(),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null===e&&(91===n.charCodeAt(_r)?(e="[",_r++):(e=null,0===vr&&s('"["')),null===e&&(93===n.charCodeAt(_r)?(e="]",_r++):(e=null,0===vr&&s('"]"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(123===n.charCodeAt(_r)?(e="{",_r++):(e=null,0===vr&&s('"{"')),null===e&&(125===n.charCodeAt(_r)?(e="}",_r++):(e=null,0===vr&&s('"}"')),null===e&&(e=d(),null===e&&(e=p())))))))))))))))))),e}function D(){var e,t,r;if(r=_r,t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"')),null===t&&(40===n.charCodeAt(_r)?(t="(",_r++):(t=null,0===vr&&s('"("')),null===t&&(41===n.charCodeAt(_r)?(t=")",_r++):(t=null,0===vr&&s('")"')),null===t&&(60===n.charCodeAt(_r)?(t="<",_r++):(t=null,0===vr&&s('"<"')),null===t&&(62===n.charCodeAt(_r)?(t=">",_r++):(t=null,0===vr&&s('">"')),null===t&&(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null===t&&(92===n.charCodeAt(_r)?(t="\\",_r++):(t=null,0===vr&&s('"\\\\"')),null===t&&(t=h(),null===t&&(47===n.charCodeAt(_r)?(t="/",_r++):(t=null,0===vr&&s('"/"')),null===t&&(91===n.charCodeAt(_r)?(t="[",_r++):(t=null,0===vr&&s('"["')),null===t&&(93===n.charCodeAt(_r)?(t="]",_r++):(t=null,0===vr&&s('"]"')),null===t&&(63===n.charCodeAt(_r)?(t="?",_r++):(t=null,0===vr&&s('"?"')),null===t&&(123===n.charCodeAt(_r)?(t="{",_r++):(t=null,0===vr&&s('"{"')),null===t&&(125===n.charCodeAt(_r)?(t="}",_r++):(t=null,0===vr&&s('"}"'))))))))))))))))))))))))),null!==t)for(e=[];null!==t;)e.push(t),t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"')),null===t&&(40===n.charCodeAt(_r)?(t="(",_r++):(t=null,0===vr&&s('"("')),null===t&&(41===n.charCodeAt(_r)?(t=")",_r++):(t=null,0===vr&&s('")"')),null===t&&(60===n.charCodeAt(_r)?(t="<",_r++):(t=null,0===vr&&s('"<"')),null===t&&(62===n.charCodeAt(_r)?(t=">",_r++):(t=null,0===vr&&s('">"')),null===t&&(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null===t&&(92===n.charCodeAt(_r)?(t="\\",_r++):(t=null,0===vr&&s('"\\\\"')),null===t&&(t=h(),null===t&&(47===n.charCodeAt(_r)?(t="/",_r++):(t=null,0===vr&&s('"/"')),null===t&&(91===n.charCodeAt(_r)?(t="[",_r++):(t=null,0===vr&&s('"["')),null===t&&(93===n.charCodeAt(_r)?(t="]",_r++):(t=null,0===vr&&s('"]"')),null===t&&(63===n.charCodeAt(_r)?(t="?",_r++):(t=null,0===vr&&s('"?"')),null===t&&(123===n.charCodeAt(_r)?(t="{",_r++):(t=null,0===vr&&s('"{"')),null===t&&(125===n.charCodeAt(_r)?(t="}",_r++):(t=null,0===vr&&s('"}"')))))))))))))))))))))))));else e=null;return null!==e&&(e=function(e){return n.substring(_r,e)}(r)),null===e&&(_r=r),e}function O(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return"*"}(l)),null===e&&(_r=l),e}function x(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(47===n.charCodeAt(_r)?(t="/",_r++):(t=null,0===vr&&s('"/"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return"/"}(l)),null===e&&(_r=l),e}function U(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return"="}(l)),null===e&&(_r=l),e}function M(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(40===n.charCodeAt(_r)?(t="(",_r++):(t=null,0===vr&&s('"("')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return"("}(l)),null===e&&(_r=l),e}function P(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(41===n.charCodeAt(_r)?(t=")",_r++):(t=null,0===vr&&s('")"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return")"}(l)),null===e&&(_r=l),e}function q(){var e,t,r,l;return r=_r,l=_r,62===n.charCodeAt(_r)?(e=">",_r++):(e=null,0===vr&&s('">"')),null!==e?(t=C(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e){return">"}(r)),null===e&&(_r=r),e}function L(){var e,t,r,l;return r=_r,l=_r,e=C(),null!==e?(60===n.charCodeAt(_r)?(t="<",_r++):(t=null,0===vr&&s('"<"')),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e){return"<"}(r)),null===e&&(_r=r),e}function H(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return","}(l)),null===e&&(_r=l),e}function k(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return";"}(l)),null===e&&(_r=l),e}function F(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return":"}(l)),null===e&&(_r=l),e}function G(){var e,t,n,r;return n=_r,r=_r,e=C(),null!==e?(t=h(),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),null!==e&&(e=function(e){return'"'}(n)),null===e&&(_r=n),e}function j(){var e,t,n,r;return n=_r,r=_r,e=h(),null!==e?(t=C(),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),null!==e&&(e=function(e){return'"'}(n)),null===e&&(_r=n),e}function W(){var e,t,n,r;if(r=_r,e=M(),null!==e){for(t=[],n=B(),null===n&&(n=Y(),null===n&&(n=W()));null!==n;)t.push(n),n=B(),null===n&&(n=Y(),null===n&&(n=W()));null!==t?(n=P(),null!==n?e=[e,t,n]:(e=null,_r=r)):(e=null,_r=r)}else e=null,_r=r;return e}function B(){var e;return/^[!-']/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[!-']")),null===e&&(/^[*-[]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[*-[]")),null===e&&(/^[\]-~]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\]-~]")),null===e&&(e=y(),null===e&&(e=v())))),e}function z(){var e,t,r,s,l,i;if(l=_r,i=_r,e=C(),null!==e)if(t=h(),null!==t){for(r=[],s=K(),null===s&&(s=Y());null!==s;)r.push(s),s=K(),null===s&&(s=Y());null!==r?(s=h(),null!==s?e=[e,t,r,s]:(e=null,_r=i)):(e=null,_r=i)}else e=null,_r=i;else e=null,_r=i;return null!==e&&(e=function(e){return n.substring(_r,e)}(l)),null===e&&(_r=l),e}function V(){var e,t,r,s,l,i;if(l=_r,i=_r,e=C(),null!==e)if(t=h(),null!==t){for(r=[],s=K(),null===s&&(s=Y());null!==s;)r.push(s),s=K(),null===s&&(s=Y());null!==r?(s=h(),null!==s?e=[e,t,r,s]:(e=null,_r=i)):(e=null,_r=i)}else e=null,_r=i;else e=null,_r=i;return null!==e&&(e=function(e){return n.substring(_r-1,e+1)}(l)),null===e&&(_r=l),e}function K(){var e;return e=v(),null===e&&(33===n.charCodeAt(_r)?(e="!",_r++):(e=null,0===vr&&s('"!"')),null===e&&(/^[#-[]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[#-[]")),null===e&&(/^[\]-~]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\]-~]")),null===e&&(e=y())))),e}function Y(){var e,t,r;return r=_r,92===n.charCodeAt(_r)?(e="\\",_r++):(e=null,0===vr&&s('"\\\\"')),null!==e?(/^[\0-\t]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[\\0-\\t]")),null===t&&(/^[\x0B-\f]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[\\x0B-\\f]")),null===t&&(/^[\x0E-]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[\\x0E-]")))),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),e}function J(){var e,t,r,l,i,o;return i=_r,o=_r,e=X(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=ee(),r=null!==r?r:"",null!==r?(l=se(),null!==l?e=[e,t,r,l]:(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o),null!==e&&(e=function(e){try{yr.uri=new Er(yr.scheme,yr.user,yr.host,yr.port),delete yr.scheme,delete yr.user,delete yr.host,delete yr.host_type,delete yr.port}catch(e){yr=-1}}(i)),null===e&&(_r=i),e}function $(){var e,t,l,i,o,u,a,c;return a=_r,c=_r,e=X(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(l=ee(),l=null!==l?l:"",null!==l?(i=se(),null!==i?(o=ge(),null!==o?(u=Ne(),u=null!==u?u:"",null!==u?e=[e,t,l,i,o,u]:(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c),null!==e&&(e=function(e){try{yr.uri=new Er(yr.scheme,yr.user,yr.host,yr.port,yr.uri_params,yr.uri_headers),delete yr.scheme,delete yr.user,delete yr.host,delete yr.host_type,delete yr.port,delete yr.uri_params,"SIP_URI"===r&&(yr=yr.uri)}catch(e){yr=-1}}(a)),null===e&&(_r=a),e}function X(){var e;return e=Q(),null===e&&(e=Z()),e}function Q(){var e,t;return t=_r,"sips"===n.substr(_r,4).toLowerCase()?(e=n.substr(_r,4),_r+=4):(e=null,0===vr&&s('"sips"')),null!==e&&(e=function(e,t){yr.scheme=t.toLowerCase()}(t,e)),null===e&&(_r=t),e}function Z(){var e,t;return t=_r,"sip"===n.substr(_r,3).toLowerCase()?(e=n.substr(_r,3),_r+=3):(e=null,0===vr&&s('"sip"')),null!==e&&(e=function(e,t){yr.scheme=t.toLowerCase()}(t,e)),null===e&&(_r=t),e}function ee(){var e,t,r,l,i,o;return l=_r,i=_r,e=te(),null!==e?(o=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=re(),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o),t=null!==t?t:"",null!==t?(64===n.charCodeAt(_r)?(r="@", -_r++):(r=null,0===vr&&s('"@"')),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){yr.user=decodeURIComponent(n.substring(_r-1,e))}(l)),null===e&&(_r=l),e}function te(){var e,t;if(t=g(),null===t&&(t=_(),null===t&&(t=ne())),null!==t)for(e=[];null!==t;)e.push(t),t=g(),null===t&&(t=_(),null===t&&(t=ne()));else e=null;return e}function ne(){var e;return 38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","')),null===e&&(59===n.charCodeAt(_r)?(e=";",_r++):(e=null,0===vr&&s('";"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"'))))))))),e}function re(){var e,t,r;for(r=_r,e=[],t=g(),null===t&&(t=_(),null===t&&(38===n.charCodeAt(_r)?(t="&",_r++):(t=null,0===vr&&s('"&"')),null===t&&(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(36===n.charCodeAt(_r)?(t="$",_r++):(t=null,0===vr&&s('"$"')),null===t&&(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","'))))))));null!==t;)e.push(t),t=g(),null===t&&(t=_(),null===t&&(38===n.charCodeAt(_r)?(t="&",_r++):(t=null,0===vr&&s('"&"')),null===t&&(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(36===n.charCodeAt(_r)?(t="$",_r++):(t=null,0===vr&&s('"$"')),null===t&&(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","'))))))));return null!==e&&(e=function(e){yr.password=n.substring(_r,e)}(r)),null===e&&(_r=r),e}function se(){var e,t,r,l,i;return l=_r,e=le(),null!==e?(i=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=me(),null!==r?t=[t,r]:(t=null,_r=i)):(t=null,_r=i),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),e}function le(){var e,t;return t=_r,e=ie(),null===e&&(e=pe(),null===e&&(e=ae())),null!==e&&(e=function(e){return yr.host=n.substring(_r,e).toLowerCase(),yr.host}(t)),null===e&&(_r=t),e}function ie(){var e,t,r,l,i,o;for(l=_r,i=_r,e=[],o=_r,t=oe(),null!==t?(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."')),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o);null!==t;)e.push(t),o=_r,t=oe(),null!==t?(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."')),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o);return null!==e?(t=ue(),null!==t?(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."')),r=null!==r?r:"",null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return yr.host_type="domain",n.substring(_r,e)}(l)),null===e&&(_r=l),e}function oe(){var e,t,r,l;if(l=_r,e=f(),null!==e){for(t=[],r=f(),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(95===n.charCodeAt(_r)?(r="_",_r++):(r=null,0===vr&&s('"_"'))));null!==r;)t.push(r),r=f(),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(95===n.charCodeAt(_r)?(r="_",_r++):(r=null,0===vr&&s('"_"'))));null!==t?e=[e,t]:(e=null,_r=l)}else e=null,_r=l;return e}function ue(){var e,t,r,l;if(l=_r,e=o(),null!==e){for(t=[],r=f(),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(95===n.charCodeAt(_r)?(r="_",_r++):(r=null,0===vr&&s('"_"'))));null!==r;)t.push(r),r=f(),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(95===n.charCodeAt(_r)?(r="_",_r++):(r=null,0===vr&&s('"_"'))));null!==t?e=[e,t]:(e=null,_r=l)}else e=null,_r=l;return e}function ae(){var e,t,r,l,i;return l=_r,i=_r,91===n.charCodeAt(_r)?(e="[",_r++):(e=null,0===vr&&s('"["')),null!==e?(t=ce(),null!==t?(93===n.charCodeAt(_r)?(r="]",_r++):(r=null,0===vr&&s('"]"')),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return yr.host_type="IPv6",n.substring(_r,e)}(l)),null===e&&(_r=l),e}function ce(){var e,t,r,l,i,o,u,a,c,h,d,p,f,m,g,T;return m=_r,g=_r,e=he(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?(58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?(58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?(58===n.charCodeAt(_r)?(a=":",_r++):(a=null,0===vr&&s('":"')),null!==a?(c=he(),null!==c?(58===n.charCodeAt(_r)?(h=":",_r++):(h=null,0===vr&&s('":"')),null!==h?(d=he(),null!==d?(58===n.charCodeAt(_r)?(p=":",_r++):(p=null,0===vr&&s('":"')),null!==p?(f=de(),null!==f?e=[e,t,r,l,i,o,u,a,c,h,d,p,f]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=he(),null!==a?(58===n.charCodeAt(_r)?(c=":",_r++):(c=null,0===vr&&s('":"')),null!==c?(h=he(),null!==h?(58===n.charCodeAt(_r)?(d=":",_r++):(d=null,0===vr&&s('":"')),null!==d?(p=de(),null!==p?e=[e,t,r,l,i,o,u,a,c,h,d,p]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=he(),null!==a?(58===n.charCodeAt(_r)?(c=":",_r++):(c=null,0===vr&&s('":"')),null!==c?(h=de(),null!==h?e=[e,t,r,l,i,o,u,a,c,h]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=de(),null!==a?e=[e,t,r,l,i,o,u,a]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=de(),null!==o?e=[e,t,r,l,i,o]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=de(),null!==l?e=[e,t,r,l]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=de(),null!==t?e=[e,t]:(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?e=[e,t]:(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?("::"===n.substr(_r,2)?(t="::",_r+=2):(t=null,0===vr&&s('"::"')),null!==t?(r=he(),null!==r?(58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?(58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?(58===n.charCodeAt(_r)?(a=":",_r++):(a=null,0===vr&&s('":"')),null!==a?(c=he(),null!==c?(58===n.charCodeAt(_r)?(h=":",_r++):(h=null,0===vr&&s('":"')),null!==h?(d=de(),null!==d?e=[e,t,r,l,i,o,u,a,c,h,d]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?("::"===n.substr(_r,2)?(r="::",_r+=2):(r=null,0===vr&&s('"::"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=he(),null!==a?(58===n.charCodeAt(_r)?(c=":",_r++):(c=null,0===vr&&s('":"')),null!==c?(h=de(),null!==h?e=[e,t,r,l,i,o,u,a,c,h]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?("::"===n.substr(_r,2)?(l="::",_r+=2):(l=null,0===vr&&s('"::"')),null!==l?(i=he(),null!==i?(58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?(58===n.charCodeAt(_r)?(a=":",_r++):(a=null,0===vr&&s('":"')),null!==a?(c=de(),null!==c?e=[e,t,r,l,i,o,u,a,c]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?(T=_r,58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?l=[l,i]:(l=null,_r=T)):(l=null,_r=T),l=null!==l?l:"",null!==l?("::"===n.substr(_r,2)?(i="::",_r+=2):(i=null,0===vr&&s('"::"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=de(),null!==a?e=[e,t,r,l,i,o,u,a]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?(T=_r,58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?l=[l,i]:(l=null,_r=T)):(l=null,_r=T),l=null!==l?l:"",null!==l?(T=_r,58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?i=[i,o]:(i=null,_r=T)):(i=null,_r=T),i=null!==i?i:"",null!==i?("::"===n.substr(_r,2)?(o="::",_r+=2):(o=null,0===vr&&s('"::"')),null!==o?(u=de(),null!==u?e=[e,t,r,l,i,o,u]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?(T=_r,58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?l=[l,i]:(l=null,_r=T)):(l=null,_r=T),l=null!==l?l:"",null!==l?(T=_r,58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?i=[i,o]:(i=null,_r=T)):(i=null,_r=T),i=null!==i?i:"",null!==i?(T=_r,58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?o=[o,u]:(o=null,_r=T)):(o=null,_r=T),o=null!==o?o:"",null!==o?("::"===n.substr(_r,2)?(u="::",_r+=2):(u=null,0===vr&&s('"::"')),null!==u?(a=he(),null!==a?e=[e,t,r,l,i,o,u,a]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?(T=_r,58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?l=[l,i]:(l=null,_r=T)):(l=null,_r=T),l=null!==l?l:"",null!==l?(T=_r,58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?i=[i,o]:(i=null,_r=T)):(i=null,_r=T),i=null!==i?i:"",null!==i?(T=_r,58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?o=[o,u]:(o=null,_r=T)):(o=null,_r=T),o=null!==o?o:"",null!==o?(T=_r,58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=he(),null!==a?u=[u,a]:(u=null,_r=T)):(u=null,_r=T),u=null!==u?u:"",null!==u?("::"===n.substr(_r,2)?(a="::",_r+=2):(a=null,0===vr&&s('"::"')),null!==a?e=[e,t,r,l,i,o,u,a]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g))))))))))))))),null!==e&&(e=function(e){return yr.host_type="IPv6",n.substring(_r,e)}(m)),null===e&&(_r=m),e}function he(){var e,t,n,r,s;return s=_r,e=u(),null!==e?(t=u(),t=null!==t?t:"",null!==t?(n=u(),n=null!==n?n:"",null!==n?(r=u(),r=null!==r?r:"",null!==r?e=[e,t,n,r]:(e=null,_r=s)):(e=null,_r=s)):(e=null,_r=s)):(e=null,_r=s),e}function de(){var e,t,r,l;return l=_r,e=he(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),null===e&&(e=pe()),e}function pe(){var e,t,r,l,i,o,u,a,c;return a=_r,c=_r,e=fe(),null!==e?(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null!==t?(r=fe(),null!==r?(46===n.charCodeAt(_r)?(l=".",_r++):(l=null,0===vr&&s('"."')),null!==l?(i=fe(),null!==i?(46===n.charCodeAt(_r)?(o=".",_r++):(o=null,0===vr&&s('"."')),null!==o?(u=fe(),null!==u?e=[e,t,r,l,i,o,u]:(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c),null!==e&&(e=function(e){return yr.host_type="IPv4",n.substring(_r,e)}(a)),null===e&&(_r=a),e}function fe(){var e,t,r,l;return l=_r,"25"===n.substr(_r,2)?(e="25",_r+=2):(e=null,0===vr&&s('"25"')),null!==e?(/^[0-5]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[0-5]")),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null===e&&(l=_r,50===n.charCodeAt(_r)?(e="2",_r++):(e=null,0===vr&&s('"2"')),null!==e?(/^[0-4]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[0-4]")),null!==t?(r=i(),null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),null===e&&(l=_r,49===n.charCodeAt(_r)?(e="1",_r++):(e=null,0===vr&&s('"1"')),null!==e?(t=i(),null!==t?(r=i(),null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),null===e&&(l=_r,/^[1-9]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[1-9]")),null!==e?(t=i(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null===e&&(e=i())))),e}function me(){var e,t,n,r,s,l,o;return l=_r,o=_r,e=i(),e=null!==e?e:"",null!==e?(t=i(),t=null!==t?t:"",null!==t?(n=i(),n=null!==n?n:"",null!==n?(r=i(),r=null!==r?r:"",null!==r?(s=i(),s=null!==s?s:"",null!==s?e=[e,t,n,r,s]:(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o),null!==e&&(e=function(e,t){return t=parseInt(t.join("")),yr.port=t,t}(l,e)),null===e&&(_r=l),e}function ge(){var e,t,r,l;for(e=[],l=_r,59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null!==t?(r=Te(),null!==r?t=[t,r]:(t=null,_r=l)):(t=null,_r=l);null!==t;)e.push(t),l=_r,59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null!==t?(r=Te(),null!==r?t=[t,r]:(t=null,_r=l)):(t=null,_r=l);return e}function Te(){var e;return e=_e(),null===e&&(e=ve(),null===e&&(e=Ce(),null===e&&(e=Se(),null===e&&(e=Ee(),null===e&&(e=Ae(),null===e&&(e=ye())))))),e}function _e(){var e,t,r,l;return r=_r,l=_r,"transport="===n.substr(_r,10).toLowerCase()?(e=n.substr(_r,10),_r+=10):(e=null,0===vr&&s('"transport="')),null!==e?("udp"===n.substr(_r,3).toLowerCase()?(t=n.substr(_r,3),_r+=3):(t=null,0===vr&&s('"udp"')),null===t&&("tcp"===n.substr(_r,3).toLowerCase()?(t=n.substr(_r,3),_r+=3):(t=null,0===vr&&s('"tcp"')),null===t&&("sctp"===n.substr(_r,4).toLowerCase()?(t=n.substr(_r,4),_r+=4):(t=null,0===vr&&s('"sctp"')),null===t&&("tls"===n.substr(_r,3).toLowerCase()?(t=n.substr(_r,3),_r+=3):(t=null,0===vr&&s('"tls"')),null===t&&(t=I())))),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.uri_params||(yr.uri_params={}),yr.uri_params.transport=t.toLowerCase()}(r,e[1])),null===e&&(_r=r),e}function ve(){var e,t,r,l;return r=_r,l=_r,"user="===n.substr(_r,5).toLowerCase()?(e=n.substr(_r,5),_r+=5):(e=null,0===vr&&s('"user="')),null!==e?("phone"===n.substr(_r,5).toLowerCase()?(t=n.substr(_r,5),_r+=5):(t=null,0===vr&&s('"phone"')),null===t&&("ip"===n.substr(_r,2).toLowerCase()?(t=n.substr(_r,2),_r+=2):(t=null,0===vr&&s('"ip"')),null===t&&(t=I())),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.uri_params||(yr.uri_params={}),yr.uri_params.user=t.toLowerCase()}(r,e[1])),null===e&&(_r=r),e}function Ce(){var e,t,r,l;return r=_r,l=_r,"method="===n.substr(_r,7).toLowerCase()?(e=n.substr(_r,7),_r+=7):(e=null,0===vr&&s('"method="')),null!==e?(t=at(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.uri_params||(yr.uri_params={}),yr.uri_params.method=t}(r,e[1])),null===e&&(_r=r),e}function Se(){var e,t,r,l;return r=_r,l=_r,"ttl="===n.substr(_r,4).toLowerCase()?(e=n.substr(_r,4),_r+=4):(e=null,0===vr&&s('"ttl="')),null!==e?(t=Yn(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.params||(yr.params={}),yr.params.ttl=t}(r,e[1])),null===e&&(_r=r),e}function Ee(){var e,t,r,l;return r=_r,l=_r,"maddr="===n.substr(_r,6).toLowerCase()?(e=n.substr(_r,6),_r+=6):(e=null,0===vr&&s('"maddr="')),null!==e?(t=le(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.uri_params||(yr.uri_params={}),yr.uri_params.maddr=t}(r,e[1])),null===e&&(_r=r),e}function Ae(){var e,t,r,l,i,o;return l=_r,i=_r,"lr"===n.substr(_r,2).toLowerCase()?(e=n.substr(_r,2),_r+=2):(e=null,0===vr&&s('"lr"')),null!==e?(o=_r,61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null!==t?(r=I(),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){yr.uri_params||(yr.uri_params={}),yr.uri_params.lr=void 0}(l)),null===e&&(_r=l),e}function ye(){var e,t,r,l,i,o;return l=_r,i=_r,e=Re(),null!==e?(o=_r,61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null!==t?(r=be(),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e,t,n){yr.uri_params||(yr.uri_params={}),n="undefined"==typeof n?void 0:n[1],yr.uri_params[t.toLowerCase()]=n}(l,e[0],e[1])),null===e&&(_r=l),e}function Re(){var e,t,n;if(n=_r,t=Ie(),null!==t)for(e=[];null!==t;)e.push(t),t=Ie();else e=null;return null!==e&&(e=function(e,t){return t.join("")}(n,e)),null===e&&(_r=n),e}function be(){var e,t,n;if(n=_r,t=Ie(),null!==t)for(e=[];null!==t;)e.push(t),t=Ie();else e=null;return null!==e&&(e=function(e,t){return t.join("")}(n,e)),null===e&&(_r=n),e}function Ie(){var e;return e=we(),null===e&&(e=g(),null===e&&(e=_())),e}function we(){var e;return 91===n.charCodeAt(_r)?(e="[",_r++):(e=null,0===vr&&s('"["')),null===e&&(93===n.charCodeAt(_r)?(e="]",_r++):(e=null,0===vr&&s('"]"')),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')))))))),e}function Ne(){var e,t,r,l,i,o,u;if(o=_r,63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null!==e)if(t=De(),null!==t){for(r=[],u=_r,38===n.charCodeAt(_r)?(l="&",_r++):(l=null,0===vr&&s('"&"')),null!==l?(i=De(),null!==i?l=[l,i]:(l=null,_r=u)):(l=null,_r=u);null!==l;)r.push(l),u=_r,38===n.charCodeAt(_r)?(l="&",_r++):(l=null,0===vr&&s('"&"')),null!==l?(i=De(),null!==i?l=[l,i]:(l=null,_r=u)):(l=null,_r=u);null!==r?e=[e,t,r]:(e=null,_r=o)}else e=null,_r=o;else e=null,_r=o;return e}function De(){var e,t,r,l,i;return l=_r,i=_r,e=Oe(),null!==e?(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null!==t?(r=xe(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e,t,n){t=t.join("").toLowerCase(),n=n.join(""),yr.uri_headers||(yr.uri_headers={}),yr.uri_headers[t]?yr.uri_headers[t].push(n):yr.uri_headers[t]=[n]}(l,e[0],e[2])),null===e&&(_r=l),e}function Oe(){var e,t;if(t=Ue(),null===t&&(t=g(),null===t&&(t=_())),null!==t)for(e=[];null!==t;)e.push(t),t=Ue(),null===t&&(t=g(),null===t&&(t=_()));else e=null;return e}function xe(){var e,t;for(e=[],t=Ue(),null===t&&(t=g(),null===t&&(t=_()));null!==t;)e.push(t),t=Ue(),null===t&&(t=g(),null===t&&(t=_()));return e}function Ue(){var e;return 91===n.charCodeAt(_r)?(e="[",_r++):(e=null,0===vr&&s('"["')),null===e&&(93===n.charCodeAt(_r)?(e="]",_r++):(e=null,0===vr&&s('"]"')),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')))))))),e}function Me(){var e;return e=ct(),null===e&&(e=Pe()),e}function Pe(){var e,t,n,r,s,l;return l=_r,e=at(),null!==e?(t=d(),null!==t?(n=qe(),null!==n?(r=d(),null!==r?(s=Ze(),null!==s?e=[e,t,n,r,s]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),e}function qe(){var e;return e=$(),null===e&&(e=Le()),e}function Le(){var e,t,r,l;return l=_r,e=Ye(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=He(),null===r&&(r=Ge()),null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),e}function He(){var e,t,r,l,i;return l=_r,e=ke(),null===e&&(e=Fe()),null!==e?(i=_r,63===n.charCodeAt(_r)?(t="?",_r++):(t=null,0===vr&&s('"?"')),null!==t?(r=Qe(),null!==r?t=[t,r]:(t=null,_r=i)):(t=null,_r=i),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),e}function ke(){var e,t,r,l;return l=_r,"//"===n.substr(_r,2)?(e="//",_r+=2):(e=null,0===vr&&s('"//"')),null!==e?(t=Je(),null!==t?(r=Fe(),r=null!==r?r:"",null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),e}function Fe(){var e,t,r;return r=_r,47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null!==e?(t=Be(),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),e}function Ge(){var e,t,n,r;if(r=_r,e=We(),null!==e){for(t=[],n=je();null!==n;)t.push(n),n=je();null!==t?e=[e,t]:(e=null,_r=r)}else e=null,_r=r;return e}function je(){var e;return e=m(),null===e&&(e=g(),null===e&&(e=_())),e}function We(){var e;return e=g(),null===e&&(e=_(),null===e&&(59===n.charCodeAt(_r)?(e=";",_r++):(e=null,0===vr&&s('";"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(64===n.charCodeAt(_r)?(e="@",_r++):(e=null,0===vr&&s('"@"')),null===e&&(38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","')))))))))))),e}function Be(){var e,t,r,l,i,o;if(i=_r,e=ze(),null!==e){for(t=[],o=_r,47===n.charCodeAt(_r)?(r="/",_r++):(r=null,0===vr&&s('"/"')),null!==r?(l=ze(),null!==l?r=[r,l]:(r=null,_r=o)):(r=null,_r=o);null!==r;)t.push(r),o=_r,47===n.charCodeAt(_r)?(r="/",_r++):(r=null,0===vr&&s('"/"')),null!==r?(l=ze(),null!==l?r=[r,l]:(r=null,_r=o)):(r=null,_r=o);null!==t?e=[e,t]:(e=null,_r=i)}else e=null,_r=i;return e}function ze(){var e,t,r,l,i,o;for(i=_r,e=[],t=Ke();null!==t;)e.push(t),t=Ke();if(null!==e){for(t=[],o=_r,59===n.charCodeAt(_r)?(r=";",_r++):(r=null,0===vr&&s('";"')),null!==r?(l=Ve(),null!==l?r=[r,l]:(r=null,_r=o)):(r=null,_r=o);null!==r;)t.push(r),o=_r,59===n.charCodeAt(_r)?(r=";",_r++):(r=null,0===vr&&s('";"')),null!==r?(l=Ve(),null!==l?r=[r,l]:(r=null,_r=o)):(r=null,_r=o);null!==t?e=[e,t]:(e=null,_r=i)}else e=null,_r=i;return e}function Ve(){var e,t;for(e=[],t=Ke();null!==t;)e.push(t),t=Ke();return e}function Ke(){var e;return e=g(),null===e&&(e=_(),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(64===n.charCodeAt(_r)?(e="@",_r++):(e=null,0===vr&&s('"@"')),null===e&&(38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","')))))))))),e}function Ye(){var e,t,r,l,u;if(l=_r,u=_r,e=o(),null!==e){for(t=[],r=o(),null===r&&(r=i(),null===r&&(43===n.charCodeAt(_r)?(r="+",_r++):(r=null,0===vr&&s('"+"')),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."'))))));null!==r;)t.push(r),r=o(),null===r&&(r=i(),null===r&&(43===n.charCodeAt(_r)?(r="+",_r++):(r=null,0===vr&&s('"+"')),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."'))))));null!==t?e=[e,t]:(e=null,_r=u)}else e=null,_r=u;return null!==e&&(e=function(e){yr.scheme=n.substring(_r,e)}(l)),null===e&&(_r=l),e}function Je(){var e;return e=$e(),null===e&&(e=Xe()),e}function $e(){var e,t,r,l;return r=_r,l=_r,e=ee(),null!==e?(64===n.charCodeAt(_r)?(t="@",_r++):(t=null,0===vr&&s('"@"')),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),e=null!==e?e:"",null!==e?(t=se(),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),e=null!==e?e:""}function Xe(){var e,t;if(t=g(),null===t&&(t=_(),null===t&&(36===n.charCodeAt(_r)?(t="$",_r++):(t=null,0===vr&&s('"$"')),null===t&&(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","')),null===t&&(59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null===t&&(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null===t&&(64===n.charCodeAt(_r)?(t="@",_r++):(t=null,0===vr&&s('"@"')),null===t&&(38===n.charCodeAt(_r)?(t="&",_r++):(t=null,0===vr&&s('"&"')),null===t&&(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"'))))))))))),null!==t)for(e=[];null!==t;)e.push(t),t=g(),null===t&&(t=_(),null===t&&(36===n.charCodeAt(_r)?(t="$",_r++):(t=null,0===vr&&s('"$"')),null===t&&(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","')),null===t&&(59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null===t&&(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null===t&&(64===n.charCodeAt(_r)?(t="@",_r++):(t=null,0===vr&&s('"@"')),null===t&&(38===n.charCodeAt(_r)?(t="&",_r++):(t=null,0===vr&&s('"&"')),null===t&&(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')))))))))));else e=null;return e}function Qe(){var e,t;for(e=[],t=je();null!==t;)e.push(t),t=je();return e}function Ze(){var e,t,r,l,o,u,a,c;if(a=_r,c=_r,"sip"===n.substr(_r,3).toLowerCase()?(e=n.substr(_r,3),_r+=3):(e=null,0===vr&&s('"SIP"')),null!==e)if(47===n.charCodeAt(_r)?(t="/",_r++):(t=null,0===vr&&s('"/"')),null!==t){if(l=i(),null!==l)for(r=[];null!==l;)r.push(l),l=i();else r=null;if(null!==r)if(46===n.charCodeAt(_r)?(l=".",_r++):(l=null,0===vr&&s('"."')),null!==l){if(u=i(),null!==u)for(o=[];null!==u;)o.push(u),u=i();else o=null;null!==o?e=[e,t,r,l,o]:(e=null,_r=c)}else e=null,_r=c;else e=null,_r=c}else e=null,_r=c;else e=null,_r=c;return null!==e&&(e=function(e){yr.sip_version=n.substring(_r,e)}(a)),null===e&&(_r=a),e}function et(){var e;return"INVITE"===n.substr(_r,6)?(e="INVITE",_r+=6):(e=null,0===vr&&s('"INVITE"')),e}function tt(){var e;return"ACK"===n.substr(_r,3)?(e="ACK",_r+=3):(e=null,0===vr&&s('"ACK"')),e}function nt(){var e;return"OPTIONS"===n.substr(_r,7)?(e="OPTIONS",_r+=7):(e=null,0===vr&&s('"OPTIONS"')),e}function rt(){var e;return"BYE"===n.substr(_r,3)?(e="BYE",_r+=3):(e=null,0===vr&&s('"BYE"')),e}function st(){var e;return"CANCEL"===n.substr(_r,6)?(e="CANCEL",_r+=6):(e=null,0===vr&&s('"CANCEL"')),e}function lt(){var e;return"REGISTER"===n.substr(_r,8)?(e="REGISTER",_r+=8):(e=null,0===vr&&s('"REGISTER"')),e}function it(){var e;return"SUBSCRIBE"===n.substr(_r,9)?(e="SUBSCRIBE",_r+=9):(e=null,0===vr&&s('"SUBSCRIBE"')),e}function ot(){var e;return"NOTIFY"===n.substr(_r,6)?(e="NOTIFY",_r+=6):(e=null,0===vr&&s('"NOTIFY"')),e}function ut(){var e;return"REFER"===n.substr(_r,5)?(e="REFER",_r+=5):(e=null,0===vr&&s('"REFER"')),e}function at(){var e,t;return t=_r,e=et(),null===e&&(e=tt(),null===e&&(e=nt(),null===e&&(e=rt(),null===e&&(e=st(),null===e&&(e=lt(),null===e&&(e=it(),null===e&&(e=ot(),null===e&&(e=ut(),null===e&&(e=I()))))))))),null!==e&&(e=function(e){return yr.method=n.substring(_r,e),yr.method}(t)),null===e&&(_r=t),e}function ct(){var e,t,n,r,s,l;return l=_r,e=Ze(),null!==e?(t=d(),null!==t?(n=ht(),null!==n?(r=d(),null!==r?(s=pt(),null!==s?e=[e,t,n,r,s]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),e}function ht(){var e,t;return t=_r,e=dt(),null!==e&&(e=function(e,t){yr.status_code=parseInt(t.join(""))}(t,e)),null===e&&(_r=t),e}function dt(){var e,t,n,r;return r=_r,e=i(),null!==e?(t=i(),null!==t?(n=i(),null!==n?e=[e,t,n]:(e=null,_r=r)):(e=null,_r=r)):(e=null,_r=r),e}function pt(){var e,t,r;for(r=_r,e=[],t=m(),null===t&&(t=g(),null===t&&(t=_(),null===t&&(t=y(),null===t&&(t=R(),null===t&&(t=d(),null===t&&(t=p()))))));null!==t;)e.push(t),t=m(),null===t&&(t=g(),null===t&&(t=_(),null===t&&(t=y(),null===t&&(t=R(),null===t&&(t=d(),null===t&&(t=p()))))));return null!==e&&(e=function(e){yr.reason_phrase=n.substring(_r,e)}(r)),null===e&&(_r=r),e}function ft(){var e,t,n,r,s,l;if(s=_r,e=Kt(),null!==e){for(t=[],l=_r,n=H(),null!==n?(r=Kt(),null!==r?n=[n,r]:(n=null,_r=l)):(n=null,_r=l);null!==n;)t.push(n),l=_r,n=H(),null!==n?(r=Kt(),null!==r?n=[n,r]:(n=null,_r=l)):(n=null,_r=l);null!==t?e=[e,t]:(e=null,_r=s)}else e=null,_r=s;return e}function mt(){var e,t,r,l,i,o;return l=_r,i=_r,e=D(),null!==e?(o=_r,64===n.charCodeAt(_r)?(t="@",_r++):(t=null,0===vr&&s('"@"')),null!==t?(r=D(),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){yr=n.substring(_r,e)}(l)),null===e&&(_r=l),e}function gt(){var e,t,n,r,s,l,i;if(s=_r,e=O(),null===e)if(l=_r,e=Tt(),null!==e){for(t=[],i=_r,n=H(),null!==n?(r=Tt(),null!==r?n=[n,r]:(n=null,_r=i)):(n=null,_r=i);null!==n;)t.push(n),i=_r,n=H(),null!==n?(r=Tt(),null!==r?n=[n,r]:(n=null,_r=i)):(n=null,_r=i);null!==t?e=[e,t]:(e=null, -_r=l)}else e=null,_r=l;return null!==e&&(e=function(e){var t,n;for(n=yr.multi_header.length,t=0;t=700)throw new TypeError("Invalid status_code: "+t);this.request.reply(t,n,r,s)},r.prototype.newMessage=function(e,t){"remote"===e?(this.direction="incoming",this.local_identity=t.to,this.remote_identity=t.from):"local"===e&&(this.direction="outgoing",this.local_identity=t.from,this.remote_identity=t.to),this.ua.newMessage({originator:e,message:this,request:t})}},{"./Constants":1,"./Exceptions":5,"./RequestSender":17,"./SIPMessage":18,"./Transactions":21,"./Utils":25,events:28,util:32}],9:[function(e,t,n){function r(e,t,n){var r;if(!(e&&e instanceof s))throw new TypeError('missing or invalid "uri" parameter');this.uri=e,this.parameters={};for(r in n)this.setParam(r,n[r]);Object.defineProperties(this,{display_name:{get:function(){return t},set:function(e){t=0===e?"0":e}}})}t.exports=r;var s=e("./URI"),l=e("./Grammar");r.prototype={setParam:function(e,t){e&&(this.parameters[e.toLowerCase()]="undefined"==typeof t||null===t?null:t.toString())},getParam:function(e){if(e)return this.parameters[e.toLowerCase()]},hasParam:function(e){if(e)return this.parameters.hasOwnProperty(e.toLowerCase())&&!0||!1},deleteParam:function(e){var t;if(e=e.toLowerCase(),this.parameters.hasOwnProperty(e))return t=this.parameters[e],delete this.parameters[e],t},clearParams:function(){this.parameters={}},clone:function(){return new r(this.uri.clone(),this.display_name,JSON.parse(JSON.stringify(this.parameters)))},toString:function(){var e,t;e=this.display_name||0===this.display_name?'"'+this.display_name+'" ':"",e+="<"+this.uri.toString()+">";for(t in this.parameters)e+=";"+t,null!==this.parameters[t]&&(e+="="+this.parameters[t]);return e}},r.parse=function(e){return e=l.parse(e,"Name_Addr_Header"),e!==-1?e:void 0}},{"./Grammar":6,"./URI":24}],10:[function(e,t,n){function r(e,t){var n=t,r=0,s=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===r;){if(s=e.indexOf("\r\n",n),s===-1)return s;!e.substring(s+2,s+4).match(/(^\r\n)/)&&e.charAt(s+2).match(/(^\s+)/)?n=s+2:r=s}return r}function s(e,t,n,r){var s,l,i,a,c=t.indexOf(":",n),h=t.substring(n,c).trim(),d=t.substring(c+1,r).trim();switch(h.toLowerCase()){case"via":case"v":e.addHeader("via",d),1===e.getHeaders("via").length?(a=e.parseHeader("Via"),a&&(e.via=a,e.via_branch=a.branch)):a=0;break;case"from":case"f":e.setHeader("from",d),a=e.parseHeader("from"),a&&(e.from=a,e.from_tag=a.getParam("tag"));break;case"to":case"t":e.setHeader("to",d),a=e.parseHeader("to"),a&&(e.to=a,e.to_tag=a.getParam("tag"));break;case"record-route":if(a=o.parse(d,"Record_Route"),a===-1)a=void 0;else for(i=a.length,l=0;lJ.T2&&(r=J.T2)),n.timers.invite2xxTimer=setTimeout(s,r))},r)}function l(){var e=this;this.timers.ackTimer=setTimeout(function(){e.status===H.STATUS_WAITING_FOR_ACK&&(G("no ACK received, terminating the session"),clearTimeout(e.timers.invite2xxTimer),v.call(e,z.BYE),x.call(e,"remote",null,z.causes.NO_ACK))},J.TIMER_H)}function i(e,t){var n=this;this.connection=new W.RTCPeerConnection(e,t),this.connection.onaddstream=function(e,t){n.emit("addstream",{stream:t})},this.connection.onremovestream=function(e,t){n.emit("removestream",{stream:t})},this.connection.oniceconnectionstatechange=function(e,t){n.emit("iceconnectionstatechange",{state:t}),"failed"===t&&n.terminate({cause:z.causes.RTP_TIMEOUT,status_code:200,reason_phrase:z.causes.RTP_TIMEOUT})}}function o(e,t,n,r){function s(r){i.onicecandidate=function(n,r){if(!r){if(i.onicecandidate=null,l.rtcReady=!0,t){var s={originator:"local",type:e,sdp:i.localDescription.sdp};l.emit("sdp",s),t(s.sdp)}t=null}},i.setLocalDescription(r,function(){if("complete"===i.iceGatheringState){if(l.rtcReady=!0,t){var n={originator:"local",type:e,sdp:i.localDescription.sdp};l.emit("sdp",n),t(n.sdp)}t=null}},function(e){l.rtcReady=!0,n&&n(e)})}G("createLocalDescription()");var l=this,i=this.connection;if(this.rtcReady=!1,"offer"===e)i.createOffer(s,function(e){l.rtcReady=!0,n&&n(e)},r);else{if("answer"!==e)throw new Error('createLocalDescription() | type must be "offer" or "answer", but "'+e+'" was given');i.createAnswer(s,function(e){l.rtcReady=!0,n&&n(e)},r)}}function u(e,t,n){var r,s,l="UAS"===t?e.to_tag:e.from_tag,i="UAS"===t?e.from_tag:e.to_tag,o=e.call_id+l+i;return s=this.earlyDialogs[o],n?!!s||(s=new X(this,e,t,X.C.STATUS_EARLY),s.error?(G(s.error),U.call(this,"remote",e,z.causes.INTERNAL_ERROR),!1):(this.earlyDialogs[o]=s,!0)):(this.from_tag=e.from_tag,this.to_tag=e.to_tag,s?(s.update(e,t),this.dialog=s,delete this.earlyDialogs[o],!0):(r=new X(this,e,t),r.error?(G(r.error),U.call(this,"remote",e,z.causes.INTERNAL_ERROR),!1):(this.dialog=r,!0)))}function a(e){function t(t){t=t||{},f=!0;var n=t.status_code||403,r=t.reason_phrase||"",s=t.extraHeaders&&t.extraHeaders.slice()||[];if(this.status!==H.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: "+n);e.reply(n,r,s)}function n(){r(function(t){var n=["Contact: "+h.contact];E.call(h,e,n),h.late_sdp&&(t=C.call(h,t)),e.reply(200,null,n,t,function(){h.status=H.STATUS_WAITING_FOR_ACK,s.call(h,e,t),l.call(h)}),"function"==typeof m.callback&&m.callback()},function(){e.reply(500)})}function r(e,t){h.late_sdp?o.call(h,"offer",e,t,h.rtcOfferConstraints):(h.remoteHold===!0&&p===!1?(h.remoteHold=!1,P.call(h,"remote")):h.remoteHold===!1&&p===!0&&(h.remoteHold=!0,M.call(h,"remote")),o.call(h,"answer",e,t,h.rtcAnswerConstraints))}G("receiveReinvite()");var i,u,a,c,h=this,d=e.getHeader("Content-Type"),p=!1,f=!1,m={request:e,callback:void 0,reject:t.bind(this)};if(this.emit("reinvite",m),!f)if(e.body){if(this.late_sdp=!1,"application/sdp"!==d)return G("invalid Content-Type"),void e.reply(415);for(i=e.parseSDP(),u=0;u=700)throw new TypeError("Invalid status_code: "+n);e.reply(n,r,s)}G("receiveUpdate()");var n,r,s,l,i=this,u=e.getHeader("Content-Type"),a=!1,c=!1,h={request:e,callback:void 0,reject:t.bind(this)};if(this.emit("update",h),!a){if(!e.body){var d=[];return E.call(this,e,d),void e.reply(200,null,d)}if("application/sdp"!==u)return G("invalid Content-Type"),void e.reply(415);for(n=e.parseSDP(),r=0;r=200&&e.status_code<=299)return this.dialog.id.call_id===e.call_id&&this.dialog.id.local_tag===e.from_tag&&this.dialog.id.remote_tag===e.to_tag?void v.call(this,z.ACK):(n=new X(this,e,"UAC"),void 0!==n.error?void G(n.error):(n.sendRequest({owner:{status:H.STATUS_TERMINATED},onRequestTimeout:function(){},onTransportError:function(){},onDialogError:function(){},receiveResponse:function(){}},z.ACK),void n.sendRequest({owner:{status:H.STATUS_TERMINATED},onRequestTimeout:function(){},onTransportError:function(){},onDialogError:function(){},receiveResponse:function(){}},z.BYE)));if(this.isCanceled)return this.isCanceled=!1,void(e.status_code>=100&&e.status_code<200?this.request.cancel(this.cancelReason):e.status_code>=200&&e.status_code<299&&_.call(this,e));if(this.status===H.STATUS_INVITE_SENT||this.status===H.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(e.status_code):this.status=H.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(e.status_code):if(!e.to_tag){G("1xx response received without to tag");break}if(e.hasHeader("contact")&&!u.call(this,e,"UAC",!0))break;if(this.status=H.STATUS_1XX_RECEIVED,N.call(this,"remote",e),!e.body)break;r={originator:"remote",type:"pranswer",sdp:e.body},this.emit("sdp",r),this.connection.setRemoteDescription(new W.RTCSessionDescription({type:"pranswer",sdp:r.sdp}),null,null);break;case/^2[0-9]{2}$/.test(e.status_code):if(this.status=H.STATUS_CONFIRMED,!e.body){_.call(this,e,400,z.causes.MISSING_SDP),U.call(this,"remote",e,z.causes.BAD_MEDIA_DESCRIPTION);break}if(!u.call(this,e,"UAC"))break;r={originator:"remote",type:"answer",sdp:e.body},this.emit("sdp",r),this.connection.setRemoteDescription(new W.RTCSessionDescription({type:"answer",sdp:r.sdp}),function(){A.call(s,e),D.call(s,"remote",e),v.call(s,z.ACK),O.call(s,"local",null)},function(){_.call(s,e,488,"Not Acceptable Here"),U.call(s,"remote",e,z.causes.BAD_MEDIA_DESCRIPTION)});break;default:t=Y.sipErrorCause(e.status_code),U.call(this,"remote",e,t)}}function g(e){function t(e){if(r.status!==H.STATUS_TERMINATED&&(v.call(r,z.ACK),!u)){if(A.call(r,e),!e.body)return void n();if("application/sdp"!==e.getHeader("Content-Type"))return void n();var t={originator:"remote",type:"answer",sdp:e.body};r.emit("sdp",t),r.connection.setRemoteDescription(new W.RTCSessionDescription({type:"answer",sdp:t.sdp}),function(){l.succeeded&&l.succeeded(e)},function(){n()})}}function n(e){l.failed&&l.failed(e)}G("sendReinvite()"),e=e||{};var r=this,s=e.extraHeaders||[],l=e.eventHandlers||{},i=e.rtcOfferConstraints||this.rtcOfferConstraints||null,u=!1;s.push("Contact: "+this.contact),s.push("Content-Type: application/sdp"),this.sessionTimers.running&&s.push("Session-Expires: "+this.sessionTimers.currentExpires+";refresher="+(this.sessionTimers.refresher?"uac":"uas")),o.call(this,"offer",function(e){e=C.call(r,e);var l=new Z(r,z.INVITE);l.send({extraHeaders:s,body:e,eventHandlers:{onSuccessResponse:function(e){t(e),u=!0},onErrorResponse:function(e){n(e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})},function(){n()},i)}function T(e){function t(e){if(r.status!==H.STATUS_TERMINATED&&!a)if(A.call(r,e),u){if(!e.body)return void n();if("application/sdp"!==e.getHeader("Content-Type"))return void n();var t={originator:"remote",type:"answer",sdp:e.body};r.emit("sdp",t),r.connection.setRemoteDescription(new W.RTCSessionDescription({type:"answer",sdp:t.sdp}),function(){l.succeeded&&l.succeeded(e)},function(){n()})}else l.succeeded&&l.succeeded(e)}function n(e){l.failed&&l.failed(e)}G("sendUpdate()"),e=e||{};var r=this,s=e.extraHeaders||[],l=e.eventHandlers||{},i=e.rtcOfferConstraints||this.rtcOfferConstraints||null,u=e.sdpOffer||!1,a=!1;if(s.push("Contact: "+this.contact),this.sessionTimers.running&&s.push("Session-Expires: "+this.sessionTimers.currentExpires+";refresher="+(this.sessionTimers.refresher?"uac":"uas")),u)s.push("Content-Type: application/sdp"),o.call(this,"offer",function(e){e=C.call(r,e);var l=new Z(r,z.UPDATE);l.send({extraHeaders:s,body:e,eventHandlers:{onSuccessResponse:function(e){t(e),a=!0},onErrorResponse:function(e){n(e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})},function(){n()},i);else{var c=new Z(r,z.UPDATE);c.send({extraHeaders:s,eventHandlers:{onSuccessResponse:function(e){t(e)},onErrorResponse:function(e){n(e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}}function _(e,t,n){G("acceptAndTerminate()");var r=[];t&&(n=n||z.REASON_PHRASE[t]||"",r.push("Reason: SIP ;cause="+t+'; text="'+n+'"')),(this.dialog||u.call(this,e,"UAC"))&&(v.call(this,z.ACK),v.call(this,z.BYE,{extraHeaders:r})),this.status=H.STATUS_TERMINATED}function v(e,t){G("sendRequest()");var n=new Z(this,e);n.send(t)}function C(e){var t,n,r;if(!this.localHold&&!this.remoteHold)return e;if(e=B.parse(e),this.localHold&&!this.remoteHold)for(G("mangleOffer() | me on hold, mangling offer"),n=e.media.length,t=0;t=z.MIN_SESSION_EXPIRES?(this.sessionTimers.currentExpires=e.session_expires,n=e.session_expires_refresher||"uas"):(this.sessionTimers.currentExpires=this.sessionTimers.defaultExpires,n="uas"),t.push("Session-Expires: "+this.sessionTimers.currentExpires+";refresher="+n),this.sessionTimers.refresher="uas"===n,y.call(this)}}function A(e){if(this.sessionTimers.enabled){var t;e.session_expires&&e.session_expires>=z.MIN_SESSION_EXPIRES?(this.sessionTimers.currentExpires=e.session_expires,t=e.session_expires_refresher||"uac"):(this.sessionTimers.currentExpires=this.sessionTimers.defaultExpires,t="uac"),this.sessionTimers.refresher="uac"===t,y.call(this)}}function y(){var e=this,t=this.sessionTimers.currentExpires;this.sessionTimers.running=!0,clearTimeout(this.sessionTimers.timer),this.sessionTimers.refresher?this.sessionTimers.timer=setTimeout(function(){e.status!==H.STATUS_TERMINATED&&(G("runSessionTimer() | sending session refresh request"),T.call(e,{eventHandlers:{succeeded:function(t){A.call(e,t)}}}))},500*t):this.sessionTimers.timer=setTimeout(function(){e.status!==H.STATUS_TERMINATED&&(j("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:z.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}function R(e){var t,n,r,s,l,i=this.connection.getLocalStreams();for(r=i.length,t=0;t=z.MIN_SESSION_EXPIRES?this.sessionTimers.defaultExpires=t.sessionTimersExpires:this.sessionTimers.defaultExpires=z.SESSION_EXPIRES),this.data=t.data||this.data,void 0===e)throw new TypeError("Not enough arguments");if(!W.hasWebRTC())throw new V.NotSupportedError("WebRTC not supported");if(e=this.ua.normalizeTarget(e),!e)throw new TypeError("Invalid target: "+l);if(this.status!==H.STATUS_NULL)throw new V.InvalidStateError(this.status);for(r in o)this.on(r,o[r]);this.from_tag=Y.newTag(),this.anonymous=t.anonymous||!1,this.isCanceled=!1,s={from_tag:this.from_tag},this.contact=this.ua.contact.toString({anonymous:this.anonymous,outbound:!0}),this.anonymous&&(s.from_display_name="Anonymous",s.from_uri="sip:anonymous@anonymous.invalid",u.push("P-Preferred-Identity: "+this.ua.configuration.uri.toString()),u.push("Privacy: id")),u.push("Contact: "+this.contact),u.push("Content-Type: application/sdp"),this.sessionTimers.enabled&&u.push("Session-Expires: "+this.sessionTimers.defaultExpires),this.request=new $.OutgoingRequest(z.INVITE,e,this.ua,s,u),this.id=this.request.call_id+this.from_tag,i.call(this,h,d),this.ua.sessions[this.id]=this,this.direction="outgoing",this.local_identity=this.request.from,this.remote_identity=this.request.to,n?n(this):I.call(this,"local",this.request),f.call(this,a,p,c)},r.prototype.init_incoming=function(e,t){G("init_incoming()");var n,r=this,s=e.getHeader("Content-Type");return e.body&&"application/sdp"!==s?void e.reply(415):(this.status=H.STATUS_INVITE_RECEIVED,this.from_tag=e.from_tag,this.id=e.call_id+this.from_tag,this.request=e,this.contact=this.ua.contact.toString(),this.ua.sessions[this.id]=this,e.hasHeader("expires")&&(n=1e3*e.getHeader("expires")),e.to_tag=Y.newTag(),u.call(this,e,"UAS",!0)?(e.body?this.late_sdp=!1:this.late_sdp=!0,this.status=H.STATUS_WAITING_FOR_ANSWER,this.timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),U.call(r,"local",null,z.causes.NO_ANSWER)},this.ua.configuration.no_answer_timeout),n&&(this.timers.expiresTimer=setTimeout(function(){r.status===H.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),U.call(r,"system",null,z.causes.EXPIRES))},n)),this.direction="incoming", -this.local_identity=e.to,this.remote_identity=e.from,t?t(this):I.call(this,"remote",e),void(this.status!==H.STATUS_TERMINATED&&(e.reply(180,null,["Contact: "+r.contact]),N.call(r,"local",null)))):void e.reply(500,"Missing Contact header field"))},r.prototype.answer=function(e){function t(e){if(v.status!==H.STATUS_TERMINATED)if(v.localMediaStream=e,e&&v.connection.addStream(e),v.request.body||v.emit("peerconnection",{peerconnection:v.connection}),v.late_sdp)r();else{var t={originator:"remote",type:"offer",sdp:C.body};v.emit("sdp",t),v.connection.setRemoteDescription(new W.RTCSessionDescription({type:"offer",sdp:t.sdp}),r,function(){C.reply(488),U.call(v,"system",null,z.causes.WEBRTC_ERROR)})}}function n(){v.status!==H.STATUS_TERMINATED&&(C.reply(480),U.call(v,"local",null,z.causes.USER_DENIED_MEDIA_ACCESS))}function r(){w.call(v,C),v.late_sdp?o.call(v,"offer",a,c,v.rtcOfferConstraints):o.call(v,"answer",a,c,I)}function a(e){function t(){v.status=H.STATUS_WAITING_FOR_ACK,s.call(v,C,e),l.call(v),D.call(v,"local")}function n(){U.call(v,"system",null,z.causes.CONNECTION_ERROR)}v.status!==H.STATUS_TERMINATED&&(E.call(v,C,S),C.reply(200,null,S,e,t,n))}function c(){v.status!==H.STATUS_TERMINATED&&(C.reply(500),U.call(v,"system",null,z.causes.WEBRTC_ERROR))}G("answer()"),e=e||{};var h,d,p,f,m=!1,g=!1,T=!1,_=!1,v=this,C=this.request,S=e.extraHeaders&&e.extraHeaders.slice()||[],A=e.mediaConstraints||{},y=e.mediaStream||null,R=e.pcConfig||{iceServers:[]},b=e.rtcConstraints||null,I=e.rtcAnswerConstraints||null;if(this.rtcAnswerConstraints=I,this.rtcOfferConstraints=e.rtcOfferConstraints||null,this.sessionTimers.enabled&&Y.isDecimal(e.sessionTimersExpires)&&(e.sessionTimersExpires>=z.MIN_SESSION_EXPIRES?this.sessionTimers.defaultExpires=e.sessionTimersExpires:this.sessionTimers.defaultExpires=z.SESSION_EXPIRES),this.data=e.data||this.data,"incoming"!==this.direction)throw new V.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this.status!==H.STATUS_WAITING_FOR_ANSWER)throw new V.InvalidStateError(this.status);if(this.status=H.STATUS_ANSWERED,!u.call(this,C,"UAS"))return void C.reply(500,"Error creating dialog");for(clearTimeout(this.timers.userNoAnswerTimer),S.unshift("Contact: "+v.contact),p=C.parseSDP(),Array.isArray(p.media)||(p.media=[p.media]),h=p.media.length;h--;){var N=p.media[h];"audio"===N.type&&(m=!0,N.direction&&"sendrecv"!==N.direction||(T=!0)),"video"===N.type&&(g=!0,N.direction&&"sendrecv"!==N.direction||(_=!0))}if(y&&A.audio===!1)for(f=y.getAudioTracks(),d=f.length,h=0;h=700))throw new TypeError("Invalid status_code: "+s);s&&(l=l||z.REASON_PHRASE[s]||"",t="SIP ;cause="+s+' ;text="'+l+'"'),this.status===H.STATUS_NULL?(this.isCanceled=!0,this.cancelReason=t):this.status===H.STATUS_INVITE_SENT?(this.isCanceled=!0,this.cancelReason=t):this.status===H.STATUS_1XX_RECEIVED&&this.request.cancel(t),this.status=H.STATUS_CANCELED,U.call(this,"local",null,z.causes.CANCELED);break;case H.STATUS_WAITING_FOR_ANSWER:case H.STATUS_ANSWERED:if(G("rejecting session"),s=s||480,s<300||s>=700)throw new TypeError("Invalid status_code: "+s);this.request.reply(s,l,i,o),U.call(this,"local",null,z.causes.REJECTED);break;case H.STATUS_WAITING_FOR_ACK:case H.STATUS_CONFIRMED:if(G("terminating session"),l=e.reason_phrase||z.REASON_PHRASE[s]||"",s&&(s<200||s>=700))throw new TypeError("Invalid status_code: "+s);s&&i.push("Reason: SIP ;cause="+s+'; text="'+l+'"'),this.status===H.STATUS_WAITING_FOR_ACK&&"incoming"===this.direction&&this.request.server_transaction.state!==K.C.STATUS_TERMINATED?(n=this.dialog,this.receiveRequest=function(e){e.method===z.ACK&&(v.call(this,z.BYE,{extraHeaders:i,body:o}),n.terminate())},this.request.server_transaction.on("stateChanged",function(){this.state===K.C.STATUS_TERMINATED&&(v.call(u,z.BYE,{extraHeaders:i,body:o}),n.terminate())}),x.call(this,"local",null,r),this.dialog=n,this.ua.dialogs[n.id.toString()]=n):(v.call(this,z.BYE,{extraHeaders:i,body:o}),x.call(this,"local",null,r))}},r.prototype.close=function(){G("close()");var e;if(this.status!==H.STATUS_TERMINATED){if(this.connection)try{this.connection.close()}catch(e){j("close() | error closing the RTCPeerConnection: %o",e)}this.localMediaStream&&this.localMediaStreamLocallyGenerated&&(G("close() | closing local MediaStream"),W.closeMediaStream(this.localMediaStream));for(e in this.timers)clearTimeout(this.timers[e]);clearTimeout(this.sessionTimers.timer),this.dialog&&(this.dialog.terminate(),delete this.dialog);for(e in this.earlyDialogs)this.earlyDialogs[e].terminate(),delete this.earlyDialogs[e];this.status=H.STATUS_TERMINATED,delete this.ua.sessions[this.id]}},r.prototype.sendDTMF=function(e,t){function n(){var e,o;if(i.status===H.STATUS_TERMINATED||!i.tones||l>=i.tones.length)return void(i.tones=null);if(e=i.tones[l],l+=1,","===e)o=2e3;else{var u=new ee(i);t.eventHandlers={failed:function(){i.tones=null}},u.send(e,t),o=r+s}setTimeout(n,o)}G("sendDTMF() | tones: %s",e);var r,s,l=0,i=this;if(t=t||{},r=t.duration||null,s=t.interToneGap||null,void 0===e)throw new TypeError("Not enough arguments");if(this.status!==H.STATUS_CONFIRMED&&this.status!==H.STATUS_WAITING_FOR_ACK)throw new V.InvalidStateError(this.status);if("number"==typeof e&&(e=e.toString()),!e||"string"!=typeof e||!e.match(/^[0-9A-D#*,]+$/i))throw new TypeError("Invalid tones: "+e);if(r&&!Y.isDecimal(r))throw new TypeError("Invalid tone duration: "+r);if(r?ree.C.MAX_DURATION?(G('"duration" value is greater than the maximum allowed, setting it to '+ee.C.MAX_DURATION+" milliseconds"),r=ee.C.MAX_DURATION):r=Math.abs(r):r=ee.C.DEFAULT_DURATION,t.duration=r,s&&!Y.isDecimal(s))throw new TypeError("Invalid interToneGap: "+s);return s?s=1&&n.test(t[0])&&(this.tone=t[0].replace(n,"$2")),t.length>=2&&r.test(t[1])&&(this.duration=parseInt(t[1].replace(r,"$2"),10))),this.duration||(this.duration=s.DEFAULT_DURATION),this.tone?this.owner.newDTMF({originator:"remote",dtmf:this,request:e}):l("invalid INFO DTMF received, discarded")}},{"../Constants":1,"../Exceptions":5,"../RTCSession":11,debug:33}],13:[function(e,t,n){function r(e,t,n){this.session=e,this.id=t,this.expires=n||s.expires,this.active=!0,this.notify(100)}t.exports=r;var s={event_type:"refer",body_type:"message/sipfrag;version=2.0",expires:300},l=e("debug")("JsSIP:RTCSession:ReferNotifier"),i=e("../Constants"),o=e("./Request");r.prototype.notify=function(e,t){l("notify()");var n,r=this;if(this.active!==!1){t=t||i.REASON_PHRASE[e]||"",n=e>=200?"terminated;reason=noresource":"active;expires="+this.expires;var u=new o(this.session,i.NOTIFY);u.send({extraHeaders:["Event: "+s.event_type+";id="+r.id,"Subscription-State: "+n,"Content-Type: "+s.body_type],body:"SIP/2.0 "+e+" "+t,eventHandlers:{onErrorResponse:function(){r.active=!1}}})}}},{"../Constants":1,"./Request":15,debug:33}],14:[function(e,t,n){function r(e){this.session=e,this.timer=null,this.outgoingRequest=null,o.EventEmitter.call(this)}function s(){console.log("removeSubscriber()"),clearTimeout(this.timer),this.session.referSubscriber=null}t.exports=r;var l={expires:120},i=e("util"),o=e("events"),u=e("debug")("JsSIP:RTCSession:ReferSubscriber"),a=e("../Constants"),c=e("../Grammar"),h=e("./Request");i.inherits(r,o.EventEmitter),r.prototype.sendRefer=function(e,t){u("sendRefer()");var n,r,i,o=null,c=this;t=t||{},n=t.extraHeaders?t.extraHeaders.slice():[],r=t.eventHandlers||{};for(var d in r)this.on(d,r[d]);t.replaces&&(o=t.replaces.request.call_id,o+=";to-tag="+t.replaces.to_tag,o+=";from-tag="+t.replaces.from_tag,o=encodeURIComponent(o)),i="Refer-To: <"+e+(o?"?Replaces="+o:"")+">",n.push(i);var p=new h(this.session,a.REFER);this.timer=setTimeout(function(){s.call(c)},1e3*l.expires),p.send({extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){c.emit("requestSucceeded",{response:e})},onErrorResponse:function(e){c.emit("requestFailed",{response:e,cause:a.causes.REJECTED})},onTransportError:function(){s.call(c),c.emit("requestFailed",{response:null,cause:a.causes.CONNECTION_ERROR})},onRequestTimeout:function(){s.call(c),c.emit("requestFailed",{response:null,cause:a.causes.REQUEST_TIMEOUT})},onDialogError:function(){s.call(c),c.emit("requestFailed",{response:null,cause:a.causes.DIALOG_ERROR})}}}),this.outgoingRequest=p.outgoingRequest},r.prototype.receiveNotify=function(e){u("receiveNotify()");var t;if(e.body){if(t=c.parse(e.body,"Status_Line"),t===-1)return void u('receiveNotify() | error parsing NOTIFY body: "'+e.body+'"');switch(!0){case/^100$/.test(t.status_code):this.emit("trying",{request:e,status_line:t});break;case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",{request:e,status_line:t});break;case/^2[0-9]{2}$/.test(t.status_code):s.call(this),this.emit("accepted",{request:e,status_line:t});break;default:s.call(this),this.emit("failed",{request:e,status_line:t})}}}},{"../Constants":1,"../Grammar":6,"./Request":15,debug:33,events:28,util:32}],15:[function(e,t,n){function r(e,t){if(s("new | %s",t),this.session=e,this.method=t,this.outgoingRequest=null,this.session.status!==u.C.STATUS_1XX_RECEIVED&&this.session.status!==u.C.STATUS_WAITING_FOR_ANSWER&&this.session.status!==u.C.STATUS_WAITING_FOR_ACK&&this.session.status!==u.C.STATUS_CONFIRMED&&this.session.status!==u.C.STATUS_TERMINATED)throw new o.InvalidStateError(this.session.status);if(this.session.status===u.C.STATUS_TERMINATED&&t!==i.BYE)throw new o.InvalidStateError(this.session.status)}t.exports=r;var s=e("debug")("JsSIP:RTCSession:Request"),l=e("debug")("JsSIP:ERROR:RTCSession:Request");l.log=console.warn.bind(console);var i=e("../Constants"),o=e("../Exceptions"),u=e("../RTCSession");r.prototype.send=function(e){e=e||{};var t=e.extraHeaders&&e.extraHeaders.slice()||[],n=e.body||null;this.eventHandlers=e.eventHandlers||{},this.outgoingRequest=this.session.dialog.sendRequest(this,this.method,{extraHeaders:t,body:n})},r.prototype.receiveResponse=function(e){switch(!0){case/^1[0-9]{2}$/.test(e.status_code):s("onProgressResponse"),this.eventHandlers.onProgressResponse&&this.eventHandlers.onProgressResponse(e);break;case/^2[0-9]{2}$/.test(e.status_code):s("onSuccessResponse"),this.eventHandlers.onSuccessResponse&&this.eventHandlers.onSuccessResponse(e);break;default:s("onErrorResponse"),this.eventHandlers.onErrorResponse&&this.eventHandlers.onErrorResponse(e)}},r.prototype.onRequestTimeout=function(){l("onRequestTimeout"),this.eventHandlers.onRequestTimeout&&this.eventHandlers.onRequestTimeout()},r.prototype.onTransportError=function(){l("onTransportError"),this.eventHandlers.onTransportError&&this.eventHandlers.onTransportError()},r.prototype.onDialogError=function(){l("onDialogError"),this.eventHandlers.onDialogError&&this.eventHandlers.onDialogError()}},{"../Constants":1,"../Exceptions":5,"../RTCSession":11,debug:33}],16:[function(e,t,n){function r(e,t){var n=1;this.ua=e,this.transport=t,this.registrar=e.configuration.registrar_server,this.expires=e.configuration.register_expires,this.call_id=l.createRandomToken(22),this.cseq=0,this.to_uri=e.configuration.uri,this.registrationTimer=null,this.registered=!1,this.contact=this.ua.contact.toString(),this.contact+=";+sip.ice",this.extraHeaders=[],this.extraContactParams="",n&&(this.contact+=";reg-id="+n,this.contact+=';+sip.instance=""')}t.exports=r;var s=e("debug")("JsSIP:Registrator"),l=e("./Utils"),i=e("./Constants"),o=e("./SIPMessage"),u=e("./RequestSender");r.prototype={setExtraHeaders:function(e){Array.isArray(e)||(e=[]),this.extraHeaders=e.slice()},setExtraContactParams:function(e){e instanceof Object||(e={}),this.extraContactParams="";for(var t in e){var n=e[t];this.extraContactParams+=";"+t,n&&(this.extraContactParams+="="+n)}},register:function(){var e,t,n,r=this;n=this.extraHeaders.slice(),n.push("Contact: "+this.contact+";expires="+this.expires+this.extraContactParams),n.push("Expires: "+this.expires),this.request=new o.OutgoingRequest(i.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},n),e=new u(this,this.ua),this.receiveResponse=function(e){var n,o,u=e.getHeaders("contact").length;if(e.cseq===this.cseq)switch(null!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=null),!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):if(e.hasHeader("expires")&&(o=e.getHeader("expires")),!u){s("no Contact header in response to REGISTER, response ignored");break}for(;u--;){if(n=e.parseHeader("contact",u),n.uri.user===this.ua.contact.uri.user){o=n.getParam("expires");break}n=null}if(!n){s("no Contact header pointing to us, response ignored");break}o||(o=this.expires),this.registrationTimer=setTimeout(function(){r.registrationTimer=null,r.register()},1e3*o-3e3),n.hasParam("temp-gruu")&&(this.ua.contact.temp_gruu=n.getParam("temp-gruu").replace(/"/g,"")),n.hasParam("pub-gruu")&&(this.ua.contact.pub_gruu=n.getParam("pub-gruu").replace(/"/g,"")),this.registered||(this.registered=!0,this.ua.registered({response:e}));break;case/^423$/.test(e.status_code):e.hasHeader("min-expires")?(this.expires=e.getHeader("min-expires"),this.register()):(s("423 response received for REGISTER without Min-Expires"),this.registrationFailure(e,i.causes.SIP_FAILURE_CODE));break;default:t=l.sipErrorCause(e.status_code),this.registrationFailure(e,t)}},this.onRequestTimeout=function(){this.registrationFailure(null,i.causes.REQUEST_TIMEOUT)},this.onTransportError=function(){this.registrationFailure(null,i.causes.CONNECTION_ERROR)},e.send()},unregister:function(e){var t;if(!this.registered)return void s("already unregistered");e=e||{},this.registered=!1,null!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=null),t=this.extraHeaders.slice(),e.all?(t.push("Contact: *"+this.extraContactParams),t.push("Expires: 0"),this.request=new o.OutgoingRequest(i.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},t)):(t.push("Contact: "+this.contact+";expires=0"+this.extraContactParams),t.push("Expires: 0"),this.request=new o.OutgoingRequest(i.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},t));var n=new u(this,this.ua);this.receiveResponse=function(e){var t;switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this.unregistered(e);break;default:t=l.sipErrorCause(e.status_code),this.unregistered(e,t)}},this.onRequestTimeout=function(){this.unregistered(null,i.causes.REQUEST_TIMEOUT)},this.onTransportError=function(){this.unregistered(null,i.causes.CONNECTION_ERROR)},n.send()},registrationFailure:function(e,t){this.ua.registrationFailed({response:e||null,cause:t}),this.registered&&(this.registered=!1,this.ua.unregistered({response:e||null,cause:t}))},unregistered:function(e,t){this.registered=!1,this.ua.unregistered({response:e||null,cause:t||null})},onTransportClosed:function(){null!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=null),this.registered&&(this.registered=!1,this.ua.unregistered({}))},close:function(){this.registered&&this.unregister()}}},{"./Constants":1,"./RequestSender":17,"./SIPMessage":18,"./Utils":25,debug:33}],17:[function(e,t,n){function r(e,t){this.ua=t,this.applicant=e,this.method=e.request.method,this.request=e.request,this.auth=null,this.challenged=!1,this.staled=!1,t.status!==i.C.STATUS_USER_CLOSED||this.method===l.BYE&&this.method===l.ACK||this.onTransportError()}t.exports=r;var s=e("debug")("JsSIP:RequestSender"),l=e("./Constants"),i=e("./UA"),o=e("./DigestAuthentication"),u=e("./Transactions");r.prototype={send:function(){switch(this.method){case"INVITE":this.clientTransaction=new u.InviteClientTransaction(this,this.request,this.ua.transport);break;case"ACK":this.clientTransaction=new u.AckClientTransaction(this,this.request,this.ua.transport);break;default:this.clientTransaction=new u.NonInviteClientTransaction(this,this.request,this.ua.transport)}this.clientTransaction.send()},onRequestTimeout:function(){this.applicant.onRequestTimeout()},onTransportError:function(){this.applicant.onTransportError()},receiveResponse:function(e){var t,n,r,i=e.status_code;if(401!==i&&407!==i||null===this.ua.configuration.password&&null===this.ua.configuration.ha1)this.applicant.receiveResponse(e);else{if(401===e.status_code?(n=e.parseHeader("www-authenticate"),r="authorization"):(n=e.parseHeader("proxy-authenticate"),r="proxy-authorization"),!n)return s(e.status_code+" with wrong or missing challenge, cannot authenticate"),void this.applicant.receiveResponse(e);if(!this.challenged||!this.staled&&n.stale===!0){if(this.auth||(this.auth=new o({username:this.ua.configuration.authorization_user,password:this.ua.configuration.password,realm:this.ua.configuration.realm,ha1:this.ua.configuration.ha1})),!this.auth.authenticate(this.request,n))return void this.applicant.receiveResponse(e);this.challenged=!0,this.ua.set("realm",this.auth.get("realm")),this.ua.set("ha1",this.auth.get("ha1")),n.stale&&(this.staled=!0),t=e.method===l.REGISTER?this.applicant.cseq+=1:this.request.dialog?this.request.dialog.local_seqnum+=1:this.request.cseq+1,this.request=this.applicant.request=this.request.clone(),this.request.cseq=t,this.request.setHeader("cseq",t+" "+this.method),this.request.setHeader(r,this.auth.toString()),this.send()}else this.applicant.receiveResponse(e)}}}},{"./Constants":1,"./DigestAuthentication":4,"./Transactions":21,"./UA":23,debug:33}],18:[function(e,t,n){function r(e,t,n,r,s,l){var i,o,u,d;return r=r||{},e&&t&&n?(this.ua=n,this.headers={},this.method=e,this.ruri=t,this.body=l,this.extraHeaders=s&&s.slice()||[],r.route_set?this.setHeader("route",r.route_set):n.configuration.use_preloaded_route&&this.setHeader("route","<"+n.transport.sip_uri+";lr>"),this.setHeader("via",""),this.setHeader("max-forwards",a.MAX_FORWARDS),i=r.to_display_name||0===r.to_display_name?'"'+r.to_display_name+'" ':"",i+="<"+(r.to_uri||t)+">",i+=r.to_tag?";tag="+r.to_tag:"",this.to=new h.parse(i),this.setHeader("to",i),o=r.from_display_name||0===r.from_display_name?'"'+r.from_display_name+'" ':n.configuration.display_name?'"'+n.configuration.display_name+'" ':"",o+="<"+(r.from_uri||n.configuration.uri)+">;tag=",o+=r.from_tag||c.newTag(),this.from=new h.parse(o),this.setHeader("from",o),u=r.call_id||n.configuration.jssip_id+c.createRandomToken(15),this.call_id=u,this.setHeader("call-id",u),d=r.cseq||Math.floor(1e4*Math.random()),this.cseq=d,void this.setHeader("cseq",d+" "+e)):null}function s(){this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null,this.sdp=null}function l(e){this.ua=e,this.headers={},this.ruri=null,this.transport=null,this.server_transaction=null}function i(){this.headers={},this.status_code=null,this.reason_phrase=null}t.exports={OutgoingRequest:r,IncomingRequest:l,IncomingResponse:i};var o=e("debug")("JsSIP:SIPMessage"),u=e("sdp-transform"),a=e("./Constants"),c=e("./Utils"),h=e("./NameAddrHeader"),d=e("./Grammar");r.prototype={setHeader:function(e,t){var n,r;for(n=new RegExp("^\\s*"+e+"\\s*:","i"),r=0;r=this.headers[e].length?void o('not so many "'+e+'" headers present'):(n=this.headers[e][t],r=n.raw,n.parsed?n.parsed:(s=d.parse(r,e.replace(/-/g,"_")),s===-1?(this.headers[e].splice(t,1),void o('error parsing "'+e+'" header field with value "'+r+'"')):(n.parsed=s,s))):void o('header "'+e+'" not present')},s:function(e,t){return this.parseHeader(e,t)},setHeader:function(e,t){var n={raw:t};this.headers[c.headerize(e)]=[n]},parseSDP:function(e){return!e&&this.sdp?this.sdp:(this.sdp=u.parse(this.body||""),this.sdp)},toString:function(){return this.data}},l.prototype=new s,l.prototype.reply=function(e,t,n,r,s,l){var i,o,u,h,d,p=[],f=this.getHeader("To"),m=0,g=0;if(e=e||null,t=t||null,!e||e<100||e>699)throw new TypeError("Invalid status_code: "+e);if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: "+t);if(t=t||a.REASON_PHRASE[e]||"",n=n&&n.slice()||[],d="SIP/2.0 "+e+" "+t+"\r\n",this.method===a.INVITE&&e>100&&e<=200)for(i=this.getHeaders("record-route"),u=i.length,m;m100?f+=";tag="+c.newTag():this.to_tag&&!this.s("to").hasParam("tag")&&(f+=";tag="+this.to_tag), +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.JsSIP=e()}}(function(){var e;return function e(t,n,r){function s(i,o){if(!n[i]){if(!t[i]){var u="function"==typeof require&&require;if(!o&&u)return u(i,!0);if(l)return l(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return s(n?n:e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var l="function"==typeof require&&require,i=0;ithis.remote_seqnum&&(this.remote_seqnum=e.cseq)}else this.remote_seqnum=e.cseq;if(e.method===o.INVITE||e.method===o.UPDATE&&e.body){if(this.uac_pending_reply===!0)e.reply(491);else{if(this.uas_pending_reply===!0){var n=(10*Math.random()|0)+1;return e.reply(500,null,["Retry-After:"+n]),!1}this.uas_pending_reply=!0,e.server_transaction.on("stateChanged",function n(){this.state!==u.C.STATUS_ACCEPTED&&this.state!==u.C.STATUS_COMPLETED&&this.state!==u.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),t.uas_pending_reply=!1)})}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){this.state===u.C.STATUS_ACCEPTED&&(t.remote_target=e.parseHeader("contact").uri)})}else e.method===o.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){this.state===u.C.STATUS_COMPLETED&&(t.remote_target=e.parseHeader("contact").uri)});return!0},sendRequest:function(e,t,n){n=n||{};var r=n.extraHeaders&&n.extraHeaders.slice()||[],s=n.body||null,l=this.createRequest(t,r,s),i=new a(this,e,l);return i.send(),l},receiveRequest:function(e){this.checkInDialogRequest(e)&&this.owner.receiveRequest(e)}}},{"./Constants":1,"./Dialog/RequestSender":3,"./SIPMessage":18,"./Transactions":21,debug:33}],3:[function(e,t,n){function r(e,t,n){this.dialog=e,this.applicant=t,this.request=n,this.reattempt=!1,this.reattemptTimer=null}t.exports=r;var s=e("../Constants"),l=e("../Transactions"),i=e("../RTCSession"),o=e("../RequestSender");r.prototype={send:function(){var e=this,t=new o(this,this.dialog.owner.ua);t.send(),(this.request.method===s.INVITE||this.request.method===s.UPDATE&&this.request.body)&&t.clientTransaction.state!==l.C.STATUS_TERMINATED&&(this.dialog.uac_pending_reply=!0,t.clientTransaction.on("stateChanged",function n(){this.state!==l.C.STATUS_ACCEPTED&&this.state!==l.C.STATUS_COMPLETED&&this.state!==l.C.STATUS_TERMINATED||(t.clientTransaction.removeListener("stateChanged",n),e.dialog.uac_pending_reply=!1)}))},onRequestTimeout:function(){this.applicant.onRequestTimeout()},onTransportError:function(){this.applicant.onTransportError()},receiveResponse:function(e){var t=this;408===e.status_code||481===e.status_code?this.applicant.onDialogError(e):e.method===s.INVITE&&491===e.status_code?this.reattempt?this.applicant.receiveResponse(e):(this.request.cseq.value=this.dialog.local_seqnum+=1,this.reattemptTimer=setTimeout(function(){t.applicant.owner.status!==i.C.STATUS_TERMINATED&&(t.reattempt=!0,t.request_sender.send())},1e3)):this.applicant.receiveResponse(e)}}},{"../Constants":1,"../RTCSession":11,"../RequestSender":17,"../Transactions":21}],4:[function(e,t,n){function r(e){this.credentials=e,this.cnonce=null,this.nc=0,this.ncHex="00000000",this.algorithm=null,this.realm=null,this.nonce=null,this.opaque=null,this.stale=null,this.qop=null,this.method=null,this.uri=null,this.ha1=null,this.response=null}t.exports=r;var s=e("debug")("JsSIP:DigestAuthentication"),l=e("debug")("JsSIP:ERROR:DigestAuthentication");l.log=console.warn.bind(console);var i=e("./Utils");r.prototype.get=function(e){switch(e){case"realm":return this.realm;case"ha1":return this.ha1;default:return void l('get() | cannot get "%s" parameter',e)}},r.prototype.authenticate=function(e,t){var n,r;if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if("MD5"!==this.algorithm)return l('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this.algorithm="MD5";if(!this.nonce)return l("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this.realm)return l("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this.credentials.password){if(!this.credentials.ha1)return l("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this.credentials.realm!==this.realm)return l('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]',this.credentials.realm,this.realm),!1}if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else{if(!(t.qop.indexOf("auth-int")>-1))return l('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this.qop="auth-int"}else this.qop=null;return this.method=e.method,this.uri=e.ruri,this.cnonce=i.createRandomToken(12),this.nc+=1,r=Number(this.nc).toString(16),this.ncHex="00000000".substr(0,8-r.length)+r,4294967296===this.nc&&(this.nc=1,this.ncHex="00000001"),this.credentials.password?this.ha1=i.calculateMD5(this.credentials.username+":"+this.realm+":"+this.credentials.password):this.ha1=this.credentials.ha1,"auth"===this.qop?(n=i.calculateMD5(this.method+":"+this.uri),this.response=i.calculateMD5(this.ha1+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+n)):"auth-int"===this.qop?(n=i.calculateMD5(this.method+":"+this.uri+":"+i.calculateMD5(this.body?this.body:"")),this.response=i.calculateMD5(this.ha1+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+n)):null===this.qop&&(n=i.calculateMD5(this.method+":"+this.uri),this.response=i.calculateMD5(this.ha1+":"+this.nonce+":"+n)),s("authenticate() | response generated"),!0},r.prototype.toString=function(){var e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.credentials.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}},{"./Utils":25,debug:33}],5:[function(e,t,n){var r={ConfigurationError:function(){var e=function(e,t){this.code=1,this.name="CONFIGURATION_ERROR",this.parameter=e,this.value=t,this.message=this.value?"Invalid value "+JSON.stringify(this.value)+' for parameter "'+this.parameter+'"':"Missing parameter: "+this.parameter};return e.prototype=new Error,e}(),InvalidStateError:function(){var e=function(e){this.code=2,this.name="INVALID_STATE_ERROR",this.status=e,this.message="Invalid status: "+e};return e.prototype=new Error,e}(),NotSupportedError:function(){var e=function(e){this.code=3,this.name="NOT_SUPPORTED_ERROR",this.message=e};return e.prototype=new Error,e}(),NotReadyError:function(){var e=function(e){this.code=4,this.name="NOT_READY_ERROR",this.message=e};return e.prototype=new Error,e}()};t.exports=r},{}],6:[function(e,t,n){t.exports=function(){function t(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var n={parse:function(n,r){function s(e){_rCr&&(Cr=_r,Sr=[]),Sr.push(e))}function l(){var e;return"\r\n"===n.substr(_r,2)?(e="\r\n",_r+=2):(e=null,0===vr&&s('"\\r\\n"')),e}function i(){var e;return/^[0-9]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[0-9]")),e}function o(){var e;return/^[a-zA-Z]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[a-zA-Z]")),e}function u(){var e;return/^[0-9a-fA-F]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[0-9a-fA-F]")),e}function a(){var e;return e=d(),null===e&&(e=p()),e}function c(){var e;return/^[\0-\xFF]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\0-\\xFF]")),e}function h(){var e;return/^["]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s('["]')),e}function d(){var e;return 32===n.charCodeAt(_r)?(e=" ",_r++):(e=null,0===vr&&s('" "')),e}function p(){var e;return 9===n.charCodeAt(_r)?(e="\t",_r++):(e=null,0===vr&&s('"\\t"')),e}function f(){var e;return/^[a-zA-Z0-9]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[a-zA-Z0-9]")),e}function m(){var e;return 59===n.charCodeAt(_r)?(e=";",_r++):(e=null,0===vr&&s('";"')),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(64===n.charCodeAt(_r)?(e="@",_r++):(e=null,0===vr&&s('"@"')),null===e&&(38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","'))))))))))),e}function g(){var e;return e=f(),null===e&&(e=T()),e}function T(){var e;return 45===n.charCodeAt(_r)?(e="-",_r++):(e=null,0===vr&&s('"-"')),null===e&&(95===n.charCodeAt(_r)?(e="_",_r++):(e=null,0===vr&&s('"_"')),null===e&&(46===n.charCodeAt(_r)?(e=".",_r++):(e=null,0===vr&&s('"."')),null===e&&(33===n.charCodeAt(_r)?(e="!",_r++):(e=null,0===vr&&s('"!"')),null===e&&(126===n.charCodeAt(_r)?(e="~",_r++):(e=null,0===vr&&s('"~"')),null===e&&(42===n.charCodeAt(_r)?(e="*",_r++):(e=null,0===vr&&s('"*"')),null===e&&(39===n.charCodeAt(_r)?(e="'",_r++):(e=null,0===vr&&s('"\'"')),null===e&&(40===n.charCodeAt(_r)?(e="(",_r++):(e=null,0===vr&&s('"("')),null===e&&(41===n.charCodeAt(_r)?(e=")",_r++):(e=null,0===vr&&s('")"')))))))))),e}function _(){var e,t,r,l,i;return l=_r,i=_r,37===n.charCodeAt(_r)?(e="%",_r++):(e=null,0===vr&&s('"%"')),null!==e?(t=u(),null!==t?(r=u(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e,t){return t.join("")}(l,e)),null===e&&(_r=l),e}function v(){var e,t,n,r,s,i;for(r=_r,s=_r,i=_r,e=[],t=a();null!==t;)e.push(t),t=a();if(null!==e?(t=l(),null!==t?e=[e,t]:(e=null,_r=i)):(e=null,_r=i),e=null!==e?e:"",null!==e){if(n=a(),null!==n)for(t=[];null!==n;)t.push(n),n=a();else t=null;null!==t?e=[e,t]:(e=null,_r=s)}else e=null,_r=s;return null!==e&&(e=function(e){return" "}(r)),null===e&&(_r=r),e}function C(){var e;return e=v(),e=null!==e?e:""}function S(){var e,t,r,l,i;for(l=_r,i=_r,e=[],t=d(),null===t&&(t=p());null!==t;)e.push(t),t=d(),null===t&&(t=p());return null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return":"}(l)),null===e&&(_r=l),e}function E(){var e,t,r,s,l,i,o;if(l=_r,i=_r,t=A(),null!==t)for(e=[];null!==t;)e.push(t),t=A();else e=null;if(null!==e){for(t=[],o=_r,r=[],s=v();null!==s;)r.push(s),s=v();for(null!==r?(s=A(),null!==s?r=[r,s]:(r=null,_r=o)):(r=null,_r=o);null!==r;){for(t.push(r),o=_r,r=[],s=v();null!==s;)r.push(s),s=v();null!==r?(s=A(),null!==s?r=[r,s]:(r=null,_r=o)):(r=null,_r=o)}null!==t?e=[e,t]:(e=null,_r=i)}else e=null,_r=i;return null!==e&&(e=function(e){return n.substring(_r,e)}(l)),null===e&&(_r=l),e}function A(){var e;return/^[!-~]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[!-~]")),null===e&&(e=y()),e}function y(){var e;return/^[\x80-\uFFFF]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\x80-\\uFFFF]")),e}function R(){var e;return/^[\x80-\xBF]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\x80-\\xBF]")),e}function b(){var e;return e=i(),null===e&&(/^[a-f]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[a-f]"))),e}function I(){var e,t,r;if(r=_r,t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"')))))))))))),null!==t)for(e=[];null!==t;)e.push(t),t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"'))))))))))));else e=null;return null!==e&&(e=function(e){return n.substring(_r,e)}(r)),null===e&&(_r=r),e}function w(){var e,t,r;if(r=_r,t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"'))))))))))),null!==t)for(e=[];null!==t;)e.push(t),t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"')))))))))));else e=null;return null!==e&&(e=function(e){return n.substring(_r,e)}(r)),null===e&&(_r=r),e}function N(){var e;return 40===n.charCodeAt(_r)?(e="(",_r++):(e=null,0===vr&&s('"("')),null===e&&(41===n.charCodeAt(_r)?(e=")",_r++):(e=null,0===vr&&s('")"')),null===e&&(60===n.charCodeAt(_r)?(e="<",_r++):(e=null,0===vr&&s('"<"')),null===e&&(62===n.charCodeAt(_r)?(e=">",_r++):(e=null,0===vr&&s('">"')),null===e&&(64===n.charCodeAt(_r)?(e="@",_r++):(e=null,0===vr&&s('"@"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","')),null===e&&(59===n.charCodeAt(_r)?(e=";",_r++):(e=null,0===vr&&s('";"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(92===n.charCodeAt(_r)?(e="\\",_r++):(e=null,0===vr&&s('"\\\\"')),null===e&&(e=h(),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null===e&&(91===n.charCodeAt(_r)?(e="[",_r++):(e=null,0===vr&&s('"["')),null===e&&(93===n.charCodeAt(_r)?(e="]",_r++):(e=null,0===vr&&s('"]"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(123===n.charCodeAt(_r)?(e="{",_r++):(e=null,0===vr&&s('"{"')),null===e&&(125===n.charCodeAt(_r)?(e="}",_r++):(e=null,0===vr&&s('"}"')),null===e&&(e=d(),null===e&&(e=p())))))))))))))))))),e}function D(){var e,t,r;if(r=_r,t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"')),null===t&&(40===n.charCodeAt(_r)?(t="(",_r++):(t=null,0===vr&&s('"("')),null===t&&(41===n.charCodeAt(_r)?(t=")",_r++):(t=null,0===vr&&s('")"')),null===t&&(60===n.charCodeAt(_r)?(t="<",_r++):(t=null,0===vr&&s('"<"')),null===t&&(62===n.charCodeAt(_r)?(t=">",_r++):(t=null,0===vr&&s('">"')),null===t&&(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null===t&&(92===n.charCodeAt(_r)?(t="\\",_r++):(t=null,0===vr&&s('"\\\\"')),null===t&&(t=h(),null===t&&(47===n.charCodeAt(_r)?(t="/",_r++):(t=null,0===vr&&s('"/"')),null===t&&(91===n.charCodeAt(_r)?(t="[",_r++):(t=null,0===vr&&s('"["')),null===t&&(93===n.charCodeAt(_r)?(t="]",_r++):(t=null,0===vr&&s('"]"')),null===t&&(63===n.charCodeAt(_r)?(t="?",_r++):(t=null,0===vr&&s('"?"')),null===t&&(123===n.charCodeAt(_r)?(t="{",_r++):(t=null,0===vr&&s('"{"')),null===t&&(125===n.charCodeAt(_r)?(t="}",_r++):(t=null,0===vr&&s('"}"'))))))))))))))))))))))))),null!==t)for(e=[];null!==t;)e.push(t),t=f(),null===t&&(45===n.charCodeAt(_r)?(t="-",_r++):(t=null,0===vr&&s('"-"')),null===t&&(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null===t&&(33===n.charCodeAt(_r)?(t="!",_r++):(t=null,0===vr&&s('"!"')),null===t&&(37===n.charCodeAt(_r)?(t="%",_r++):(t=null,0===vr&&s('"%"')),null===t&&(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null===t&&(95===n.charCodeAt(_r)?(t="_",_r++):(t=null,0===vr&&s('"_"')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(96===n.charCodeAt(_r)?(t="`",_r++):(t=null,0===vr&&s('"`"')),null===t&&(39===n.charCodeAt(_r)?(t="'",_r++):(t=null,0===vr&&s('"\'"')),null===t&&(126===n.charCodeAt(_r)?(t="~",_r++):(t=null,0===vr&&s('"~"')),null===t&&(40===n.charCodeAt(_r)?(t="(",_r++):(t=null,0===vr&&s('"("')),null===t&&(41===n.charCodeAt(_r)?(t=")",_r++):(t=null,0===vr&&s('")"')),null===t&&(60===n.charCodeAt(_r)?(t="<",_r++):(t=null,0===vr&&s('"<"')),null===t&&(62===n.charCodeAt(_r)?(t=">",_r++):(t=null,0===vr&&s('">"')),null===t&&(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null===t&&(92===n.charCodeAt(_r)?(t="\\",_r++):(t=null,0===vr&&s('"\\\\"')),null===t&&(t=h(),null===t&&(47===n.charCodeAt(_r)?(t="/",_r++):(t=null,0===vr&&s('"/"')),null===t&&(91===n.charCodeAt(_r)?(t="[",_r++):(t=null,0===vr&&s('"["')),null===t&&(93===n.charCodeAt(_r)?(t="]",_r++):(t=null,0===vr&&s('"]"')),null===t&&(63===n.charCodeAt(_r)?(t="?",_r++):(t=null,0===vr&&s('"?"')),null===t&&(123===n.charCodeAt(_r)?(t="{",_r++):(t=null,0===vr&&s('"{"')),null===t&&(125===n.charCodeAt(_r)?(t="}",_r++):(t=null,0===vr&&s('"}"')))))))))))))))))))))))));else e=null;return null!==e&&(e=function(e){return n.substring(_r,e)}(r)),null===e&&(_r=r),e}function O(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(42===n.charCodeAt(_r)?(t="*",_r++):(t=null,0===vr&&s('"*"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return"*"}(l)),null===e&&(_r=l),e}function x(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(47===n.charCodeAt(_r)?(t="/",_r++):(t=null,0===vr&&s('"/"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return"/"}(l)),null===e&&(_r=l),e}function U(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return"="}(l)),null===e&&(_r=l),e}function M(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(40===n.charCodeAt(_r)?(t="(",_r++):(t=null,0===vr&&s('"("')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return"("}(l)),null===e&&(_r=l),e}function P(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(41===n.charCodeAt(_r)?(t=")",_r++):(t=null,0===vr&&s('")"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return")"}(l)),null===e&&(_r=l),e}function q(){var e,t,r,l;return r=_r,l=_r,62===n.charCodeAt(_r)?(e=">",_r++):(e=null,0===vr&&s('">"')),null!==e?(t=C(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e){return">"}(r)),null===e&&(_r=r),e}function L(){var e,t,r,l;return r=_r,l=_r,e=C(),null!==e?(60===n.charCodeAt(_r)?(t="<",_r++):(t=null,0===vr&&s('"<"')),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e){return"<"}(r)),null===e&&(_r=r),e}function k(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return","}(l)),null===e&&(_r=l),e}function H(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return";"}(l)),null===e&&(_r=l),e}function F(){var e,t,r,l,i;return l=_r,i=_r,e=C(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=C(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return":"}(l)),null===e&&(_r=l),e}function G(){var e,t,n,r;return n=_r,r=_r,e=C(),null!==e?(t=h(),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),null!==e&&(e=function(e){return'"'}(n)),null===e&&(_r=n),e}function j(){var e,t,n,r;return n=_r,r=_r,e=h(),null!==e?(t=C(),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),null!==e&&(e=function(e){return'"'}(n)),null===e&&(_r=n),e}function W(){var e,t,n,r;if(r=_r,e=M(),null!==e){for(t=[],n=B(),null===n&&(n=J(),null===n&&(n=W()));null!==n;)t.push(n),n=B(),null===n&&(n=J(),null===n&&(n=W()));null!==t?(n=P(),null!==n?e=[e,t,n]:(e=null,_r=r)):(e=null,_r=r)}else e=null,_r=r;return e}function B(){var e;return/^[!-']/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[!-']")),null===e&&(/^[*-[]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[*-[]")),null===e&&(/^[\]-~]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\]-~]")),null===e&&(e=y(),null===e&&(e=v())))),e}function z(){var e,t,r,s,l,i;if(l=_r,i=_r,e=C(),null!==e)if(t=h(),null!==t){for(r=[],s=Y(),null===s&&(s=J());null!==s;)r.push(s),s=Y(),null===s&&(s=J());null!==r?(s=h(),null!==s?e=[e,t,r,s]:(e=null,_r=i)):(e=null,_r=i)}else e=null,_r=i;else e=null,_r=i;return null!==e&&(e=function(e){return n.substring(_r,e)}(l)),null===e&&(_r=l),e}function V(){var e,t,r,s,l,i;if(l=_r,i=_r,e=C(),null!==e)if(t=h(),null!==t){for(r=[],s=Y(),null===s&&(s=J());null!==s;)r.push(s),s=Y(),null===s&&(s=J());null!==r?(s=h(),null!==s?e=[e,t,r,s]:(e=null,_r=i)):(e=null,_r=i)}else e=null,_r=i;else e=null,_r=i;return null!==e&&(e=function(e){return n.substring(_r-1,e+1)}(l)),null===e&&(_r=l),e}function Y(){var e;return e=v(),null===e&&(33===n.charCodeAt(_r)?(e="!",_r++):(e=null,0===vr&&s('"!"')),null===e&&(/^[#-[]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[#-[]")),null===e&&(/^[\]-~]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[\\]-~]")),null===e&&(e=y())))),e}function J(){var e,t,r;return r=_r,92===n.charCodeAt(_r)?(e="\\",_r++):(e=null,0===vr&&s('"\\\\"')),null!==e?(/^[\0-\t]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[\\0-\\t]")),null===t&&(/^[\x0B-\f]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[\\x0B-\\f]")),null===t&&(/^[\x0E-]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[\\x0E-]")))),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),e}function K(){var e,t,r,l,i,o;return i=_r,o=_r,e=X(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=ee(),r=null!==r?r:"",null!==r?(l=se(),null!==l?e=[e,t,r,l]:(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o),null!==e&&(e=function(e){try{yr.uri=new Er(yr.scheme,yr.user,yr.host,yr.port),delete yr.scheme,delete yr.user,delete yr.host,delete yr.host_type,delete yr.port}catch(e){yr=-1}}(i)),null===e&&(_r=i),e}function $(){var e,t,l,i,o,u,a,c;return a=_r,c=_r,e=X(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(l=ee(),l=null!==l?l:"",null!==l?(i=se(),null!==i?(o=ge(),null!==o?(u=Ne(),u=null!==u?u:"",null!==u?e=[e,t,l,i,o,u]:(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c),null!==e&&(e=function(e){try{yr.uri=new Er(yr.scheme,yr.user,yr.host,yr.port,yr.uri_params,yr.uri_headers),delete yr.scheme,delete yr.user,delete yr.host,delete yr.host_type,delete yr.port,delete yr.uri_params,"SIP_URI"===r&&(yr=yr.uri)}catch(e){yr=-1}}(a)),null===e&&(_r=a),e}function X(){var e;return e=Q(),null===e&&(e=Z()),e}function Q(){var e,t;return t=_r,"sips"===n.substr(_r,4).toLowerCase()?(e=n.substr(_r,4),_r+=4):(e=null,0===vr&&s('"sips"')),null!==e&&(e=function(e,t){yr.scheme=t.toLowerCase()}(t,e)),null===e&&(_r=t),e}function Z(){var e,t;return t=_r,"sip"===n.substr(_r,3).toLowerCase()?(e=n.substr(_r,3),_r+=3):(e=null,0===vr&&s('"sip"')),null!==e&&(e=function(e,t){yr.scheme=t.toLowerCase()}(t,e)),null===e&&(_r=t),e}function ee(){var e,t,r,l,i,o;return l=_r,i=_r,e=te(),null!==e?(o=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=re(),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o),t=null!==t?t:"",null!==t?(64===n.charCodeAt(_r)?(r="@", +_r++):(r=null,0===vr&&s('"@"')),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){yr.user=decodeURIComponent(n.substring(_r-1,e))}(l)),null===e&&(_r=l),e}function te(){var e,t;if(t=g(),null===t&&(t=_(),null===t&&(t=ne())),null!==t)for(e=[];null!==t;)e.push(t),t=g(),null===t&&(t=_(),null===t&&(t=ne()));else e=null;return e}function ne(){var e;return 38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","')),null===e&&(59===n.charCodeAt(_r)?(e=";",_r++):(e=null,0===vr&&s('";"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"'))))))))),e}function re(){var e,t,r;for(r=_r,e=[],t=g(),null===t&&(t=_(),null===t&&(38===n.charCodeAt(_r)?(t="&",_r++):(t=null,0===vr&&s('"&"')),null===t&&(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(36===n.charCodeAt(_r)?(t="$",_r++):(t=null,0===vr&&s('"$"')),null===t&&(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","'))))))));null!==t;)e.push(t),t=g(),null===t&&(t=_(),null===t&&(38===n.charCodeAt(_r)?(t="&",_r++):(t=null,0===vr&&s('"&"')),null===t&&(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')),null===t&&(36===n.charCodeAt(_r)?(t="$",_r++):(t=null,0===vr&&s('"$"')),null===t&&(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","'))))))));return null!==e&&(e=function(e){yr.password=n.substring(_r,e)}(r)),null===e&&(_r=r),e}function se(){var e,t,r,l,i;return l=_r,e=le(),null!==e?(i=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=me(),null!==r?t=[t,r]:(t=null,_r=i)):(t=null,_r=i),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),e}function le(){var e,t;return t=_r,e=ie(),null===e&&(e=pe(),null===e&&(e=ae())),null!==e&&(e=function(e){return yr.host=n.substring(_r,e).toLowerCase(),yr.host}(t)),null===e&&(_r=t),e}function ie(){var e,t,r,l,i,o;for(l=_r,i=_r,e=[],o=_r,t=oe(),null!==t?(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."')),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o);null!==t;)e.push(t),o=_r,t=oe(),null!==t?(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."')),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o);return null!==e?(t=ue(),null!==t?(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."')),r=null!==r?r:"",null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return yr.host_type="domain",n.substring(_r,e)}(l)),null===e&&(_r=l),e}function oe(){var e,t,r,l;if(l=_r,e=f(),null!==e){for(t=[],r=f(),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(95===n.charCodeAt(_r)?(r="_",_r++):(r=null,0===vr&&s('"_"'))));null!==r;)t.push(r),r=f(),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(95===n.charCodeAt(_r)?(r="_",_r++):(r=null,0===vr&&s('"_"'))));null!==t?e=[e,t]:(e=null,_r=l)}else e=null,_r=l;return e}function ue(){var e,t,r,l;if(l=_r,e=o(),null!==e){for(t=[],r=f(),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(95===n.charCodeAt(_r)?(r="_",_r++):(r=null,0===vr&&s('"_"'))));null!==r;)t.push(r),r=f(),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(95===n.charCodeAt(_r)?(r="_",_r++):(r=null,0===vr&&s('"_"'))));null!==t?e=[e,t]:(e=null,_r=l)}else e=null,_r=l;return e}function ae(){var e,t,r,l,i;return l=_r,i=_r,91===n.charCodeAt(_r)?(e="[",_r++):(e=null,0===vr&&s('"["')),null!==e?(t=ce(),null!==t?(93===n.charCodeAt(_r)?(r="]",_r++):(r=null,0===vr&&s('"]"')),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){return yr.host_type="IPv6",n.substring(_r,e)}(l)),null===e&&(_r=l),e}function ce(){var e,t,r,l,i,o,u,a,c,h,d,p,f,m,g,T;return m=_r,g=_r,e=he(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?(58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?(58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?(58===n.charCodeAt(_r)?(a=":",_r++):(a=null,0===vr&&s('":"')),null!==a?(c=he(),null!==c?(58===n.charCodeAt(_r)?(h=":",_r++):(h=null,0===vr&&s('":"')),null!==h?(d=he(),null!==d?(58===n.charCodeAt(_r)?(p=":",_r++):(p=null,0===vr&&s('":"')),null!==p?(f=de(),null!==f?e=[e,t,r,l,i,o,u,a,c,h,d,p,f]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=he(),null!==a?(58===n.charCodeAt(_r)?(c=":",_r++):(c=null,0===vr&&s('":"')),null!==c?(h=he(),null!==h?(58===n.charCodeAt(_r)?(d=":",_r++):(d=null,0===vr&&s('":"')),null!==d?(p=de(),null!==p?e=[e,t,r,l,i,o,u,a,c,h,d,p]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=he(),null!==a?(58===n.charCodeAt(_r)?(c=":",_r++):(c=null,0===vr&&s('":"')),null!==c?(h=de(),null!==h?e=[e,t,r,l,i,o,u,a,c,h]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=de(),null!==a?e=[e,t,r,l,i,o,u,a]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=de(),null!==o?e=[e,t,r,l,i,o]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?(58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=de(),null!==l?e=[e,t,r,l]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=de(),null!==t?e=[e,t]:(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,"::"===n.substr(_r,2)?(e="::",_r+=2):(e=null,0===vr&&s('"::"')),null!==e?(t=he(),null!==t?e=[e,t]:(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?("::"===n.substr(_r,2)?(t="::",_r+=2):(t=null,0===vr&&s('"::"')),null!==t?(r=he(),null!==r?(58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?(58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?(58===n.charCodeAt(_r)?(a=":",_r++):(a=null,0===vr&&s('":"')),null!==a?(c=he(),null!==c?(58===n.charCodeAt(_r)?(h=":",_r++):(h=null,0===vr&&s('":"')),null!==h?(d=de(),null!==d?e=[e,t,r,l,i,o,u,a,c,h,d]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?("::"===n.substr(_r,2)?(r="::",_r+=2):(r=null,0===vr&&s('"::"')),null!==r?(l=he(),null!==l?(58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=he(),null!==a?(58===n.charCodeAt(_r)?(c=":",_r++):(c=null,0===vr&&s('":"')),null!==c?(h=de(),null!==h?e=[e,t,r,l,i,o,u,a,c,h]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?("::"===n.substr(_r,2)?(l="::",_r+=2):(l=null,0===vr&&s('"::"')),null!==l?(i=he(),null!==i?(58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?(58===n.charCodeAt(_r)?(a=":",_r++):(a=null,0===vr&&s('":"')),null!==a?(c=de(),null!==c?e=[e,t,r,l,i,o,u,a,c]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?(T=_r,58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?l=[l,i]:(l=null,_r=T)):(l=null,_r=T),l=null!==l?l:"",null!==l?("::"===n.substr(_r,2)?(i="::",_r+=2):(i=null,0===vr&&s('"::"')),null!==i?(o=he(),null!==o?(58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=de(),null!==a?e=[e,t,r,l,i,o,u,a]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?(T=_r,58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?l=[l,i]:(l=null,_r=T)):(l=null,_r=T),l=null!==l?l:"",null!==l?(T=_r,58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?i=[i,o]:(i=null,_r=T)):(i=null,_r=T),i=null!==i?i:"",null!==i?("::"===n.substr(_r,2)?(o="::",_r+=2):(o=null,0===vr&&s('"::"')),null!==o?(u=de(),null!==u?e=[e,t,r,l,i,o,u]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?(T=_r,58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?l=[l,i]:(l=null,_r=T)):(l=null,_r=T),l=null!==l?l:"",null!==l?(T=_r,58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?i=[i,o]:(i=null,_r=T)):(i=null,_r=T),i=null!==i?i:"",null!==i?(T=_r,58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?o=[o,u]:(o=null,_r=T)):(o=null,_r=T),o=null!==o?o:"",null!==o?("::"===n.substr(_r,2)?(u="::",_r+=2):(u=null,0===vr&&s('"::"')),null!==u?(a=he(),null!==a?e=[e,t,r,l,i,o,u,a]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g),null===e&&(g=_r,e=he(),null!==e?(T=_r,58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?t=[t,r]:(t=null,_r=T)):(t=null,_r=T),t=null!==t?t:"",null!==t?(T=_r,58===n.charCodeAt(_r)?(r=":",_r++):(r=null,0===vr&&s('":"')),null!==r?(l=he(),null!==l?r=[r,l]:(r=null,_r=T)):(r=null,_r=T),r=null!==r?r:"",null!==r?(T=_r,58===n.charCodeAt(_r)?(l=":",_r++):(l=null,0===vr&&s('":"')),null!==l?(i=he(),null!==i?l=[l,i]:(l=null,_r=T)):(l=null,_r=T),l=null!==l?l:"",null!==l?(T=_r,58===n.charCodeAt(_r)?(i=":",_r++):(i=null,0===vr&&s('":"')),null!==i?(o=he(),null!==o?i=[i,o]:(i=null,_r=T)):(i=null,_r=T),i=null!==i?i:"",null!==i?(T=_r,58===n.charCodeAt(_r)?(o=":",_r++):(o=null,0===vr&&s('":"')),null!==o?(u=he(),null!==u?o=[o,u]:(o=null,_r=T)):(o=null,_r=T),o=null!==o?o:"",null!==o?(T=_r,58===n.charCodeAt(_r)?(u=":",_r++):(u=null,0===vr&&s('":"')),null!==u?(a=he(),null!==a?u=[u,a]:(u=null,_r=T)):(u=null,_r=T),u=null!==u?u:"",null!==u?("::"===n.substr(_r,2)?(a="::",_r+=2):(a=null,0===vr&&s('"::"')),null!==a?e=[e,t,r,l,i,o,u,a]:(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g)):(e=null,_r=g))))))))))))))),null!==e&&(e=function(e){return yr.host_type="IPv6",n.substring(_r,e)}(m)),null===e&&(_r=m),e}function he(){var e,t,n,r,s;return s=_r,e=u(),null!==e?(t=u(),t=null!==t?t:"",null!==t?(n=u(),n=null!==n?n:"",null!==n?(r=u(),r=null!==r?r:"",null!==r?e=[e,t,n,r]:(e=null,_r=s)):(e=null,_r=s)):(e=null,_r=s)):(e=null,_r=s),e}function de(){var e,t,r,l;return l=_r,e=he(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=he(),null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),null===e&&(e=pe()),e}function pe(){var e,t,r,l,i,o,u,a,c;return a=_r,c=_r,e=fe(),null!==e?(46===n.charCodeAt(_r)?(t=".",_r++):(t=null,0===vr&&s('"."')),null!==t?(r=fe(),null!==r?(46===n.charCodeAt(_r)?(l=".",_r++):(l=null,0===vr&&s('"."')),null!==l?(i=fe(),null!==i?(46===n.charCodeAt(_r)?(o=".",_r++):(o=null,0===vr&&s('"."')),null!==o?(u=fe(),null!==u?e=[e,t,r,l,i,o,u]:(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c)):(e=null,_r=c),null!==e&&(e=function(e){return yr.host_type="IPv4",n.substring(_r,e)}(a)),null===e&&(_r=a),e}function fe(){var e,t,r,l;return l=_r,"25"===n.substr(_r,2)?(e="25",_r+=2):(e=null,0===vr&&s('"25"')),null!==e?(/^[0-5]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[0-5]")),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null===e&&(l=_r,50===n.charCodeAt(_r)?(e="2",_r++):(e=null,0===vr&&s('"2"')),null!==e?(/^[0-4]/.test(n.charAt(_r))?(t=n.charAt(_r),_r++):(t=null,0===vr&&s("[0-4]")),null!==t?(r=i(),null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),null===e&&(l=_r,49===n.charCodeAt(_r)?(e="1",_r++):(e=null,0===vr&&s('"1"')),null!==e?(t=i(),null!==t?(r=i(),null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),null===e&&(l=_r,/^[1-9]/.test(n.charAt(_r))?(e=n.charAt(_r),_r++):(e=null,0===vr&&s("[1-9]")),null!==e?(t=i(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null===e&&(e=i())))),e}function me(){var e,t,n,r,s,l,o;return l=_r,o=_r,e=i(),e=null!==e?e:"",null!==e?(t=i(),t=null!==t?t:"",null!==t?(n=i(),n=null!==n?n:"",null!==n?(r=i(),r=null!==r?r:"",null!==r?(s=i(),s=null!==s?s:"",null!==s?e=[e,t,n,r,s]:(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o)):(e=null,_r=o),null!==e&&(e=function(e,t){return t=parseInt(t.join("")),yr.port=t,t}(l,e)),null===e&&(_r=l),e}function ge(){var e,t,r,l;for(e=[],l=_r,59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null!==t?(r=Te(),null!==r?t=[t,r]:(t=null,_r=l)):(t=null,_r=l);null!==t;)e.push(t),l=_r,59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null!==t?(r=Te(),null!==r?t=[t,r]:(t=null,_r=l)):(t=null,_r=l);return e}function Te(){var e;return e=_e(),null===e&&(e=ve(),null===e&&(e=Ce(),null===e&&(e=Se(),null===e&&(e=Ee(),null===e&&(e=Ae(),null===e&&(e=ye())))))),e}function _e(){var e,t,r,l;return r=_r,l=_r,"transport="===n.substr(_r,10).toLowerCase()?(e=n.substr(_r,10),_r+=10):(e=null,0===vr&&s('"transport="')),null!==e?("udp"===n.substr(_r,3).toLowerCase()?(t=n.substr(_r,3),_r+=3):(t=null,0===vr&&s('"udp"')),null===t&&("tcp"===n.substr(_r,3).toLowerCase()?(t=n.substr(_r,3),_r+=3):(t=null,0===vr&&s('"tcp"')),null===t&&("sctp"===n.substr(_r,4).toLowerCase()?(t=n.substr(_r,4),_r+=4):(t=null,0===vr&&s('"sctp"')),null===t&&("tls"===n.substr(_r,3).toLowerCase()?(t=n.substr(_r,3),_r+=3):(t=null,0===vr&&s('"tls"')),null===t&&(t=I())))),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.uri_params||(yr.uri_params={}),yr.uri_params.transport=t.toLowerCase()}(r,e[1])),null===e&&(_r=r),e}function ve(){var e,t,r,l;return r=_r,l=_r,"user="===n.substr(_r,5).toLowerCase()?(e=n.substr(_r,5),_r+=5):(e=null,0===vr&&s('"user="')),null!==e?("phone"===n.substr(_r,5).toLowerCase()?(t=n.substr(_r,5),_r+=5):(t=null,0===vr&&s('"phone"')),null===t&&("ip"===n.substr(_r,2).toLowerCase()?(t=n.substr(_r,2),_r+=2):(t=null,0===vr&&s('"ip"')),null===t&&(t=I())),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.uri_params||(yr.uri_params={}),yr.uri_params.user=t.toLowerCase()}(r,e[1])),null===e&&(_r=r),e}function Ce(){var e,t,r,l;return r=_r,l=_r,"method="===n.substr(_r,7).toLowerCase()?(e=n.substr(_r,7),_r+=7):(e=null,0===vr&&s('"method="')),null!==e?(t=at(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.uri_params||(yr.uri_params={}),yr.uri_params.method=t}(r,e[1])),null===e&&(_r=r),e}function Se(){var e,t,r,l;return r=_r,l=_r,"ttl="===n.substr(_r,4).toLowerCase()?(e=n.substr(_r,4),_r+=4):(e=null,0===vr&&s('"ttl="')),null!==e?(t=Jn(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.params||(yr.params={}),yr.params.ttl=t}(r,e[1])),null===e&&(_r=r),e}function Ee(){var e,t,r,l;return r=_r,l=_r,"maddr="===n.substr(_r,6).toLowerCase()?(e=n.substr(_r,6),_r+=6):(e=null,0===vr&&s('"maddr="')),null!==e?(t=le(),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),null!==e&&(e=function(e,t){yr.uri_params||(yr.uri_params={}),yr.uri_params.maddr=t}(r,e[1])),null===e&&(_r=r),e}function Ae(){var e,t,r,l,i,o;return l=_r,i=_r,"lr"===n.substr(_r,2).toLowerCase()?(e=n.substr(_r,2),_r+=2):(e=null,0===vr&&s('"lr"')),null!==e?(o=_r,61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null!==t?(r=I(),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){yr.uri_params||(yr.uri_params={}),yr.uri_params.lr=void 0}(l)),null===e&&(_r=l),e}function ye(){var e,t,r,l,i,o;return l=_r,i=_r,e=Re(),null!==e?(o=_r,61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null!==t?(r=be(),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e,t,n){yr.uri_params||(yr.uri_params={}),n="undefined"==typeof n?void 0:n[1],yr.uri_params[t.toLowerCase()]=n}(l,e[0],e[1])),null===e&&(_r=l),e}function Re(){var e,t,n;if(n=_r,t=Ie(),null!==t)for(e=[];null!==t;)e.push(t),t=Ie();else e=null;return null!==e&&(e=function(e,t){return t.join("")}(n,e)),null===e&&(_r=n),e}function be(){var e,t,n;if(n=_r,t=Ie(),null!==t)for(e=[];null!==t;)e.push(t),t=Ie();else e=null;return null!==e&&(e=function(e,t){return t.join("")}(n,e)),null===e&&(_r=n),e}function Ie(){var e;return e=we(),null===e&&(e=g(),null===e&&(e=_())),e}function we(){var e;return 91===n.charCodeAt(_r)?(e="[",_r++):(e=null,0===vr&&s('"["')),null===e&&(93===n.charCodeAt(_r)?(e="]",_r++):(e=null,0===vr&&s('"]"')),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')))))))),e}function Ne(){var e,t,r,l,i,o,u;if(o=_r,63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null!==e)if(t=De(),null!==t){for(r=[],u=_r,38===n.charCodeAt(_r)?(l="&",_r++):(l=null,0===vr&&s('"&"')),null!==l?(i=De(),null!==i?l=[l,i]:(l=null,_r=u)):(l=null,_r=u);null!==l;)r.push(l),u=_r,38===n.charCodeAt(_r)?(l="&",_r++):(l=null,0===vr&&s('"&"')),null!==l?(i=De(),null!==i?l=[l,i]:(l=null,_r=u)):(l=null,_r=u);null!==r?e=[e,t,r]:(e=null,_r=o)}else e=null,_r=o;else e=null,_r=o;return e}function De(){var e,t,r,l,i;return l=_r,i=_r,e=Oe(),null!==e?(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null!==t?(r=xe(),null!==r?e=[e,t,r]:(e=null,_r=i)):(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e,t,n){t=t.join("").toLowerCase(),n=n.join(""),yr.uri_headers||(yr.uri_headers={}),yr.uri_headers[t]?yr.uri_headers[t].push(n):yr.uri_headers[t]=[n]}(l,e[0],e[2])),null===e&&(_r=l),e}function Oe(){var e,t;if(t=Ue(),null===t&&(t=g(),null===t&&(t=_())),null!==t)for(e=[];null!==t;)e.push(t),t=Ue(),null===t&&(t=g(),null===t&&(t=_()));else e=null;return e}function xe(){var e,t;for(e=[],t=Ue(),null===t&&(t=g(),null===t&&(t=_()));null!==t;)e.push(t),t=Ue(),null===t&&(t=g(),null===t&&(t=_()));return e}function Ue(){var e;return 91===n.charCodeAt(_r)?(e="[",_r++):(e=null,0===vr&&s('"["')),null===e&&(93===n.charCodeAt(_r)?(e="]",_r++):(e=null,0===vr&&s('"]"')),null===e&&(47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')))))))),e}function Me(){var e;return e=ct(),null===e&&(e=Pe()),e}function Pe(){var e,t,n,r,s,l;return l=_r,e=at(),null!==e?(t=d(),null!==t?(n=qe(),null!==n?(r=d(),null!==r?(s=Ze(),null!==s?e=[e,t,n,r,s]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),e}function qe(){var e;return e=$(),null===e&&(e=Le()),e}function Le(){var e,t,r,l;return l=_r,e=Je(),null!==e?(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null!==t?(r=ke(),null===r&&(r=Ge()),null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),e}function ke(){var e,t,r,l,i;return l=_r,e=He(),null===e&&(e=Fe()),null!==e?(i=_r,63===n.charCodeAt(_r)?(t="?",_r++):(t=null,0===vr&&s('"?"')),null!==t?(r=Qe(),null!==r?t=[t,r]:(t=null,_r=i)):(t=null,_r=i),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),e}function He(){var e,t,r,l;return l=_r,"//"===n.substr(_r,2)?(e="//",_r+=2):(e=null,0===vr&&s('"//"')),null!==e?(t=Ke(),null!==t?(r=Fe(),r=null!==r?r:"",null!==r?e=[e,t,r]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),e}function Fe(){var e,t,r;return r=_r,47===n.charCodeAt(_r)?(e="/",_r++):(e=null,0===vr&&s('"/"')),null!==e?(t=Be(),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),e}function Ge(){var e,t,n,r;if(r=_r,e=We(),null!==e){for(t=[],n=je();null!==n;)t.push(n),n=je();null!==t?e=[e,t]:(e=null,_r=r)}else e=null,_r=r;return e}function je(){var e;return e=m(),null===e&&(e=g(),null===e&&(e=_())),e}function We(){var e;return e=g(),null===e&&(e=_(),null===e&&(59===n.charCodeAt(_r)?(e=";",_r++):(e=null,0===vr&&s('";"')),null===e&&(63===n.charCodeAt(_r)?(e="?",_r++):(e=null,0===vr&&s('"?"')),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(64===n.charCodeAt(_r)?(e="@",_r++):(e=null,0===vr&&s('"@"')),null===e&&(38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","')))))))))))),e}function Be(){var e,t,r,l,i,o;if(i=_r,e=ze(),null!==e){for(t=[],o=_r,47===n.charCodeAt(_r)?(r="/",_r++):(r=null,0===vr&&s('"/"')),null!==r?(l=ze(),null!==l?r=[r,l]:(r=null,_r=o)):(r=null,_r=o);null!==r;)t.push(r),o=_r,47===n.charCodeAt(_r)?(r="/",_r++):(r=null,0===vr&&s('"/"')),null!==r?(l=ze(),null!==l?r=[r,l]:(r=null,_r=o)):(r=null,_r=o);null!==t?e=[e,t]:(e=null,_r=i)}else e=null,_r=i;return e}function ze(){var e,t,r,l,i,o;for(i=_r,e=[],t=Ye();null!==t;)e.push(t),t=Ye();if(null!==e){for(t=[],o=_r,59===n.charCodeAt(_r)?(r=";",_r++):(r=null,0===vr&&s('";"')),null!==r?(l=Ve(),null!==l?r=[r,l]:(r=null,_r=o)):(r=null,_r=o);null!==r;)t.push(r),o=_r,59===n.charCodeAt(_r)?(r=";",_r++):(r=null,0===vr&&s('";"')),null!==r?(l=Ve(),null!==l?r=[r,l]:(r=null,_r=o)):(r=null,_r=o);null!==t?e=[e,t]:(e=null,_r=i)}else e=null,_r=i;return e}function Ve(){var e,t;for(e=[],t=Ye();null!==t;)e.push(t),t=Ye();return e}function Ye(){var e;return e=g(),null===e&&(e=_(),null===e&&(58===n.charCodeAt(_r)?(e=":",_r++):(e=null,0===vr&&s('":"')),null===e&&(64===n.charCodeAt(_r)?(e="@",_r++):(e=null,0===vr&&s('"@"')),null===e&&(38===n.charCodeAt(_r)?(e="&",_r++):(e=null,0===vr&&s('"&"')),null===e&&(61===n.charCodeAt(_r)?(e="=",_r++):(e=null,0===vr&&s('"="')),null===e&&(43===n.charCodeAt(_r)?(e="+",_r++):(e=null,0===vr&&s('"+"')),null===e&&(36===n.charCodeAt(_r)?(e="$",_r++):(e=null,0===vr&&s('"$"')),null===e&&(44===n.charCodeAt(_r)?(e=",",_r++):(e=null,0===vr&&s('","')))))))))),e}function Je(){var e,t,r,l,u;if(l=_r,u=_r,e=o(),null!==e){for(t=[],r=o(),null===r&&(r=i(),null===r&&(43===n.charCodeAt(_r)?(r="+",_r++):(r=null,0===vr&&s('"+"')),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."'))))));null!==r;)t.push(r),r=o(),null===r&&(r=i(),null===r&&(43===n.charCodeAt(_r)?(r="+",_r++):(r=null,0===vr&&s('"+"')),null===r&&(45===n.charCodeAt(_r)?(r="-",_r++):(r=null,0===vr&&s('"-"')),null===r&&(46===n.charCodeAt(_r)?(r=".",_r++):(r=null,0===vr&&s('"."'))))));null!==t?e=[e,t]:(e=null,_r=u)}else e=null,_r=u;return null!==e&&(e=function(e){yr.scheme=n.substring(_r,e)}(l)),null===e&&(_r=l),e}function Ke(){var e;return e=$e(),null===e&&(e=Xe()),e}function $e(){var e,t,r,l;return r=_r,l=_r,e=ee(),null!==e?(64===n.charCodeAt(_r)?(t="@",_r++):(t=null,0===vr&&s('"@"')),null!==t?e=[e,t]:(e=null,_r=l)):(e=null,_r=l),e=null!==e?e:"",null!==e?(t=se(),null!==t?e=[e,t]:(e=null,_r=r)):(e=null,_r=r),e=null!==e?e:""}function Xe(){var e,t;if(t=g(),null===t&&(t=_(),null===t&&(36===n.charCodeAt(_r)?(t="$",_r++):(t=null,0===vr&&s('"$"')),null===t&&(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","')),null===t&&(59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null===t&&(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null===t&&(64===n.charCodeAt(_r)?(t="@",_r++):(t=null,0===vr&&s('"@"')),null===t&&(38===n.charCodeAt(_r)?(t="&",_r++):(t=null,0===vr&&s('"&"')),null===t&&(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"'))))))))))),null!==t)for(e=[];null!==t;)e.push(t),t=g(),null===t&&(t=_(),null===t&&(36===n.charCodeAt(_r)?(t="$",_r++):(t=null,0===vr&&s('"$"')),null===t&&(44===n.charCodeAt(_r)?(t=",",_r++):(t=null,0===vr&&s('","')),null===t&&(59===n.charCodeAt(_r)?(t=";",_r++):(t=null,0===vr&&s('";"')),null===t&&(58===n.charCodeAt(_r)?(t=":",_r++):(t=null,0===vr&&s('":"')),null===t&&(64===n.charCodeAt(_r)?(t="@",_r++):(t=null,0===vr&&s('"@"')),null===t&&(38===n.charCodeAt(_r)?(t="&",_r++):(t=null,0===vr&&s('"&"')),null===t&&(61===n.charCodeAt(_r)?(t="=",_r++):(t=null,0===vr&&s('"="')),null===t&&(43===n.charCodeAt(_r)?(t="+",_r++):(t=null,0===vr&&s('"+"')))))))))));else e=null;return e}function Qe(){var e,t;for(e=[],t=je();null!==t;)e.push(t),t=je();return e}function Ze(){var e,t,r,l,o,u,a,c;if(a=_r,c=_r,"sip"===n.substr(_r,3).toLowerCase()?(e=n.substr(_r,3),_r+=3):(e=null,0===vr&&s('"SIP"')),null!==e)if(47===n.charCodeAt(_r)?(t="/",_r++):(t=null,0===vr&&s('"/"')),null!==t){if(l=i(),null!==l)for(r=[];null!==l;)r.push(l),l=i();else r=null;if(null!==r)if(46===n.charCodeAt(_r)?(l=".",_r++):(l=null,0===vr&&s('"."')),null!==l){if(u=i(),null!==u)for(o=[];null!==u;)o.push(u),u=i();else o=null;null!==o?e=[e,t,r,l,o]:(e=null,_r=c)}else e=null,_r=c;else e=null,_r=c}else e=null,_r=c;else e=null,_r=c;return null!==e&&(e=function(e){yr.sip_version=n.substring(_r,e)}(a)),null===e&&(_r=a),e}function et(){var e;return"INVITE"===n.substr(_r,6)?(e="INVITE",_r+=6):(e=null,0===vr&&s('"INVITE"')),e}function tt(){var e;return"ACK"===n.substr(_r,3)?(e="ACK",_r+=3):(e=null,0===vr&&s('"ACK"')),e}function nt(){var e;return"OPTIONS"===n.substr(_r,7)?(e="OPTIONS",_r+=7):(e=null,0===vr&&s('"OPTIONS"')),e}function rt(){var e;return"BYE"===n.substr(_r,3)?(e="BYE",_r+=3):(e=null,0===vr&&s('"BYE"')),e}function st(){var e;return"CANCEL"===n.substr(_r,6)?(e="CANCEL",_r+=6):(e=null,0===vr&&s('"CANCEL"')),e}function lt(){var e;return"REGISTER"===n.substr(_r,8)?(e="REGISTER",_r+=8):(e=null,0===vr&&s('"REGISTER"')),e}function it(){var e;return"SUBSCRIBE"===n.substr(_r,9)?(e="SUBSCRIBE",_r+=9):(e=null,0===vr&&s('"SUBSCRIBE"')),e}function ot(){var e;return"NOTIFY"===n.substr(_r,6)?(e="NOTIFY",_r+=6):(e=null,0===vr&&s('"NOTIFY"')),e}function ut(){var e;return"REFER"===n.substr(_r,5)?(e="REFER",_r+=5):(e=null,0===vr&&s('"REFER"')),e}function at(){var e,t;return t=_r,e=et(),null===e&&(e=tt(),null===e&&(e=nt(),null===e&&(e=rt(),null===e&&(e=st(),null===e&&(e=lt(),null===e&&(e=it(),null===e&&(e=ot(),null===e&&(e=ut(),null===e&&(e=I()))))))))),null!==e&&(e=function(e){return yr.method=n.substring(_r,e),yr.method}(t)),null===e&&(_r=t),e}function ct(){var e,t,n,r,s,l;return l=_r,e=Ze(),null!==e?(t=d(),null!==t?(n=ht(),null!==n?(r=d(),null!==r?(s=pt(),null!==s?e=[e,t,n,r,s]:(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l)):(e=null,_r=l),e}function ht(){var e,t;return t=_r,e=dt(),null!==e&&(e=function(e,t){yr.status_code=parseInt(t.join(""))}(t,e)),null===e&&(_r=t),e}function dt(){var e,t,n,r;return r=_r,e=i(),null!==e?(t=i(),null!==t?(n=i(),null!==n?e=[e,t,n]:(e=null,_r=r)):(e=null,_r=r)):(e=null,_r=r),e}function pt(){var e,t,r;for(r=_r,e=[],t=m(),null===t&&(t=g(),null===t&&(t=_(),null===t&&(t=y(),null===t&&(t=R(),null===t&&(t=d(),null===t&&(t=p()))))));null!==t;)e.push(t),t=m(),null===t&&(t=g(),null===t&&(t=_(),null===t&&(t=y(),null===t&&(t=R(),null===t&&(t=d(),null===t&&(t=p()))))));return null!==e&&(e=function(e){yr.reason_phrase=n.substring(_r,e)}(r)),null===e&&(_r=r),e}function ft(){var e,t,n,r,s,l;if(s=_r,e=Yt(),null!==e){for(t=[],l=_r,n=k(),null!==n?(r=Yt(),null!==r?n=[n,r]:(n=null,_r=l)):(n=null,_r=l);null!==n;)t.push(n),l=_r,n=k(),null!==n?(r=Yt(),null!==r?n=[n,r]:(n=null,_r=l)):(n=null,_r=l);null!==t?e=[e,t]:(e=null,_r=s)}else e=null,_r=s;return e}function mt(){var e,t,r,l,i,o;return l=_r,i=_r,e=D(),null!==e?(o=_r,64===n.charCodeAt(_r)?(t="@",_r++):(t=null,0===vr&&s('"@"')),null!==t?(r=D(),null!==r?t=[t,r]:(t=null,_r=o)):(t=null,_r=o),t=null!==t?t:"",null!==t?e=[e,t]:(e=null,_r=i)):(e=null,_r=i),null!==e&&(e=function(e){yr=n.substring(_r,e)}(l)),null===e&&(_r=l),e}function gt(){var e,t,n,r,s,l,i;if(s=_r,e=O(),null===e)if(l=_r,e=Tt(),null!==e){for(t=[],i=_r,n=k(),null!==n?(r=Tt(),null!==r?n=[n,r]:(n=null,_r=i)):(n=null,_r=i);null!==n;)t.push(n),i=_r,n=k(),null!==n?(r=Tt(),null!==r?n=[n,r]:(n=null,_r=i)):(n=null,_r=i);null!==t?e=[e,t]:(e=null, +_r=l)}else e=null,_r=l;return null!==e&&(e=function(e){var t,n;for(n=yr.multi_header.length,t=0;t=700)throw new TypeError("Invalid status_code: "+t);this.request.reply(t,n,r,s)},r.prototype.newMessage=function(e,t){"remote"===e?(this.direction="incoming",this.local_identity=t.to,this.remote_identity=t.from):"local"===e&&(this.direction="outgoing",this.local_identity=t.from,this.remote_identity=t.to),this.ua.newMessage({originator:e,message:this,request:t})}},{"./Constants":1,"./Exceptions":5,"./RequestSender":17,"./SIPMessage":18,"./Transactions":21,"./Utils":25,events:28,util:32}],9:[function(e,t,n){function r(e,t,n){var r;if(!(e&&e instanceof s))throw new TypeError('missing or invalid "uri" parameter');this.uri=e,this.parameters={};for(r in n)this.setParam(r,n[r]);Object.defineProperties(this,{display_name:{get:function(){return t},set:function(e){t=0===e?"0":e}}})}t.exports=r;var s=e("./URI"),l=e("./Grammar");r.prototype={setParam:function(e,t){e&&(this.parameters[e.toLowerCase()]="undefined"==typeof t||null===t?null:t.toString())},getParam:function(e){if(e)return this.parameters[e.toLowerCase()]},hasParam:function(e){if(e)return this.parameters.hasOwnProperty(e.toLowerCase())&&!0||!1},deleteParam:function(e){var t;if(e=e.toLowerCase(),this.parameters.hasOwnProperty(e))return t=this.parameters[e],delete this.parameters[e],t},clearParams:function(){this.parameters={}},clone:function(){return new r(this.uri.clone(),this.display_name,JSON.parse(JSON.stringify(this.parameters)))},toString:function(){var e,t;e=this.display_name||0===this.display_name?'"'+this.display_name+'" ':"",e+="<"+this.uri.toString()+">";for(t in this.parameters)e+=";"+t,null!==this.parameters[t]&&(e+="="+this.parameters[t]);return e}},r.parse=function(e){return e=l.parse(e,"Name_Addr_Header"),e!==-1?e:void 0}},{"./Grammar":6,"./URI":24}],10:[function(e,t,n){function r(e,t){var n=t,r=0,s=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===r;){if(s=e.indexOf("\r\n",n),s===-1)return s;!e.substring(s+2,s+4).match(/(^\r\n)/)&&e.charAt(s+2).match(/(^\s+)/)?n=s+2:r=s}return r}function s(e,t,n,r){var s,l,i,a,c=t.indexOf(":",n),h=t.substring(n,c).trim(),d=t.substring(c+1,r).trim();switch(h.toLowerCase()){case"via":case"v":e.addHeader("via",d),1===e.getHeaders("via").length?(a=e.parseHeader("Via"),a&&(e.via=a,e.via_branch=a.branch)):a=0;break;case"from":case"f":e.setHeader("from",d),a=e.parseHeader("from"),a&&(e.from=a,e.from_tag=a.getParam("tag"));break;case"to":case"t":e.setHeader("to",d),a=e.parseHeader("to"),a&&(e.to=a,e.to_tag=a.getParam("tag"));break;case"record-route":if(a=o.parse(d,"Record_Route"),a===-1)a=void 0;else for(i=a.length,l=0;lK.T2&&(r=K.T2)),n.timers.invite2xxTimer=setTimeout(s,r))},r)}function l(){var e=this;this.timers.ackTimer=setTimeout(function(){e.status===k.STATUS_WAITING_FOR_ACK&&(G("no ACK received, terminating the session"),clearTimeout(e.timers.invite2xxTimer),v.call(e,z.BYE),x.call(e,"remote",null,z.causes.NO_ACK))},K.TIMER_H)}function i(e,t){var n=this;this.connection=new W.RTCPeerConnection(e,t),this.connection.onaddstream=function(e,t){n.emit("addstream",{stream:t})},this.connection.onremovestream=function(e,t){n.emit("removestream",{stream:t})},this.connection.oniceconnectionstatechange=function(e,t){n.emit("iceconnectionstatechange",{state:t}),"failed"===t&&n.terminate({cause:z.causes.RTP_TIMEOUT,status_code:200,reason_phrase:z.causes.RTP_TIMEOUT})}}function o(e,t,n,r){function s(r){i.onicecandidate=function(n,r){if(!r){if(i.onicecandidate=null,l.rtcReady=!0,t){var s={originator:"local",type:e,sdp:i.localDescription.sdp};l.emit("sdp",s),t(s.sdp)}t=null}},i.setLocalDescription(r,function(){if("complete"===i.iceGatheringState){if(l.rtcReady=!0,t){var n={originator:"local",type:e,sdp:i.localDescription.sdp};l.emit("sdp",n),t(n.sdp)}t=null}},function(e){l.rtcReady=!0,n&&n(e)})}G("createLocalDescription()");var l=this,i=this.connection;if(this.rtcReady=!1,"offer"===e)i.createOffer(s,function(e){l.rtcReady=!0,n&&n(e)},r);else{if("answer"!==e)throw new Error('createLocalDescription() | type must be "offer" or "answer", but "'+e+'" was given');i.createAnswer(s,function(e){l.rtcReady=!0,n&&n(e)},r)}}function u(e,t,n){var r,s,l="UAS"===t?e.to_tag:e.from_tag,i="UAS"===t?e.from_tag:e.to_tag,o=e.call_id+l+i;return s=this.earlyDialogs[o],n?!!s||(s=new X(this,e,t,X.C.STATUS_EARLY),s.error?(G(s.error),U.call(this,"remote",e,z.causes.INTERNAL_ERROR),!1):(this.earlyDialogs[o]=s,!0)):(this.from_tag=e.from_tag,this.to_tag=e.to_tag,s?(s.update(e,t),this.dialog=s,delete this.earlyDialogs[o],!0):(r=new X(this,e,t),r.error?(G(r.error),U.call(this,"remote",e,z.causes.INTERNAL_ERROR),!1):(this.dialog=r,!0)))}function a(e){function t(t){t=t||{},f=!0;var n=t.status_code||403,r=t.reason_phrase||"",s=t.extraHeaders&&t.extraHeaders.slice()||[];if(this.status!==k.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: "+n);e.reply(n,r,s)}function n(){r(function(t){var n=["Contact: "+h.contact];E.call(h,e,n),h.late_sdp&&(t=C.call(h,t)),e.reply(200,null,n,t,function(){h.status=k.STATUS_WAITING_FOR_ACK,s.call(h,e,t),l.call(h)}),"function"==typeof m.callback&&m.callback()},function(){e.reply(500)})}function r(e,t){h.late_sdp?o.call(h,"offer",e,t,h.rtcOfferConstraints):(h.remoteHold===!0&&p===!1?(h.remoteHold=!1,P.call(h,"remote")):h.remoteHold===!1&&p===!0&&(h.remoteHold=!0,M.call(h,"remote")),o.call(h,"answer",e,t,h.rtcAnswerConstraints))}G("receiveReinvite()");var i,u,a,c,h=this,d=e.getHeader("Content-Type"),p=!1,f=!1,m={request:e,callback:void 0,reject:t.bind(this)};if(this.emit("reinvite",m),!f)if(e.body){if(this.late_sdp=!1,"application/sdp"!==d)return G("invalid Content-Type"),void e.reply(415);for(i=e.parseSDP(),u=0;u=700)throw new TypeError("Invalid status_code: "+n);e.reply(n,r,s)}G("receiveUpdate()");var n,r,s,l,i=this,u=e.getHeader("Content-Type"),a=!1,c=!1,h={request:e,callback:void 0,reject:t.bind(this)};if(this.emit("update",h),!a){if(!e.body){var d=[];return E.call(this,e,d),void e.reply(200,null,d)}if("application/sdp"!==u)return G("invalid Content-Type"),void e.reply(415);for(n=e.parseSDP(),r=0;r=200&&e.status_code<=299)return this.dialog.id.call_id===e.call_id&&this.dialog.id.local_tag===e.from_tag&&this.dialog.id.remote_tag===e.to_tag?void v.call(this,z.ACK):(n=new X(this,e,"UAC"),void 0!==n.error?void G(n.error):(n.sendRequest({owner:{status:k.STATUS_TERMINATED},onRequestTimeout:function(){},onTransportError:function(){},onDialogError:function(){},receiveResponse:function(){}},z.ACK),void n.sendRequest({owner:{status:k.STATUS_TERMINATED},onRequestTimeout:function(){},onTransportError:function(){},onDialogError:function(){},receiveResponse:function(){}},z.BYE)));if(this.isCanceled)return this.isCanceled=!1,void(e.status_code>=100&&e.status_code<200?this.request.cancel(this.cancelReason):e.status_code>=200&&e.status_code<299&&_.call(this,e));if(this.status===k.STATUS_INVITE_SENT||this.status===k.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(e.status_code):this.status=k.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(e.status_code):if(!e.to_tag){G("1xx response received without to tag");break}if(e.hasHeader("contact")&&!u.call(this,e,"UAC",!0))break;if(this.status=k.STATUS_1XX_RECEIVED,N.call(this,"remote",e),!e.body)break;r={originator:"remote",type:"pranswer",sdp:e.body},this.emit("sdp",r),this.connection.setRemoteDescription(new W.RTCSessionDescription({type:"pranswer",sdp:r.sdp}),null,null);break;case/^2[0-9]{2}$/.test(e.status_code):if(this.status=k.STATUS_CONFIRMED,!e.body){_.call(this,e,400,z.causes.MISSING_SDP),U.call(this,"remote",e,z.causes.BAD_MEDIA_DESCRIPTION);break}if(!u.call(this,e,"UAC"))break;r={originator:"remote",type:"answer",sdp:e.body},this.emit("sdp",r),this.connection.setRemoteDescription(new W.RTCSessionDescription({type:"answer",sdp:r.sdp}),function(){A.call(s,e),D.call(s,"remote",e),v.call(s,z.ACK),O.call(s,"local",null)},function(){_.call(s,e,488,"Not Acceptable Here"),U.call(s,"remote",e,z.causes.BAD_MEDIA_DESCRIPTION)});break;default:t=J.sipErrorCause(e.status_code),U.call(this,"remote",e,t)}}function g(e){function t(e){if(r.status!==k.STATUS_TERMINATED&&(v.call(r,z.ACK),!u)){if(A.call(r,e),!e.body)return void n();if("application/sdp"!==e.getHeader("Content-Type"))return void n();var t={originator:"remote",type:"answer",sdp:e.body};r.emit("sdp",t),r.connection.setRemoteDescription(new W.RTCSessionDescription({type:"answer",sdp:t.sdp}),function(){l.succeeded&&l.succeeded(e)},function(){n()})}}function n(e){l.failed&&l.failed(e)}G("sendReinvite()"),e=e||{};var r=this,s=e.extraHeaders||[],l=e.eventHandlers||{},i=e.rtcOfferConstraints||this.rtcOfferConstraints||null,u=!1;s.push("Contact: "+this.contact),s.push("Content-Type: application/sdp"),this.sessionTimers.running&&s.push("Session-Expires: "+this.sessionTimers.currentExpires+";refresher="+(this.sessionTimers.refresher?"uac":"uas")),o.call(this,"offer",function(e){e=C.call(r,e);var l=new Z(r,z.INVITE);l.send({extraHeaders:s,body:e,eventHandlers:{onSuccessResponse:function(e){t(e),u=!0},onErrorResponse:function(e){n(e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})},function(){n()},i)}function T(e){function t(e){if(r.status!==k.STATUS_TERMINATED&&!a)if(A.call(r,e),u){if(!e.body)return void n();if("application/sdp"!==e.getHeader("Content-Type"))return void n();var t={originator:"remote",type:"answer",sdp:e.body};r.emit("sdp",t),r.connection.setRemoteDescription(new W.RTCSessionDescription({type:"answer",sdp:t.sdp}),function(){l.succeeded&&l.succeeded(e)},function(){n()})}else l.succeeded&&l.succeeded(e)}function n(e){l.failed&&l.failed(e)}G("sendUpdate()"),e=e||{};var r=this,s=e.extraHeaders||[],l=e.eventHandlers||{},i=e.rtcOfferConstraints||this.rtcOfferConstraints||null,u=e.sdpOffer||!1,a=!1;if(s.push("Contact: "+this.contact),this.sessionTimers.running&&s.push("Session-Expires: "+this.sessionTimers.currentExpires+";refresher="+(this.sessionTimers.refresher?"uac":"uas")),u)s.push("Content-Type: application/sdp"),o.call(this,"offer",function(e){e=C.call(r,e);var l=new Z(r,z.UPDATE);l.send({extraHeaders:s,body:e,eventHandlers:{onSuccessResponse:function(e){t(e),a=!0},onErrorResponse:function(e){n(e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})},function(){n()},i);else{var c=new Z(r,z.UPDATE);c.send({extraHeaders:s,eventHandlers:{onSuccessResponse:function(e){t(e)},onErrorResponse:function(e){n(e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}}function _(e,t,n){G("acceptAndTerminate()");var r=[];t&&(n=n||z.REASON_PHRASE[t]||"",r.push("Reason: SIP ;cause="+t+'; text="'+n+'"')),(this.dialog||u.call(this,e,"UAC"))&&(v.call(this,z.ACK),v.call(this,z.BYE,{extraHeaders:r})),this.status=k.STATUS_TERMINATED}function v(e,t){G("sendRequest()");var n=new Z(this,e);n.send(t)}function C(e){var t,n,r;if(!this.localHold&&!this.remoteHold)return e;if(e=B.parse(e),this.localHold&&!this.remoteHold)for(G("mangleOffer() | me on hold, mangling offer"),n=e.media.length,t=0;t=z.MIN_SESSION_EXPIRES?(this.sessionTimers.currentExpires=e.session_expires,n=e.session_expires_refresher||"uas"):(this.sessionTimers.currentExpires=this.sessionTimers.defaultExpires,n="uas"),t.push("Session-Expires: "+this.sessionTimers.currentExpires+";refresher="+n),this.sessionTimers.refresher="uas"===n,y.call(this)}}function A(e){if(this.sessionTimers.enabled){var t;e.session_expires&&e.session_expires>=z.MIN_SESSION_EXPIRES?(this.sessionTimers.currentExpires=e.session_expires,t=e.session_expires_refresher||"uac"):(this.sessionTimers.currentExpires=this.sessionTimers.defaultExpires,t="uac"),this.sessionTimers.refresher="uac"===t,y.call(this)}}function y(){var e=this,t=this.sessionTimers.currentExpires;this.sessionTimers.running=!0,clearTimeout(this.sessionTimers.timer),this.sessionTimers.refresher?this.sessionTimers.timer=setTimeout(function(){e.status!==k.STATUS_TERMINATED&&(G("runSessionTimer() | sending session refresh request"),T.call(e,{eventHandlers:{succeeded:function(t){A.call(e,t)}}}))},500*t):this.sessionTimers.timer=setTimeout(function(){e.status!==k.STATUS_TERMINATED&&(j("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:z.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}function R(e){var t,n,r,s,l,i=this.connection.getLocalStreams();for(r=i.length,t=0;t=z.MIN_SESSION_EXPIRES?this.sessionTimers.defaultExpires=t.sessionTimersExpires:this.sessionTimers.defaultExpires=z.SESSION_EXPIRES),this.data=t.data||this.data,void 0===e)throw new TypeError("Not enough arguments");if(!W.hasWebRTC())throw new V.NotSupportedError("WebRTC not supported");if(e=this.ua.normalizeTarget(e),!e)throw new TypeError("Invalid target: "+l);if(this.status!==k.STATUS_NULL)throw new V.InvalidStateError(this.status);for(r in o)this.on(r,o[r]);this.from_tag=J.newTag(),this.anonymous=t.anonymous||!1,this.isCanceled=!1,s={from_tag:this.from_tag},this.contact=this.ua.contact.toString({anonymous:this.anonymous,outbound:!0}),this.anonymous&&(s.from_display_name="Anonymous",s.from_uri="sip:anonymous@anonymous.invalid",u.push("P-Preferred-Identity: "+this.ua.configuration.uri.toString()),u.push("Privacy: id")),u.push("Contact: "+this.contact),u.push("Content-Type: application/sdp"),this.sessionTimers.enabled&&u.push("Session-Expires: "+this.sessionTimers.defaultExpires),this.request=new $.OutgoingRequest(z.INVITE,e,this.ua,s,u),this.id=this.request.call_id+this.from_tag,i.call(this,h,d),this.ua.sessions[this.id]=this,this.direction="outgoing",this.local_identity=this.request.from,this.remote_identity=this.request.to,n?n(this):I.call(this,"local",this.request),f.call(this,a,p,c)},r.prototype.init_incoming=function(e,t){G("init_incoming()");var n,r=this,s=e.getHeader("Content-Type");return e.body&&"application/sdp"!==s?void e.reply(415):(this.status=k.STATUS_INVITE_RECEIVED,this.from_tag=e.from_tag,this.id=e.call_id+this.from_tag,this.request=e,this.contact=this.ua.contact.toString(),this.ua.sessions[this.id]=this,e.hasHeader("expires")&&(n=1e3*e.getHeader("expires")),e.to_tag=J.newTag(),u.call(this,e,"UAS",!0)?(e.body?this.late_sdp=!1:this.late_sdp=!0,this.status=k.STATUS_WAITING_FOR_ANSWER,this.timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),U.call(r,"local",null,z.causes.NO_ANSWER)},this.ua.configuration.no_answer_timeout),n&&(this.timers.expiresTimer=setTimeout(function(){r.status===k.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),U.call(r,"system",null,z.causes.EXPIRES))},n)),this.direction="incoming", +this.local_identity=e.to,this.remote_identity=e.from,t?t(this):I.call(this,"remote",e),void(this.status!==k.STATUS_TERMINATED&&(e.reply(180,null,["Contact: "+r.contact]),N.call(r,"local",null)))):void e.reply(500,"Missing Contact header field"))},r.prototype.answer=function(e){function t(e){if(v.status!==k.STATUS_TERMINATED)if(v.localMediaStream=e,e&&v.connection.addStream(e),v.request.body||v.emit("peerconnection",{peerconnection:v.connection}),v.late_sdp)r();else{var t={originator:"remote",type:"offer",sdp:C.body};v.emit("sdp",t),v.connection.setRemoteDescription(new W.RTCSessionDescription({type:"offer",sdp:t.sdp}),r,function(){C.reply(488),U.call(v,"system",null,z.causes.WEBRTC_ERROR)})}}function n(){v.status!==k.STATUS_TERMINATED&&(C.reply(480),U.call(v,"local",null,z.causes.USER_DENIED_MEDIA_ACCESS))}function r(){w.call(v,C),v.late_sdp?o.call(v,"offer",a,c,v.rtcOfferConstraints):o.call(v,"answer",a,c,I)}function a(e){function t(){v.status=k.STATUS_WAITING_FOR_ACK,s.call(v,C,e),l.call(v),D.call(v,"local")}function n(){U.call(v,"system",null,z.causes.CONNECTION_ERROR)}v.status!==k.STATUS_TERMINATED&&(E.call(v,C,S),C.reply(200,null,S,e,t,n))}function c(){v.status!==k.STATUS_TERMINATED&&(C.reply(500),U.call(v,"system",null,z.causes.WEBRTC_ERROR))}G("answer()"),e=e||{};var h,d,p,f,m=!1,g=!1,T=!1,_=!1,v=this,C=this.request,S=e.extraHeaders&&e.extraHeaders.slice()||[],A=e.mediaConstraints||{},y=e.mediaStream||null,R=e.pcConfig||{iceServers:[]},b=e.rtcConstraints||null,I=e.rtcAnswerConstraints||null;if(this.rtcAnswerConstraints=I,this.rtcOfferConstraints=e.rtcOfferConstraints||null,this.sessionTimers.enabled&&J.isDecimal(e.sessionTimersExpires)&&(e.sessionTimersExpires>=z.MIN_SESSION_EXPIRES?this.sessionTimers.defaultExpires=e.sessionTimersExpires:this.sessionTimers.defaultExpires=z.SESSION_EXPIRES),this.data=e.data||this.data,"incoming"!==this.direction)throw new V.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this.status!==k.STATUS_WAITING_FOR_ANSWER)throw new V.InvalidStateError(this.status);if(this.status=k.STATUS_ANSWERED,!u.call(this,C,"UAS"))return void C.reply(500,"Error creating dialog");for(clearTimeout(this.timers.userNoAnswerTimer),S.unshift("Contact: "+v.contact),p=C.parseSDP(),Array.isArray(p.media)||(p.media=[p.media]),h=p.media.length;h--;){var N=p.media[h];"audio"===N.type&&(m=!0,N.direction&&"sendrecv"!==N.direction||(T=!0)),"video"===N.type&&(g=!0,N.direction&&"sendrecv"!==N.direction||(_=!0))}if(y&&A.audio===!1)for(f=y.getAudioTracks(),d=f.length,h=0;h=700))throw new TypeError("Invalid status_code: "+s);s&&(l=l||z.REASON_PHRASE[s]||"",t="SIP ;cause="+s+' ;text="'+l+'"'),this.status===k.STATUS_NULL?(this.isCanceled=!0,this.cancelReason=t):this.status===k.STATUS_INVITE_SENT?(this.isCanceled=!0,this.cancelReason=t):this.status===k.STATUS_1XX_RECEIVED&&this.request.cancel(t),this.status=k.STATUS_CANCELED,U.call(this,"local",null,z.causes.CANCELED);break;case k.STATUS_WAITING_FOR_ANSWER:case k.STATUS_ANSWERED:if(G("rejecting session"),s=s||480,s<300||s>=700)throw new TypeError("Invalid status_code: "+s);this.request.reply(s,l,i,o),U.call(this,"local",null,z.causes.REJECTED);break;case k.STATUS_WAITING_FOR_ACK:case k.STATUS_CONFIRMED:if(G("terminating session"),l=e.reason_phrase||z.REASON_PHRASE[s]||"",s&&(s<200||s>=700))throw new TypeError("Invalid status_code: "+s);s&&i.push("Reason: SIP ;cause="+s+'; text="'+l+'"'),this.status===k.STATUS_WAITING_FOR_ACK&&"incoming"===this.direction&&this.request.server_transaction.state!==Y.C.STATUS_TERMINATED?(n=this.dialog,this.receiveRequest=function(e){e.method===z.ACK&&(v.call(this,z.BYE,{extraHeaders:i,body:o}),n.terminate())},this.request.server_transaction.on("stateChanged",function(){this.state===Y.C.STATUS_TERMINATED&&(v.call(u,z.BYE,{extraHeaders:i,body:o}),n.terminate())}),x.call(this,"local",null,r),this.dialog=n,this.ua.dialogs[n.id.toString()]=n):(v.call(this,z.BYE,{extraHeaders:i,body:o}),x.call(this,"local",null,r))}},r.prototype.close=function(){G("close()");var e;if(this.status!==k.STATUS_TERMINATED){if(this.connection)try{this.connection.close()}catch(e){j("close() | error closing the RTCPeerConnection: %o",e)}this.localMediaStream&&this.localMediaStreamLocallyGenerated&&(G("close() | closing local MediaStream"),W.closeMediaStream(this.localMediaStream));for(e in this.timers)clearTimeout(this.timers[e]);clearTimeout(this.sessionTimers.timer),this.dialog&&(this.dialog.terminate(),delete this.dialog);for(e in this.earlyDialogs)this.earlyDialogs[e].terminate(),delete this.earlyDialogs[e];this.status=k.STATUS_TERMINATED,delete this.ua.sessions[this.id]}},r.prototype.sendDTMF=function(e,t){function n(){var e,o;if(i.status===k.STATUS_TERMINATED||!i.tones||l>=i.tones.length)return void(i.tones=null);if(e=i.tones[l],l+=1,","===e)o=2e3;else{var u=new ee(i);t.eventHandlers={failed:function(){i.tones=null}},u.send(e,t),o=r+s}setTimeout(n,o)}G("sendDTMF() | tones: %s",e);var r,s,l=0,i=this;if(t=t||{},r=t.duration||null,s=t.interToneGap||null,void 0===e)throw new TypeError("Not enough arguments");if(this.status!==k.STATUS_CONFIRMED&&this.status!==k.STATUS_WAITING_FOR_ACK)throw new V.InvalidStateError(this.status);if("number"==typeof e&&(e=e.toString()),!e||"string"!=typeof e||!e.match(/^[0-9A-D#*,]+$/i))throw new TypeError("Invalid tones: "+e);if(r&&!J.isDecimal(r))throw new TypeError("Invalid tone duration: "+r);if(r?ree.C.MAX_DURATION?(G('"duration" value is greater than the maximum allowed, setting it to '+ee.C.MAX_DURATION+" milliseconds"),r=ee.C.MAX_DURATION):r=Math.abs(r):r=ee.C.DEFAULT_DURATION,t.duration=r,s&&!J.isDecimal(s))throw new TypeError("Invalid interToneGap: "+s);return s?s=1&&n.test(t[0])&&(this.tone=t[0].replace(n,"$2")),t.length>=2&&r.test(t[1])&&(this.duration=parseInt(t[1].replace(r,"$2"),10))),this.duration||(this.duration=s.DEFAULT_DURATION),this.tone?this.owner.newDTMF({originator:"remote",dtmf:this,request:e}):l("invalid INFO DTMF received, discarded")}},{"../Constants":1,"../Exceptions":5,"../RTCSession":11,debug:33}],13:[function(e,t,n){function r(e,t,n){this.session=e,this.id=t,this.expires=n||s.expires,this.active=!0,this.notify(100)}t.exports=r;var s={event_type:"refer",body_type:"message/sipfrag;version=2.0",expires:300},l=e("debug")("JsSIP:RTCSession:ReferNotifier"),i=e("../Constants"),o=e("./Request");r.prototype.notify=function(e,t){l("notify()");var n,r=this;if(this.active!==!1){t=t||i.REASON_PHRASE[e]||"",n=e>=200?"terminated;reason=noresource":"active;expires="+this.expires;var u=new o(this.session,i.NOTIFY);u.send({extraHeaders:["Event: "+s.event_type+";id="+r.id,"Subscription-State: "+n,"Content-Type: "+s.body_type],body:"SIP/2.0 "+e+" "+t,eventHandlers:{onErrorResponse:function(){r.active=!1}}})}}},{"../Constants":1,"./Request":15,debug:33}],14:[function(e,t,n){function r(e){this.session=e,this.timer=null,this.outgoingRequest=null,o.EventEmitter.call(this)}function s(){console.log("removeSubscriber()"),clearTimeout(this.timer),this.session.referSubscriber=null}t.exports=r;var l={expires:120},i=e("util"),o=e("events"),u=e("debug")("JsSIP:RTCSession:ReferSubscriber"),a=e("../Constants"),c=e("../Grammar"),h=e("./Request");i.inherits(r,o.EventEmitter),r.prototype.sendRefer=function(e,t){u("sendRefer()");var n,r,i,o=null,c=this;t=t||{},n=t.extraHeaders?t.extraHeaders.slice():[],r=t.eventHandlers||{};for(var d in r)this.on(d,r[d]);t.replaces&&(o=t.replaces.request.call_id,o+=";to-tag="+t.replaces.to_tag,o+=";from-tag="+t.replaces.from_tag,o=encodeURIComponent(o)),i="Refer-To: <"+e+(o?"?Replaces="+o:"")+">",n.push(i);var p=new h(this.session,a.REFER);this.timer=setTimeout(function(){s.call(c)},1e3*l.expires),p.send({extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){c.emit("requestSucceeded",{response:e})},onErrorResponse:function(e){c.emit("requestFailed",{response:e,cause:a.causes.REJECTED})},onTransportError:function(){s.call(c),c.emit("requestFailed",{response:null,cause:a.causes.CONNECTION_ERROR})},onRequestTimeout:function(){s.call(c),c.emit("requestFailed",{response:null,cause:a.causes.REQUEST_TIMEOUT})},onDialogError:function(){s.call(c),c.emit("requestFailed",{response:null,cause:a.causes.DIALOG_ERROR})}}}),this.outgoingRequest=p.outgoingRequest},r.prototype.receiveNotify=function(e){u("receiveNotify()");var t;if(e.body){if(t=c.parse(e.body,"Status_Line"),t===-1)return void u('receiveNotify() | error parsing NOTIFY body: "'+e.body+'"');switch(!0){case/^100$/.test(t.status_code):this.emit("trying",{request:e,status_line:t});break;case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",{request:e,status_line:t});break;case/^2[0-9]{2}$/.test(t.status_code):s.call(this),this.emit("accepted",{request:e,status_line:t});break;default:s.call(this),this.emit("failed",{request:e,status_line:t})}}}},{"../Constants":1,"../Grammar":6,"./Request":15,debug:33,events:28,util:32}],15:[function(e,t,n){function r(e,t){if(s("new | %s",t),this.session=e,this.method=t,this.outgoingRequest=null,this.session.status!==u.C.STATUS_1XX_RECEIVED&&this.session.status!==u.C.STATUS_WAITING_FOR_ANSWER&&this.session.status!==u.C.STATUS_WAITING_FOR_ACK&&this.session.status!==u.C.STATUS_CONFIRMED&&this.session.status!==u.C.STATUS_TERMINATED)throw new o.InvalidStateError(this.session.status);if(this.session.status===u.C.STATUS_TERMINATED&&t!==i.BYE)throw new o.InvalidStateError(this.session.status)}t.exports=r;var s=e("debug")("JsSIP:RTCSession:Request"),l=e("debug")("JsSIP:ERROR:RTCSession:Request");l.log=console.warn.bind(console);var i=e("../Constants"),o=e("../Exceptions"),u=e("../RTCSession");r.prototype.send=function(e){e=e||{};var t=e.extraHeaders&&e.extraHeaders.slice()||[],n=e.body||null;this.eventHandlers=e.eventHandlers||{},this.outgoingRequest=this.session.dialog.sendRequest(this,this.method,{extraHeaders:t,body:n})},r.prototype.receiveResponse=function(e){switch(!0){case/^1[0-9]{2}$/.test(e.status_code):s("onProgressResponse"),this.eventHandlers.onProgressResponse&&this.eventHandlers.onProgressResponse(e);break;case/^2[0-9]{2}$/.test(e.status_code):s("onSuccessResponse"),this.eventHandlers.onSuccessResponse&&this.eventHandlers.onSuccessResponse(e);break;default:s("onErrorResponse"),this.eventHandlers.onErrorResponse&&this.eventHandlers.onErrorResponse(e)}},r.prototype.onRequestTimeout=function(){l("onRequestTimeout"),this.eventHandlers.onRequestTimeout&&this.eventHandlers.onRequestTimeout()},r.prototype.onTransportError=function(){l("onTransportError"),this.eventHandlers.onTransportError&&this.eventHandlers.onTransportError()},r.prototype.onDialogError=function(){l("onDialogError"),this.eventHandlers.onDialogError&&this.eventHandlers.onDialogError()}},{"../Constants":1,"../Exceptions":5,"../RTCSession":11,debug:33}],16:[function(e,t,n){function r(e,t){var n=1;this.ua=e,this.transport=t,this.registrar=e.configuration.registrar_server,this.expires=e.configuration.register_expires,this.call_id=l.createRandomToken(22),this.cseq=0,this.to_uri=e.configuration.uri,this.registrationTimer=null,this.registered=!1,this.contact=this.ua.contact.toString(),this.contact+=";+sip.ice",this.extraHeaders=[],this.extraContactParams="",n&&(this.contact+=";reg-id="+n,this.contact+=';+sip.instance=""')}t.exports=r;var s=e("debug")("JsSIP:Registrator"),l=e("./Utils"),i=e("./Constants"),o=e("./SIPMessage"),u=e("./RequestSender");r.prototype={setExtraHeaders:function(e){Array.isArray(e)||(e=[]),this.extraHeaders=e.slice()},setExtraContactParams:function(e){e instanceof Object||(e={}),this.extraContactParams="";for(var t in e){var n=e[t];this.extraContactParams+=";"+t,n&&(this.extraContactParams+="="+n)}},register:function(){var e,t,n,r=this;n=this.extraHeaders.slice(),n.push("Contact: "+this.contact+";expires="+this.expires+this.extraContactParams),n.push("Expires: "+this.expires),this.request=new o.OutgoingRequest(i.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},n),e=new u(this,this.ua),this.receiveResponse=function(e){var n,o,u=e.getHeaders("contact").length;if(e.cseq===this.cseq)switch(null!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=null),!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):if(e.hasHeader("expires")&&(o=e.getHeader("expires")),!u){s("no Contact header in response to REGISTER, response ignored");break}for(;u--;){if(n=e.parseHeader("contact",u),n.uri.user===this.ua.contact.uri.user){o=n.getParam("expires");break}n=null}if(!n){s("no Contact header pointing to us, response ignored");break}o||(o=this.expires),this.registrationTimer=setTimeout(function(){r.registrationTimer=null,r.register()},1e3*o-3e3),n.hasParam("temp-gruu")&&(this.ua.contact.temp_gruu=n.getParam("temp-gruu").replace(/"/g,"")),n.hasParam("pub-gruu")&&(this.ua.contact.pub_gruu=n.getParam("pub-gruu").replace(/"/g,"")),this.registered||(this.registered=!0,this.ua.registered({response:e}));break;case/^423$/.test(e.status_code):e.hasHeader("min-expires")?(this.expires=e.getHeader("min-expires"),this.register()):(s("423 response received for REGISTER without Min-Expires"),this.registrationFailure(e,i.causes.SIP_FAILURE_CODE));break;default:t=l.sipErrorCause(e.status_code),this.registrationFailure(e,t)}},this.onRequestTimeout=function(){this.registrationFailure(null,i.causes.REQUEST_TIMEOUT)},this.onTransportError=function(){this.registrationFailure(null,i.causes.CONNECTION_ERROR)},e.send()},unregister:function(e){var t;if(!this.registered)return void s("already unregistered");e=e||{},this.registered=!1,null!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=null),t=this.extraHeaders.slice(),e.all?(t.push("Contact: *"+this.extraContactParams),t.push("Expires: 0"),this.request=new o.OutgoingRequest(i.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},t)):(t.push("Contact: "+this.contact+";expires=0"+this.extraContactParams),t.push("Expires: 0"),this.request=new o.OutgoingRequest(i.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},t));var n=new u(this,this.ua);this.receiveResponse=function(e){var t;switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this.unregistered(e);break;default:t=l.sipErrorCause(e.status_code),this.unregistered(e,t)}},this.onRequestTimeout=function(){this.unregistered(null,i.causes.REQUEST_TIMEOUT)},this.onTransportError=function(){this.unregistered(null,i.causes.CONNECTION_ERROR)},n.send()},registrationFailure:function(e,t){this.ua.registrationFailed({response:e||null,cause:t}),this.registered&&(this.registered=!1,this.ua.unregistered({response:e||null,cause:t}))},unregistered:function(e,t){this.registered=!1,this.ua.unregistered({response:e||null,cause:t||null})},onTransportClosed:function(){null!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=null),this.registered&&(this.registered=!1,this.ua.unregistered({}))},close:function(){this.registered&&this.unregister()}}},{"./Constants":1,"./RequestSender":17,"./SIPMessage":18,"./Utils":25,debug:33}],17:[function(e,t,n){function r(e,t){this.ua=t,this.applicant=e,this.method=e.request.method,this.request=e.request,this.auth=null,this.challenged=!1,this.staled=!1,t.status!==i.C.STATUS_USER_CLOSED||this.method===l.BYE&&this.method===l.ACK||this.onTransportError()}t.exports=r;var s=e("debug")("JsSIP:RequestSender"),l=e("./Constants"),i=e("./UA"),o=e("./DigestAuthentication"),u=e("./Transactions");r.prototype={send:function(){switch(this.method){case"INVITE":this.clientTransaction=new u.InviteClientTransaction(this,this.request,this.ua.transport);break;case"ACK":this.clientTransaction=new u.AckClientTransaction(this,this.request,this.ua.transport);break;default:this.clientTransaction=new u.NonInviteClientTransaction(this,this.request,this.ua.transport)}this.clientTransaction.send()},onRequestTimeout:function(){this.applicant.onRequestTimeout()},onTransportError:function(){this.applicant.onTransportError()},receiveResponse:function(e){var t,n,r,i=e.status_code;if(401!==i&&407!==i||null===this.ua.configuration.password&&null===this.ua.configuration.ha1)this.applicant.receiveResponse(e);else{if(401===e.status_code?(n=e.parseHeader("www-authenticate"),r="authorization"):(n=e.parseHeader("proxy-authenticate"),r="proxy-authorization"),!n)return s(e.status_code+" with wrong or missing challenge, cannot authenticate"),void this.applicant.receiveResponse(e);if(!this.challenged||!this.staled&&n.stale===!0){if(this.auth||(this.auth=new o({username:this.ua.configuration.authorization_user,password:this.ua.configuration.password,realm:this.ua.configuration.realm,ha1:this.ua.configuration.ha1})),!this.auth.authenticate(this.request,n))return void this.applicant.receiveResponse(e);this.challenged=!0,this.ua.set("realm",this.auth.get("realm")),this.ua.set("ha1",this.auth.get("ha1")),n.stale&&(this.staled=!0),t=e.method===l.REGISTER?this.applicant.cseq+=1:this.request.dialog?this.request.dialog.local_seqnum+=1:this.request.cseq+1,this.request=this.applicant.request=this.request.clone(),this.request.cseq=t,this.request.setHeader("cseq",t+" "+this.method),this.request.setHeader(r,this.auth.toString()),this.send()}else this.applicant.receiveResponse(e)}}}},{"./Constants":1,"./DigestAuthentication":4,"./Transactions":21,"./UA":23,debug:33}],18:[function(e,t,n){function r(e,t,n,r,s,l){var i,o,u,d;return r=r||{},e&&t&&n?(this.ua=n,this.headers={},this.method=e,this.ruri=t,this.body=l,this.extraHeaders=s&&s.slice()||[],r.route_set?this.setHeader("route",r.route_set):n.configuration.use_preloaded_route&&this.setHeader("route","<"+n.transport.sip_uri+";lr>"),this.setHeader("via",""),this.setHeader("max-forwards",a.MAX_FORWARDS),i=r.to_display_name||0===r.to_display_name?'"'+r.to_display_name+'" ':"",i+="<"+(r.to_uri||t)+">",i+=r.to_tag?";tag="+r.to_tag:"",this.to=new h.parse(i),this.setHeader("to",i),o=r.from_display_name||0===r.from_display_name?'"'+r.from_display_name+'" ':n.configuration.display_name?'"'+n.configuration.display_name+'" ':"",o+="<"+(r.from_uri||n.configuration.uri)+">;tag=",o+=r.from_tag||c.newTag(),this.from=new h.parse(o),this.setHeader("from",o),u=r.call_id||n.configuration.jssip_id+c.createRandomToken(15),this.call_id=u,this.setHeader("call-id",u),d=r.cseq||Math.floor(1e4*Math.random()),this.cseq=d,void this.setHeader("cseq",d+" "+e)):null}function s(){this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null,this.sdp=null}function l(e){this.ua=e,this.headers={},this.ruri=null,this.transport=null,this.server_transaction=null}function i(){this.headers={},this.status_code=null,this.reason_phrase=null}t.exports={OutgoingRequest:r,IncomingRequest:l,IncomingResponse:i};var o=e("debug")("JsSIP:SIPMessage"),u=e("sdp-transform"),a=e("./Constants"),c=e("./Utils"),h=e("./NameAddrHeader"),d=e("./Grammar");r.prototype={setHeader:function(e,t){var n,r;for(n=new RegExp("^\\s*"+e+"\\s*:","i"),r=0;r=this.headers[e].length?void o('not so many "'+e+'" headers present'):(n=this.headers[e][t],r=n.raw,n.parsed?n.parsed:(s=d.parse(r,e.replace(/-/g,"_")),s===-1?(this.headers[e].splice(t,1),void o('error parsing "'+e+'" header field with value "'+r+'"')):(n.parsed=s,s))):void o('header "'+e+'" not present')},s:function(e,t){return this.parseHeader(e,t)},setHeader:function(e,t){var n={raw:t};this.headers[c.headerize(e)]=[n]},parseSDP:function(e){return!e&&this.sdp?this.sdp:(this.sdp=u.parse(this.body||""),this.sdp)},toString:function(){return this.data}},l.prototype=new s,l.prototype.reply=function(e,t,n,r,s,l){var i,o,u,h,d,p=[],f=this.getHeader("To"),m=0,g=0;if(e=e||null,t=t||null,!e||e<100||e>699)throw new TypeError("Invalid status_code: "+e);if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: "+t);if(t=t||a.REASON_PHRASE[e]||"",n=n&&n.slice()||[],d="SIP/2.0 "+e+" "+t+"\r\n",this.method===a.INVITE&&e>100&&e<=200)for(i=this.getHeaders("record-route"),u=i.length,m;m100?f+=";tag="+c.newTag():this.to_tag&&!this.s("to").hasParam("tag")&&(f+=";tag="+this.to_tag), d+="To: "+f+"\r\n",d+="From: "+this.getHeader("From")+"\r\n",d+="Call-ID: "+this.call_id+"\r\n",d+="CSeq: "+this.cseq+" "+this.method+"\r\n",u=n.length,h=0;h699)throw new TypeError("Invalid status_code: "+e);if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: "+t);for(t=t||a.REASON_PHRASE[e]||"",r="SIP/2.0 "+e+" "+t+"\r\n",s;s100?n+=";tag="+c.newTag():this.to_tag&&!this.s("to").hasParam("tag")&&(n+=";tag="+this.to_tag),r+="To: "+n+"\r\n",r+="From: "+this.getHeader("From")+"\r\n",r+="Call-ID: "+this.call_id+"\r\n",r+="CSeq: "+this.cseq+" "+this.method+"\r\n",r+="Content-Length: 0\r\n\r\n",this.transport.send(r)},i.prototype=new s},{"./Constants":1,"./Grammar":6,"./NameAddrHeader":9,"./Utils":25,debug:33,"sdp-transform":44}],19:[function(e,t,n){function r(){}t.exports=r;var s=e("./Utils"),l=e("./Grammar"),i=e("debug")("JsSIP:ERROR:Socket");i.log=console.warn.bind(console),r.isSocket=function(e){if(Array.isArray(e))return!1;if("undefined"==typeof e)return i("undefined JsSIP.Socket instance"),!1;try{if(!s.isString(e.url))throw i("missing or invalid JsSIP.Socket url property"),new Error;if(!s.isString(e.via_transport))throw i("missing or invalid JsSIP.Socket via_transport property"),new Error;if(l.parse(e.sip_uri,"SIP_URI")===-1)throw i("missing or invalid JsSIP.Socket sip_uri property"),new Error}catch(e){return!1}try{["connect","disconnect","send"].forEach(function(t){if(!s.isFunction(e[t]))throw i("missing or invalid JsSIP.Socket method: "+t),new Error})}catch(e){return!1}return!0}},{"./Grammar":6,"./Utils":25,debug:33}],20:[function(e,t,n){var r=500,s=4e3,l=5e3,i={T1:r,T2:s,T4:l,TIMER_B:64*r,TIMER_D:0*r,TIMER_F:64*r,TIMER_H:64*r,TIMER_I:0*r,TIMER_J:0*r,TIMER_K:0*l,TIMER_L:64*r,TIMER_M:64*r,PROVISIONAL_RESPONSE_INTERVAL:6e4};t.exports=i},{}],21:[function(e,t,n){function r(e,t,n){var r;this.type=a.NON_INVITE_CLIENT,this.transport=n,this.id="z9hG4bK"+Math.floor(1e7*Math.random()),this.request_sender=e,this.request=t,r="SIP/2.0/"+n.via_transport,r+=" "+e.ua.configuration.via_host+";branch="+this.id,this.request.setHeader("via",r),this.request_sender.ua.newTransaction(this),h.EventEmitter.call(this)}function s(e,t,n){var r,s=this;this.type=a.INVITE_CLIENT,this.transport=n,this.id="z9hG4bK"+Math.floor(1e7*Math.random()),this.request_sender=e,this.request=t,r="SIP/2.0/"+n.via_transport,r+=" "+e.ua.configuration.via_host+";branch="+this.id,this.request.setHeader("via",r),this.request_sender.ua.newTransaction(this),this.request.cancel=function(e){s.cancel_request(s,e)},h.EventEmitter.call(this)}function l(e,t,n){var r;this.transport=n,this.id="z9hG4bK"+Math.floor(1e7*Math.random()),this.request_sender=e,this.request=t,r="SIP/2.0/"+n.via_transport,r+=" "+e.ua.configuration.via_host+";branch="+this.id,this.request.setHeader("via",r),h.EventEmitter.call(this)}function i(e,t){this.type=a.NON_INVITE_SERVER,this.id=e.via_branch,this.request=e,this.transport=e.transport,this.ua=t,this.last_response="",e.server_transaction=this,this.state=a.STATUS_TRYING,t.newTransaction(this),h.EventEmitter.call(this)}function o(e,t){this.type=a.INVITE_SERVER,this.id=e.via_branch,this.request=e,this.transport=e.transport,this.ua=t,this.last_response="",e.server_transaction=this,this.state=a.STATUS_PROCEEDING,t.newTransaction(this),this.resendProvisionalTimer=null,e.reply(100),h.EventEmitter.call(this)}function u(e,t){var n;switch(t.method){case T.INVITE:if(n=e.transactions.ist[t.via_branch]){switch(n.state){case a.STATUS_PROCEEDING:n.transport.send(n.last_response);break;case a.STATUS_ACCEPTED:}return!0}break;case T.ACK:if(n=e.transactions.ist[t.via_branch],!n)return!1;if(n.state===a.STATUS_ACCEPTED)return!1;if(n.state===a.STATUS_COMPLETED)return n.state=a.STATUS_CONFIRMED,n.I=setTimeout(function(){n.timer_I()},_.TIMER_I),!0;break;case T.CANCEL:return n=e.transactions.ist[t.via_branch],n?(t.reply_sl(200),n.state!==a.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(n=e.transactions.nist[t.via_branch]){switch(n.state){case a.STATUS_TRYING:break;case a.STATUS_PROCEEDING:case a.STATUS_COMPLETED:n.transport.send(n.last_response)}return!0}}}t.exports={C:null,NonInviteClientTransaction:r,InviteClientTransaction:s,AckClientTransaction:l,NonInviteServerTransaction:i,InviteServerTransaction:o,checkTransaction:u};var a={STATUS_TRYING:1,STATUS_PROCEEDING:2,STATUS_CALLING:3,STATUS_ACCEPTED:4,STATUS_COMPLETED:5,STATUS_TERMINATED:6,STATUS_CONFIRMED:7,NON_INVITE_CLIENT:"nict",NON_INVITE_SERVER:"nist",INVITE_CLIENT:"ict",INVITE_SERVER:"ist"};t.exports.C=a;var c=e("util"),h=e("events"),d=e("debug")("JsSIP:NonInviteClientTransaction"),p=e("debug")("JsSIP:InviteClientTransaction"),f=e("debug")("JsSIP:AckClientTransaction"),m=e("debug")("JsSIP:NonInviteServerTransaction"),g=e("debug")("JsSIP:InviteServerTransaction"),T=e("./Constants"),_=e("./Timers");c.inherits(r,h.EventEmitter),r.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged")},r.prototype.send=function(){var e=this;this.stateChanged(a.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},_.TIMER_F),this.transport.send(this.request)||this.onTransportError()},r.prototype.onTransportError=function(){d("transport error occurred, deleting transaction "+this.id),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(a.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this),this.request_sender.onTransportError()},r.prototype.timer_F=function(){d("Timer F expired for transaction "+this.id),this.stateChanged(a.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this),this.request_sender.onRequestTimeout()},r.prototype.timer_K=function(){this.stateChanged(a.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this)},r.prototype.receiveResponse=function(e){var t=this,n=e.status_code;if(n<200)switch(this.state){case a.STATUS_TRYING:case a.STATUS_PROCEEDING:this.stateChanged(a.STATUS_PROCEEDING),this.request_sender.receiveResponse(e)}else switch(this.state){case a.STATUS_TRYING:case a.STATUS_PROCEEDING:this.stateChanged(a.STATUS_COMPLETED),clearTimeout(this.F),408===n?this.request_sender.onRequestTimeout():this.request_sender.receiveResponse(e),this.K=setTimeout(function(){t.timer_K()},_.TIMER_K);break;case a.STATUS_COMPLETED:}},c.inherits(s,h.EventEmitter),s.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged")},s.prototype.send=function(){var e=this;this.stateChanged(a.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},_.TIMER_B),this.transport.send(this.request)||this.onTransportError()},s.prototype.onTransportError=function(){clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==a.STATUS_ACCEPTED&&(p("transport error occurred, deleting transaction "+this.id),this.request_sender.onTransportError()),this.stateChanged(a.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this)},s.prototype.timer_M=function(){p("Timer M expired for transaction "+this.id),this.state===a.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(a.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this))},s.prototype.timer_B=function(){p("Timer B expired for transaction "+this.id),this.state===a.STATUS_CALLING&&(this.stateChanged(a.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this),this.request_sender.onRequestTimeout())},s.prototype.timer_D=function(){p("Timer D expired for transaction "+this.id),clearTimeout(this.B),this.stateChanged(a.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this)},s.prototype.sendACK=function(e){var t=this;this.ack="ACK "+this.request.ruri+" SIP/2.0\r\n",this.ack+="Via: "+this.request.headers.Via.toString()+"\r\n",this.request.headers.Route&&(this.ack+="Route: "+this.request.headers.Route.toString()+"\r\n"),this.ack+="To: "+e.getHeader("to")+"\r\n",this.ack+="From: "+this.request.headers.From.toString()+"\r\n",this.ack+="Call-ID: "+this.request.headers["Call-ID"].toString()+"\r\n",this.ack+="CSeq: "+this.request.headers.CSeq.toString().split(" ")[0],this.ack+=" ACK\r\n",this.ack+="Content-Length: 0\r\n\r\n",this.D=setTimeout(function(){t.timer_D()},_.TIMER_D),this.transport.send(this.ack)},s.prototype.cancel_request=function(e,t){var n=e.request;this.cancel=T.CANCEL+" "+n.ruri+" SIP/2.0\r\n",this.cancel+="Via: "+n.headers.Via.toString()+"\r\n",this.request.headers.Route&&(this.cancel+="Route: "+n.headers.Route.toString()+"\r\n"),this.cancel+="To: "+n.headers.To.toString()+"\r\n",this.cancel+="From: "+n.headers.From.toString()+"\r\n",this.cancel+="Call-ID: "+n.headers["Call-ID"].toString()+"\r\n",this.cancel+="CSeq: "+n.headers.CSeq.toString().split(" ")[0]+" CANCEL\r\n",t&&(this.cancel+="Reason: "+t+"\r\n"),this.cancel+="Content-Length: 0\r\n\r\n",this.state===a.STATUS_PROCEEDING&&this.transport.send(this.cancel)},s.prototype.receiveResponse=function(e){var t=this,n=e.status_code;if(n>=100&&n<=199)switch(this.state){case a.STATUS_CALLING:this.stateChanged(a.STATUS_PROCEEDING),this.request_sender.receiveResponse(e);break;case a.STATUS_PROCEEDING:this.request_sender.receiveResponse(e)}else if(n>=200&&n<=299)switch(this.state){case a.STATUS_CALLING:case a.STATUS_PROCEEDING:this.stateChanged(a.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},_.TIMER_M),this.request_sender.receiveResponse(e);break;case a.STATUS_ACCEPTED:this.request_sender.receiveResponse(e)}else if(n>=300&&n<=699)switch(this.state){case a.STATUS_CALLING:case a.STATUS_PROCEEDING:this.stateChanged(a.STATUS_COMPLETED),this.sendACK(e),this.request_sender.receiveResponse(e);break;case a.STATUS_COMPLETED:this.sendACK(e)}},c.inherits(l,h.EventEmitter),l.prototype.send=function(){this.transport.send(this.request)||this.onTransportError()},l.prototype.onTransportError=function(){f("transport error occurred for transaction "+this.id),this.request_sender.onTransportError()},c.inherits(i,h.EventEmitter),i.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged")},i.prototype.timer_J=function(){m("Timer J expired for transaction "+this.id),this.stateChanged(a.STATUS_TERMINATED),this.ua.destroyTransaction(this)},i.prototype.onTransportError=function(){this.transportError||(this.transportError=!0,m("transport error occurred, deleting transaction "+this.id),clearTimeout(this.J),this.stateChanged(a.STATUS_TERMINATED),this.ua.destroyTransaction(this))},i.prototype.receiveResponse=function(e,t,n,r){var s=this;if(100===e)switch(this.state){case a.STATUS_TRYING:this.stateChanged(a.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case a.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=200&&e<=699)switch(this.state){case a.STATUS_TRYING:case a.STATUS_PROCEEDING:this.stateChanged(a.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){s.timer_J()},_.TIMER_J),this.transport.send(t)?n&&n():(this.onTransportError(),r&&r());break;case a.STATUS_COMPLETED:}},c.inherits(o,h.EventEmitter),o.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged")},o.prototype.timer_H=function(){g("Timer H expired for transaction "+this.id),this.state===a.STATUS_COMPLETED&&g("ACK not received, dialog will be terminated"),this.stateChanged(a.STATUS_TERMINATED),this.ua.destroyTransaction(this)},o.prototype.timer_I=function(){this.stateChanged(a.STATUS_TERMINATED)},o.prototype.timer_L=function(){g("Timer L expired for transaction "+this.id),this.state===a.STATUS_ACCEPTED&&(this.stateChanged(a.STATUS_TERMINATED),this.ua.destroyTransaction(this))},o.prototype.onTransportError=function(){this.transportError||(this.transportError=!0,g("transport error occurred, deleting transaction "+this.id),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),clearTimeout(this.L),clearTimeout(this.H),clearTimeout(this.I),this.stateChanged(a.STATUS_TERMINATED),this.ua.destroyTransaction(this))},o.prototype.resend_provisional=function(){this.transport.send(this.last_response)||this.onTransportError()},o.prototype.receiveResponse=function(e,t,n,r){var s=this;if(e>=100&&e<=199)switch(this.state){case a.STATUS_PROCEEDING:this.transport.send(t)||this.onTransportError(),this.last_response=t}if(e>100&&e<=199&&this.state===a.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){s.resend_provisional()},_.PROVISIONAL_RESPONSE_INTERVAL));else if(e>=200&&e<=299)switch(this.state){case a.STATUS_PROCEEDING:this.stateChanged(a.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){s.timer_L()},_.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case a.STATUS_ACCEPTED:this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=300&&e<=699)switch(this.state){case a.STATUS_PROCEEDING:null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(a.STATUS_COMPLETED),this.H=setTimeout(function(){s.timer_H()},_.TIMER_H),n&&n()):(this.onTransportError(),r&&r())}}},{"./Constants":1,"./Timers":20,debug:33,events:28,util:32}],22:[function(e,t,n){function r(e,t){if(c("new()"),this.status=d.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=t||d.recovery_options,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1,"undefined"==typeof e)throw new TypeError("Invalid argument. undefined 'sockets' argument");e instanceof Array||(e=[e]),e.forEach(function(e){if(!a.isSocket(e.socket))throw new TypeError("Invalid argument. invalid 'JsSIP.Socket' instance");if(e.weight&&!Number(e.weight))throw new TypeError("Invalid argument. 'weight' attribute is not a number");this.sockets.push({socket:e.socket,weight:e.weight||0,status:d.SOCKET_STATUS_READY})},this),Object.defineProperties(this,{via_transport:{get:function(){return this.socket.via_transport}},url:{get:function(){return this.socket.url}},sip_uri:{get:function(){return this.socket.sip_uri}}}),u.call(this)}function s(){this.recover_attempts=0,this.status=d.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}function l(e,t,n){this.status=d.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:n}),this.close_requested||(e&&(this.socket.status=d.SOCKET_STATUS_ERROR),o.call(this,e))}function i(e){if("\r\n"===e)return void c("received message with CRLF Keep Alive response");if("string"!=typeof e){try{e=String.fromCharCode.apply(null,new Uint8Array(e))}catch(e){return void c("received binary message failed to be converted into string, message discarded")}c("received binary message:\n\n"+e+"\n")}else c("received text message:\n\n"+e+"\n");this.ondata({transport:this,message:e})}function o(){var e,t=this;this.recover_attempts+=1,e=Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1),ethis.recovery_options.max_interval&&(e=this.recovery_options.max_interval),c("reconnection attempt: "+this.recover_attempts+". next connection attempt in "+e+" seconds"),this.recovery_timer=setTimeout(function(){t.close_requested||t.isConnected()||t.isConnecting()||(u.call(t),t.connect())},1e3*e)}function u(){var e=[];if(this.sockets.forEach(function(t){t.status!==d.SOCKET_STATUS_ERROR&&(0===e.length?e.push(t):t.weight>e[0].weight?e=[t]:t.weight===e[0].weight&&e.push(t))}),0===e.length)return this.sockets.forEach(function(e){e.status=d.SOCKET_STATUS_READY}),void u.call(this);var t=Math.floor(Math.random()*e.length);this.socket=e[t].socket}t.exports=r;var a=e("./Socket"),c=e("debug")("JsSIP:Transport"),h=e("debug")("JsSIP:ERROR:Transport"),d={STATUS_CONNECTED:0,STATUS_CONNECTING:1,STATUS_DISCONNECTED:2,SOCKET_STATUS_READY:0,SOCKET_STATUS_ERROR:1,recovery_options:{min_interval:2,max_interval:30}};r.prototype.connect=function(){return c("connect()"),this.isConnected()?void c("Transport is already connected"):this.isConnecting()?void c("Transport is connecting"):(this.close_requested=!1,this.status=d.STATUS_CONNECTING,this.onconnecting({socket:this.socket,attempts:this.recover_attempts}),void(this.close_requested||(this.socket.onconnect=s.bind(this),this.socket.ondisconnect=l.bind(this),this.socket.ondata=i.bind(this),this.socket.connect())))},r.prototype.disconnect=function(){c("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=d.STATUS_DISCONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.socket.onconnect=function(){},this.socket.ondisconnect=function(){},this.socket.ondata=function(){},this.socket.disconnect(),this.ondisconnect()},r.prototype.send=function(e){if(c("send()"),!this.isConnected())return h("unable to send message, transport is not connected"),!1;var t=e.toString();return c("sending message:\n\n"+t+"\n"),this.socket.send(t)},r.prototype.isConnected=function(){return this.status===d.STATUS_CONNECTED},r.prototype.isConnecting=function(){return this.status===d.STATUS_CONNECTING}},{"./Socket":19,debug:33}],23:[function(e,t,n){function r(e){if(h("new() [configuration:%o]",e),this.cache={credentials:{}},this.configuration={},this.dynConfiguration={},this.dialogs={},this.applicants={},this.sessions={},this.transport=null,this.contact=null,this.status=u.STATUS_INIT,this.error=null,this.transactions={nist:{},nict:{},ist:{},ict:{}},this.data={},Object.defineProperties(this,{transactionsCount:{get:function(){var e,t=["nist","nict","ist","ict"],n=0;for(e in t)n+=Object.keys(this.transactions[t[e]]).length;return n}},nictTransactionsCount:{get:function(){return Object.keys(this.transactions.nict).length}},nistTransactionsCount:{get:function(){return Object.keys(this.transactions.nist).length}},ictTransactionsCount:{get:function(){return Object.keys(this.transactions.ict).length}},istTransactionsCount:{get:function(){return Object.keys(this.transactions.ist).length}}}),void 0===e)throw new TypeError("Not enough arguments");try{this.loadConfig(e)}catch(e){throw this.status=u.STATUS_NOT_READY,this.error=u.CONFIGURATION_ERROR,e}this._registrator=new m(this),c.EventEmitter.call(this),p.called||p()}function s(e){this.emit("connecting",e)}function l(e){this.status!==u.STATUS_USER_CLOSED&&(this.status=u.STATUS_READY,this.error=null,this.emit("connected",e),this.dynConfiguration.register&&this._registrator.register())}function i(e){var t,n,r,s=["nict","ict","nist","ist"];for(r=s.length,t=0;t"}};for(t in p)r.configuration_skeleton[t].value=p[t];Object.defineProperties(this.configuration,r.configuration_skeleton);for(t in p)r.configuration_skeleton[t].value="";h("configuration parameters after validation:");for(t in p)switch(t){case"uri":case"registrar_server":h("- "+t+": "+p[t]);break;case"password":case"ha1":h("- "+t+": NOT SHOWN");break;default:h("- "+t+": "+JSON.stringify(p[t]))}},r.configuration_skeleton=function(){var e,t,n,r={},s=["jssip_id","hostport_params","uri","authorization_user","contact_uri","display_name","instance_id","no_answer_timeout","session_timers","password","realm","ha1","register_expires","registrar_server","sockets","use_preloaded_route","ws_servers","via_core_value","via_host"],l=["password","realm","ha1","display_name"];for(e in s)t=s[e],n=l.indexOf(t)!==-1,r[t]={value:"",writable:n,configurable:!1};return r.register={value:"",writable:!0,configurable:!1},r}(),r.configuration_check={mandatory:{uri:function(e){var t;return/^sip:/i.test(e)||(e=f.SIP+":"+e),t=y.parse(e),t&&t.user?t:void 0}},optional:{authorization_user:function(e){return R.parse('"'+e+'"',"quoted_string")===-1?void 0:e},connection_recovery_max_interval:function(e){var t;if(E.isDecimal(e)&&(t=Number(e),t>0))return t},connection_recovery_min_interval:function(e){var t;if(E.isDecimal(e)&&(t=Number(e),t>0))return t},contact_uri:function(e){if("string"==typeof e){var t=R.parse(e,"SIP_URI");if(t!==-1)return t}},display_name:function(e){return R.parse('"'+e+'"',"display_name")===-1?void 0:e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),R.parse(e,"uuid")===-1?void 0:e},no_answer_timeout:function(e){var t;if(E.isDecimal(e)&&(t=Number(e),t>0))return t},session_timers:function(e){if("boolean"==typeof e)return e},password:function(e){return String(e)},realm:function(e){return String(e)},ha1:function(e){return String(e)},register:function(e){if("boolean"==typeof e)return e},register_expires:function(e){var t;if(E.isDecimal(e)&&(t=Number(e),t>0))return t},registrar_server:function(e){var t;return/^sip:/i.test(e)||(e=f.SIP+":"+e),t=y.parse(e),t?t.user?void 0:t:void 0},sockets:function(e){var t,n;if(S.isSocket(e))e=[{socket:e}];else{if(!Array.isArray(e)||!e.length)return;for(n=e.length,t=0;t0&&(r+="?"+s.join("&")),r},toAor:function(e){var t;return t=this.scheme+":",this.user&&(t+=l.escapeUser(this.user)+"@"),t+=this.host,e&&(this.port||0===this.port)&&(t+=":"+this.port),t}},r.parse=function(e){return e=i.parse(e,"SIP_URI"),e!==-1?e:void 0}},{"./Constants":1,"./Grammar":6,"./Utils":25}],25:[function(e,t,n){var r={};t.exports=r;var s=e("./Constants"),l=e("./URI"),i=e("./Grammar");r.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length},r.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)},r.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},r.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},r.isEmpty=function(e){if(null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e))return!0},r.hasMethods=function(e){for(var t,n=1;t=arguments[n++];)if(this.isFunction(e[t]))return!1;return!0},r.createRandomToken=function(e,t){var n,r,s="";for(t=t||32,n=0;n>>32-t}function n(e,t){var n,r,s,l,i;return s=2147483648&e,l=2147483648&t,n=1073741824&e,r=1073741824&t,i=(1073741823&e)+(1073741823&t),n&r?2147483648^i^s^l:n|r?1073741824&i?3221225472^i^s^l:1073741824^i^s^l:i^s^l}function r(e,t,n){return e&t|~e&n}function s(e,t,n){return e&n|t&~n}function l(e,t,n){return e^t^n}function i(e,t,n){return t^(e|~n)}function o(e,s,l,i,o,u,a){return e=n(e,n(n(r(s,l,i),o),a)),n(t(e,u),s)}function u(e,r,l,i,o,u,a){return e=n(e,n(n(s(r,l,i),o),a)),n(t(e,u),r)}function a(e,r,s,i,o,u,a){return e=n(e,n(n(l(r,s,i),o),a)),n(t(e,u),r)}function c(e,r,s,l,o,u,a){return e=n(e,n(n(i(r,s,l),o),a)),n(t(e,u),r)}function h(e){for(var t,n=e.length,r=n+8,s=(r-r%64)/64,l=16*(s+1),i=new Array(l-1),o=0,u=0;u>>29,i}function d(e){var t,n,r="",s="";for(n=0;n<=3;n++)t=e>>>8*n&255,s="0"+t.toString(16),r+=s.substr(s.length-2,2);return r}function p(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}var f,m,g,T,_,v,C,S,E,A=[],y=7,R=12,b=17,I=22,w=5,N=9,D=14,O=20,x=4,U=11,M=16,P=23,q=6,L=10,H=15,k=21;for(e=p(e),A=h(e),v=1732584193,C=4023233417,S=2562383102,E=271733878,f=0;f1)return m("more than one Via header field present in the response, dropping the response"),!1}function a(){var e=_.str_utf8_length(d.body),t=d.getHeader("content-length");if(e0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!s(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,l,o;if(!s(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],l=n.length,r=-1,n===t||s(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(o=l;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){r=o;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],s(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?s(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(s(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],29:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(h===setTimeout)return setTimeout(e,0);if((h===r||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===s||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function o(){g&&f&&(g=!1,f.length?m=f.concat(m):T=-1,m.length&&u())}function u(){if(!g){var e=l(o);g=!0;for(var t=m.length;t;){for(f=m,m=[];++T1)for(var n=1;n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(t)?r.showHidden=t:t&&n._extend(r,t),S(r.showHidden)&&(r.showHidden=!1),S(r.depth)&&(r.depth=2),S(r.colors)&&(r.colors=!1),S(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=l),u(r,e,r.depth)}function l(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function i(e,t){return e}function o(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&b(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var s=t.inspect(r,e);return v(s)||(s=u(e,s,r)),s}var l=a(e,t);if(l)return l;var i=Object.keys(t),m=o(i);if(e.showHidden&&(i=Object.getOwnPropertyNames(t)),R(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return c(t);if(0===i.length){if(b(t)){var g=t.name?": "+t.name:"";return e.stylize("[Function"+g+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(y(t))return e.stylize(Date.prototype.toString.call(t),"date");if(R(t))return c(t)}var T="",_=!1,C=["{","}"];if(f(t)&&(_=!0,C=["[","]"]),b(t)){var S=t.name?": "+t.name:"";T=" [Function"+S+"]"}if(E(t)&&(T=" "+RegExp.prototype.toString.call(t)),y(t)&&(T=" "+Date.prototype.toUTCString.call(t)),R(t)&&(T=" "+c(t)),0===i.length&&(!_||0==t.length))return C[0]+T+C[1];if(r<0)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var A;return A=_?h(e,t,r,m,i):i.map(function(n){return d(e,t,r,m,n,_)}),e.seen.pop(),p(A,T,C)}function a(e,t){if(S(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return _(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,s){for(var l=[],i=0,o=t.length;i-1&&(o=l?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),S(i)){if(l&&s.match(/^\d+$/))return o;i=JSON.stringify(""+s),i.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=e.stylize(i,"string"))}return i+": "+o}function p(e,t,n){var r=0,s=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return s>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function f(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function T(e){return null==e}function _(e){return"number"==typeof e}function v(e){return"string"==typeof e}function C(e){return"symbol"==typeof e}function S(e){return void 0===e}function E(e){return A(e)&&"[object RegExp]"===w(e)}function A(e){return"object"==typeof e&&null!==e}function y(e){return A(e)&&"[object Date]"===w(e)}function R(e){return A(e)&&("[object Error]"===w(e)||e instanceof Error)}function b(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function w(e){return Object.prototype.toString.call(e)}function N(e){return e<10?"0"+e.toString(10):e.toString(10)}function D(){var e=new Date,t=[N(e.getHours()),N(e.getMinutes()),N(e.getSeconds())].join(":");return[e.getDate(),P[e.getMonth()],t].join(" ")}function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var x=/%[sdj%]/g;n.format=function(e){if(!v(e)){for(var t=[],n=0;n=l)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),o=r[n];n=31}function s(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var s=0,l=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(s++,"%c"===e&&(l=s))}),e.splice(l,0,r),e}function l(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function o(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e("./debug"),n.log=l,n.formatArgs=s,n.save=i,n.load=o,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(o())},{"./debug":34}],34:[function(e,t,n){function r(){return n.colors[c++%n.colors.length]}function s(e){function t(){}function s(){var e=s,t=+new Date,l=t-(a||t);e.diff=l,e.prev=a,e.curr=t,a=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var i=Array.prototype.slice.call(arguments);i[0]=n.coerce(i[0]),"string"!=typeof i[0]&&(i=["%o"].concat(i));var o=0;i[0]=i[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;o++;var s=n.formatters[r];if("function"==typeof s){var l=i[o];t=s.call(e,l),i.splice(o,1),o--}return t}),"function"==typeof n.formatArgs&&(i=n.formatArgs.apply(e,i));var u=s.log||n.log||console.log.bind(console);u.apply(e,i)}t.enabled=!1,s.enabled=!0;var l=n.enabled(e)?s:t;return l.namespace=e,l}function l(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,s=0;s1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*h;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*a;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function s(e){return e>=c?Math.round(e/c)+"d":e>=a?Math.round(e/a)+"h":e>=u?Math.round(e/u)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function l(e){return i(e,c,"day")||i(e,a,"hour")||i(e,u,"minute")||i(e,o,"second")||e+" ms"}function i(e,t,n){if(!(e=32||s.android&&s.chrome&&T>=39||_&&s.opera&&T>=27||s.android&&s.opera&&T>=24||s.android&&s.webkit&&!s.chrome&&T>=37||S.webkitGetUserMedia&&C.webkitRTCPeerConnection)v=!0,o=S.webkitGetUserMedia.bind(S),u=S.mediaDevices,a=C.webkitRTCPeerConnection,c=C.RTCSessionDescription,h=C.RTCIceCandidate,d=C.MediaStreamTrack,d&&d.getSources?p=d.getSources.bind(d):S.getMediaDevices&&(p=S.getMediaDevices.bind(S)),f=function(e,t){return e.src=URL.createObjectURL(t),e},m=!0,g=!1;else if(s.firefox&&T<47||S.mozGetUserMedia&&C.mozRTCPeerConnection)v=!0,o=S.mozGetUserMedia.bind(S),u=S.mediaDevices,a=C.mozRTCPeerConnection,c=C.mozRTCSessionDescription,h=C.mozRTCIceCandidate,d=C.MediaStreamTrack,f=function(e,t){return e.src=URL.createObjectURL(t),e},m=!1,g=!1;else if((s.firefox||s.gecko)&&T>=47)v=!0,o=S.mozGetUserMedia.bind(S),u=S.mediaDevices,a=C.RTCPeerConnection,c=C.RTCSessionDescription,h=C.RTCIceCandidate,d=C.MediaStreamTrack,f=function(e,t){return e.src=URL.createObjectURL(t),e},m=!1,g=!1;else if(e.plugin&&"function"==typeof e.plugin.isRequired&&e.plugin.isRequired()&&"function"==typeof e.plugin.isInstalled&&e.plugin.isInstalled()){var n=e.plugin.interface;v=!0,o=n.getUserMedia,u=n.mediaDevices,a=n.RTCPeerConnection,c=n.RTCSessionDescription,h=n.RTCIceCandidate,d=n.MediaStreamTrack,d&&d.getSources?p=d.getSources.bind(d):S.getMediaDevices&&(p=S.getMediaDevices.bind(S)),f=n.attachMediaStream,m=n.canRenegotiate,g=!0}else S.getUserMedia&&C.RTCPeerConnection&&(v=!0,o=S.getUserMedia.bind(S),u=S.mediaDevices,a=C.RTCPeerConnection,c=C.RTCSessionDescription,h=C.RTCIceCandidate,d=C.MediaStreamTrack,d&&d.getSources?p=d.getSources.bind(d):S.getMediaDevices&&(p=S.getMediaDevices.bind(S)),f=C.attachMediaStream||function(e,t){return e.src=URL.createObjectURL(t),e},m=!0,g=!1);return r.hasWebRTC=function(){return v},o?r.getUserMedia=function(e,t,n){l("getUserMedia() | constraints: %o",e);try{o(e,function(e){l("getUserMedia() | success"),t&&t(e)},function(e){l("getUserMedia() | error:",e),n&&n(e)})}catch(e){i("getUserMedia() | error:",e),n&&n(e)}}:r.getUserMedia=function(e,n,r){i("getUserMedia() | WebRTC not supported"),r?r(new Error("rtcninja: WebRTC not supported, missing getUserMedia [browser: "+s.name+" "+s.version+"]")):t("getUserMedia")},r.mediaDevices=u,r.RTCPeerConnection=a||t("RTCPeerConnection"),r.RTCSessionDescription=c||t("RTCSessionDescription"),r.RTCIceCandidate=h||t("RTCIceCandidate"),r.MediaStreamTrack=d||t("MediaStreamTrack"),r.getMediaDevices=p,r.attachMediaStream=f||t("attachMediaStream"),r.canRenegotiate=m,r.closeMediaStream=function(e){if(e)try{l("closeMediaStream() | calling stop() on all the MediaStreamTrack");var t,n,r;if(e.getTracks)for(t=e.getTracks(),n=0,r=t.length;n=10)),v=!1,C=n.window||n,S=C.navigator||{};i.log=console.warn.bind(console)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{bowser:40,debug:33}],37:[function(e,t,n){"use strict";function r(e,t){h("new | [pcConfig:%o, pcConstraints:%o]",e,t),s.call(this,e),this.pcConstraints=t,this.ourLocalDescription=null,this.ourSignalingState=null,this.ourIceConnectionState=null,this.ourIceGatheringState=null,this.timerGatheringTimeout=null,this.timerGatheringTimeoutAfterRelay=null,this.ignoreIceGathering=!1,this.closed=!1,o.call(this),a.call(this)}function s(e){this.pcConfig=c(!0,e), -p.fixPeerConnectionConfig(this.pcConfig),this.options={iceTransportsRelay:"relay"===this.pcConfig.iceTransports,iceTransportsNone:"none"===this.pcConfig.iceTransports,gatheringTimeout:this.pcConfig.gatheringTimeout,gatheringTimeoutAfterRelay:this.pcConfig.gatheringTimeoutAfterRelay},delete this.pcConfig.gatheringTimeout,delete this.pcConfig.gatheringTimeoutAfterRelay,h("setConfigurationAndOptions | processed pcConfig: %o",this.pcConfig)}function l(){return this.closed||this.pc&&"closed"===this.pc.iceConnectionState}function i(){var e=this,t=this.pc;t.onnegotiationneeded=function(t){l.call(e)||(h("onnegotiationneeded()"),e.onnegotiationneeded&&e.onnegotiationneeded(t))},t.onicecandidate=function(t){var n,r,s;if(!l.call(e)&&!e.ignoreIceGathering&&!e.options.iceTransportsNone)if(n=t.candidate){if(r=f.REGEXP_RELAY_CANDIDATE.test(n.candidate),e.options.iceTransportsRelay&&!r)return;r&&!e.timerGatheringTimeoutAfterRelay&&"number"==typeof e.options.gatheringTimeoutAfterRelay&&(h("onicecandidate() | first relay candidate found, ending gathering in %d ms",e.options.gatheringTimeoutAfterRelay),e.timerGatheringTimeoutAfterRelay=setTimeout(function(){l.call(e)||(h("forced end of candidates after timeout"),delete e.timerGatheringTimeoutAfterRelay,clearTimeout(e.timerGatheringTimeout),delete e.timerGatheringTimeout,e.ignoreIceGathering=!0,e.onicecandidate&&e.onicecandidate({candidate:null},null))},e.options.gatheringTimeoutAfterRelay)),s=new p.RTCIceCandidate({sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,candidate:n.candidate}),null===m.normalizeCandidate&&(f.REGEXP_NORMALIZED_CANDIDATE.test(n.candidate)?m.normalizeCandidate=!1:(h('onicecandidate() | normalizing ICE candidates syntax (remove "a=" and "\\r\\n")'),m.normalizeCandidate=!0)),m.normalizeCandidate&&(s.candidate=n.candidate.replace(f.REGEXP_FIX_CANDIDATE,"")),h("onicecandidate() | m%d(%s) %s",s.sdpMLineIndex,s.sdpMid||"no mid",s.candidate),e.onicecandidate&&e.onicecandidate(t,s)}else h("onicecandidate() | end of candidates"),clearTimeout(e.timerGatheringTimeout),delete e.timerGatheringTimeout,clearTimeout(e.timerGatheringTimeoutAfterRelay),delete e.timerGatheringTimeoutAfterRelay,e.onicecandidate&&e.onicecandidate(t,null)},t.onaddstream=function(t){l.call(e)||(h("onaddstream() | stream: %o",t.stream),e.onaddstream&&e.onaddstream(t,t.stream))},t.onremovestream=function(t){l.call(e)||(h("onremovestream() | stream: %o",t.stream),e.onremovestream&&e.onremovestream(t,t.stream))},t.ondatachannel=function(t){l.call(e)||(h("ondatachannel() | datachannel: %o",t.channel),e.ondatachannel&&e.ondatachannel(t,t.channel))},t.onsignalingstatechange=function(n){t.signalingState!==e.ourSignalingState&&(h("onsignalingstatechange() | signalingState: %s",t.signalingState),e.ourSignalingState=t.signalingState,e.onsignalingstatechange&&e.onsignalingstatechange(n,t.signalingState))},t.oniceconnectionstatechange=function(n){t.iceConnectionState!==e.ourIceConnectionState&&(h("oniceconnectionstatechange() | iceConnectionState: %s",t.iceConnectionState),e.ourIceConnectionState=t.iceConnectionState,e.oniceconnectionstatechange&&e.oniceconnectionstatechange(n,t.iceConnectionState))},t.onicegatheringstatechange=function(n){l.call(e)||t.iceGatheringState!==e.ourIceGatheringState&&(h("onicegatheringstatechange() | iceGatheringState: %s",t.iceGatheringState),e.ourIceGatheringState=t.iceGatheringState,e.onicegatheringstatechange&&e.onicegatheringstatechange(n,t.iceGatheringState))},t.onidentityresult=function(t){l.call(e)||(h("onidentityresult()"),e.onidentityresult&&e.onidentityresult(t))},t.onpeeridentity=function(t){l.call(e)||(h("onpeeridentity()"),e.onpeeridentity&&e.onpeeridentity(t))},t.onidpassertionerror=function(t){l.call(e)||(h("onidpassertionerror()"),e.onidpassertionerror&&e.onidpassertionerror(t))},t.onidpvalidationerror=function(t){l.call(e)||(h("onidpvalidationerror()"),e.onidpvalidationerror&&e.onidpvalidationerror(t))}}function o(){this.pcConstraints?this.pc=new p.RTCPeerConnection(this.pcConfig,this.pcConstraints):this.pc=new p.RTCPeerConnection(this.pcConfig),i.call(this)}function u(){var e=this.pc,t=this.options,n=null;return e.localDescription?(t.iceTransportsRelay?n=e.localDescription.sdp.replace(f.REGEXP_SDP_NON_RELAY_CANDIDATES,""):t.iceTransportsNone&&(n=e.localDescription.sdp.replace(f.REGEXP_SDP_CANDIDATES,"")),this.ourLocalDescription=new p.RTCSessionDescription({type:e.localDescription.type,sdp:n||e.localDescription.sdp}),this.ourLocalDescription):(this.ourLocalDescription=null,null)}function a(){var e=this;Object.defineProperties(this,{peerConnection:{get:function(){return e.pc}},signalingState:{get:function(){return e.pc.signalingState}},iceConnectionState:{get:function(){return e.pc.iceConnectionState}},iceGatheringState:{get:function(){return e.pc.iceGatheringState}},localDescription:{get:function(){return u.call(e)}},remoteDescription:{get:function(){return e.pc.remoteDescription}},peerIdentity:{get:function(){return e.pc.peerIdentity}}})}t.exports=r;var c=e("merge"),h=e("debug")("rtcninja:RTCPeerConnection"),d=e("debug")("rtcninja:ERROR:RTCPeerConnection"),p=e("./Adapter"),f={REGEXP_NORMALIZED_CANDIDATE:new RegExp(/^candidate:/i),REGEXP_FIX_CANDIDATE:new RegExp(/(^a=|\r|\n)/gi),REGEXP_RELAY_CANDIDATE:new RegExp(/ relay /i),REGEXP_SDP_CANDIDATES:new RegExp(/^a=candidate:.*\r\n/gim),REGEXP_SDP_NON_RELAY_CANDIDATES:new RegExp(/^a=candidate:(.(?!relay ))*\r\n/gim)},m={normalizeCandidate:null};d.log=console.warn.bind(console),r.prototype.createOffer=function(e,t,n){h("createOffer()");var r=this;p.fixRTCOfferOptions(n),this.pc.createOffer(function(t){l.call(r)||(h("createOffer() | success"),e&&e(t))},function(e){l.call(r)||(d("createOffer() | error:",e),t&&t(e))},n)},r.prototype.createAnswer=function(e,t,n){h("createAnswer()");var r=this;this.pc.createAnswer(function(t){l.call(r)||(h("createAnswer() | success"),e&&e(t))},function(e){l.call(r)||(d("createAnswer() | error:",e),t&&t(e))},n)},r.prototype.setLocalDescription=function(e,t,n){function r(){"number"==typeof s.options.gatheringTimeout&&"complete"!==s.pc.iceGatheringState&&(h("setLocalDescription() | ending gathering in %d ms (gatheringTimeout option)",s.options.gatheringTimeout),s.timerGatheringTimeout=setTimeout(function(){l.call(s)||(h("forced end of candidates after gatheringTimeout timeout"),delete s.timerGatheringTimeout,clearTimeout(s.timerGatheringTimeoutAfterRelay),delete s.timerGatheringTimeoutAfterRelay,s.ignoreIceGathering=!0,s.onicecandidate&&s.onicecandidate({candidate:null},null))},s.options.gatheringTimeout))}h("setLocalDescription()");var s=this;this.pc.setLocalDescription(e,function(){l.call(s)||(h("setLocalDescription() | success"),clearTimeout(s.timerGatheringTimeout),delete s.timerGatheringTimeout,clearTimeout(s.timerGatheringTimeoutAfterRelay),delete s.timerGatheringTimeoutAfterRelay,r(),t&&t())},function(e){l.call(s)||(d("setLocalDescription() | error:",e),n&&n(e))}),this.ignoreIceGathering=!1},r.prototype.setRemoteDescription=function(e,t,n){h("setRemoteDescription()");var r=this;this.pc.setRemoteDescription(e,function(){l.call(r)||(h("setRemoteDescription() | success"),t&&t())},function(e){l.call(r)||(d("setRemoteDescription() | error:",e),n&&n(e))})},r.prototype.updateIce=function(e){h("updateIce() | pcConfig: %o",e),s.call(this,e),this.pc.updateIce(this.pcConfig),this.ignoreIceGathering=!1},r.prototype.addIceCandidate=function(e,t,n){h("addIceCandidate() | candidate: %o",e);var r=this;this.pc.addIceCandidate(e,function(){l.call(r)||(h("addIceCandidate() | success"),t&&t())},function(e){l.call(r)||(d("addIceCandidate() | error:",e),n&&n(e))})},r.prototype.getConfiguration=function(){return h("getConfiguration()"),this.pc.getConfiguration()},r.prototype.getLocalStreams=function(){return h("getLocalStreams()"),this.pc.getLocalStreams()},r.prototype.getRemoteStreams=function(){return h("getRemoteStreams()"),this.pc.getRemoteStreams()},r.prototype.getStreamById=function(e){return h("getStreamById() | streamId: %s",e),this.pc.getStreamById(e)},r.prototype.addStream=function(e){h("addStream() | stream: %s",e),this.pc.addStream(e)},r.prototype.removeStream=function(e){h("removeStream() | stream: %o",e),this.pc.removeStream(e)},r.prototype.close=function(){h("close()"),this.closed=!0,clearTimeout(this.timerGatheringTimeout),delete this.timerGatheringTimeout,clearTimeout(this.timerGatheringTimeoutAfterRelay),delete this.timerGatheringTimeoutAfterRelay,this.pc.close()},r.prototype.createDataChannel=function(){return h("createDataChannel()"),this.pc.createDataChannel.apply(this.pc,arguments)},r.prototype.createDTMFSender=function(e){return h("createDTMFSender()"),this.pc.createDTMFSender?this.pc.createDTMFSender(e):null},r.prototype.getStats=function(){return h("getStats()"),this.pc.getStats.apply(this.pc,arguments)},r.prototype.setIdentityProvider=function(){return h("setIdentityProvider()"),this.pc.setIdentityProvider.apply(this.pc,arguments)},r.prototype.getIdentityAssertion=function(){return h("getIdentityAssertion()"),this.pc.getIdentityAssertion()},r.prototype.reset=function(e){h("reset() | pcConfig: %o",e);var t=this.pc;t.onnegotiationneeded=null,t.onicecandidate=null,t.onaddstream=null,t.onremovestream=null,t.ondatachannel=null,t.onsignalingstatechange=null,t.oniceconnectionstatechange=null,t.onicegatheringstatechange=null,t.onidentityresult=null,t.onpeeridentity=null,t.onidpassertionerror=null,t.onidpvalidationerror=null,clearTimeout(this.timerGatheringTimeout),delete this.timerGatheringTimeout,clearTimeout(this.timerGatheringTimeoutAfterRelay),delete this.timerGatheringTimeoutAfterRelay,h("reset() | closing current peerConnection"),t.close(),s.call(this,e),o.call(this)}},{"./Adapter":36,debug:33,merge:41}],38:[function(e,t,n){"use strict";function r(e){var t=u(e||{});return c=!0,r.RTCPeerConnection=a,r.getUserMedia=t.getUserMedia,r.mediaDevices=t.mediaDevices,r.RTCSessionDescription=t.RTCSessionDescription,r.RTCIceCandidate=t.RTCIceCandidate,r.MediaStreamTrack=t.MediaStreamTrack,r.getMediaDevices=t.getMediaDevices,r.attachMediaStream=t.attachMediaStream,r.closeMediaStream=t.closeMediaStream,r.canRenegotiate=t.canRenegotiate,t.hasWebRTC()?(l("WebRTC supported"),!0):(i("WebRTC not supported"),!1)}t.exports=r;var s=e("bowser"),l=e("debug")("rtcninja"),i=e("debug")("rtcninja:ERROR"),o=e("./version"),u=e("./Adapter"),a=e("./RTCPeerConnection"),c=!1;i.log=console.warn.bind(console),l("version %s",o),l("detected browser: %s %s [mobile:%s, tablet:%s, android:%s, ios:%s]",s.name,s.version,!!s.mobile,!!s.tablet,!!s.android,!!s.ios),r.hasWebRTC=function(){return c||r(),u.hasWebRTC()},Object.defineProperty(r,"version",{get:function(){return o}}),Object.defineProperty(r,"called",{get:function(){return c}}),r.debug=e("debug"),r.browser=s},{"./Adapter":36,"./RTCPeerConnection":37,"./version":39,bowser:40,debug:33}],39:[function(e,t,n){"use strict";t.exports=e("../package.json").version},{"../package.json":42}],40:[function(t,n,r){!function(t,r){"undefined"!=typeof n&&n.exports?n.exports=r():"function"==typeof e&&e.amd?e(t,r):this[t]=r()}("bowser",function(){function e(e){function t(t){var n=e.match(t);return n&&n.length>1&&n[1]||""}function n(t){var n=e.match(t);return n&&n.length>1&&n[2]||""}var r,s=t(/(ipod|iphone|ipad)/i).toLowerCase(),l=/like android/i.test(e),o=!l&&/android/i.test(e),u=/nexus\s*[0-6]\s*/i.test(e),a=!u&&/nexus\s*[0-9]+/i.test(e),c=/CrOS/.test(e),h=/silk/i.test(e),d=/sailfish/i.test(e),p=/tizen/i.test(e),f=/(web|hpw)os/i.test(e),m=/windows phone/i.test(e),g=(/SamsungBrowser/i.test(e),!m&&/windows/i.test(e)),T=!s&&!h&&/macintosh/i.test(e),_=!o&&!d&&!p&&!f&&/linux/i.test(e),v=t(/edge\/(\d+(\.\d+)?)/i),C=t(/version\/(\d+(\.\d+)?)/i),S=/tablet/i.test(e),E=!S&&/[^-]mobi/i.test(e),A=/xbox/i.test(e);/opera/i.test(e)?r={name:"Opera",opera:i,version:C||t(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr|opios/i.test(e)?r={name:"Opera",opera:i,version:t(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||C}:/SamsungBrowser/i.test(e)?r={name:"Samsung Internet for Android",samsungBrowser:i,version:C||t(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(e)?r={name:"Opera Coast",coast:i,version:C||t(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(e)?r={name:"Yandex Browser",yandexbrowser:i,version:C||t(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(e)?r={name:"UC Browser",ucbrowser:i,version:t(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(e)?r={name:"Maxthon",maxthon:i,version:t(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(e)?r={name:"Epiphany",epiphany:i,version:t(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(e)?r={name:"Puffin",puffin:i,version:t(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(e)?r={name:"Sleipnir",sleipnir:i,version:t(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(e)?r={name:"K-Meleon",kMeleon:i,version:t(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:m?(r={name:"Windows Phone",windowsphone:i},v?(r.msedge=i,r.version=v):(r.msie=i,r.version=t(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?r={name:"Internet Explorer",msie:i,version:t(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:c?r={name:"Chrome",chromeos:i,chromeBook:i,chrome:i,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(e)?r={name:"Microsoft Edge",msedge:i,version:v}:/vivaldi/i.test(e)?r={name:"Vivaldi",vivaldi:i,version:t(/vivaldi\/(\d+(\.\d+)?)/i)||C}:d?r={name:"Sailfish",sailfish:i,version:t(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?r={name:"SeaMonkey",seamonkey:i,version:t(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(e)?(r={name:"Firefox",firefox:i,version:t(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(r.firefoxos=i)):h?r={name:"Amazon Silk",silk:i,version:t(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(e)?r={name:"PhantomJS",phantom:i,version:t(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(e)?r={name:"SlimerJS",slimer:i,version:t(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?r={name:"BlackBerry",blackberry:i,version:C||t(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:f?(r={name:"WebOS",webos:i,version:C||t(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(r.touchpad=i)):/bada/i.test(e)?r={name:"Bada",bada:i,version:t(/dolfin\/(\d+(\.\d+)?)/i)}:p?r={name:"Tizen",tizen:i,version:t(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||C}:/qupzilla/i.test(e)?r={name:"QupZilla",qupzilla:i,version:t(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||C}:/chromium/i.test(e)?r={name:"Chromium",chromium:i,version:t(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||C}:/chrome|crios|crmo/i.test(e)?r={name:"Chrome",chrome:i,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:o?r={name:"Android",version:C}:/safari|applewebkit/i.test(e)?(r={name:"Safari",safari:i},C&&(r.version=C)):s?(r={name:"iphone"==s?"iPhone":"ipad"==s?"iPad":"iPod"},C&&(r.version=C)):r=/googlebot/i.test(e)?{name:"Googlebot",googlebot:i,version:t(/googlebot\/(\d+(\.\d+))/i)||C}:{name:t(/^(.*)\/(.*) /),version:n(/^(.*)\/(.*) /)},!r.msedge&&/(apple)?webkit/i.test(e)?(/(apple)?webkit\/537\.36/i.test(e)?(r.name=r.name||"Blink",r.blink=i):(r.name=r.name||"Webkit",r.webkit=i),!r.version&&C&&(r.version=C)):!r.opera&&/gecko\//i.test(e)&&(r.name=r.name||"Gecko",r.gecko=i,r.version=r.version||t(/gecko\/(\d+(\.\d+)?)/i)),r.windowsphone||r.msedge||!o&&!r.silk?r.windowsphone||r.msedge||!s?T?r.mac=i:A?r.xbox=i:g?r.windows=i:_&&(r.linux=i):(r[s]=i,r.ios=i):r.android=i;var y="";r.windowsphone?y=t(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):s?(y=t(/os (\d+([_\s]\d+)*) like mac os x/i),y=y.replace(/[_\s]/g,".")):o?y=t(/android[ \/-](\d+(\.\d+)*)/i):r.webos?y=t(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):r.blackberry?y=t(/rim\stablet\sos\s(\d+(\.\d+)*)/i):r.bada?y=t(/bada\/(\d+(\.\d+)*)/i):r.tizen&&(y=t(/tizen[\/\s](\d+(\.\d+)*)/i)),y&&(r.osversion=y);var R=y.split(".")[0];return S||a||"ipad"==s||o&&(3==R||R>=4&&!E)||r.silk?r.tablet=i:(E||"iphone"==s||"ipod"==s||o||u||r.blackberry||r.webos||r.bada)&&(r.mobile=i),r.msedge||r.msie&&r.version>=10||r.yandexbrowser&&r.version>=15||r.vivaldi&&r.version>=1||r.chrome&&r.version>=20||r.samsungBrowser&&r.version>=4||r.firefox&&r.version>=20||r.safari&&r.version>=6||r.opera&&r.version>=10||r.ios&&r.osversion&&r.osversion.split(".")[0]>=6||r.blackberry&&r.version>=10.1||r.chromium&&r.version>=20?r.a=i:r.msie&&r.version<10||r.chrome&&r.version<20||r.firefox&&r.version<20||r.safari&&r.version<6||r.opera&&r.version<10||r.ios&&r.osversion&&r.osversion.split(".")[0]<6||r.chromium&&r.version<20?r.c=i:r.x=i,r}function t(e){return e.split(".").length}function n(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n=0;){if(s[0][r]>s[1][r])return 1;if(s[0][r]!==s[1][r])return-1;if(0===r)return 0}}function s(t,n,s){var l=o;"string"==typeof n&&(s=n,n=void 0),void 0===n&&(n=!1),s&&(l=e(s));var i=""+l.version;for(var u in t)if(t.hasOwnProperty(u)&&l[u]){if("string"!=typeof t[u])throw new Error("Browser version in the minVersion map should be a string: "+u+": "+String(t));return r([i,t[u]])<0}return n}function l(e,t,n){return!s(e,t,n)}var i=!0,o=e("undefined"!=typeof navigator?navigator.userAgent||"":"");return o.test=function(e){for(var t=0;t=0.12.0"},dependencies:{bowser:"^1.4.6",debug:"^2.2.0",merge:"^1.2.0"},devDependencies:{browserify:"^13.1.0",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-expect-file":"0.0.7","gulp-filelog":"^0.4.1","gulp-header":"^1.8.8","gulp-jscs":"^3.0.2","gulp-jscs-stylish":"^1.4.0","gulp-jshint":"^2.0.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.4",jshint:"^2.9.3","jshint-stylish":"^2.2.1","vinyl-source-stream":"^1.1.0"},gitHead:"7160d2718fcf4a2ca0f90641456f35aa7294b837",bugs:{url:"https://github.com/eface2face/rtcninja.js/issues"},_id:"rtcninja@0.7.0",scripts:{},_shasum:"8a57d8e51ef0777f16105a33ac99e4de515cd540",_from:"rtcninja@>=0.7.0 <0.8.0",_npmVersion:"2.15.9",_nodeVersion:"4.5.0",_npmUser:{name:"ibc",email:"ibc@aliax.net"},dist:{shasum:"8a57d8e51ef0777f16105a33ac99e4de515cd540",tarball:"https://registry.npmjs.org/rtcninja/-/rtcninja-0.7.0.tgz"},maintainers:[{name:"ibc",email:"ibc@aliax.net"}],_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/rtcninja-0.7.0.tgz_1475058681576_0.9719346789643168"},directories:{},_resolved:"https://registry.npmjs.org/rtcninja/-/rtcninja-0.7.0.tgz"}},{}],43:[function(e,t,n){var r=t.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w\/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-\.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%d trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:([\w_\/]*) (\S*)(?: (\S*))?/,names:["value","uri","config"],format:function(e){return null!=e.config?"extmap:%s %s %s":"extmap:%s %s"}},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_]*):(.*)/,names:["id","attribute","value"],format:"ssrc:%d %s:%s"},{push:"ssrcGroups",reg:/^ssrc-group:(\w*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_\/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{push:"invalid",names:["value"]}]};Object.keys(r).forEach(function(e){var t=r[e];t.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})},{}],44:[function(e,t,n){var r=e("./parser"),s=e("./writer");n.write=s,n.parse=r.parse,n.parseFmtpConfig=r.parseFmtpConfig,n.parsePayloads=r.parsePayloads,n.parseRemoteCandidates=r.parseRemoteCandidates},{"./parser":45,"./writer":46}],45:[function(e,t,n){var r=function(e){return String(Number(e))===e?Number(e):e},s=function(e,t,n,s){if(s&&!n)t[s]=r(e[1]);else for(var l=0;l=r)return e;var s=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(s);case"%d":return Number(s);case"%v":return""}})},i=function(e,t,n){var r=t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format,s=[e+"="+r];if(t.names)for(var i=0;i (https://github.com/jmillan)",contributors:["Iñaki Baz Castillo (https://github.com/ibc)","Saúl Ibarra Corretgé (https://github.com/saghul)"],main:"lib/JsSIP.js",keywords:["sip","websocket","webrtc","node","browser","library"],license:"MIT",repository:{type:"git",url:"https://github.com/versatica/JsSIP.git"},bugs:{url:"https://github.com/versatica/JsSIP/issues"},dependencies:{debug:"^2.2.0",rtcninja:"^0.7.0","sdp-transform":"^1.6.2"},devDependencies:{browserify:"^13.1.0",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-expect-file":"0.0.7","gulp-header":"1.8.8","gulp-jshint":"^2.0.1","gulp-nodeunit-runner":"^0.2.2","gulp-rename":"^1.2.2","gulp-uglify":"^2.0.0","gulp-util":"^3.0.7",jshint:"^2.9.3","jshint-stylish":"^2.2.1",pegjs:"0.7.0","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},scripts:{test:"gulp test"}}},{}]},{},[7])(7)}); \ No newline at end of file +},getHeader:function(e){if(e)return this.headers[l.headerize(e)]},hasHeader:function(e){if(e)return this.headers.hasOwnProperty(l.headerize(e))&&!0||!1},deleteHeader:function(e){var t;if(e=l.headerize(e),this.headers.hasOwnProperty(e))return t=this.headers[e],delete this.headers[e],t},clearHeaders:function(){this.headers={}},clone:function(){return new r(this.scheme,this.user,this.host,this.port,JSON.parse(JSON.stringify(this.parameters)),JSON.parse(JSON.stringify(this.headers)))},toString:function(){var e,t,n,r,s=[];r=this.scheme+":",this.user&&(r+=l.escapeUser(this.user)+"@"),r+=this.host,(this.port||0===this.port)&&(r+=":"+this.port);for(t in this.parameters)r+=";"+t,null!==this.parameters[t]&&(r+="="+this.parameters[t]);for(e in this.headers)for(n=0;n0&&(r+="?"+s.join("&")),r},toAor:function(e){var t;return t=this.scheme+":",this.user&&(t+=l.escapeUser(this.user)+"@"),t+=this.host,e&&(this.port||0===this.port)&&(t+=":"+this.port),t}},r.parse=function(e){return e=i.parse(e,"SIP_URI"),e!==-1?e:void 0}},{"./Constants":1,"./Grammar":6,"./Utils":25}],25:[function(e,t,n){var r={};t.exports=r;var s=e("./Constants"),l=e("./URI"),i=e("./Grammar");r.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length},r.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)},r.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},r.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},r.isEmpty=function(e){if(null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e))return!0},r.hasMethods=function(e){for(var t,n=1;t=arguments[n++];)if(this.isFunction(e[t]))return!1;return!0},r.createRandomToken=function(e,t){var n,r,s="";for(t=t||32,n=0;n>>32-t}function n(e,t){var n,r,s,l,i;return s=2147483648&e,l=2147483648&t,n=1073741824&e,r=1073741824&t,i=(1073741823&e)+(1073741823&t),n&r?2147483648^i^s^l:n|r?1073741824&i?3221225472^i^s^l:1073741824^i^s^l:i^s^l}function r(e,t,n){return e&t|~e&n}function s(e,t,n){return e&n|t&~n}function l(e,t,n){return e^t^n}function i(e,t,n){return t^(e|~n)}function o(e,s,l,i,o,u,a){return e=n(e,n(n(r(s,l,i),o),a)),n(t(e,u),s)}function u(e,r,l,i,o,u,a){return e=n(e,n(n(s(r,l,i),o),a)),n(t(e,u),r)}function a(e,r,s,i,o,u,a){return e=n(e,n(n(l(r,s,i),o),a)),n(t(e,u),r)}function c(e,r,s,l,o,u,a){return e=n(e,n(n(i(r,s,l),o),a)),n(t(e,u),r)}function h(e){for(var t,n=e.length,r=n+8,s=(r-r%64)/64,l=16*(s+1),i=new Array(l-1),o=0,u=0;u>>29,i}function d(e){var t,n,r="",s="";for(n=0;n<=3;n++)t=e>>>8*n&255,s="0"+t.toString(16),r+=s.substr(s.length-2,2);return r}function p(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}var f,m,g,T,_,v,C,S,E,A=[],y=7,R=12,b=17,I=22,w=5,N=9,D=14,O=20,x=4,U=11,M=16,P=23,q=6,L=10,k=15,H=21;for(e=p(e),A=h(e),v=1732584193,C=4023233417,S=2562383102,E=271733878,f=0;f1)return m("more than one Via header field present in the response, dropping the response"),!1}function a(){var e=_.str_utf8_length(d.body),t=d.getHeader("content-length");if(e0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!s(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,l,o;if(!s(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],l=n.length,r=-1,n===t||s(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(o=l;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){r=o;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],s(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?s(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(s(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],29:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(h===setTimeout)return setTimeout(e,0);if((h===r||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===s||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function o(){g&&f&&(g=!1,f.length?m=f.concat(m):T=-1,m.length&&u())}function u(){if(!g){var e=l(o);g=!0;for(var t=m.length;t;){for(f=m,m=[];++T1)for(var n=1;n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(t)?r.showHidden=t:t&&n._extend(r,t),S(r.showHidden)&&(r.showHidden=!1),S(r.depth)&&(r.depth=2),S(r.colors)&&(r.colors=!1),S(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=l),u(r,e,r.depth)}function l(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function i(e,t){return e}function o(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&b(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var s=t.inspect(r,e);return v(s)||(s=u(e,s,r)),s}var l=a(e,t);if(l)return l;var i=Object.keys(t),m=o(i);if(e.showHidden&&(i=Object.getOwnPropertyNames(t)),R(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return c(t);if(0===i.length){if(b(t)){var g=t.name?": "+t.name:"";return e.stylize("[Function"+g+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(y(t))return e.stylize(Date.prototype.toString.call(t),"date");if(R(t))return c(t)}var T="",_=!1,C=["{","}"];if(f(t)&&(_=!0,C=["[","]"]),b(t)){var S=t.name?": "+t.name:"";T=" [Function"+S+"]"}if(E(t)&&(T=" "+RegExp.prototype.toString.call(t)),y(t)&&(T=" "+Date.prototype.toUTCString.call(t)),R(t)&&(T=" "+c(t)),0===i.length&&(!_||0==t.length))return C[0]+T+C[1];if(r<0)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var A;return A=_?h(e,t,r,m,i):i.map(function(n){return d(e,t,r,m,n,_)}),e.seen.pop(),p(A,T,C)}function a(e,t){if(S(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return _(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,s){for(var l=[],i=0,o=t.length;i-1&&(o=l?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),S(i)){if(l&&s.match(/^\d+$/))return o;i=JSON.stringify(""+s),i.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=e.stylize(i,"string"))}return i+": "+o}function p(e,t,n){var r=0,s=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return s>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function f(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function T(e){return null==e}function _(e){return"number"==typeof e}function v(e){return"string"==typeof e}function C(e){return"symbol"==typeof e}function S(e){return void 0===e}function E(e){return A(e)&&"[object RegExp]"===w(e)}function A(e){return"object"==typeof e&&null!==e}function y(e){return A(e)&&"[object Date]"===w(e)}function R(e){return A(e)&&("[object Error]"===w(e)||e instanceof Error)}function b(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function w(e){return Object.prototype.toString.call(e)}function N(e){return e<10?"0"+e.toString(10):e.toString(10)}function D(){var e=new Date,t=[N(e.getHours()),N(e.getMinutes()),N(e.getSeconds())].join(":");return[e.getDate(),P[e.getMonth()],t].join(" ")}function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var x=/%[sdj%]/g;n.format=function(e){if(!v(e)){for(var t=[],n=0;n=l)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),o=r[n];n=31}function s(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var s=0,l=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(s++,"%c"===e&&(l=s))}),e.splice(l,0,r),e}function l(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(e){try{null==e?n.storage.removeItem("debug"):n.storage.debug=e}catch(e){}}function o(){var e;try{e=n.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}n=t.exports=e("./debug"),n.log=l,n.formatArgs=s,n.save=i,n.load=o,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(o())},{"./debug":34}],34:[function(e,t,n){function r(){return n.colors[c++%n.colors.length]}function s(e){function t(){}function s(){var e=s,t=+new Date,l=t-(a||t);e.diff=l,e.prev=a,e.curr=t,a=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var i=Array.prototype.slice.call(arguments);i[0]=n.coerce(i[0]),"string"!=typeof i[0]&&(i=["%o"].concat(i));var o=0;i[0]=i[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;o++;var s=n.formatters[r];if("function"==typeof s){var l=i[o];t=s.call(e,l),i.splice(o,1),o--}return t}),"function"==typeof n.formatArgs&&(i=n.formatArgs.apply(e,i));var u=s.log||n.log||console.log.bind(console);u.apply(e,i)}t.enabled=!1,s.enabled=!0;var l=n.enabled(e)?s:t;return l.namespace=e,l}function l(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,s=0;s1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*h;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*a;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function s(e){return e>=c?Math.round(e/c)+"d":e>=a?Math.round(e/a)+"h":e>=u?Math.round(e/u)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function l(e){return i(e,c,"day")||i(e,a,"hour")||i(e,u,"minute")||i(e,o,"second")||e+" ms"}function i(e,t,n){if(!(e=32||s.android&&s.chrome&&T>=39||_&&s.opera&&T>=27||s.android&&s.opera&&T>=24||s.android&&s.webkit&&!s.chrome&&T>=37||S.webkitGetUserMedia&&C.webkitRTCPeerConnection)v=!0,o=S.webkitGetUserMedia.bind(S),u=S.mediaDevices,a=C.webkitRTCPeerConnection,c=C.RTCSessionDescription,h=C.RTCIceCandidate,d=C.MediaStreamTrack,d&&d.getSources?p=d.getSources.bind(d):S.getMediaDevices&&(p=S.getMediaDevices.bind(S)),f=function(e,t){return e.src=URL.createObjectURL(t),e},m=!0,g=!1;else if(s.firefox&&T<47||S.mozGetUserMedia&&C.mozRTCPeerConnection)v=!0,o=S.mozGetUserMedia.bind(S),u=S.mediaDevices,a=C.mozRTCPeerConnection,c=C.mozRTCSessionDescription,h=C.mozRTCIceCandidate,d=C.MediaStreamTrack,f=function(e,t){return e.src=URL.createObjectURL(t),e},m=!1,g=!1;else if((s.firefox||s.gecko)&&T>=47)v=!0,o=S.mozGetUserMedia.bind(S),u=S.mediaDevices,a=C.RTCPeerConnection,c=C.RTCSessionDescription,h=C.RTCIceCandidate,d=C.MediaStreamTrack,f=function(e,t){return e.src=URL.createObjectURL(t),e},m=!1,g=!1;else if(e.plugin&&"function"==typeof e.plugin.isRequired&&e.plugin.isRequired()&&"function"==typeof e.plugin.isInstalled&&e.plugin.isInstalled()){var n=e.plugin.interface;v=!0,o=n.getUserMedia,u=n.mediaDevices,a=n.RTCPeerConnection,c=n.RTCSessionDescription,h=n.RTCIceCandidate,d=n.MediaStreamTrack,d&&d.getSources?p=d.getSources.bind(d):S.getMediaDevices&&(p=S.getMediaDevices.bind(S)),f=n.attachMediaStream,m=n.canRenegotiate,g=!0}else S.getUserMedia&&C.RTCPeerConnection&&(v=!0,o=S.getUserMedia.bind(S),u=S.mediaDevices,a=C.RTCPeerConnection,c=C.RTCSessionDescription,h=C.RTCIceCandidate,d=C.MediaStreamTrack,d&&d.getSources?p=d.getSources.bind(d):S.getMediaDevices&&(p=S.getMediaDevices.bind(S)),f=C.attachMediaStream||function(e,t){return e.src=URL.createObjectURL(t),e},m=!0,g=!1);return r.hasWebRTC=function(){return v},o?r.getUserMedia=function(e,t,n){l("getUserMedia() | constraints: %o",e);try{o(e,function(e){l("getUserMedia() | success"),t&&t(e)},function(e){l("getUserMedia() | error:",e),n&&n(e)})}catch(e){i("getUserMedia() | error:",e),n&&n(e)}}:r.getUserMedia=function(e,n,r){i("getUserMedia() | WebRTC not supported"),r?r(new Error("rtcninja: WebRTC not supported, missing getUserMedia [browser: "+s.name+" "+s.version+"]")):t("getUserMedia")},r.mediaDevices=u,r.RTCPeerConnection=a||t("RTCPeerConnection"),r.RTCSessionDescription=c||t("RTCSessionDescription"),r.RTCIceCandidate=h||t("RTCIceCandidate"),r.MediaStreamTrack=d||t("MediaStreamTrack"),r.getMediaDevices=p,r.attachMediaStream=f||t("attachMediaStream"),r.canRenegotiate=m,r.closeMediaStream=function(e){if(e)try{l("closeMediaStream() | calling stop() on all the MediaStreamTrack");var t,n,r;if(e.getTracks)for(t=e.getTracks(),n=0,r=t.length;n=10)),v=!1,C=n.window||n,S=C.navigator||{};i.log=console.warn.bind(console)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{bowser:40,debug:33}],37:[function(e,t,n){"use strict";function r(e,t){h("new | [pcConfig:%o, pcConstraints:%o]",e,t),s.call(this,e),this.pcConstraints=t,this.ourLocalDescription=null,this.ourSignalingState=null,this.ourIceConnectionState=null,this.ourIceGatheringState=null,this.timerGatheringTimeout=null,this.timerGatheringTimeoutAfterRelay=null,this.ignoreIceGathering=!1,this.closed=!1,o.call(this),a.call(this)}function s(e){this.pcConfig=c(!0,e), +p.fixPeerConnectionConfig(this.pcConfig),this.options={iceTransportsRelay:"relay"===this.pcConfig.iceTransports,iceTransportsNone:"none"===this.pcConfig.iceTransports,gatheringTimeout:this.pcConfig.gatheringTimeout,gatheringTimeoutAfterRelay:this.pcConfig.gatheringTimeoutAfterRelay},delete this.pcConfig.gatheringTimeout,delete this.pcConfig.gatheringTimeoutAfterRelay,h("setConfigurationAndOptions | processed pcConfig: %o",this.pcConfig)}function l(){return this.closed||this.pc&&"closed"===this.pc.iceConnectionState}function i(){var e=this,t=this.pc;t.onnegotiationneeded=function(t){l.call(e)||(h("onnegotiationneeded()"),e.onnegotiationneeded&&e.onnegotiationneeded(t))},t.onicecandidate=function(t){var n,r,s;if(!l.call(e)&&!e.ignoreIceGathering&&!e.options.iceTransportsNone)if(n=t.candidate){if(r=f.REGEXP_RELAY_CANDIDATE.test(n.candidate),e.options.iceTransportsRelay&&!r)return;r&&!e.timerGatheringTimeoutAfterRelay&&"number"==typeof e.options.gatheringTimeoutAfterRelay&&(h("onicecandidate() | first relay candidate found, ending gathering in %d ms",e.options.gatheringTimeoutAfterRelay),e.timerGatheringTimeoutAfterRelay=setTimeout(function(){l.call(e)||(h("forced end of candidates after timeout"),delete e.timerGatheringTimeoutAfterRelay,clearTimeout(e.timerGatheringTimeout),delete e.timerGatheringTimeout,e.ignoreIceGathering=!0,e.onicecandidate&&e.onicecandidate({candidate:null},null))},e.options.gatheringTimeoutAfterRelay)),s=new p.RTCIceCandidate({sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,candidate:n.candidate}),null===m.normalizeCandidate&&(f.REGEXP_NORMALIZED_CANDIDATE.test(n.candidate)?m.normalizeCandidate=!1:(h('onicecandidate() | normalizing ICE candidates syntax (remove "a=" and "\\r\\n")'),m.normalizeCandidate=!0)),m.normalizeCandidate&&(s.candidate=n.candidate.replace(f.REGEXP_FIX_CANDIDATE,"")),h("onicecandidate() | m%d(%s) %s",s.sdpMLineIndex,s.sdpMid||"no mid",s.candidate),e.onicecandidate&&e.onicecandidate(t,s)}else h("onicecandidate() | end of candidates"),clearTimeout(e.timerGatheringTimeout),delete e.timerGatheringTimeout,clearTimeout(e.timerGatheringTimeoutAfterRelay),delete e.timerGatheringTimeoutAfterRelay,e.onicecandidate&&e.onicecandidate(t,null)},t.onaddstream=function(t){l.call(e)||(h("onaddstream() | stream: %o",t.stream),e.onaddstream&&e.onaddstream(t,t.stream))},t.onremovestream=function(t){l.call(e)||(h("onremovestream() | stream: %o",t.stream),e.onremovestream&&e.onremovestream(t,t.stream))},t.ondatachannel=function(t){l.call(e)||(h("ondatachannel() | datachannel: %o",t.channel),e.ondatachannel&&e.ondatachannel(t,t.channel))},t.onsignalingstatechange=function(n){t.signalingState!==e.ourSignalingState&&(h("onsignalingstatechange() | signalingState: %s",t.signalingState),e.ourSignalingState=t.signalingState,e.onsignalingstatechange&&e.onsignalingstatechange(n,t.signalingState))},t.oniceconnectionstatechange=function(n){t.iceConnectionState!==e.ourIceConnectionState&&(h("oniceconnectionstatechange() | iceConnectionState: %s",t.iceConnectionState),e.ourIceConnectionState=t.iceConnectionState,e.oniceconnectionstatechange&&e.oniceconnectionstatechange(n,t.iceConnectionState))},t.onicegatheringstatechange=function(n){l.call(e)||t.iceGatheringState!==e.ourIceGatheringState&&(h("onicegatheringstatechange() | iceGatheringState: %s",t.iceGatheringState),e.ourIceGatheringState=t.iceGatheringState,e.onicegatheringstatechange&&e.onicegatheringstatechange(n,t.iceGatheringState))},t.onidentityresult=function(t){l.call(e)||(h("onidentityresult()"),e.onidentityresult&&e.onidentityresult(t))},t.onpeeridentity=function(t){l.call(e)||(h("onpeeridentity()"),e.onpeeridentity&&e.onpeeridentity(t))},t.onidpassertionerror=function(t){l.call(e)||(h("onidpassertionerror()"),e.onidpassertionerror&&e.onidpassertionerror(t))},t.onidpvalidationerror=function(t){l.call(e)||(h("onidpvalidationerror()"),e.onidpvalidationerror&&e.onidpvalidationerror(t))}}function o(){this.pcConstraints?this.pc=new p.RTCPeerConnection(this.pcConfig,this.pcConstraints):this.pc=new p.RTCPeerConnection(this.pcConfig),i.call(this)}function u(){var e=this.pc,t=this.options,n=null;return e.localDescription?(t.iceTransportsRelay?n=e.localDescription.sdp.replace(f.REGEXP_SDP_NON_RELAY_CANDIDATES,""):t.iceTransportsNone&&(n=e.localDescription.sdp.replace(f.REGEXP_SDP_CANDIDATES,"")),this.ourLocalDescription=new p.RTCSessionDescription({type:e.localDescription.type,sdp:n||e.localDescription.sdp}),this.ourLocalDescription):(this.ourLocalDescription=null,null)}function a(){var e=this;Object.defineProperties(this,{peerConnection:{get:function(){return e.pc}},signalingState:{get:function(){return e.pc.signalingState}},iceConnectionState:{get:function(){return e.pc.iceConnectionState}},iceGatheringState:{get:function(){return e.pc.iceGatheringState}},localDescription:{get:function(){return u.call(e)}},remoteDescription:{get:function(){return e.pc.remoteDescription}},peerIdentity:{get:function(){return e.pc.peerIdentity}}})}t.exports=r;var c=e("merge"),h=e("debug")("rtcninja:RTCPeerConnection"),d=e("debug")("rtcninja:ERROR:RTCPeerConnection"),p=e("./Adapter"),f={REGEXP_NORMALIZED_CANDIDATE:new RegExp(/^candidate:/i),REGEXP_FIX_CANDIDATE:new RegExp(/(^a=|\r|\n)/gi),REGEXP_RELAY_CANDIDATE:new RegExp(/ relay /i),REGEXP_SDP_CANDIDATES:new RegExp(/^a=candidate:.*\r\n/gim),REGEXP_SDP_NON_RELAY_CANDIDATES:new RegExp(/^a=candidate:(.(?!relay ))*\r\n/gim)},m={normalizeCandidate:null};d.log=console.warn.bind(console),r.prototype.createOffer=function(e,t,n){h("createOffer()");var r=this;p.fixRTCOfferOptions(n),this.pc.createOffer(function(t){l.call(r)||(h("createOffer() | success"),e&&e(t))},function(e){l.call(r)||(d("createOffer() | error:",e),t&&t(e))},n)},r.prototype.createAnswer=function(e,t,n){h("createAnswer()");var r=this;this.pc.createAnswer(function(t){l.call(r)||(h("createAnswer() | success"),e&&e(t))},function(e){l.call(r)||(d("createAnswer() | error:",e),t&&t(e))},n)},r.prototype.setLocalDescription=function(e,t,n){function r(){"number"==typeof s.options.gatheringTimeout&&"complete"!==s.pc.iceGatheringState&&(h("setLocalDescription() | ending gathering in %d ms (gatheringTimeout option)",s.options.gatheringTimeout),s.timerGatheringTimeout=setTimeout(function(){l.call(s)||(h("forced end of candidates after gatheringTimeout timeout"),delete s.timerGatheringTimeout,clearTimeout(s.timerGatheringTimeoutAfterRelay),delete s.timerGatheringTimeoutAfterRelay,s.ignoreIceGathering=!0,s.onicecandidate&&s.onicecandidate({candidate:null},null))},s.options.gatheringTimeout))}h("setLocalDescription()");var s=this;this.pc.setLocalDescription(e,function(){l.call(s)||(h("setLocalDescription() | success"),clearTimeout(s.timerGatheringTimeout),delete s.timerGatheringTimeout,clearTimeout(s.timerGatheringTimeoutAfterRelay),delete s.timerGatheringTimeoutAfterRelay,r(),t&&t())},function(e){l.call(s)||(d("setLocalDescription() | error:",e),n&&n(e))}),this.ignoreIceGathering=!1},r.prototype.setRemoteDescription=function(e,t,n){h("setRemoteDescription()");var r=this;this.pc.setRemoteDescription(e,function(){l.call(r)||(h("setRemoteDescription() | success"),t&&t())},function(e){l.call(r)||(d("setRemoteDescription() | error:",e),n&&n(e))})},r.prototype.updateIce=function(e){h("updateIce() | pcConfig: %o",e),s.call(this,e),this.pc.updateIce(this.pcConfig),this.ignoreIceGathering=!1},r.prototype.addIceCandidate=function(e,t,n){h("addIceCandidate() | candidate: %o",e);var r=this;this.pc.addIceCandidate(e,function(){l.call(r)||(h("addIceCandidate() | success"),t&&t())},function(e){l.call(r)||(d("addIceCandidate() | error:",e),n&&n(e))})},r.prototype.getConfiguration=function(){return h("getConfiguration()"),this.pc.getConfiguration()},r.prototype.getLocalStreams=function(){return h("getLocalStreams()"),this.pc.getLocalStreams()},r.prototype.getRemoteStreams=function(){return h("getRemoteStreams()"),this.pc.getRemoteStreams()},r.prototype.getStreamById=function(e){return h("getStreamById() | streamId: %s",e),this.pc.getStreamById(e)},r.prototype.addStream=function(e){h("addStream() | stream: %s",e),this.pc.addStream(e)},r.prototype.removeStream=function(e){h("removeStream() | stream: %o",e),this.pc.removeStream(e)},r.prototype.close=function(){h("close()"),this.closed=!0,clearTimeout(this.timerGatheringTimeout),delete this.timerGatheringTimeout,clearTimeout(this.timerGatheringTimeoutAfterRelay),delete this.timerGatheringTimeoutAfterRelay,this.pc.close()},r.prototype.createDataChannel=function(){return h("createDataChannel()"),this.pc.createDataChannel.apply(this.pc,arguments)},r.prototype.createDTMFSender=function(e){return h("createDTMFSender()"),this.pc.createDTMFSender?this.pc.createDTMFSender(e):null},r.prototype.getStats=function(){return h("getStats()"),this.pc.getStats.apply(this.pc,arguments)},r.prototype.setIdentityProvider=function(){return h("setIdentityProvider()"),this.pc.setIdentityProvider.apply(this.pc,arguments)},r.prototype.getIdentityAssertion=function(){return h("getIdentityAssertion()"),this.pc.getIdentityAssertion()},r.prototype.reset=function(e){h("reset() | pcConfig: %o",e);var t=this.pc;t.onnegotiationneeded=null,t.onicecandidate=null,t.onaddstream=null,t.onremovestream=null,t.ondatachannel=null,t.onsignalingstatechange=null,t.oniceconnectionstatechange=null,t.onicegatheringstatechange=null,t.onidentityresult=null,t.onpeeridentity=null,t.onidpassertionerror=null,t.onidpvalidationerror=null,clearTimeout(this.timerGatheringTimeout),delete this.timerGatheringTimeout,clearTimeout(this.timerGatheringTimeoutAfterRelay),delete this.timerGatheringTimeoutAfterRelay,h("reset() | closing current peerConnection"),t.close(),s.call(this,e),o.call(this)}},{"./Adapter":36,debug:33,merge:41}],38:[function(e,t,n){"use strict";function r(e){var t=u(e||{});return c=!0,r.RTCPeerConnection=a,r.getUserMedia=t.getUserMedia,r.mediaDevices=t.mediaDevices,r.RTCSessionDescription=t.RTCSessionDescription,r.RTCIceCandidate=t.RTCIceCandidate,r.MediaStreamTrack=t.MediaStreamTrack,r.getMediaDevices=t.getMediaDevices,r.attachMediaStream=t.attachMediaStream,r.closeMediaStream=t.closeMediaStream,r.canRenegotiate=t.canRenegotiate,t.hasWebRTC()?(l("WebRTC supported"),!0):(i("WebRTC not supported"),!1)}t.exports=r;var s=e("bowser"),l=e("debug")("rtcninja"),i=e("debug")("rtcninja:ERROR"),o=e("./version"),u=e("./Adapter"),a=e("./RTCPeerConnection"),c=!1;i.log=console.warn.bind(console),l("version %s",o),l("detected browser: %s %s [mobile:%s, tablet:%s, android:%s, ios:%s]",s.name,s.version,!!s.mobile,!!s.tablet,!!s.android,!!s.ios),r.hasWebRTC=function(){return c||r(),u.hasWebRTC()},Object.defineProperty(r,"version",{get:function(){return o}}),Object.defineProperty(r,"called",{get:function(){return c}}),r.debug=e("debug"),r.browser=s},{"./Adapter":36,"./RTCPeerConnection":37,"./version":39,bowser:40,debug:33}],39:[function(e,t,n){"use strict";t.exports=e("../package.json").version},{"../package.json":42}],40:[function(t,n,r){!function(t,r){"undefined"!=typeof n&&n.exports?n.exports=r():"function"==typeof e&&e.amd?e(t,r):this[t]=r()}("bowser",function(){function e(e){function t(t){var n=e.match(t);return n&&n.length>1&&n[1]||""}function n(t){var n=e.match(t);return n&&n.length>1&&n[2]||""}var r,s=t(/(ipod|iphone|ipad)/i).toLowerCase(),l=/like android/i.test(e),o=!l&&/android/i.test(e),u=/nexus\s*[0-6]\s*/i.test(e),a=!u&&/nexus\s*[0-9]+/i.test(e),c=/CrOS/.test(e),h=/silk/i.test(e),d=/sailfish/i.test(e),p=/tizen/i.test(e),f=/(web|hpw)os/i.test(e),m=/windows phone/i.test(e),g=(/SamsungBrowser/i.test(e),!m&&/windows/i.test(e)),T=!s&&!h&&/macintosh/i.test(e),_=!o&&!d&&!p&&!f&&/linux/i.test(e),v=t(/edge\/(\d+(\.\d+)?)/i),C=t(/version\/(\d+(\.\d+)?)/i),S=/tablet/i.test(e),E=!S&&/[^-]mobi/i.test(e),A=/xbox/i.test(e);/opera/i.test(e)?r={name:"Opera",opera:i,version:C||t(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr|opios/i.test(e)?r={name:"Opera",opera:i,version:t(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||C}:/SamsungBrowser/i.test(e)?r={name:"Samsung Internet for Android",samsungBrowser:i,version:C||t(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(e)?r={name:"Opera Coast",coast:i,version:C||t(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(e)?r={name:"Yandex Browser",yandexbrowser:i,version:C||t(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(e)?r={name:"UC Browser",ucbrowser:i,version:t(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(e)?r={name:"Maxthon",maxthon:i,version:t(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(e)?r={name:"Epiphany",epiphany:i,version:t(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(e)?r={name:"Puffin",puffin:i,version:t(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(e)?r={name:"Sleipnir",sleipnir:i,version:t(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(e)?r={name:"K-Meleon",kMeleon:i,version:t(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:m?(r={name:"Windows Phone",windowsphone:i},v?(r.msedge=i,r.version=v):(r.msie=i,r.version=t(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?r={name:"Internet Explorer",msie:i,version:t(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:c?r={name:"Chrome",chromeos:i,chromeBook:i,chrome:i,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(e)?r={name:"Microsoft Edge",msedge:i,version:v}:/vivaldi/i.test(e)?r={name:"Vivaldi",vivaldi:i,version:t(/vivaldi\/(\d+(\.\d+)?)/i)||C}:d?r={name:"Sailfish",sailfish:i,version:t(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?r={name:"SeaMonkey",seamonkey:i,version:t(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(e)?(r={name:"Firefox",firefox:i,version:t(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(r.firefoxos=i)):h?r={name:"Amazon Silk",silk:i,version:t(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(e)?r={name:"PhantomJS",phantom:i,version:t(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(e)?r={name:"SlimerJS",slimer:i,version:t(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?r={name:"BlackBerry",blackberry:i,version:C||t(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:f?(r={name:"WebOS",webos:i,version:C||t(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(r.touchpad=i)):/bada/i.test(e)?r={name:"Bada",bada:i,version:t(/dolfin\/(\d+(\.\d+)?)/i)}:p?r={name:"Tizen",tizen:i,version:t(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||C}:/qupzilla/i.test(e)?r={name:"QupZilla",qupzilla:i,version:t(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||C}:/chromium/i.test(e)?r={name:"Chromium",chromium:i,version:t(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||C}:/chrome|crios|crmo/i.test(e)?r={name:"Chrome",chrome:i,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:o?r={name:"Android",version:C}:/safari|applewebkit/i.test(e)?(r={name:"Safari",safari:i},C&&(r.version=C)):s?(r={name:"iphone"==s?"iPhone":"ipad"==s?"iPad":"iPod"},C&&(r.version=C)):r=/googlebot/i.test(e)?{name:"Googlebot",googlebot:i,version:t(/googlebot\/(\d+(\.\d+))/i)||C}:{name:t(/^(.*)\/(.*) /),version:n(/^(.*)\/(.*) /)},!r.msedge&&/(apple)?webkit/i.test(e)?(/(apple)?webkit\/537\.36/i.test(e)?(r.name=r.name||"Blink",r.blink=i):(r.name=r.name||"Webkit",r.webkit=i),!r.version&&C&&(r.version=C)):!r.opera&&/gecko\//i.test(e)&&(r.name=r.name||"Gecko",r.gecko=i,r.version=r.version||t(/gecko\/(\d+(\.\d+)?)/i)),r.windowsphone||r.msedge||!o&&!r.silk?r.windowsphone||r.msedge||!s?T?r.mac=i:A?r.xbox=i:g?r.windows=i:_&&(r.linux=i):(r[s]=i,r.ios=i):r.android=i;var y="";r.windowsphone?y=t(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):s?(y=t(/os (\d+([_\s]\d+)*) like mac os x/i),y=y.replace(/[_\s]/g,".")):o?y=t(/android[ \/-](\d+(\.\d+)*)/i):r.webos?y=t(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):r.blackberry?y=t(/rim\stablet\sos\s(\d+(\.\d+)*)/i):r.bada?y=t(/bada\/(\d+(\.\d+)*)/i):r.tizen&&(y=t(/tizen[\/\s](\d+(\.\d+)*)/i)),y&&(r.osversion=y);var R=y.split(".")[0];return S||a||"ipad"==s||o&&(3==R||R>=4&&!E)||r.silk?r.tablet=i:(E||"iphone"==s||"ipod"==s||o||u||r.blackberry||r.webos||r.bada)&&(r.mobile=i),r.msedge||r.msie&&r.version>=10||r.yandexbrowser&&r.version>=15||r.vivaldi&&r.version>=1||r.chrome&&r.version>=20||r.samsungBrowser&&r.version>=4||r.firefox&&r.version>=20||r.safari&&r.version>=6||r.opera&&r.version>=10||r.ios&&r.osversion&&r.osversion.split(".")[0]>=6||r.blackberry&&r.version>=10.1||r.chromium&&r.version>=20?r.a=i:r.msie&&r.version<10||r.chrome&&r.version<20||r.firefox&&r.version<20||r.safari&&r.version<6||r.opera&&r.version<10||r.ios&&r.osversion&&r.osversion.split(".")[0]<6||r.chromium&&r.version<20?r.c=i:r.x=i,r}function t(e){return e.split(".").length}function n(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n=0;){if(s[0][r]>s[1][r])return 1;if(s[0][r]!==s[1][r])return-1;if(0===r)return 0}}function s(t,n,s){var l=o;"string"==typeof n&&(s=n,n=void 0),void 0===n&&(n=!1),s&&(l=e(s));var i=""+l.version;for(var u in t)if(t.hasOwnProperty(u)&&l[u]){if("string"!=typeof t[u])throw new Error("Browser version in the minVersion map should be a string: "+u+": "+String(t));return r([i,t[u]])<0}return n}function l(e,t,n){return!s(e,t,n)}var i=!0,o=e("undefined"!=typeof navigator?navigator.userAgent||"":"");return o.test=function(e){for(var t=0;t=0.12.0"},dependencies:{bowser:"^1.4.6",debug:"^2.2.0",merge:"^1.2.0"},devDependencies:{browserify:"^13.1.0",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-expect-file":"0.0.7","gulp-filelog":"^0.4.1","gulp-header":"^1.8.8","gulp-jscs":"^3.0.2","gulp-jscs-stylish":"^1.4.0","gulp-jshint":"^2.0.1","gulp-rename":"^1.2.2","gulp-uglify":"^1.5.4",jshint:"^2.9.3","jshint-stylish":"^2.2.1","vinyl-source-stream":"^1.1.0"},readme:'# rtcninja.js \n\nWebRTC API wrapper to deal with different browsers transparently, [eventually](http://iswebrtcreadyyet.com/) this library shouldn\'t be needed. We only have to wait until W3C group in charge [finishes the specification](https://tools.ietf.org/wg/rtcweb/) and the different browsers implement it correctly :sweat_smile:.\n\n\n\nSupported environments:\n* [Google Chrome](https://www.google.com/chrome/browser/desktop/index.html) (desktop & mobile)\n* [Google Canary](https://www.google.com/chrome/browser/canary.html) (desktop & mobile)\n* [Mozilla Firefox](https://www.mozilla.org/en-GB/firefox/new) (desktop & mobile)\n* [Firefox Nigthly](https://nightly.mozilla.org/) (desktop & mobile)\n* [Opera](http://www.opera.com/)\n* [Vivaldi](https://vivaldi.com/)\n* [CrossWalk](https://crosswalk-project.org/)\n* [Cordova](http://cordova.apache.org/): iOS support, you only have to use our plugin [following these steps](https://github.com/eface2face/cordova-plugin-iosrtc#usage).\n* [NW.js](https://github.com/nwjs/nw.js/)\n* [Electron](https://github.com/atom/electron)\n\n\n## Installation\n\n### **npm**:\n\n```bash\n$ npm install rtcninja\n```\n\nand then:\n\n```javascript\nvar rtcninja = require(\'rtcninja\');\n```\n\n### **bower**:\n\n```bash\n$ bower install rtcninja\n```\n\n\n## Browserified library\n\nTake a browserified version of the library from the `dist/` folder:\n\n* `dist/rtcninja.js`: The uncompressed version.\n* `dist/rtcninja.min.js`: The compressed production-ready version.\n\nThey expose the global `window.rtcninja` module.\n\n\n## Usage\n\nIn the [examples](./examples/) folder we provide a complete one.\n\n```javascript\n// Must first call it.\nrtcninja();\n\n// Then check.\nif (rtcninja.hasWebRTC()) {\n // Do something.\n}\nelse {\n // Do something.\n}\n```\n\n\n## Documentation\n\nYou can read the full [API documentation](docs/index.md) in the docs folder.\n\n\n## Issues\n\nhttps://github.com/eface2face/rtcninja.js/issues\n\n\n## Developer guide\n\n* Create a branch with a name including your user and a meaningful word about the fix/feature you\'re going to implement, ie: "jesusprubio/fixstuff"\n* Use [GitHub pull requests](https://help.github.com/articles/using-pull-requests).\n* Conventions:\n * We use [JSHint](http://jshint.com/) and [Crockford\'s Styleguide](http://javascript.crockford.com/code.html).\n * Please run `grunt lint` to be sure your code fits with them.\n\n\n### Debugging\n\nThe library includes the Node [debug](https://github.com/visionmedia/debug) module. In order to enable debugging:\n\nIn Node set the `DEBUG=rtcninja*` environment variable before running the application, or set it at the top of the script:\n\n```javascript\nprocess.env.DEBUG = \'rtcninja*\';\n```\n\nIn the browser run `rtcninja.debug.enable(\'rtcninja*\');` and reload the page. Note that the debugging settings are stored into the browser LocalStorage. To disable it run `rtcninja.debug.disable(\'rtcninja*\');`.\n\n\n## Copyright & License\n\n* eFace2Face Inc.\n* [MIT](./LICENSE)\n',readmeFilename:"README.md",gitHead:"7160d2718fcf4a2ca0f90641456f35aa7294b837",bugs:{url:"https://github.com/eface2face/rtcninja.js/issues"},_id:"rtcninja@0.7.0",scripts:{},_shasum:"8a57d8e51ef0777f16105a33ac99e4de515cd540",_from:"rtcninja@>=0.7.0 <0.8.0"}},{}],43:[function(e,t,n){var r=t.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w\/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-\.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%d trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:([\w_\/]*) (\S*)(?: (\S*))?/,names:["value","uri","config"],format:function(e){return null!=e.config?"extmap:%s %s %s":"extmap:%s %s"}},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_]*):(.*)/,names:["id","attribute","value"],format:"ssrc:%d %s:%s"},{push:"ssrcGroups",reg:/^ssrc-group:(\w*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_\/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{push:"invalid",names:["value"]}]};Object.keys(r).forEach(function(e){var t=r[e];t.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})},{}],44:[function(e,t,n){var r=e("./parser"),s=e("./writer");n.write=s,n.parse=r.parse,n.parseFmtpConfig=r.parseFmtpConfig,n.parsePayloads=r.parsePayloads,n.parseRemoteCandidates=r.parseRemoteCandidates},{"./parser":45,"./writer":46}],45:[function(e,t,n){var r=function(e){return String(Number(e))===e?Number(e):e},s=function(e,t,n,s){if(s&&!n)t[s]=r(e[1]);else for(var l=0;l=r)return e;var s=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(s);case"%d":return Number(s);case"%v":return""}})},i=function(e,t,n){var r=t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format,s=[e+"="+r];if(t.names)for(var i=0;i (https://github.com/jmillan)",contributors:["Iñaki Baz Castillo (https://github.com/ibc)","Saúl Ibarra Corretgé (https://github.com/saghul)"],main:"lib/JsSIP.js",keywords:["sip","websocket","webrtc","node","browser","library"],license:"MIT",repository:{type:"git",url:"https://github.com/versatica/JsSIP.git"},bugs:{url:"https://github.com/versatica/JsSIP/issues"},dependencies:{debug:"2.3.0",rtcninja:"^0.7.0","sdp-transform":"^1.6.2"},devDependencies:{browserify:"^13.1.0",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-expect-file":"0.0.7","gulp-header":"1.8.8","gulp-jshint":"^2.0.1","gulp-nodeunit-runner":"^0.2.2","gulp-rename":"^1.2.2","gulp-uglify":"^2.0.0","gulp-util":"^3.0.7",jshint:"^2.9.3","jshint-stylish":"^2.2.1",pegjs:"0.7.0","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},scripts:{test:"gulp test"}}},{}]},{},[7])(7)}); \ No newline at end of file diff --git a/package.json b/package.json index 22bf1ea..ff9e0f1 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "jssip", + "name": "jssip-rtcninja", "title": "JsSIP", "description": "the Javascript SIP library", - "version": "2.0.6", + "version": "2.0.7", "homepage": "http://jssip.net", "author": "José Luis Millán (https://github.com/jmillan)", "contributors": [ @@ -27,7 +27,7 @@ "url": "https://github.com/versatica/JsSIP/issues" }, "dependencies": { - "debug": "^2.2.0", + "debug": "2.3.0", "rtcninja": "^0.7.0", "sdp-transform": "^1.6.2" },