mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-15 11:29:56 +00:00
*) Add support for unified config:
When config file does not exist the system will browse freeswitch.conf (if it exists) for an embedded file. Embeded files denoted with +file.conf Terminated by either another [+XXX] or EOF eg [+iax.conf] ... [+exosip.conf] ... EOF *) Change default examples to use this method *) Fix small bug in core to pass along failure when outgoing channel fails. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@663 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b1150960c1
commit
9bfd7ae25a
@ -1,7 +0,0 @@
|
|||||||
[settings]
|
|
||||||
|
|
||||||
directory_name => ldap
|
|
||||||
host => ldap.mydomain.org
|
|
||||||
dn => cn=Manager,dc=mydomain,dc=org
|
|
||||||
pass => mypass
|
|
||||||
base => dc=mydomain,dc=org
|
|
@ -1,3 +0,0 @@
|
|||||||
[settings]
|
|
||||||
address => 225.0.0.37
|
|
||||||
port => 12345
|
|
@ -1,5 +0,0 @@
|
|||||||
[settings]
|
|
||||||
port => 5060
|
|
||||||
dialplan => demo
|
|
||||||
rtp_min_port => 10000
|
|
||||||
rtp_max_port => 20000
|
|
@ -1,9 +0,0 @@
|
|||||||
[extensions]
|
|
||||||
|
|
||||||
1000 => playback /tmp/siriusraw.raw
|
|
||||||
|
|
||||||
; to time from a timer instead of from the input stream use
|
|
||||||
; 1000 => playback /tmp/siriusraw.raw soft
|
|
||||||
|
|
||||||
; call the freeswitch conference
|
|
||||||
888 => bridge iax/guest@66.250.68.194/888
|
|
174
conf/freeswitch.conf
Normal file
174
conf/freeswitch.conf
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
; Unified Config file
|
||||||
|
; each section denoted with a + could also be in it's own file
|
||||||
|
|
||||||
|
;---- MODULES
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+modules.conf]
|
||||||
|
[modules]
|
||||||
|
|
||||||
|
; If this option is the first one the rest of them will be ignored
|
||||||
|
; If it is not the first one, _it_ will be ignored
|
||||||
|
;load => all
|
||||||
|
|
||||||
|
; Event Handlers
|
||||||
|
;load => mod_event_multicast
|
||||||
|
;load => mod_event_test
|
||||||
|
;load => mod_zeroconf
|
||||||
|
;load => mod_xmpp_event
|
||||||
|
|
||||||
|
; Directory Interfaces
|
||||||
|
load => mod_ldap
|
||||||
|
|
||||||
|
; Endpoints
|
||||||
|
load => mod_exosip
|
||||||
|
load => mod_iax
|
||||||
|
;load => mod_portaudio
|
||||||
|
;load => mod_woomera
|
||||||
|
|
||||||
|
; Applications
|
||||||
|
load => mod_bridgecall
|
||||||
|
load => mod_ivrtest
|
||||||
|
load => mod_playback
|
||||||
|
|
||||||
|
; Dialplan Interfaces
|
||||||
|
load => mod_dialplan_demo
|
||||||
|
load => mod_dialplan_directory
|
||||||
|
load => mod_pcre
|
||||||
|
|
||||||
|
; Codec Interfaces
|
||||||
|
load => mod_g711
|
||||||
|
load => mod_gsm
|
||||||
|
load => mod_l16
|
||||||
|
load => mod_speex
|
||||||
|
|
||||||
|
; File Format Interfaces
|
||||||
|
load => mod_sndfile
|
||||||
|
|
||||||
|
; Timers
|
||||||
|
load => mod_softtimer
|
||||||
|
|
||||||
|
|
||||||
|
load => mod_wanpipe
|
||||||
|
|
||||||
|
;---- IAX PROTOCOL
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+iax.conf]
|
||||||
|
[settings]
|
||||||
|
debug => 0
|
||||||
|
port => 4569
|
||||||
|
dialplan => demo
|
||||||
|
codec_prefs => PCMU,PCMA,speex,L16
|
||||||
|
codec_master => us
|
||||||
|
codec_rates=8
|
||||||
|
|
||||||
|
;---- SIP PROTOCOL
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+exosip.conf]
|
||||||
|
[settings]
|
||||||
|
debug => 10
|
||||||
|
port => 5060
|
||||||
|
dialplan => demo
|
||||||
|
codec_prefs => PCMU
|
||||||
|
|
||||||
|
;---- WOOMERA PROTOCOL
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+woomera.conf]
|
||||||
|
[settings]
|
||||||
|
debug=0
|
||||||
|
|
||||||
|
;---- WANPIPE PRI
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+wanpipe.conf]
|
||||||
|
[settings]
|
||||||
|
debug => 0
|
||||||
|
dialplan => demo
|
||||||
|
bpf => 320
|
||||||
|
|
||||||
|
[span]
|
||||||
|
span => 1
|
||||||
|
node => cpe
|
||||||
|
switch => ni2
|
||||||
|
dp = national
|
||||||
|
l1 = ulaw
|
||||||
|
bchan => 1-23
|
||||||
|
dchan => 24
|
||||||
|
dialplan => demo
|
||||||
|
|
||||||
|
|
||||||
|
;---- SOUND CARD CHANNEL
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+portaudio.conf]
|
||||||
|
[settings]
|
||||||
|
debug => 2
|
||||||
|
dialplan => demo
|
||||||
|
|
||||||
|
; partial string match on something in the name or the device #
|
||||||
|
indev => USB
|
||||||
|
outdev => USB
|
||||||
|
|
||||||
|
cid_name => FreeSwitch
|
||||||
|
cid_num => 5555551212
|
||||||
|
|
||||||
|
;--- ZEROCONF
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+zeroconf.conf]
|
||||||
|
[settings]
|
||||||
|
|
||||||
|
publish => yes
|
||||||
|
browse => _sip._udp
|
||||||
|
|
||||||
|
;---- XMPP EVENT
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+xmpp_event.conf]
|
||||||
|
[settings]
|
||||||
|
|
||||||
|
#debug => 1
|
||||||
|
jid => freeswitch@my.jabber.com/me
|
||||||
|
passwd => mypass
|
||||||
|
|
||||||
|
target_jid => freeswitch@reader.org/him
|
||||||
|
|
||||||
|
;---- LDAP DIALPLAN
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+dialplan_directory.conf]
|
||||||
|
[settings]
|
||||||
|
|
||||||
|
directory_name => ldap
|
||||||
|
host => ldap.freeswitch.org
|
||||||
|
dn => cn=Manager,dc=freeswitch,dc=org
|
||||||
|
pass => test
|
||||||
|
base => dc=freeswitch,dc=org
|
||||||
|
|
||||||
|
;----REGULAR EXPRESSION DIALPLAN
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+regextensions.conf]
|
||||||
|
|
||||||
|
; any extension starting with a '4'
|
||||||
|
; strip the '4' and consider the rest a numeric filename
|
||||||
|
[playfile]
|
||||||
|
regex => ^4(\d+)
|
||||||
|
match => playback /var/sounds/$1.raw
|
||||||
|
|
||||||
|
; send everything to wanpipe isdn
|
||||||
|
[gateway]
|
||||||
|
regex => (.*)
|
||||||
|
match => bridge wanpipe/a/a/$1
|
||||||
|
|
||||||
|
; ordniary extension
|
||||||
|
[plain_old_extension]
|
||||||
|
regex => 9999
|
||||||
|
match => playback /var/sounds/beep.gsm
|
||||||
|
|
||||||
|
;---- BASIC EXTENSIONS
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
[+extensions.conf]
|
||||||
|
[extensions]
|
||||||
|
|
||||||
|
1000 => playback /var/sounds/beep.raw
|
||||||
|
|
||||||
|
; to time from a timer instead of from the input stream use
|
||||||
|
; 1000 => playback /var/sounds/beep.raw soft
|
||||||
|
|
||||||
|
; call the freeswitch conference
|
||||||
|
888 => bridge iax/guest@66.250.68.194/888
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
[settings]
|
|
||||||
debug => 2
|
|
||||||
port => 4569
|
|
||||||
dialplan => demo
|
|
||||||
codec_prefs => PCMU,PCMA,speex,L16
|
|
||||||
codec_master => us
|
|
@ -1,47 +0,0 @@
|
|||||||
[modules]
|
|
||||||
|
|
||||||
; If this option is the first one the rest of them will be ignored
|
|
||||||
;load => all
|
|
||||||
|
|
||||||
; Extension will be chosen automaticly if not specified (.dll for windows, .so for UNIX)
|
|
||||||
; Full paths will be taken "as is" (eg /some/dir/mymod.so)
|
|
||||||
|
|
||||||
; Event Handlers
|
|
||||||
;load => mod_event_multicast
|
|
||||||
load => mod_zeroconf
|
|
||||||
load => mod_xmpp_event
|
|
||||||
|
|
||||||
; Directory Interfaces
|
|
||||||
load => mod_ldap
|
|
||||||
|
|
||||||
; Endpoints
|
|
||||||
load => mod_exosip
|
|
||||||
load => mod_iax
|
|
||||||
load => mod_woomera
|
|
||||||
|
|
||||||
; Applications
|
|
||||||
load => mod_bridgecall
|
|
||||||
load => mod_ivrtest
|
|
||||||
load => mod_playback
|
|
||||||
|
|
||||||
; Dialplan Interfaces
|
|
||||||
load => mod_dialplan_demo
|
|
||||||
load => mod_dialplan_directory
|
|
||||||
load => mod_pcre
|
|
||||||
|
|
||||||
; Codec Interfaces
|
|
||||||
load => mod_g711
|
|
||||||
load => mod_gsm
|
|
||||||
load => mod_l16
|
|
||||||
load => mod_speex
|
|
||||||
|
|
||||||
; File Format Interfaces
|
|
||||||
load => mod_sndfile
|
|
||||||
|
|
||||||
; Timers
|
|
||||||
load => mod_softtimer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
[settings]
|
|
||||||
debug => 2
|
|
||||||
dialplan => demo
|
|
||||||
|
|
||||||
; partial string match on something in the name or the device #
|
|
||||||
indev => USB
|
|
||||||
outdev => USB
|
|
||||||
|
|
||||||
cid_name => FreeSwitch
|
|
||||||
cid_num => 5555551212
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
[playfiles]
|
|
||||||
regex => 4(.*)
|
|
||||||
match => playback /tmp/$1.raw
|
|
||||||
|
|
||||||
[passthrough]
|
|
||||||
regex => 1(.*)
|
|
||||||
match => bridge iax/guest@1.2.3.4/$1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
[settings]
|
|
||||||
debug => 1
|
|
||||||
dialplan => pcre
|
|
||||||
mtu => 320
|
|
||||||
dtmf_on => 150
|
|
||||||
dtmf_off => 50
|
|
||||||
|
|
||||||
[span]
|
|
||||||
span => 1
|
|
||||||
node => cpe
|
|
||||||
|
|
||||||
;switch => ni2
|
|
||||||
switch => dms100
|
|
||||||
;switch => lucent5e
|
|
||||||
;switch => att4ess
|
|
||||||
;switch => euroisdn
|
|
||||||
;switch => gr303eoc
|
|
||||||
;switch => gr303tmc
|
|
||||||
|
|
||||||
dp => national
|
|
||||||
;dp => international
|
|
||||||
;dp => local
|
|
||||||
;dp => private
|
|
||||||
;dp => unknown
|
|
||||||
|
|
||||||
l1 => ulaw
|
|
||||||
;l1 => alaw
|
|
||||||
|
|
||||||
bchan => 1-23
|
|
||||||
dchan => 24
|
|
||||||
dialplan => pcre
|
|
@ -1,8 +0,0 @@
|
|||||||
[settings]
|
|
||||||
debug=2
|
|
||||||
|
|
||||||
[profile]
|
|
||||||
host=localhost
|
|
||||||
port=42420
|
|
||||||
audio_ip=10.200.10.20
|
|
||||||
dialplan=demo
|
|
@ -1,9 +0,0 @@
|
|||||||
[settings]
|
|
||||||
|
|
||||||
debug => 0
|
|
||||||
|
|
||||||
#jid => somebody@jabber.org
|
|
||||||
#passwd => pass
|
|
||||||
#target_jid => somebodyelse@jabber.org
|
|
||||||
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
[settings]
|
|
||||||
|
|
||||||
; cant do both at once WTF?
|
|
||||||
publish => yes
|
|
||||||
#browse => _sip._udp
|
|
||||||
|
|
@ -70,12 +70,18 @@ struct switch_config {
|
|||||||
char *path;
|
char *path;
|
||||||
/*! current category */
|
/*! current category */
|
||||||
char category[256];
|
char category[256];
|
||||||
|
/*! current section */
|
||||||
|
char section[256];
|
||||||
/*! buffer of current line being read */
|
/*! buffer of current line being read */
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
/*! current line number in file */
|
/*! current line number in file */
|
||||||
int lineno;
|
int lineno;
|
||||||
/*! current category number in file */
|
/*! current category number in file */
|
||||||
int catno;
|
int catno;
|
||||||
|
/*! current section number in file */
|
||||||
|
int sectno;
|
||||||
|
|
||||||
|
int lockto;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -73,6 +73,7 @@ static struct {
|
|||||||
int dtmf_on;
|
int dtmf_on;
|
||||||
int dtmf_off;
|
int dtmf_off;
|
||||||
int supress_dtmf_tone;
|
int supress_dtmf_tone;
|
||||||
|
int configured_spans;
|
||||||
char *dialplan;
|
char *dialplan;
|
||||||
} globals;
|
} globals;
|
||||||
|
|
||||||
@ -351,6 +352,12 @@ static switch_status wanpipe_on_transmit(switch_core_session *session)
|
|||||||
static switch_status wanpipe_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
|
static switch_status wanpipe_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
|
||||||
switch_core_session **new_session)
|
switch_core_session **new_session)
|
||||||
{
|
{
|
||||||
|
if (!globals.configured_spans) {
|
||||||
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error No Spans Configured.\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((*new_session = switch_core_session_request(&wanpipe_endpoint_interface, NULL))) {
|
if ((*new_session = switch_core_session_request(&wanpipe_endpoint_interface, NULL))) {
|
||||||
struct private_object *tech_pvt;
|
struct private_object *tech_pvt;
|
||||||
switch_channel *channel;
|
switch_channel *channel;
|
||||||
@ -1177,7 +1184,7 @@ static int config_wanpipe(int reload)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
globals.configured_spans = 0;
|
||||||
for(current_span = 1; current_span < MAX_SPANS; current_span++) {
|
for(current_span = 1; current_span < MAX_SPANS; current_span++) {
|
||||||
if (SPANS[current_span]) {
|
if (SPANS[current_span]) {
|
||||||
|
|
||||||
@ -1195,6 +1202,7 @@ static int config_wanpipe(int reload)
|
|||||||
}
|
}
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Launch span %d\n", current_span);
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Launch span %d\n", current_span);
|
||||||
pri_thread_launch(&SPANS[current_span]->spri);
|
pri_thread_launch(&SPANS[current_span]->spri);
|
||||||
|
globals.configured_spans++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,15 +52,46 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config *cfg, char *file_path)
|
|||||||
path = path_buf;
|
path = path_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path || (f = fopen(path, "r")) == 0) {
|
if (!path) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(cfg, 0, sizeof(*cfg));
|
memset(cfg, 0, sizeof(*cfg));
|
||||||
cfg->file = f;
|
cfg->lockto = -1;
|
||||||
cfg->path = path;
|
|
||||||
|
|
||||||
return 1;
|
if (!(f = fopen(path, "r"))) {
|
||||||
|
if (file_path[0] != '/') {
|
||||||
|
int last = -1;
|
||||||
|
char *var, *val;
|
||||||
|
|
||||||
|
snprintf(path_buf, sizeof(path_buf), "%s/freeswitch.conf", SWITCH_CONF_DIR);
|
||||||
|
path = path_buf;
|
||||||
|
|
||||||
|
if ((f = fopen(path, "r")) == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg->file = f;
|
||||||
|
cfg->path = path;
|
||||||
|
|
||||||
|
while (switch_config_next_pair(cfg, &var, &val)) {
|
||||||
|
if ((cfg->sectno != last) && !strcmp(cfg->section, file_path)) {
|
||||||
|
cfg->lockto = cfg->sectno;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_config_close_file(cfg);
|
||||||
|
memset(cfg, 0, sizeof(*cfg));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
cfg->file = f;
|
||||||
|
cfg->path = path;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,8 +127,21 @@ SWITCH_DECLARE(int) switch_config_next_pair(switch_config *cfg, char **var, char
|
|||||||
if (**var == '[' && (end = strchr(*var, ']')) != 0) {
|
if (**var == '[' && (end = strchr(*var, ']')) != 0) {
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
(*var)++;
|
(*var)++;
|
||||||
switch_copy_string(cfg->category, *var, sizeof(cfg->category));
|
if (**var == '+') {
|
||||||
cfg->catno++;
|
(*var)++;
|
||||||
|
switch_copy_string(cfg->section, *var, sizeof(cfg->section));
|
||||||
|
cfg->sectno++;
|
||||||
|
|
||||||
|
if (cfg->lockto > -1 && cfg->sectno != cfg->lockto) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cfg->catno = 0;
|
||||||
|
cfg->lineno = 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
switch_copy_string(cfg->category, *var, sizeof(cfg->category));
|
||||||
|
cfg->catno++;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,6 +807,8 @@ SWITCH_DECLARE(switch_status) switch_core_session_outgoing_channel(switch_core_s
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user