From 24157bde69b7b99935c877117c2b5f9e757b9425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Thu, 29 Jan 2015 01:19:28 +0100 Subject: [PATCH] 0.6.13 --- CHANGELOG.md | 4 ++-- bower.json | 2 +- dist/{jssip-0.6.13-pre.js => jssip-0.6.13.js} | 4 ++-- dist/{jssip-0.6.13-pre.min.js => jssip-0.6.13.min.js} | 4 ++-- dist/jssip.js | 4 ++-- package.json | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) rename dist/{jssip-0.6.13-pre.js => jssip-0.6.13.js} (99%) rename dist/{jssip-0.6.13-pre.min.js => jssip-0.6.13.min.js} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d129e3bc..20e316262 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ CHANGELOG ========= -Version 0.6.13 (released in 2015-XX-XX) +Version 0.6.13 (released in 2015-01-29) -------------------------------------- -* Properly keep mute local audio/video if remote is on hold, and keep it even if we reoffer. Also fix SDP direction attributes in reoffers according to current local and remote "hold" status. +* Properly keep mute local audio/video if remote is on hold, and keep it even if we re-offer. Also fix SDP direction attributes in re-offers according to current local and remote "hold" status. Version 0.6.12 (released in 2015-01-28) diff --git a/bower.json b/bower.json index 66076d3f7..3f61e4234 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jssip", - "version": "0.6.13-pre", + "version": "0.6.13", "description": "the Javascript SIP library", "main": "dist/jssip.js", "homepage": "http://jssip.net", diff --git a/dist/jssip-0.6.13-pre.js b/dist/jssip-0.6.13.js similarity index 99% rename from dist/jssip-0.6.13-pre.js rename to dist/jssip-0.6.13.js index 285c9b3be..afe471557 100644 --- a/dist/jssip-0.6.13-pre.js +++ b/dist/jssip-0.6.13.js @@ -1,5 +1,5 @@ /* - * JsSIP.js 0.6.13-pre + * JsSIP.js 0.6.13 * the Javascript SIP library * Copyright 2012-2015 José Luis Millán (https://github.com/jmillan) * Homepage: http://jssip.net @@ -23850,7 +23850,7 @@ module.exports={ "name": "jssip", "title": "JsSIP", "description": "the Javascript SIP library", - "version": "0.6.13-pre", + "version": "0.6.13", "homepage": "http://jssip.net", "author": "José Luis Millán (https://github.com/jmillan)", "contributors": [ diff --git a/dist/jssip-0.6.13-pre.min.js b/dist/jssip-0.6.13.min.js similarity index 99% rename from dist/jssip-0.6.13-pre.min.js rename to dist/jssip-0.6.13.min.js index fac1bdf2b..452cf3dfb 100644 --- a/dist/jssip-0.6.13-pre.min.js +++ b/dist/jssip-0.6.13.min.js @@ -1,5 +1,5 @@ /* - * JsSIP.js 0.6.13-pre + * JsSIP.js 0.6.13 * the Javascript SIP library * Copyright 2012-2015 José Luis Millán (https://github.com/jmillan) * Homepage: http://jssip.net @@ -13,4 +13,4 @@ var e=this;if(this.status!==P.STATUS_WAITING_FOR_ACK&&this.status!==P.STATUS_CONFIRMED)throw new j.InvalidStateError(this.status);return this.audioMuted||A.call(this,!1),this.videoMuted||E.call(this,!1),o.call(this)?void(this.localHold!==!1&&(this.localHold=!1,O.call(this,"local"),p.call(this,{eventHandlers:{failed:function(){e.terminate({cause:G.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}}}))):this.pending_actions.isPending("hold")?void 0:this.pending_actions.isPending("renegotiate")?void 0:this.pending_actions.isPending("unhold")?void 0:void this.pending_actions.push("unhold")},n.prototype.renegotiate=function(e){k("renegotiate()"),e=e||{};var t,n=this,r=e.rtcOfferConstraints||null;if(this.status!==P.STATUS_WAITING_FOR_ACK&&this.status!==P.STATUS_CONFIRMED)throw new j.InvalidStateError(this.status);return this.renegotiateOptions=e,o.call(this)?(t={failed:function(){n.terminate({cause:G.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}},_.call(this),void(this.renegotiateOptions.useUpdate?f.call(this,{sdpOffer:!0,eventHandlers:t,rtcOfferConstraints:r,extraHeaders:e.extraHeaders}):p.call(this,{eventHandlers:t,rtcOfferConstraints:r,extraHeaders:e.extraHeaders}))):this.pending_actions.isPending("hold")?void 0:this.pending_actions.isPending("unhold")?void 0:this.pending_actions.isPending("renegotiate")?void 0:void this.pending_actions.push("renegotiate")},n.prototype.receiveRequest=function(e){k("receiveRequest()");var t,n=this;if(e.method===G.CANCEL)(this.status===P.STATUS_WAITING_FOR_ANSWER||this.status===P.STATUS_ANSWERED)&&(this.status=P.STATUS_CANCELED,this.request.reply(487),D.call(this,"remote",e,G.causes.CANCELED));else switch(e.method){case G.ACK:if(this.status===P.STATUS_WAITING_FOR_ACK){if(clearTimeout(this.timers.ackTimer),clearTimeout(this.timers.invite2xxTimer),this.late_sdp){if(!e.body){N.call(this,"remote",e,G.causes.MISSING_SDP);break}this.connection.setRemoteDescription(new F.RTCSessionDescription({type:"answer",sdp:e.body}),function(){n.status=P.STATUS_CONFIRMED},function(){N.call(n,"remote",e,G.causes.BAD_MEDIA_DESCRIPTION)})}else this.status=P.STATUS_CONFIRMED;this.status!==P.STATUS_CONFIRMED||this.is_confirmed||w.call(this,"remote",e)}break;case G.BYE:this.status===P.STATUS_CONFIRMED?(e.reply(200),N.call(this,"remote",e,G.causes.BYE)):this.status===P.STATUS_INVITE_RECEIVED?(e.reply(200),this.request.reply(487,"BYE Received"),N.call(this,"remote",e,G.causes.BYE)):e.reply(403,"Wrong Status");break;case G.INVITE:this.status===P.STATUS_CONFIRMED?a.call(this,e):e.reply(403,"Wrong Status");break;case G.INFO:this.status===P.STATUS_CONFIRMED||this.status===P.STATUS_WAITING_FOR_ACK||this.status===P.STATUS_INVITE_RECEIVED?(t=e.getHeader("content-type"),t&&t.match(/^application\/dtmf-relay/i)?new $(this).init_incoming(e):e.reply(415)):e.reply(403,"Wrong Status");break;case G.UPDATE:this.status===P.STATUS_CONFIRMED?c.call(this,e):e.reply(403,"Wrong Status");break;default:e.reply(501)}},n.prototype.onTransportError=function(){H("onTransportError()"),this.status!==P.STATUS_TERMINATED&&(this.status===P.STATUS_CONFIRMED?N.call(this,"system",null,G.causes.CONNECTION_ERROR):D.call(this,"system",null,G.causes.CONNECTION_ERROR))},n.prototype.onRequestTimeout=function(){k("onRequestTimeout"),this.status!==P.STATUS_TERMINATED&&(this.status===P.STATUS_CONFIRMED?N.call(this,"system",null,G.causes.REQUEST_TIMEOUT):D.call(this,"system",null,G.causes.REQUEST_TIMEOUT))},n.prototype.onDialogError=function(e){H("onDialogError()"),this.status!==P.STATUS_TERMINATED&&(this.status===P.STATUS_CONFIRMED?N.call(this,"remote",e,G.causes.DIALOG_ERROR):D.call(this,"remote",e,G.causes.DIALOG_ERROR))},n.prototype.newDTMF=function(e){k("newDTMF()"),this.emit("newDTMF",e)},n.prototype.onReadyToReinvite=function(){var e=this.pending_actions.length()>0?this.pending_actions.shift():null;e&&("hold"===e.name?this.hold():"unhold"===e.name?this.unhold():"renegotiate"===e.name&&this.renegotiate(this.renegotiateOptions))}},{"./Constants":1,"./Dialog":2,"./Exceptions":5,"./Parser":10,"./RTCSession/DTMF":12,"./RTCSession/Request":13,"./RequestSender":15,"./SIPMessage":16,"./Timers":17,"./Transactions":18,"./Utils":22,debug:29,events:24,rtcninja:34,util:28}],12:[function(e,t){function n(e){this.owner=e,this.direction=null,this.tone=null,this.duration=null}t.exports=n;var r={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500};n.C=r;var s=e("debug")("JsSIP:RTCSession:DTMF"),l=e("debug")("JsSIP:ERROR:RTCSession:DTMF");l.log=console.warn.bind(console);var i=e("../Constants"),o=e("../Exceptions"),u=e("../RTCSession");n.prototype.send=function(e,t){var n,r;if(void 0===e)throw new TypeError("Not enough arguments");if(this.direction="outgoing",this.owner.status!==u.C.STATUS_CONFIRMED&&this.owner.status!==u.C.STATUS_WAITING_FOR_ACK)throw new o.InvalidStateError(this.owner.status);if(t=t||{},n=t.extraHeaders?t.extraHeaders.slice():[],this.eventHandlers=t.eventHandlers||{},"string"==typeof e)e=e.toUpperCase();else{if("number"!=typeof e)throw new TypeError("Invalid tone: "+e);e=e.toString()}if(!e.match(/^[0-9A-D#*]$/))throw new TypeError("Invalid tone: "+e);this.tone=e,this.duration=t.duration,n.push("Content-Type: application/dtmf-relay"),r="Signal="+this.tone+"\r\n",r+="Duration="+this.duration,this.owner.newDTMF({originator:"local",dtmf:this,request:this.request}),this.owner.dialog.sendRequest(this,i.INFO,{extraHeaders:n,body:r})},n.prototype.receiveResponse=function(e){switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):s("onSuccessResponse"),this.eventHandlers.onSuccessResponse&&this.eventHandlers.onSuccessResponse(e);break;default:this.eventHandlers.onErrorResponse&&this.eventHandlers.onErrorResponse(e)}},n.prototype.onRequestTimeout=function(){l("onRequestTimeout"),this.eventHandlers.onRequestTimeout&&this.eventHandlers.onRequestTimeout()},n.prototype.onTransportError=function(){l("onTransportError"),this.eventHandlers.onTransportError&&this.eventHandlers.onTransportError()},n.prototype.onDialogError=function(){l("onDialogError"),this.eventHandlers.onDialogError&&this.eventHandlers.onDialogError()},n.prototype.init_incoming=function(e){var t,n=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,r=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;this.direction="incoming",this.request=e,e.reply(200),e.body&&(t=e.body.split("\r\n"),2===t.length&&(n.test(t[0])&&(this.tone=t[0].replace(n,"$2")),r.test(t[1])&&(this.duration=parseInt(t[1].replace(r,"$2"),10)))),this.tone&&this.duration?this.owner.newDTMF({originator:"remote",dtmf:this,request:e}):s("invalid INFO DTMF received, discarded")}},{"../Constants":1,"../Exceptions":5,"../RTCSession":11,debug:29}],13:[function(e,t){function n(e,t){if(r("new | %s",t),this.session=e,this.method=t,this.session.status!==o.C.STATUS_1XX_RECEIVED&&this.session.status!==o.C.STATUS_WAITING_FOR_ANSWER&&this.session.status!==o.C.STATUS_WAITING_FOR_ACK&&this.session.status!==o.C.STATUS_CONFIRMED&&this.session.status!==o.C.STATUS_TERMINATED)throw new i.InvalidStateError(this.session.status);if(this.session.status===o.C.STATUS_TERMINATED&&t!==l.BYE)throw new i.InvalidStateError(this.session.status)}t.exports=n;var r=e("debug")("JsSIP:RTCSession:Request"),s=e("debug")("JsSIP:ERROR:RTCSession:Request");s.log=console.warn.bind(console);var l=e("../Constants"),i=e("../Exceptions"),o=e("../RTCSession");n.prototype.send=function(e){e=e||{};var t=e.extraHeaders&&e.extraHeaders.slice()||[],n=e.body||null;this.eventHandlers=e.eventHandlers||{},this.session.dialog.sendRequest(this,this.method,{extraHeaders:t,body:n})},n.prototype.receiveResponse=function(e){switch(!0){case/^1[0-9]{2}$/.test(e.status_code):r("onProgressResponse"),this.eventHandlers.onProgressResponse&&this.eventHandlers.onProgressResponse(e);break;case/^2[0-9]{2}$/.test(e.status_code):r("onSuccessResponse"),this.eventHandlers.onSuccessResponse&&this.eventHandlers.onSuccessResponse(e);break;default:r("onErrorResponse"),this.eventHandlers.onErrorResponse&&this.eventHandlers.onErrorResponse(e)}},n.prototype.onRequestTimeout=function(){s("onRequestTimeout"),this.eventHandlers.onRequestTimeout&&this.eventHandlers.onRequestTimeout()},n.prototype.onTransportError=function(){s("onTransportError"),this.eventHandlers.onTransportError&&this.eventHandlers.onTransportError()},n.prototype.onDialogError=function(){s("onDialogError"),this.eventHandlers.onDialogError&&this.eventHandlers.onDialogError()}},{"../Constants":1,"../Exceptions":5,"../RTCSession":11,debug:29}],14:[function(e,t){function n(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=s.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=n;var r=e("debug")("JsSIP:Registrator"),s=e("./Utils"),l=e("./Constants"),i=e("./SIPMessage"),o=e("./RequestSender");n.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,u=this;n=this.extraHeaders.slice(),n.push("Contact: "+this.contact+";expires="+this.expires+this.extraContactParams),n.push("Expires: "+this.expires),this.request=new i.OutgoingRequest(l.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},n),e=new o(this,this.ua),this.receiveResponse=function(e){var n,i,o=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")&&(i=e.getHeader("expires")),!o){r("no Contact header in response to REGISTER, response ignored");break}for(;o--;){if(n=e.parseHeader("contact",o),n.uri.user===this.ua.contact.uri.user){i=n.getParam("expires");break}n=null}if(!n){r("no Contact header pointing to us, response ignored");break}i||(i=this.expires),this.registrationTimer=setTimeout(function(){u.registrationTimer=null,u.register()},1e3*i-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()):(r("423 response received for REGISTER without Min-Expires"),this.registrationFailure(e,l.causes.SIP_FAILURE_CODE));break;default:t=s.sipErrorCause(e.status_code),this.registrationFailure(e,t)}},this.onRequestTimeout=function(){this.registrationFailure(null,l.causes.REQUEST_TIMEOUT)},this.onTransportError=function(){this.registrationFailure(null,l.causes.CONNECTION_ERROR)},e.send()},unregister:function(e){var t;if(!this.registered)return void r("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 i.OutgoingRequest(l.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 i.OutgoingRequest(l.REGISTER,this.registrar,this.ua,{to_uri:this.to_uri,call_id:this.call_id,cseq:this.cseq+=1},t));var n=new o(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=s.sipErrorCause(e.status_code),this.unregistered(e,t)}},this.onRequestTimeout=function(){this.unregistered(null,l.causes.REQUEST_TIMEOUT)},this.onTransportError=function(){this.unregistered(null,l.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":15,"./SIPMessage":16,"./Utils":22,debug:29}],15:[function(e,t){function n(e,t){this.ua=t,this.applicant=e,this.method=e.request.method,this.request=e.request,this.credentials=null,this.challenged=!1,this.staled=!1,t.status!==l.C.STATUS_USER_CLOSED||this.method===s.BYE&&this.method===s.ACK||this.onTransportError()}t.exports=n;var r=e("debug")("JsSIP:RequestSender"),s=e("./Constants"),l=e("./UA"),i=e("./DigestAuthentication"),o=e("./Transactions");n.prototype={send:function(){switch(this.method){case"INVITE":this.clientTransaction=new o.InviteClientTransaction(this,this.request,this.ua.transport);break;case"ACK":this.clientTransaction=new o.AckClientTransaction(this,this.request,this.ua.transport);break;default:this.clientTransaction=new o.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,l,o=e.status_code;if(401!==o&&407!==o||null===this.ua.configuration.password)this.applicant.receiveResponse(e);else{if(401===e.status_code?(n=e.parseHeader("www-authenticate"),l="authorization"):(n=e.parseHeader("proxy-authenticate"),l="proxy-authorization"),!n)return r(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.credentials||(this.credentials=new i(this.ua)),!this.credentials.authenticate(this.request,n))return void this.applicant.receiveResponse(e);this.challenged=!0,n.stale&&(this.staled=!0),e.method===s.REGISTER?t=this.applicant.cseq+=1:this.request.dialog?t=this.request.dialog.local_seqnum+=1:(t=this.request.cseq+1,this.request.cseq=t),this.request.setHeader("cseq",t+" "+this.method),this.request.setHeader(l,this.credentials.toString()),this.send()}else this.applicant.receiveResponse(e)}}}},{"./Constants":1,"./DigestAuthentication":4,"./Transactions":18,"./UA":20,debug:29}],16:[function(e,t){function n(e,t,n,r,s,l){var i,c,h,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.server.sip_uri),this.setHeader("via",""),this.setHeader("max-forwards",o.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 a.parse(i),this.setHeader("to",i),c=r.from_display_name||0===r.from_display_name?'"'+r.from_display_name+'" ':n.configuration.display_name?'"'+n.configuration.display_name+'" ':"",c+="<"+(r.from_uri||n.configuration.uri)+">;tag=",c+=r.from_tag||u.newTag(),this.from=new a.parse(c),this.setHeader("from",c),h=r.call_id||n.configuration.jssip_id+u.createRandomToken(15),this.call_id=h,this.setHeader("call-id",h),d=r.cseq||Math.floor(1e4*Math.random()),this.cseq=d,void this.setHeader("cseq",d+" "+e)):null}function r(){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}function s(e){this.ua=e,this.headers={},this.ruri=null,this.transport=null,this.server_transaction=null}function l(){this.headers={},this.status_code=null,this.reason_phrase=null}t.exports={OutgoingRequest:n,IncomingRequest:s,IncomingResponse:l};var i=e("debug")("JsSIP:SIPMessage"),o=e("./Constants"),u=e("./Utils"),a=e("./NameAddrHeader"),c=e("./Grammar");n.prototype={setHeader:function(e,t){this.headers[u.headerize(e)]=Array.isArray(t)?t:[t]},getHeader:function(e){var t,n,r=this.extraHeaders.length,s=this.headers[u.headerize(e)];if(s){if(s[0])return s[0]}else for(t=new RegExp("^\\s*"+e+"\\s*:","i"),n=0;r>n;n++)if(s=this.extraHeaders[n],t.test(s))return s.substring(s.indexOf(":")+1).trim()},getHeaders:function(e){var t,n,r,s=this.headers[u.headerize(e)],l=[];if(s){for(n=s.length,t=0;n>t;t++)l.push(s[t]);return l}for(n=this.extraHeaders.length,r=new RegExp("^\\s*"+e+"\\s*:","i"),t=0;n>t;t++)s=this.extraHeaders[t],r.test(s)&&l.push(s.substring(s.indexOf(":")+1).trim());return l},hasHeader:function(e){var t,n,r=this.extraHeaders.length;if(this.headers[u.headerize(e)])return!0;for(t=new RegExp("^\\s*"+e+"\\s*:","i"),n=0;r>n;n++)if(t.test(this.extraHeaders[n]))return!0;return!1},toString:function(){var e,t,n,r="",s=[];r+=this.method+" "+this.ruri+" SIP/2.0\r\n";for(e in this.headers)for(t=this.headers[e].length,n=0;t>n;n++)r+=e+": "+this.headers[e][n]+"\r\n";for(t=this.extraHeaders.length,n=0;t>n;n++)r+=this.extraHeaders[n].trim()+"\r\n";switch(this.method){case o.REGISTER:s.push("path","gruu");break;case o.INVITE:this.ua.configuration.session_timers&&s.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&s.push("gruu"),s.push("ice");break;case o.UPDATE:this.ua.configuration.session_timers&&s.push("timer"),s.push("ice")}return s.push("outbound"),r+="Allow: "+o.ALLOWED_METHODS+"\r\n",r+="Supported: "+s+"\r\n",r+="User-Agent: "+o.USER_AGENT+"\r\n",this.body?(t=u.str_utf8_length(this.body),r+="Content-Length: "+t+"\r\n\r\n",r+=this.body):r+="Content-Length: 0\r\n\r\n",r}},r.prototype={addHeader:function(e,t){var n={raw:t};e=u.headerize(e),this.headers[e]?this.headers[e].push(n):this.headers[e]=[n]},getHeader:function(e){var t=this.headers[u.headerize(e)];if(t)return t[0]?t[0].raw:void 0},getHeaders:function(e){var t,n,r=this.headers[u.headerize(e)],s=[];if(!r)return[];for(n=r.length,t=0;n>t;t++)s.push(r[t].raw);return s},hasHeader:function(e){return this.headers[u.headerize(e)]?!0:!1},parseHeader:function(e,t){var n,r,s;return e=u.headerize(e),t=t||0,this.headers[e]?t>=this.headers[e].length?void i('not so many "'+e+'" headers present'):(n=this.headers[e][t],r=n.raw,n.parsed?n.parsed:(s=c.parse(r,e.replace(/-/g,"_")),-1===s?(this.headers[e].splice(t,1),void i('error parsing "'+e+'" header field with value "'+r+'"')):(n.parsed=s,s))):void i('header "'+e+'" not present')},s:function(e,t){return this.parseHeader(e,t)},setHeader:function(e,t){var n={raw:t};this.headers[u.headerize(e)]=[n]},toString:function(){return this.data}},s.prototype=new r,s.prototype.reply=function(e,t,n,r,s,l){var i,a,c,h,d,p=[],f=this.getHeader("To"),m=0,g=0;if(e=e||null,t=t||null,!e||100>e||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||o.REASON_PHRASE[e]||"",n=n&&n.slice()||[],d="SIP/2.0 "+e+" "+t+"\r\n",this.method===o.INVITE&&e>100&&200>=e)for(i=this.getHeaders("record-route"),c=i.length,m;c>m;m++)d+="Record-Route: "+i[m]+"\r\n";for(a=this.getHeaders("via"),c=a.length,g;c>g;g++)d+="Via: "+a[g]+"\r\n";for(!this.to_tag&&e>100?f+=";tag="+u.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",c=n.length,h=0;c>h;h++)d+=n[h].trim()+"\r\n";switch(this.method){case o.INVITE:this.ua.configuration.session_timers&&p.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&p.push("gruu"),p.push("ice");break;case o.UPDATE:this.ua.configuration.session_timers&&p.push("timer"),r&&p.push("ice")}p.push("outbound"),this.method===o.OPTIONS?(d+="Allow: "+o.ALLOWED_METHODS+"\r\n",d+="Accept: "+o.ACCEPTED_BODY_TYPES+"\r\n"):405===e?d+="Allow: "+o.ALLOWED_METHODS+"\r\n":415===e&&(d+="Accept: "+o.ACCEPTED_BODY_TYPES+"\r\n"),d+="Supported: "+p+"\r\n",r?(c=u.str_utf8_length(r),d+="Content-Type: application/sdp\r\n",d+="Content-Length: "+c+"\r\n\r\n",d+=r):d+="Content-Length: 0\r\n\r\n",this.server_transaction.receiveResponse(e,d,s,l)},s.prototype.reply_sl=function(e,t){var n,r,s=0,l=this.getHeaders("via"),i=l.length;if(e=e||null,t=t||null,!e||100>e||e>699)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||o.REASON_PHRASE[e]||"",r="SIP/2.0 "+e+" "+t+"\r\n",s;i>s;s++)r+="Via: "+l[s]+"\r\n";n=this.getHeader("To"),!this.to_tag&&e>100?n+=";tag="+u.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)},l.prototype=new r},{"./Constants":1,"./Grammar":6,"./NameAddrHeader":9,"./Utils":22,debug:29}],17:[function(e,t){var n=500,r=4e3,s=5e3,l={T1:n,T2:r,T4:s,TIMER_B:64*n,TIMER_D:0*n,TIMER_F:64*n,TIMER_H:64*n,TIMER_I:0*n,TIMER_J:0*n,TIMER_K:0*s,TIMER_L:64*n,TIMER_M:64*n,PROVISIONAL_RESPONSE_INTERVAL:6e4};t.exports=l},{}],18:[function(e,t){function n(e,t,n){var r,s;this.type=u.NON_INVITE_CLIENT,this.transport=n,this.id="z9hG4bK"+Math.floor(1e7*Math.random()),this.request_sender=e,this.request=t,s=e.ua.configuration.hack_via_tcp?"TCP":e.ua.configuration.hack_via_ws?"WS":n.server.scheme,r="SIP/2.0/"+s,r+=" "+e.ua.configuration.via_host+";branch="+this.id,this.request.setHeader("via",r),this.request_sender.ua.newTransaction(this),c.EventEmitter.call(this)}function r(e,t,n){var r,s,l=this;this.type=u.INVITE_CLIENT,this.transport=n,this.id="z9hG4bK"+Math.floor(1e7*Math.random()),this.request_sender=e,this.request=t,s=e.ua.configuration.hack_via_tcp?"TCP":e.ua.configuration.hack_via_ws?"WS":n.server.scheme,r="SIP/2.0/"+s,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){l.cancel_request(l,e)},c.EventEmitter.call(this)}function s(e,t,n){var r,s;this.transport=n,this.id="z9hG4bK"+Math.floor(1e7*Math.random()),this.request_sender=e,this.request=t,s=e.ua.configuration.hack_via_tcp?"TCP":e.ua.configuration.hack_via_ws?"WS":n.server.scheme,r="SIP/2.0/"+s,r+=" "+e.ua.configuration.via_host+";branch="+this.id,this.request.setHeader("via",r),c.EventEmitter.call(this)}function l(e,t){this.type=u.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=u.STATUS_TRYING,t.newTransaction(this),c.EventEmitter.call(this)}function i(e,t){this.type=u.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=u.STATUS_PROCEEDING,t.newTransaction(this),this.resendProvisionalTimer=null,e.reply(100),c.EventEmitter.call(this)}function o(e,t){var n;switch(t.method){case g.INVITE:if(n=e.transactions.ist[t.via_branch]){switch(n.state){case u.STATUS_PROCEEDING:n.transport.send(n.last_response);break;case u.STATUS_ACCEPTED:}return!0}break;case g.ACK:if(n=e.transactions.ist[t.via_branch],!n)return!1;if(n.state===u.STATUS_ACCEPTED)return!1;if(n.state===u.STATUS_COMPLETED)return n.state=u.STATUS_CONFIRMED,n.I=setTimeout(function(){n.timer_I()},T.TIMER_I),!0;break;case g.CANCEL:return n=e.transactions.ist[t.via_branch],n?(t.reply_sl(200),n.state===u.STATUS_PROCEEDING?!1:!0):(t.reply_sl(481),!0);default:if(n=e.transactions.nist[t.via_branch]){switch(n.state){case u.STATUS_TRYING:break;case u.STATUS_PROCEEDING:case u.STATUS_COMPLETED:n.transport.send(n.last_response)}return!0}}}t.exports={C:null,NonInviteClientTransaction:n,InviteClientTransaction:r,AckClientTransaction:s,NonInviteServerTransaction:l,InviteServerTransaction:i,checkTransaction:o};var u={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=u;var a=e("util"),c=e("events"),h=e("debug")("JsSIP:NonInviteClientTransaction"),d=e("debug")("JsSIP:InviteClientTransaction"),p=e("debug")("JsSIP:AckClientTransaction"),f=e("debug")("JsSIP:NonInviteServerTransaction"),m=e("debug")("JsSIP:InviteServerTransaction"),g=e("./Constants"),T=e("./Timers");a.inherits(n,c.EventEmitter),n.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged")},n.prototype.send=function(){var e=this;this.stateChanged(u.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},T.TIMER_F),this.transport.send(this.request)||this.onTransportError()},n.prototype.onTransportError=function(){h("transport error occurred, deleting transaction "+this.id),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(u.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this),this.request_sender.onTransportError()},n.prototype.timer_F=function(){h("Timer F expired for transaction "+this.id),this.stateChanged(u.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this),this.request_sender.onRequestTimeout()},n.prototype.timer_K=function(){this.stateChanged(u.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this)},n.prototype.receiveResponse=function(e){var t=this,n=e.status_code;if(200>n)switch(this.state){case u.STATUS_TRYING:case u.STATUS_PROCEEDING:this.stateChanged(u.STATUS_PROCEEDING),this.request_sender.receiveResponse(e)}else switch(this.state){case u.STATUS_TRYING:case u.STATUS_PROCEEDING:this.stateChanged(u.STATUS_COMPLETED),clearTimeout(this.F),408===n?this.request_sender.onRequestTimeout():this.request_sender.receiveResponse(e),this.K=setTimeout(function(){t.timer_K()},T.TIMER_K);break;case u.STATUS_COMPLETED:}},a.inherits(r,c.EventEmitter),r.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged")},r.prototype.send=function(){var e=this;this.stateChanged(u.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},T.TIMER_B),this.transport.send(this.request)||this.onTransportError()},r.prototype.onTransportError=function(){d("transport error occurred, deleting transaction "+this.id),clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==u.STATUS_ACCEPTED&&this.request_sender.onTransportError(),this.stateChanged(u.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this)},r.prototype.timer_M=function(){d("Timer M expired for transaction "+this.id),this.state===u.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(u.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this))},r.prototype.timer_B=function(){d("Timer B expired for transaction "+this.id),this.state===u.STATUS_CALLING&&(this.stateChanged(u.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this),this.request_sender.onRequestTimeout())},r.prototype.timer_D=function(){d("Timer D expired for transaction "+this.id),clearTimeout(this.B),this.stateChanged(u.STATUS_TERMINATED),this.request_sender.ua.destroyTransaction(this)},r.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()},T.TIMER_D),this.transport.send(this.ack)},r.prototype.cancel_request=function(e,t){var n=e.request;this.cancel=g.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===u.STATUS_PROCEEDING&&this.transport.send(this.cancel)},r.prototype.receiveResponse=function(e){var t=this,n=e.status_code;if(n>=100&&199>=n)switch(this.state){case u.STATUS_CALLING:this.stateChanged(u.STATUS_PROCEEDING),this.request_sender.receiveResponse(e);break;case u.STATUS_PROCEEDING:this.request_sender.receiveResponse(e)}else if(n>=200&&299>=n)switch(this.state){case u.STATUS_CALLING:case u.STATUS_PROCEEDING:this.stateChanged(u.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},T.TIMER_M),this.request_sender.receiveResponse(e);break;case u.STATUS_ACCEPTED:this.request_sender.receiveResponse(e)}else if(n>=300&&699>=n)switch(this.state){case u.STATUS_CALLING:case u.STATUS_PROCEEDING:this.stateChanged(u.STATUS_COMPLETED),this.sendACK(e),this.request_sender.receiveResponse(e);break;case u.STATUS_COMPLETED:this.sendACK(e)}},a.inherits(s,c.EventEmitter),s.prototype.send=function(){this.transport.send(this.request)||this.onTransportError()},s.prototype.onTransportError=function(){p("transport error occurred for transaction "+this.id),this.request_sender.onTransportError()},a.inherits(l,c.EventEmitter),l.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged")},l.prototype.timer_J=function(){f("Timer J expired for transaction "+this.id),this.stateChanged(u.STATUS_TERMINATED),this.ua.destroyTransaction(this)},l.prototype.onTransportError=function(){this.transportError||(this.transportError=!0,f("transport error occurred, deleting transaction "+this.id),clearTimeout(this.J),this.stateChanged(u.STATUS_TERMINATED),this.ua.destroyTransaction(this))},l.prototype.receiveResponse=function(e,t,n,r){var s=this;if(100===e)switch(this.state){case u.STATUS_TRYING:this.stateChanged(u.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case u.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=200&&699>=e)switch(this.state){case u.STATUS_TRYING:case u.STATUS_PROCEEDING:this.stateChanged(u.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){s.timer_J()},T.TIMER_J),this.transport.send(t)?n&&n():(this.onTransportError(),r&&r());break;case u.STATUS_COMPLETED:}},a.inherits(i,c.EventEmitter),i.prototype.stateChanged=function(e){this.state=e,this.emit("stateChanged")},i.prototype.timer_H=function(){m("Timer H expired for transaction "+this.id),this.state===u.STATUS_COMPLETED&&m("ACK not received, dialog will be terminated"),this.stateChanged(u.STATUS_TERMINATED),this.ua.destroyTransaction(this)},i.prototype.timer_I=function(){this.stateChanged(u.STATUS_TERMINATED),this.ua.destroyTransaction(this)},i.prototype.timer_L=function(){m("Timer L expired for transaction "+this.id),this.state===u.STATUS_ACCEPTED&&(this.stateChanged(u.STATUS_TERMINATED),this.ua.destroyTransaction(this))},i.prototype.onTransportError=function(){this.transportError||(this.transportError=!0,m("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(u.STATUS_TERMINATED),this.ua.destroyTransaction(this)) },i.prototype.resend_provisional=function(){this.transport.send(this.last_response)||this.onTransportError()},i.prototype.receiveResponse=function(e,t,n,r){var s=this;if(e>=100&&199>=e)switch(this.state){case u.STATUS_PROCEEDING:this.transport.send(t)||this.onTransportError(),this.last_response=t}if(e>100&&199>=e&&this.state===u.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){s.resend_provisional()},T.PROVISIONAL_RESPONSE_INTERVAL));else if(e>=200&&299>=e)switch(this.state){case u.STATUS_PROCEEDING:this.stateChanged(u.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){s.timer_L()},T.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case u.STATUS_ACCEPTED:this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=300&&699>=e)switch(this.state){case u.STATUS_PROCEEDING:null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(u.STATUS_COMPLETED),this.H=setTimeout(function(){s.timer_H()},T.TIMER_H),n&&n()):(this.onTransportError(),r&&r())}}},{"./Constants":1,"./Timers":17,debug:29,events:24,util:28}],19:[function(e,t){function n(e,t){this.ua=e,this.ws=null,this.server=t,this.reconnection_attempts=0,this.closed=!1,this.connected=!1,this.reconnectTimer=null,this.lastTransportError={},this.node_websocket_options=this.ua.configuration.node_websocket_options||{},this.node_websocket_options.headers=this.node_websocket_options.headers||{},this.node_websocket_options.headers["User-Agent"]=l.USER_AGENT}t.exports=n;var r={STATUS_READY:0,STATUS_DISCONNECTED:1,STATUS_ERROR:2};n.C=r;var s=e("debug")("JsSIP:Transport"),l=e("./Constants"),i=e("./Parser"),o=e("./UA"),u=e("./SIPMessage"),a=e("./sanityCheck"),c=e("websocket").w3cwebsocket;n.prototype={connect:function(){var e=this;if(this.ws&&(this.ws.readyState===this.ws.OPEN||this.ws.readyState===this.ws.CONNECTING))return s("WebSocket "+this.server.ws_uri+" is already connected"),!1;this.ws&&this.ws.close(),s("connecting to WebSocket "+this.server.ws_uri),this.ua.onTransportConnecting(this,0===this.reconnection_attempts?1:this.reconnection_attempts);try{this.ws=new c(this.server.ws_uri,"sip",this.node_websocket_options.origin,this.node_websocket_options.headers,this.node_websocket_options.requestOptions,this.node_websocket_options.clientConfig),this.ws.binaryType="arraybuffer",this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(t){e.onClose(t)},this.ws.onmessage=function(t){e.onMessage(t)},this.ws.onerror=function(t){e.onError(t)}}catch(t){s("error connecting to WebSocket "+this.server.ws_uri+": "+t),this.lastTransportError.code=null,this.lastTransportError.reason=t.message,this.ua.onTransportError(this)}},disconnect:function(){this.ws&&(clearTimeout(this.reconnectTimer),this.closed=!0,s("closing WebSocket "+this.server.ws_uri),this.ws.close()),null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.ua.onTransportDisconnected({transport:this,code:this.lastTransportError.code,reason:this.lastTransportError.reason}))},send:function(e){var t=e.toString();return this.ws&&this.ws.readyState===this.ws.OPEN?(s("sending WebSocket message:\n\n"+t+"\n"),this.ws.send(t),!0):(s("unable to send message, WebSocket is not open"),!1)},onOpen:function(){this.connected=!0,s("WebSocket "+this.server.ws_uri+" connected"),null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnection_attempts=0,this.closed=!1,this.ua.onTransportConnected(this)},onClose:function(e){var t=this.connected;this.connected=!1,this.lastTransportError.code=e.code,this.lastTransportError.reason=e.reason,s("WebSocket disconnected (code: "+e.code+(e.reason?"| reason: "+e.reason:"")+")"),e.wasClean===!1&&s("WebSocket abrupt disconnection"),t===!0?(this.ua.onTransportClosed(this),this.closed?this.ua.emit("disconnected",this.ua,{transport:this,code:this.lastTransportError.code,reason:this.lastTransportError.reason}):this.reConnect()):this.ua.onTransportError(this)},onMessage:function(e){var t,n,r=e.data;if("\r\n"===r)return void s("received WebSocket message with CRLF Keep Alive response");if("string"!=typeof r){try{r=String.fromCharCode.apply(null,new Uint8Array(r))}catch(c){return void s("received WebSocket binary message failed to be converted into string, message discarded")}s("received WebSocket binary message:\n\n"+r+"\n")}else s("received WebSocket text message:\n\n"+r+"\n");if(t=i.parseMessage(r,this.ua),t&&!(this.ua.status===o.C.STATUS_USER_CLOSED&&t instanceof u.IncomingRequest)&&a(t,this.ua,this))if(t instanceof u.IncomingRequest)t.transport=this,this.ua.receiveRequest(t);else if(t instanceof u.IncomingResponse)switch(t.method){case l.INVITE:n=this.ua.transactions.ict[t.via_branch],n&&n.receiveResponse(t);break;case l.ACK:break;default:n=this.ua.transactions.nict[t.via_branch],n&&n.receiveResponse(t)}},onError:function(e){s("WebSocket connection error: %o",e)},reConnect:function(){var e=this;this.reconnection_attempts+=1,this.reconnection_attempts>this.ua.configuration.ws_server_max_reconnection?(s("maximum reconnection attempts for WebSocket "+this.server.ws_uri),this.ua.onTransportError(this)):(s("trying to reconnect to WebSocket "+this.server.ws_uri+" (reconnection attempt "+this.reconnection_attempts+")"),this.reconnectTimer=setTimeout(function(){e.connect(),e.reconnectTimer=null},1e3*this.ua.configuration.ws_server_reconnection_timeout))}}},{"./Constants":1,"./Parser":10,"./SIPMessage":16,"./UA":20,"./sanityCheck":23,debug:29,websocket:43}],20:[function(e,t){function n(e){if(this.cache={credentials:{}},this.configuration={},this.dynConfiguration={},this.dialogs={},this.applicants={},this.sessions={},this.transport=null,this.contact=null,this.status=r.STATUS_INIT,this.error=null,this.transactions={nist:{},nict:{},ist:{},ict:{}},this.data={},this.transportRecoverAttempts=0,this.transportRecoveryTimer=null,Object.defineProperties(this,{transactionsCount:{get:function(){var e,t=["nist","nict","ist","ict"],n=0;for(e in t)n+=Object.keys(this.transactions[t[e]]).length;return n}},nictTransactionsCount:{get:function(){return Object.keys(this.transactions.nict).length}},nistTransactionsCount:{get:function(){return Object.keys(this.transactions.nist).length}},ictTransactionsCount:{get:function(){return Object.keys(this.transactions.ict).length}},istTransactionsCount:{get:function(){return Object.keys(this.transactions.ist).length}}}),void 0===e)throw new TypeError("Not enough arguments");try{this.loadConfig(e)}catch(t){throw this.status=r.STATUS_NOT_READY,this.error=r.CONFIGURATION_ERROR,t}this._registrator=new a(this),l.EventEmitter.call(this)}t.exports=n;var r={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2};n.C=r;var s=e("util"),l=e("events"),i=e("debug")("JsSIP:UA"),o=e("rtcninja"),u=e("./Constants"),a=e("./Registrator"),c=e("./RTCSession"),h=e("./Message"),d=e("./Transport"),p=e("./Transactions"),p=e("./Transactions"),f=e("./Utils"),m=e("./Exceptions"),g=e("./URI"),T=e("./Grammar");s.inherits(n,l.EventEmitter),n.prototype.start=function(){var e;this.status===r.STATUS_INIT?(e=this.getNextWsServer(),this.transport=new d(this,e),this.transport.connect()):this.status===r.STATUS_USER_CLOSED?(i("restarting UA"),this.status=r.STATUS_READY,this.transport.connect()):i(this.status===r.STATUS_READY?"UA is in READY status, not restarted":"ERROR: connection is down, Auto-Recovery system is trying to reconnect"),this.dynConfiguration.register=this.configuration.register},n.prototype.register=function(){this.dynConfiguration.register=!0,this._registrator.register()},n.prototype.unregister=function(e){this.dynConfiguration.register=!1,this._registrator.unregister(e)},n.prototype.registrator=function(){return this._registrator},n.prototype.isRegistered=function(){return this._registrator.registered?!0:!1},n.prototype.isConnected=function(){return this.transport?this.transport.connected:!1},n.prototype.call=function(e,t){var n;return n=new c(this),n.connect(e,t),n},n.prototype.sendMessage=function(e,t,n){var r;return r=new h(this),r.send(e,t,n),r},n.prototype.terminateSessions=function(e){for(var t in this.sessions)this.sessions[t].isEnded()||this.sessions[t].terminate(e)},n.prototype.stop=function(){var e,t,n,s=this;if(this.dynConfiguration={},this.status===r.STATUS_USER_CLOSED)return void i("UA already closed");clearTimeout(this.transportRecoveryTimer),this._registrator.close(),n=Object.keys(this.sessions).length;for(e in this.sessions){i("closing session "+e);try{this.sessions[e].terminate()}catch(l){}}for(t in this.applicants)try{this.applicants[t].close()}catch(l){}this.status=r.STATUS_USER_CLOSED,setTimeout(function(){s.transport.disconnect()},2e3)},n.prototype.normalizeTarget=function(e){return f.normalizeTarget(e,this.configuration.hostport_params)},n.prototype.saveCredentials=function(e){this.cache.credentials[e.realm]=this.cache.credentials[e.realm]||{},this.cache.credentials[e.realm][e.uri]=e},n.prototype.getCredentials=function(e){var t,n;return t=e.ruri.host,this.cache.credentials[t]&&this.cache.credentials[t][e.ruri]&&(n=this.cache.credentials[t][e.ruri],n.method=e.method),n},n.prototype.onTransportClosed=function(e){var t,n,r,s=["nict","ict","nist","ist"];for(e.server.status=d.C.STATUS_DISCONNECTED,i("connection state set to "+d.C.STATUS_DISCONNECTED),r=s.length,t=0;r>t;t++)for(n in this.transactions[s[t]])this.transactions[s[t]][n].onTransportError();this.emit("disconnected")},n.prototype.onTransportError=function(e){var t;i("transport "+e.server.ws_uri+" failed | connection state set to "+d.C.STATUS_ERROR),e.server.status=d.C.STATUS_ERROR,this.emit("disconnected",{transport:e,code:e.lastTransportError.code,reason:e.lastTransportError.reason}),this.status!==r.STATUS_USER_CLOSED&&(t=this.getNextWsServer(),t?(this.transport=new d(this,t),this.transport.connect()):(this.closeSessionsOnTransportError(),this.error&&this.error===r.NETWORK_ERROR||(this.status=r.STATUS_NOT_READY,this.error=r.NETWORK_ERROR),this.recoverTransport()))},n.prototype.onTransportConnected=function(e){this.transport=e,this.transportRecoverAttempts=0,e.server.status=d.C.STATUS_READY,i("connection state set to "+d.C.STATUS_READY),this.status!==r.STATUS_USER_CLOSED&&(this.status=r.STATUS_READY,this.error=null,this.emit("connected",{transport:e}),this.dynConfiguration.register&&this._registrator.register())},n.prototype.onTransportConnecting=function(e,t){this.emit("connecting",{transport:e,attempts:t})},n.prototype.onTransportDisconnected=function(e){this.emit("disconnected",e)},n.prototype.newTransaction=function(e){this.transactions[e.type][e.id]=e,this.emit("newTransaction",{transaction:e})},n.prototype.destroyTransaction=function(e){delete this.transactions[e.type][e.id],this.emit("transactionDestroyed",{transaction:e})},n.prototype.newMessage=function(e){this.emit("newMessage",e)},n.prototype.newRTCSession=function(e){this.emit("newRTCSession",e)},n.prototype.registered=function(e){this.emit("registered",e)},n.prototype.unregistered=function(e){this.emit("unregistered",e)},n.prototype.registrationFailed=function(e){this.emit("registrationFailed",e)},n.prototype.receiveRequest=function(e){var t,n,r,s=e.method;if(e.ruri.user!==this.configuration.uri.user&&e.ruri.user!==this.contact.uri.user)return i("Request-URI does not point to us"),void(e.method!==u.ACK&&e.reply_sl(404));if(e.ruri.scheme===u.SIPS)return void e.reply_sl(416);if(!p.checkTransaction(this,e)){if(s===u.INVITE?new p.InviteServerTransaction(e,this):s!==u.ACK&&s!==u.CANCEL&&new p.NonInviteServerTransaction(e,this),s===u.OPTIONS)e.reply(200);else if(s===u.MESSAGE){if(0===this.listeners("newMessage").length)return void e.reply(405);r=new h(this),r.init_incoming(e)}else if(s===u.INVITE&&!e.to_tag&&0===this.listeners("newRTCSession").length)return void e.reply(405);if(e.to_tag)t=this.findDialog(e),t?t.receiveRequest(e):s===u.NOTIFY?(n=this.findSession(e),n?n.receiveRequest(e):(i("received NOTIFY request for a non existent subscription"),e.reply(481,"Subscription does not exist"))):s!==u.ACK&&e.reply(481);else switch(s){case u.INVITE:o.hasWebRTC()?(n=new c(this),n.init_incoming(e)):(i("INVITE received but WebRTC is not supported"),e.reply(488));break;case u.BYE:e.reply(481);break;case u.CANCEL:n=this.findSession(e),n?n.receiveRequest(e):i("received CANCEL request for a non existent session");break;case u.ACK:break;default:e.reply(405)}}},n.prototype.findSession=function(e){var t=e.call_id+e.from_tag,n=this.sessions[t],r=e.call_id+e.to_tag,s=this.sessions[r];return n?n:s?s:null},n.prototype.findDialog=function(e){var t=e.call_id+e.from_tag+e.to_tag,n=this.dialogs[t];return n?n:(t=e.call_id+e.to_tag+e.from_tag,n=this.dialogs[t],n?n:null)},n.prototype.getNextWsServer=function(){var e,t,n,r=[];for(t=this.configuration.ws_servers.length,e=0;t>e;e++)n=this.configuration.ws_servers[e],n.status!==d.C.STATUS_ERROR&&(0===r.length?r.push(n):n.weight>r[0].weight?r=[n]:n.weight===r[0].weight&&r.push(n));return e=Math.floor(Math.random()*r.length),r[e]},n.prototype.closeSessionsOnTransportError=function(){var e;for(e in this.sessions)this.sessions[e].onTransportError();this._registrator.onTransportClosed()},n.prototype.recoverTransport=function(e){var t,n,r,s,l,o;for(e=e||this,l=e.transportRecoverAttempts,n=e.configuration.ws_servers.length,t=0;n>t;t++)e.configuration.ws_servers[t].status=0;o=e.getNextWsServer(),r=Math.floor(Math.random()*Math.pow(2,l)+1),s=r*e.configuration.connection_recovery_min_interval,s>e.configuration.connection_recovery_max_interval&&(i("time for next connection attempt exceeds connection_recovery_max_interval, resetting counter"),s=e.configuration.connection_recovery_min_interval,l=0),i("next connection attempt in "+s+" seconds"),this.transportRecoveryTimer=setTimeout(function(){e.transportRecoverAttempts=l+1,e.transport=new d(e,o),e.transport.connect()},1e3*s)},n.prototype.loadConfig=function(e){var t,r,s,l,o,u={via_host:f.createRandomToken(12)+".invalid",password:null,register_expires:600,register:!0,registrar_server:null,ws_server_max_reconnection:3,ws_server_reconnection_timeout:4,connection_recovery_min_interval:2,connection_recovery_max_interval:30,use_preloaded_route:!1,no_answer_timeout:60,session_timers:!0,hack_via_tcp:!1,hack_via_ws:!1,hack_ip_in_contact:!1,node_websocket_options:{}};for(t in n.configuration_check.mandatory){if(!e.hasOwnProperty(t))throw new m.ConfigurationError(t);if(r=e[t],s=n.configuration_check.mandatory[t].call(this,r),void 0===s)throw new m.ConfigurationError(t,r);u[t]=s}for(t in n.configuration_check.optional)if(e.hasOwnProperty(t)){if(r=e[t],f.isEmpty(r))continue;if(s=n.configuration_check.optional[t].call(this,r),void 0===s)throw new m.ConfigurationError(t,r);u[t]=s}if(u.connection_recovery_max_interval"}};for(t in u)n.configuration_skeleton[t].value=u[t];Object.defineProperties(this.configuration,n.configuration_skeleton);for(t in u)n.configuration_skeleton[t].value="";i("configuration parameters after validation:");for(t in u)switch(t){case"uri":case"registrar_server":i("- "+t+": "+u[t]);break;case"password":i("- "+t+": NOT SHOWN");break;default:i("- "+t+": "+JSON.stringify(u[t]))}},n.configuration_skeleton=function(){var e,t,n={},r=["jssip_id","ws_server_max_reconnection","ws_server_reconnection_timeout","hostport_params","uri","ws_servers","authorization_user","connection_recovery_max_interval","connection_recovery_min_interval","display_name","hack_via_tcp","hack_via_ws","hack_ip_in_contact","instance_id","no_answer_timeout","session_timers","node_websocket_options","password","register_expires","registrar_server","use_preloaded_route","via_core_value","via_host"];for(e in r)t=r[e],n[t]={value:"",writable:!1,configurable:!1};return n.register={value:"",writable:!0,configurable:!1},n}(),n.configuration_check={mandatory:{uri:function(e){var t;return/^sip:/i.test(e)||(e=u.SIP+":"+e),t=g.parse(e),t&&t.user?t:void 0},ws_servers:function(e){var t,n,r;if("string"==typeof e)e=[{ws_uri:e}];else{if(!Array.isArray(e))return;for(n=e.length,t=0;n>t;t++)"string"==typeof e[t]&&(e[t]={ws_uri:e[t]})}if(0===e.length)return!1;for(n=e.length,t=0;n>t;t++){if(!e[t].ws_uri)return void i('ERROR: missing "ws_uri" attribute in ws_servers parameter');if(e[t].weight&&!Number(e[t].weight))return void i('ERROR: "weight" attribute in ws_servers parameter must be a Number');if(r=T.parse(e[t].ws_uri,"absoluteURI"),-1===r)return void i('ERROR: invalid "ws_uri" attribute in ws_servers parameter: '+e[t].ws_uri);if("wss"!==r.scheme&&"ws"!==r.scheme)return void i("ERROR: invalid URI scheme in ws_servers parameter: "+r.scheme);e[t].sip_uri="",e[t].weight||(e[t].weight=0),e[t].status=0,e[t].scheme=r.scheme.toUpperCase()}return e}},optional:{authorization_user:function(e){return-1===T.parse('"'+e+'"',"quoted_string")?void 0:e},connection_recovery_max_interval:function(e){var t;return f.isDecimal(e)&&(t=Number(e),t>0)?t:void 0},connection_recovery_min_interval:function(e){var t;return f.isDecimal(e)&&(t=Number(e),t>0)?t:void 0},display_name:function(e){return-1===T.parse('"'+e+'"',"display_name")?void 0:e},hack_via_tcp:function(e){return"boolean"==typeof e?e:void 0},hack_via_ws:function(e){return"boolean"==typeof e?e:void 0},hack_ip_in_contact:function(e){return"boolean"==typeof e?e:void 0},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===T.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){var t;return f.isDecimal(e)&&(t=Number(e),t>0)?t:void 0},session_timers:function(e){return"boolean"==typeof e?e:void 0},node_websocket_options:function(e){return"object"==typeof e?e:{}},password:function(e){return String(e)},register:function(e){return"boolean"==typeof e?e:void 0},register_expires:function(e){var t;return f.isDecimal(e)&&(t=Number(e),t>0)?t:void 0},registrar_server:function(e){var t;return/^sip:/i.test(e)||(e=u.SIP+":"+e),t=g.parse(e),t?t.user?void 0:t:void 0},use_preloaded_route:function(e){return"boolean"==typeof e?e:void 0}}}},{"./Constants":1,"./Exceptions":5,"./Grammar":6,"./Message":8,"./RTCSession":11,"./Registrator":14,"./Transactions":18,"./Transport":19,"./URI":21,"./Utils":22,debug:29,events:24,rtcninja:34,util:28}],21:[function(e,t){function n(e,t,n,s,l,i){var o,u;if(!n)throw new TypeError('missing or invalid "host" parameter');e=e||r.SIP,this.parameters={},this.headers={};for(o in l)this.setParam(o,l[o]);for(u in i)this.setHeader(u,i[u]);Object.defineProperties(this,{scheme:{get:function(){return e},set:function(t){e=t.toLowerCase()}},user:{get:function(){return t},set:function(e){t=e}},host:{get:function(){return n},set:function(e){n=e.toLowerCase()}},port:{get:function(){return s},set:function(e){s=0===e?e:parseInt(e,10)||null}}})}t.exports=n;var r=e("./Constants"),s=e("./Utils"),l=e("./Grammar");n.prototype={setParam:function(e,t){e&&(this.parameters[e.toLowerCase()]="undefined"==typeof t||null===t?null:t.toString().toLowerCase())},getParam:function(e){return e?this.parameters[e.toLowerCase()]:void 0},hasParam:function(e){return e?this.parameters.hasOwnProperty(e.toLowerCase())&&!0||!1:void 0},deleteParam:function(e){var t;return e=e.toLowerCase(),this.parameters.hasOwnProperty(e)?(t=this.parameters[e],delete this.parameters[e],t):void 0},clearParams:function(){this.parameters={}},setHeader:function(e,t){this.headers[s.headerize(e)]=Array.isArray(t)?t:[t]},getHeader:function(e){return e?this.headers[s.headerize(e)]:void 0},hasHeader:function(e){return e?this.headers.hasOwnProperty(s.headerize(e))&&!0||!1:void 0},deleteHeader:function(e){var t;return e=s.headerize(e),this.headers.hasOwnProperty(e)?(t=this.headers[e],delete this.headers[e],t):void 0},clearHeaders:function(){this.headers={}},clone:function(){return new n(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,l=[];r=this.scheme+":",this.user&&(r+=s.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 in this.headers[e])l.push(e+"="+this.headers[e][n]);return l.length>0&&(r+="?"+l.join("&")),r},toAor:function(e){var t;return t=this.scheme+":",this.user&&(t+=s.escapeUser(this.user)+"@"),t+=this.host,e&&(this.port||0===this.port)&&(t+=":"+this.port),t}},n.parse=function(e){return e=l.parse(e,"SIP_URI"),-1!==e?e:void 0}},{"./Constants":1,"./Grammar":6,"./Utils":22}],22:[function(e,t){var n={};t.exports=n;var r=e("./Constants"),s=e("./URI"),l=e("./Grammar");n.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length},n.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)?!0:!1},n.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},n.isEmpty=function(e){return null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e)?!0:void 0},n.createRandomToken=function(e,t){var n,r,s="";for(t=t||32,n=0;e>n;n++)r=Math.random()*t|0,s+=r.toString(t);return s},n.newTag=function(){return n.createRandomToken(10)},n.newUUID=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,n="x"===e?t:3&t|8;return n.toString(16)});return e},n.hostType=function(e){return e?(e=l.parse(e,"host"),-1!==e?e.host_type:void 0):void 0},n.normalizeTarget=function(e,t){var l,i,o,u;if(e){if(e instanceof s)return e;if("string"==typeof e){switch(i=e.split("@"),i.length){case 1:if(!t)return;o=e,u=t;break;case 2:o=i[0],u=i[1];break;default:o=i.slice(0,i.length-1).join("@"),u=i[i.length-1]}return o=o.replace(/^(sips?|tel):/i,""),/^[\-\.\(\)]*\+?[0-9\-\.\(\)]+$/.test(o)&&(o=o.replace(/[\-\.\(\)]/g,"")),e=r.SIP+":"+n.escapeUser(o)+"@"+u,(l=s.parse(e))?l:void 0}}else;},n.escapeUser=function(e){return encodeURIComponent(decodeURIComponent(e)).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")},n.headerize=function(e){var t,n={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),s="",l=r.length;for(t=0;l>t;t++)0!==t&&(s+="-"),s+=r[t].charAt(0).toUpperCase()+r[t].substring(1);return n[s]&&(s=n[s]),s},n.sipErrorCause=function(e){var t;for(t in r.SIP_ERROR_CAUSES)if(-1!==r.SIP_ERROR_CAUSES[t].indexOf(e))return r.causes[t];return r.causes.SIP_FAILURE_CODE},n.getRandomTestNetIP=function(){function e(e,t){return Math.floor(Math.random()*(t-e+1)+e)}return"192.0.2."+e(1,254)},n.calculateMD5=function(e){function t(e,t){return e<>>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;n>u;)t=(u-u%4)/4,o=u%4*8,i[t]=i[t]|e.charCodeAt(u)<>>29,i}function d(e){var t,n,r="",s="";for(n=0;3>=n;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;nr?t+=String.fromCharCode(r):r>127&&2048>r?(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,A,E=[],R=7,y=12,b=17,I=22,w=5,N=9,D=14,U=20,O=4,x=11,M=16,P=23,L=6,q=10,k=15,H=21;for(e=p(e),E=h(e),v=1732584193,C=4023233417,S=2562383102,A=271733878,f=0;fe?(c(400),!1):void 0}function i(){var e,t,n=h.from_tag,r=h.call_id,s=h.cseq;if(!h.to_tag)if(h.method===m.INVITE){if(d.transactions.ist[h.via_branch])return!1;for(t in d.transactions.ist)if(e=d.transactions.ist[t],e.request.from_tag===n&&e.request.call_id===r&&e.request.cseq===s)return c(482),!1}else{if(d.transactions.nist[h.via_branch])return!1;for(t in d.transactions.nist)if(e=d.transactions.nist[t],e.request.from_tag===n&&e.request.call_id===r&&e.request.cseq===s)return c(482),!1}}function o(){return h.getHeaders("via").length>1?(f("more than one Via header field present in the response, dropping the response"),!1):void 0}function u(){var e=T.str_utf8_length(h.body),t=h.getHeader("content-length");return t>e?(f("message body length is lower than the value in Content-Length header field, dropping the response"),!1):void 0}function a(){for(var e=["from","to","call_id","cseq","via"],t=e.length;t--;)if(!h.hasHeader(e[t]))return f("missing mandatory header field : "+e[t]+", dropping the response"),!1}function c(e){var t,n="SIP/2.0 "+e+" "+m.REASON_PHRASE[e]+"\r\n",r=h.getHeaders("via"),s=r.length,l=0;for(l;s>l;l++)n+="Via: "+r[l]+"\r\n";t=h.getHeader("To"),h.to_tag||(t+=";tag="+T.newTag()),n+="To: "+t+"\r\n",n+="From: "+h.getHeader("From")+"\r\n",n+="Call-ID: "+h.call_id+"\r\n",n+="CSeq: "+h.cseq+" "+h.method+"\r\n",n+="\r\n",p.send(n)}t.exports=n;var h,d,p,f=e("debug")("JsSIP:sanityCheck"),m=e("./Constants"),g=e("./SIPMessage"),T=e("./Utils"),_=[],v=[],C=[];_.push(r),_.push(s),_.push(l),_.push(i),v.push(o),v.push(u),C.push(a)},{"./Constants":1,"./SIPMessage":16,"./Utils":22,debug:29}],24:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function s(e){return"number"==typeof e}function l(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!s(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,s,o,u,a;if(this._events||(this._events={}),"error"===e&&(!this._events.error||l(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],i(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(s=arguments.length,o=new Array(s-1),u=1;s>u;u++)o[u-1]=arguments[u];n.apply(this,o)}else if(l(n)){for(s=arguments.length,o=new Array(s-1),u=1;s>u;u++)o[u-1]=arguments[u];for(a=n.slice(),s=a.length,u=0;s>u;u++)a[u].apply(this,o)}return!0},n.prototype.addListener=function(e,t){var s;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?l(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,l(this._events[e])&&!this._events[e].warned){var s;s=i(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[e].length>s&&(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())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),s||(s=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var s=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,s,i,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this; if(n=this._events[e],i=n.length,s=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(l(n)){for(o=i;o-->0;)if(n[o]===t||n[o].listener&&n[o].listener===t){s=o;break}if(0>s)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],25:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],26:[function(e,t){function n(){if(!i){i=!0;for(var e,t=l.length;t;){e=l,l=[];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){return e}function o(e){var t={};return e.forEach(function(e){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)),y(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(A(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(R(t))return e.stylize(Date.prototype.toString.call(t),"date");if(y(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(A(t)&&(T=" "+RegExp.prototype.toString.call(t)),R(t)&&(T=" "+Date.prototype.toUTCString.call(t)),y(t)&&(T=" "+c(t)),0===i.length&&(!_||0==t.length))return C[0]+T+C[1];if(0>r)return A(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var E;return E=_?h(e,t,r,m,i):i.map(function(n){return d(e,t,r,m,n,_)}),e.seen.pop(),p(E,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;o>i;++i)l.push(U(t,String(i))?d(e,t,n,r,String(i),!0):"");return s.forEach(function(s){s.match(/^\d+$/)||l.push(d(e,t,n,r,s,!0))}),l}function d(e,t,n,r,s,l){var i,o,a;if(a=Object.getOwnPropertyDescriptor(t,s)||{value:t[s]},a.get?o=a.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):a.set&&(o=e.stylize("[Setter]","special")),U(r,s)||(i="["+s+"]"),o||(e.seen.indexOf(a.value)<0?(o=g(n)?u(e,a.value,null):u(e,a.value,n-1),o.indexOf("\n")>-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 A(e){return E(e)&&"[object RegExp]"===w(e)}function E(e){return"object"==typeof e&&null!==e}function R(e){return E(e)&&"[object Date]"===w(e)}function y(e){return E(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 10>e?"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 U(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var O=/%[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(t){return"[Circular]"}default:return e}}),o=r[n];l>n;o=r[++n])i+=g(o)||!E(o)?" "+o:" "+s(o);return i},n.deprecate=function(e,s){function l(){if(!i){if(t.throwDeprecation)throw new Error(s);t.traceDeprecation?console.trace(s):console.error(s),i=!0}return e.apply(this,arguments)}if(S(r.process))return function(){return n.deprecate(e,s).apply(this,arguments)};if(t.noDeprecation===!0)return e;var i=!1;return l};var x,M={};n.debuglog=function(e){if(S(x)&&(x=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!M[e])if(new RegExp("\\b"+e+"\\b","i").test(x)){var r=t.pid;M[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else M[e]=function(){};return M[e]},n.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=f,n.isBoolean=m,n.isNull=g,n.isNullOrUndefined=T,n.isNumber=_,n.isString=v,n.isSymbol=C,n.isUndefined=S,n.isRegExp=A,n.isObject=E,n.isDate=R,n.isError=y,n.isFunction=b,n.isPrimitive=I,n.isBuffer=e("./support/isBuffer");var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",D(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!E(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":27,_process:26,inherits:25}],29:[function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=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?u.removeItem("debug"):u.debug=e}catch(t){}}function o(){var e;try{e=u.debug}catch(t){}return e}n=t.exports=e("./debug"),n.log=l,n.formatArgs=s,n.save=i,n.load=o,n.useColors=r;var u;u="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:window.localStorage,n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(o())},{"./debug":30}],30:[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;r>s;s++)t[s]&&(e=t[s].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function i(){n.enable("")}function o(e){var t,r;for(t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=s,n.coerce=u,n.disable=i,n.enable=l,n.enabled=o,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var a,c=0},{ms:31}],31:[function(e,t){function n(e){var t=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"y":return n*c;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"h":return n*u;case"minutes":case"minute":case"m":return n*o;case"seconds":case"second":case"s":return n*i;case"ms":return n}}}function r(e){return e>=a?Math.round(e/a)+"d":e>=u?Math.round(e/u)+"h":e>=o?Math.round(e/o)+"m":e>=i?Math.round(e/i)+"s":e+"ms"}function s(e){return l(e,a,"day")||l(e,u,"hour")||l(e,o,"minute")||l(e,i,"second")||e+" ms"}function l(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var i=1e3,o=60*i,u=60*o,a=24*u,c=365.25*a;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t["long"]?s(e):r(e)}},{}],32:[function(e,t){(function(n){function r(e){function t(e){return function(){throw new Error("rtcninja: WebRTC not supported, missing "+e+" [browser: "+s.name+" "+s.version+"]")}}if(g&&s.chrome&&m>=32||s.android&&s.chrome&&m>=39||g&&s.opera&&m>=27||s.android&&s.opera&&m>=24||s.android&&s.webkit&&!s.chrome&&m>=37||_.webkitGetUserMedia&&n.webkitRTCPeerConnection)T=!0,o=_.webkitGetUserMedia.bind(_),u=n.webkitRTCPeerConnection,a=n.RTCSessionDescription,c=n.RTCIceCandidate,h=n.MediaStreamTrack,d=function(e,t){return e.src=URL.createObjectURL(t),e},p=!0,f=!1;else if(g&&s.firefox&&m>=22||s.android&&s.firefox&&m>=33||_.mozGetUserMedia&&n.mozRTCPeerConnection)T=!0,o=_.mozGetUserMedia.bind(_),u=n.mozRTCPeerConnection,a=n.mozRTCSessionDescription,c=n.mozRTCIceCandidate,h=n.MediaStreamTrack,d=function(e,t){return e.src=URL.createObjectURL(t),e},p=!1,f=!1;else if(e.plugin&&"function"==typeof e.plugin.isRequired&&e.plugin.isRequired()&&"function"==typeof e.plugin.isInstalled&&e.plugin.isInstalled()){var v=e.plugin["interface"];T=!0,o=v.getUserMedia,u=v.RTCPeerConnection,a=v.RTCSessionDescription,c=v.RTCIceCandidate,h=v.MediaStreamTrack,d=v.attachMediaStream,p=v.canRenegotiate,f=!0}else _.getUserMedia&&n.RTCPeerConnection&&(T=!0,o=_.getUserMedia.bind(_),u=n.RTCPeerConnection,a=n.RTCSessionDescription,c=n.RTCIceCandidate,h=n.MediaStreamTrack,d=n.attachMediaStream||function(e,t){return e.src=URL.createObjectURL(t),e},p=!1,f=!1);return r.hasWebRTC=function(){return T},r.getUserMedia=o?function(e,t,n){l("getUserMedia() | constraints:",e);try{o(e,function(e){l("getUserMedia() | success"),t&&t(e)},function(e){l("getUserMedia() | error:",e),n&&n(e)})}catch(r){i("getUserMedia() | error:",r),n&&n(r)}}: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.RTCPeerConnection=u||t("RTCPeerConnection"),r.RTCSessionDescription=a||t("RTCSessionDescription"),r.RTCIceCandidate=c||t("RTCIceCandidate"),r.MediaStreamTrack=h||t("MediaStreamTrack"),r.attachMediaStream=d||t("attachMediaStream"),r.canRenegotiate=p,r.closeMediaStream=function(e){if(e)if(h&&h.prototype&&h.prototype.stop){l("closeMediaStream() | calling stop() on all the MediaStreamTrack");var t,n,r;if(e.getTracks)for(t=e.getTracks(),n=0,r=t.length;r>n;n++)t[n].stop();else{for(t=e.getAudioTracks(),n=0,r=t.length;r>n;n++)t[n].stop();for(t=e.getVideoTracks(),n=0,r=t.length;r>n;n++)t[n].stop()}}else"function"==typeof e.stop&&(l("closeMediaStream() | calling stop() on the MediaStream"),e.stop())},r.fixPeerConnectionConfig=function(e){Array.isArray(e.iceServers)||(e.iceServers=[]);for(var t=0,n=e.iceServers.length;n>t;t++){var r=e.iceServers[t],s=r.hasOwnProperty("urls"),l=r.hasOwnProperty("url");"object"==typeof r&&(s&&!l?r.url=Array.isArray(r.urls)?r.urls[0]:r.urls:!s&&l&&(r.urls=Array.isArray(r.url)?r.url.slice():r.url),l&&Array.isArray(r.url)&&(r.url=r.url[0]))}},r.fixRTCOfferOptions=function(e){e=e||{},f?(e.offerToReceiveAudio&&(e.mandatory=e.mandatory||{},e.mandatory.OfferToReceiveAudio=!0),e.offerToReceiveVideo&&(e.mandatory=e.mandatory||{},e.mandatory.OfferToReceiveVideo=!0)):(e.mandatory&&e.mandatory.OfferToReceiveAudio&&(e.offerToReceiveAudio=1),e.mandatory&&e.mandatory.OfferToReceiveVideo&&(e.offerToReceiveVideo=1),delete e.mandatory)},r}t.exports=r;var s=e("bowser").browser,l=e("debug")("rtcninja:Adapter"),i=e("debug")("rtcninja:ERROR:Adapter");i.log=console.warn.bind(console);var o=null,u=null,a=null,c=null,h=null,d=null,p=!1,f=!1,m=Number(s.version)||0,g=!(s.mobile&&s.tablet),T=!1,_=n.navigator||{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{bowser:36,debug:29}],33:[function(e,t){function n(e,t){c("new | original pcConfig:",e),s.call(this,e),c("new | processed pcConfig:",this.pcConfig),this.pcConstraints=t,this._localDescription=null,this._signalingState=null,this._iceConnectionState=null,this._iceGatheringState=null,this.timerGatheringTimeout=null,this.timerGatheringTimeoutAfterRelay=null,this.ignoreIceGathering=!1,this.closed=!1,l.call(this),o.call(this)}function r(){return this.closed||this.pc&&"closed"===this.pc.iceConnectionState}function s(e){this.pcConfig=a(!0,e),d.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}function l(){this.pc=new d.RTCPeerConnection(this.pcConfig,this.pcConstraints),i.call(this)}function i(){var e=this,t=this.pc;t.onnegotiationneeded=function(t){r.call(e)||(c("onnegotiationneeded()"),e.onnegotiationneeded&&e.onnegotiationneeded(t))},t.onicecandidate=function(t){if(!r.call(e)&&!e.ignoreIceGathering&&!e.options.iceTransportsNone){var n=t.candidate;if(n){var s=p.REGEXP_RELAY_CANDIDATE.test(n.candidate);if(e.options.iceTransportsRelay&&!s)return;s&&!e.timerGatheringTimeoutAfterRelay&&"number"==typeof e.options.gatheringTimeoutAfterRelay&&(c("onicecandidate() | first relay candidate found, ending gathering in %d ms",e.options.gatheringTimeoutAfterRelay),e.timerGatheringTimeoutAfterRelay=setTimeout(function(){r.call(e)||(c("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));var l=new d.RTCIceCandidate({sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,candidate:n.candidate});null===f.normalizeCandidate&&(p.REGEXP_NORMALIZED_CANDIDATE.test(n.candidate)?f.normalizeCandidate=!1:(c('onicecandidate() | normalizing ICE candidates syntax (remove "a=" and "\\r\\n")'),f.normalizeCandidate=!0)),f.normalizeCandidate&&(l.candidate=n.candidate.replace(p.REGEXP_FIX_CANDIDATE,"")),c("onicecandidate() | m%d(%s) %s",l.sdpMLineIndex,l.sdpMid||"no mid",l.candidate),e.onicecandidate&&e.onicecandidate(t,l)}else c("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){r.call(e)||(c("onaddstream() | stream:",t.stream),e.onaddstream&&e.onaddstream(t,t.stream))},t.onremovestream=function(t){r.call(e)||(c("onremovestream() | stream:",t.stream),e.onremovestream&&e.onremovestream(t,t.stream))},t.ondatachannel=function(t){r.call(e)||(c("ondatachannel()"),e.ondatachannel&&e.ondatachannel(t,t.channel))},t.onsignalingstatechange=function(n){t.signalingState!==e._signalingState&&(c("onsignalingstatechange() | signalingState: %s",t.signalingState),e._signalingState=t.signalingState,e.onsignalingstatechange&&e.onsignalingstatechange(n,t.signalingState))},t.oniceconnectionstatechange=function(n){t.iceConnectionState!==e._iceConnectionState&&(c("oniceconnectionstatechange() | iceConnectionState: %s",t.iceConnectionState),e._iceConnectionState=t.iceConnectionState,e.oniceconnectionstatechange&&e.oniceconnectionstatechange(n,t.iceConnectionState))},t.onicegatheringstatechange=function(n){r.call(e)||t.iceGatheringState!==e._iceGatheringState&&(c("onicegatheringstatechange() | iceGatheringState: %s",t.iceGatheringState),e._iceGatheringState=t.iceGatheringState,e.onicegatheringstatechange&&e.onicegatheringstatechange(n,t.iceGatheringState))},t.onidentityresult=function(t){r.call(e)||(c("onidentityresult()"),e.onidentityresult&&e.onidentityresult(t))},t.onpeeridentity=function(t){r.call(e)||(c("onpeeridentity()"),e.onpeeridentity&&e.onpeeridentity(t))},t.onidpassertionerror=function(t){r.call(e)||(c("onidpassertionerror()"),e.onidpassertionerror&&e.onidpassertionerror(t))},t.onidpvalidationerror=function(t){r.call(e)||(c("onidpvalidationerror()"),e.onidpvalidationerror&&e.onidpvalidationerror(t))}}function o(){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}}})}function u(){var e=this.pc,t=this.options,n=null;return e.localDescription?(t.iceTransportsRelay?n=e.localDescription.sdp.replace(p.REGEXP_SDP_NON_RELAY_CANDIDATES,""):t.iceTransportsNone&&(n=e.localDescription.sdp.replace(p.REGEXP_SDP_CANDIDATES,"")),this._localDescription=new d.RTCSessionDescription({type:e.localDescription.type,sdp:n||e.localDescription.sdp}),this._localDescription):(this._localDescription=null,null)}t.exports=n;var a=e("merge"),c=e("debug")("rtcninja:Connection"),h=e("debug")("rtcninja:ERROR:Connection");h.log=console.warn.bind(console);var d=e("./Adapter"),p={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)},f={normalizeCandidate:null};n.prototype.createOffer=function(e,t,n){c("createOffer()");var s=this;d.fixRTCOfferOptions(n),this.pc.createOffer(function(t){r.call(s)||(c("createOffer() | success"),e&&e(t))},function(e){r.call(s)||(h("createOffer() | error:",e),t&&t(e))},n)},n.prototype.createAnswer=function(e,t,n){c("createAnswer()");var s=this;this.pc.createAnswer(function(t){r.call(s)||(c("createAnswer() | success"),e&&e(t))},function(e){r.call(s)||(h("createAnswer() | error:",e),t&&t(e))},n)},n.prototype.setLocalDescription=function(e,t,n){function s(){"number"==typeof l.options.gatheringTimeout&&"complete"!==l.pc.iceGatheringState&&(c("setLocalDescription() | ending gathering in %d ms (gatheringTimeout option)",l.options.gatheringTimeout),l.timerGatheringTimeout=setTimeout(function(){r.call(l)||(c("forced end of candidates after gatheringTimeout timeout"),delete l.timerGatheringTimeout,clearTimeout(l.timerGatheringTimeoutAfterRelay),delete l.timerGatheringTimeoutAfterRelay,l.ignoreIceGathering=!0,l.onicecandidate&&l.onicecandidate({candidate:null},null))},l.options.gatheringTimeout))}c("setLocalDescription()");var l=this;this.pc.setLocalDescription(e,function(){r.call(l)||(c("setLocalDescription() | success"),clearTimeout(l.timerGatheringTimeout),delete l.timerGatheringTimeout,clearTimeout(l.timerGatheringTimeoutAfterRelay),delete l.timerGatheringTimeoutAfterRelay,s(),t&&t())},function(e){r.call(l)||(h("setLocalDescription() | error:",e),n&&n(e))}),this.ignoreIceGathering=!1},n.prototype.setRemoteDescription=function(e,t,n){c("setRemoteDescription()");var s=this;this.pc.setRemoteDescription(e,function(){r.call(s)||(c("setRemoteDescription() | success"),t&&t())},function(e){r.call(s)||(h("setRemoteDescription() | error:",e),n&&n(e))})},n.prototype.updateIce=function(e){c("updateIce() | pcConfig:",e),s.call(this,e),this.pc.updateIce(this.pcConfig),this.ignoreIceGathering=!1},n.prototype.addIceCandidate=function(e,t,n){c("addIceCandidate() | candidate:",e);var s=this;this.pc.addIceCandidate(e,function(){r.call(s)||(c("addIceCandidate() | success"),t&&t())},function(e){r.call(s)||(h("addIceCandidate() | error:",e),n&&n(e))})},n.prototype.getConfiguration=function(){return c("getConfiguration()"),this.pc.getConfiguration()},n.prototype.getLocalStreams=function(){return c("getLocalStreams()"),this.pc.getLocalStreams()},n.prototype.getRemoteStreams=function(){return c("getRemoteStreams()"),this.pc.getRemoteStreams()},n.getStreamById=function(e){c("getStreamById() | streamId:",e),this.pc.getStreamById(e)},n.prototype.addStream=function(e){c("addStream() | stream:",e),this.pc.addStream(e)},n.prototype.removeStream=function(e){c("removeStream() | stream:",e),this.pc.removeStream(e)},n.prototype.close=function(){c("close()"),this.closed=!0,clearTimeout(this.timerGatheringTimeout),delete this.timerGatheringTimeout,clearTimeout(this.timerGatheringTimeoutAfterRelay),delete this.timerGatheringTimeoutAfterRelay,this.pc.close()},n.prototype.createDataChannel=function(){return c("createDataChannel()"),this.pc.createDataChannel.apply(this.pc,arguments)},n.prototype.createDTMFSender=function(e){return c("createDTMFSender()"),this.pc.createDTMFSender(e)},n.prototype.getStats=function(){return c("getStats()"),this.pc.getStats.apply(this.pc,arguments)},n.prototype.setIdentityProvider=function(){return c("setIdentityProvider()"),this.pc.setIdentityProvider.apply(this.pc,arguments)},n.prototype.getIdentityAssertion=function(){return c("getIdentityAssertion()"),this.pc.getIdentityAssertion()},n.prototype.reset=function(){c("reset()");var e=this.pc;e.onnegotiationneeded=null,e.onicecandidate=null,e.onaddstream=null,e.onremovestream=null,e.ondatachannel=null,e.onsignalingstatechange=null,e.oniceconnectionstatechange=null,e.onicegatheringstatechange=null,e.onidentityresult=null,e.onpeeridentity=null,e.onidpassertionerror=null,e.onidpvalidationerror=null,clearTimeout(this.timerGatheringTimeout),delete this.timerGatheringTimeout,clearTimeout(this.timerGatheringTimeoutAfterRelay),delete this.timerGatheringTimeoutAfterRelay,e.close(),l.call(this)}},{"./Adapter":32,debug:29,merge:37}],34:[function(e,t){function n(e){var t=o(e||{});return a=!0,n.Connection=u,n.getUserMedia=t.getUserMedia,n.RTCSessionDescription=t.RTCSessionDescription,n.RTCIceCandidate=t.RTCIceCandidate,n.MediaStreamTrack=t.MediaStreamTrack,n.attachMediaStream=t.attachMediaStream,n.closeMediaStream=t.closeMediaStream,n.canRenegotiate=t.canRenegotiate,t.hasWebRTC()?(s("WebRTC supported"),!0):(l("WebRTC not supported"),!1)}t.exports=n;var r=e("bowser").browser,s=e("debug")("rtcninja"),l=e("debug")("rtcninja:ERROR");l.log=console.warn.bind(console);var i=e("./version"),o=e("./Adapter"),u=e("./Connection"),a=!1;s("version %s",i),s("detected browser: %s %s [mobile:%s, tablet:%s, android:%s, ios:%s]",r.name,r.version,!!r.mobile,!!r.tablet,!!r.android,!!r.ios),n.hasWebRTC=function(){return a||n(),o.hasWebRTC()},Object.defineProperty(n,"version",{get:function(){return i}}),Object.defineProperty(n,"called",{get:function(){return a}}),n.debug=e("debug"),n.browser=r},{"./Adapter":32,"./Connection":33,"./version":35,bowser:36,debug:29}],35:[function(e,t){t.exports=e("../package.json").version},{"../package.json":38}],36:[function(t,n){!function(t,r){"undefined"!=typeof n&&n.exports?n.exports.browser=r():"function"==typeof e&&e.amd?e(r):this[t]=r()}("bowser",function(){function e(e){function n(t){var n=e.match(t);return n&&n.length>1&&n[1]||""}var r,s=n(/(ipod|iphone|ipad)/i).toLowerCase(),l=/like android/i.test(e),i=!l&&/android/i.test(e),o=n(/version\/(\d+(\.\d+)?)/i),u=/tablet/i.test(e),a=!u&&/[^-]mobi/i.test(e);/opera|opr/i.test(e)?r={name:"Opera",opera:t,version:o||n(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/windows phone/i.test(e)?r={name:"Windows Phone",windowsphone:t,msie:t,version:n(/iemobile\/(\d+(\.\d+)?)/i)}:/msie|trident/i.test(e)?r={name:"Internet Explorer",msie:t,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:/chrome|crios|crmo/i.test(e)?r={name:"Chrome",chrome:t,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:s?(r={name:"iphone"==s?"iPhone":"ipad"==s?"iPad":"iPod"},o&&(r.version=o)):/sailfish/i.test(e)?r={name:"Sailfish",sailfish:t,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?r={name:"SeaMonkey",seamonkey:t,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(e)?(r={name:"Firefox",firefox:t,version:n(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(r.firefoxos=t)):/silk/i.test(e)?r={name:"Amazon Silk",silk:t,version:n(/silk\/(\d+(\.\d+)?)/i)}:i?r={name:"Android",version:o}:/phantom/i.test(e)?r={name:"PhantomJS",phantom:t,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?r={name:"BlackBerry",blackberry:t,version:o||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:/(web|hpw)os/i.test(e)?(r={name:"WebOS",webos:t,version:o||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(r.touchpad=t)):r=/bada/i.test(e)?{name:"Bada",bada:t,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:/tizen/i.test(e)?{name:"Tizen",tizen:t,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||o}:/safari/i.test(e)?{name:"Safari",safari:t,version:o}:{},/(apple)?webkit/i.test(e)?(r.name=r.name||"Webkit",r.webkit=t,!r.version&&o&&(r.version=o)):!r.opera&&/gecko\//i.test(e)&&(r.name=r.name||"Gecko",r.gecko=t,r.version=r.version||n(/gecko\/(\d+(\.\d+)?)/i)),i||r.silk?r.android=t:s&&(r[s]=t,r.ios=t);var c="";s?(c=n(/os (\d+([_\s]\d+)*) like mac os x/i),c=c.replace(/[_\s]/g,".")):i?c=n(/android[ \/-](\d+(\.\d+)*)/i):r.windowsphone?c=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):r.webos?c=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):r.blackberry?c=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):r.bada?c=n(/bada\/(\d+(\.\d+)*)/i):r.tizen&&(c=n(/tizen[\/\s](\d+(\.\d+)*)/i)),c&&(r.osversion=c);var h=c.split(".")[0];return u||"ipad"==s||i&&(3==h||4==h&&!a)||r.silk?r.tablet=t:(a||"iphone"==s||"ipod"==s||i||r.blackberry||r.webos||r.bada)&&(r.mobile=t),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.blackberry&&r.version>=10.1?r.a=t: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.c=t:r.x=t,r}var t=!0,n=e("undefined"!=typeof navigator?navigator.userAgent:"");return n._detect=e,n})},{}],37:[function(e,t){!function(e){function n(e,t){if("object"!==s(e))return t;for(var r in t)e[r]="object"===s(e[r])&&"object"===s(t[r])?n(e[r],t[r]):t[r];return e}function r(e,t,r){var i=r[0],o=r.length;(e||"object"!==s(i))&&(i={});for(var u=0;o>u;++u){var a=r[u],c=s(a);if("object"===c)for(var h in a){var d=e?l.clone(a[h]):a[h];i[h]=t?n(i[h],d):d}}return i}function s(e){return{}.toString.call(e).slice(8,-1).toLowerCase()}var l=function(e){return r(e===!0,!1,arguments)},i="merge";l.recursive=function(e){return r(e===!0,!0,arguments)},l.clone=function(e){var t,n,r=e,i=s(e);if("array"===i)for(r=[],n=e.length,t=0;n>t;++t)r[t]=l.clone(e[t]);else if("object"===i){r={};for(t in e)r[t]=l.clone(e[t])}return r},e?t.exports=l:window[i]=l}("object"==typeof t&&t&&"object"==typeof t.exports&&t.exports)},{}],38:[function(e,t){t.exports={name:"rtcninja",version:"0.3.3",description:"WebRTC API wrapper to deal with different browsers",author:{name:"Iñaki Baz Castillo",email:"inaki.baz@eface2face.com",url:"http://eface2face.com"},license:"ISC",main:"lib/rtcninja.js",homepage:"https://github.com/eface2face/rtcninja.js",repository:{type:"git",url:"https://github.com/eface2face/rtcninja.js.git"},keywords:["webrtc"],engines:{node:">=0.10.32"},dependencies:{bowser:"^0.7.2",debug:"^2.1.1",merge:"^1.2.0"},devDependencies:{browserify:"^8.1.1",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-expect-file":"0.0.7","gulp-filelog":"^0.4.1","gulp-header":"^1.2.2","gulp-jshint":"^1.9.0","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0","jshint-stylish":"^1.0.0","vinyl-transform":"^1.0.0"},readme:"# rtcninja.js\n\nWebRTC API wrapper to deal with different browsers.\n\n\n## Installation\n\n* With **npm**:\n\n```bash\n$ npm install rtcninja\n```\n\n* With **bower**:\n\n```bash\n$ bower install rtcninja\n```\n\n## Usage in Node\n\n```javascript\nvar rtcninja = require('rtcninja');\n```\n\n\n## Browserified library\n\nTake a browserified version of the library from the `dist/` folder:\n\n* `dist/rtcninja-X.Y.Z.js`: The uncompressed version.\n* `dist/rtcninja-X.Y.Z.min.js`: The compressed production-ready version.\n* `dist/rtcninja.js`: A copy of the uncompressed version.\n* `dist/rtcninja.min.js`: A copy of the compressed version.\n\nThey expose the global `window.rtcninja` module.\n\n```html\n\n```\n\n\n## Usage Example\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## 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## Author\n\nIñaki Baz Castillo at [eFace2Face](http://eface2face.com).\n\n\n## License\n\nISC.\n",readmeFilename:"README.md",gitHead:"a3a0605db6881265d4a8cd85498fd85a8fd5e35c",bugs:{url:"https://github.com/eface2face/rtcninja.js/issues"},_id:"rtcninja@0.3.3",scripts:{},_shasum:"12fa526217ddbbbf49a1365c84c3ab544d398156",_from:"rtcninja@>=0.3.3 <0.4.0"} -},{}],39:[function(e,t){var n=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\-]*)\/(\d*)(?:\s*\/(\S*))?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":"rtpmap:%d %s/%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:(\w*)/,format:"mid:%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*))?(?: generation (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","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",null!=e.generation&&(t+=" generation %d"),t}},{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"},{name:"msidSemantic",reg:/^msid-semantic: (\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)/},{push:"invalid",names:["value"]}]};Object.keys(n).forEach(function(e){var t=n[e];t.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})},{}],40:[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":41,"./writer":42}],41:[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=s)return e;var r=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}})},l=function(e,t,n){var r=t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format,l=[e+"="+r];if(t.names)for(var i=0;i=0.8.0"},dependencies:{debug:"~2.1.0",nan:"~1.0.0","typedarray-to-buffer":"~3.0.0"},devDependencies:{"buffer-equal":"0.0.1",faucet:"0.0.1",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-jshint":"^1.9.0","jshint-stylish":"^1.0.0",tape:"^3.0.0"},config:{verbose:!1},scripts:{install:"(node-gyp rebuild 2> builderror.log) || (exit 0)",test:"faucet test/unit",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",gitHead:"cda940b883aa884906ac13158fe514229a67f426",bugs:{url:"https://github.com/theturtle32/WebSocket-Node/issues"},_id:"websocket@1.0.17",_shasum:"8a572afc6ec120eb41473ca517d07d932f7b6a1c",_from:"websocket@>=1.0.17 <2.0.0",_npmVersion:"1.4.28",_npmUser:{name:"theturtle32",email:"brian@worlize.com"},maintainers:[{name:"theturtle32",email:"brian@worlize.com"}],dist:{shasum:"8a572afc6ec120eb41473ca517d07d932f7b6a1c",tarball:"http://registry.npmjs.org/websocket/-/websocket-1.0.17.tgz"},_resolved:"https://registry.npmjs.org/websocket/-/websocket-1.0.17.tgz",readme:"ERROR: No README data found!"}},{}],46:[function(e,t){t.exports={name:"jssip",title:"JsSIP",description:"the Javascript SIP library",version:"0.6.13-pre",homepage:"http://jssip.net",author:"José Luis Millán (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.1.1",rtcninja:"^0.3.3","sdp-transform":"~1.1.0",websocket:"^1.0.17"},devDependencies:{browserify:"^8.1.1",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-expect-file":"0.0.7","gulp-filelog":"^0.4.1","gulp-header":"^1.2.2","gulp-jshint":"^1.9.0","gulp-nodeunit-runner":"^0.2.2","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0","gulp-util":"^3.0.2","jshint-stylish":"^1.0.0",pegjs:"0.7.0","vinyl-transform":"^1.0.0"},scripts:{test:"gulp test"}}},{}]},{},[7])(7)}); \ No newline at end of file +},{}],39:[function(e,t){var n=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\-]*)\/(\d*)(?:\s*\/(\S*))?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":"rtpmap:%d %s/%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:(\w*)/,format:"mid:%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*))?(?: generation (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","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",null!=e.generation&&(t+=" generation %d"),t}},{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"},{name:"msidSemantic",reg:/^msid-semantic: (\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)/},{push:"invalid",names:["value"]}]};Object.keys(n).forEach(function(e){var t=n[e];t.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})},{}],40:[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":41,"./writer":42}],41:[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=s)return e;var r=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}})},l=function(e,t,n){var r=t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format,l=[e+"="+r];if(t.names)for(var i=0;i=0.8.0"},dependencies:{debug:"~2.1.0",nan:"~1.0.0","typedarray-to-buffer":"~3.0.0"},devDependencies:{"buffer-equal":"0.0.1",faucet:"0.0.1",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-jshint":"^1.9.0","jshint-stylish":"^1.0.0",tape:"^3.0.0"},config:{verbose:!1},scripts:{install:"(node-gyp rebuild 2> builderror.log) || (exit 0)",test:"faucet test/unit",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",gitHead:"cda940b883aa884906ac13158fe514229a67f426",bugs:{url:"https://github.com/theturtle32/WebSocket-Node/issues"},_id:"websocket@1.0.17",_shasum:"8a572afc6ec120eb41473ca517d07d932f7b6a1c",_from:"websocket@>=1.0.17 <2.0.0",_npmVersion:"1.4.28",_npmUser:{name:"theturtle32",email:"brian@worlize.com"},maintainers:[{name:"theturtle32",email:"brian@worlize.com"}],dist:{shasum:"8a572afc6ec120eb41473ca517d07d932f7b6a1c",tarball:"http://registry.npmjs.org/websocket/-/websocket-1.0.17.tgz"},_resolved:"https://registry.npmjs.org/websocket/-/websocket-1.0.17.tgz",readme:"ERROR: No README data found!"}},{}],46:[function(e,t){t.exports={name:"jssip",title:"JsSIP",description:"the Javascript SIP library",version:"0.6.13",homepage:"http://jssip.net",author:"José Luis Millán (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.1.1",rtcninja:"^0.3.3","sdp-transform":"~1.1.0",websocket:"^1.0.17"},devDependencies:{browserify:"^8.1.1",gulp:"git+https://github.com/gulpjs/gulp.git#4.0","gulp-expect-file":"0.0.7","gulp-filelog":"^0.4.1","gulp-header":"^1.2.2","gulp-jshint":"^1.9.0","gulp-nodeunit-runner":"^0.2.2","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0","gulp-util":"^3.0.2","jshint-stylish":"^1.0.0",pegjs:"0.7.0","vinyl-transform":"^1.0.0"},scripts:{test:"gulp test"}}},{}]},{},[7])(7)}); \ No newline at end of file diff --git a/dist/jssip.js b/dist/jssip.js index 285c9b3be..afe471557 100644 --- a/dist/jssip.js +++ b/dist/jssip.js @@ -1,5 +1,5 @@ /* - * JsSIP.js 0.6.13-pre + * JsSIP.js 0.6.13 * the Javascript SIP library * Copyright 2012-2015 José Luis Millán (https://github.com/jmillan) * Homepage: http://jssip.net @@ -23850,7 +23850,7 @@ module.exports={ "name": "jssip", "title": "JsSIP", "description": "the Javascript SIP library", - "version": "0.6.13-pre", + "version": "0.6.13", "homepage": "http://jssip.net", "author": "José Luis Millán (https://github.com/jmillan)", "contributors": [ diff --git a/package.json b/package.json index 96951972a..818d3f46f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jssip", "title": "JsSIP", "description": "the Javascript SIP library", - "version": "0.6.13-pre", + "version": "0.6.13", "homepage": "http://jssip.net", "author": "José Luis Millán (https://github.com/jmillan)", "contributors": [