Freeswitch-trunk
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
February 2009
- 17 participants
- 681 discussions
Author: brian
Date: Fri Feb 20 10:53:24 2009
New Revision: 12180
Log:
add ruby example
Added:
freeswitch/trunk/libs/esl/ruby/single_command.rb
Added: freeswitch/trunk/libs/esl/ruby/single_command.rb
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/esl/ruby/single_command.rb Fri Feb 20 10:53:24 2009
@@ -0,0 +1,8 @@
+#! /usr/bin/ruby
+
+require "ESL"
+
+command = ARGV.join(" ")
+con = ESL::ESLconnection.new("localhost", "8021", "ClueCon")
+e = con.sendRecv("api #{command}")
+puts e.getBody()
1
0
[commit] r12179 - in freeswitch/trunk/libs/esl: lua perl php python ruby src src/include
by FreeSWITCH SVN 20 Feb '09
by FreeSWITCH SVN 20 Feb '09
20 Feb '09
Author: anthm
Date: Fri Feb 20 10:52:11 2009
New Revision: 12179
Log:
add api and bgapi methods
Modified:
freeswitch/trunk/libs/esl/lua/esl_wrap.cpp
freeswitch/trunk/libs/esl/perl/ESL.pm
freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
freeswitch/trunk/libs/esl/php/ESL.php
freeswitch/trunk/libs/esl/php/esl_wrap.cpp
freeswitch/trunk/libs/esl/php/php_ESL.h
freeswitch/trunk/libs/esl/python/esl_wrap.cpp
freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp
freeswitch/trunk/libs/esl/src/esl_oop.cpp
freeswitch/trunk/libs/esl/src/include/esl_oop.h
Modified: freeswitch/trunk/libs/esl/lua/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/lua/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/lua/esl_wrap.cpp Fri Feb 20 10:52:11 2009
@@ -2333,6 +2333,68 @@
}
+static int _wrap_ESLconnection_api(lua_State* L) {
+ int SWIG_arg = -1;
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+
+ SWIG_check_num_args("api",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("api",1,"ESLconnection *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("api",2,"char const *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("api",3,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+ SWIG_fail_ptr("ESLconnection_api",1,SWIGTYPE_p_ESLconnection);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ arg3 = (char *)lua_tostring(L, 3);
+ result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+ SWIG_arg=0;
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_ESLconnection_bgapi(lua_State* L) {
+ int SWIG_arg = -1;
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+
+ SWIG_check_num_args("bgapi",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bgapi",1,"ESLconnection *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("bgapi",2,"char const *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("bgapi",3,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
+ SWIG_fail_ptr("ESLconnection_bgapi",1,SWIGTYPE_p_ESLconnection);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ arg3 = (char *)lua_tostring(L, 3);
+ result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+ SWIG_arg=0;
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,0); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
static int _wrap_ESLconnection_sendEvent(lua_State* L) {
int SWIG_arg = -1;
ESLconnection *arg1 = (ESLconnection *) 0 ;
@@ -2595,6 +2657,8 @@
{"getInfo", _wrap_ESLconnection_getInfo},
{"send", _wrap_ESLconnection_send},
{"sendRecv", _wrap_ESLconnection_sendRecv},
+ {"api", _wrap_ESLconnection_api},
+ {"bgapi", _wrap_ESLconnection_bgapi},
{"sendEvent", _wrap_ESLconnection_sendEvent},
{"recvEvent", _wrap_ESLconnection_recvEvent},
{"recvEventTimed", _wrap_ESLconnection_recvEventTimed},
Modified: freeswitch/trunk/libs/esl/perl/ESL.pm
==============================================================================
--- freeswitch/trunk/libs/esl/perl/ESL.pm (original)
+++ freeswitch/trunk/libs/esl/perl/ESL.pm Fri Feb 20 10:52:11 2009
@@ -130,6 +130,8 @@
*getInfo = *ESLc::ESLconnection_getInfo;
*send = *ESLc::ESLconnection_send;
*sendRecv = *ESLc::ESLconnection_sendRecv;
+*api = *ESLc::ESLconnection_api;
+*bgapi = *ESLc::ESLconnection_bgapi;
*sendEvent = *ESLc::ESLconnection_sendEvent;
*recvEvent = *ESLc::ESLconnection_recvEvent;
*recvEventTimed = *ESLc::ESLconnection_recvEventTimed;
Modified: freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/perl/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/perl/esl_wrap.cpp Fri Feb 20 10:52:11 2009
@@ -2824,6 +2824,106 @@
}
+XS(_wrap_ESLconnection_api) {
+ {
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: ESLconnection_api(self,cmd,arg);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'");
+ }
+ arg1 = reinterpret_cast< ESLconnection * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_ESLconnection_bgapi) {
+ {
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: ESLconnection_bgapi(self,cmd,arg);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'");
+ }
+ arg1 = reinterpret_cast< ESLconnection * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ SWIG_croak_null();
+ }
+}
+
+
XS(_wrap_ESLconnection_sendEvent) {
{
ESLconnection *arg1 = (ESLconnection *) 0 ;
@@ -3268,6 +3368,8 @@
{"ESLc::ESLconnection_getInfo", _wrap_ESLconnection_getInfo},
{"ESLc::ESLconnection_send", _wrap_ESLconnection_send},
{"ESLc::ESLconnection_sendRecv", _wrap_ESLconnection_sendRecv},
+{"ESLc::ESLconnection_api", _wrap_ESLconnection_api},
+{"ESLc::ESLconnection_bgapi", _wrap_ESLconnection_bgapi},
{"ESLc::ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent},
{"ESLc::ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent},
{"ESLc::ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed},
Modified: freeswitch/trunk/libs/esl/php/ESL.php
==============================================================================
--- freeswitch/trunk/libs/esl/php/ESL.php (original)
+++ freeswitch/trunk/libs/esl/php/ESL.php Fri Feb 20 10:52:11 2009
@@ -131,6 +131,16 @@
return is_resource($r) ? new ESLevent($r) : $r;
}
+ function api($cmd,$arg) {
+ $r=ESLconnection_api($this->_cPtr,$cmd,$arg);
+ return is_resource($r) ? new ESLevent($r) : $r;
+ }
+
+ function bgapi($cmd,$arg) {
+ $r=ESLconnection_bgapi($this->_cPtr,$cmd,$arg);
+ return is_resource($r) ? new ESLevent($r) : $r;
+ }
+
function sendEvent($send_me) {
return ESLconnection_sendEvent($this->_cPtr,$send_me);
}
Modified: freeswitch/trunk/libs/esl/php/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/php/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/php/esl_wrap.cpp Fri Feb 20 10:52:11 2009
@@ -1886,6 +1886,86 @@
}
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api) {
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+ zval **args[3];
+
+ SWIG_ResetError();
+ if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
+ WRONG_PARAM_COUNT;
+ }
+
+ {
+ if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+ SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_api. Expected SWIGTYPE_p_ESLconnection");
+ }
+ }
+ if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+
+ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+ convert_to_string_ex(args[1]);
+ arg2 = (char *) Z_STRVAL_PP(args[1]);
+ /*@SWIG@*/;
+
+
+ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+ convert_to_string_ex(args[2]);
+ arg3 = (char *) Z_STRVAL_PP(args[2]);
+ /*@SWIG@*/;
+
+ result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+ {
+ SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0);
+ }
+ return;
+fail:
+ zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi) {
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+ zval **args[3];
+
+ SWIG_ResetError();
+ if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
+ WRONG_PARAM_COUNT;
+ }
+
+ {
+ if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
+ SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_bgapi. Expected SWIGTYPE_p_ESLconnection");
+ }
+ }
+ if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
+
+ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+ convert_to_string_ex(args[1]);
+ arg2 = (char *) Z_STRVAL_PP(args[1]);
+ /*@SWIG@*/;
+
+
+ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+ convert_to_string_ex(args[2]);
+ arg3 = (char *) Z_STRVAL_PP(args[2]);
+ /*@SWIG@*/;
+
+ result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+ {
+ SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0);
+ }
+ return;
+fail:
+ zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendEvent) {
ESLconnection *arg1 = (ESLconnection *) 0 ;
ESLevent *arg2 = (ESLevent *) 0 ;
@@ -2248,6 +2328,8 @@
SWIG_ZEND_NAMED_FE(eslconnection_getinfo,_wrap_ESLconnection_getInfo,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_send,_wrap_ESLconnection_send,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_sendrecv,_wrap_ESLconnection_sendRecv,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_api,_wrap_ESLconnection_api,NULL)
+ SWIG_ZEND_NAMED_FE(eslconnection_bgapi,_wrap_ESLconnection_bgapi,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_sendevent,_wrap_ESLconnection_sendEvent,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_recvevent,_wrap_ESLconnection_recvEvent,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_recveventtimed,_wrap_ESLconnection_recvEventTimed,NULL)
Modified: freeswitch/trunk/libs/esl/php/php_ESL.h
==============================================================================
--- freeswitch/trunk/libs/esl/php/php_ESL.h (original)
+++ freeswitch/trunk/libs/esl/php/php_ESL.h Fri Feb 20 10:52:11 2009
@@ -52,6 +52,8 @@
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_getInfo);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_send);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendRecv);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api);
+ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendEvent);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEvent);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEventTimed);
Modified: freeswitch/trunk/libs/esl/python/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/python/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/python/esl_wrap.cpp Fri Feb 20 10:52:11 2009
@@ -3728,6 +3728,98 @@
}
+SWIGINTERN PyObject *_wrap_ESLconnection_api(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOO:ESLconnection_api",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'");
+ }
+ arg1 = reinterpret_cast< ESLconnection * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ESLconnection_bgapi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOO:ESLconnection_bgapi",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'");
+ }
+ arg1 = reinterpret_cast< ESLconnection * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_ESLconnection_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ESLconnection *arg1 = (ESLconnection *) 0 ;
@@ -4086,6 +4178,8 @@
{ (char *)"ESLconnection_getInfo", _wrap_ESLconnection_getInfo, METH_VARARGS, NULL},
{ (char *)"ESLconnection_send", _wrap_ESLconnection_send, METH_VARARGS, NULL},
{ (char *)"ESLconnection_sendRecv", _wrap_ESLconnection_sendRecv, METH_VARARGS, NULL},
+ { (char *)"ESLconnection_api", _wrap_ESLconnection_api, METH_VARARGS, NULL},
+ { (char *)"ESLconnection_bgapi", _wrap_ESLconnection_bgapi, METH_VARARGS, NULL},
{ (char *)"ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent, METH_VARARGS, NULL},
{ (char *)"ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent, METH_VARARGS, NULL},
{ (char *)"ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed, METH_VARARGS, NULL},
Modified: freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp Fri Feb 20 10:52:11 2009
@@ -2852,6 +2852,98 @@
SWIGINTERN VALUE
+_wrap_ESLconnection_api(int argc, VALUE *argv, VALUE self) {
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ VALUE vresult = Qnil;
+
+ if ((argc < 2) || (argc > 2)) {
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+ }
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","api", 1, self ));
+ }
+ arg1 = reinterpret_cast< ESLconnection * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","api", 2, argv[0] ));
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","api", 3, argv[1] ));
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return vresult;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_ESLconnection_bgapi(int argc, VALUE *argv, VALUE self) {
+ ESLconnection *arg1 = (ESLconnection *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ ESLevent *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ VALUE vresult = Qnil;
+
+ if ((argc < 2) || (argc > 2)) {
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
+ }
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","bgapi", 1, self ));
+ }
+ arg1 = reinterpret_cast< ESLconnection * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","bgapi", 2, argv[0] ));
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","bgapi", 3, argv[1] ));
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return vresult;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return Qnil;
+}
+
+
+SWIGINTERN VALUE
_wrap_ESLconnection_sendEvent(int argc, VALUE *argv, VALUE self) {
ESLconnection *arg1 = (ESLconnection *) 0 ;
ESLevent *arg2 = (ESLevent *) 0 ;
@@ -3507,6 +3599,8 @@
rb_define_method(cESLconnection.klass, "getInfo", VALUEFUNC(_wrap_ESLconnection_getInfo), -1);
rb_define_method(cESLconnection.klass, "send", VALUEFUNC(_wrap_ESLconnection_send), -1);
rb_define_method(cESLconnection.klass, "sendRecv", VALUEFUNC(_wrap_ESLconnection_sendRecv), -1);
+ rb_define_method(cESLconnection.klass, "api", VALUEFUNC(_wrap_ESLconnection_api), -1);
+ rb_define_method(cESLconnection.klass, "bgapi", VALUEFUNC(_wrap_ESLconnection_bgapi), -1);
rb_define_method(cESLconnection.klass, "sendEvent", VALUEFUNC(_wrap_ESLconnection_sendEvent), -1);
rb_define_method(cESLconnection.klass, "recvEvent", VALUEFUNC(_wrap_ESLconnection_recvEvent), -1);
rb_define_method(cESLconnection.klass, "recvEventTimed", VALUEFUNC(_wrap_ESLconnection_recvEventTimed), -1);
Modified: freeswitch/trunk/libs/esl/src/esl_oop.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl_oop.cpp (original)
+++ freeswitch/trunk/libs/esl/src/esl_oop.cpp Fri Feb 20 10:52:11 2009
@@ -54,6 +54,50 @@
return NULL;
}
+ESLevent *ESLconnection::api(const char *cmd, const char *arg)
+{
+ size_t len = strlen(cmd) + strlen(arg) + 5;
+ char *cmd_buf;
+
+ cmd_buf = (char *) malloc(len);
+ assert(cmd_buf);
+
+ snprintf(cmd_buf, len, "api %s %s", cmd, arg);
+ *(cmd_buf + len) = '\0';
+
+ if (esl_send_recv(&handle, cmd_buf) == ESL_SUCCESS) {
+ esl_event_t *event;
+ esl_event_dup(&event, handle.last_sr_event);
+ return new ESLevent(event, 1);
+ }
+
+ free(cmd_buf);
+
+ return NULL;
+}
+
+ESLevent *ESLconnection::bgapi(const char *cmd, const char *arg)
+{
+ size_t len = strlen(cmd) + strlen(arg) + 5;
+ char *cmd_buf;
+
+ cmd_buf = (char *) malloc(len);
+ assert(cmd_buf);
+
+ snprintf(cmd_buf, len, "bgapi %s %s", cmd, arg);
+ *(cmd_buf + len) = '\0';
+
+ if (esl_send_recv(&handle, cmd_buf) == ESL_SUCCESS) {
+ esl_event_t *event;
+ esl_event_dup(&event, handle.last_sr_event);
+ return new ESLevent(event, 1);
+ }
+
+ free(cmd_buf);
+
+ return NULL;
+}
+
ESLevent *ESLconnection::getInfo()
{
if (handle.connected && handle.info_event) {
@@ -98,9 +142,10 @@
}
if (esl_recv_event(&handle, NULL) == ESL_SUCCESS) {
- if (handle.last_ievent) {
+ esl_event_t *e = handle.last_ievent ? handle.last_ievent : handle.last_event;
+ if (e) {
esl_event_t *event;
- esl_event_dup(&event, handle.last_ievent);
+ esl_event_dup(&event, e);
last_event_obj = new ESLevent(event, 1);
return last_event_obj;
}
@@ -117,9 +162,10 @@
}
if (esl_recv_event_timed(&handle, ms, NULL) == ESL_SUCCESS) {
- if (handle.last_ievent) {
+ esl_event_t *e = handle.last_ievent ? handle.last_ievent : handle.last_event;
+ if (e) {
esl_event_t *event;
- esl_event_dup(&event, handle.last_ievent);
+ esl_event_dup(&event, e);
last_event_obj = new ESLevent(event, 1);
return last_event_obj;
}
Modified: freeswitch/trunk/libs/esl/src/include/esl_oop.h
==============================================================================
--- freeswitch/trunk/libs/esl/src/include/esl_oop.h (original)
+++ freeswitch/trunk/libs/esl/src/include/esl_oop.h Fri Feb 20 10:52:11 2009
@@ -77,6 +77,8 @@
ESLevent *getInfo();
esl_status_t send(const char *cmd);
ESLevent *sendRecv(const char *cmd);
+ ESLevent *api(const char *cmd, const char *arg);
+ ESLevent *bgapi(const char *cmd, const char *arg);
esl_status_t sendEvent(ESLevent *send_me);
ESLevent *recvEvent();
ESLevent *recvEventTimed(int ms);
1
0
[commit] r12178 - freeswitch/trunk/src/mod/formats/mod_portaudio_stream
by FreeSWITCH SVN 20 Feb '09
by FreeSWITCH SVN 20 Feb '09
20 Feb '09
Author: brian
Date: Fri Feb 20 10:49:18 2009
New Revision: 12178
Log:
add MODFORM-25 to SVN, thanks Hanedi Salas
Added:
freeswitch/trunk/src/mod/formats/mod_portaudio_stream/
freeswitch/trunk/src/mod/formats/mod_portaudio_stream/Makefile
freeswitch/trunk/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c
Added: freeswitch/trunk/src/mod/formats/mod_portaudio_stream/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/formats/mod_portaudio_stream/Makefile Fri Feb 20 10:49:18 2009
@@ -0,0 +1,23 @@
+BASE=../../../..
+BASE=../../../..
+
+PA_DIR=$(BASE)/libs/portaudio
+MODPA_DIR=$(BASE)/src/mod/endpoints/mod_portaudio
+
+
+PALA=$(PA_DIR)/lib/libportaudio.la
+LOCAL_CFLAGS=-I. -I$(PA_DIR)/include -I$(MODPA_DIR) -D__EXTENSION__=1
+
+LOCAL_INSERT_LDFLAGS=if test $$osarch = "Darwin" ; then echo "-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon" ; fi ;
+
+LOCAL_LIBADD=$(PALA)
+LOCAL_OBJS=$(MODPA_DIR)/pablio.o $(MODPA_DIR)/pa_ringbuffer.o
+LOCAL_SOURCES=$(MODPA_DIR)/pablio.c $(MODPA_DIR)/pa_ringbuffer.c
+
+include $(BASE)/build/modmake.rules
+
+$(PALA): $(PA_DIR) $(PA_DIR)/.update
+ cd $(PA_DIR) && $(MAKE)
+ $(TOUCH_TARGET)
+
+$(LOCAL_OBJS): $(LOCAL_SOURCES)
\ No newline at end of file
Added: freeswitch/trunk/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c Fri Feb 20 10:49:18 2009
@@ -0,0 +1,639 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm(a)freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm(a)freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * mod_portaudio_stream.c -- Portaudio Streaming interface Audio
+ *
+ */
+#include "switch.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "pablio.h"
+#include <string.h>
+
+#define DEFAULT_PREBUFFER_SIZE 1024 * 64
+#define SAMPLE_TYPE paInt16
+#define PREFERRED_RATE 8000
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_stream_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_stream_shutdown);
+SWITCH_MODULE_DEFINITION(mod_portaudio_stream, mod_portaudio_stream_load, mod_portaudio_stream_shutdown, NULL);
+static switch_memory_pool_t *module_pool = NULL;
+
+struct portaudio_stream_source;
+
+static struct {
+ int running;
+ int threads;
+ switch_mutex_t *mutex;
+ switch_hash_t *source_hash;
+
+} globals;
+
+
+struct portaudio_stream_context {
+ struct portaudio_stream_source *source;
+ switch_mutex_t *audio_mutex;
+ switch_buffer_t *audio_buffer;
+ int err;
+ const char *func;
+ const char *file;
+ int line;
+ switch_file_handle_t *handle;
+ struct portaudio_stream_context *next;
+};
+
+typedef struct portaudio_stream_context portaudio_stream_context_t;
+
+struct portaudio_stream_source {
+ char *sourcename;
+ int sourcedev;
+ int rate;
+ int interval;
+ char *timer_name;
+ int total;
+ int ready;
+ int stopped;
+ uint8_t channels;
+ switch_size_t samples;
+ uint32_t prebuf;
+ portaudio_stream_context_t *context_list;
+ switch_mutex_t *mutex;
+ switch_memory_pool_t *pool;
+ switch_thread_rwlock_t *rwlock;
+ PABLIO_Stream *audio_stream;
+ switch_frame_t read_frame;
+ switch_timer_t timer;
+ switch_codec_t read_codec;
+ switch_codec_t write_codec;
+ switch_mutex_t *device_lock;
+ unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+};
+
+typedef struct portaudio_stream_source portaudio_stream_source_t;
+
+
+
+static int get_dev_by_number(char *numstr, int in)
+{
+ int numDevices = Pa_GetDeviceCount();
+ const PaDeviceInfo *pdi;
+ char *end_ptr;
+ int number;
+
+ number = (int) strtol(numstr, &end_ptr, 10);
+
+ if (end_ptr == numstr || number < 0) {
+ return -1;
+ }
+
+ if (number > -1 && number < numDevices && (pdi = Pa_GetDeviceInfo(number))) {
+ if (in && pdi->maxInputChannels) {
+ return number;
+ } else if (!in && pdi->maxOutputChannels) {
+ return number;
+ }
+ }
+
+ return -1;
+}
+
+static int get_dev_by_name(char *name, int in)
+{
+ int i;
+ int numDevices;
+ const PaDeviceInfo *pdi;
+ numDevices = Pa_GetDeviceCount();
+
+ if (numDevices < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
+ return -2;
+ }
+
+ for (i = 0; i < numDevices; i++) {
+ int match = 0;
+ pdi = Pa_GetDeviceInfo(i);
+
+ if (switch_strlen_zero(name)) {
+ match = 1;
+ } else if (pdi && pdi->name && strstr(pdi->name, name)) {
+ match = 1;
+ }
+
+ if (match) {
+ if (in && pdi->maxInputChannels) {
+ return i;
+ } else if (!in && pdi->maxOutputChannels) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+}
+
+static switch_status_t engage_device(portaudio_stream_source_t *source,int restart)
+{
+ PaStreamParameters inputParameters,outputParameters;
+ PaError err;
+ int sample_rate = source->rate;
+ int codec_ms = source->interval;
+
+ switch_mutex_init(&source->device_lock, SWITCH_MUTEX_NESTED, module_pool);
+
+ if (source->timer.timer_interface) {
+ switch_core_timer_sync(&source->timer);
+ }
+
+ if (source->audio_stream) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (!source->read_codec.implementation) {
+ if (switch_core_codec_init(&source->read_codec,
+ "L16",
+ NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+ return SWITCH_STATUS_FALSE;
+ }
+ }
+
+ switch_assert(source->read_codec.implementation);
+
+ if (!source->write_codec.implementation) {
+ if (switch_core_codec_init(&source->write_codec,
+ "L16",
+ NULL,
+ sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
+ switch_core_codec_destroy(&source->read_codec);
+ return SWITCH_STATUS_FALSE;
+ }
+ }
+
+
+ if (!source->timer.timer_interface) {
+ if (switch_core_timer_init(&source->timer,
+ source->timer_name, codec_ms, source->read_codec.implementation->samples_per_packet,
+ module_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
+ switch_core_codec_destroy(&source->read_codec);
+ switch_core_codec_destroy(&source->write_codec);
+ return SWITCH_STATUS_FALSE;
+ }
+ }
+
+ source->read_frame.rate = sample_rate;
+ source->read_frame.codec = &source->read_codec;
+
+ switch_mutex_lock(source->device_lock);
+ /* LOCKED ************************************************************************************************** */
+ inputParameters.device = source->sourcedev;
+ inputParameters.channelCount = 1;
+ inputParameters.sampleFormat = SAMPLE_TYPE;
+ inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency;
+ inputParameters.hostApiSpecificStreamInfo = NULL;
+ outputParameters.device = source->sourcedev;
+ outputParameters.channelCount = 1;
+ outputParameters.sampleFormat = SAMPLE_TYPE;
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+
+
+ err = OpenAudioStream(&source->audio_stream, &inputParameters, NULL, sample_rate, paClipOff,
+ source->read_codec.implementation->samples_per_packet, 0);
+ /* UNLOCKED ************************************************************************************************* */
+ if (err != paNoError) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening audio device retrying\n");
+ switch_yield(1000000);
+ err = OpenAudioStream(&source->audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,
+ source->read_codec.implementation->samples_per_packet, 0);
+ }
+
+ switch_mutex_unlock(source->device_lock);
+ if (err != paNoError) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device\n");
+ switch_core_codec_destroy(&source->read_codec);
+ switch_core_timer_destroy(&source->timer);
+ return SWITCH_STATUS_FALSE;
+ }
+
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
+{
+ portaudio_stream_source_t *source = obj;
+ portaudio_stream_context_t *cp;
+ int samples = 0;
+ int bused, bytesToWrite;
+
+
+ switch_mutex_lock(globals.mutex);
+ globals.threads++;
+ switch_mutex_unlock(globals.mutex);
+
+ if (!source->prebuf) {
+ source->prebuf = DEFAULT_PREBUFFER_SIZE;
+ }
+
+
+
+ switch_mutex_lock(globals.mutex);
+ switch_core_hash_insert(globals.source_hash, source->sourcename, source);
+ switch_mutex_unlock(globals.mutex);
+
+
+ switch_thread_rwlock_create(&source->rwlock, source->pool);
+
+ if (engage_device(source,0)!=SWITCH_STATUS_SUCCESS){
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " Dev %d cant be engaged !\n",(int) source->sourcedev);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " Dev %d engaged at %d rate!\n",(int) source->sourcedev, (int) source->rate);
+ if (globals.running && !source->stopped) {
+ source->ready = 1;
+
+ if (!source->audio_stream){
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Audio Stream wops!\n");
+ source->stopped = 0;
+ source->ready = 0;
+ } else {
+ while (globals.running && !source->stopped) {
+ samples = 0;
+ switch_mutex_lock(source->device_lock);
+ samples = ReadAudioStream(source->audio_stream, source->databuf,
+ source->read_codec.implementation->samples_per_packet , &source->timer);
+ switch_mutex_unlock(source->device_lock);
+
+
+ if (samples) {
+ bytesToWrite = source->samples;
+ if (samples < bytesToWrite) {
+ bytesToWrite = samples;
+ }
+ bytesToWrite *= source->audio_stream->bytesPerFrame;
+
+ if (source->total) {
+
+ switch_mutex_lock(source->mutex);
+ for (cp = source->context_list; cp; cp = cp->next) {
+
+ switch_mutex_lock(cp->audio_mutex);
+
+ bused = switch_buffer_inuse(cp->audio_buffer);
+ if (bused > source->samples * 768 ) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d] %d used %d max\n", cp->func, cp->file,
+ cp->line,(int) bused, (int) ( source->samples * 768));
+ switch_buffer_zero(cp->audio_buffer);
+ } else {
+ switch_buffer_write(cp->audio_buffer, source->databuf, bytesToWrite);
+ }
+
+ switch_mutex_unlock(cp->audio_mutex);
+ }
+ switch_mutex_unlock(source->mutex);
+ }
+
+ }
+
+ }
+ }
+
+ }
+ }
+
+
+ source->ready = 0;
+
+ switch_mutex_lock(globals.mutex);
+ switch_core_hash_delete(globals.source_hash, source->sourcename);
+ switch_mutex_unlock(globals.mutex);
+
+ switch_thread_rwlock_wrlock(source->rwlock);
+ switch_thread_rwlock_unlock(source->rwlock);
+
+
+ switch_mutex_lock(source->device_lock);
+ CloseAudioStream(source->audio_stream);
+ if (source->read_codec.implementation) {
+ switch_core_codec_destroy(&source->read_codec);
+ switch_core_codec_destroy(&source->write_codec);
+ }
+ if (source->write_codec.implementation) {
+ switch_core_codec_destroy(&source->write_codec);
+ }
+ switch_mutex_unlock(source->device_lock);
+
+
+ switch_core_destroy_memory_pool(&source->pool);
+
+ switch_mutex_lock(globals.mutex);
+ globals.threads--;
+ switch_mutex_unlock(globals.mutex);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " thread ending succesfully !\n");
+ switch_thread_exit(thread,SWITCH_STATUS_SUCCESS);
+
+ return NULL;
+}
+
+
+static switch_status_t portaudio_stream_file_open(switch_file_handle_t *handle, const char *path)
+{
+ portaudio_stream_context_t *context ;
+ portaudio_stream_source_t *source;
+ switch_memory_pool_t *pool;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_thread_t *thread;
+ switch_threadattr_t *thd_attr = NULL;
+ uint32_t rate = PREFERRED_RATE;
+ char *npath ;
+ int devNumber;
+
+
+
+
+
+ handle->pre_buffer_datalen = 0;
+
+ if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing! (yet)\n");
+ return status;
+ }
+
+ npath = switch_core_strdup(module_pool, path);
+
+ int tmp = handle->samplerate;
+ if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
+ rate = tmp;
+ }
+
+ if (*path == '#') {
+ devNumber = get_dev_by_number(npath + 1, 1);
+ } else {
+ devNumber = get_dev_by_name(npath , 1);
+ }
+ npath = switch_mprintf("device-%d at %d",devNumber,rate);
+
+
+
+ switch_mutex_lock(globals.mutex);
+ source = switch_core_hash_find(globals.source_hash, npath);
+
+ /* dev isnt there, try to start thread */
+ if (!source) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " source isnt Created, create and start thread!\n");
+
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, " :S no pool\n");
+ } else {
+ source = switch_core_alloc(pool, sizeof(*source));
+ if (source!=NULL){
+ source->pool = pool;
+ source->sourcedev = devNumber;
+ source->sourcename = switch_core_strdup(source->pool, npath);
+ source->rate = rate;
+ source->interval = 20;
+ source->channels = 1;
+ source->timer_name = "soft";
+ source->prebuf = DEFAULT_PREBUFFER_SIZE;
+ source->stopped = 0;
+ source->ready = 0;
+ source->samples = switch_samples_per_packet(source->rate, source->interval);
+
+
+
+ switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
+
+
+
+ switch_threadattr_create(&thd_attr, source->pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&thread, thd_attr, read_stream_thread, source, source->pool);
+
+ }
+
+ }
+
+ }
+ switch_mutex_unlock(globals.mutex);
+ switch_yield(1000000);
+ /* dev already engaged */
+ if (source) {
+
+ /*wait for source to be ready*/
+
+ while(source->ready==0){switch_yield(100000);}
+
+
+ if (switch_thread_rwlock_tryrdlock(source->rwlock) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " error rwlock !\n");
+ source = NULL;
+ }
+
+ }
+
+
+
+ if (source) {
+ status = SWITCH_STATUS_SUCCESS;
+
+ if ((context = switch_core_alloc(handle->memory_pool, sizeof(*context))) == 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " error allocating context!\n");
+ status = SWITCH_STATUS_MEMERR;
+ } else {
+ /* everything goes fine at this point */
+ handle->samples = 0;
+ handle->samplerate = source->rate;
+ handle->channels = 1;
+ handle->format = 0;
+ handle->sections = 0;
+ handle->seekable = 0;
+ handle->speed = 0;
+ handle->private_info = context;
+ handle->interval = source->interval;
+
+
+ switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
+ if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
+ status = SWITCH_STATUS_MEMERR;
+ } else {
+ /* context created... then continue */
+ context->source = source;
+ context->file = handle->file;
+ context->func = handle->func;
+ context->line = handle->line;
+ context->handle = handle;
+ switch_mutex_lock(source->mutex);
+ context->next = source->context_list;
+ source->context_list = context;
+ source->total++;
+ switch_mutex_unlock(source->mutex);
+
+ }
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown source %s\n", path);
+ status = SWITCH_STATUS_FALSE;
+ }
+
+
+
+ return status;
+}
+
+
+static switch_status_t portaudio_stream_file_close(switch_file_handle_t *handle)
+{
+ portaudio_stream_context_t *cp, *last = NULL, *context = handle->private_info;
+
+
+ switch_mutex_lock(context->source->mutex);
+ for (cp = context->source->context_list; cp; cp = cp->next) {
+ if (cp == context) {
+ if (last) {
+ last->next = cp->next;
+ } else {
+ context->source->context_list = cp->next;
+ }
+ break;
+ }
+ last = cp;
+ }
+ context->source->total--;
+ switch_mutex_unlock(context->source->mutex);
+ switch_buffer_destroy(&context->audio_buffer);
+ switch_thread_rwlock_unlock(context->source->rwlock);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t portaudio_stream_file_read(switch_file_handle_t *handle, void *data, size_t *len)
+{
+ portaudio_stream_context_t *context = handle->private_info;
+ switch_size_t bytes = 0;
+ int bytesPerSample = context->source->audio_stream->bytesPerFrame;
+ size_t need = *len * bytesPerSample;
+
+
+
+ if (!context->source->ready) {
+ *len = 0;
+ return SWITCH_STATUS_FALSE;
+ }
+
+ switch_mutex_lock(context->audio_mutex);
+ if ((bytes = switch_buffer_read(context->audio_buffer, data, need))) {
+ *len = bytes / bytesPerSample;
+ } else {
+ if (need > 2560) {
+ need = 2560;
+ }
+ memset(data, 255, need);
+ *len = need / bytesPerSample;
+ }
+ switch_mutex_unlock(context->audio_mutex);
+
+
+
+ handle->sample_count += *len;
+ return SWITCH_STATUS_SUCCESS;
+
+
+}
+
+/* Registration */
+
+static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
+
+static void shutdown_event_handler(switch_event_t *event)
+{
+ globals.running = 0;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_stream_load)
+{
+ switch_file_interface_t *file_interface;
+ supported_formats[0] = "portaudio_stream";
+
+ module_pool = pool;
+
+ Pa_Initialize();
+
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+ file_interface->interface_name = modname;
+ file_interface->extens = supported_formats;
+ file_interface->file_open = portaudio_stream_file_open;
+ file_interface->file_close = portaudio_stream_file_close;
+ file_interface->file_read = portaudio_stream_file_read;
+
+ if (switch_event_bind(modname, SWITCH_EVENT_SHUTDOWN, SWITCH_EVENT_SUBCLASS_ANY, shutdown_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind shutdown event handler!\n");
+ }
+
+ memset(&globals, 0, sizeof(globals));
+ globals.running = 1;
+ globals.threads = 0;
+ switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
+ switch_core_hash_init(&globals.source_hash, module_pool);
+
+
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_stream_shutdown)
+{
+ globals.running = 0;
+ switch_event_unbind_callback(shutdown_event_handler);
+
+ while(globals.threads > 0) {
+ switch_yield(100000);
+ }
+
+ Pa_Terminate();
+
+ switch_core_hash_destroy(&globals.source_hash);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */
1
0
Author: anthm
Date: Fri Feb 20 09:30:01 2009
New Revision: 12177
Log:
don't execute apps on channels that are hungup
Modified:
freeswitch/trunk/src/switch_core_session.c
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Fri Feb 20 09:30:01 2009
@@ -1238,6 +1238,11 @@
{
switch_application_interface_t *application_interface;
+ if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is hungup, aborting execution of application: %s\n", app);
+ return SWITCH_STATUS_FALSE;
+ }
+
if ((application_interface = switch_loadable_module_get_application_interface(app)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", app);
switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
1
0
Author: brian
Date: Fri Feb 20 02:39:08 2009
New Revision: 12176
Log:
fix events.pl
Modified:
freeswitch/trunk/libs/esl/perl/events.pl
Modified: freeswitch/trunk/libs/esl/perl/events.pl
==============================================================================
--- freeswitch/trunk/libs/esl/perl/events.pl (original)
+++ freeswitch/trunk/libs/esl/perl/events.pl Fri Feb 20 02:39:08 2009
@@ -1,6 +1,6 @@
require ESL;
-my $con = new ESL::eslConnection("localhost", "8021", "ClueCon");
+my $con = new ESL::ESLconnection("localhost", "8021", "ClueCon");
$con->events("plain", "all");
1
0
Author: mrene
Date: Thu Feb 19 22:38:54 2009
New Revision: 12175
Log:
fix getlib.sh's curl/wget detection
Modified:
freeswitch/trunk/build/getlib.sh.in
Modified: freeswitch/trunk/build/getlib.sh.in
==============================================================================
--- freeswitch/trunk/build/getlib.sh.in (original)
+++ freeswitch/trunk/build/getlib.sh.in Thu Feb 19 22:38:54 2009
@@ -5,10 +5,10 @@
WGET=@WGET@
CURL=@CURL@
-if [ -f $WGET ] ; then
+if [ -f "$WGET" ] ; then
DOWNLOAD_CMD=$WGET
else
- if [ -f $CURL ] ; then
+ if [ -f "$CURL" ] ; then
DOWNLOAD_CMD="$CURL -O"
fi
fi
1
0
[commit] r12174 - in freeswitch/trunk/src/mod/endpoints/mod_skypiax: . asterisk
by FreeSWITCH SVN 20 Feb '09
by FreeSWITCH SVN 20 Feb '09
20 Feb '09
Author: gmaruzz
Date: Thu Feb 19 19:26:20 2009
New Revision: 12174
Log:
skypiax: ringback is ok now, early media in early stage (eg: not yet early media :-) )
Modified:
freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h
freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c
freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h
freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c Thu Feb 19 19:26:20 2009
@@ -1880,40 +1880,31 @@
#endif
return 0;
}
-
-int outbound_channel_answered(private_t * p)
+int remote_party_is_ringing(private_t * p)
{
-#ifdef NOTDEF
- switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
-
- if (strlen(tech_pvt->session_uuid_str)) {
- session = switch_core_session_locate(tech_pvt->session_uuid_str);
- } else {
- ERRORA("No session???\n", SKYPIAX_P_LOG);
- }
- if (session) {
- channel = switch_core_session_get_channel(session);
- } else {
- ERRORA("No session???\n", SKYPIAX_P_LOG);
+ if (p->owner) {
+ ast_queue_control(p->owner, AST_CONTROL_RINGING);
}
- if (channel) {
- switch_channel_mark_answered(channel);
- //DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id);
- } else {
- ERRORA("No channel???\n", SKYPIAX_P_LOG);
+
+ return 0;
+}
+int remote_party_is_early_media(private_t * p)
+{
+ if (p->owner) {
+ ast_queue_control(p->owner, AST_CONTROL_RINGING);
}
- switch_core_session_rwunlock(session);
+ return 0;
+}
+
-#endif
+int outbound_channel_answered(private_t * p)
+{
if (p->owner) {
ast_queue_control(p->owner, AST_CONTROL_ANSWER);
}
- NOTICA("HERE!\n", SKYPIAX_P_LOG);
-
return 0;
}
void *skypiax_do_tcp_srv_thread(void *obj)
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h Thu Feb 19 19:26:20 2009
@@ -414,6 +414,8 @@
#endif /* WIN32 */
int skypiax_close_socket(unsigned int fd);
private_t *find_available_skypiax_interface(void);
+int remote_party_is_ringing(private_t * tech_pvt);
+int remote_party_is_early_media(private_t * tech_pvt);
#define SKYPIAX_STATE_DOWN AST_STATE_DOWN
#define SKYPIAX_STATE_RING AST_STATE_RING
#define SKYPIAX_STATE_DIALING AST_STATE_DIALING
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c Thu Feb 19 19:26:20 2009
@@ -1169,6 +1169,62 @@
return 0;
}
+int remote_party_is_ringing(private_t * tech_pvt)
+{
+ switch_core_session_t *session = NULL;
+ switch_channel_t *channel = NULL;
+
+ if (strlen(tech_pvt->session_uuid_str)) {
+ session = switch_core_session_locate(tech_pvt->session_uuid_str);
+ } else {
+ ERRORA("No session???\n", SKYPIAX_P_LOG);
+ }
+ if (session) {
+ channel = switch_core_session_get_channel(session);
+ } else {
+ ERRORA("No session???\n", SKYPIAX_P_LOG);
+ }
+ if (channel) {
+ switch_channel_mark_ring_ready(channel);
+ DEBUGA_SKYPE("skype_call: REMOTE PARTY RINGING\n", SKYPIAX_P_LOG);
+ } else {
+ ERRORA("No channel???\n", SKYPIAX_P_LOG);
+ }
+
+ switch_core_session_rwunlock(session);
+
+ return 0;
+}
+
+
+int remote_party_is_early_media(private_t * tech_pvt)
+{
+ switch_core_session_t *session = NULL;
+ switch_channel_t *channel = NULL;
+
+ if (strlen(tech_pvt->session_uuid_str)) {
+ session = switch_core_session_locate(tech_pvt->session_uuid_str);
+ } else {
+ ERRORA("No session???\n", SKYPIAX_P_LOG);
+ }
+ if (session) {
+ channel = switch_core_session_get_channel(session);
+ switch_core_session_add_stream(session, NULL);
+ } else {
+ ERRORA("No session???\n", SKYPIAX_P_LOG);
+ }
+ if (channel) {
+ //switch_channel_mark_pre_answered(channel);
+ NOTICA("skype_call: REMOTE PARTY EARLY MEDIA, we will pass you the audio, just the code is not yet written :-)\n", SKYPIAX_P_LOG);
+ } else {
+ ERRORA("No channel???\n", SKYPIAX_P_LOG);
+ }
+
+ switch_core_session_rwunlock(session);
+
+ return 0;
+}
+
int outbound_channel_answered(private_t * tech_pvt)
{
switch_core_session_t *session = NULL;
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h Thu Feb 19 19:26:20 2009
@@ -268,3 +268,5 @@
#endif /* WIN32 */
int skypiax_close_socket(unsigned int fd);
private_t *find_available_skypiax_interface(void);
+int remote_party_is_ringing(private_t * tech_pvt);
+int remote_party_is_early_media(private_t * tech_pvt);
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Thu Feb 19 19:26:20 2009
@@ -267,12 +267,14 @@
strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n",
SKYPIAX_P_LOG, id);
+ remote_party_is_ringing(tech_pvt);
}
} else if (!strcasecmp(value, "EARLYMEDIA")) {
tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
- DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n",
+ NOTICA("Our remote party in skype_call %s is EARLYMEDIA\n",
SKYPIAX_P_LOG, id);
+ remote_party_is_early_media(tech_pvt);
} else if (!strcasecmp(value, "MISSED")) {
DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
} else if (!strcasecmp(value, "FINISHED")) {
1
0
[commit] r12173 - in freeswitch/trunk: libs/esl/src libs/esl/src/include src src/include src/mod/applications/mod_commands src/mod/event_handlers/mod_event_socket src/mod/formats/mod_local_stream
by FreeSWITCH SVN 20 Feb '09
by FreeSWITCH SVN 20 Feb '09
20 Feb '09
Author: anthm
Date: Thu Feb 19 19:10:59 2009
New Revision: 12173
Log:
FSCORE-297
Modified:
freeswitch/trunk/libs/esl/src/esl.c
freeswitch/trunk/libs/esl/src/include/esl.h
freeswitch/trunk/src/include/switch_apr.h
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
freeswitch/trunk/src/switch_apr.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_core_session.c
freeswitch/trunk/src/switch_event.c
freeswitch/trunk/src/switch_loadable_module.c
freeswitch/trunk/src/switch_log.c
Modified: freeswitch/trunk/libs/esl/src/esl.c
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl.c (original)
+++ freeswitch/trunk/libs/esl/src/esl.c Thu Feb 19 19:10:59 2009
@@ -643,7 +643,7 @@
hval = esl_event_get_header(handle->last_event, "content-type");
- if (strcasecmp(hval, "auth/request")) {
+ if (esl_safe_strcasecmp(hval, "auth/request")) {
snprintf(handle->err, sizeof(handle->err), "Connection Error");
goto fail;
}
@@ -660,7 +660,7 @@
hval = esl_event_get_header(handle->last_event, "reply-text");
- if (strcasecmp(hval, "+OK accepted")) {
+ if (esl_safe_strcasecmp(hval, "+OK accepted")) {
snprintf(handle->err, sizeof(handle->err), "Authentication Error");
goto fail;
}
@@ -876,7 +876,7 @@
hval = esl_event_get_header(revent, "content-type");
- if (!esl_strlen_zero(hval) && !strcasecmp(hval, "text/event-plain") && revent->body) {
+ if (!esl_strlen_zero(hval) && !esl_safe_strcasecmp(hval, "text/event-plain") && revent->body) {
const char *en;
esl_event_types_t et = ESL_EVENT_COMMAND;
char *body = strdup(revent->body);
Modified: freeswitch/trunk/libs/esl/src/include/esl.h
==============================================================================
--- freeswitch/trunk/libs/esl/src/include/esl.h (original)
+++ freeswitch/trunk/libs/esl/src/include/esl.h Thu Feb 19 19:10:59 2009
@@ -341,7 +341,7 @@
#define esl_recv(_h) esl_recv_event(_h, NULL)
#define esl_recv_timed(_h, _ms) esl_recv_event_timed(_h, _ms, NULL)
-
+#define esl_safe_strcasecmp(_s1, _s2) ((_s1) && (_s2)) ? strcasecmp((_s1), (_s2)) : 1
#ifdef __cplusplus
}
Modified: freeswitch/trunk/src/include/switch_apr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_apr.h (original)
+++ freeswitch/trunk/src/include/switch_apr.h Thu Feb 19 19:10:59 2009
@@ -620,6 +620,8 @@
*/
SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data);
+SWITCH_DECLARE(switch_status_t) switch_queue_interrupt_all(switch_queue_t *queue);
+
/**
* push/add a object to the queue, returning immediatly if the queue is full
*
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Thu Feb 19 19:10:59 2009
@@ -1671,7 +1671,8 @@
/*!
\brief Launch a thread
*/
-SWITCH_DECLARE(void) switch_core_launch_thread(void *(SWITCH_THREAD_FUNC *func) (switch_thread_t *, void *), void *obj, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_thread_t *) switch_core_launch_thread(void *(SWITCH_THREAD_FUNC *func) (switch_thread_t *, void *),
+ void *obj, switch_memory_pool_t *pool);
#endif
/*!
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Thu Feb 19 19:10:59 2009
@@ -40,7 +40,9 @@
#include <switch_version.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load);
-SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, NULL, NULL);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown);
+SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, mod_commands_shutdown, NULL);
+
SWITCH_STANDARD_API(time_test_function)
{
@@ -2289,6 +2291,8 @@
return SWITCH_STATUS_SUCCESS;
}
+static switch_thread_rwlock_t *bgapi_rwlock = NULL;
+
struct bg_job {
char *cmd;
char *arg;
@@ -2309,6 +2313,8 @@
if (!job)
return NULL;
+ switch_thread_rwlock_rdlock(bgapi_rwlock);
+
pool = job->pool;
SWITCH_STANDARD_STREAM(stream);
@@ -2345,6 +2351,9 @@
job = NULL;
switch_core_destroy_memory_pool(&pool);
pool = NULL;
+
+ switch_thread_rwlock_unlock(bgapi_rwlock);
+
return NULL;
}
@@ -3183,11 +3192,37 @@
return SWITCH_STATUS_SUCCESS;
}
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown)
+{
+ int x;
+
+
+ for (x = 30; x > 0; x--) {
+ if (switch_thread_rwlock_trywrlock(bgapi_rwlock) == SWITCH_STATUS_SUCCESS) {
+ switch_thread_rwlock_unlock(bgapi_rwlock);
+ break;
+ }
+ if (x == 30) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for bgapi threads.\n");
+ }
+ switch_yield(1000000);
+ }
+
+ if (!x) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up waiting for bgapi threads.\n");
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
{
switch_api_interface_t *commands_api_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ switch_thread_rwlock_create(&bgapi_rwlock, pool);
+
SWITCH_ADD_API(commands_api_interface, "group_call", "Generate a dial string to call a group", group_call_function, "<group>[@<domain>]");
SWITCH_ADD_API(commands_api_interface, "in_group", "determine if a user is in a group", in_group_function, "<user>[@<domain>] <group_name>");
Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Thu Feb 19 19:10:59 2009
@@ -116,6 +116,7 @@
static void remove_listener(listener_t *listener);
+static void kill_all_listeners(void);
static uint32_t next_id(void)
{
@@ -452,31 +453,24 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown)
{
- listener_t *l;
int sanity = 0;
prefs.done = 1;
+ kill_all_listeners();
switch_log_unbind_logger(socket_logger);
close_socket(&listen_list.sock);
while (prefs.threads) {
- switch_yield(10000);
- if (++sanity == 1000) {
+ switch_yield(100000);
+ kill_all_listeners();
+ if (++sanity >= 200) {
break;
}
}
- switch_event_unbind(&globals.node);
-
- switch_mutex_lock(globals.listener_mutex);
- for (l = listen_list.listeners; l; l = l->next) {
- close_socket(&l->sock);
- }
- switch_mutex_unlock(globals.listener_mutex);
-
- switch_yield(1000000);
+ switch_event_unbind(&globals.node);
return SWITCH_STATUS_SUCCESS;
}
@@ -509,6 +503,22 @@
}
+static void kill_all_listeners(void)
+{
+ listener_t *l;
+
+ switch_mutex_lock(globals.listener_mutex);
+ for (l = listen_list.listeners; l; l = l->next) {
+ switch_clear_flag(l, LFLAG_RUNNING);
+ if (l->sock) {
+ switch_socket_shutdown(l->sock, SWITCH_SHUTDOWN_READWRITE);
+ switch_socket_close(l->sock);
+ }
+ }
+ switch_mutex_unlock(globals.listener_mutex);
+}
+
+
static listener_t *find_listener(uint32_t id)
{
listener_t *l, *r = NULL;
@@ -961,12 +971,16 @@
uint32_t max_len = sizeof(mbuf);
switch_channel_t *channel = NULL;
int clen = 0;
-
+
*event = NULL;
+
+ if (prefs.done) {
+ return SWITCH_STATUS_FALSE;
+ }
+
start = switch_epoch_time_now(NULL);
ptr = mbuf;
-
if (listener->session) {
channel = switch_core_session_get_channel(listener->session);
}
@@ -976,7 +990,7 @@
mlen = 1;
status = switch_socket_recv(listener->sock, ptr, &mlen);
- if (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS) {
+ if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) {
return SWITCH_STATUS_FALSE;
}
@@ -1044,7 +1058,7 @@
status = switch_socket_recv(listener->sock, p, &mlen);
- if (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS) {
+ if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) {
return SWITCH_STATUS_FALSE;
}
@@ -1211,10 +1225,15 @@
switch_stream_handle_t stream = { 0 };
char *reply, *freply = NULL;
switch_status_t status;
+
+ switch_mutex_lock(globals.listener_mutex);
+ prefs.threads++;
+ switch_mutex_unlock(globals.listener_mutex);
+
if (!acs) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal error.\n");
- return NULL;
+ goto cleanup;
}
if (!acs->listener || !switch_test_flag(acs->listener, LFLAG_RUNNING) ||
@@ -1291,6 +1310,11 @@
}
+ cleanup:
+ switch_mutex_lock(globals.listener_mutex);
+ prefs.threads--;
+ switch_mutex_unlock(globals.listener_mutex);
+
return NULL;
}
@@ -1934,7 +1958,7 @@
}
}
- while (switch_test_flag(listener, LFLAG_RUNNING) && listen_list.ready) {
+ while (!prefs.done && switch_test_flag(listener, LFLAG_RUNNING) && listen_list.ready) {
len = sizeof(buf);
memset(buf, 0, len);
status = read_packet(listener, &revent, 0);
@@ -2106,7 +2130,7 @@
config();
- for (;;) {
+ while(!prefs.done) {
rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_INET, prefs.port, 0, pool);
if (rv)
goto fail;
@@ -2132,7 +2156,7 @@
listen_list.ready = 1;
- for (;;) {
+ while(!prefs.done) {
if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
goto fail;
Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c Thu Feb 19 19:10:59 2009
@@ -222,13 +222,13 @@
if (!used && !is_open) {
break;
}
-
+
if (!is_open || used >= source->prebuf || (source->total && used > source->samples * 2)) {
used = switch_buffer_read(audio_buffer, dist_buf, source->samples * 2);
if (source->total) {
switch_mutex_lock(source->mutex);
- for (cp = source->context_list; cp; cp = cp->next) {
+ for (cp = source->context_list; cp && RUNNING; cp = cp->next) {
if (switch_test_flag(cp->handle, SWITCH_FILE_CALLBACK)) {
continue;
}
Modified: freeswitch/trunk/src/switch_apr.c
==============================================================================
--- freeswitch/trunk/src/switch_apr.c (original)
+++ freeswitch/trunk/src/switch_apr.c Thu Feb 19 19:10:59 2009
@@ -895,6 +895,11 @@
return apr_queue_trypop(queue, data);
}
+SWITCH_DECLARE(switch_status_t) switch_queue_interrupt_all(switch_queue_t *queue)
+{
+ return apr_queue_interrupt_all(queue);
+}
+
SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data)
{
apr_status_t s;
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Thu Feb 19 19:10:59 2009
@@ -345,9 +345,9 @@
*/
-SWITCH_DECLARE(void) switch_core_launch_thread(switch_thread_start_t func, void *obj, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_thread_t *) switch_core_launch_thread(switch_thread_start_t func, void *obj, switch_memory_pool_t *pool)
{
- switch_thread_t *thread;
+ switch_thread_t *thread = NULL;
switch_threadattr_t *thd_attr = NULL;
switch_core_thread_session_t *ts;
int mypool;
@@ -356,11 +356,10 @@
if (!pool && switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not allocate memory pool\n");
- return;
+ return NULL;
}
switch_threadattr_create(&thd_attr, pool);
- switch_threadattr_detach_set(thd_attr, 1);
if ((ts = switch_core_alloc(pool, sizeof(*ts))) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not allocate memory\n");
@@ -369,10 +368,13 @@
ts->pool = pool;
}
ts->objs[0] = obj;
+ ts->objs[1] = thread;
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_priority_increase(thd_attr);
switch_thread_create(&thread, thd_attr, func, ts, pool);
}
+
+ return thread;
}
SWITCH_DECLARE(void) switch_core_set_globals(void)
@@ -1457,6 +1459,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
{
switch_event_t *event;
+
if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Shutting Down");
switch_event_fire(&event);
@@ -1464,26 +1467,29 @@
switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
switch_set_flag((&runtime), SCF_SHUTTING_DOWN);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
switch_core_session_hupall(SWITCH_CAUSE_SYSTEM_SHUTDOWN);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
- switch_core_memory_stop();
- switch_loadable_module_shutdown();
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n");
- switch_event_shutdown();
+ switch_loadable_module_shutdown();
+
if (switch_test_flag((&runtime), SCF_USE_SQL)) {
switch_core_sqldb_stop();
}
switch_scheduler_task_thread_stop();
-
+
switch_rtp_shutdown();
switch_xml_destroy();
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n");
+ switch_event_shutdown();
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
switch_log_shutdown();
+ switch_core_memory_stop();
+
if (runtime.console && runtime.console != stdout && runtime.console != stderr) {
fclose(runtime.console);
runtime.console = NULL;
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Thu Feb 19 19:10:59 2009
@@ -58,6 +58,9 @@
/* Acquire a read lock on the session */
#ifdef SWITCH_DEBUG_RWLOCKS
if (switch_core_session_perform_read_lock(session, file, func, line) != SWITCH_STATUS_SUCCESS) {
+#if EMACS_CC_MODE_IS_BUGGY
+ }
+#endif
#else
if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
#endif
@@ -127,21 +130,20 @@
void *val;
switch_core_session_t *session;
uint32_t loops = 0;
-
- switch_mutex_lock(runtime.throttle_mutex);
- for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
- switch_hash_this(hi, NULL, NULL, &val);
- if (val) {
- session = (switch_core_session_t *) val;
- if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
- switch_channel_hangup(switch_core_session_get_channel(session), cause);
- switch_core_session_rwunlock(session);
+
+ while (session_manager.session_count > 0) {
+ switch_mutex_lock(runtime.throttle_mutex);
+ for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, NULL, NULL, &val);
+ if (val) {
+ session = (switch_core_session_t *) val;
+ if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_hangup(switch_core_session_get_channel(session), cause);
+ switch_core_session_rwunlock(session);
+ }
}
}
- }
- switch_mutex_unlock(runtime.throttle_mutex);
-
- while (session_manager.session_count > 0) {
+ switch_mutex_unlock(runtime.throttle_mutex);
switch_yield(1000000);
if (++loops == 30) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up with %d session%s remaining\n",
@@ -151,6 +153,7 @@
}
}
+
SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(const char *uuid_str, switch_core_session_message_t *message)
{
switch_core_session_t *session = NULL;
Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c (original)
+++ freeswitch/trunk/src/switch_event.c Thu Feb 19 19:10:59 2009
@@ -74,7 +74,9 @@
static switch_memory_pool_t *RUNTIME_POOL = NULL;
static switch_memory_pool_t *THRUNTIME_POOL = NULL;
#define NUMBER_OF_QUEUES 3
+static switch_thread_t *EVENT_QUEUE_THREADS[NUMBER_OF_QUEUES] = { 0 };
static switch_queue_t *EVENT_QUEUE[NUMBER_OF_QUEUES] = { 0 };
+static switch_thread_t *EVENT_DISPATCH_QUEUE_THREADS[MAX_DISPATCH_VAL] = { 0 };
static switch_queue_t *EVENT_DISPATCH_QUEUE[MAX_DISPATCH_VAL] = { 0 };
static int POOL_COUNT_MAX = SWITCH_CORE_QUEUE_LEN;
static switch_mutex_t *EVENT_QUEUE_MUTEX = NULL;
@@ -174,15 +176,15 @@
static int switch_events_match(switch_event_t *event, switch_event_node_t *node)
{
int match = 0;
-
+
if (node->event_id == SWITCH_EVENT_ALL) {
match++;
-
+
if (!node->subclass) {
return match;
}
}
-
+
if (match || event->event_id == node->event_id) {
if (event->subclass_name && node->subclass) {
@@ -227,6 +229,10 @@
void *pop = NULL;
switch_event_t *event = NULL;
+ if (!SYSTEM_RUNNING) {
+ break;
+ }
+
if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) {
break;
}
@@ -278,6 +284,10 @@
break;
}
+ if (!SYSTEM_RUNNING) {
+ break;
+ }
+
event = (switch_event_t *) pop;
while (event) {
@@ -313,20 +323,22 @@
switch_event_types_t e;
switch_event_node_t *node;
- switch_thread_rwlock_rdlock(RWLOCK);
- for (e = (*event)->event_id;; e = SWITCH_EVENT_ALL) {
- for (node = EVENT_NODES[e]; node; node = node->next) {
- if (switch_events_match(*event, node)) {
- (*event)->bind_user_data = node->user_data;
- node->callback(*event);
+ if (SYSTEM_RUNNING) {
+ switch_thread_rwlock_rdlock(RWLOCK);
+ for (e = (*event)->event_id;; e = SWITCH_EVENT_ALL) {
+ for (node = EVENT_NODES[e]; node; node = node->next) {
+ if (switch_events_match(*event, node)) {
+ (*event)->bind_user_data = node->user_data;
+ node->callback(*event);
+ }
+ }
+
+ if (e == SWITCH_EVENT_ALL) {
+ break;
}
}
-
- if (e == SWITCH_EVENT_ALL) {
- break;
- }
+ switch_thread_rwlock_unlock(RWLOCK);
}
- switch_thread_rwlock_unlock(RWLOCK);
switch_event_destroy(event);
}
@@ -416,10 +428,10 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled event header(s) %d bytes\n",
size, (int) sizeof(switch_event_header_t) * size);
- while (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
+ while (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS && pop) {
free(pop);
}
- while (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
+ while (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS && pop) {
free(pop);
}
}
@@ -438,12 +450,14 @@
for (x = 0; x < 3; x++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping event queue %d\n", x);
- switch_queue_push(EVENT_QUEUE[x], NULL);
+ switch_queue_trypush(EVENT_QUEUE[x], NULL);
+ switch_queue_interrupt_all(EVENT_QUEUE[x]);
}
for (x = 0; x < SOFT_MAX_DISPATCH; x++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch queue %d\n", x);
- switch_queue_push(EVENT_DISPATCH_QUEUE[x], NULL);
+ switch_queue_trypush(EVENT_DISPATCH_QUEUE[x], NULL);
+ switch_queue_interrupt_all(EVENT_DISPATCH_QUEUE[x]);
}
while (x < 10000 && THREAD_COUNT) {
@@ -453,7 +467,35 @@
}
last = THREAD_COUNT;
}
+
+ for (x = 0; x < SOFT_MAX_DISPATCH; x++) {
+ void *pop = NULL;
+ switch_event_t *event = NULL;
+ switch_status_t st;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch thread %d\n", x);
+ switch_thread_join(&st, EVENT_DISPATCH_QUEUE_THREADS[x]);
+
+ while (switch_queue_trypop(EVENT_DISPATCH_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) {
+ event = (switch_event_t *) pop;
+ switch_event_destroy(&event);
+ }
+ }
+ for (x = 0; x < NUMBER_OF_QUEUES; x++) {
+ void *pop = NULL;
+ switch_event_t *event = NULL;
+ switch_status_t st;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping queue thread %d\n", x);
+ switch_thread_join(&st, EVENT_QUEUE_THREADS[x]);
+
+ while (switch_queue_trypop(EVENT_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) {
+ event = (switch_event_t *) pop;
+ switch_event_destroy(&event);
+ }
+ }
+
for (hi = switch_hash_first(NULL, CUSTOM_HASH); hi; hi = switch_hash_next(hi)) {
switch_event_subclass_t *subclass;
switch_hash_this(hi, &var, NULL, &val);
@@ -472,7 +514,6 @@
static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t *pool)
{
- switch_thread_t *thread;
switch_threadattr_t *thd_attr;
uint32_t index = 0;
@@ -492,8 +533,7 @@
switch_threadattr_create(&thd_attr, pool);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_priority_increase(thd_attr);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_thread_create(&thread, thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool);
+ switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index);
}
@@ -502,18 +542,26 @@
SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
{
- switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
switch_assert(pool != NULL);
+ THRUNTIME_POOL = RUNTIME_POOL = pool;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Eventing Engine.\n");
+ switch_thread_rwlock_create(&RWLOCK, RUNTIME_POOL);
+ switch_mutex_init(&BLOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
+ switch_mutex_init(&POOL_LOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
+ switch_mutex_init(&EVENT_QUEUE_MUTEX, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
+ switch_core_hash_init(&CUSTOM_HASH, RUNTIME_POOL);
+
+ switch_mutex_lock(EVENT_QUEUE_MUTEX);
+ SYSTEM_RUNNING = -1;
+ switch_mutex_unlock(EVENT_QUEUE_MUTEX);
switch_threadattr_create(&thd_attr, pool);
- switch_threadattr_detach_set(thd_attr, 1);
gethostname(hostname, sizeof(hostname));
switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), AF_INET);
switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), AF_INET6);
- THRUNTIME_POOL = RUNTIME_POOL = pool;
switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
switch_queue_create(&EVENT_QUEUE[1], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
@@ -521,21 +569,13 @@
switch_queue_create(&EVENT_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
switch_queue_create(&EVENT_HEADER_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Eventing Engine.\n");
- switch_thread_rwlock_create(&RWLOCK, RUNTIME_POOL);
- switch_mutex_init(&BLOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
- switch_mutex_init(&POOL_LOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
- switch_mutex_init(&EVENT_QUEUE_MUTEX, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
- switch_core_hash_init(&CUSTOM_HASH, RUNTIME_POOL);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_priority_increase(thd_attr);
- switch_threadattr_detach_set(thd_attr, 1);
launch_dispatch_threads(1, DISPATCH_QUEUE_LEN, RUNTIME_POOL);
- switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
- switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);
- switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL);
+ switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
+ switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);
+ switch_thread_create(&EVENT_QUEUE_THREADS[2], thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL);
while (!THREAD_COUNT) {
switch_cond_next();
@@ -1029,7 +1069,7 @@
if (SYSTEM_RUNNING <= 0) {
/* sorry we're closed */
switch_event_destroy(event);
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_SUCCESS;
}
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Name", switch_event_name((*event)->event_id));
Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/trunk/src/switch_loadable_module.c Thu Feb 19 19:10:59 2009
@@ -52,6 +52,7 @@
switch_module_shutdown_t switch_module_shutdown;
switch_memory_pool_t *pool;
switch_status_t status;
+ switch_thread_t *thread;
};
struct switch_loadable_module_container {
@@ -117,7 +118,7 @@
if (module->switch_module_runtime) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting runtime thread for %s\n", module->module_interface->module_name);
- switch_core_launch_thread(switch_loadable_module_exec, module, loadable_modules.pool);
+ module->thread = switch_core_launch_thread(switch_loadable_module_exec, module, loadable_modules.pool);
}
}
switch_mutex_unlock(loadable_modules.mutex);
@@ -910,7 +911,7 @@
} else if ((status = switch_loadable_module_load_file(path, file, global, &new_module)) == SWITCH_STATUS_SUCCESS) {
if ((status = switch_loadable_module_process(file, new_module)) == SWITCH_STATUS_SUCCESS && runtime) {
if (new_module->switch_module_runtime) {
- switch_core_launch_thread(switch_loadable_module_exec, new_module, new_module->pool);
+ new_module->thread = switch_core_launch_thread(switch_loadable_module_exec, new_module, new_module->pool);
}
} else if (status != SWITCH_STATUS_SUCCESS) {
*err = "module load routine returned an error";
@@ -1053,7 +1054,7 @@
module->switch_module_runtime = switch_module_runtime;
}
if (runtime && module->switch_module_runtime) {
- switch_core_launch_thread(switch_loadable_module_exec, module, module->pool);
+ module->thread = switch_core_launch_thread(switch_loadable_module_exec, module, module->pool);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", module_interface->module_name);
return switch_loadable_module_process((char *) module->filename, module);
@@ -1241,6 +1242,13 @@
if (unload && module->status != SWITCH_STATUS_NOUNLOAD && !(flags & SCF_VG)) {
switch_memory_pool_t *pool;
+ switch_status_t st;
+
+ if (module->thread) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s stopping runtime thread.\n", module->module_interface->module_name);
+ switch_thread_join(&st, module->thread);
+ }
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s unloaded.\n", module->module_interface->module_name);
switch_dso_destroy(&module->lib);
if ((pool = module->pool)) {
Modified: freeswitch/trunk/src/switch_log.c
==============================================================================
--- freeswitch/trunk/src/switch_log.c (original)
+++ freeswitch/trunk/src/switch_log.c Thu Feb 19 19:10:59 2009
@@ -193,6 +193,8 @@
return SWITCH_STATUS_SUCCESS;
}
+static switch_thread_t *thread;
+
static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *thread, void *obj)
{
@@ -382,7 +384,6 @@
SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool, switch_bool_t colorize)
{
- switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
switch_assert(pool != NULL);
@@ -397,7 +398,6 @@
switch_queue_create(&LOG_RECYCLE_QUEUE, SWITCH_CORE_QUEUE_LEN, LOG_POOL);
switch_mutex_init(&BINDLOCK, SWITCH_MUTEX_NESTED, LOG_POOL);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_threadattr_detach_set(thd_attr, 1);
switch_thread_create(&thread, thd_attr, log_thread, NULL, LOG_POOL);
while (!THREAD_RUNNING) {
@@ -433,12 +433,16 @@
SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void)
{
+ switch_status_t st;
THREAD_RUNNING = -1;
switch_queue_push(LOG_QUEUE, NULL);
while (THREAD_RUNNING) {
switch_cond_next();
}
+
+ switch_thread_join(&st, thread);
+
switch_core_memory_reclaim_logger();
return SWITCH_STATUS_SUCCESS;
1
0
[commit] r12172 - freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs
by FreeSWITCH SVN 19 Feb '09
by FreeSWITCH SVN 19 Feb '09
19 Feb '09
Author: gmaruzz
Date: Thu Feb 19 17:48:13 2009
New Revision: 12172
Log:
skypiax: updated default.xml dialplan with skypiax inside
Modified:
freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/default.xml
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/default.xml
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/default.xml (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/configs/default.xml Thu Feb 19 17:48:13 2009
@@ -15,33 +15,11 @@
<context name="default">
<extension name="unloop">
- <condition field="$${unroll_loops}" expression="^true$"/>
+ <condition field="${unroll_loops}" expression="^true$"/>
<condition field="${sip_looped_call}" expression="^true$">
<action application="deflect" data="${destination_number}"/>
</condition>
</extension>
-
- <!--
- Try to get the domain from the sip_auth_realm otherwise it will
- default domain in vars.xml for cases it can't figure it out.
-
- -->
- <extension name="set_domain" continue="true">
- <condition field="${domain_name}" expression="^$"/>
- <condition field="source" expression="mod_sofia"/>
- <condition field="${sip_auth_realm}" expression="^$">
- <action application="set" data="domain_name=$${domain}"/>
- <anti-action application="set" data="domain_name=${sip_auth_realm}"/>
- </condition>
- </extension>
-
- <!-- Set the domain -->
- <extension name="set_domain_openzap" continue="true">
- <condition field="${domain_name}" expression="^$"/>
- <condition field="source" expression="mod_openzap">
- <action application="set" data="domain_name=$${domain}"/>
- </condition>
- </extension>
<!-- Example of doing things based on time of day. -->
<extension name="tod_example" continue="true">
@@ -94,6 +72,15 @@
<condition field="${call_debug}" expression="^true$" break="never">
<action application="info"/>
</condition>
+ <!--
+ This is an example of how to auto detect if telephone-event is missing and activate inband detection
+ -->
+ <!--
+ <condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never">
+ <action application="set" data="rtp_payload_number=$1"/>
+ <anti-action application="start_dtmf"/>
+ </condition>
+ -->
<condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never">
<action application="set" data="sip_secure_media=true"/>
<!-- Offer SRTP on outbound legs if we have it on inbound. -->
@@ -188,13 +175,8 @@
</extension>
<extension name="extension-intercom">
- <!-- <condition field="${sip_to_params}" expression="intercom\=true"/> -->
<condition field="destination_number" expression="^8(10[01][0-9])$">
<action application="set" data="dialed_extension=$1"/>
- <!-- This Alert-Info seems to be a case for Intercom for Polycom which sip_auto_answer=true covers already. -->
- <!--<action application="export"><![CDATA[alert_info=<sip:${domain_name}>;Ring;Answer]]></action>-->
- <action application="export"><![CDATA[sip_h_Call-Info=<sip:${domain_name}>;answer-after=0]]></action>
- <action application="export" data="sip_invite_params=intercom=true"/>
<action application="export" data="sip_auto_answer=true"/>
<action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
</condition>
@@ -211,32 +193,44 @@
<condition field="destination_number" expression="^(10[01][0-9])$">
<action application="set" data="dialed_extension=$1"/>
<action application="export" data="dialed_extension=$1"/>
- </condition>
- <condition field="destination_number" expression="^${caller_id_number}$">
- <action application="set" data="voicemail_authorized=${sip_authorized}"/>
+ <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
+ <action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
+ <action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+ <action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
+ <action application="set" data="ringback=${us-ring}"/>
+ <action application="set" data="transfer_ringback=$${hold_music}"/>
+ <action application="set" data="call_timeout=30"/>
+ <!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
+ <action application="set" data="hangup_after_bridge=true"/>
+ <!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
+ <action application="set" data="continue_on_fail=true"/>
+ <action application="db" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
+ <action application="db" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
+ <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
+ <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
+ <action application="db" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
+ <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
<action application="answer"/>
<action application="sleep" data="1000"/>
- <action application="voicemail" data="check default ${domain_name} ${dialed_extension}"/>
- <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
- <anti-action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
- <anti-action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
- <anti-action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
- <anti-action application="set" data="ringback=${us-ring}"/>
- <anti-action application="set" data="transfer_ringback=$${hold_music}"/>
- <anti-action application="set" data="call_timeout=30"/>
- <!-- <anti-action application="set" data="sip_exclude_contact=${network_addr}"/> -->
- <anti-action application="set" data="hangup_after_bridge=true"/>
- <!--<anti-action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
- <anti-action application="set" data="continue_on_fail=true"/>
- <anti-action application="db" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
- <anti-action application="db" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
- <anti-action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
- <!--<anti-action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
- <anti-action application="db" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
- <anti-action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
- <anti-action application="answer"/>
- <anti-action application="sleep" data="1000"/>
- <anti-action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
+ <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
+ </condition>
+ </extension>
+
+ <extension name="group_dial_sales">
+ <condition field="destination_number" expression="^2000$">
+ <action application="bridge" data="${group_call(sales@${domain_name})}"/>
+ </condition>
+ </extension>
+
+ <extension name="group_dial_support">
+ <condition field="destination_number" expression="^2001$">
+ <action application="bridge" data="group/support@${domain_name}"/>
+ </condition>
+ </extension>
+
+ <extension name="group_dial_billing">
+ <condition field="destination_number" expression="^2002$">
+ <action application="bridge" data="group/billing@${domain_name}"/>
</condition>
</extension>
@@ -250,7 +244,7 @@
<!-- voicemail main extension -->
<extension name="vmain">
- <condition field="destination_number" expression="^vmain|4000$">
+ <condition field="destination_number" expression="^vmain|4000|\*98$">
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="voicemail" data="check default ${domain_name}"/>
@@ -285,7 +279,6 @@
</extension>
-
<!--
start a dynamic conference with the settings of the "default" conference profile in conference.conf.xml
-->
@@ -309,30 +302,70 @@
<action application="conference" data="$1-${domain_name}@ultrawideband"/>
</condition>
</extension>
+ <!-- MONO 48kHz conferences -->
+ <extension name="cdquality_conferences">
+ <condition field="destination_number" expression="^(33\d{2})$">
+ <action application="answer"/>
+ <action application="conference" data="$1-${domain_name}@cdquality"/>
+ </condition>
+ </extension>
<!-- dial the freeswitch conference via SIP-->
<extension name="freeswitch_public_conf_via_sip">
- <condition field="destination_number" expression="^9(888|1616)$">
+ <condition field="destination_number" expression="^9(888|1616|3232)$">
+ <action application="export" data="hold_music=silence"/>
<action application="bridge" data="sofia/${use_profile}/$1(a)conference.freeswitch.org"/>
</condition>
</extension>
- <!--This extension will start a conference and invite several people upon entering -->
- <extension name="mad_boss">
+ <!--
+ This extension will start a conference and invite a group.
+ At anytime the participant can dial *2 to bridge directly to the boss.
+ All other callers are then hung up on.
+ -->
+ <extension name="mad_boss_intercom">
<condition field="destination_number" expression="^0911$">
+ <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss1"/>
+ <action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
+ <action application="set" data="conference_auto_outcall_timeout=60"/>
+ <action application="set" data="conference_auto_outcall_flags=mute"/>
+ <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>
+ <action application="set" data="sip_exclude_contact=${network_addr}"/>
+ <action application="conference_set_auto_outcall" data="${group_call(sales)}"/>
+ <action application="conference" data="madboss_intercom1@default+flags{endconf|deaf}"/>
+ </condition>
+ </extension>
+
+ <!--
+ This extension will start a conference and invite a few of people.
+ At anytime the participant can dial *2 to bridge directly to the boss.
+ All other callers are then hung up on.
+ -->
+ <extension name="mad_boss_intercom">
+ <condition field="destination_number" expression="^0912$">
+ <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss2"/>
+ <action application="set" data="conference_auto_outcall_caller_id_number=0912"/>
+ <action application="set" data="conference_auto_outcall_timeout=60"/>
+ <action application="set" data="conference_auto_outcall_flags=mute"/>
+ <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>
+ <action application="set" data="sip_exclude_contact=${network_addr}"/>
+ <action application="conference_set_auto_outcall" data="loopback/9999"/>
+ <action application="conference" data="madboss_intercom2@default+flags{endconf|deaf}"/>
+ </condition>
+ </extension>
+ <!--This extension will start a conference and invite several people upon entering -->
+ <extension name="mad_boss">
+ <condition field="destination_number" expression="^0913$">
<!--These params effect the outcalls made once you join-->
<action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss"/>
<action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
<action application="set" data="conference_auto_outcall_timeout=60"/>
<action application="set" data="conference_auto_outcall_flags=none"/>
<!--<action application="set" data="conference_auto_outcall_announce=say:You have been called into an emergency conference"/>-->
-
<!--Add as many of these as you need, These are the people you are going to call-->
- <action application="conference_set_auto_outcall" data="sofia/gateway/$${default_provider}/19184238080"/>
- <action application="conference_set_auto_outcall" data="sofia/default/888(a)conference.freeswitch.org"/>
-
- <action application="conference" data="cool@default"/>
+ <action application="conference_set_auto_outcall" data="loopback/9999"/>
+ <action application="conference" data="madboss3@default"/>
</condition>
</extension>
@@ -458,6 +491,22 @@
</condition>
</extension>
+ <extension name="fax_receive">
+ <condition field="destination_number" expression="^9978$">
+ <action application="answer" />
+ <action application="playback" data="silence_stream://2000"/>
+ <action application="rxfax" data="/tmp/rxfax.tif"/>
+ <action application="hangup"/>
+ </condition>
+ </extension>
+
+ <extension name="fax_transmit">
+ <condition field="destination_number" expression="^9979$">
+ <action application="txfax" data="/tmp/txfax.tif"/>
+ <action application="hangup"/>
+ </condition>
+ </extension>
+
<!-- Send a 180 and let the far end generate ringback. -->
<extension name="ringback_180">
<condition field="destination_number" expression="^9980$">
@@ -586,9 +635,6 @@
-->
<!--
- This is an example of how to override the RURI on an outgoing invite to a registered contact.
- -->
- <!--
<extension name="refer">
<condition field="${sip_refer_to}">
<expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression>
@@ -601,7 +647,11 @@
<action application="bridge" data="sofia/${use_profile}/${refer_user}@${refer_domain}"/>
</condition>
</extension>
-
+ -->
+ <!--
+ This is an example of how to override the RURI on an outgoing invite to a registered contact.
+ -->
+ <!--
<extension name="ruri">
<condition field="destination_number" expression="^ruri$">
<action application="bridge" data="sofia/${ruri_profile}/${ruri_user}${regex(${sofia_contact(${ruri_contact})}|^[^\(a)]+(.*)|%1)}"/>
1
0
19 Feb '09
Author: brian
Date: Thu Feb 19 15:43:51 2009
New Revision: 12171
Log:
use -latest for this so it doesn't conflict with 1.0.3 release
Modified:
freeswitch/trunk/src/mod/asr_tts/mod_flite/Makefile
Modified: freeswitch/trunk/src/mod/asr_tts/mod_flite/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_flite/Makefile (original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_flite/Makefile Thu Feb 19 15:43:51 2009
@@ -14,7 +14,7 @@
include $(BASE)/build/modmake.rules
$(FLITE_DIR):
- $(GETLIB) $(FLITE).tar.gz
+ $(GETLIB) $(FLITE)-latest.tar.gz
$(FLITE_DIR)/Makefile: $(FLITE_DIR)
cd $(FLITE_DIR) && CFLAGS="-fPIC" ./configure
1
0