wanpipe-3.4.6.tgz

This commit is contained in:
Harald Welte 2021-12-29 18:28:39 +01:00
parent 7bbfefe672
commit 4cfa4b86fd
73 changed files with 1534 additions and 535 deletions

View File

@ -8,7 +8,14 @@ For more info visit: http://wiki.sangoma.com
------------------------------------------------------------------------------
* Tue Aug 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.5
* Tue Sep 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.6
=====================================================================
- Fund a bug in Sangoma_mgd causing channel 31 in each span to
fail. This bug was introduced in 3.4.5 release.
* Tue Sep 16 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.5
=====================================================================
- New firmawre feature for A101/2/5/8: Free Run Timer Interrupt

2
Setup
View File

@ -7327,7 +7327,7 @@ KERNEL_UNAME=`uname -r`
PKG_NAME=wanpipe
DISTR_NAME="WANPIPE"
PROD=wanrouter
PROD_VER=3.4.5
PROD_VER=3.4.6
PROD_HOME=`pwd`
META_CONF=$PROD_HOME/$PROD.rc
WAN_INTR_DIR=$PROD_HOME/interfaces

View File

@ -1,5 +1,5 @@
Package: wanpipe
Version: 3.4.5-0
Version: 3.4.6-0
Section: networking
Priority: optional
Architecture: all

View File

@ -6,7 +6,7 @@
#define WANPIPE_COMPANY "Sangoma Technologies Inc"
/********** LINUX **********/
#define WANPIPE_VERSION "3.4.5"
#define WANPIPE_VERSION "3.4.6"
#define WANPIPE_SUB_VERSION "0"
#define WANPIPE_VERSION_BETA 0
#define WANPIPE_LITE_VERSION "1.1.1"

View File

@ -1,6 +1,6 @@
%define WANPIPE_VER wanpipe-modules
%define name %{WANPIPE_VER}
%define version 3.4.5
%define version 3.4.6
%define release 0
%define serial 1
%define MODULES_DIR /lib/modules
@ -51,7 +51,14 @@ echo "Wanpipe Modules located in %{MODULES_DIR}/%{KVERSION}"
%changelog
* Tue Aug 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.5
* Tue Sep 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.6
=====================================================================
- Fund a bug in Sangoma_mgd causing channel 31 in each span to
fail. This bug was introduced in 3.4.5 release.
* Tue Sep 16 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.5
=====================================================================
- New firmawre feature for A101/2/5/8: Free Run Timer Interrupt

View File

@ -1,7 +1,7 @@
%define KERNEL_VERSION %{?kern_ver}
%define WANPIPE_VER wanpipe-util
%define name %{WANPIPE_VER}
%define version 3.4.5
%define version 3.4.6
%define release 0
%define serial 1
%define ETC_DIR /etc
@ -328,7 +328,14 @@ enable_smg_log;
%changelog
* Tue Aug 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.5
* Tue Sep 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.6
=====================================================================
- Fund a bug in Sangoma_mgd causing channel 31 in each span to
fail. This bug was introduced in 3.4.5 release.
* Tue Sep 16 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.5
=====================================================================
- New firmawre feature for A101/2/5/8: Free Run Timer Interrupt

View File

@ -1,7 +1,7 @@
%define KERNEL_VERSION %{?kern_ver}
%define WANPIPE_VER wanpipe
%define name %{WANPIPE_VER}
%define version 3.4.5
%define version 3.4.6
%define release 0
%define serial 1
%define UTILS_DIR /usr/sbin
@ -255,7 +255,14 @@ install_init;
%changelog
* Tue Aug 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.5
* Tue Sep 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.6
=====================================================================
- Fund a bug in Sangoma_mgd causing channel 31 in each span to
fail. This bug was introduced in 3.4.5 release.
* Tue Sep 16 2009 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.4.5
=====================================================================
- New firmawre feature for A101/2/5/8: Free Run Timer Interrupt

View File

