Merge branch 'master' into v1.4

Conflicts:
	build/next-release.txt
This commit is contained in:
Ken Rice 2015-03-12 13:51:12 -05:00
commit 5a650e4c2f
96 changed files with 788 additions and 426 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -1 +1 @@
1.4.16
1.4.17

View File

@ -5,6 +5,7 @@
<profile name="internal-ipv6">
<!--aliases are other names that will work as a valid profile name for this profile-->
<settings>
<!-- Can be set to "_undef_" to remove the User-Agent header -->
<!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
<param name="debug" value="0"/>
<param name="sip-trace" value="no"/>

View File

@ -36,6 +36,8 @@
bypass media after an attended transfer.
-->
<!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
<!-- Can be set to "_undef_" to remove the User-Agent header -->
<!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
<param name="debug" value="0"/>
<param name="sip-trace" value="no"/>

View File

@ -129,6 +129,8 @@
</gateways>
<settings>
<!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
<!-- Can be set to "_undef_" to remove the User-Agent header -->
<param name="user-agent-string" value="FreeSWITCH/SoftPhone"/>
<!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
<param name="debug" value="0"/>

View File

@ -110,7 +110,7 @@
<!-- <load module="mod_posix_timer"/> -->
<!-- Languages -->
<load module="mod_v8"/>
<!-- <load module="mod_v8"/> -->
<!-- <load module="mod_perl"/> -->
<!-- <load module="mod_python"/> -->
<!-- <load module="mod_java"/> -->

View File

@ -34,6 +34,9 @@
<param name="spool-dir" value="$${temp_dir}"/>
<param name="file-prefix" value="faxrx"/>
<!-- How many packets to process before sending the re-invite on tx/rx -->
<!-- <param name="t38-rx-reinvite-packet-count" value="50"/> -->
<!-- <param name="t38-tx-reinvite-packet-count" value="100"/> -->
</fax-settings>
<descriptors>

View File

@ -152,7 +152,7 @@
<param name="rtp-enable-zrtp" value="true"/>
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE' application_name='freeswitch'" /> -->
<!-- <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE'" /> -->
<!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
<!--
Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for

View File

@ -66,6 +66,6 @@
<!-- <param name="ssl-version" value="TLSv1"/> -->
<!-- optional: enables cookies and stores them in the specified file. -->
<!-- <param name="cookie-file" value="/$${temp_dir}/cookie-mod_xml_curl.txt"/> -->
<!-- <param name="cookie-file" value="$${run_dir}/mod_xml_cdr-cookie.txt"/> -->
</settings>
</configuration>

View File

@ -5,6 +5,7 @@
<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
<!--aliases are other names that will work as a valid profile name for this profile-->
<settings>
<!-- Can be set to "_undef_" to remove the User-Agent header -->
<!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
<param name="debug" value="0"/>
<param name="sip-trace" value="no"/>

View File

@ -42,7 +42,10 @@
bypass media after an attended transfer.
-->
<!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
<!-- Can be set to "_undef_" to remove the User-Agent header -->
<!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
<param name="debug" value="0"/>
<!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. -->
<!-- <param name="shutdown-on-fail" value="true"/> -->

View File

@ -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)

2
debian/rules vendored
View File

@ -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

View File

@ -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 - <krice AT freeswitch.org> - Stable Branch Maintainer, xmlcdr, sofia improvements, load testing, 1 liners here and there.
Travis Cross <tc@traviscross.com> - 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 - <justinunger at gmail dot com> Lots of help with patches and SIP testing. Thanks!
Paul D. Tinsley - Various patches and support. <pdt at jackhammer.org>
Ken Rice - <krice AT freeswitch.org> - xmlcdr, sofia improvements, load testing, 1 liners here and there.
Travis Cross <tc@traviscross.com> - git migration, Debian packaging, ZRTP integration, mod_prefix, and many other improvements
Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr menu additions and other tweaks.
Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups.
Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug finding and usability enhancements.

View File

@ -222,6 +222,7 @@ I will translate them anyways
<prompt phrase="Noviembre" filename="mon-10.wav"/>
<prompt phrase="Diciembre" filename="mon-11.wav"/>
<prompt phrase="En punto" filename="oclock.wav"/>
<prompt phrase="de" filename="of.wav"/>
<prompt phrase="oh" filename="oh.wav"/>
<prompt phrase="P.M." filename="p-m.wav"/>
<prompt phrase="Segundo" filename="second.wav"/>

View File

