mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 12:40:17 +00:00
iax and empty core for opal
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@86 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
3db9df6899
commit
8311b9a01a
@ -2,11 +2,12 @@
|
||||
mod_bridgecall
|
||||
mod_dialplan_demo
|
||||
mod_softtimer
|
||||
mod_woomerachan
|
||||
#mod_woomerachan
|
||||
mod_playback
|
||||
#mod_wanchan
|
||||
mod_speexcodec
|
||||
mod_exosip
|
||||
mod_g711codec
|
||||
mod_rawaudio
|
||||
mod_opalchan
|
||||
mod_iaxchan
|
||||
#mod_opalchan
|
||||
|
@ -55,6 +55,7 @@ SWITCH_DECLARE(switch_dialplan_interface *) loadable_module_get_dialplan_interfa
|
||||
SWITCH_DECLARE(switch_timer_interface *) loadable_module_get_timer_interface(char *name);
|
||||
SWITCH_DECLARE(switch_application_interface *) loadable_module_get_application_interface(char *name);
|
||||
SWITCH_DECLARE(int) loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array, int arraylen);
|
||||
SWITCH_DECLARE(int) loadable_module_get_codecs_sorted(switch_memory_pool *pool, switch_codec_interface **array, int arraylen, char **prefs, int preflen);
|
||||
SWITCH_DECLARE(void) loadable_module_shutdown(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -44,7 +44,8 @@ extern "C" {
|
||||
//#include <apr_poll.h>
|
||||
//#include <sys/types.h>
|
||||
|
||||
#define SWITCH_GLOBAL_VERSION "1.5"
|
||||
#define SWITCH_GLOBAL_VERSION "1"
|
||||
#define SWITCH_MAX_CODECS 30
|
||||
|
||||
typedef enum {
|
||||
SWITCH_STATUS_SUCCESS,
|
||||
|
@ -79,9 +79,10 @@ typedef typeof(tv.tv_usec) switch_suseconds_t;
|
||||
#define switch_strlen_zero(s) (s && *s != '\0') ? 0 : 1
|
||||
#define switch_yield(ms) apr_sleep(ms * 10); apr_thread_yield();
|
||||
|
||||
SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char **array, int arraylen);
|
||||
SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, unsigned int flags, switch_memory_pool *pool);
|
||||
SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms);
|
||||
|
||||
SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len);
|
||||
|
||||
#if !defined(switch_strdupa) && defined(__GNUC__)
|
||||
# define switch_strdupa(s) \
|
||||
|
@ -230,7 +230,7 @@ static switch_status exosip_on_init(switch_core_session *session)
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||
char *dest_uri;
|
||||
switch_codec_interface *codecs[512];
|
||||
switch_codec_interface *codecs[SWITCH_MAX_CODECS];
|
||||
int num_codecs = 0;
|
||||
/* do SIP Goodies...*/
|
||||
|
||||
@ -592,7 +592,7 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
|
||||
}
|
||||
|
||||
switch_clear_flag(tech_pvt, TFLAG_READING);
|
||||
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
@ -751,7 +751,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
|
||||
switch_yield(1000);
|
||||
}
|
||||
}
|
||||
eXosip_quit();
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -785,7 +784,7 @@ static switch_status exosip_create_call(eXosip_event_t *event)
|
||||
|
||||
if ((session = switch_core_session_request(&exosip_endpoint_interface, NULL))) {
|
||||
struct private_object *tech_pvt;
|
||||
switch_codec_interface *codecs[512];
|
||||
switch_codec_interface *codecs[SWITCH_MAX_CODECS];
|
||||
int num_codecs = 0;
|
||||
|
||||
|
||||
@ -1374,15 +1373,16 @@ static int config_exosip(int reload)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "eXosip_listen_addr failed!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
|
||||
switch_mutex_init(&globals.port_lock, SWITCH_MUTEX_NESTED, module_pool);
|
||||
|
||||
|
||||
/* Setup the user agent */
|
||||
eXosip_set_user_agent("OPENSWITCH 2.0");
|
||||
|
||||
eXosip_set_user_agent("FreeSWITCH");
|
||||
|
||||
monitor_thread_run();
|
||||
|
||||
eXosip_quit();
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
@ -241,6 +241,10 @@ SWITCH_DECLARE(switch_channel_state) switch_channel_set_state(switch_channel *ch
|
||||
return state;
|
||||
}
|
||||
|
||||
if (last_state >= CS_HANGUP) {
|
||||
return last_state;
|
||||
}
|
||||
|
||||
/* STUB for more dev
|
||||
case CS_INIT:
|
||||
switch(state) {
|
||||
|
@ -367,3 +367,17 @@ SWITCH_DECLARE(int) loadable_module_get_codecs(switch_memory_pool *pool, switch_
|
||||
return i;
|
||||
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(int) loadable_module_get_codecs_sorted(switch_memory_pool *pool, switch_codec_interface **array, int arraylen, char **prefs, int preflen)
|
||||
{
|
||||
int x, i = 0;
|
||||
switch_codec_interface *codec_interface;
|
||||
|
||||
for(x = 0; x < preflen; x++) {
|
||||
if ((codec_interface = loadable_module_get_codec_interface(prefs[x]))) {
|
||||
array[i++] = codec_interface;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -31,6 +31,50 @@
|
||||
*/
|
||||
#include <switch_utils.h>
|
||||
|
||||
SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < len; i++) {
|
||||
buf[i] = ((buf[i] >> 8) & 0x00ff) | ((buf[i] << 8) & 0xff00);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char **array, int arraylen)
|
||||
{
|
||||
int argc;
|
||||
char *scan;
|
||||
int paren = 0;
|
||||
|
||||
if (!buf || !array || !arraylen) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(array, 0, arraylen * sizeof(*array));
|
||||
|
||||
scan = buf;
|
||||
|
||||
for (argc = 0; *scan && (argc < arraylen - 1); argc++) {
|
||||
array[argc] = scan;
|
||||
for (; *scan; scan++) {
|
||||
if (*scan == '(')
|
||||
paren++;
|
||||
else if (*scan == ')') {
|
||||
if (paren)
|
||||
paren--;
|
||||
} else if ((*scan == delim) && !paren) {
|
||||
*scan++ = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*scan) {
|
||||
array[argc++] = scan;
|
||||
}
|
||||
|
||||
return argc;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, unsigned int flags, switch_memory_pool *pool)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user