@ -2195,7 +2195,7 @@ init_global_params()
{
if [ $OSYSTEM = "Linux" ]; then
ROUTER_VERSION=3.4.5
ROUTER_VERSION=3.4.6
IFCONFIG_LIST=ifconfig
MODULE_STAT=lsmod
WAN_DRIVERS="wanpipe"

View File

@ -1,13 +1,13 @@
K 25
svn:wc:ra_dav:version-url
V 35
/svn/sangoma_mgd/!svn/ver/193/trunk
/svn/sangoma_mgd/!svn/ver/204/trunk
END
sigboost.h
K 25
svn:wc:ra_dav:version-url
V 46
/svn/sangoma_mgd/!svn/ver/188/trunk/sigboost.h
/svn/sangoma_mgd/!svn/ver/204/trunk/sigboost.h
END
switch_buffer.h
K 25
@ -27,12 +27,6 @@ svn:wc:ra_dav:version-url
V 43
/svn/sangoma_mgd/!svn/ver/1/trunk/sound.raw
END
__smg_ctrl_common
K 25
svn:wc:ra_dav:version-url
V 53
/svn/sangoma_mgd/!svn/ver/193/trunk/__smg_ctrl_common
END
safe_sangoma
K 25
svn:wc:ra_dav:version-url
@ -45,12 +39,6 @@ svn:wc:ra_dav:version-url
V 48
/svn/sangoma_mgd/!svn/ver/1/trunk/callgettest.sh
END
smg_ctrl_pri
K 25
svn:wc:ra_dav:version-url
V 48
/svn/sangoma_mgd/!svn/ver/184/trunk/smg_ctrl_pri
END
ss7box
K 25
svn:wc:ra_dav:version-url
@ -67,7 +55,7 @@ call_signal.c
K 25
svn:wc:ra_dav:version-url
V 49
/svn/sangoma_mgd/!svn/ver/186/trunk/call_signal.c
/svn/sangoma_mgd/!svn/ver/202/trunk/call_signal.c
END
re-sync.sh
K 25
@ -85,7 +73,7 @@ sangoma_mgd.c
K 25
svn:wc:ra_dav:version-url
V 49
/svn/sangoma_mgd/!svn/ver/193/trunk/sangoma_mgd.c
/svn/sangoma_mgd/!svn/ver/204/trunk/sangoma_mgd.c
END
woomera.conf
K 25
@ -115,7 +103,7 @@ sangoma_mgd.h
K 25
svn:wc:ra_dav:version-url
V 49
/svn/sangoma_mgd/!svn/ver/189/trunk/sangoma_mgd.h
/svn/sangoma_mgd/!svn/ver/204/trunk/sangoma_mgd.h
END
q931_cause.h
K 25
@ -135,18 +123,6 @@ svn:wc:ra_dav:version-url
V 43
/svn/sangoma_mgd/!svn/ver/186/trunk/install
END
smg_ctrl_bri
K 25
svn:wc:ra_dav:version-url
V 48
/svn/sangoma_mgd/!svn/ver/175/trunk/smg_ctrl_bri
END
smg_ctrl_ss7
K 25
svn:wc:ra_dav:version-url
V 48
/svn/sangoma_mgd/!svn/ver/181/trunk/smg_ctrl_ss7
END
sangoma_mgd_memdbg.c
K 25
svn:wc:ra_dav:version-url
@ -159,6 +135,12 @@ svn:wc:ra_dav:version-url
V 56
/svn/sangoma_mgd/!svn/ver/189/trunk/sangoma_mgd_common.h
END
smg_ctrl
K 25
svn:wc:ra_dav:version-url
V 44
/svn/sangoma_mgd/!svn/ver/198/trunk/smg_ctrl
END
switch_buffer.c
K 25
svn:wc:ra_dav:version-url
@ -169,7 +151,7 @@ Makefile
K 25
svn:wc:ra_dav:version-url
V 44
/svn/sangoma_mgd/!svn/ver/192/trunk/Makefile
/svn/sangoma_mgd/!svn/ver/203/trunk/Makefile
END
sangoma_mgd_memdbg.h
K 25

View File

@ -1,14 +1,14 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk
https://www.sangomapbx.com/svn/sangoma_mgd
2009-08-17T22:04:54.377308Z
193
2009-09-18T20:42:35.794839Z
204
ncorbic
@ -35,10 +35,10 @@ file
2009-07-17T17:05:47.000000Z
d7641fb196ec8d94dd9e843e92a01ed2
2009-07-17T17:32:27.268768Z
188
2009-09-18T19:50:52.000000Z
2f5277bc3255aa10d68b1df0a63b2de6
2009-09-18T20:42:35.794839Z
204
ncorbic
app
@ -68,19 +68,6 @@ file
157
ncorbic
__smg_ctrl_common
file
2009-08-18T17:27:36.000000Z
65a9acd49617d8c8a018c7196dcc4443
2009-08-17T22:04:54.377308Z
193
ncorbic
has-props
conf_bri
dir
@ -97,19 +84,6 @@ file
ncorbic
has-props
smg_ctrl_pri
file
2009-07-14T20:11:42.000000Z
c7d20fb219b6f09c9839d1e790825e8a
2009-07-13T22:25:11.834953Z
184
ncorbic
has-props
conf
dir
@ -138,10 +112,10 @@ file
2009-07-17T14:59:38.000000Z
641a4b3ba4c49a8f39bcc4709d042f0c
2009-07-16T21:35:39.883599Z
186
2009-09-17T20:37:35.000000Z
94b43fda8af2fc13879f7071793a12dc
2009-09-17T21:31:23.869639Z
202
ncorbic
re-sync.sh
@ -181,6 +155,9 @@ file
161
ncorbic
rc
dir
g711.h
file
@ -226,11 +203,11 @@ file
2009-08-18T17:27:36.000000Z
f65c77a3e5f570fee7081286296d14ea
2009-08-10T15:44:42.284278Z
192
davidy
2009-09-17T20:37:35.000000Z
756ba033691b157a7d8af99d59af9346
2009-09-17T21:48:55.845572Z
203
ncorbic
sangoma_mgd_memdbg.h
file
@ -300,10 +277,10 @@ file
2009-08-18T17:27:36.000000Z
96a2446359704f7ef0373f40439328be
2009-08-17T22:04:54.377308Z
193
2009-09-18T19:50:52.000000Z
0df244b0c94f5fadfeb4a6c5110f7f6a
2009-09-18T20:42:35.794839Z
204
ncorbic
woomera.conf
@ -336,11 +313,11 @@ file
2009-08-18T17:27:36.000000Z
adac2a08453aa9f2077dcb8abc5d7d5b
2009-07-24T16:42:00.883153Z
189
davidy
2009-09-18T19:50:52.000000Z
10830f87ebeabb8913c8a46405750f03
2009-09-18T20:42:35.794839Z
204
ncorbic
q931_cause.h
file
@ -354,19 +331,6 @@ a31121fb876e49155ae5d77812b68cc3
1
root
smg_ctrl_bri
file
2009-05-13T19:31:42.000000Z
2208383568f70510d310fc3be44856eb
2009-05-13T21:19:52.845605Z
175
ncorbic
has-props
install
file
@ -380,16 +344,16 @@ file
ncorbic
has-props
smg_ctrl_ss7
smg_ctrl
file
2009-06-17T21:56:41.000000Z
e8e3f3c1dac4922fb7167d7cd0221256
2009-06-30T21:49:00.856416Z
181
2009-09-17T20:37:35.000000Z
3c25c0a7952abb4488eb6dc3dc356700
2009-09-01T18:37:52.119878Z
198
ncorbic
has-props

View File

@ -1,5 +0,0 @@
K 14
svn:executable
V 1
*
END

View File

@ -1,5 +0,0 @@
K 14
svn:executable
V 1
*
END

View File

@ -1,5 +0,0 @@
K 14
svn:executable
V 1
*
END

View File

@ -33,7 +33,7 @@ CC = gcc
ifndef DESTDIR
ifdef INSTALLPREFIX
DESTDIR=$(INSTALL_PREFIX)
DESTDIR=$(INSTALLPREFIX)
else
DESTDIR=
endif
@ -117,27 +117,34 @@ install_smg: old_cleanup
fi
install -D -m 755 ./safe_sangoma $(DESTDIR)/usr/sbin/safe_sangoma
install -D -m 755 ./__smg_ctrl_common $(DESTDIR)/usr/sbin/__smg_ctrl_common
install -D -m 755 ./smg_ctrl $(DESTDIR)/usr/sbin/smg_ctrl
ifeq "${PRI}" "YES"
@echo "PRI control scripts installed"
@if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.pri $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.pri $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 smg_ctrl_pri $(INSTALLPREFIX)/usr/sbin/smg_ctrl
install -D -m 755 rc/smg.rc.pri $(DESTDIR)/etc/wanpipe/smg.rc
else
ifeq "${BRI}" "YES"
@echo "BRI control scripts installed"
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.bri $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 smg_ctrl_bri $(DESTDIR)/usr/sbin/smg_ctrl
install -D -m 755 rc/smg.rc.bri $(DESTDIR)/etc/wanpipe/smg.rc
else
@echo "SS7 control scripts installed"
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.ss7 $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 smg_ctrl_ss7 $(DESTDIR)/usr/sbin/smg_ctrl
@if [ -e $(DESTDIR)/usr/local/ss7box/sangoma_isupd ]; then \
echo "install -D -m 755 rc/smg.rc.isupd $(DESTDIR)/etc/wanpipe/smg.rc"; \
install -D -m 755 rc/smg.rc.isupd $(DESTDIR)/etc/wanpipe/smg.rc; \
else \
echo "install -D -m 755 rc/smg.rc.ss7boost $(DESTDIR)/etc/wanpipe/smg.rc"; \
install -D -m 755 rc/smg.rc.ss7boost $(DESTDIR)/etc/wanpipe/smg.rc; \
fi
install -D -m 755 scripts/init.d/smgss7_init_ctrl $(DESTDIR)/etc/init.d/smgss7_init_ctrl
install -D -m 755 scripts/init.d/smgss7_init_ctrl $(DESTDIR)/usr/sbin/smgss7_init_ctrl

View File

@ -38,7 +38,8 @@ static struct call_signal_map call_signal_table[] = {
{SIGBOOST_EVENT_HEARTBEAT, "HEARTBEAT"},
{SIGBOOST_EVENT_INSERT_CHECK_LOOP, "LOOP START"},
{SIGBOOST_EVENT_REMOVE_CHECK_LOOP, "LOOP STOP"},
{SIGBOOST_EVENT_DIGIT_IN, "DIGIT_IN"}
{SIGBOOST_EVENT_DIGIT_IN, "DIGIT_IN"},
{SIGBOOST_EVENT_CALL_PROGRESS, "CALL_PROGRESS"}
};
#define USE_SCTP 1

View File

@ -9,7 +9,17 @@
*
* =============================================
*
* v1.54 Nenad Corbic <ncorbic@sangoma.com>
* Bug added in 1.51 release causing call on channel 31 to fail.
*
* v1.53 Nenad Corbic <ncorbic@sangoma.com>
* Added progress message
*
* v1.52 David Yat Sin <dyatsin@sangoma.com>
* Changed sangoma_open_span_chan to __sangoma_span_chan
* to enabled shared used of file descriptors when using
* with PRI in NFAS mode
*
* v1.51 David Yat Sin <dyatsin@sangoma.com>
* MAX_SPANS increased to 32.
* Fix for server.process_table declared incorrectly
@ -296,7 +306,7 @@ struct woomera_server server;
#endif
#define SMG_VERSION "v1.51"
#define SMG_VERSION "v1.54"
/* enable early media */
#if 1
@ -336,9 +346,17 @@ static int drop_seq=0;
#undef SMG_DROP_SEQ
#endif
#if 0
#define SMG_NO_MEDIA
#warning "SMG No Media Defined"
#else
#undef SMG_NO_MEDIA
#endif
const char WELCOME_TEXT[] =
"================================================================================\n"
"Sangoma Media Gateway Daemon v1.51 \n"
"Sangoma Media Gateway Daemon v1.54 \n"
"\n"
"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n"
"Copyright 2005, 2006, 2007 \n"
@ -378,7 +396,7 @@ static int isup_exec_command(int span, int chan, int id, int cmd, int cause)
short_signal_event_t oevent;
int retry=5;
call_signal_event_init(&oevent, cmd, chan, span);
call_signal_event_init((short_signal_event_t*)&oevent, cmd, chan, span);
oevent.release_cause = cause;
if (id >= 0) {
@ -405,6 +423,31 @@ isup_exec_cmd_retry:
return 0;
}
static int isup_exec_event(call_signal_event_t *event)
{
int retry=5;
isup_exec_cmd_retry:
if (call_signal_connection_write(&server.mcon, event) < 0){
--retry;
if (retry <= 0) {
log_printf(SMG_LOG_ALL, server.log,
"Critical System Error: Failed to tx on ISUP socket: %s\n",
strerror(errno));
return -1;
} else {
log_printf(SMG_LOG_ALL, server.log,
"System Warning: Failed to tx on ISUP socket: %s :retry %i\n",
strerror(errno),retry);
}
goto isup_exec_cmd_retry;
}
return 0;
}
static int isup_exec_commandp(int span, int chan, int id, int cmd, int cause)
{
@ -1237,13 +1280,16 @@ static void media_loop_run(struct media_session *ms)
char filename[100];
FILE *filed=NULL;
int loops=0,flags_out=0;
int open_cnt = 0;
open_cnt=0;
sangoma_api_hdr_t hdrframe;
memset(&hdrframe,0,sizeof(hdrframe));
memset(circuit_frame,0,sizeof(circuit_frame));
retry_loop:
ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1);
ms->sangoma_sock = open_span_chan(woomera->span+1, woomera->chan+1);
log_printf(SMG_LOG_PROD, server.log, "Media Loop Started %s fd=%i\n",
woomera->interface,ms->sangoma_sock);
@ -1275,11 +1321,16 @@ retry_loop:
sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api);
sangoma_tdm_disable_hwec(ms->sangoma_sock,&tdm_api);
ms->oob_disable = 0;
#ifdef LIBSANGOMA_VERSION
open_cnt = sangoma_get_open_cnt(ms->sangoma_sock, &tdm_api);
if (open_cnt > 1) {
ms->oob_disable = 1;
}
#endif
}
if (errs) {
if (errs) {
log_printf(SMG_LOG_ALL, server.log, "Media Loop: failed to open tdm device %s\n",
woomera->interface);
return;
@ -1302,21 +1353,6 @@ retry_loop:
continue;
}
#if 0
if (res == SMG_SOCKET_EVENT_NVAL) {
close_socket(&ms->sangoma_sock);
if (woomera_test_flag(woomera, WFLAG_MEDIA_END)) {
break;
}
ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1);
log_printf(SMG_LOG_ALL, server.log, "Media Loop Restart %s\n",
woomera->interface);
continue;
}
#endif
res = sangoma_readmsg_socket(ms->sangoma_sock,
&hdrframe,
sizeof(hdrframe),
@ -1365,7 +1401,7 @@ retry_loop:
sangoma_tdm_enable_hwec(ms->sangoma_sock,&tdm_api);
close_socket(&ms->sangoma_sock);
close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1);
if (loops < 1) {
log_printf(SMG_LOG_ALL, server.log, "Media Loop FAILED %s Master=%i MediaEnd=%i Loops=%i\n",
@ -1416,6 +1452,9 @@ static void *media_thread_run(void *obj)
FILE *tx_fd=NULL;
int sock_timeout=200;
int hwec_reenable=0;
int open_cnt = 0;
open_cnt=0;
if (woomera_test_flag(woomera, WFLAG_MEDIA_END) ||
!woomera->interface ||
@ -1478,7 +1517,7 @@ static void *media_thread_run(void *obj)
}
#else
media_retry:
ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1);
ms->sangoma_sock = open_span_chan(woomera->span+1, woomera->chan+1);
if (ms->sangoma_sock < 0) {
if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) {
@ -1546,6 +1585,13 @@ media_retry:
#endif
ms->oob_disable = 0;
#ifdef LIBSANGOMA_VERSION
open_cnt = sangoma_get_open_cnt(ms->sangoma_sock, &tdm_api);
if (open_cnt > 1) {
ms->oob_disable = 1;
}
#endif
if (!bearer_cap_is_audio(woomera->bearer_cap)) {
int err;
err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api);
@ -1569,10 +1615,12 @@ media_retry:
#ifdef WP_HPTDM_API
/* No tdm thread */
#else
#ifndef SMG_NO_MEDIA
if (!errs &&
launch_media_tdm_thread(woomera)) {
errs++;
}
#endif
#endif
if (errs) {
@ -1650,6 +1698,10 @@ media_retry:
break;
}
#ifdef SMG_NO_MEDIA
continue;
#endif
if (res == 0) {
if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) {
@ -1841,7 +1893,7 @@ media_thread_exit:
/* Dont wait for the other thread */
close_socket(&ms->udp_sock);
close_socket(&ms->sangoma_sock);
close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1);
while(woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) {
usleep(1000);
sched_yield();
@ -1850,7 +1902,7 @@ media_thread_exit:
close_socket(&ms->udp_sock);
close_socket(&ms->sangoma_sock);
close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1);
if (tx_fd){
fclose(tx_fd);
@ -1887,10 +1939,7 @@ static void *media_tdm_thread_run(void *obj)
unsigned char circuit_frame[1024];
sangoma_api_hdr_t hdrframe;
int flags_out;
#if 0
int tdm_cnt=0;
#endif
int poll_opt = POLLIN | POLLPRI;
memset(&hdrframe,0,sizeof(hdrframe));
memset(circuit_frame,0,sizeof(circuit_frame));
@ -1921,8 +1970,12 @@ static void *media_tdm_thread_run(void *obj)
break;
}
res = waitfor_socket(ms->sangoma_sock, 1000, (POLLIN | POLLPRI), &flags_out);
if (ms->oob_disable) {
poll_opt = POLLIN;
} else {
poll_opt = POLLIN | POLLPRI;
}
res = waitfor_socket(ms->sangoma_sock, 1000, poll_opt, &flags_out);
if (res < 0) {
@ -2537,7 +2590,62 @@ static void handle_event_dtmf(struct woomera_interface *woomera, unsigned char d
return;
}
static int handle_woomera_progress(struct woomera_interface *woomera,
struct woomera_message *wmsg)
{
call_signal_event_t event;
int err=-1;
memset(&event, 0, sizeof(event));
call_signal_event_init((short_signal_event_t*)&event, SIGBOOST_EVENT_CALL_PROGRESS, woomera->chan, woomera->span);
sprintf(event.isup_in_rdnis,"SMG003-EVI-2");
event.isup_in_rdnis_size=strlen(event.isup_in_rdnis);
if (woomera->index >= 0) {
event.call_setup_id = woomera->index;
}
log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n",
wmsg->command, woomera->interface);
if (!woomera_check_running(woomera)) {
socket_printf(woomera->socket, "405 PROGRESS Channel already hungup%s"
"Unique-Call-Id: %s%s",
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
return -1;
}
if (!woomera_test_flag(woomera,WFLAG_CALL_ACKED)) {
socket_printf(woomera->socket, "405 PROGRESS Channel not aceked%s"
"Unique-Call-Id: %s%s",
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
return -1;
}
err=isup_exec_event(&event);
if (err == 0) {
socket_printf(woomera->socket,
"200 %s PROGRESS OK%s"
"Unique-Call-Id: %s%s",
wmsg->callid,
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
} else {
socket_printf(woomera->socket, "405 PROGRESS Boost failure%s"
"Unique-Call-Id: %s%s",
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
}
return err;
}
static int handle_woomera_media_accept_answer(struct woomera_interface *woomera,
struct woomera_message *wmsg,
@ -2549,10 +2657,7 @@ static int handle_woomera_media_accept_answer(struct woomera_interface *woomera,
log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n",
wmsg->command, woomera->interface);
if (woomera_test_flag(woomera, WFLAG_HANGUP) ||
!woomera_test_flag(woomera, WFLAG_RUNNING) ||
woomera_test_flag(woomera, WFLAG_MEDIA_END)) {
if (!woomera_check_running(woomera)) {
log_printf(SMG_LOG_DEBUG_CALL, server.log,
"ERROR! call was cancelled MEDIA on HANGUP or MEDIA END!\n");
@ -3202,27 +3307,27 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_
} else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) {
cause=81;
socket_printf(woomera->socket, "EVENT HANGUP %s"
"Cause: %s%s"
"Q931-Cause-Code: %d%s",
WOOMERA_LINE_SEPERATOR,
q931_rel_to_str(cause),
WOOMERA_LINE_SEPERATOR,
cause,
WOOMERA_RECORD_SEPERATOR);
cause=81;
socket_printf(woomera->socket, "EVENT HANGUP %s"
"Cause: %s%s"
"Q931-Cause-Code: %d%s",
WOOMERA_LINE_SEPERATOR,
q931_rel_to_str(cause),
WOOMERA_LINE_SEPERATOR,
cause,
WOOMERA_RECORD_SEPERATOR);
socket_printf(woomera->socket, "404 Session Mis-match%s"
WOOMERA_RECORD_SEPERATOR);
woomera_set_flag(woomera, WFLAG_HANGUP);
woomera_set_flag(woomera, WFLAG_HANGUP);
return;
}
if (!strcasecmp(wmsg->command, "dtmf")) {
if (!strcasecmp(wmsg->command, "dtmf")) {
log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n",
woomera->interface, wmsg->command_args, wmsg->body);
log_printf(SMG_LOG_WOOMERA, woomera->log,
"WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n",
woomera->interface, wmsg->command_args, wmsg->body);
wanpipe_send_dtmf(woomera,wmsg->body);
@ -3273,8 +3378,7 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
} else if (!strcasecmp(wmsg->command, "proceed")) {
log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n",
@ -3287,7 +3391,12 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
} else if (!strcasecmp(wmsg->command, "progress")) {
handle_woomera_progress(woomera,wmsg);
} else if ((media = !strcasecmp(wmsg->command, "media")) ||
(answer = !strcasecmp(wmsg->command, "answer")) ||
(accept = !strcasecmp(wmsg->command, "accept"))) {
@ -3796,6 +3905,7 @@ static void handle_call_start(call_signal_event_t *event)
struct woomera_event wevent;
char callid[20];
char *session;
struct woomera_interface *tmp_woomera=NULL;
int clients;
remove_end_of_digits_char((unsigned char*)event->called_number_digits);
@ -3806,11 +3916,17 @@ static void handle_call_start(call_signal_event_t *event)
validate_number((unsigned char*)event->calling_number_digits);
}
if (smg_validate_span_chan(event->span,event->chan)) {
log_printf(0,server.log,
"Error: invalid span=% chan=%i on incoming call [w%dg%d] - Call START!\n",
event->span+1, event->chan+1, event->span+1,event->chan+1);
return;
}
pthread_mutex_lock(&server.process_lock);
if (server.process_table[event->span][event->chan].dev) {
if ((tmp_woomera=server.process_table[event->span][event->chan].dev)) {
struct woomera_interface *tmp_woomera = server.process_table[event->span][event->chan].dev;
woomera_set_flag(tmp_woomera,WFLAG_HANGUP);
woomera_set_flag(tmp_woomera,WFLAG_MEDIA_END);
log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [w%dg%d] - Call START!\n", event->span+1, event->chan+1);
@ -5506,10 +5622,10 @@ static int sangoma_tdm_init (int span)
return 0;
}
static int woomera_startup(int argc, char **argv)
{
int x = 0, pid = 0, bg = 0;
int span_cnt, chan_cnt;
char *cfg=NULL, *debug=NULL, *arg=NULL;
while((arg = argv[x++])) {
@ -5590,6 +5706,12 @@ static int woomera_startup(int argc, char **argv)
return 0;
}
for (span_cnt = 0; span_cnt < CORE_MAX_SPANS; span_cnt++) {
for (chan_cnt = 0; chan_cnt < CORE_MAX_CHAN_PER_SPAN; chan_cnt++) {
pthread_mutex_init(&server.process_table[span_cnt][chan_cnt].media_lock, NULL);
}
}
q931_cause_setup();
bearer_cap_setup();
uil1p_to_str_setup();
@ -5692,6 +5814,13 @@ static int woomera_shutdown(void)
{
char *event_string;
int told = 0, loops = 0;
int span_cnt, chan_cnt;
for (span_cnt = 0; span_cnt < CORE_MAX_SPANS; span_cnt++) {
for (chan_cnt = 0; chan_cnt < CORE_MAX_CHAN_PER_SPAN; chan_cnt++) {
pthread_mutex_destroy(&server.process_table[span_cnt][chan_cnt].media_lock);
}
}
close_socket(&server.master_connection.socket);
pthread_mutex_destroy(&server.listen_lock);

View File

@ -225,7 +225,7 @@ struct media_session {
teletone_dtmf_detect_state_t dtmf_detect;
teletone_generation_session_t tone_session;
switch_buffer_t *dtmf_buffer;
unsigned char oob_disable;
};
struct woomera_message {
@ -283,23 +283,24 @@ struct woomera_interface {
char session[SMG_SESSION_NAME_SZ];
int check_digits; /* set to 1 when session comes up */
int bearer_cap;
struct woomera_interface *next;
struct woomera_interface *next;
};
struct woomera_session {
struct woomera_interface *dev;
struct woomera_interface *dev;
char session[SMG_SESSION_NAME_SZ];
char digits[MAX_DIALED_DIGITS+1];
int digits_len;
int bearer_cap;
int clients;
unsigned char media_used;
pthread_mutex_t media_lock;
};
#define CORE_TANK_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS
struct woomera_server {
// struct woomera_session process_table[CORE_MAX_CHAN_PER_SPAN][CORE_MAX_SPANS];
struct woomera_session process_table[CORE_MAX_SPANS][CORE_MAX_CHAN_PER_SPAN];
struct woomera_session process_table[CORE_MAX_SPANS][CORE_MAX_CHAN_PER_SPAN+1];
struct woomera_interface *holding_tank[CORE_TANK_LEN];
int holding_tank_index;
struct woomera_interface master_connection;
@ -683,9 +684,55 @@ static inline void validate_number(unsigned char *s)
}
}
static inline int woomera_check_running(struct woomera_interface *woomera)
{
if (woomera_test_flag(woomera, WFLAG_HANGUP) ||
!woomera_test_flag(woomera, WFLAG_RUNNING) ||
woomera_test_flag(woomera, WFLAG_MEDIA_END)) {
return 0;
}
return 1;
}
static inline int open_span_chan (unsigned char span, unsigned char chan)
{
int fd = -1;
#ifndef LIBSANGOMA_VERSION
fd = sangoma_open_tdmapi_span_chan(span, chan);
#else
if (chan == 24) {
pthread_mutex_lock(&server.process_table[span][chan].media_lock);
if(server.process_table[span][chan].media_used > 0) {
log_printf(SMG_LOG_ALL, server.log,
"Critical Error: channel already opened [w%ig%i]\n", span, chan);
} else {
server.process_table[span][chan].media_used++;
fd = __sangoma_open_api_span_chan(span, chan);
}
pthread_mutex_unlock(&server.process_table[span][chan].media_lock);
} else {
fd = sangoma_open_api_span_chan(span, chan);
}
#endif
return fd;
}
static inline void close_span_chan (int *socket, unsigned char span, unsigned char chan)
{
if (chan == 24) {
pthread_mutex_lock(&server.process_table[span][chan].media_lock);
if(server.process_table[span][chan].media_used > 0) {
server.process_table[span][chan].media_used--;
}
close_socket(socket);
pthread_mutex_unlock(&server.process_table[span][chan].media_lock);
} else {
close_socket(socket);
}
}
extern int smg_log_init(void);
extern void smg_log_cleanup(void);

View File

@ -30,6 +30,7 @@ enum e_sigboost_event_id_values
SIGBOOST_EVENT_CALL_STOPPED_ACK = 0x86, /*134*/
SIGBOOST_EVENT_SYSTEM_RESTART = 0x87, /*135*/
SIGBOOST_EVENT_SYSTEM_RESTART_ACK = 0x88, /*136*/
SIGBOOST_EVENT_CALL_PROGRESS = 0x50, /*decimal 80*/
/* Following IDs are ss7boost to sangoma_mgd only. */
SIGBOOST_EVENT_HEARTBEAT = 0x89, /*137*/
SIGBOOST_EVENT_INSERT_CHECK_LOOP = 0x8a, /*138*/
@ -68,13 +69,21 @@ enum e_sigboost_huntgroup_values
SIGBOOST_HUNTGRP_RR_DESC = 0x03, /* round-robin with highest available first */
};
enum e_sigboost_event_info_par_values
{
SIGBOOST_EVI_SPARE = 0x00,
SIGBOOST_EVI_ALERTING = 0x01,
SIGBOOST_EVI_PROGRESS = 0x02,
};
#define MAX_DIALED_DIGITS 31
/* Next two defines are used to create the range of values for call_setup_id
* in the t_sigboost structure.
* 0..((CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN) - 1) */
#define CORE_MAX_SPANS 200
#define CORE_MAX_CHAN_PER_SPAN 30
#define CORE_MAX_CHAN_PER_SPAN 32
#define MAX_PENDING_CALLS CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN
/* 0..(MAX_PENDING_CALLS-1) is range of call_setup_id below */
#define SIZE_RDNIS 900
@ -138,6 +147,7 @@ static inline int boost_full_event(int event_id)
switch (event_id) {
case SIGBOOST_EVENT_CALL_START:
case SIGBOOST_EVENT_DIGIT_IN:
case SIGBOOST_EVENT_CALL_PROGRESS:
return 1;
default:
return 0;

View File

@ -1,6 +1,7 @@
#!/bin/bash
#!/bin/bash
cmd=$1;
sigd=$2;
xtraargs='';
cnt=0;
max_retry=10;
use_syslog=1;
@ -45,45 +46,6 @@ function usage()
return 1
}
if [ $sigd = "ss7boost" ] || [ $sigd = "sangoma_isupd" ]; then
sigd_safe_args="-i"
sigd_bg_args=""
SIG_LOG=/var/log/messages
eval "type $sigd 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
export PATH=$PATH:/usr/local/ss7box
fi
eval "type $sigd 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
echo
echo "Error $sigd is not found"
echo
exit 1
fi
SS7=1;
elif [ $sigd = "sangoma_brid" ]; then
sigd_safe_args=""
sigd_bg_args="-bg"
BRI=1;
elif [ $sigd = "sangoma_prid" ]; then
sigd_safe_args=""
sigd_bg_args="-bg"
PRI=1;
eval "export LD_LIBRARY_PATH=/usr/lib/sangoma_prid:${LD_LIBRARY_PATH} "
else
echo
usage
exit 1
fi
while [ ! -z "$3" ];
do
args=$args"$3 "
shift
done
function stop_all()
{
@ -93,7 +55,11 @@ function stop_all()
stop_safe_sangoma
stop_sigdaemon
stop_sangoma_mgd
#post_args=$post_args" >/dev/null 2>/dev/null &"
if [ "$xtraargs" != "sigdonly" ]; then
stop_sangoma_mgd
fi
remove_pid_files
}
@ -261,13 +227,28 @@ function start_test()
}
function start_all()
{
check_running
#post_args=$post_args" >/dev/null 2>/dev/null &"
if [ "$xtraargs" = "sigdonly" ]; then
start_sigd
ret=$?
else
start_sigd
ret=$?
if [ $ret -eq 0 ]; then
start_smg
ret=$?
fi
fi
return $ret
}
function start_sigd()
{
check_sigd_running
pre_args="";
post_args="";
#post_args=$post_args" >/dev/null 2>/dev/null &"
echo " "
echo "Starting processes..."
echo -n "Loading SCTP..."
@ -318,9 +299,26 @@ function start_all()
return 1;
fi
sleep 3
if [ "$xtraargs" = "sigdonly" ]; then
echo "Sangoma $sigd running.."
if [ $use_syslog -eq 1 ]; then
echo "log file: $LOG and /var/log/messages"
else
echo "log file: $LOG and /var/log/messages"
fi
echo " "
fi
return 0
}
function start_smg()
{
#check_sigd_running
check_smg_running
pre_args="";
post_args="";
if [ $use_safe -eq 1 ]; then
pre_args=" safe_sangoma"
post_args=""
@ -328,7 +326,6 @@ function start_all()
post_args=" -bg"
fi
if [ -e /etc/wanpipe/.no_smg_load ]; then
echo "Skipping sangoma_mgd..."
return 0;
@ -360,10 +357,11 @@ function start_all()
echo " "
return 0
}
function check_running ()
function check_sigd_running()
{
local rc
eval "pidof $sigd 2> /dev/null > /dev/null"
@ -373,7 +371,13 @@ function check_running ()
echo "exiting..."
exit 0
fi
return 0
}
function check_smg_running()
{
local rc
eval "pidof sangoma_mgd 2> /dev/null > /dev/null"
rc=$?
if [ $rc -eq 0 ]; then
@ -387,7 +391,6 @@ function check_running ()
if [ -e /var/run/sangoma_mgd.pid ];then
eval "rm -f /var/run/sangoma_mgd.pid >/dev/null 2>/dev/null";
fi
return 0
}
@ -492,14 +495,101 @@ function parse_args()
done
}
read_smg_conf ()
{
WAN_HOME=/etc/wanpipe
WAN_CONF_DIR=$WAN_HOME
META_SMG_CONF=$WAN_HOME/smg.rc
# Read meta-configuration file.
if [ -f $META_SMG_CONF ]
then . $META_SMG_CONF
else
echo " $META_SMG_CONF not found !!!!"
return 1
fi
return 0
}
function init_smg_conf()
{
SMG_BOOT=
SANGOMA_PRID=
SANGOMA_BRID=
SANGOMA_SS7ISUP=
SANGOMA_MEDIA_GATEWAY=
}
######################
#main start here
######################
parse_args
init_smg_conf
read_smg_conf
#Set sigd
if [ $SANGOMA_PRID = "YES" ]; then
sigd="sangoma_prid"
elif [ $SANGOMA_BRID = "YES" ]; then
sigd="sangoma_brid"
elif [ $SANGOMA_PRID = "YES" ]; then
sigd="sangoma_prid"
elif [ $SANGOMA_SS7ISUP = "YES" ]; then
sigd="sangoma_isupd"
elif [ $SANGOMA_SS7BOOST = "YES" ]; then
sigd="ss7boost"
else
echo "Failed to specify sigd!!! check $META_SMG_CONF "
exit 1
fi
if [ $SANGOMA_MEDIA_GATEWAY = "NO" ]; then
xtraargs="sigdonly"
fi
if [ $sigd = "ss7boost" ] || [ $sigd = "sangoma_isupd" ]; then
sigd_safe_args="-i"
sigd_bg_args=""
SIG_LOG=/var/log/messages
eval "type $sigd 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
export PATH=$PATH:/usr/local/ss7box
fi
eval "type $sigd 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
echo
echo "Error $sigd is not found"
echo
exit 1
fi
SS7=1;
elif [ $sigd = "sangoma_brid" ]; then
sigd_safe_args=""
sigd_bg_args="-bg"
BRI=1;
elif [ $sigd = "sangoma_prid" ]; then
sigd_safe_args=""
sigd_bg_args="-bg"
PRI=1;
else
usage
exit 1
fi
while [ ! -z "$3" ];
do
args=$args"$3 "
shift
done
ret=0
if [ "$cmd" = "start" ]; then
start_all
ret=$?
start_all
ret=$?
if [ $ret -ne 0 ]; then
stop_all
fi

View File

@ -1,15 +0,0 @@
#!/bin/bash
cmd=$1;
while [ ! -z "$2" ];
do
args=$args"$2 "
shift
done
__smg_ctrl_common $cmd sangoma_brid $args
ret=$?
exit $ret

View File

@ -1,15 +0,0 @@
#!/bin/bash
cmd=$1;
while [ ! -z "$2" ];
do
args=$args"$2 "
shift
done
__smg_ctrl_common $cmd sangoma_prid $args
ret=$?
exit $ret

View File

@ -1,15 +0,0 @@
#!/bin/bash
cmd=$1;
while [ ! -z "$2" ];
do
args=$args"$2 "
shift
done
__smg_ctrl_common $cmd sangoma_isupd $args
ret=$?
exit $ret

View File

@ -0,0 +1,165 @@
################################################################################
# Sangoma MGD
#
# Author: Anthony Minessale II <anthmct@yahoo.com>
# Nenad Corbic <ncorbic@sangoma.com>
#
# Copyright: (c) 2005 Anthony Minessale II
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
################################################################################
SMG_DTMF=YES
#Default kernel directory to be overwritten by user
#Kernel version and location
ifndef KVER
KVER=$(shell uname -r)
endif
ifndef KMOD
KMOD=/lib/modules/$(KVER)
endif
ifndef KDIR
KDIR=$(KMOD)/build
endif
ifndef KINSTDIR
KINSTDIR=$(KMOD)/kernel
endif
CC = gcc
ifndef DESTDIR
ifdef INSTALLPREFIX
DESTDIR=$(INSTALLPREFIX)
else
DESTDIR=
endif
endif
INCLUDES = -I ../../ssmg/libsangoma.trunk -I. -I ../../patches/kdrivers/include -I ../../patches/kdrivers/wanec/oct6100_api/include -I ../../patches/kdrivers/wanec -I/usr/local/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -Ilib/libteletone/src
CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6
ifeq "${PRI}" "YES"
CFLAGS += -DPRI_PROT -DSMG_CALLING_NAME
NO_SS7:=YES
else
ifeq "${BRI}" "YES"
CFLAGS += -DBRI_PROT -DSMG_CALLING_NAME
NO_SS7:=YES
else
ifeq "${NO_SS7}" "YES"
BRI:=YES
CFLAGS += -DBRI_PROT
endif
endif
endif
CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g
LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm
#Enable memory leak subsystem
#Not to be used in production
#CFLAGS += -DSMG_MEMORY_DEBUG
ifeq "${SMG_DTMF}" "YES"
LDFLAGS+= -lteletone
CFLAGS+= -DSMG_DTMF_ENABLE
endif
all: sangoma_mgd
libs:
$(shell cd lib/libteletone; ./configure --prefix=$(DESTDIR); cd ../../; )
$(MAKE) -C lib/libteletone all
switch_buffer.o: switch_buffer.c switch_buffer.h
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o switch_buffer.o switch_buffer.c
call_signal.o: call_signal.c call_signal.h
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o call_signal.o call_signal.c
sangoma_mgd_memdbg.o: sangoma_mgd_memdbg.c sangoma_mgd_memdbg.h
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_memdbg.o sangoma_mgd_memdbg.c
sangoma_mgd_logger.o: sangoma_mgd_logger.c
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_logger.o sangoma_mgd_logger.c
sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c
sangoma_mgd: sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o call_signal.o switch_buffer.o sigboost.h sangoma_mgd_memdbg.h
rm -fr core*
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o switch_buffer.o call_signal.o $(LDFLAGS)
clean: old_cleanup
find . -name '*.o' | xargs rm -f
rm -fr sangoma_mgd pritest *.o *.so *~ *core* *.so* *.a
make -C lib/libteletone clean
distclean: clean
@echo OK
install: all install_smg
install_smg: old_cleanup
install -D -m 755 sangoma_mgd $(DESTDIR)/usr/sbin/sangoma_mgd
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 ./safe_sangoma $(DESTDIR)/usr/sbin/safe_sangoma
install -D -m 755 ./smg_ctrl $(DESTDIR)/usr/sbin/smg_ctrl
ifeq "${PRI}" "YES"
@echo "PRI control scripts installed"
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.pri $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 rc/smg.rc.pri $(DESTDIR)/etc/wanpipe/smg.rc
else
ifeq "${BRI}" "YES"
@echo "BRI control scripts installed"
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.bri $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 rc/smg.rc.bri $(DESTDIR)/etc/wanpipe/smg.rc
else
@echo "SS7 control scripts installed"
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.ss7 $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
@if [ -e $(DESTDIR)/usr/local/ss7box/sangoma_isupd ]; then \
echo "install -D -m 755 rc/smg.rc.isupd $(DESTDIR)/etc/wanpipe/smg.rc"; \
install -D -m 755 rc/smg.rc.isupd $(DESTDIR)/etc/wanpipe/smg.rc; \
else \
echo "install -D -m 755 rc/smg.rc.ss7boost $(DESTDIR)/etc/wanpipe/smg.rc"; \
install -D -m 755 rc/smg.rc.ss7boost $(DESTDIR)/etc/wanpipe/smg.rc; \
fi
install -D -m 755 scripts/init.d/smgss7_init_ctrl $(DESTDIR)/etc/init.d/smgss7_init_ctrl
install -D -m 755 scripts/init.d/smgss7_init_ctrl $(DESTDIR)/usr/sbin/smgss7_init_ctrl
endif
endif
@echo "sangoma_mgd Installed"
old_cleanup:
./scripts/old_cleanup.sh
install_all: all install_smg
uninstall:
/bin/rm $(DESTDIR)/usr/sbin/sangoma_mgd $(DESTDIR)/etc/sangoma_mgd.conf

View File

@ -33,7 +33,7 @@ CC = gcc
ifndef DESTDIR
ifdef INSTALLPREFIX
DESTDIR=$(INSTALL_PREFIX)
DESTDIR=$(INSTALLPREFIX)
else
DESTDIR=
endif
@ -108,7 +108,7 @@ clean: old_cleanup
distclean: clean
@echo OK
install: all install_smg old_cleanup
install: all install_smg
install_smg: old_cleanup
install -D -m 755 sangoma_mgd $(DESTDIR)/usr/sbin/sangoma_mgd
@ -117,27 +117,34 @@ install_smg: old_cleanup
fi
install -D -m 755 ./safe_sangoma $(DESTDIR)/usr/sbin/safe_sangoma
install -D -m 755 ./__smg_ctrl_common $(DESTDIR)/usr/sbin/__smg_ctrl_common
install -D -m 755 ./smg_ctrl $(DESTDIR)/usr/sbin/smg_ctrl
ifeq "${PRI}" "YES"
@echo "PRI control scripts installed"
@if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.pri $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.pri $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 smg_ctrl_pri $(INSTALLPREFIX)/usr/sbin/smg_ctrl
install -D -m 755 rc/smg.rc.pri $(DESTDIR)/etc/wanpipe/smg.rc
else
ifeq "${BRI}" "YES"
@echo "BRI control scripts installed"
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.bri $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 smg_ctrl_bri $(DESTDIR)/usr/sbin/smg_ctrl
install -D -m 755 rc/smg.rc.bri $(DESTDIR)/etc/wanpipe/smg.rc
else
@echo "SS7 control scripts installed"
@if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \
install -D -m 755 sangoma_mgd.conf.sample.ss7 $(DESTDIR)/etc/sangoma_mgd.conf; \
fi
install -D -m 755 smg_ctrl_ss7 $(DESTDIR)/usr/sbin/smg_ctrl
@if [ -e $(DESTDIR)/usr/local/ss7box/sangoma_isupd ]; then \
echo "install -D -m 755 rc/smg.rc.isupd $(DESTDIR)/etc/wanpipe/smg.rc"; \
install -D -m 755 rc/smg.rc.isupd $(DESTDIR)/etc/wanpipe/smg.rc; \
else \
echo "install -D -m 755 rc/smg.rc.ss7boost $(DESTDIR)/etc/wanpipe/smg.rc"; \
install -D -m 755 rc/smg.rc.ss7boost $(DESTDIR)/etc/wanpipe/smg.rc; \
fi
install -D -m 755 scripts/init.d/smgss7_init_ctrl $(DESTDIR)/etc/init.d/smgss7_init_ctrl
install -D -m 755 scripts/init.d/smgss7_init_ctrl $(DESTDIR)/usr/sbin/smgss7_init_ctrl

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/app
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -38,7 +38,8 @@ static struct call_signal_map call_signal_table[] = {
{SIGBOOST_EVENT_HEARTBEAT, "HEARTBEAT"},
{SIGBOOST_EVENT_INSERT_CHECK_LOOP, "LOOP START"},
{SIGBOOST_EVENT_REMOVE_CHECK_LOOP, "LOOP STOP"},
{SIGBOOST_EVENT_DIGIT_IN, "DIGIT_IN"}
{SIGBOOST_EVENT_DIGIT_IN, "DIGIT_IN"},
{SIGBOOST_EVENT_CALL_PROGRESS, "CALL_PROGRESS"}
};
#define USE_SCTP 1

View File

@ -148,3 +148,27 @@ echo 0 .cw_module_info_check
grep -c 1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check
1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check
grep -c 1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check
AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check
grep -c AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check
opbx_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .opbx_cli_entry_check
echo 0 .opbx_cli_entry_check
cw_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .cw_cli_entry_check
echo 0 .cw_cli_entry_check
MODULE_INFO /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/module.h .cw_module_info_check
echo 0 .cw_module_info_check
1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check
grep -c 1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check
1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check
grep -c 1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check
AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check
grep -c AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check
opbx_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .opbx_cli_entry_check
echo 0 .opbx_cli_entry_check
cw_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .cw_cli_entry_check
echo 0 .cw_cli_entry_check
MODULE_INFO /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/module.h .cw_module_info_check
echo 0 .cw_module_info_check
1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check
grep -c 1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check
1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check
grep -c 1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check

View File

@ -1,13 +1,13 @@
K 25
svn:wc:ra_dav:version-url
V 36
/svn/chan_woomera/!svn/ver/117/trunk
/svn/chan_woomera/!svn/ver/119/trunk
END
chan_woomera.c
K 25
svn:wc:ra_dav:version-url
V 51
/svn/chan_woomera/!svn/ver/117/trunk/chan_woomera.c
/svn/chan_woomera/!svn/ver/119/trunk/chan_woomera.c
END
g711.h
K 25
@ -30,8 +30,8 @@ END
woomera.conf
K 25
svn:wc:ra_dav:version-url
V 48
/svn/chan_woomera/!svn/ver/97/trunk/woomera.conf
V 49
/svn/chan_woomera/!svn/ver/118/trunk/woomera.conf
END
README
K 25

View File

@ -1,14 +1,14 @@
8
dir
117
119
https://www.sangomapbx.com/svn/chan_woomera/trunk
https://www.sangomapbx.com/svn/chan_woomera
2009-07-16T21:31:38.540981Z
117
2009-09-17T21:28:42.285967Z
119
ncorbic
@ -32,10 +32,10 @@ file
2009-07-17T14:59:48.000000Z
49f4e6b0a5c6406879aad08e7630066c
2009-07-16T21:31:38.540981Z
117
2009-09-17T21:01:12.000000Z
110d2fbba4c604cf87f486ed8c7896e8
2009-09-17T21:28:42.285967Z
119
ncorbic
g711.h
@ -81,10 +81,10 @@ file
2009-04-09T17:34:03.000000Z
be959aafe84874470b0c5ed23094a7a2
2009-03-28T00:51:34.257571Z
97
2009-09-17T21:01:12.000000Z
be929ca884ac67db1fcdc85c4e5384fb
2009-09-17T21:27:40.731828Z
118
ncorbic
README

View File

@ -14,6 +14,10 @@
* This program is free software, distributed under the terms of
* the GNU General Public License
* =============================================
* v1.54 Nenad Corbic <ncorbic@sangoma.com>
* Sep 16 2009
* Added Progress Messages
*
* v1.53 Nenad Corbic <ncorbic@sangoma.com>
* Jul 16 2009
* Updated for Asterisk load balancing and well
@ -292,7 +296,7 @@
#include "asterisk/musiconhold.h"
#include "asterisk/transcap.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.53 $")
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.54 $")
#else
@ -343,7 +347,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.53 $")
#define CALLWEAVER_19 1
#endif
CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.53 $")
CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.54 $")
#if defined(DSP_FEATURE_FAX_CNG_DETECT)
#undef DSP_FEATURE_FAX_DETECT
@ -650,7 +654,7 @@ CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.53 $")
extern int option_verbose;
#define WOOMERA_VERSION "v1.53"
#define WOOMERA_VERSION "v1.54"
#ifndef WOOMERA_CHAN_NAME
#define WOOMERA_CHAN_NAME "SS7"
#endif
@ -811,7 +815,8 @@ typedef enum {
TFLAG_ANSWER_RECEIVED = (1 << 17),
TFLAG_CONFIRM_ANSWER = (1 << 18),
TFLAG_CONFIRM_ANSWER_ENABLED = (1 << 19),
TFLAG_AST_HANGUP = (1 << 20)
TFLAG_AST_HANGUP = (1 << 20),
TFLAG_PROGRESS = (1 << 21),
} TFLAGS;
static int usecnt = 0;
@ -864,6 +869,7 @@ struct woomera_profile {
struct woomera_event_queue event_queue;
int jb_enable;
int progress_enable;
int progress_on_accept;
int coding;
float rxgain_val;
float txgain_val;
@ -2655,7 +2661,11 @@ static void *tech_monitor_thread(void *obj)
ast_set_flag(tech_pvt,TFLAG_ACCEPTED);
ast_clear_flag(tech_pvt,TFLAG_ACCEPT);
if (tech_pvt->profile->progress_on_accept) {
ast_set_flag(tech_pvt, TFLAG_PROGRESS);
}
err=woomera_printf(tech_pvt->profile, tech_pvt->command_channel,
"ACCEPT %s%s"
"Raw-Audio: %s:%d%s"
@ -2679,9 +2689,30 @@ static void *tech_monitor_thread(void *obj)
goto tech_thread_continue;
continue;
}
}
if (ast_test_flag(tech_pvt, TFLAG_PROGRESS)) {
int err;
ast_clear_flag(tech_pvt, TFLAG_PROGRESS);
err=woomera_printf(tech_pvt->profile, tech_pvt->command_channel,
"PROGRESS %s%s"
"Unique-Call-Id: %s%s",
tech_pvt->callid,
WOOMERA_LINE_SEPARATOR,
tech_pvt->callid,
WOOMERA_RECORD_SEPARATOR);
if(err < 0 || woomera_message_parse_wait(tech_pvt,&wmsg) < 0) {
ast_set_flag(tech_pvt, TFLAG_ABORT);
if (globals.debug > 2) {
ast_log(LOG_NOTICE, "PROGRESS ABORT Ch=%d\n",
tech_pvt->command_channel);
}
goto tech_thread_continue;
continue;
}
}
if (ast_test_flag(tech_pvt, TFLAG_ANSWER)) {
int err;
@ -3409,6 +3440,9 @@ static int config_woomera(void)
} else if (!strcmp(v->name, "progress_enable")) {
profile->progress_enable = atoi(v->value);
} else if (!strcmp(v->name, "progress_on_accept")) {
profile->progress_on_accept = atoi(v->value);
} else if (!strcmp(v->name, "coding")) {
if (strcmp(v->value, "alaw") == 0) {
@ -4486,6 +4520,7 @@ static int tech_indicate(struct ast_channel *self, int condition)
private_object *tech_pvt;
int res = -1;
tech_pvt = self->tech_pvt;
if (!tech_pvt) {
return res;
@ -4534,6 +4569,10 @@ static int tech_indicate(struct ast_channel *self, int condition)
if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) {
ast_set_flag(tech_pvt, TFLAG_ACCEPT);
}
if (!tech_pvt->profile->progress_on_accept) {
ast_set_flag(tech_pvt, TFLAG_PROGRESS);
}
break;
case AST_CONTROL_HOLD:
if (globals.debug > 3) {
@ -4578,7 +4617,7 @@ static int tech_indicate(struct ast_channel *self, int condition)
res = -1;
break;
}
ast_mutex_unlock(&tech_pvt->iolock);
return res;

View File

@ -60,7 +60,7 @@ context=sangoma
;Debug flags is used to enable/disable woomera channel
;debugging level.
;Production: set to 2
;Production: set to 2 (Default)
;Debugging: set to 3
;------------------------------
debug=2
@ -72,7 +72,7 @@ debug=2
;number of T1/E1 channels supported.
;If unsure set this value to 0.
;Options: 1 to 600 - limited calls
; 0 - unlimited Calls
; 0 - unlimited Calls (Default)
;------------------------------
;max_calls=0
@ -80,8 +80,10 @@ debug=2
;Enable Incoming DTMF detection
;This option will enable Rx DTMF detection on each
;channel. The Tx DTMF is automatically enabled on SMG.
;If you dont need DTMF do not enable it.
;Options: 1 - Enable DTMF
;If you dont need DTMF do not enable it. Note if SMG
;supports HWDTMF, this option will automatically be
;turned off in Asterisk.
;Options: 1 - Enable DTMF (Default)
; 0 - Disable DTMF
;------------------------------
dtmf_enable=1
@ -92,7 +94,7 @@ dtmf_enable=1
;jitter buffer options.
;NOTE: a jb patch must be applied to Asterisk.
;Options: 1 - Enable JitterBuffer
; 0 - Disable JitterBuffer
; 0 - Disable JitterBuffer (Default)
;------------------------------
jb_enable=0
@ -101,11 +103,24 @@ jb_enable=0
;Used for Asterisk Early Audio with
;Zap and SIP.
;Options: 1 - Enable ProgresMsg
; 0 - Disable ProgresMsg
; 0 - Disable ProgresMsg (Default)
;------------------------------
progress_enable=0
;Enable progress messages transmissions
;to TDM on each incoming call after
;the call has been ACCEPTED. Note
;this is for INCOMING calls only
;and should be used when telco
;requires gateway to send progress messages
;on EVERY call setup.
;Options: 1 - Enable progress
; 0 - Diasble progress (Default)
;------------------------------
progress_on_accept=0
;Coding is necessary to identify
;ulaw/alaw rx/tx gain.
;Opionts: ulaw

View File

@ -14,6 +14,10 @@
* This program is free software, distributed under the terms of
* the GNU General Public License
* =============================================
* v1.54 Nenad Corbic <ncorbic@sangoma.com>
* Sep 16 2009
* Added Progress Messages
*
* v1.53 Nenad Corbic <ncorbic@sangoma.com>
* Jul 16 2009
* Updated for Asterisk load balancing and well
@ -292,7 +296,7 @@
#include "asterisk/musiconhold.h"
#include "asterisk/transcap.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.53 $")
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.54 $")
#else
@ -343,7 +347,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.53 $")
#define CALLWEAVER_19 1
#endif
CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.53 $")
CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.54 $")
#if defined(DSP_FEATURE_FAX_CNG_DETECT)
#undef DSP_FEATURE_FAX_DETECT
@ -650,7 +654,7 @@ CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.53 $")
extern int option_verbose;
#define WOOMERA_VERSION "v1.53"
#define WOOMERA_VERSION "v1.54"
#ifndef WOOMERA_CHAN_NAME
#define WOOMERA_CHAN_NAME "SS7"
#endif
@ -811,7 +815,8 @@ typedef enum {
TFLAG_ANSWER_RECEIVED = (1 << 17),
TFLAG_CONFIRM_ANSWER = (1 << 18),
TFLAG_CONFIRM_ANSWER_ENABLED = (1 << 19),
TFLAG_AST_HANGUP = (1 << 20)
TFLAG_AST_HANGUP = (1 << 20),
TFLAG_PROGRESS = (1 << 21),
} TFLAGS;
static int usecnt = 0;
@ -864,6 +869,7 @@ struct woomera_profile {
struct woomera_event_queue event_queue;
int jb_enable;
int progress_enable;
int progress_on_accept;
int coding;
float rxgain_val;
float txgain_val;
@ -2655,7 +2661,11 @@ static void *tech_monitor_thread(void *obj)
ast_set_flag(tech_pvt,TFLAG_ACCEPTED);
ast_clear_flag(tech_pvt,TFLAG_ACCEPT);
if (tech_pvt->profile->progress_on_accept) {
ast_set_flag(tech_pvt, TFLAG_PROGRESS);
}
err=woomera_printf(tech_pvt->profile, tech_pvt->command_channel,
"ACCEPT %s%s"
"Raw-Audio: %s:%d%s"
@ -2679,9 +2689,30 @@ static void *tech_monitor_thread(void *obj)
goto tech_thread_continue;
continue;
}
}
if (ast_test_flag(tech_pvt, TFLAG_PROGRESS)) {
int err;
ast_clear_flag(tech_pvt, TFLAG_PROGRESS);
err=woomera_printf(tech_pvt->profile, tech_pvt->command_channel,
"PROGRESS %s%s"
"Unique-Call-Id: %s%s",
tech_pvt->callid,
WOOMERA_LINE_SEPARATOR,
tech_pvt->callid,
WOOMERA_RECORD_SEPARATOR);
if(err < 0 || woomera_message_parse_wait(tech_pvt,&wmsg) < 0) {
ast_set_flag(tech_pvt, TFLAG_ABORT);
if (globals.debug > 2) {
ast_log(LOG_NOTICE, "PROGRESS ABORT Ch=%d\n",
tech_pvt->command_channel);
}
goto tech_thread_continue;
continue;
}
}
if (ast_test_flag(tech_pvt, TFLAG_ANSWER)) {
int err;
@ -3409,6 +3440,9 @@ static int config_woomera(void)
} else if (!strcmp(v->name, "progress_enable")) {
profile->progress_enable = atoi(v->value);
} else if (!strcmp(v->name, "progress_on_accept")) {
profile->progress_on_accept = atoi(v->value);
} else if (!strcmp(v->name, "coding")) {
if (strcmp(v->value, "alaw") == 0) {
@ -4486,6 +4520,7 @@ static int tech_indicate(struct ast_channel *self, int condition)
private_object *tech_pvt;
int res = -1;
tech_pvt = self->tech_pvt;
if (!tech_pvt) {
return res;
@ -4534,6 +4569,14 @@ static int tech_indicate(struct ast_channel *self, int condition)
if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) {
ast_set_flag(tech_pvt, TFLAG_ACCEPT);
}
#if 0
/* Disable this for non ss7 installs */
if (!tech_pvt->profile->progress_on_accept) {
ast_set_flag(tech_pvt, TFLAG_PROGRESS);
}
#endif
break;
case AST_CONTROL_HOLD:
if (globals.debug > 3) {
@ -4578,7 +4621,7 @@ static int tech_indicate(struct ast_channel *self, int condition)
res = -1;
break;
}
ast_mutex_unlock(&tech_pvt->iolock);
return res;

View File

@ -60,7 +60,7 @@ context=sangoma
;Debug flags is used to enable/disable woomera channel
;debugging level.
;Production: set to 2
;Production: set to 2 (Default)
;Debugging: set to 3
;------------------------------
debug=2
@ -72,7 +72,7 @@ debug=2
;number of T1/E1 channels supported.
;If unsure set this value to 0.
;Options: 1 to 600 - limited calls
; 0 - unlimited Calls
; 0 - unlimited Calls (Default)
;------------------------------
;max_calls=0
@ -80,8 +80,10 @@ debug=2
;Enable Incoming DTMF detection
;This option will enable Rx DTMF detection on each
;channel. The Tx DTMF is automatically enabled on SMG.
;If you dont need DTMF do not enable it.
;Options: 1 - Enable DTMF
;If you dont need DTMF do not enable it. Note if SMG
;supports HWDTMF, this option will automatically be
;turned off in Asterisk.
;Options: 1 - Enable DTMF (Default)
; 0 - Disable DTMF
;------------------------------
dtmf_enable=1
@ -92,7 +94,7 @@ dtmf_enable=1
;jitter buffer options.
;NOTE: a jb patch must be applied to Asterisk.
;Options: 1 - Enable JitterBuffer
; 0 - Disable JitterBuffer
; 0 - Disable JitterBuffer (Default)
;------------------------------
jb_enable=0
@ -101,11 +103,24 @@ jb_enable=0
;Used for Asterisk Early Audio with
;Zap and SIP.
;Options: 1 - Enable ProgresMsg
; 0 - Disable ProgresMsg
; 0 - Disable ProgresMsg (Default)
;------------------------------
progress_enable=0
;Enable progress messages transmissions
;to TDM on each incoming call after
;the call has been ACCEPTED. Note
;this is for INCOMING calls only
;and should be used when telco
;requires gateway to send progress messages
;on EVERY call setup.
;Options: 1 - Enable progress
; 0 - Diasble progress (Default)
;------------------------------
progress_on_accept=0
;Coding is necessary to identify
;ulaw/alaw rx/tx gain.
;Opionts: ulaw

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/conf
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/conf_bri
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/lib
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/lib/libteletone
https://www.sangomapbx.com/svn/sangoma_mgd
@ -88,8 +88,17 @@ file
root
has-props
src
dir
depcomp
file
2009-04-30T20:22:39.000000Z
7e26ecc61d5c27c50d334ebe19d5ef06
2007-09-21T20:53:51.260136Z
1
root
ChangeLog
file
@ -103,17 +112,8 @@ d41d8cd98f00b204e9800998ecf8427e
1
root
depcomp
file
2009-04-30T20:22:39.000000Z
7e26ecc61d5c27c50d334ebe19d5ef06
2007-09-21T20:53:51.260136Z
1
root
src
dir
compile
file
@ -152,14 +152,14 @@ c2defdef8cd93c3d9e29628267699702
1
root
config.sub
README
file
2009-04-30T20:22:39.000000Z
74587542264e2bb761ee931ddb7d69f1
234c8df99750448a5b1c4709304a38e5
2007-09-21T20:53:51.260136Z
1
root
@ -176,14 +176,14 @@ file
1
root
README
config.sub
file
2009-04-30T20:22:39.000000Z
234c8df99750448a5b1c4709304a38e5
74587542264e2bb761ee931ddb7d69f1
2007-09-21T20:53:51.260136Z
1
root

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/lib/libteletone/src
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -0,0 +1,41 @@
K 25
svn:wc:ra_dav:version-url
V 38
/svn/sangoma_mgd/!svn/ver/203/trunk/rc
END
smg.rc.pri
K 25
svn:wc:ra_dav:version-url
V 49
/svn/sangoma_mgd/!svn/ver/198/trunk/rc/smg.rc.pri
END
smg.rc.pri_only
K 25
svn:wc:ra_dav:version-url
V 54
/svn/sangoma_mgd/!svn/ver/200/trunk/rc/smg.rc.pri_only
END
smg.rc.bri
K 25
svn:wc:ra_dav:version-url
V 49
/svn/sangoma_mgd/!svn/ver/198/trunk/rc/smg.rc.bri
END
smg.rc.bri_only
K 25
svn:wc:ra_dav:version-url
V 54
/svn/sangoma_mgd/!svn/ver/200/trunk/rc/smg.rc.bri_only
END
smg.rc.ss7boost
K 25
svn:wc:ra_dav:version-url
V 54
/svn/sangoma_mgd/!svn/ver/203/trunk/rc/smg.rc.ss7boost
END
smg.rc.isupd
K 25
svn:wc:ra_dav:version-url
V 51
/svn/sangoma_mgd/!svn/ver/203/trunk/rc/smg.rc.isupd
END

View File

@ -0,0 +1,100 @@
8
dir
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/rc
https://www.sangomapbx.com/svn/sangoma_mgd
2009-09-17T21:48:55.845572Z
203
ncorbic
svn:special svn:externals svn:needs-lock
27f70977-ab3a-0410-9ff6-8a87bf49d3db
smg.rc.pri
file
2009-09-17T20:37:35.000000Z
3d243e4ac9de7c589e8d45309923d0ce
2009-09-01T18:37:52.119878Z
198
ncorbic
smg.rc.pri_only
file
2009-09-17T20:37:35.000000Z
036e8d57070e085deac9ac06831357e2
2009-09-10T18:34:27.617807Z
200
ncorbic
smg.rc.bri
file
2009-09-17T20:37:35.000000Z
c4270d84c32e0b8fee3f7019a32e5671
2009-09-01T18:37:52.119878Z
198
ncorbic
smg.rc.bri_only
file
2009-09-17T20:37:35.000000Z
450f85f7650f97c553e2f4346591c955
2009-09-10T18:34:27.617807Z
200
ncorbic
smg.rc.ss7boost
file
2009-09-17T21:01:04.000000Z
2955ed3b82f0e8892a59cbe74d19ac74
2009-09-17T21:48:55.845572Z
203
ncorbic
smg.rc.isupd
file
2009-09-17T21:01:04.000000Z
ac506d788aafcc64a63c12018d89ba0f
2009-09-17T21:48:55.845572Z
203
ncorbic

View File

@ -0,0 +1 @@
8

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="NO"
SANGOMA_BRID="YES"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="YES"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="NO"
SANGOMA_BRID="YES"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="NO"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="NO"
SANGOMA_BRID="NO"
SANGOMA_SS7ISUP="YES"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="YES"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="YES"
SANGOMA_BRID="NO"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="YES"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="YES"
SANGOMA_BRID="NO"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="NO"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="NO"
SANGOMA_BRID="NO"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="YES"
SANGOMA_MEDIA_GATEWAY="YES"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="NO"
SANGOMA_BRID="YES"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="YES"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="NO"
SANGOMA_BRID="YES"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="NO"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="NO"
SANGOMA_BRID="NO"
SANGOMA_SS7ISUP="YES"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="YES"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="YES"
SANGOMA_BRID="NO"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="YES"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="YES"
SANGOMA_BRID="NO"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="NO"
SANGOMA_MEDIA_GATEWAY="NO"

View File

@ -0,0 +1,10 @@
#!/bin/sh
# smg.rc SMG_RC FILE
# Note: This file is 'executed' by the shell script, so
# the usual shell syntax must be observed.
SANGOMA_PRID="NO"
SANGOMA_BRID="NO"
SANGOMA_SS7ISUP="NO"
SANGOMA_SS7BOOST="YES"
SANGOMA_MEDIA_GATEWAY="YES"

View File

@ -9,7 +9,17 @@
*
* =============================================
*
* v1.54 Nenad Corbic <ncorbic@sangoma.com>
* Bug added in 1.51 release causing call on channel 31 to fail.
*
* v1.53 Nenad Corbic <ncorbic@sangoma.com>
* Added progress message
*
* v1.52 David Yat Sin <dyatsin@sangoma.com>
* Changed sangoma_open_span_chan to __sangoma_span_chan
* to enabled shared used of file descriptors when using
* with PRI in NFAS mode
*
* v1.51 David Yat Sin <dyatsin@sangoma.com>
* MAX_SPANS increased to 32.
* Fix for server.process_table declared incorrectly
@ -296,7 +306,7 @@ struct woomera_server server;
#endif
#define SMG_VERSION "v1.51"
#define SMG_VERSION "v1.54"
/* enable early media */
#if 1
@ -336,9 +346,17 @@ static int drop_seq=0;
#undef SMG_DROP_SEQ
#endif
#if 0
#define SMG_NO_MEDIA
#warning "SMG No Media Defined"
#else
#undef SMG_NO_MEDIA
#endif
const char WELCOME_TEXT[] =
"================================================================================\n"
"Sangoma Media Gateway Daemon v1.51 \n"
"Sangoma Media Gateway Daemon v1.54 \n"
"\n"
"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n"
"Copyright 2005, 2006, 2007 \n"
@ -378,7 +396,7 @@ static int isup_exec_command(int span, int chan, int id, int cmd, int cause)
short_signal_event_t oevent;
int retry=5;
call_signal_event_init(&oevent, cmd, chan, span);
call_signal_event_init((short_signal_event_t*)&oevent, cmd, chan, span);
oevent.release_cause = cause;
if (id >= 0) {
@ -405,6 +423,31 @@ isup_exec_cmd_retry:
return 0;
}
static int isup_exec_event(call_signal_event_t *event)
{
int retry=5;
isup_exec_cmd_retry:
if (call_signal_connection_write(&server.mcon, event) < 0){
--retry;
if (retry <= 0) {
log_printf(SMG_LOG_ALL, server.log,
"Critical System Error: Failed to tx on ISUP socket: %s\n",
strerror(errno));
return -1;
} else {
log_printf(SMG_LOG_ALL, server.log,
"System Warning: Failed to tx on ISUP socket: %s :retry %i\n",
strerror(errno),retry);
}
goto isup_exec_cmd_retry;
}
return 0;
}
static int isup_exec_commandp(int span, int chan, int id, int cmd, int cause)
{
@ -1237,13 +1280,16 @@ static void media_loop_run(struct media_session *ms)
char filename[100];
FILE *filed=NULL;
int loops=0,flags_out=0;
int open_cnt = 0;
open_cnt=0;
sangoma_api_hdr_t hdrframe;
memset(&hdrframe,0,sizeof(hdrframe));
memset(circuit_frame,0,sizeof(circuit_frame));
retry_loop:
ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1);
ms->sangoma_sock = open_span_chan(woomera->span+1, woomera->chan+1);
log_printf(SMG_LOG_PROD, server.log, "Media Loop Started %s fd=%i\n",
woomera->interface,ms->sangoma_sock);
@ -1275,11 +1321,16 @@ retry_loop:
sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api);
sangoma_tdm_disable_hwec(ms->sangoma_sock,&tdm_api);
ms->oob_disable = 0;
#ifdef LIBSANGOMA_VERSION
open_cnt = sangoma_get_open_cnt(ms->sangoma_sock, &tdm_api);
if (open_cnt > 1) {
ms->oob_disable = 1;
}
#endif
}
if (errs) {
if (errs) {
log_printf(SMG_LOG_ALL, server.log, "Media Loop: failed to open tdm device %s\n",
woomera->interface);
return;
@ -1302,21 +1353,6 @@ retry_loop:
continue;
}
#if 0
if (res == SMG_SOCKET_EVENT_NVAL) {
close_socket(&ms->sangoma_sock);
if (woomera_test_flag(woomera, WFLAG_MEDIA_END)) {
break;
}
ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1);
log_printf(SMG_LOG_ALL, server.log, "Media Loop Restart %s\n",
woomera->interface);
continue;
}
#endif
res = sangoma_readmsg_socket(ms->sangoma_sock,
&hdrframe,
sizeof(hdrframe),
@ -1365,7 +1401,7 @@ retry_loop:
sangoma_tdm_enable_hwec(ms->sangoma_sock,&tdm_api);
close_socket(&ms->sangoma_sock);
close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1);
if (loops < 1) {
log_printf(SMG_LOG_ALL, server.log, "Media Loop FAILED %s Master=%i MediaEnd=%i Loops=%i\n",
@ -1416,6 +1452,9 @@ static void *media_thread_run(void *obj)
FILE *tx_fd=NULL;
int sock_timeout=200;
int hwec_reenable=0;
int open_cnt = 0;
open_cnt=0;
if (woomera_test_flag(woomera, WFLAG_MEDIA_END) ||
!woomera->interface ||
@ -1478,7 +1517,7 @@ static void *media_thread_run(void *obj)
}
#else
media_retry:
ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1);
ms->sangoma_sock = open_span_chan(woomera->span+1, woomera->chan+1);
if (ms->sangoma_sock < 0) {
if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) {
@ -1546,6 +1585,13 @@ media_retry:
#endif
ms->oob_disable = 0;
#ifdef LIBSANGOMA_VERSION
open_cnt = sangoma_get_open_cnt(ms->sangoma_sock, &tdm_api);
if (open_cnt > 1) {
ms->oob_disable = 1;
}
#endif
if (!bearer_cap_is_audio(woomera->bearer_cap)) {
int err;
err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api);
@ -1569,10 +1615,12 @@ media_retry:
#ifdef WP_HPTDM_API
/* No tdm thread */
#else
#ifndef SMG_NO_MEDIA
if (!errs &&
launch_media_tdm_thread(woomera)) {
errs++;
}
#endif
#endif
if (errs) {
@ -1650,6 +1698,10 @@ media_retry:
break;
}
#ifdef SMG_NO_MEDIA
continue;
#endif
if (res == 0) {
if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) {
@ -1841,7 +1893,7 @@ media_thread_exit:
/* Dont wait for the other thread */
close_socket(&ms->udp_sock);
close_socket(&ms->sangoma_sock);
close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1);
while(woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) {
usleep(1000);
sched_yield();
@ -1850,7 +1902,7 @@ media_thread_exit:
close_socket(&ms->udp_sock);
close_socket(&ms->sangoma_sock);
close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1);
if (tx_fd){
fclose(tx_fd);
@ -1887,10 +1939,7 @@ static void *media_tdm_thread_run(void *obj)
unsigned char circuit_frame[1024];
sangoma_api_hdr_t hdrframe;
int flags_out;
#if 0
int tdm_cnt=0;
#endif
int poll_opt = POLLIN | POLLPRI;
memset(&hdrframe,0,sizeof(hdrframe));
memset(circuit_frame,0,sizeof(circuit_frame));
@ -1921,8 +1970,12 @@ static void *media_tdm_thread_run(void *obj)
break;
}
res = waitfor_socket(ms->sangoma_sock, 1000, (POLLIN | POLLPRI), &flags_out);
if (ms->oob_disable) {
poll_opt = POLLIN;
} else {
poll_opt = POLLIN | POLLPRI;
}
res = waitfor_socket(ms->sangoma_sock, 1000, poll_opt, &flags_out);
if (res < 0) {
@ -2537,7 +2590,62 @@ static void handle_event_dtmf(struct woomera_interface *woomera, unsigned char d
return;
}
static int handle_woomera_progress(struct woomera_interface *woomera,
struct woomera_message *wmsg)
{
call_signal_event_t event;
int err=-1;
memset(&event, 0, sizeof(event));
call_signal_event_init((short_signal_event_t*)&event, SIGBOOST_EVENT_CALL_PROGRESS, woomera->chan, woomera->span);
sprintf(event.isup_in_rdnis,"SMG003-EVI-2");
event.isup_in_rdnis_size=strlen(event.isup_in_rdnis);
if (woomera->index >= 0) {
event.call_setup_id = woomera->index;
}
log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n",
wmsg->command, woomera->interface);
if (!woomera_check_running(woomera)) {
socket_printf(woomera->socket, "405 PROGRESS Channel already hungup%s"
"Unique-Call-Id: %s%s",
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
return -1;
}
if (!woomera_test_flag(woomera,WFLAG_CALL_ACKED)) {
socket_printf(woomera->socket, "405 PROGRESS Channel not aceked%s"
"Unique-Call-Id: %s%s",
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
return -1;
}
err=isup_exec_event(&event);
if (err == 0) {
socket_printf(woomera->socket,
"200 %s PROGRESS OK%s"
"Unique-Call-Id: %s%s",
wmsg->callid,
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
} else {
socket_printf(woomera->socket, "405 PROGRESS Boost failure%s"
"Unique-Call-Id: %s%s",
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
}
return err;
}
static int handle_woomera_media_accept_answer(struct woomera_interface *woomera,
struct woomera_message *wmsg,
@ -2549,10 +2657,7 @@ static int handle_woomera_media_accept_answer(struct woomera_interface *woomera,
log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n",
wmsg->command, woomera->interface);
if (woomera_test_flag(woomera, WFLAG_HANGUP) ||
!woomera_test_flag(woomera, WFLAG_RUNNING) ||
woomera_test_flag(woomera, WFLAG_MEDIA_END)) {
if (!woomera_check_running(woomera)) {
log_printf(SMG_LOG_DEBUG_CALL, server.log,
"ERROR! call was cancelled MEDIA on HANGUP or MEDIA END!\n");
@ -3202,27 +3307,27 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_
} else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) {
cause=81;
socket_printf(woomera->socket, "EVENT HANGUP %s"
"Cause: %s%s"
"Q931-Cause-Code: %d%s",
WOOMERA_LINE_SEPERATOR,
q931_rel_to_str(cause),
WOOMERA_LINE_SEPERATOR,
cause,
WOOMERA_RECORD_SEPERATOR);
cause=81;
socket_printf(woomera->socket, "EVENT HANGUP %s"
"Cause: %s%s"
"Q931-Cause-Code: %d%s",
WOOMERA_LINE_SEPERATOR,
q931_rel_to_str(cause),
WOOMERA_LINE_SEPERATOR,
cause,
WOOMERA_RECORD_SEPERATOR);
socket_printf(woomera->socket, "404 Session Mis-match%s"
WOOMERA_RECORD_SEPERATOR);
woomera_set_flag(woomera, WFLAG_HANGUP);
woomera_set_flag(woomera, WFLAG_HANGUP);
return;
}
if (!strcasecmp(wmsg->command, "dtmf")) {
if (!strcasecmp(wmsg->command, "dtmf")) {
log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n",
woomera->interface, wmsg->command_args, wmsg->body);
log_printf(SMG_LOG_WOOMERA, woomera->log,
"WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n",
woomera->interface, wmsg->command_args, wmsg->body);
wanpipe_send_dtmf(woomera,wmsg->body);
@ -3273,8 +3378,7 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
} else if (!strcasecmp(wmsg->command, "proceed")) {
log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n",
@ -3287,7 +3391,12 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_
WOOMERA_LINE_SEPERATOR,
woomera->session,
WOOMERA_RECORD_SEPERATOR);
} else if (!strcasecmp(wmsg->command, "progress")) {
handle_woomera_progress(woomera,wmsg);
} else if ((media = !strcasecmp(wmsg->command, "media")) ||
(answer = !strcasecmp(wmsg->command, "answer")) ||
(accept = !strcasecmp(wmsg->command, "accept"))) {
@ -3796,6 +3905,7 @@ static void handle_call_start(call_signal_event_t *event)
struct woomera_event wevent;
char callid[20];
char *session;
struct woomera_interface *tmp_woomera=NULL;
int clients;
remove_end_of_digits_char((unsigned char*)event->called_number_digits);
@ -3806,11 +3916,17 @@ static void handle_call_start(call_signal_event_t *event)
validate_number((unsigned char*)event->calling_number_digits);
}
if (smg_validate_span_chan(event->span,event->chan)) {
log_printf(0,server.log,
"Error: invalid span=% chan=%i on incoming call [w%dg%d] - Call START!\n",
event->span+1, event->chan+1, event->span+1,event->chan+1);
return;
}
pthread_mutex_lock(&server.process_lock);
if (server.process_table[event->span][event->chan].dev) {
if ((tmp_woomera=server.process_table[event->span][event->chan].dev)) {
struct woomera_interface *tmp_woomera = server.process_table[event->span][event->chan].dev;
woomera_set_flag(tmp_woomera,WFLAG_HANGUP);
woomera_set_flag(tmp_woomera,WFLAG_MEDIA_END);
log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [w%dg%d] - Call START!\n", event->span+1, event->chan+1);
@ -5506,10 +5622,10 @@ static int sangoma_tdm_init (int span)
return 0;
}
static int woomera_startup(int argc, char **argv)
{
int x = 0, pid = 0, bg = 0;
int span_cnt, chan_cnt;
char *cfg=NULL, *debug=NULL, *arg=NULL;
while((arg = argv[x++])) {
@ -5590,6 +5706,12 @@ static int woomera_startup(int argc, char **argv)
return 0;
}
for (span_cnt = 0; span_cnt < CORE_MAX_SPANS; span_cnt++) {
for (chan_cnt = 0; chan_cnt < CORE_MAX_CHAN_PER_SPAN; chan_cnt++) {
pthread_mutex_init(&server.process_table[span_cnt][chan_cnt].media_lock, NULL);
}
}
q931_cause_setup();
bearer_cap_setup();
uil1p_to_str_setup();
@ -5692,6 +5814,13 @@ static int woomera_shutdown(void)
{
char *event_string;
int told = 0, loops = 0;
int span_cnt, chan_cnt;
for (span_cnt = 0; span_cnt < CORE_MAX_SPANS; span_cnt++) {
for (chan_cnt = 0; chan_cnt < CORE_MAX_CHAN_PER_SPAN; chan_cnt++) {
pthread_mutex_destroy(&server.process_table[span_cnt][chan_cnt].media_lock);
}
}
close_socket(&server.master_connection.socket);
pthread_mutex_destroy(&server.listen_lock);

View File

@ -225,7 +225,7 @@ struct media_session {
teletone_dtmf_detect_state_t dtmf_detect;
teletone_generation_session_t tone_session;
switch_buffer_t *dtmf_buffer;
unsigned char oob_disable;
};
struct woomera_message {
@ -283,23 +283,24 @@ struct woomera_interface {
char session[SMG_SESSION_NAME_SZ];
int check_digits; /* set to 1 when session comes up */
int bearer_cap;
struct woomera_interface *next;
struct woomera_interface *next;
};
struct woomera_session {
struct woomera_interface *dev;
struct woomera_interface *dev;
char session[SMG_SESSION_NAME_SZ];
char digits[MAX_DIALED_DIGITS+1];
int digits_len;
int bearer_cap;
int clients;
unsigned char media_used;
pthread_mutex_t media_lock;
};
#define CORE_TANK_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS
struct woomera_server {
// struct woomera_session process_table[CORE_MAX_CHAN_PER_SPAN][CORE_MAX_SPANS];
struct woomera_session process_table[CORE_MAX_SPANS][CORE_MAX_CHAN_PER_SPAN];
struct woomera_session process_table[CORE_MAX_SPANS][CORE_MAX_CHAN_PER_SPAN+1];
struct woomera_interface *holding_tank[CORE_TANK_LEN];
int holding_tank_index;
struct woomera_interface master_connection;
@ -683,9 +684,55 @@ static inline void validate_number(unsigned char *s)
}
}
static inline int woomera_check_running(struct woomera_interface *woomera)
{
if (woomera_test_flag(woomera, WFLAG_HANGUP) ||
!woomera_test_flag(woomera, WFLAG_RUNNING) ||
woomera_test_flag(woomera, WFLAG_MEDIA_END)) {
return 0;
}
return 1;
}
static inline int open_span_chan (unsigned char span, unsigned char chan)
{
int fd = -1;
#ifndef LIBSANGOMA_VERSION
fd = sangoma_open_tdmapi_span_chan(span, chan);
#else
if (chan == 24) {
pthread_mutex_lock(&server.process_table[span][chan].media_lock);
if(server.process_table[span][chan].media_used > 0) {
log_printf(SMG_LOG_ALL, server.log,
"Critical Error: channel already opened [w%ig%i]\n", span, chan);
} else {
server.process_table[span][chan].media_used++;
fd = __sangoma_open_api_span_chan(span, chan);
}
pthread_mutex_unlock(&server.process_table[span][chan].media_lock);
} else {
fd = sangoma_open_api_span_chan(span, chan);
}
#endif
return fd;
}
static inline void close_span_chan (int *socket, unsigned char span, unsigned char chan)
{
if (chan == 24) {
pthread_mutex_lock(&server.process_table[span][chan].media_lock);
if(server.process_table[span][chan].media_used > 0) {
server.process_table[span][chan].media_used--;
}
close_socket(socket);
pthread_mutex_unlock(&server.process_table[span][chan].media_lock);
} else {
close_socket(socket);
}
}
extern int smg_log_init(void);
extern void smg_log_cleanup(void);

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/scripts
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/scripts/callgen
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/scripts/init.d
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/scripts/ss7
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -30,6 +30,7 @@ enum e_sigboost_event_id_values
SIGBOOST_EVENT_CALL_STOPPED_ACK = 0x86, /*134*/
SIGBOOST_EVENT_SYSTEM_RESTART = 0x87, /*135*/
SIGBOOST_EVENT_SYSTEM_RESTART_ACK = 0x88, /*136*/
SIGBOOST_EVENT_CALL_PROGRESS = 0x50, /*decimal 80*/
/* Following IDs are ss7boost to sangoma_mgd only. */
SIGBOOST_EVENT_HEARTBEAT = 0x89, /*137*/
SIGBOOST_EVENT_INSERT_CHECK_LOOP = 0x8a, /*138*/
@ -68,13 +69,21 @@ enum e_sigboost_huntgroup_values
SIGBOOST_HUNTGRP_RR_DESC = 0x03, /* round-robin with highest available first */
};
enum e_sigboost_event_info_par_values
{
SIGBOOST_EVI_SPARE = 0x00,
SIGBOOST_EVI_ALERTING = 0x01,
SIGBOOST_EVI_PROGRESS = 0x02,
};
#define MAX_DIALED_DIGITS 31
/* Next two defines are used to create the range of values for call_setup_id
* in the t_sigboost structure.
* 0..((CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN) - 1) */
#define CORE_MAX_SPANS 200
#define CORE_MAX_CHAN_PER_SPAN 30
#define CORE_MAX_CHAN_PER_SPAN 32
#define MAX_PENDING_CALLS CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN
/* 0..(MAX_PENDING_CALLS-1) is range of call_setup_id below */
#define SIZE_RDNIS 900
@ -138,6 +147,7 @@ static inline int boost_full_event(int event_id)
switch (event_id) {
case SIGBOOST_EVENT_CALL_START:
case SIGBOOST_EVENT_DIGIT_IN:
case SIGBOOST_EVENT_CALL_PROGRESS:
return 1;
default:
return 0;

View File

@ -1,6 +1,7 @@
#!/bin/bash
#!/bin/bash
cmd=$1;
sigd=$2;
xtraargs='';
cnt=0;
max_retry=10;
use_syslog=1;
@ -45,45 +46,6 @@ function usage()
return 1
}
if [ $sigd = "ss7boost" ] || [ $sigd = "sangoma_isupd" ]; then
sigd_safe_args="-i"
sigd_bg_args=""
SIG_LOG=/var/log/messages
eval "type $sigd 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
export PATH=$PATH:/usr/local/ss7box
fi
eval "type $sigd 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
echo
echo "Error $sigd is not found"
echo
exit 1
fi
SS7=1;
elif [ $sigd = "sangoma_brid" ]; then
sigd_safe_args=""
sigd_bg_args="-bg"
BRI=1;
elif [ $sigd = "sangoma_prid" ]; then
sigd_safe_args=""
sigd_bg_args="-bg"
PRI=1;
eval "export LD_LIBRARY_PATH=/usr/lib/sangoma_prid:${LD_LIBRARY_PATH} "
else
echo
usage
exit 1
fi
while [ ! -z "$3" ];
do
args=$args"$3 "
shift
done
function stop_all()
{
@ -93,7 +55,11 @@ function stop_all()
stop_safe_sangoma
stop_sigdaemon
stop_sangoma_mgd
#post_args=$post_args" >/dev/null 2>/dev/null &"
if [ "$xtraargs" != "sigdonly" ]; then
stop_sangoma_mgd
fi
remove_pid_files
}
@ -261,13 +227,28 @@ function start_test()
}
function start_all()
{
check_running
#post_args=$post_args" >/dev/null 2>/dev/null &"
if [ "$xtraargs" = "sigdonly" ]; then
start_sigd
ret=$?
else
start_sigd
ret=$?
if [ $ret -eq 0 ]; then
start_smg
ret=$?
fi
fi
return $ret
}
function start_sigd()
{
check_sigd_running
pre_args="";
post_args="";
#post_args=$post_args" >/dev/null 2>/dev/null &"
echo " "
echo "Starting processes..."
echo -n "Loading SCTP..."
@ -318,9 +299,26 @@ function start_all()
return 1;
fi
sleep 3
if [ "$xtraargs" = "sigdonly" ]; then
echo "Sangoma $sigd running.."
if [ $use_syslog -eq 1 ]; then
echo "log file: $LOG and /var/log/messages"
else
echo "log file: $LOG and /var/log/messages"
fi
echo " "
fi
return 0
}
function start_smg()
{
#check_sigd_running
check_smg_running
pre_args="";
post_args="";
if [ $use_safe -eq 1 ]; then
pre_args=" safe_sangoma"
post_args=""
@ -328,7 +326,6 @@ function start_all()
post_args=" -bg"
fi
if [ -e /etc/wanpipe/.no_smg_load ]; then
echo "Skipping sangoma_mgd..."
return 0;
@ -360,10 +357,11 @@ function start_all()
echo " "
return 0
}
function check_running ()
function check_sigd_running()
{
local rc
eval "pidof $sigd 2> /dev/null > /dev/null"
@ -373,7 +371,13 @@ function check_running ()
echo "exiting..."
exit 0
fi
return 0
}
function check_smg_running()
{
local rc
eval "pidof sangoma_mgd 2> /dev/null > /dev/null"
rc=$?
if [ $rc -eq 0 ]; then
@ -387,7 +391,6 @@ function check_running ()
if [ -e /var/run/sangoma_mgd.pid ];then
eval "rm -f /var/run/sangoma_mgd.pid >/dev/null 2>/dev/null";
fi
return 0
}
@ -492,14 +495,100 @@ function parse_args()
done
}
read_smg_conf ()
{
WAN_HOME=/etc/wanpipe
WAN_CONF_DIR=$WAN_HOME
META_SMG_CONF=$WAN_HOME/smg.rc
# Read meta-configuration file.
if [ -f $META_SMG_CONF ]
then . $META_SMG_CONF
else
echo " $META_SMG_CONF not found !!!!"
return 1
fi
return 0
}
function init_smg_conf()
{
SMG_BOOT=
SANGOMA_PRID=
SANGOMA_BRID=
SANGOMA_SS7ISUP=
SANGOMA_MEDIA_GATEWAY=
SANGOMA_SS7BOOST=
}
######################
#main start here
######################
parse_args
init_smg_conf
read_smg_conf
#Set sigd
if [ "$SANGOMA_PRID" = "YES" ]; then
sigd="sangoma_prid"
elif [ "$SANGOMA_BRID" = "YES" ]; then
sigd="sangoma_brid"
elif [ "$SANGOMA_SS7ISUP" = "YES" ]; then
sigd="sangoma_isupd"
elif [ "$SANGOMA_SS7BOOST" = "YES" ]; then
sigd="ss7boost"
else
echo "Failed to specify sigd!!! check $META_SMG_CONF "
exit 1
fi
if [ $SANGOMA_MEDIA_GATEWAY = "NO" ]; then
xtraargs="sigdonly"
fi
if [ $sigd = "ss7boost" ] || [ $sigd = "sangoma_isupd" ]; then
sigd_safe_args="-i"
sigd_bg_args=""
SIG_LOG=/var/log/messages
eval "type $sigd 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
export PATH=$PATH:/usr/local/ss7box
fi
eval "type $sigd 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
echo
echo "Error $sigd is not found"
echo
exit 1
fi
SS7=1;
elif [ $sigd = "sangoma_brid" ]; then
sigd_safe_args=""
sigd_bg_args="-bg"
BRI=1;
elif [ $sigd = "sangoma_prid" ]; then
sigd_safe_args=""
sigd_bg_args="-bg"
PRI=1;
else
usage
exit 1
fi
while [ ! -z "$3" ];
do
args=$args"$3 "
shift
done
ret=0
if [ "$cmd" = "start" ]; then
start_all
ret=$?
start_all
ret=$?
if [ $ret -ne 0 ]; then
stop_all
fi

View File

@ -1,15 +0,0 @@
#!/bin/bash
cmd=$1;
while [ ! -z "$2" ];
do
args=$args"$2 "
shift
done
__smg_ctrl_common $cmd sangoma_brid $args
ret=$?
exit $ret

View File

@ -1,15 +0,0 @@
#!/bin/bash
cmd=$1;
while [ ! -z "$2" ];
do
args=$args"$2 "
shift
done
__smg_ctrl_common $cmd sangoma_prid $args
ret=$?
exit $ret

View File

@ -1,15 +0,0 @@
#!/bin/bash
cmd=$1;
while [ ! -z "$2" ];
do
args=$args"$2 "
shift
done
__smg_ctrl_common $cmd sangoma_isupd $args
ret=$?
exit $ret

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/unit
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/unit/core
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/unit/tests
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/unit/tests/1_loop
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/unit/tests/1_loop/tmp
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/unit/tests/2_loop_call
https://www.sangomapbx.com/svn/sangoma_mgd

View File

@ -1,7 +1,7 @@
8
dir
193
204
https://www.sangomapbx.com/svn/sangoma_mgd/trunk/unit/tests/2_loop_call/tmp
https://www.sangomapbx.com/svn/sangoma_mgd