@ -171,6 +171,7 @@
<prompt phrase="Noviembre" filename="mon-10.wav"/>
<prompt phrase="Diciembre" filename="mon-11.wav"/>
<prompt phrase="En punto" filename="oclock.wav"/>
<prompt phrase="de" filename="of.wav"/>
<prompt phrase="P.M." filename="p-m.wav"/>
<prompt phrase="Segundo" filename="second.wav"/>
<prompt phrase="Segundos" filename="seconds.wav"/>

View File

@ -170,6 +170,7 @@
<prompt phrase="Noviembre" filename="mon-10.wav"/>
<prompt phrase="Diciembre" filename="mon-11.wav"/>
<prompt phrase="En punto" filename="oclock.wav"/>
<prompt phrase="de" filename="of.wav"/>
<prompt phrase="P.M." filename="p-m.wav"/>
<prompt phrase="Segundo" filename="second.wav"/>
<prompt phrase="Segundos" filename="seconds.wav"/>

View File

@ -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 <anthm@freeswitch.org>
# Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
#
# 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

View File

@ -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<this._requests.length;i++){call=this._requests[i];batch_request.push(c
success_cb=function(data){self._batchCb(data,handlers,self.all_done_cb);};if(self.jsonrpcclient.options.ajaxUrl===null){throw"$.JsonRpcClient.batch used with no websocket and no http endpoint.";}
$.ajax({url:self.jsonrpcclient.options.ajaxUrl,data:$.toJSON(batch_request),dataType:'json',cache:false,type:'POST',error:function(jqXHR,textStatus,errorThrown){self.error_cb(jqXHR,textStatus,errorThrown);},success:success_cb});};$.JsonRpcClient._batchObject.prototype._batchCb=function(result,handlers,all_done_cb){for(var i=0;i<result.length;i++){var response=result[i];if('error'in response){if(response.id===null||!(response.id in handlers)){if('console'in window)console.log(response);}else{handlers[response.id].error_cb(response.error,this);}}else{if(!(response.id in handlers)&&'console'in window){console.log(response);}else{handlers[response.id].success_cb(response.result,this);}}}
if(typeof all_done_cb==='function')all_done_cb(result);};})(jQuery);(function($){var generateGUID=(typeof(window.crypto)!=='undefined'&&typeof(window.crypto.getRandomValues)!=='undefined')?function(){var buf=new Uint16Array(8);window.crypto.getRandomValues(buf);var S4=function(num){var ret=num.toString(16);while(ret.length<4){ret="0"+ret;}
return ret;};return(S4(buf[0])+S4(buf[1])+"-"+S4(buf[2])+"-"+S4(buf[3])+"-"+S4(buf[4])+"-"+S4(buf[5])+S4(buf[6])+S4(buf[7]));}:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};$.verto=function(options,callbacks){var verto=this;$.verto.saved.push(verto);verto.options=$.extend({login:null,passwd:null,socketUrl:null,tag:null,videoParams:{},audioParams:{},iceServers:false,ringSleep:6000},options);verto.sessid=$.cookie('verto_session_uuid')||generateGUID();$.cookie('verto_session_uuid',verto.sessid,{expires:1});verto.dialogs={};verto.callbacks=callbacks||{};verto.eventSUBS={};verto.rpcClient=new $.JsonRpcClient({login:verto.options.login,passwd:verto.options.passwd,socketUrl:verto.options.socketUrl,sessid:verto.sessid,onmessage:function(e){return verto.handleMessage(e.eventData);},onWSConnect:function(o){o.call('login',{});},onWSLogin:function(success){if(verto.callbacks.onWSLogin){verto.callbacks.onWSLogin(verto,success);}},onWSClose:function(success){if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,success);}
return ret;};return(S4(buf[0])+S4(buf[1])+"-"+S4(buf[2])+"-"+S4(buf[3])+"-"+S4(buf[4])+"-"+S4(buf[5])+S4(buf[6])+S4(buf[7]));}:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};$.verto=function(options,callbacks){var verto=this;$.verto.saved.push(verto);verto.options=$.extend({login:null,passwd:null,socketUrl:null,tag:null,videoParams:{},audioParams:{},loginParams:{},iceServers:false,ringSleep:6000},options);verto.sessid=$.cookie('verto_session_uuid')||generateGUID();$.cookie('verto_session_uuid',verto.sessid,{expires:1});verto.dialogs={};verto.callbacks=callbacks||{};verto.eventSUBS={};verto.rpcClient=new $.JsonRpcClient({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);},onWSConnect:function(o){o.call('login',{});},onWSLogin:function(success){if(verto.callbacks.onWSLogin){verto.callbacks.onWSLogin(verto,success);}},onWSClose:function(success){if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,success);}
verto.purge();}});if(verto.options.ringFile&&verto.options.tag){verto.ringer=$("#"+verto.options.tag);}
verto.rpcClient.call('login',{});};$.verto.prototype.videoParams=function(on){var verto=this;verto.options.videoParams=on;};$.verto.prototype.iceServers=function(on){var verto=this;verto.options.iceServers=on;};$.verto.prototype.loginData=function(params){verto.options.login=params.login;verto.options.passwd=params.passwd;verto.rpcClient.loginData(params);};$.verto.prototype.logout=function(msg){var verto=this;verto.rpcClient.closeSocket();if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,false);}
verto.purge();};$.verto.prototype.login=function(msg){var verto=this;verto.logout();verto.rpcClient.call('login',{});};$.verto.prototype.message=function(msg){var verto=this;var err=0;if(!msg.to){console.error("Missing To");err++;}
@ -203,7 +203,7 @@ if(err){return false;}
dialog.sendMethod("verto.info",{msg:msg});return true;};$.verto.dialog.prototype.answer=function(params){var dialog=this;if(!dialog.answered){if(params){if(params.useVideo){dialog.useVideo(true);}
dialog.params.callee_id_name=params.callee_id_name;dialog.params.callee_id_number=params.callee_id_number;}
dialog.rtc.createAnswer(dialog.params.sdp);dialog.answered=true;}};$.verto.dialog.prototype.handleAnswer=function(params){var dialog=this;dialog.gotAnswer=true;if(dialog.state.val>=$.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?" &lt;":" <")+dialog.params.remote_caller_id_number+(enc?"&gt;":">");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?" &lt;":" <")+dialog.params.remote_caller_id_number+(enc?"&gt;":">");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();}}

