diff --git a/Makefile.am b/Makefile.am index 96e9181646..8f681a58e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,7 +57,11 @@ MY_DEFAULT_ARGS= --build=$(build) --host=$(host) --target=$(target) --prefix="$( if test "$$target" = "install"; then \ $(MAKE) $(AM_MAKEFLAGS) core_install && cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ; \ else \ - $(MAKE) $(AM_MAKEFLAGS) core && cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\ + if test "$$target" = "clean"; then \ + cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\ + else \ + $(MAKE) $(AM_MAKEFLAGS) core && cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\ + fi; \ fi; \ fi; fi diff --git a/build/Makefile.centos5 b/build/Makefile.centos5 index 79a2485986..cddd8f29ee 100644 --- a/build/Makefile.centos5 +++ b/build/Makefile.centos5 @@ -11,10 +11,10 @@ FSPREFIX=/usr/local/freeswitch PREFIX=/usr/local/freeswitch DOWNLOAD=http://files.freeswitch.org/downloads/libs JPEG=v8d -OPENSSL=1.0.1j +OPENSSL=1.0.1l SQLITE=autoconf-3080403 PCRE=8.35 -CURL=7.35.0 +CURL=7.40.0 SPEEX=1.2rc1 LIBEDIT=20140618-3.1 LDNS=1.6.17 @@ -76,7 +76,7 @@ curl: curl-$(CURL)/.done curl-$(CURL)/.done: curl-$(CURL) curl-$(CURL): (test -d $@) || (wget -4 -O $@.tar.gz $(DOWNLOAD)/$@.tar.gz && tar zxfv $@.tar.gz) - (cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install && touch .done) + (cd $@ && ./configure LDFLAGS='-L$(PREFIX)/lib -Wl,-rpath=$(PREFIX)/lib' CFLAGS='-I$(PREFIX)/include' --prefix=$(PREFIX) && make && sudo make install && touch .done) speex: speex-$(SPEEX)/.done speex-$(SPEEX)/.done: speex-$(SPEEX) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index f2b9ecab1c..582c3192da 100644 --- a/build/Makefile.centos6 +++ b/build/Makefile.centos6 @@ -7,7 +7,7 @@ # # RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel -DEBS=git build-essential automake autoconf libtool wget python uuid-dev zlib1g-dev libjpeg-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev libtool-bin pkg-config +DEBS=git build-essential automake autoconf 'libtool-bin|libtool' wget python uuid-dev zlib1g-dev 'libjpeg8-dev|libjpeg62-turbo-dev' libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config freeswitch: deps has-git freeswitch.git/Makefile cd freeswitch.git && make diff --git a/build/next-release.txt b/build/next-release.txt index 6ee81aba98..04e0d3f14f 100644 --- a/build/next-release.txt +++ b/build/next-release.txt @@ -1 +1 @@ -1.4.16 +1.4.17 diff --git a/conf/insideout/sip_profiles/internal-ipv6.xml b/conf/insideout/sip_profiles/internal-ipv6.xml index 525554f4b8..0ae93cfc82 100644 --- a/conf/insideout/sip_profiles/internal-ipv6.xml +++ b/conf/insideout/sip_profiles/internal-ipv6.xml @@ -5,6 +5,7 @@ + diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml index 666f7de5ab..158d5974a7 100644 --- a/conf/insideout/sip_profiles/internal.xml +++ b/conf/insideout/sip_profiles/internal.xml @@ -36,6 +36,8 @@ bypass media after an attended transfer. --> + + diff --git a/conf/softphone/freeswitch.xml b/conf/softphone/freeswitch.xml index 3d5faa240c..311ba4fcc2 100644 --- a/conf/softphone/freeswitch.xml +++ b/conf/softphone/freeswitch.xml @@ -129,6 +129,8 @@ + + diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml index 092372d68c..1940561ec0 100644 --- a/conf/vanilla/autoload_configs/modules.conf.xml +++ b/conf/vanilla/autoload_configs/modules.conf.xml @@ -110,7 +110,7 @@ - + diff --git a/conf/vanilla/autoload_configs/spandsp.conf.xml b/conf/vanilla/autoload_configs/spandsp.conf.xml index 2653c40bb8..2471ca52ce 100644 --- a/conf/vanilla/autoload_configs/spandsp.conf.xml +++ b/conf/vanilla/autoload_configs/spandsp.conf.xml @@ -34,6 +34,9 @@ + + + diff --git a/conf/vanilla/autoload_configs/switch.conf.xml b/conf/vanilla/autoload_configs/switch.conf.xml index 102a2a7f1e..8e66e7159f 100644 --- a/conf/vanilla/autoload_configs/switch.conf.xml +++ b/conf/vanilla/autoload_configs/switch.conf.xml @@ -152,7 +152,7 @@ - + - + diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml index 62b9708e8b..98efa2ffbb 100644 --- a/conf/vanilla/sip_profiles/internal-ipv6.xml +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml @@ -5,6 +5,7 @@ + diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index a848cb9583..1788780601 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -42,7 +42,10 @@ bypass media after an attended transfer. --> + + + diff --git a/configure.ac b/configure.ac index 884a5b48fb..288a0db079 100644 --- a/configure.ac +++ b/configure.ac @@ -375,6 +375,7 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC) + APR_ADDTO(SWITCH_AM_CFLAGS, -Werror) elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC) diff --git a/debian/rules b/debian/rules index 6bfd911f4d..d85cf4e8f8 100755 --- a/debian/rules +++ b/debian/rules @@ -63,7 +63,7 @@ override_dh_auto_clean: .stamp-bootstrap: @$(call show_vars) - ./bootstrap.sh -j + [ -f ./bootstrap.sh ] && ./bootstrap.sh -j || ./rebootstrap.sh -j touch $@ .stamp-configure: .stamp-bootstrap diff --git a/docs/AUTHORS b/docs/AUTHORS index 67925ca8c6..41fb3da3f7 100644 --- a/docs/AUTHORS +++ b/docs/AUTHORS @@ -18,6 +18,8 @@ that much better: Brian K. West - For countless hours of work on BSD and Mac support, finding countless bugs, and moral support. Xcode project files. + Ken Rice - - Stable Branch Maintainer, xmlcdr, sofia improvements, load testing, 1 liners here and there. + Travis Cross - git migration, Debian packaging, ZRTP integration, mod_prefix, and many other improvements Joshua Colp - For his help making mod_exosip possible (which we are now getting rid of but oh well), and for just being a swell guy! Michal "cypromis" Bielicki (michal.bielicki AT voiceworks.pl) - Solaris porting, and autotools enhancements, debian, rpm and solaris packaging. @@ -27,8 +29,6 @@ that much better: Stefan Knoblich - Sofia TLS, various patches and support. Thanks. Justin Unger - Lots of help with patches and SIP testing. Thanks! Paul D. Tinsley - Various patches and support. - Ken Rice - - xmlcdr, sofia improvements, load testing, 1 liners here and there. - Travis Cross - git migration, Debian packaging, ZRTP integration, mod_prefix, and many other improvements Neal Horman - conference improvements, switch_ivr menu additions and other tweaks. Johny Kadarisman - mod_python fixups. Michael Murdock - testing, documentation, bug finding and usability enhancements. diff --git a/docs/phrase/phrase_es.xml b/docs/phrase/phrase_es.xml index 518d7fce64..dd62e6fef3 100644 --- a/docs/phrase/phrase_es.xml +++ b/docs/phrase/phrase_es.xml @@ -222,6 +222,7 @@ I will translate them anyways + diff --git a/docs/phrase/phrase_es_ES.xml b/docs/phrase/phrase_es_ES.xml index 9a7521a065..a3f937f33c 100644 --- a/docs/phrase/phrase_es_ES.xml +++ b/docs/phrase/phrase_es_ES.xml @@ -171,6 +171,7 @@ + diff --git a/docs/phrase/phrase_es_MX.xml b/docs/phrase/phrase_es_MX.xml index edabd9f45c..182511d808 100644 --- a/docs/phrase/phrase_es_MX.xml +++ b/docs/phrase/phrase_es_MX.xml @@ -170,6 +170,7 @@ + diff --git a/freeswitch.spec b/freeswitch.spec index 67ceb70562..7f8bda2a76 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -11,7 +11,7 @@ # # This file is part of: # FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -# Copyright (C) 2005-2014, Anthony Minessale II +# Copyright (C) 2005-2015, Anthony Minessale II # # This file and all modifications and additions to the pristine package are under the same license as the package itself. # @@ -45,8 +45,8 @@ %{?with_timerfd:%define build_timerfd 1 } %{?with_mod_esl:%define build_mod_esl 1 } -%define version %{VERSION_NUMBER} -%define release %{BUILD_NUMBER} +%define version 1.5.16 +%define release 1 ###################################################################################################################### # @@ -116,7 +116,7 @@ Vendor: http://www.freeswitch.org/ ###################################################################################################################### Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 Source1: http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz -Source2: http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2 +Source2: http://files.freeswitch.org/downloads/libs/flite-2.0.0-release.tar.bz2 Source3: http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz Source5: http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz diff --git a/html5/verto/demo/js/verto-min.js b/html5/verto/demo/js/verto-min.js index 4718b16a03..f8acd1549e 100644 --- a/html5/verto/demo/js/verto-min.js +++ b/html5/verto/demo/js/verto-min.js @@ -60,7 +60,7 @@ return{addAnswerSDP:function(sdp,cbSuccess,cbError){peer.setRemoteDescription(ne var video_constraints={mandatory:{},optional:[]};function getUserMedia(options){var n=navigator,media;n.getMedia=n.webkitGetUserMedia||n.mozGetUserMedia;n.getMedia(options.constraints||{audio:true,video:video_constraints},streaming,options.onerror||function(e){console.error(e);});function streaming(stream){var video=options.video;if(video){video[moz?'mozSrcObject':'src']=moz?stream:window.webkitURL.createObjectURL(stream);} if(options.onsuccess){options.onsuccess(stream);} media=stream;} -return media;}})(jQuery);(function($){$.JsonRpcClient=function(options){var self=this;this.options=$.extend({ajaxUrl:null,socketUrl:null,onmessage:null,login:null,passwd:null,sessid:null,getSocket:function(onmessage_cb){return self._getSocket(onmessage_cb);}},options);self.ws_cnt=0;this.wsOnMessage=function(event){self._wsOnMessage(event);};};$.JsonRpcClient.prototype._ws_socket=null;$.JsonRpcClient.prototype._ws_callbacks={};$.JsonRpcClient.prototype._current_id=1;$.JsonRpcClient.prototype.call=function(method,params,success_cb,error_cb){if(!params){params={};} +return media;}})(jQuery);(function($){$.JsonRpcClient=function(options){var self=this;this.options=$.extend({ajaxUrl:null,socketUrl:null,onmessage:null,login:null,passwd:null,sessid:null,loginParams:null,getSocket:function(onmessage_cb){return self._getSocket(onmessage_cb);}},options);self.ws_cnt=0;this.wsOnMessage=function(event){self._wsOnMessage(event);};};$.JsonRpcClient.prototype._ws_socket=null;$.JsonRpcClient.prototype._ws_callbacks={};$.JsonRpcClient.prototype._current_id=1;$.JsonRpcClient.prototype.call=function(method,params,success_cb,error_cb){if(!params){params={};} if(this.options.sessid){params.sessid=this.options.sessid;} var request={jsonrpc:'2.0',method:method,params:params,id:this._current_id++};if(!success_cb){success_cb=function(e){console.log("Success: ",e);};} if(!error_cb){error_cb=function(e){console.log("Error: ",e);};} @@ -70,7 +70,7 @@ $.ajax({type:'POST',url:this.options.ajaxUrl,data:$.toJSON(request),dataType:'js var request={jsonrpc:'2.0',method:method,params:params};var socket=this.options.getSocket(this.wsOnMessage);if(socket!==null){this._wsCall(socket,request);return;} if(this.options.ajaxUrl===null){throw"$.JsonRpcClient.notify used with no websocket and no http endpoint.";} $.ajax({type:'POST',url:this.options.ajaxUrl,data:$.toJSON(request),dataType:'json',cache:false});};$.JsonRpcClient.prototype.batch=function(callback,all_done_cb,error_cb){var batch=new $.JsonRpcClient._batchObject(this,all_done_cb,error_cb);callback(batch);batch._execute();};$.JsonRpcClient.prototype.socketReady=function(){if(this._ws_socket===null||this._ws_socket.readyState>1){return false;} -return true;};$.JsonRpcClient.prototype.closeSocket=function(){if(self.socketReady()){this._ws_socket.onclose=function(w){console.log("Closing Socket");};this._ws_socket.close();}};$.JsonRpcClient.prototype.loginData=function(params){self.options.login=params.login;self.options.passwd=params.passwd;};$.JsonRpcClient.prototype.connectSocket=function(onmessage_cb){var self=this;if(self.to){clearTimeout(self.to);} +return true;};$.JsonRpcClient.prototype.closeSocket=function(){var self=this;if(self.socketReady()){self._ws_socket.onclose=function(w){console.log("Closing Socket");};self._ws_socket.close();}};$.JsonRpcClient.prototype.loginData=function(params){var self=this;self.options.login=params.login;self.options.passwd=params.passwd;self.options.loginParams=params.loginParams;};$.JsonRpcClient.prototype.connectSocket=function(onmessage_cb){var self=this;if(self.to){clearTimeout(self.to);} if(!self.socketReady()){self.authing=false;if(self._ws_socket){delete self._ws_socket;} self._ws_socket=new WebSocket(self.options.socketUrl);if(self._ws_socket){self._ws_socket.onmessage=onmessage_cb;self._ws_socket.onclose=function(w){if(!self.ws_sleep){self.ws_sleep=1000;} if(self.options.onWSClose){self.options.onWSClose(self);} @@ -78,7 +78,7 @@ console.error("Websocket Lost "+self.ws_cnt+" sleep: "+self.ws_sleep+"msec");sel self.ws_sleep=1000;self.ws_cnt=0;if(self.options.onWSConnect){self.options.onWSConnect(self);} var req;while((req=$.JsonRpcClient.q.pop())){self._ws_socket.send(req);}};}} return self._ws_socket?true:false;};$.JsonRpcClient.prototype._getSocket=function(onmessage_cb){if(this.options.socketUrl===null||!("WebSocket"in window))return null;this.connectSocket(onmessage_cb);return this._ws_socket;};$.JsonRpcClient.q=[];$.JsonRpcClient.prototype._wsCall=function(socket,request,success_cb,error_cb){var request_json=$.toJSON(request);if(socket.readyState<1){self=this;$.JsonRpcClient.q.push(request_json);}else{socket.send(request_json);} -if('id'in request&&typeof success_cb!=='undefined'){this._ws_callbacks[request.id]={request:request_json,request_obj:request,success_cb:success_cb,error_cb:error_cb};}};$.JsonRpcClient.prototype._wsOnMessage=function(event){var response;try{response=$.parseJSON(event.data);if(typeof response==='object'&&'jsonrpc'in response&&response.jsonrpc==='2.0'){if('result'in response&&this._ws_callbacks[response.id]){var success_cb=this._ws_callbacks[response.id].success_cb;delete this._ws_callbacks[response.id];success_cb(response.result,this);return;}else if('error'in response&&this._ws_callbacks[response.id]){var error_cb=this._ws_callbacks[response.id].error_cb;var orig_req=this._ws_callbacks[response.id].request;if(!self.authing&&response.error.code==-32000&&self.options.login&&self.options.passwd){self.authing=true;this.call("login",{login:self.options.login,passwd:self.options.passwd},this._ws_callbacks[response.id].request_obj.method=="login"?function(e){self.authing=false;console.log("logged in");delete self._ws_callbacks[response.id];if(self.options.onWSLogin){self.options.onWSLogin(true,self);}}:function(e){self.authing=false;console.log("logged in, resending request id: "+response.id);var socket=self.options.getSocket(self.wsOnMessage);if(socket!==null){socket.send(orig_req);} +if('id'in request&&typeof success_cb!=='undefined'){this._ws_callbacks[request.id]={request:request_json,request_obj:request,success_cb:success_cb,error_cb:error_cb};}};$.JsonRpcClient.prototype._wsOnMessage=function(event){var response;try{response=$.parseJSON(event.data);if(typeof response==='object'&&'jsonrpc'in response&&response.jsonrpc==='2.0'){if('result'in response&&this._ws_callbacks[response.id]){var success_cb=this._ws_callbacks[response.id].success_cb;delete this._ws_callbacks[response.id];success_cb(response.result,this);return;}else if('error'in response&&this._ws_callbacks[response.id]){var error_cb=this._ws_callbacks[response.id].error_cb;var orig_req=this._ws_callbacks[response.id].request;if(!self.authing&&response.error.code==-32000&&self.options.login&&self.options.passwd){self.authing=true;this.call("login",{login:self.options.login,passwd:self.options.passwd,loginParams:self.options.loginParams},this._ws_callbacks[response.id].request_obj.method=="login"?function(e){self.authing=false;console.log("logged in");delete self._ws_callbacks[response.id];if(self.options.onWSLogin){self.options.onWSLogin(true,self);}}:function(e){self.authing=false;console.log("logged in, resending request id: "+response.id);var socket=self.options.getSocket(self.wsOnMessage);if(socket!==null){socket.send(orig_req);} if(self.options.onWSLogin){self.options.onWSLogin(true,self);}},function(e){console.log("error logging in, request id:",response.id);delete self._ws_callbacks[response.id];error_cb(response.error,this);if(self.options.onWSLogin){self.options.onWSLogin(false,self);}});return;} delete this._ws_callbacks[response.id];error_cb(response.error,this);return;}}}catch(err){console.log("ERROR: "+err);return;} if(typeof this.options.onmessage==='function'){event.eventData=response;if(!event.eventData){event.eventData={};} @@ -93,7 +93,7 @@ for(i=0;i=$.verto.enum.state.active.val){return;} -if(dialog.state.val>=$.verto.enum.state.early.val){dialog.setState($.verto.enum.state.active);}else{if(dialog.gotEarly){console.log("Dialog "+dialog.callID+" Got answer while still establishing early media, delaying...");}else{console.log("Dialog "+dialog.callID+" Answering Channel");dialog.rtc.answer(params.sdp,function(){dialog.setState($.verto.enum.state.active);},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"ANSWER SDP",params.sdp);}}};$.verto.dialog.prototype.cidString=function(enc){var dialog=this;var party=dialog.params.remote_caller_id_name+(enc?" <":" <")+dialog.params.remote_caller_id_number+(enc?">":">");return party;};$.verto.dialog.prototype.sendMessage=function(msg,params){var dialog=this;if(dialog.callbacks.onMessage){dialog.callbacks.onMessage(dialog.verto,dialog,msg,params);}};$.verto.dialog.prototype.handleInfo=function(params){var dialog=this;dialog.sendMessage($.verto.enum.message.info,params.msg);};$.verto.dialog.prototype.handleDisplay=function(params){var dialog=this;if(params.display_name){dialog.params.remote_caller_id_name=params.display_name;} +if(dialog.state.val>=$.verto.enum.state.early.val){dialog.setState($.verto.enum.state.active);}else{if(dialog.gotEarly){console.log("Dialog "+dialog.callID+"Got answer while still establishing early media, delaying...");}else{console.log("Dialog "+dialog.callID+"Answering Channel");dialog.rtc.answer(params.sdp,function(){dialog.setState($.verto.enum.state.active);},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"ANSWER SDP",params.sdp);}}};$.verto.dialog.prototype.cidString=function(enc){var dialog=this;var party=dialog.params.remote_caller_id_name+(enc?" <":" <")+dialog.params.remote_caller_id_number+(enc?">":">");return party;};$.verto.dialog.prototype.sendMessage=function(msg,params){var dialog=this;if(dialog.callbacks.onMessage){dialog.callbacks.onMessage(dialog.verto,dialog,msg,params);}};$.verto.dialog.prototype.handleInfo=function(params){var dialog=this;dialog.sendMessage($.verto.enum.message.info,params.msg);};$.verto.dialog.prototype.handleDisplay=function(params){var dialog=this;if(params.display_name){dialog.params.remote_caller_id_name=params.display_name;} if(params.display_number){dialog.params.remote_caller_id_number=params.display_number;} dialog.sendMessage($.verto.enum.message.display,{});};$.verto.dialog.prototype.handleMedia=function(params){var dialog=this;if(dialog.state.val>=$.verto.enum.state.early.val){return;} dialog.gotEarly=true;dialog.rtc.answer(params.sdp,function(){console.log("Dialog "+dialog.callID+"Establishing early media");dialog.setState($.verto.enum.state.early);if(dialog.gotAnswer){console.log("Dialog "+dialog.callID+"Answering Channel");dialog.setState($.verto.enum.state.active);}},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"EARLY SDP",params.sdp);};$.verto.ENUM=function(s){var i=0,o={};s.split(" ").map(function(x){o[x]={name:x,val:i++};});return Object.freeze(o);};$.verto.enum={};$.verto.enum.states=Object.freeze({new:{requesting:1,recovering:1,ringing:1,destroy:1,answering:1},requesting:{trying:1,hangup:1},recovering:{answering:1,hangup:1},trying:{active:1,early:1,hangup:1},ringing:{answering:1,hangup:1},answering:{active:1,hangup:1},active:{answering:1,requesting:1,hangup:1,held:1},held:{hangup:1,active:1},early:{hangup:1,active:1},hangup:{destroy:1},destroy:{},purge:{destroy:1}});$.verto.enum.state=$.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");$.verto.enum.direction=$.verto.ENUM("inbound outbound");$.verto.enum.message=$.verto.ENUM("display info pvtEvent");$.verto.enum=Object.freeze($.verto.enum);$.verto.saved=[];$(window).bind('beforeunload',function(){for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.logout();verto.purge();}} diff --git a/html5/verto/js/src/jquery.jsonrpcclient.js b/html5/verto/js/src/jquery.jsonrpcclient.js index e6000f084f..9422215921 100644 --- a/html5/verto/js/src/jquery.jsonrpcclient.js +++ b/html5/verto/js/src/jquery.jsonrpcclient.js @@ -71,6 +71,7 @@ login : null, /// auth login passwd : null, /// auth passwd sessid : null, + loginParams : null, getSocket : function(onmessage_cb) { return self._getSocket(onmessage_cb); } }, options); @@ -250,15 +251,18 @@ }; $.JsonRpcClient.prototype.closeSocket = function() { + var self = this; if (self.socketReady()) { - this._ws_socket.onclose = function (w) {console.log("Closing Socket");}; - this._ws_socket.close(); + self._ws_socket.onclose = function (w) {console.log("Closing Socket");}; + self._ws_socket.close(); } }; $.JsonRpcClient.prototype.loginData = function(params) { + var self = this; self.options.login = params.login; self.options.passwd = params.passwd; + self.options.loginParams = params.loginParams; }; $.JsonRpcClient.prototype.connectSocket = function(onmessage_cb) { @@ -418,7 +422,7 @@ if (!self.authing && response.error.code == -32000 && self.options.login && self.options.passwd) { self.authing = true; - this.call("login", { login: self.options.login, passwd: self.options.passwd}, + this.call("login", { login: self.options.login, passwd: self.options.passwd, loginParams: self.options.loginParams}, this._ws_callbacks[response.id].request_obj.method == "login" ? function(e) { self.authing = false; diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index 53deb8feef..9bb5e02ceb 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -73,6 +73,7 @@ tag: null, videoParams: {}, audioParams: {}, + loginParams: {}, iceServers: false, ringSleep: 6000 }, options); @@ -90,6 +91,7 @@ login: verto.options.login, passwd: verto.options.passwd, socketUrl: verto.options.socketUrl, + loginParams: verto.options.loginParams, sessid: verto.sessid, onmessage: function(e) { return verto.handleMessage(e.eventData); diff --git a/libs/broadvoice/Makefile.am b/libs/broadvoice/Makefile.am index a681b8d450..f99395399c 100644 --- a/libs/broadvoice/Makefile.am +++ b/libs/broadvoice/Makefile.am @@ -20,7 +20,6 @@ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) -AUTOMAKE_OPTIONS = subdir-objects noinst_SCRIPTS = broadvoice.spec diff --git a/libs/broadvoice/src/Makefile.am b/libs/broadvoice/src/Makefile.am index c96590e472..9b197ba891 100644 --- a/libs/broadvoice/src/Makefile.am +++ b/libs/broadvoice/src/Makefile.am @@ -21,7 +21,6 @@ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) -AUTOMAKE_OPTIONS = subdir-objects MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = libbroadvoice.dsp \ diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index dbf57c9c15..32fb77111c 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -1205,7 +1205,7 @@ struct color_map_el color_map[] = { static const char* match_color(const char *s) { struct color_map_el *map = color_map; - while (map->name) { + while (*map->name) { if (!(strcasecmp(s, map->name))) { return map->seq; } diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index aa071870a0..a57d892627 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1915,6 +1915,17 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event ftdm_set_string(caller_data->dnis.digits, (char *)pevent->ring.callednum); ftdm_set_string(caller_data->rdnis.digits, (char *)pevent->ring.redirectingnum); + if (pevent->ring.callingplanani != -1) { + caller_data->ani.type = pevent->ring.callingplanani >> 4; + caller_data->ani.plan = pevent->ring.callingplanani & 0x0F; + } else { + /* the remote party did not sent a valid (according to libpri) ANI ton, + * so let's use the callingplan ton/type and hope is correct. + */ + caller_data->ani.type = pevent->ring.callingplan >> 4; + caller_data->ani.plan = pevent->ring.callingplan & 0x0F; + } + caller_data->cid_num.type = pevent->ring.callingplan >> 4; caller_data->cid_num.plan = pevent->ring.callingplan & 0x0F; @@ -2706,7 +2717,8 @@ static ftdm_status_t ftdm_libpri_stop(ftdm_span_t *span) ftdm_libpri_data_t *isdn_data = span->signal_data; if (!ftdm_test_flag(isdn_data, FTMOD_LIBPRI_RUNNING)) { - return FTDM_FAIL; + ftdm_log(FTDM_LOG_DEBUG, "Span %d already stopped, continuing anyway...\n", ftdm_span_get_id(span)); + return FTDM_SUCCESS; } ftdm_log(FTDM_LOG_INFO, "Stopping span [s%d][%s]\n", diff --git a/libs/iksemel/openssl.m4 b/libs/iksemel/openssl.m4 index 8adea2192e..6bf1851021 100644 --- a/libs/iksemel/openssl.m4 +++ b/libs/iksemel/openssl.m4 @@ -33,7 +33,7 @@ else AC_CHECK_LIB(ssl, TLSv1_method,, HAVE_TLS=0 AC_MSG_WARN(OpenSSL protocol library was not found)) - ],[AC_MSG_WARN(OpenSSL include files were not found)]) + ],[AC_MSG_WARN(OpenSSL include files were not found)],[#include ]) fi if test x$HAVE_SSL = x1; then diff --git a/libs/libcodec2/Makefile.am b/libs/libcodec2/Makefile.am index 8c24f42fe4..1aa4a11879 100644 --- a/libs/libcodec2/Makefile.am +++ b/libs/libcodec2/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = -Isrc -fPIC -Wall -O3 -lm -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu NAME = codec2 AM_CPPFLAGS = $(AM_CFLAGS) diff --git a/libs/libcodec2/src/Makefile.am b/libs/libcodec2/src/Makefile.am index f06c42e0f6..1153b3ccbd 100644 --- a/libs/libcodec2/src/Makefile.am +++ b/libs/libcodec2/src/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = -I../src -fPIC -Wall -O3 -g -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu NAME = codec2 AM_CPPFLAGS = $(AM_CFLAGS) diff --git a/libs/libcodec2/unittest/Makefile.am b/libs/libcodec2/unittest/Makefile.am index e9a216d48e..a8f12a0c00 100644 --- a/libs/libcodec2/unittest/Makefile.am +++ b/libs/libcodec2/unittest/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = -I../src -I$(abs_srcdir)/../src -fPIC -g -DFLOATING_POINT -DVAR_ARRAYS -O2 -Wall -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu NAME = libcodec2 AM_CPPFLAGS = $(AM_CFLAGS) diff --git a/libs/libdingaling/Makefile.am b/libs/libdingaling/Makefile.am index 5da1715ef4..37bf42cb31 100644 --- a/libs/libdingaling/Makefile.am +++ b/libs/libdingaling/Makefile.am @@ -1,6 +1,6 @@ EXTRA_DIST = SUBDIRS = -AUTOMAKE_OPTIONS = foreign subdir-objects +AUTOMAKE_OPTIONS = foreign NAME=dingaling PREFIX=$(prefix) TOUCH_TARGET=@if test -f "$@" ; then touch "$@" ; fi ; diff --git a/libs/libdingaling/src/sha1.c b/libs/libdingaling/src/sha1.c index c54154a866..b96446c122 100644 --- a/libs/libdingaling/src/sha1.c +++ b/libs/libdingaling/src/sha1.c @@ -57,11 +57,20 @@ #include "sha1.h" +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-const-variable" +#endif + #ifndef lint static const char rcsid[] = "$Id: sha1.c 680 2003-07-25 21:57:38Z asaddi $"; #endif /* !lint */ +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) #define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) diff --git a/libs/libzrtp/Makefile.am b/libs/libzrtp/Makefile.am index ff5002a69e..2d3b82421d 100644 --- a/libs/libzrtp/Makefile.am +++ b/libs/libzrtp/Makefile.am @@ -4,7 +4,6 @@ # # Viktor Krikun # -AUTOMAKE_OPTIONS = subdir-objects libzrtp_includedir=$(includedir)/libzrtp libzrtp_include_HEADERS = \ diff --git a/libs/silk/Makefile.am b/libs/silk/Makefile.am index a410e96998..c1d88b3a55 100644 --- a/libs/silk/Makefile.am +++ b/libs/silk/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = -Isrc -I$(abs_srcdir)/src -Iinterface -I$(abs_srcdir)/interface -fPIC -O3 -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu NAME = libSKP_SILK_SDK AM_CPPFLAGS = $(AM_CFLAGS) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 3d6072b228..f5b42d453c 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Jan 7 11:24:56 PST 2015 +Wed Feb 11 12:35:25 EST 2015 diff --git a/libs/sofia-sip/Makefile.am b/libs/sofia-sip/Makefile.am index 3a5bbb0baf..7279695865 100644 --- a/libs/sofia-sip/Makefile.am +++ b/libs/sofia-sip/Makefile.am @@ -5,7 +5,7 @@ # Contact: Pekka Pessi # Licensed under LGPL. See file COPYING. -AUTOMAKE_OPTIONS = foreign 1.7 subdir-objects +AUTOMAKE_OPTIONS = foreign 1.7 SUBDIRS = libsofia-sip-ua $(GLIB_SUBDIRS) packages # tests s2check utils DIST_SUBDIRS = s2check libsofia-sip-ua libsofia-sip-ua-glib utils packages \ diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c index 0e8c0dd64f..e15d6787de 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c @@ -176,7 +176,7 @@ int nua_client_create(nua_handle_t *nh, if (tags) { nua_move_signal(cr->cr_signal, nh->nh_nua->nua_signal); - if (cr->cr_signal) { + if (cr->cr_signal[0]) { /* Steal reference from signal */ cr->cr_owner = e->e_nh, e->e_nh = NULL; cr->cr_tags = tags; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c index 85f1647d3e..7364d4b255 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c @@ -877,7 +877,7 @@ void nua_stack_shutdown(nua_t *nua) if (status >= 200) { for (nh = nua->nua_handles; nh; nh = nh_next) { nh_next = nh->nh_next; - while (nh->nh_ds && nh->nh_ds->ds_usage) { + while (nh->nh_ds->ds_usage) { nua_dialog_usage_remove(nh, nh->nh_ds, nh->nh_ds->ds_usage, NULL, NULL); } } @@ -1096,7 +1096,7 @@ sip_replaces_t *nua_stack_handle_make_replaces(nua_handle_t *nh, su_home_t *home, int early_only) { - if (nh && nh->nh_ds && nh->nh_ds->ds_leg) + if (nh && nh->nh_ds->ds_leg) return nta_leg_make_replaces(nh->nh_ds->ds_leg, home, early_only); else return NULL; diff --git a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c index 70a5b23b72..37b58e54bb 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c +++ b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c @@ -270,7 +270,7 @@ static void print_session(sdp_printer_t *p, sdp_session_t const *sdp) { p->pr_ok = 1; - if (p->pr_ok && sdp->sdp_version) + if (p->pr_ok) print_version(p, sdp->sdp_version); if (p->pr_ok && sdp->sdp_origin) print_origin(p, sdp->sdp_origin); diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h b/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h index 484c0a2fe8..8e212b11f3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h @@ -317,7 +317,7 @@ sip_payload_t *sip_payload_create(su_home_t *, void const *data, isize_t len); * @HIDE */ #define SIP_PAYLOAD_INIT2(data, length) \ - {{{ 0, 0, sip_payload_class, data, length }, NULL, data, length }} + {{{ 0, 0, sip_payload_class, data, length }}, NULL, data, length } /** Create a SIP separator line structure. */ SOFIAPUBFUN sip_separator_t *sip_separator_create(su_home_t *home); diff --git a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c index 87216c6b5a..0e192acd0c 100644 --- a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c +++ b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c @@ -732,10 +732,19 @@ int soa_sdp_upgrade(soa_session_t *ss, if (session == NULL || user == NULL) return (errno = EFAULT), -1; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-literal-null-conversion" +#endif + Ns = sdp_media_count(session, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0); Nu = sdp_media_count(user, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0); Nr = sdp_media_count(remote, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + if (remote == NULL) Nmax = Ns + Nu; else if (Ns < Nr) @@ -1144,6 +1153,11 @@ static int offer_answer_step(soa_session_t *ss, else if (remote == NULL) return soa_set_status(ss, 500, "No remote SDP"); +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-literal-null-conversion" +#endif + /* Pre-negotiation Step: Expand truncated remote SDP */ if (local && remote) switch (action) { case generate_answer: @@ -1160,6 +1174,11 @@ static int offer_answer_step(soa_session_t *ss, break; } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + + /* Step A: Create local SDP session (based on user-supplied SDP) */ if (local == NULL) switch (action) { case generate_offer: diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c index 3d74f66644..bc03a69cfb 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c @@ -516,7 +516,7 @@ sres_sip_url_transport(url_t const *uri) if (len >= sizeof parameter) return -1; - for (i = 0; sres_sip_tports[i].stp_name; i++) { + for (i = 0; *sres_sip_tports[i].stp_name; i++) { if (su_casematch(parameter, sres_sip_tports[i].stp_name)) return sres_sip_tports[i].stp_number; } diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index e990f7f815..8a46b65502 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -311,7 +311,7 @@ int ws_handshake(wsh_t *wsh) proto_buf); respond[511] = 0; - if (ws_raw_write(wsh, respond, strlen(respond)) != strlen(respond)) { + if (ws_raw_write(wsh, respond, strlen(respond)) != (ssize_t)strlen(respond)) { goto err; } @@ -406,7 +406,7 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) ssize_t r; int sanity = 2000; int ssl_err = 0; - ssize_t wrote = 0; + size_t wrote = 0; if (wsh->ssl) { do { diff --git a/libs/sofia-sip/m4/sac-openssl.m4 b/libs/sofia-sip/m4/sac-openssl.m4 index 7daf7f4773..289d3e132e 100644 --- a/libs/sofia-sip/m4/sac-openssl.m4 +++ b/libs/sofia-sip/m4/sac-openssl.m4 @@ -33,7 +33,7 @@ else AC_CHECK_LIB(ssl, TLSv1_method,, HAVE_TLS=0 AC_MSG_WARN(OpenSSL protocol library was not found)) - ],[AC_MSG_WARN(OpenSSL include files were not found)]) + ],[AC_MSG_WARN(OpenSSL include files were not found)],[#include ]) fi if test x$HAVE_OPENSSL = x1; then diff --git a/libs/sofia-sip/s2check/Makefile.am b/libs/sofia-sip/s2check/Makefile.am index ae4d7502b2..a6332ac681 100644 --- a/libs/sofia-sip/s2check/Makefile.am +++ b/libs/sofia-sip/s2check/Makefile.am @@ -5,8 +5,6 @@ # Contact: Pekka Pessi # Licensed under LGPL. See file COPYING. -AUTOMAKE_OPTIONS = subdir-objects - # ---------------------------------------------------------------------- # Header paths diff --git a/libs/srtp/test/Makefile.am b/libs/srtp/test/Makefile.am index 4af9005ac3..2651f2714f 100644 --- a/libs/srtp/test/Makefile.am +++ b/libs/srtp/test/Makefile.am @@ -1,4 +1,4 @@ -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu AM_CFLAGS = $(new_AM_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir)/crypto/include AM_CPPFLAGS = $(AM_CFLAGS) AM_LDFLAGS = $(new_AM_LDFLAGS) -L$(srcdir) -lsrtp diff --git a/libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj b/libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj index bd8a68bd2c..5a9eea4f8c 100644 --- a/libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj +++ b/libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj @@ -87,7 +87,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" Disabled ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -124,7 +124,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" Disabled ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) - _WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions) + _WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -159,7 +159,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" MaxSpeed OnlyExplicitInline ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL true @@ -197,7 +197,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" MaxSpeed OnlyExplicitInline ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) - _WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions) + _WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL true diff --git a/libs/win32/v8/build-v8.bat b/libs/win32/v8/build-v8.bat index 7dfa758946..21b1af7db6 100644 --- a/libs/win32/v8/build-v8.bat +++ b/libs/win32/v8/build-v8.bat @@ -23,7 +23,13 @@ IF "%1-%2" == "%LAST_BUILD_INFO%" ( SET LIB_DEST_DIR= -IF NOT "%4" == "" ( +IF "%VisualStudioVersion%" == "11.0" ( + SET VS_VERSION=-Gmsvs_version=2012 + ECHO Forcing build to use Visual Studio 2012 +) ELSE IF "%VisualStudioVersion%" == "12.0" ( + SET VS_VERSION=-Gmsvs_version=2013 + ECHO Forcing build to use Visual Studio 2013 +) ELSE IF NOT "%4" == "" ( SET VS_VERSION=-Gmsvs_version=%4 ECHO Forcing build to use Visual Studio %4 ) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index d317541ca2..535044ca18 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -2,7 +2,7 @@ ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- src_repo="$(pwd)" -tmp_dir=${TMP_DIR:="/tmp"} +tmp_dir=${TMP_DIR:=".."} zgrep () { (echo "$2" | grep -e "$1" >/dev/null); } @@ -99,10 +99,11 @@ parse_version () { set_fs_ver () { local ver="$1" major="$2" minor="$3" micro="$4" rev="$5" hrev="$6" - sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ + sed \ + -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ - -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$ver\2|" \ + -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], bugs@freeswitch.org)\)|\1$ver\2|" \ configure.ac > configure.ac.$$ mv configure.ac.$$ configure.ac if [ -n "$rev" ]; then @@ -114,6 +115,13 @@ set_fs_ver () { configure.ac > configure.ac.$$ mv configure.ac.$$ configure.ac fi + + sed -e "s|\(%define version \).*|\1$major.$minor.$micro|" \ + freeswitch.spec > freeswitch.spec.$$ + mv freeswitch.spec.$$ freeswitch.spec + +#%define version 1.5.16 + } gnuize () { diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index 8d633d6d80..894d28e162 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -19,18 +19,11 @@ dst_dir="/tmp/$dst_name" cd $src_repo cp -a src_dist/* rpmbuild/SOURCES/ || true -rpmbuild --define "VERSION_NUMBER $cver" \ - --define "BUILD_NUMBER $build" \ - --define "_topdir %(pwd)/rpmbuild" \ +rpmbuild --define "_topdir %(pwd)/rpmbuild" \ --define "_rpmdir %{_topdir}" \ --define "_srcrpmdir %{_topdir}" \ -ba freeswitch.spec -# --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \ -# --define "_sourcedir %{_topdir}" \ -# --define "_builddir %{_topdir}" \ - - mkdir $src_repo/RPMS mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/. diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 82c970bced..da47e38fea 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -6,15 +6,18 @@ sdir="." . $sdir/common.sh check_pwd -check_input_ver_build $@ -eval $(parse_version "$1") +version=`cat build/next-release.txt` +check_input_ver_build $version +eval $(parse_version "$version") if [ -n "$grev" ]; then dst_name="freeswitch-$cmajor.$cminor.$cmicro.$grev" else dst_name="freeswitch-$cmajor.$cminor.$cmicro" fi -dst_dir="${tmp_dir}/jenkins.$$/$dst_name" +#This should be a RAM Drive +build_dir="jenkins.$$" +dst_dir="${tmp_dir}/${build_dir}/$dst_name" if [ -d "$dst_dir" ]; then echo "error: destination directory $dst_dir already exists." 1>&2 @@ -39,9 +42,14 @@ zip -r $dst_name.zip $dst_name rm -rf ${dst_name}.tar $dst_dir -mkdir -p ${src_repo}/src_dist -mv -f ${dst_name}.tar.* ${src_repo}/src_dist -mv -f $dst_name.zip ${src_repo}/src_dist +mkdir -p ${src_repo}/../src_dist +mv -f ${dst_name}.tar.* ${src_repo}/../src_dist +mv -f $dst_name.zip ${src_repo}/../src_dist + +cd ${tmp_dir} +ls -al +rm -rf ${build_dir} +ls -al cat 1>&2 <agent_name, h->agent_system, h->member_uuid); cc_execute_sql(NULL, sql, NULL); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 7215084977..15ceb23ee7 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3455,7 +3455,11 @@ SWITCH_STANDARD_API(uuid_pre_answer_function) if (uuid && (xsession = switch_core_session_locate(uuid))) { switch_channel_t *channel = switch_core_session_get_channel(xsession); - switch_channel_pre_answer(channel); + if (switch_channel_pre_answer(channel) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK\n"); + } else { + stream->write_function(stream, "-ERROR\n"); + } switch_core_session_rwunlock(xsession); } else { stream->write_function(stream, "-ERROR\n"); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 60de0c7810..0a680af860 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4534,6 +4534,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v member->loop_loop = 1; if (setup_media(member, member->conference)) { + switch_mutex_unlock(member->read_mutex); break; } } @@ -8959,6 +8960,9 @@ SWITCH_STANDARD_APP(conference_auto_function) static int setup_media(conference_member_t *member, conference_obj_t *conference) { switch_codec_implementation_t read_impl = { 0 }; + + switch_mutex_lock(member->audio_out_mutex); + switch_core_session_get_read_impl(member->session, &read_impl); if (switch_core_codec_ready(&member->read_codec)) { @@ -8975,6 +8979,9 @@ static int setup_media(conference_member_t *member, conference_obj_t *conference switch_resample_destroy(&member->read_resampler); } + switch_buffer_destroy(&member->resample_buffer); + switch_buffer_destroy(&member->audio_buffer); + switch_buffer_destroy(&member->mux_buffer); switch_core_session_get_read_impl(member->session, &member->orig_read_impl); member->native_rate = read_impl.samples_per_second; @@ -9052,6 +9059,8 @@ static int setup_media(conference_member_t *member, conference_obj_t *conference goto codec_done1; } + switch_mutex_unlock(member->audio_out_mutex); + return 0; codec_done1: @@ -9060,6 +9069,8 @@ static int setup_media(conference_member_t *member, conference_obj_t *conference switch_core_codec_destroy(&member->write_codec); done: + switch_mutex_unlock(member->audio_out_mutex); + return -1; @@ -9571,6 +9582,15 @@ SWITCH_STANDARD_APP(conference_function) member.channel = switch_core_session_get_channel(session); member.pool = switch_core_session_get_pool(session); + /* Prepare MUTEXS */ + switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, member.pool); + switch_mutex_init(&member.write_mutex, SWITCH_MUTEX_NESTED, member.pool); + switch_mutex_init(&member.read_mutex, SWITCH_MUTEX_NESTED, member.pool); + switch_mutex_init(&member.fnode_mutex, SWITCH_MUTEX_NESTED, member.pool); + switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, member.pool); + switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, member.pool); + switch_thread_rwlock_create(&member.rwlock, member.pool); + if (setup_media(&member, conference)) { //flags = 0; goto done; @@ -9584,16 +9604,8 @@ SWITCH_STANDARD_APP(conference_function) } switch_channel_set_variable_printf(channel, "conference_member_id", "%u", *mid); - - /* Prepare MUTEXS */ member.id = *mid; - switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, member.pool); - switch_mutex_init(&member.write_mutex, SWITCH_MUTEX_NESTED, member.pool); - switch_mutex_init(&member.read_mutex, SWITCH_MUTEX_NESTED, member.pool); - switch_mutex_init(&member.fnode_mutex, SWITCH_MUTEX_NESTED, member.pool); - switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, member.pool); - switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, member.pool); - switch_thread_rwlock_create(&member.rwlock, member.pool); + /* Install our Signed Linear codec so we get the audio in that format */ switch_core_session_set_read_codec(member.session, &member.read_codec); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index fc515a50e0..d7eb90b417 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -818,11 +818,21 @@ SWITCH_STANDARD_APP(eavesdrop_function) switch_channel_t *channel = switch_core_session_get_channel(session); const char *require_group = switch_channel_get_variable(channel, "eavesdrop_require_group"); const char *enable_dtmf = switch_channel_get_variable(channel, "eavesdrop_enable_dtmf"); + const char *bridge_aleg = switch_channel_get_variable(channel, "eavesdrop_bridge_aleg"); + const char *bridge_bleg = switch_channel_get_variable(channel, "eavesdrop_bridge_bleg"); if (enable_dtmf) { flags = switch_true(enable_dtmf) ? ED_DTMF : ED_NONE; } + /* Defaults to both, if neither is set */ + if (switch_true(bridge_aleg)) { + flags |= ED_BRIDGE_READ; + } + if (switch_true(bridge_bleg)) { + flags |= ED_BRIDGE_WRITE; + } + if (!strcasecmp((char *) data, "all")) { switch_cache_db_handle_t *db = NULL; char *errmsg = NULL; diff --git a/src/mod/applications/mod_memcache/mod_memcache.c b/src/mod/applications/mod_memcache/mod_memcache.c index a5a5324e93..d7c3f957b9 100644 --- a/src/mod/applications/mod_memcache/mod_memcache.c +++ b/src/mod/applications/mod_memcache/mod_memcache.c @@ -357,7 +357,7 @@ SWITCH_STANDARD_API(memcache_function) } else if (!strcasecmp(subcmd, "delete") && argc > 1) { key = argv[1]; if (argc > 2) { - expires_str = argv[3]; + expires_str = argv[2]; expires = (time_t) strtol(expires_str, NULL, 10); } rc = memcached_delete(memcached, key, strlen(key), expires); @@ -368,7 +368,7 @@ SWITCH_STANDARD_API(memcache_function) } } else if (!strcasecmp(subcmd, "flush")) { if (argc > 1) { - expires_str = argv[3]; + expires_str = argv[1]; expires = (time_t) strtol(expires_str, NULL, 10); } rc = memcached_flush(memcached, expires); diff --git a/src/mod/applications/mod_mongo/mod_mongo.c b/src/mod/applications/mod_mongo/mod_mongo.c index aeb375a9d5..0de63fd0b6 100644 --- a/src/mod/applications/mod_mongo/mod_mongo.c +++ b/src/mod/applications/mod_mongo/mod_mongo.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II + * Copyright (C) 2005-2015, Anthony Minessale II * * Version: MPL 1.1 * @@ -44,6 +44,7 @@ #define DELIMITER ';' #define FIND_ONE_SYNTAX "mongo_find_one ns; query; fields; options" +#define FIND_N_SYNTAX "mongo_find_n ns; query; fields; options; n" #define MAPREDUCE_SYNTAX "mongo_mapreduce ns; query" SWITCH_MODULE_LOAD_FUNCTION(mod_mongo_load); @@ -184,6 +185,102 @@ SWITCH_STANDARD_API(mongo_mapreduce_function) return status; } +SWITCH_STANDARD_API(mongo_find_n_function) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + char *db = NULL, *collection = NULL, *json_query = NULL, *json_fields = NULL, *query_options_str = NULL; + int query_options = 0; + int n = 1; + + db = strdup(cmd); + switch_assert(db != NULL); + + if ((collection = strchr(db, '.'))) { + *collection++ = '\0'; + if ((json_query = strchr(collection, DELIMITER))) { + *json_query++ = '\0'; + if ((json_fields = strchr(json_query, DELIMITER))) { + *json_fields++ = '\0'; + if ((query_options_str = strchr(json_fields, DELIMITER))) { + char *n_str; + *query_options_str++ = '\0'; + if (!zstr(query_options_str)) { + query_options = parse_query_options(query_options_str); + } + if ((n_str = strchr(query_options_str, DELIMITER))) { + *n_str++ = '\0'; + if (switch_is_number(n_str)) { + n = atoi(n_str); + if (n < 1) { + n = 1; + } + } + } + } + } + } + } + + if (!zstr(db) && !zstr(collection) && !zstr(json_query) && !zstr(json_fields)) { + bson_error_t error; + mongoc_client_t *conn = get_connection(); + if (conn) { + mongoc_collection_t *col = mongoc_client_get_collection(conn, db, collection); + if (col) { + bson_t *query = bson_new_from_json((uint8_t *)json_query, strlen(json_query), &error); + bson_t *fields = bson_new_from_json((uint8_t *)json_fields, strlen(json_fields), &error); + if (query && fields) { + /* send query */ + mongoc_cursor_t *cursor = mongoc_collection_find(col, query_options, 0, n, 0, query, fields, NULL); + if (cursor && !mongoc_cursor_error(cursor, &error)) { + /* get results from cursor */ + const bson_t *result; + stream->write_function(stream, "-OK\n["); + if (mongoc_cursor_more(cursor) && mongoc_cursor_next(cursor, &result)) { + char *json_result; + json_result = bson_as_json(result, NULL); + stream->write_function(stream, "%s", json_result); + bson_free(json_result); + } + while (mongoc_cursor_more(cursor) && mongoc_cursor_next(cursor, &result)) { + char *json_result; + json_result = bson_as_json(result, NULL); + stream->write_function(stream, ",%s", json_result); + bson_free(json_result); + } + stream->write_function(stream, "]\n"); + } else { + stream->write_function(stream, "-ERR\nquery failed!\n"); + } + if (cursor) { + mongoc_cursor_destroy(cursor); + } + } else { + stream->write_function(stream, "-ERR\nmissing query or fields!\n%s\n", FIND_ONE_SYNTAX); + } + if (query) { + bson_destroy(query); + } + if (fields) { + bson_destroy(fields); + } + mongoc_collection_destroy(col); + } else { + stream->write_function(stream, "-ERR\nunknown collection: %s\n", collection); + } + connection_done(conn); + } else { + stream->write_function(stream, "-ERR\nfailed to get connection!\n"); + } + } else { + stream->write_function(stream, "-ERR\n%s\n", FIND_N_SYNTAX); + } + + switch_safe_free(db); + + return status; +} + SWITCH_STANDARD_API(mongo_find_one_function) { switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -218,21 +315,21 @@ SWITCH_STANDARD_API(mongo_find_one_function) bson_t *query = bson_new_from_json((uint8_t *)json_query, strlen(json_query), &error); bson_t *fields = bson_new_from_json((uint8_t *)json_fields, strlen(json_fields), &error); if (query && fields) { - int ok = 0; /* send query */ mongoc_cursor_t *cursor = mongoc_collection_find(col, query_options, 0, 1, 0, query, fields, NULL); - if (cursor && mongoc_cursor_more(cursor) && !mongoc_cursor_error(cursor, &error)) { + if (cursor && !mongoc_cursor_error(cursor, &error)) { /* get result from cursor */ const bson_t *result; - if (mongoc_cursor_next(cursor, &result)) { + if (mongoc_cursor_more(cursor) && mongoc_cursor_next(cursor, &result)) { char *json_result; json_result = bson_as_json(result, NULL); stream->write_function(stream, "-OK\n%s\n", json_result); bson_free(json_result); - ok = 1; + } else { + /* empty set */ + stream->write_function(stream, "-OK\n{}\n"); } - } - if (!ok) { + } else { stream->write_function(stream, "-ERR\nquery failed!\n"); } if (cursor) { @@ -256,7 +353,7 @@ SWITCH_STANDARD_API(mongo_find_one_function) stream->write_function(stream, "-ERR\nfailed to get connection!\n"); } } else { - stream->write_function(stream, "-ERR\n%s\n", FIND_ONE_SYNTAX); + stream->write_function(stream, "-ERR\n%s\n", FIND_ONE_SYNTAX); } switch_safe_free(db); @@ -349,6 +446,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_mongo_load) } SWITCH_ADD_API(api_interface, "mongo_find_one", "findOne", mongo_find_one_function, FIND_ONE_SYNTAX); + SWITCH_ADD_API(api_interface, "mongo_find_n", "find", mongo_find_n_function, FIND_N_SYNTAX); SWITCH_ADD_API(api_interface, "mongo_mapreduce", "Map/Reduce", mongo_mapreduce_function, MAPREDUCE_SYNTAX); return SWITCH_STATUS_SUCCESS; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 12a8a95948..1158026215 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -519,6 +519,8 @@ switch_status_t load_configuration(switch_bool_t reload) spandsp_globals.header = "SpanDSP Fax Header"; spandsp_globals.timezone = ""; spandsp_globals.tonedebug = 0; + spandsp_globals.t38_tx_reinvite_packet_count = 100; + spandsp_globals.t38_rx_reinvite_packet_count = 50; if ((xml = switch_xml_open_cfg("spandsp.conf", &cfg, NULL)) || (xml = switch_xml_open_cfg("fax.conf", &cfg, NULL))) { status = SWITCH_STATUS_SUCCESS; @@ -627,10 +629,34 @@ switch_status_t load_configuration(switch_bool_t reload) } else { spandsp_globals.enable_t38_request = 0; } + } else if (!strcmp(name, "t38-tx-reinvite-packet-count")) { + int delay = atoi(value); + + if (delay >= 0 && delay < 1000) { + spandsp_globals.t38_tx_reinvite_packet_count = delay; + } else { + spandsp_globals.t38_tx_reinvite_packet_count = 100; + } + } else if (!strcmp(name, "t38-rx-reinvite-packet-count")) { + int delay = atoi(value); + + if (delay >= 0 && delay < 1000) { + spandsp_globals.t38_rx_reinvite_packet_count = delay; + } else { + spandsp_globals.t38_rx_reinvite_packet_count = 0; + } } else if (!strcmp(name, "ident")) { - spandsp_globals.ident = switch_core_strdup(spandsp_globals.config_pool, value); + if (!strcmp(value, "_undef_")) { + spandsp_globals.ident = ""; + } else { + spandsp_globals.ident = switch_core_strdup(spandsp_globals.config_pool, value); + } } else if (!strcmp(name, "header")) { - spandsp_globals.header = switch_core_strdup(spandsp_globals.config_pool, value); + if (!strcmp(value, "_undef_")) { + spandsp_globals.header = ""; + } else { + spandsp_globals.header = switch_core_strdup(spandsp_globals.config_pool, value); + } } else if (!strcmp(name, "spool-dir")) { spandsp_globals.spool = switch_core_strdup(spandsp_globals.config_pool, value); } else if (!strcmp(name, "file-prefix")) { diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index c732c7b357..7f2f5d04a3 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -82,6 +82,8 @@ struct spandsp_globals { char *modem_directory; switch_hash_t *tones; int tonedebug; + int t38_tx_reinvite_packet_count; + int t38_rx_reinvite_packet_count; }; extern struct spandsp_globals spandsp_globals; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 2c0ba42cc1..c2fc659187 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -138,7 +138,7 @@ static int add_pvt(pvt_t *pvt) { int r = 0; - if (t38_state_list.thread_running) { + if (t38_state_list.thread_running > 0) { switch_mutex_lock(t38_state_list.mutex); pvt->next = t38_state_list.head; t38_state_list.head = pvt; @@ -190,6 +190,13 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * pvt_t *pvt; int samples = 160; int ms = 20; + int r = 0; + + if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); + r = -1; + goto end; + } switch_mutex_lock(t38_state_list.mutex); t38_state_list.thread_running = 1; @@ -197,14 +204,9 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread started.\n"); - if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); - goto end; - } - switch_mutex_lock(spandsp_globals.cond_mutex); - while(t38_state_list.thread_running) { + while(t38_state_list.thread_running == 1) { switch_mutex_lock(t38_state_list.mutex); @@ -233,7 +235,7 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread ended.\n"); switch_mutex_lock(t38_state_list.mutex); - t38_state_list.thread_running = 0; + t38_state_list.thread_running = r; switch_mutex_unlock(t38_state_list.mutex); if (timer.timer_interface) { @@ -1483,9 +1485,9 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat switch_ivr_sleep(session, 250, SWITCH_TRUE, NULL); if (pvt->app_mode == FUNCTION_TX) { - req_counter = 100; + req_counter = spandsp_globals.t38_tx_reinvite_packet_count; } else { - req_counter = 50; + req_counter = spandsp_globals.t38_rx_reinvite_packet_count; } while (switch_channel_ready(channel)) { diff --git a/src/mod/applications/mod_translate/mod_translate.c b/src/mod/applications/mod_translate/mod_translate.c index 61feecd36d..b3f9e96ad5 100644 --- a/src/mod/applications/mod_translate/mod_translate.c +++ b/src/mod/applications/mod_translate/mod_translate.c @@ -112,7 +112,7 @@ static switch_status_t load_config(void) return status; } -static void translate_number(char *number, char *profile, char **translated, switch_core_session_t *session, switch_event_t *event) +static void translate_number(char *number, char *profile, char **translated, switch_core_session_t *session, switch_event_t *event, switch_memory_pool_t *pool) { translate_rule_t *hi = NULL; translate_rule_t *rule = NULL; @@ -153,9 +153,11 @@ static void translate_number(char *number, char *profile, char **translated, swi } else if (event) { subbed = switch_event_expand_headers(event, substituted); } - - substituted = switch_core_session_strdup(session, subbed); - + if (session) { + substituted = switch_core_session_strdup(session, subbed); + } else { + substituted = switch_core_strdup(pool, subbed); + } if (subbed != substituted) { switch_safe_free(subbed); } @@ -255,7 +257,7 @@ SWITCH_STANDARD_APP(translate_app_function) } } - translate_number(argv[0], argv[1], &translated, session, event); + translate_number(argv[0], argv[1], &translated, session, event, NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Translated: %s\n", translated); @@ -307,8 +309,8 @@ SWITCH_STANDARD_DIALPLAN(translate_dialplan_hunt) } } - translate_number((char *) caller_profile->destination_number, translate_profile, &translated_dest, session, event); - translate_number((char *) caller_profile->caller_id_number, translate_profile, &translated_cid_num, session, event); + translate_number((char *) caller_profile->destination_number, translate_profile, &translated_dest, session, event, NULL); + translate_number((char *) caller_profile->caller_id_number, translate_profile, &translated_cid_num, session, event, NULL); /* maybe we should translate ani/aniii here too? */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Profile: [%s] Translated Destination: [%s] Translated CID: [%s]\n", translate_profile, translated_dest, translated_cid_num); @@ -340,12 +342,12 @@ SWITCH_STANDARD_API(translate_function) } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", cmd); - mydata = switch_core_strdup(globals.pool, cmd); + mydata = strdup(cmd); if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { if (!session) { char *areacode = switch_core_get_variable("default_areacode"); - + switch_core_new_memory_pool(&pool); switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS); if (zstr(areacode)) { @@ -355,19 +357,21 @@ SWITCH_STANDARD_API(translate_function) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "areacode", areacode); } } - translate_number(argv[0], argv[1], &translated, session, event); + translate_number(argv[0], argv[1], &translated, session, event, pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Translated: %s\n", translated); stream->write_function(stream, "%s", translated); } + free(mydata); end: if (!session) { if (pool) { switch_core_destroy_memory_pool(&pool); } } + return SWITCH_STATUS_SUCCESS; usage: diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 2f5f1b950c..d24fecc6a4 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -5712,7 +5712,7 @@ SWITCH_STANDARD_API(vm_fsdb_auth_login_function) switch_event_create(¶ms, SWITCH_EVENT_GENERAL); if (switch_xml_locate_user_merged("id:number-alias", id, domain, NULL, &x_user, params) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", id, domain); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", id, domain); stream->write_function(stream, "-ERR User not found\n"); } else { switch_xml_t x_param, x_params; @@ -5953,6 +5953,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) msg_get_callback_t cbt = { 0 }; char *sql; switch_memory_pool_t *pool; + switch_xml_t x_user = NULL; switch_core_new_memory_pool(&pool); @@ -5972,11 +5973,18 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) if (argv[4]) email = argv[4]; + if (!profile_name || !domain || !id || !uuid || !email) { stream->write_function(stream, "-ERR Missing Arguments\n"); goto done; } + if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, NULL) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Can't locate user.\n"); + switch_xml_free(x_user); + goto done; + } + if (!(profile = get_profile(profile_name))) { stream->write_function(stream, "-ERR Profile not found\n"); goto done; @@ -5998,6 +6006,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) switch_core_time_duration_t duration; char duration_str[80]; char *formatted_cid_num = NULL; + char *msg_uuid = NULL; sql = switch_mprintf("select created_epoch, read_epoch, username, domain, uuid, cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags, forwarded_by from voicemail_msgs WHERE username = '%q' AND domain = '%q' AND uuid = '%q' ORDER BY read_flags, created_epoch", id, domain, uuid); memset(&cbt, 0, sizeof(cbt)); @@ -6005,6 +6014,13 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) vm_execute_sql_callback(profile, profile->mutex, sql, message_get_callback, &cbt); switch_safe_free(sql); + msg_uuid = switch_event_get_header(cbt.my_params, "VM-Message-UUID"); + + if (!msg_uuid) { + profile_rwunlock(profile); + stream->write_function(stream, "-ERR Invalid Message UUID\n"); + goto done; + } if (!strcasecmp(switch_event_get_header(cbt.my_params, "VM-Message-Read-Flags"), URGENT_FLAG_STRING)) { priority = 1; } @@ -6080,7 +6096,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) } switch_simple_email(email, from, header_string, body, switch_event_get_header(cbt.my_params, "VM-Message-File-Path"), profile->convert_cmd, profile->convert_ext); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending message to %s\n", email); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", email); switch_safe_free(body); switch_event_fire(&cbt.my_params); diff --git a/src/mod/applications/mod_voicemail_ivr/config.c b/src/mod/applications/mod_voicemail_ivr/config.c index b0cf543411..b2b7d40116 100644 --- a/src/mod/applications/mod_voicemail_ivr/config.c +++ b/src/mod/applications/mod_voicemail_ivr/config.c @@ -169,7 +169,7 @@ static void populate_dtmfa_from_event(vmivr_menu_t *menu) { } } } - menu->dtmfa[i++] = '\0'; + menu->dtmfa[i++] = NULL; } vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile_name) diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 7f65bd406a..133618632f 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2009-2014, Anthony Minessale II + * Copyright (C) 2009-2015, Anthony Minessale II * * Version: MPL 1.1 * @@ -212,6 +212,7 @@ static int get_next_speech_channel_number(void); #define BUILTIN_ID "builtin:" #define SESSION_ID "session:" #define HTTP_ID "http://" +#define HTTPS_ID "https://" #define FILE_ID "file://" #define INLINE_ID "inline:" static int text_starts_with(const char *text, const char *match); @@ -3207,7 +3208,7 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha } /* figure out what type of grammar this is */ - if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, FILE_ID) || text_starts_with(grammar, SESSION_ID) + if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, HTTPS_ID) || text_starts_with(grammar, FILE_ID) || text_starts_with(grammar, SESSION_ID) || text_starts_with(grammar, BUILTIN_ID)) { switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Grammar is URI\n", schannel->name); type = GRAMMAR_TYPE_URI; diff --git a/src/mod/codecs/mod_com_g729/Makefile.am b/src/mod/codecs/mod_com_g729/Makefile.am index e6586e159f..b311a7c641 100644 --- a/src/mod/codecs/mod_com_g729/Makefile.am +++ b/src/mod/codecs/mod_com_g729/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_com_g729 -VERSION=194 +VERSION=201501231218 if ISLINUX diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.c b/src/mod/endpoints/mod_rtmp/mod_rtmp.c index 9e29601b4f..2ec48628ae 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.c +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.c @@ -222,9 +222,6 @@ switch_status_t rtmp_on_destroy(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); if (tech_pvt) { - - rtmp_notify_call_state(session); - if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); } diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 52fb8faefb..2e1a849e41 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -80,7 +80,10 @@ + + + diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 68453edf34..9b55414045 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3657,11 +3657,15 @@ static void select_from_profile(sofia_profile_t *profile, if (exclude_contact) { sql = switch_mprintf("select contact, profile_name, '%q' " - "from sip_registrations where profile_name='%q' and sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') " + "from sip_registrations where profile_name='%q' " + "and upper(sip_user)=upper('%q') " + "and (sip_host='%q' or presence_hosts like '%%%q%%') " "and contact not like '%%%s%%'", (concat != NULL) ? concat : "", profile->name, user, domain, domain, exclude_contact); } else { sql = switch_mprintf("select contact, profile_name, '%q' " - "from sip_registrations where profile_name='%q' and sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", + "from sip_registrations where profile_name='%q' " + "and upper(sip_user)=upper('%q') " + "and (sip_host='%q' or presence_hosts like '%%%q%%')", (concat != NULL) ? concat : "", profile->name, user, domain, domain); } @@ -4247,11 +4251,16 @@ static switch_status_t sofia_manage(char *relative_oid, switch_management_action return SWITCH_STATUS_SUCCESS; } -static void protect_dest_uri(switch_caller_profile_t *cp) +static int protect_dest_uri(switch_caller_profile_t *cp) { char *p = cp->destination_number, *o = p; char *q = NULL, *e = NULL, *qenc = NULL; switch_size_t enclen = 0; + int mod = 0; + + if (!(e = strchr(p, '@'))) { + return 0; + } while((p = strchr(p, '/'))) { q = p++; @@ -4267,11 +4276,11 @@ static void protect_dest_uri(switch_caller_profile_t *cp) } } - if (!go) return; + if (!go) return 0; *q++ = '\0'; } else { - return; + return 0; } if (!strncasecmp(q, "sips:", 5)) { @@ -4281,7 +4290,7 @@ static void protect_dest_uri(switch_caller_profile_t *cp) } if (!(e = strchr(q, '@'))) { - return; + return 0; } *e++ = '\0'; @@ -4290,9 +4299,12 @@ static void protect_dest_uri(switch_caller_profile_t *cp) enclen = (strlen(q) * 2) + 2; qenc = switch_core_alloc(cp->pool, enclen); switch_url_encode(q, qenc, enclen); + mod = 1; } cp->destination_number = switch_core_sprintf(cp->pool, "%s/%s@%s", o, qenc ? qenc : q, e); + + return mod; } static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, @@ -4312,6 +4324,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session int cid_locked = 0; switch_channel_t *o_channel = NULL; sofia_gateway_t *gateway_ptr = NULL; + int mod = 0; *new_session = NULL; @@ -4321,7 +4334,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } if (!switch_true(switch_event_get_header(var_event, "sofia_suppress_url_encoding"))) { - protect_dest_uri(outbound_profile); + mod = protect_dest_uri(outbound_profile); } if (!(nsession = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, @@ -4509,7 +4522,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session c++; tech_pvt->e_dest = switch_core_session_strdup(nsession, c); } - } else if ((host = strchr(dest, '%'))) { + } else if (!mod && !strchr(dest, '@') && (host = strchr(dest, '%'))) { char buf[1024]; *host = '@'; tech_pvt->e_dest = switch_core_session_strdup(nsession, dest); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 52307a2800..28ce0f8fb6 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -639,6 +639,7 @@ struct sofia_profile { unsigned int mndlb; uint32_t max_calls; uint32_t nonce_ttl; + uint32_t max_auth_validity; nua_t *nua; switch_memory_pool_t *pool; su_root_t *s_root; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0f0f492e99..7428a2d242 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -299,15 +299,15 @@ static void extract_vars(sofia_profile_t *profile, sip_t const *sip, switch_channel_t *channel = switch_core_session_get_channel(session); if (sip) { - if (sip->sip_from && sip->sip_from->a_url) + if (sip->sip_from) url_set_chanvars(session, sip->sip_from->a_url, sip_from); - if (sip->sip_request && sip->sip_request->rq_url) + if (sip->sip_request) url_set_chanvars(session, sip->sip_request->rq_url, sip_req); - if (sip->sip_to && sip->sip_to->a_url) + if (sip->sip_to) url_set_chanvars(session, sip->sip_to->a_url, sip_to); - if (sip->sip_contact && sip->sip_contact->m_url) + if (sip->sip_contact) url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); - if (sip->sip_referred_by && sip->sip_referred_by->b_url) + if (sip->sip_referred_by) url_set_chanvars(session, sip->sip_referred_by->b_url, sip_referred_by); if (sip->sip_to && sip->sip_to->a_tag) { switch_channel_set_variable(channel, "sip_to_tag", sip->sip_to->a_tag); @@ -585,7 +585,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event-package", sip->sip_event->o_type); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event-id", sip->sip_event->o_id); - if (sip->sip_contact && sip->sip_contact->m_url) { + if (sip->sip_contact) { switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s@%s", sip->sip_contact->m_url->url_user, sip->sip_contact->m_url->url_host); } @@ -748,7 +748,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, int acl_ok = 1; char *last_acl = NULL; - if (sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host + if (sip->sip_to && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host && sip->sip_payload && sip->sip_payload->pl_data ) { sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), NULL); @@ -1137,7 +1137,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro if (!fs) { if ((passerted = sip_p_asserted_identity(sip))) { - if (passerted->paid_url && passerted->paid_url->url_user) { + if (passerted->paid_url->url_user) { number = passerted->paid_url->url_user; } if (!zstr(passerted->paid_display)) { @@ -1574,14 +1574,12 @@ static void our_sofia_event_callback(nua_event_t event, if (sip->sip_referred_by) { referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_referred_by), 0); ref_by_user = sip->sip_referred_by->b_url->url_user; - } - else if(sip->sip_to && sip->sip_to->a_url) - { + } else if(sip->sip_to){ referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_to), 0); ref_by_user = sip->sip_to->a_url->url_user; } - if (sip->sip_to && sip->sip_to->a_url) { + if (sip->sip_to) { req_user = sip->sip_to->a_url->url_user; req_host = sip->sip_to->a_url->url_host; } @@ -2050,7 +2048,7 @@ void sofia_event_callback(nua_event_t event, switch(event) { case nua_i_terminated: - if ((status == 401 || status == 407 || status == 403) && sofia_private && sofia_private->uuid) { + if ((status == 401 || status == 407 || status == 403) && sofia_private) { switch_core_session_t *session; if ((session = switch_core_session_locate(sofia_private->uuid))) { @@ -2219,7 +2217,7 @@ void sofia_event_callback(nua_event_t event, if (sip->sip_from) { channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from); } - if (!channel_name && sip->sip_contact && sip->sip_contact->m_url) { + if (!channel_name && sip->sip_contact) { channel_name = url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); } if (sip->sip_referred_by) { @@ -2874,6 +2872,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void nua_set_params(profile->nua, SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO"), + SIPTAG_USER_AGENT(SIP_NONE), NUTAG_AUTOANSWER(0), NUTAG_AUTOACK(0), NUTAG_AUTOALERT(0), @@ -2913,7 +2912,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")), TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")), TAG_IF(profile->pres_type == PRES_TYPE_PNP, NUTAG_ALLOW_EVENTS("ua-profile")), - NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END()); + NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), + TAG_IF(strcasecmp(profile->user_agent, "_undef_"), SIPTAG_USER_AGENT_STR(profile->user_agent)), + TAG_END()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name); @@ -2945,6 +2946,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void NTATAG_SERVER_RPORT(profile->server_rport_level), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */ nua_set_params(node->nua, + SIPTAG_USER_AGENT(SIP_NONE), NUTAG_APPL_METHOD("OPTIONS"), NUTAG_APPL_METHOD("REFER"), NUTAG_APPL_METHOD("SUBSCRIBE"), @@ -2956,7 +2958,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void NUTAG_ALLOW("INFO"), TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")), TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)), - SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END()); + SIPTAG_SUPPORTED_STR(supported), + TAG_IF(strcasecmp(profile->user_agent, "_undef_"), SIPTAG_USER_AGENT_STR(profile->user_agent)), + TAG_END()); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activated db for %s\n", profile->name); @@ -4971,6 +4975,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } else if (!strcasecmp(var, "nonce-ttl")) { profile->nonce_ttl = atoi(val); + } else if (!strcasecmp(var, "max-auth-validity")) { + profile->max_auth_validity = atoi(val); } else if (!strcasecmp(var, "accept-blind-reg")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_BLIND_REG); @@ -5390,6 +5396,11 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting nonce TTL to 60 seconds\n"); profile->nonce_ttl = 60; } + + if (!profile->max_auth_validity) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting MAX Auth Validity to 0 Attempts\n"); + profile->max_auth_validity = 0; + } if (!profile->sdp_username) { profile->sdp_username = switch_core_strdup(profile->pool, "FreeSWITCH"); @@ -5889,8 +5900,8 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } if (sip && - sip->sip_from && sip->sip_from->a_url && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host && - sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { + sip->sip_from && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host && + sip->sip_to && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { sql = switch_mprintf("select 'appearance-index=1' from sip_subscriptions where expires > -1 and hostname='%q' and event='call-info' and " "sub_to_user='%q' and sub_to_host='%q'", mod_sofia_globals.hostname, sip->sip_to->a_url->url_user, @@ -6039,41 +6050,39 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } for (p_contact = sip->sip_contact; p_contact; p_contact = p_contact->m_next) { - if (p_contact->m_url) { - full_contact = sip_header_as_string(home, (void *) p_contact); - invite_contact = sofia_glue_strip_uri(full_contact); + full_contact = sip_header_as_string(home, (void *) p_contact); + invite_contact = sofia_glue_strip_uri(full_contact); - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_%d", i); - switch_channel_set_variable(a_channel, var_name, full_contact); + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_%d", i); + switch_channel_set_variable(a_channel, var_name, full_contact); - if (i == 0) { - switch_channel_set_variable(channel, "sip_redirected_to", full_contact); - switch_channel_set_variable(a_channel, "sip_redirected_to", full_contact); - } - - if (p_contact->m_url->url_user) { - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i); - switch_channel_set_variable(channel, var_name, p_contact->m_url->url_user); - switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_user); - } - if (p_contact->m_url->url_host) { - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_host_%d", i); - switch_channel_set_variable(channel, var_name, p_contact->m_url->url_host); - switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_host); - } - if (p_contact->m_url->url_params) { - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_params_%d", i); - switch_channel_set_variable(channel, var_name, p_contact->m_url->url_params); - switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_params); - } - - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_dialstring_%d", i); - switch_channel_set_variable_printf(channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact); - switch_channel_set_variable_printf(a_channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact); - stream.write_function(&stream, "%ssofia/%s/%s", i ? separator : "", sip_redirect_profile, invite_contact); - free(invite_contact); - i++; + if (i == 0) { + switch_channel_set_variable(channel, "sip_redirected_to", full_contact); + switch_channel_set_variable(a_channel, "sip_redirected_to", full_contact); } + + if (p_contact->m_url->url_user) { + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i); + switch_channel_set_variable(channel, var_name, p_contact->m_url->url_user); + switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_user); + } + if (p_contact->m_url->url_host) { + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_host_%d", i); + switch_channel_set_variable(channel, var_name, p_contact->m_url->url_host); + switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_host); + } + if (p_contact->m_url->url_params) { + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_params_%d", i); + switch_channel_set_variable(channel, var_name, p_contact->m_url->url_params); + switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_params); + } + + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_dialstring_%d", i); + switch_channel_set_variable_printf(channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact); + switch_channel_set_variable_printf(a_channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact); + stream.write_function(&stream, "%ssofia/%s/%s", i ? separator : "", sip_redirect_profile, invite_contact); + free(invite_contact); + i++; } redirect_dialstring = stream.data; @@ -7788,7 +7797,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_channel_set_variable(tech_pvt->channel, "transfer_disposition", "recv_replace"); - if (refer_to->r_url && refer_to->r_url->url_headers) { + if (refer_to->r_url->url_headers) { rep = (char *) switch_stristr("Replaces=", refer_to->r_url->url_headers); } @@ -8111,7 +8120,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t const char *port = NULL; const char *rep_h = NULL; - if (refer_to && refer_to->r_url && refer_to->r_url->url_port) { + if (refer_to && refer_to->r_url->url_port) { port = refer_to->r_url->url_port; } @@ -8125,7 +8134,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t nightmare_xfer_helper = switch_core_alloc(npool, sizeof(*nightmare_xfer_helper)); nightmare_xfer_helper->exten = switch_core_strdup(npool, exten); - if (refer_to->r_url && (refer_to->r_url->url_params || refer_to->r_url->url_headers)) { + if (refer_to->r_url->url_params || refer_to->r_url->url_headers) { if (refer_to->r_url->url_headers) { nightmare_xfer_helper->exten_with_params = switch_core_sprintf(npool, "{sip_invite_params=%s?%s}%s", @@ -8146,7 +8155,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t nightmare_xfer_helper->bridge_to_uuid = switch_core_strdup(npool, br_a); nightmare_xfer_helper->pool = npool; - if (refer_to->r_url && refer_to->r_url->url_headers) { + if (refer_to->r_url->url_headers) { char *h, *v, *hp; p = switch_core_session_strdup(session, refer_to->r_url->url_headers); while (p && *p) { @@ -8316,7 +8325,7 @@ static switch_status_t create_info_event(sip_t const *sip, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-Content-Type", sip->sip_content_type->c_type); } - if (sip->sip_from && sip->sip_from->a_url) { + if (sip->sip_from) { if (sip->sip_from->a_url->url_user) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-From-User", sip->sip_from->a_url->url_user); } @@ -8326,7 +8335,7 @@ static switch_status_t create_info_event(sip_t const *sip, } } - if (sip->sip_to && sip->sip_to->a_url) { + if (sip->sip_to) { if (sip->sip_to->a_url->url_user) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-To-User", sip->sip_to->a_url->url_user); } @@ -8337,7 +8346,7 @@ static switch_status_t create_info_event(sip_t const *sip, } - if (sip->sip_contact && sip->sip_contact->m_url) { + if (sip->sip_contact) { if (sip->sip_contact->m_url->url_user) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-Contact-User", sip->sip_contact->m_url->url_user); } @@ -8786,9 +8795,10 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia int is_tcp = 0, is_tls = 0; const char *uparams = NULL; char *name_params = NULL; + const char *req_uri = NULL; + char *req_user = NULL; - - if (sip && sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_params) { + if (sip && sip->sip_contact && sip->sip_contact->m_url->url_params) { uparams = sip->sip_contact->m_url->url_params; } else { uparams = NULL; @@ -8822,7 +8832,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia goto fail; } - if (!(sip->sip_contact && sip->sip_contact->m_url)) { + if (!(sip->sip_contact)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n"); nua_respond(nh, 400, "Missing Contact Header", TAG_END()); goto fail; @@ -8873,7 +8883,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia char *last_acl = NULL; const char *contact_host = NULL; - if (sip && sip->sip_contact && sip->sip_contact->m_url) { + if (sip && sip->sip_contact) { contact_host = sip->sip_contact->m_url->url_host; } @@ -9081,7 +9091,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } } - if (sip->sip_via || (sip->sip_contact && sip->sip_contact->m_url)) { + if (sip->sip_via || sip->sip_contact) { char tmp[35] = ""; const char *ipv6 = strchr(tech_pvt->mparams.remote_ip, ':'); @@ -9162,7 +9172,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_event_destroy(&v_event); } - if (sip->sip_from && sip->sip_from->a_url) { + if (sip->sip_from) { from_user = sip->sip_from->a_url->url_user; from_host = sip->sip_from->a_url->url_host; //channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from); @@ -9197,7 +9207,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } if ((rpid = sip_remote_party_id(sip))) { - if (rpid->rpid_url && rpid->rpid_url->url_user) { + if (rpid->rpid_url->url_user) { char *full_rpid_header = sip_header_as_string(nh->nh_home, (void *) rpid); from_user = rpid->rpid_url->url_user; if (!zstr(full_rpid_header)) { @@ -9213,7 +9223,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } if ((passerted = sip_p_asserted_identity(sip))) { - if (passerted->paid_url && passerted->paid_url->url_user) { + if (passerted->paid_url->url_user) { char *full_paid_header = sip_header_as_string(nh->nh_home, (void *) passerted); //char *full_paid_header = (char *)(passerted->paid_common->h_data); from_user = passerted->paid_url->url_user; @@ -9236,7 +9246,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } if ((ppreferred = sip_p_preferred_identity(sip))) { - if (ppreferred->ppid_url && ppreferred->ppid_url->url_user) { + if (ppreferred->ppid_url->url_user) { char *full_ppid_header = sip_header_as_string(nh->nh_home, (void *) ppreferred); from_user = ppreferred->ppid_url->url_user; if (!zstr(full_ppid_header)) { @@ -9262,58 +9272,55 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia extract_header_vars(profile, sip, session, nh); - if (sip->sip_request->rq_url) { - const char *req_uri = url_set_chanvars(session, sip->sip_request->rq_url, sip_req); - char *user = NULL; - if (sip->sip_request->rq_url->url_user) { + req_uri = url_set_chanvars(session, sip->sip_request->rq_url, sip_req); + if (sip->sip_request->rq_url->url_user) { - user = switch_core_session_strdup(session, sip->sip_request->rq_url->url_user); - if (profile->parse_invite_tel_params) { - if (strchr(user, ';')) { - int argc1, x1 = 0; - char *argv1[32] = { 0 }; + req_user = switch_core_session_strdup(session, sip->sip_request->rq_url->url_user); + if (profile->parse_invite_tel_params) { + if (strchr(req_user, ';')) { + int argc1, x1 = 0; + char *argv1[32] = { 0 }; - if ((argc1 = switch_separate_string(user, ';', argv1, (sizeof(argv1) / sizeof(argv1[0]))))) { - for (x1 = 0; x1 < argc1; x1++) { - if (x1 == 0) { - switch_channel_set_variable(channel, "sip_req_user", argv1[0]); + if ((argc1 = switch_separate_string(req_user, ';', argv1, (sizeof(argv1) / sizeof(argv1[0]))))) { + for (x1 = 0; x1 < argc1; x1++) { + if (x1 == 0) { + switch_channel_set_variable(channel, "sip_req_user", argv1[0]); + } else { + int argc2 = 0; + char *argv2[2] = { 0 }; + if ((argc2 = switch_separate_string(argv1[x1], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])))) == 2) { + char *var_name = NULL; + var_name = switch_mprintf("sip_invite_%s", argv2[0]); + switch_channel_set_variable(channel, var_name, argv2[1]); + switch_safe_free( var_name ); } else { - int argc2 = 0; - char *argv2[2] = { 0 }; - if ((argc2 = switch_separate_string(argv1[x1], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])))) == 2) { - char *var_name = NULL; - var_name = switch_mprintf("sip_invite_%s", argv2[0]); - switch_channel_set_variable(channel, var_name, argv2[1]); - switch_safe_free( var_name ); - } else { - char *var_name = NULL; - var_name = switch_mprintf("sip_invite_%s", argv1[x1]); - switch_channel_set_variable(channel, var_name, "true"); - switch_safe_free( var_name ); - } + char *var_name = NULL; + var_name = switch_mprintf("sip_invite_%s", argv1[x1]); + switch_channel_set_variable(channel, var_name, "true"); + switch_safe_free( var_name ); } } } } } } - - if (sofia_test_pflag(profile, PFLAG_FULL_ID)) { - destination_number = req_uri; - } else { - destination_number = user; - } - if (sip->sip_request->rq_url->url_params && (sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "intercom=true"))) { - switch_channel_set_variable(channel, "sip_auto_answer_detected", "true"); - } } - if (!destination_number && sip->sip_to && sip->sip_to->a_url) { + if (sofia_test_pflag(profile, PFLAG_FULL_ID)) { + destination_number = req_uri; + } else { + destination_number = req_user; + } + if (sip->sip_request->rq_url->url_params && (sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "intercom=true"))) { + switch_channel_set_variable(channel, "sip_auto_answer_detected", "true"); + } + + if (!destination_number && sip->sip_to) { destination_number = sip->sip_to->a_url->url_user; } /* The human network, OH THE HUMANITY!!! lets send invites with no number! */ - if (!destination_number && sip->sip_from && sip->sip_from->a_url) { + if (!destination_number && sip->sip_from) { destination_number = sip->sip_from->a_url->url_user; } @@ -9323,12 +9330,12 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia destination_number = "service"; } - if (sip->sip_to && sip->sip_to->a_url) { + if (sip->sip_to) { const char *host, *user; int port, check_nat = 0; url_t *transport_url; - if (sip->sip_record_route && sip->sip_record_route->r_url) { + if (sip->sip_record_route) { transport_url = sip->sip_record_route->r_url; } else { transport_url = sip->sip_contact->m_url; @@ -9430,7 +9437,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia nua_set_hparams(tech_pvt->nh, SIPTAG_VIA_STR(tech_pvt->user_via), TAG_END()); } - if (sip->sip_contact && sip->sip_contact->m_url) { + if (sip->sip_contact) { url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); } @@ -9574,8 +9581,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia char *state = "progressing"; if (sip && - sip->sip_from && sip->sip_from->a_url && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host && - sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { + sip->sip_from && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host && + sip->sip_to && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { sql = switch_mprintf("select 'appearance-index=1' from sip_subscriptions where expires > -1 and hostname='%q' and event='call-info' and " "sub_to_user='%q' and sub_to_host='%q'", mod_sofia_globals.hostname, sip->sip_to->a_url->url_user, @@ -9693,12 +9700,12 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia char *p = NULL; const char *user = NULL, *host = NULL, *from_user = NULL, *from_host = NULL; - if (sip->sip_to && sip->sip_to->a_url) { + if (sip->sip_to) { user = sip->sip_to->a_url->url_user; host = sip->sip_to->a_url->url_host; } - if (sip->sip_from && sip->sip_from->a_url) { + if (sip->sip_from) { from_user = sip->sip_from->a_url->url_user; from_host = sip->sip_from->a_url->url_host; } @@ -9827,7 +9834,9 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (b_call_id) { char *sql = switch_mprintf("update sip_dialogs set call_info_state='idle' where call_id='%q'", b_call_id); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "SQL: %s\n", sql); + if (mod_sofia_globals.debug_sla > 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "QUERY SQL %s\n", sql); + } sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); switch_channel_presence(b_channel, "unknown", "idle", NULL); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index c26c66740d..74d4395113 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2852,7 +2852,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua const char *ipv6; sip_from_t const *from; - if (!sip || !sip->sip_contact || !sip->sip_contact->m_url) { + if (!sip || !sip->sip_contact) { return NULL; } @@ -2933,7 +2933,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua np->is_nat = NULL; } - if (sip->sip_record_route && sip->sip_record_route->r_url) { + if (sip->sip_record_route) { char *full_contact = sip_header_as_string(nh->nh_home, (void *) contact); char *route = sofia_glue_strip_uri(sip_header_as_string(nh->nh_home, (void *) sip->sip_record_route)); char *full_contact_dup; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 5520e6ec76..7e31b4cfdd 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3704,7 +3704,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, use_to_tag = to_tag; } - if ( sip->sip_contact && sip->sip_contact->m_url ) { + if (sip->sip_contact) { contact_host = sip->sip_contact->m_url->url_host; contact_port = sip->sip_contact->m_url->url_port; contact_user = sip->sip_contact->m_url->url_user; @@ -4062,7 +4062,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, } - if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { + if (nh && nh->nh_ds->ds_usage) { /* nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); */ nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta, exp_delta); } @@ -5029,8 +5029,7 @@ void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip) char buf[512]; su_home_t *home = NULL; - if (!tech_pvt || tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url || - !sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) { + if (!tech_pvt || tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) { return; } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 7e26470d73..8c3e4b6fab 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1269,7 +1269,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu sofia_private = *sofia_private_p; } - if (sip && sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_params) { + if (sip && sip->sip_contact && sip->sip_contact->m_url->url_params) { uparams = sip->sip_contact->m_url->url_params; } else { uparams = NULL; @@ -2189,7 +2189,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port); /* backwards compatibility */ - if (mod_sofia_globals.reg_deny_binding_fetch_and_no_lookup && !(sip->sip_contact && sip->sip_contact->m_url)) { + if (mod_sofia_globals.reg_deny_binding_fetch_and_no_lookup && !sip->sip_contact) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT! ip: %s, port: %i\n", network_ip, network_port); nua_respond(nh, 400, "Missing Contact Header", TAG_END()); goto end; @@ -2226,7 +2226,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h char *last_acl = NULL; const char *contact_host = NULL; - if (sip && sip->sip_contact && sip->sip_contact->m_url) { + if (sip && sip->sip_contact) { contact_host = sip->sip_contact->m_url->url_host; } @@ -2492,7 +2492,7 @@ void sofia_reg_handle_sip_r_challenge(int status, } } - if (!gateway && !sip_auth_username && sip && sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { + if (!gateway && !sip_auth_username && sip && sip->sip_to && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { switch_xml_t x_user, x_param, x_params; switch_event_t *locate_params; @@ -2548,7 +2548,7 @@ void sofia_reg_handle_sip_r_challenge(int status, tl_gets(tags, NUTAG_CALLSTATE_REF(ss_state), SIPTAG_WWW_AUTHENTICATE_REF(authenticate), TAG_END()); nua_authenticate(nh, - TAG_IF(gateway, SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")), + TAG_IF(sofia_private && !zstr(sofia_private->gateway_name), SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")), NUTAG_AUTH(authentication), TAG_END()); goto end; @@ -2726,7 +2726,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, free(sql); //if (!sofia_glue_execute_sql2str(profile, profile->dbh_mutex, sql, np, nplen)) { - if (zstr(np)) { + if (zstr(np) || (profile->max_auth_validity != 0 && cb.last_nc >= profile->max_auth_validity )) { sql = switch_mprintf("delete from sip_authentication where nonce='%q'", nonce); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); ret = AUTH_STALE; diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 9c5272bad9..de942f14f5 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -885,6 +885,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_bool_t r = SWITCH_FALSE; const char *passwd = NULL; const char *login = NULL; + cJSON *login_params = NULL; if (!params) { *code = CODE_AUTH_FAILED; @@ -940,6 +941,23 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_event_create(&req_params, SWITCH_EVENT_REQUEST_PARAMS); switch_assert(req_params); + if ((login_params = cJSON_GetObjectItem(params, "loginParams"))) { + cJSON * i; + + for(i = login_params->child; i; i = i->next) { + if (i->type == cJSON_True) { + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, "true"); + } else if (i->type == cJSON_False) { + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, "false"); + } else if (!zstr(i->string) && !zstr(i->valuestring)) { + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, i->valuestring); + } + } + + DUMP_EVENT(req_params); + + } + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "action", "jsonrpc-authenticate"); if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, req_params) != SWITCH_STATUS_SUCCESS && !jsock->profile->blind_reg) { @@ -1664,7 +1682,7 @@ authed: char *expression = rule->name; if ((proceed = switch_regex_perform(request.uri, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%d request [%s] matched expr [%s]\n", proceed, request.uri, expression); request.uri = rule->value; break; @@ -1713,14 +1731,28 @@ done: if (pflags & SWITCH_POLL_READ) { ssize_t bytes; - bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen, wsh->block); + bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen - 1, wsh->block); if (bytes < 0) { die("BAD READ %" SWITCH_SIZE_T_FMT "\n", bytes); break; } + if (bytes == 0) { + bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen - 1, wsh->block); + + if (bytes < 0) { + die("BAD READ %" SWITCH_SIZE_T_FMT "\n", bytes); + break; + } + + if (bytes == 0) { // socket broken ? + break; + } + } + wsh->datalen += bytes; + *(wsh->buffer + wsh->datalen) = '\0'; if (strstr(wsh->buffer, "\r\n\r\n") || strstr(wsh->buffer, "\n\n")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "socket %s is going to handle a new request\n", jsock->name); diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index e990f7f815..8a46b65502 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -311,7 +311,7 @@ int ws_handshake(wsh_t *wsh) proto_buf); respond[511] = 0; - if (ws_raw_write(wsh, respond, strlen(respond)) != strlen(respond)) { + if (ws_raw_write(wsh, respond, strlen(respond)) != (ssize_t)strlen(respond)) { goto err; } @@ -406,7 +406,7 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) ssize_t r; int sanity = 2000; int ssl_err = 0; - ssize_t wrote = 0; + size_t wrote = 0; if (wsh->ssl) { do { diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 99a6415469..ae64880216 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -271,9 +271,10 @@ static void event_handler(switch_event_t *event) return; } + switch_mutex_lock(globals.listener_mutex); + lp = listen_list.listeners; - switch_mutex_lock(globals.listener_mutex); while (lp) { int send = 0; diff --git a/src/mod/event_handlers/mod_rayo/rayo_input_component.c b/src/mod/event_handlers/mod_rayo/rayo_input_component.c index 0eaabae613..a32cdf8602 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_input_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_input_component.c @@ -1,6 +1,6 @@ /* * mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2013-2014, Grasshopper + * Copyright (C) 2013-2015, Grasshopper * * Version: MPL 1.1 * @@ -383,6 +383,8 @@ static int validate_call_input(iks *input, const char **error) { iks *grammar; const char *content_type; + int has_grammar = 0; + int use_mrcp = 0; /* validate input attributes */ if (!VALIDATE_RAYO_INPUT(input)) { @@ -390,26 +392,48 @@ static int validate_call_input(iks *input, const char **error) return 0; } - /* missing grammar */ - grammar = iks_find(input, "grammar"); - if (!grammar) { + use_mrcp = !strncmp("unimrcp", iks_find_attrib(input, "recognizer") ? iks_find_attrib(input, "recognizer") : globals.default_recognizer, 7); + + /* validate grammar elements */ + for (grammar = iks_find(input, "grammar"); grammar; grammar = iks_next_tag(grammar)) { + /* is this a grammar? */ + if (strcmp("grammar", iks_name(grammar))) { + continue; + } + content_type = iks_find_attrib(grammar, "content-type"); + if (zstr(content_type)) { + /* grammar URL */ + if (zstr(iks_find_attrib(grammar, "url"))) { + *error = "url or content-type must be set"; + return 0; + } else if (!use_mrcp) { + *error = "url only supported with unimrcp recognizer"; + return 0; + } + } else { + /* inline grammar / only support srgs */ + if (!zstr(iks_find_attrib(grammar, "url"))) { + *error = "url not allowed with content-type"; + return 0; + } else if (strcmp("application/srgs+xml", content_type)) { + *error = "Unsupported content type"; + return 0; + } + + /* missing inline grammar body */ + if (zstr(iks_find_cdata(input, "grammar"))) { + *error = "Grammar content is missing"; + return 0; + } + } + has_grammar = 1; + } + + if (!has_grammar) { *error = "Missing "; return 0; } - /* only support srgs */ - content_type = iks_find_attrib(grammar, "content-type"); - if (!zstr(content_type) && strcmp("application/srgs+xml", content_type)) { - *error = "Unsupported content type"; - return 0; - } - - /* missing grammar body */ - if (zstr(iks_find_cdata(input, "grammar"))) { - *error = "Grammar content is missing"; - return 0; - } - return 1; } @@ -512,30 +536,35 @@ static char *setup_grammars_unimrcp(struct input_component *component, switch_co continue; } - /* get the srgs contained in this grammar */ - if (!(grammar_cdata = iks_child(grammar_tag)) || iks_type(grammar_cdata) != IKS_CDATA) { - *stanza_error = STANZA_ERROR_BAD_REQUEST; - *error_detail = "Missing grammar"; - switch_safe_free(grammar_uri_list.data); - return NULL; - } + if (!zstr(iks_find_attrib_soft(grammar_tag, "content-type"))) { + /* get the srgs contained in this grammar */ + if (!(grammar_cdata = iks_child(grammar_tag)) || iks_type(grammar_cdata) != IKS_CDATA) { + *stanza_error = STANZA_ERROR_BAD_REQUEST; + *error_detail = "Missing grammar"; + switch_safe_free(grammar_uri_list.data); + return NULL; + } - /* load the grammar */ - grammar = switch_core_sprintf(RAYO_POOL(component), "inline:%s", iks_cdata(grammar_cdata)); - grammar_name = switch_core_sprintf(RAYO_POOL(component), "grammar-%d", rayo_actor_seq_next(RAYO_ACTOR(component))); - /* unlock handler mutex, otherwise deadlock will happen if switch_ivr_detect_speech_load_grammar removes the media bug */ - switch_mutex_unlock(component->handler->mutex); - if (switch_ivr_detect_speech_load_grammar(session, grammar, grammar_name) != SWITCH_STATUS_SUCCESS) { + /* load the grammar */ + grammar = switch_core_sprintf(RAYO_POOL(component), "inline:%s", iks_cdata(grammar_cdata)); + grammar_name = switch_core_sprintf(RAYO_POOL(component), "grammar-%d", rayo_actor_seq_next(RAYO_ACTOR(component))); + /* unlock handler mutex, otherwise deadlock will happen if switch_ivr_detect_speech_load_grammar removes the media bug */ + switch_mutex_unlock(component->handler->mutex); + if (switch_ivr_detect_speech_load_grammar(session, grammar, grammar_name) != SWITCH_STATUS_SUCCESS) { + switch_mutex_lock(component->handler->mutex); + *stanza_error = STANZA_ERROR_INTERNAL_SERVER_ERROR; + *error_detail = "Failed to load grammar"; + switch_safe_free(grammar_uri_list.data); + return NULL; + } switch_mutex_lock(component->handler->mutex); - *stanza_error = STANZA_ERROR_INTERNAL_SERVER_ERROR; - *error_detail = "Failed to load grammar"; - switch_safe_free(grammar_uri_list.data); - return NULL; - } - switch_mutex_lock(component->handler->mutex); - /* add grammar to uri-list */ - grammar_uri_list.write_function(&grammar_uri_list, "session:%s\r\n", grammar_name); + /* add grammar to uri-list */ + grammar_uri_list.write_function(&grammar_uri_list, "session:%s\r\n", grammar_name); + } else { + /* add URI to uri-list */ + grammar_uri_list.write_function(&grammar_uri_list, "%s\r\n", iks_find_attrib_soft(grammar_tag, "url")); + } } switch_core_asr_text_param(ah, "start-recognize", "true"); diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 773e937912..b384d1a8a4 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -181,9 +181,6 @@ static inline void free_context(shout_context_t *context) while ((len = lame_encode_flush(context->gfp, mp3buffer, sizeof(mp3buffer))) > 0) { ret = fwrite(mp3buffer, 1, len, context->fp); - if (ret < 0) { - break; - } } lame_mp3_tags_fid(context->gfp, context->fp); @@ -899,7 +896,8 @@ static switch_status_t shout_file_close(switch_file_handle_t *handle) static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) { shout_context_t *context = handle->private_info; - + off_t seek_samples; + if (handle->handler || switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { return SWITCH_STATUS_FALSE; } else { @@ -908,10 +906,10 @@ static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned in } switch_buffer_zero(context->audio_buffer); - *cur_sample = mpg123_seek(context->mh, (off_t) samples, whence); + seek_samples = mpg123_seek(context->mh, (off_t) samples, whence); - if (*cur_sample >= 0) { - handle->pos = *cur_sample; + if (seek_samples >= 0) { + handle->pos = *cur_sample = seek_samples; return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/languages/mod_java/modjava.c b/src/mod/languages/mod_java/modjava.c index 663d9a0a9f..811237d5fd 100644 --- a/src/mod/languages/mod_java/modjava.c +++ b/src/mod/languages/mod_java/modjava.c @@ -128,6 +128,7 @@ static switch_status_t exec_user_method(user_method_t * userMethod) { if (class == NULL) { (*env)->ExceptionDescribe(env); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Class not found\n",userMethod->class); status = SWITCH_STATUS_FALSE; goto done; } @@ -136,6 +137,7 @@ static switch_status_t exec_user_method(user_method_t * userMethod) { if (method == NULL) { (*env)->ExceptionDescribe(env); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Method not found\n",userMethod->method); status = SWITCH_STATUS_FALSE; goto done; } @@ -145,6 +147,7 @@ static switch_status_t exec_user_method(user_method_t * userMethod) { if (arg == NULL) { (*env)->ExceptionDescribe(env); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Args not found\n"); status = SWITCH_STATUS_FALSE; goto done; } @@ -187,7 +190,7 @@ SWITCH_STANDARD_APP(java_function) static switch_status_t load_config(JavaVMOption **javaOptions, int *optionCount, vm_control_t * vmControl) { switch_xml_t cfg, xml; - switch_status_t status; + switch_status_t status = SWITCH_STATUS_SUCCESS; char *derr = NULL; xml = switch_xml_open_cfg("java.conf", &cfg, NULL); diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_es/mod_say_es.c index 8de56e861e..f648a72956 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -335,8 +335,10 @@ static switch_status_t es_say_time(switch_core_session_t *session, char *tosay, if (say_date) { say_file("time/day-%d.wav", tm.tm_wday); - say_file("time/mon-%d.wav", tm.tm_mon); say_num(tm.tm_mday, SSM_PRONOUNCED); + say_file("time/of.wav"); + say_file("time/mon-%d.wav", tm.tm_mon); + say_file("time/of.wav"); say_num(tm.tm_year + 1900, SSM_PRONOUNCED); } diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 56f4500b82..71f51d30ce 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -70,6 +70,7 @@ static struct { int timeout; switch_memory_pool_t *pool; switch_event_node_t *node; + char *cookie_file; } globals; SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load); @@ -330,6 +331,11 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file); } + if (globals.cookie_file) { + switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, globals.cookie_file); + switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, globals.cookie_file); + } + switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.timeout); /* these were used for testing, optionally they may be enabled if someone desires @@ -582,6 +588,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load) } else if (!strcasecmp(val, "any")) { globals.auth_scheme = (long)CURLAUTH_ANY; } + } else if (!strcasecmp(var, "cookie-file")) { + globals.cookie_file = switch_core_strdup(globals.pool, val); } } diff --git a/src/switch.c b/src/switch.c index 2433535152..5f0c9d82b3 100644 --- a/src/switch.c +++ b/src/switch.c @@ -90,24 +90,6 @@ static void handle_SIGILL(int sig) return; } -#ifndef WIN32 - -static void handle_SIGCHLD(int sig) -{ - int status = 0; - int pid = 0; - - if (sig) {}; - - pid = wait(&status); - if (pid > 0) { - system_ready = -1; - } - - return; -} -#endif - /* kill a freeswitch process running in background mode */ static int freeswitch_kill_background() { @@ -519,7 +501,7 @@ int main(int argc, char *argv[]) char *local_argv[1024] = { 0 }; int local_argc = argc; char *arg_argv[128] = { 0 }; - int alt_dirs = 0, log_set = 0, run_set = 0, do_kill = 0; + int alt_dirs = 0, alt_base = 0, log_set = 0, run_set = 0, do_kill = 0; int priority = 0; #ifdef __sun switch_core_flag_t flags = SCF_USE_SQL; @@ -898,6 +880,7 @@ int main(int argc, char *argv[]) return 255; } strcpy(SWITCH_GLOBAL_dirs.base_dir, local_argv[x]); + alt_base = 1; } else if (!strcmp(local_argv[x], "-temp")) { @@ -1046,7 +1029,7 @@ int main(int argc, char *argv[]) return 255; } - if (alt_dirs && alt_dirs != 3) { + if (alt_dirs && alt_dirs != 3 && !alt_base) { fprintf(stderr, "You must specify all or none of -conf, -log, and -db\n"); return 255; } @@ -1088,8 +1071,6 @@ int main(int argc, char *argv[]) fprintf(stderr, "System Error!\n"); exit(-1); } - - signal(SIGCHLD, handle_SIGCHLD); } #endif diff --git a/src/switch_core.c b/src/switch_core.c index b2216ec2b5..85947c25ca 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1813,16 +1813,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc } -#ifndef WIN32 -static void handle_SIGCHLD(int sig) -{ - int status = 0; - - wait(&status); - return; -} -#endif - #ifdef TRAP_BUS static void handle_SIGBUS(int sig) { @@ -2311,13 +2301,6 @@ SWITCH_DECLARE(void) switch_core_set_signal_handlers(void) { /* set signal handlers */ signal(SIGINT, SIG_IGN); -#ifndef WIN32 - if (switch_test_flag((&runtime), SCF_THREADED_SYSTEM_EXEC)) { - signal(SIGCHLD, SIG_DFL); - } else { - signal(SIGCHLD, handle_SIGCHLD); - } -#endif #ifdef SIGPIPE signal(SIGPIPE, SIG_IGN); #endif diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 3718dfb3a4..d6f7009097 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -581,7 +581,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch const char *new_stereo = orig_stereo; switch_thread_rwlock_wrlock(orig_session->bug_rwlock); - + switch_channel_set_variable(new_channel, "RECORD_MIN_SEC", "0"); switch_channel_set_variable(new_channel, "record_append", "true"); switch_channel_set_variable(new_channel, "record_stereo", new_stereo); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 60de27c73e..2755d90a4b 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1183,7 +1183,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s { const char *var = switch_channel_get_variable(channel, "RECORD_USE_THREAD"); - if (zstr(var) || switch_true(var)) { + if (!rh->native && rh->fh && (zstr(var) || switch_true(var))) { switch_threadattr_t *thd_attr = NULL; switch_memory_pool_t *pool = switch_core_session_get_pool(session); int sanity = 200; @@ -1758,6 +1758,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session char cid_buf[1024] = ""; switch_caller_profile_t *cp = NULL; uint32_t sanity = 600; + switch_media_bug_flag_t read_flags = 0, write_flags = 0; if (!switch_channel_media_up(channel)) { goto end; @@ -1847,6 +1848,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session write_frame.buflen = sizeof(buf); write_frame.rate = codec.implementation->actual_samples_per_second; + /* Make sure that at least one leg is bridged, default to both */ + if (! (flags & (ED_BRIDGE_READ | ED_BRIDGE_WRITE))) { + flags |= ED_BRIDGE_READ | ED_BRIDGE_WRITE; + } + ep->eavesdropper = session; ep->flags = flags; switch_mutex_init(&ep->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession)); @@ -1862,10 +1868,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session switch_buffer_add_mutex(ep->r_buffer, ep->r_mutex); + if (flags & ED_BRIDGE_READ) { + read_flags = SMBF_READ_STREAM | SMBF_READ_REPLACE; + } + if (flags & ED_BRIDGE_WRITE) { + write_flags = SMBF_WRITE_STREAM | SMBF_WRITE_REPLACE; + } + if (switch_core_media_bug_add(tsession, "eavesdrop", uuid, eavesdrop_callback, ep, 0, - SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | - SMBF_READ_PING | SMBF_THREAD_LOCK | SMBF_NO_PAUSE, + read_flags | write_flags | SMBF_READ_PING | SMBF_THREAD_LOCK | SMBF_NO_PAUSE, &bug) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot attach bug\n"); goto end; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 2bb5bb466a..eda1d6ef01 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -2463,12 +2463,10 @@ SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *sessio if (cache_obj->timer.interval) { switch_core_timer_destroy(&cache_obj->timer); } - if (&cache_obj->sh && cache_obj->sh.speech_interface) { + if (cache_obj->sh.speech_interface) { switch_core_speech_close(&cache_obj->sh, &flags); } - if (&cache_obj->codec) { - switch_core_codec_destroy(&cache_obj->codec); - } + switch_core_codec_destroy(&cache_obj->codec); switch_channel_set_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME, NULL); } } diff --git a/src/switch_pcm.c b/src/switch_pcm.c index eaa099e32c..73e266da01 100644 --- a/src/switch_pcm.c +++ b/src/switch_pcm.c @@ -393,12 +393,12 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) } for (; countb > 0; countb--) { switch_core_codec_add_implementation(pool, codec_interface, - SWITCH_CODEC_TYPE_AUDIO, 70, "L16", NULL, rate, rate, bps, + SWITCH_CODEC_TYPE_AUDIO, 100, "L16", NULL, rate, rate, bps, mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, spf * countb, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy); switch_core_codec_add_implementation(pool, codec_interface, - SWITCH_CODEC_TYPE_AUDIO, 70, "L16", NULL, rate, rate, bps, + SWITCH_CODEC_TYPE_AUDIO, 100, "L16", NULL, rate, rate, bps, mpf * countb, spf * countb, bpf * countb * 2, ebpf * countb, 2, spf * countb, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy); } @@ -415,7 +415,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 5; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 12000, /* samples transferred per second */ @@ -433,7 +433,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 12000, /* samples transferred per second */ @@ -462,7 +462,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 3; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 24000, /* samples transferred per second */ @@ -480,7 +480,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 24000, /* samples transferred per second */ @@ -511,7 +511,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 5; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 48000, /* samples transferred per second */ @@ -529,7 +529,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 48000, /* samples transferred per second */ @@ -559,7 +559,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 4; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 8000, /* samples transferred per second */ @@ -577,7 +577,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 8000, /* samples transferred per second */ @@ -606,7 +606,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 4; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 16000, /* samples transferred per second */ @@ -624,7 +624,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 16000, /* samples transferred per second */ @@ -654,7 +654,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 4; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 32000, /* samples transferred per second */ @@ -672,7 +672,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 32000, /* samples transferred per second */ @@ -701,7 +701,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) /* 10ms is already registered */ for (x = 0; x < 3; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 48000, /* samples transferred per second */ @@ -719,7 +719,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 48000, /* samples transferred per second */ @@ -747,7 +747,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 3; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 44100, /* samples transferred per second */ @@ -765,7 +765,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 44100, /* samples transferred per second */ @@ -791,7 +791,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 22050, /* samples transferred per second */ @@ -809,7 +809,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 22050, /* samples transferred per second */ @@ -827,7 +827,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 11025, /* samples transferred per second */ @@ -845,7 +845,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 11025, /* samples transferred per second */ @@ -864,7 +864,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 11025, /* samples transferred per second */ @@ -882,7 +882,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 70, /* the IANA code number */ + 100, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 11025, /* samples transferred per second */ diff --git a/src/switch_pgsql.c b/src/switch_pgsql.c index 74eea5cb8e..4d955f1f45 100644 --- a/src/switch_pgsql.c +++ b/src/switch_pgsql.c @@ -525,7 +525,7 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_exec_string_detailed(c goto error; } - if (!result) { + if (result) { switch (result->status) { #if POSTGRESQL_MAJOR_VERSION >= 9 && POSTGRESQL_MINOR_VERSION >= 2 case PGRES_SINGLE_TUPLE: diff --git a/src/switch_rtp.c b/src/switch_rtp.c index ad93d8ee71..91905df22f 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1154,6 +1154,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d host, port); switch_rtp_change_ice_dest(rtp_session, ice, host, port); + ice->last_ok = now; } @@ -2009,14 +2010,14 @@ static int rtcp_stats(switch_rtp_t *rtp_session) stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->timer.samplecount); #endif /* Interarrival jitter calculation */ - pkt_tsdiff = rtp_session->timer.samplecount - ntohl(hdr->ts) ; /* relative transit times for this packet */ + pkt_tsdiff = abs((int)rtp_session->timer.samplecount - (int)ntohl(hdr->ts)); /* relative transit times for this packet */ if (stats->pkt_count < 2) { /* Can not compute Jitter with only one packet */ stats->last_pkt_tsdiff = pkt_tsdiff; } else { - packet_spacing_diff = pkt_tsdiff - stats->last_pkt_tsdiff; /* Jitter : difference of relative transit times for the two packets */ + packet_spacing_diff = abs((int)pkt_tsdiff - (int)stats->last_pkt_tsdiff); /* Jitter : difference of relative transit times for the two packets */ stats->last_pkt_tsdiff = pkt_tsdiff; /* Interarrival jitter estimation, "J(i) = J(i-1) + ( |D(i-1,i)| - J(i-1) )/16" */ - stats->inter_jitter = (stats->inter_jitter + (((double)abs(packet_spacing_diff) - stats->inter_jitter) /16.)); + stats->inter_jitter = (stats->inter_jitter + (((double)packet_spacing_diff - stats->inter_jitter) /16.)); } #ifdef DEBUG_RTCP diff --git a/src/switch_time.c b/src/switch_time.c index c226b90592..be3debf560 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -413,12 +413,12 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval return SWITCH_STATUS_GENERR; } - val.it_interval.tv_sec = 0; - val.it_interval.tv_nsec = interval * 1000000; + val.it_interval.tv_sec = interval / 1000; + val.it_interval.tv_nsec = (interval % 1000) * 1000000; val.it_value.tv_sec = 0; - val.it_value.tv_nsec = val.it_interval.tv_nsec; + val.it_value.tv_nsec = 100000; - if (timerfd_settime(fd, TFD_TIMER_ABSTIME, &val, NULL) < 0) { + if (timerfd_settime(fd, 0, &val, NULL) < 0) { close(fd); return SWITCH_STATUS_GENERR; } @@ -1038,10 +1038,10 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) if (tfd > -1) { spec.it_interval.tv_sec = 0; spec.it_interval.tv_nsec = runtime.microseconds_per_tick * 1000; - spec.it_value.tv_sec = spec.it_interval.tv_sec; - spec.it_value.tv_nsec = spec.it_interval.tv_nsec; + spec.it_value.tv_sec = 0; + spec.it_value.tv_nsec = 100000; - if (timerfd_settime(tfd, TFD_TIMER_ABSTIME, &spec, NULL)) { + if (timerfd_settime(tfd, 0, &spec, NULL)) { close(tfd); tfd = -1; } @@ -1109,7 +1109,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) #ifdef HAVE_TIMERFD_CREATE if (last_MICROSECONDS_PER_TICK != runtime.microseconds_per_tick) { spec.it_interval.tv_nsec = runtime.microseconds_per_tick * 1000; - timerfd_settime(tfd, TFD_TIMER_ABSTIME, &spec, NULL); + timerfd_settime(tfd, 0, &spec, NULL); } last_MICROSECONDS_PER_TICK = runtime.microseconds_per_tick; diff --git a/src/switch_utils.c b/src/switch_utils.c index 905442e6ce..c0963aeb9e 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -3464,42 +3464,21 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val) SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val) { - char *p; - - if ((p = strchr(exp, '-'))) { - int min; - int max; - - min = atol(exp); - p++; - max = atol(p); - - if (val >= min && val <= max) { - return 1; - } - } else if ((p = strchr(exp, ','))) { - const char *cur = exp; - p++; - while (cur) { - if (atol(cur) == val) { + // Expression exp must be a comma separated list of numbers or ranges. + // To match numbers not in range 9-17, enter the reversed range 18-8. + for (;; ++exp) { + int a = strtol(exp, (char **)&exp, 10); + if (*exp != '-') { + if (a == val) + return 1; + } else { + int b = strtol(++exp, (char **)&exp, 10); + if (a <= b ? (val >= a && val <=b ) : (val >= a || val <= b)) return 1; - } - - cur = p; - if (p && p + 1) { - if ((p = strchr((p + 1), ','))) { - p++; - } - } - } - } else { - if (atol(exp) == val) { - return 1; } + if (*exp != ',') + return 0; } - - return 0; - } SWITCH_DECLARE(int) switch_tod_cmp(const char *exp, int val) diff --git a/support-d/.bashrc b/support-d/.bashrc index 05b3b38149..531c44bdfc 100644 --- a/support-d/.bashrc +++ b/support-d/.bashrc @@ -35,6 +35,21 @@ if [ "`id -u`" = "0" ]; then fi fi +if [ "${UNAME}" = "Darwin" ]; then + if [ -d ~/src/depot_tools ]; then + export PATH=$PATH:~/src/depot_tools + fi + if [ -d "/Applications/Chromium.app" ]; then + alias chromium='CHROME_LOG_FILE=chrome.log /Applications/Chromium.app/Contents/MacOS/Chromium --args --enable-usermedia-screen-capturing --usermedia-screen-capturing --enable-logging --v=1 --vmodule=*source*/talk/*=5 2>&1 | tee console.log' + fi + if [ -d "/Applications/Google Chrome Canary.app" ]; then + alias canary='CHROME_LOG_FILE=chrome.log /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --args --enable-usermedia-screen-capturing --usermedia-screen-capturing --enable-logging --v=1 --vmodule=*source*/talk/*=5 2>&1 | tee console.log' + fi + if [ -d "/Applications/Google Chrome.app" ]; then + alias chrome='CHROME_LOG_FILE=chrome.log /Applications/Google\ Chrome.app/Concd outtents/MacOS/Google\ Chrome --args --enable-usermedia-screen-capturing --usermedia-screen-capturing --enable-logging --v=1 --vmodule=*source*/talk/*=5 2>&1 | tee console.log' + fi +fi + if [ ! -f ~/.inputrc ]; then export INPUTRC="/etc/inputrc" fi @@ -58,16 +73,21 @@ alias emcas='emacs' alias meacs='emacs' alias mecas='emacs' alias bgit='git commit --author "Brian West "' -alias mgit='git commit --author "Mike Jerris "' +alias mgit='git commit --author "Mike Jerris "' alias tgit='git commit --author "Anthony Minessale "' alias dp='emacs /usr/local/freeswitch/conf/dialplan/default.xml' alias go='/usr/local/freeswitch/bin/freeswitch -nonat' alias fstop='top -p `cat /usr/local/freeswitch/run/freeswitch.pid`' +alias fsgcore='gcore `cat /usr/local/freeswitch/run/freeswitch.pid`' alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/run/freeswitch.pid`' alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`' alias emacs='emacs -nw' -alias jitteron='tc qdisc add dev eth0 root handle 1: netem delay 40ms 20ms ; tc qdisc add dev eth0 parent 1:1 pfifo limit 1000' -alias jitteroff='tc qdisc del dev eth0 root netem' + +if [ "${UNAME}" = "Linux" ]; then + alias govg='valgrind --tool=memcheck --log-file=vg.log --leak-check=full --leak-resolution=high --show-reachable=yes .libs/freeswitch -vg' + alias jitteron='tc qdisc add dev eth0 root handle 1: netem delay 40ms 20ms ; tc qdisc add dev eth0 parent 1:1 pfifo limit 1000' + alias jitteroff='tc qdisc del dev eth0 root netem' +fi # Auto Update the .bashrc if hostname contains freeswitch.org if [[ $(hostname) =~ "freeswitch.org" ]]; then