View File

@ -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;

View File

@ -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);

View File

@ -20,7 +20,6 @@
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
AUTOMAKE_OPTIONS = subdir-objects
noinst_SCRIPTS = broadvoice.spec

View File

@ -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 \

View File

@ -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;
}

View File

@ -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",

View File

@ -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 <openssl/safestack.h>])
fi
if test x$HAVE_SSL = x1; then

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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 ;

View File

@ -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))))

View File

@ -4,7 +4,6 @@
#
# Viktor Krikun <v.krikun@soft-industry.com> <v.krikun@gmail.com>
#
AUTOMAKE_OPTIONS = subdir-objects
libzrtp_includedir=$(includedir)/libzrtp
libzrtp_include_HEADERS = \

View File

@ -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)

View File

@ -1 +1 @@
Wed Jan 7 11:24:56 PST 2015
Wed Feb 11 12:35:25 EST 2015

View File

@ -5,7 +5,7 @@
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# 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 \

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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:

View File

@ -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;
}

View File

@ -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 {

View File

@ -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 <openssl/safestack.h>])
fi
if test x$HAVE_OPENSSL = x1; then

View File

@ -5,8 +5,6 @@
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
AUTOMAKE_OPTIONS = subdir-objects
# ----------------------------------------------------------------------
# Header paths

View File

@ -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

View File

@ -87,7 +87,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -124,7 +124,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories>
<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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -159,7 +159,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -197,7 +197,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories>
<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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>

View File

@ -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
)

View File

@ -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 () {

View File

@ -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/.

View File

@ -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 <<EOF
----------------------------------------------------------------------

4
scripts/ci/test_build.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
./bootstrap.sh -j
./configure -C
make

View File

@ -46,6 +46,13 @@
#pragma warning (disable:167)
#endif
static void fs_encode_cleanup()
{
switch_safe_free(SWITCH_GLOBAL_dirs.conf_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.mod_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.log_dir);
}
int main(int argc, char *argv[])
{
int r = 1;
@ -75,6 +82,27 @@ int main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
switch(argv[i][1]) {
case 'c':
i++;
if((SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(argv[i]) + 1)) == NULL) {
return 255;
}
strcpy(SWITCH_GLOBAL_dirs.conf_dir, argv[i]);
break;
case 'k':
i++;
if((SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(argv[i]) + 1)) == NULL) {
return 255;
}
strcpy(SWITCH_GLOBAL_dirs.log_dir, argv[i]);
break;
case 'm':
i++;
if((SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(argv[i]) + 1)) == NULL) {
return 255;
}
strcpy(SWITCH_GLOBAL_dirs.mod_dir, argv[i]);
break;
case 'l':
i++;
/* Load extra modules */
@ -129,6 +157,7 @@ int main(int argc, char *argv[])
switch_loadable_module_init(SWITCH_FALSE);
switch_loadable_module_load_module("", "CORE_PCM_MODULE", SWITCH_TRUE, &err);
switch_loadable_module_load_module("", "CORE_SPEEX_MODULE", SWITCH_TRUE, &err);
switch_loadable_module_load_module("", "CORE_SOFTTIMER_MODULE", SWITCH_TRUE, &err);
for (i = 0; i < extra_modules_count; i++) {
if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) extra_modules[i], SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
@ -288,6 +317,8 @@ end:
if (pool) {
switch_core_destroy_memory_pool(&pool);
}
fs_encode_cleanup();
//switch_core_destroy();
@ -295,12 +326,16 @@ end:
usage:
printf("Usage: %s [options] input output\n\n", argv[0]);
printf("The output must end in the format, e.g., myfile.SPEEX\n");
printf("\t\t -c path\t\t Path to the FS configurations.\n");
printf("\t\t -k path\t\t Path to the FS log directory\n");
printf("\t\t -l module[,module]\t Load additional modules (comma-separated)\n");
printf("\t\t -m path\t\t Path to the modules.\n");
printf("\t\t -f format\t\t fmtp to pass to the codec\n");
printf("\t\t -p ptime\t\t ptime to use while encoding\n");
printf("\t\t -r rate\t\t sampling rate\n");
printf("\t\t -b bitrate\t\t codec bitrate (if supported)\n");
printf("\t\t -v\t\t\t verbose\n");
fs_encode_cleanup();
return 1;
}

View File

@ -331,7 +331,9 @@ typedef enum {
ED_MUX_READ = (1 << 0),
ED_MUX_WRITE = (1 << 1),
ED_DTMF = (1 << 2),
ED_COPY_DISPLAY = (1 << 3)
ED_COPY_DISPLAY = (1 << 3),
ED_BRIDGE_READ = (1 << 4),
ED_BRIDGE_WRITE = (1 << 5)
} switch_eavesdrop_flag_enum_t;
typedef uint32_t switch_eavesdrop_flag_t;

View File

@ -1794,8 +1794,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
} else {
/* Agent didn't answer or originate failed */
int delay_next_agent_call = 0;
sql = switch_mprintf("UPDATE members SET state = '%q', serving_agent = '', serving_system = ''"
sql = switch_mprintf("UPDATE members SET state = case state when '%q' then '%q' else state end, serving_agent = '', serving_system = ''"
" WHERE serving_agent = '%q' AND serving_system = '%q' AND uuid = '%q' AND system = 'single_box'",
cc_member_state2str(CC_MEMBER_STATE_TRYING), /* Only switch to Waiting from Trying (state may be set to Abandoned in callcenter_function()) */
cc_member_state2str(CC_MEMBER_STATE_WAITING),
h->agent_name, h->agent_system, h->member_uuid);
cc_execute_sql(NULL, sql, NULL);

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -1,6 +1,6 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
*
* 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;

View File

@ -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")) {

View File

@ -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;

View File

@ -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)) {

View File

@ -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:

View File

@ -5712,7 +5712,7 @@ SWITCH_STANDARD_API(vm_fsdb_auth_login_function)
switch_event_create(&params, 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);

View File

@ -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)

View File

@ -1,6 +1,6 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2009-2014, Anthony Minessale II <anthm@freeswitch.org>
* Copyright (C) 2009-2015, Anthony Minessale II <anthm@freeswitch.org>
*
* 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;

View File

@ -1,7 +1,7 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_com_g729
VERSION=194
VERSION=201501231218
if ISLINUX

View File

@ -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);
}

View File

@ -80,7 +80,10 @@
<!-- <param name="media-option" value="bypass-media-after-att-xfer"/> -->
<!-- bypass again when hold is complete -->
<!-- <param name="media-option" value="bypass-media-after-hold"/> -->
<!-- Can be set to "_undef_" to remove the User-Agent header -->
<!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
<param name="debug" value="0"/>
<!-- If you want FreeSWITCH to shutdown if this profile fails to load,
uncomment the next line. -->

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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 {

View File

@ -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;

View File

@ -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 <grammar>";
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");

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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 */

View File

@ -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:

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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 <brian@freeswitch.org>"'
alias mgit='git commit --author "Mike Jerris <mike@freeswitch.org>"'
alias mgit='git commit --author "Mike Jerris <mike@jerris.com>"'
alias tgit='git commit --author "Anthony Minessale <anthm@freeswitch.org>"'
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