[asterisk-commits] murf: branch murf/selway r145824 - in /team/murf/selway: ./ apps/ channels/ c...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 2 11:01:41 CDT 2008
Author: murf
Date: Thu Oct 2 11:01:40 2008
New Revision: 145824
URL: http://svn.digium.com/view/asterisk?view=rev&rev=145824
Log:
Merged revisions 143674,143736,143903,143964,144066,144238,144356,144420,144677,144758,144924-144925,145293,145479,145751 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r143674 | murf | 2008-09-19 15:07:05 -0600 (Fri, 19 Sep 2008) | 1 line
This fix comes from a debugging session on a test box that has been getting hung channels when the mssqlserver bounces. All the connections then become invalid, and must be reconnected. The cdr_odbc backend had code to do it, but depended on re-establishing the connection, but re-using the STMT that had been built. By trial and error, we determined that the STMT could not be re-used after the connection was re-established. and must be rebuilt. These changes accomplish this.
................
r143736 | seanbright | 2008-09-19 18:50:10 -0600 (Fri, 19 Sep 2008) | 9 lines
Make vmail.cgi work with mailboxes defined in users.conf, too.
(closes issue #13187)
Reported by: netvoice
Patches:
20080911__bug13187.diff.txt uploaded by Corydon76 (license 14)
(Slightly modified to take alchamist's comments on mantis into account)
Tested by: msales, alchamist, seanbright
................
r143903 | seanbright | 2008-09-22 16:49:00 -0600 (Mon, 22 Sep 2008) | 8 lines
Use the advertised header size in .au files instead of just assuming they
are 24 bytes (the minimum).
(closes issue #13450)
Reported by: jamessan
Patches:
pcm-header.diff uploaded by jamessan (license 246)
................
r143964 | murf | 2008-09-23 08:22:10 -0600 (Tue, 23 Sep 2008) | 21 lines
In at least one machine, we noted that the timestr
was not getting set in the STMT; it was coming out,
usually, as binary garbage to an mssql server.
These changes fixed the problem. The only thing
I can venture forth as a guess, is that the pointer
is being stored in the interface, not a copy of the
string. Because we ripped the build process into a
subroutine, the timestr became a temp. stack variable,
and between the time the STMT got built and the
time it was executed on the server, the string being
pointed to was damaged. At any rate, even if this
theory is false, and some mechanism was at fault,
this fix worked reliably where it didn't before.
Why this bug didn't bite last week, I have no idea.
This change basically defines the timestr buffer
in the calling function, extending the life of the
buffer to cover both the STMT's building and
processing to the server.
................
r144066 | murf | 2008-09-23 10:41:49 -0600 (Tue, 23 Sep 2008) | 29 lines
(closes issue #13489)
Reported by: DougUDI
Tested by: murf
(closes issue #13490)
Reported by: seanbright
Tested by: murf
(closes issue #13467)
Reported by: edantie
Tested by: murf, edantie, DougUDI
This crash happens because we are unsafely handling old pointers.
The channel whose cdr is being handled, has been hung up and
destroyed already. I reorganized the code a bit, and tried not
to lose the fork-cdr-chain concepts of the previous code.
I now verify that the 'previous' channel (the channel we
had when the bridge was started), still exists, by looking it up
by name in the channel list. I also do not try to reset the
CDR's of channels involved in bridges.
Testing shows it solves the crash problem, and should not
negatively impact previous fixes involving CDR's generated
during/after blind transfers. (The reason we need to reset
the CDR's on the "beginning" channels in the first place).
................
r144238 | crichter | 2008-09-24 02:20:52 -0600 (Wed, 24 Sep 2008) | 1 line
improved helptext of misdn_set_opt.
................
r144356 | tilghman | 2008-09-24 19:44:47 -0600 (Wed, 24 Sep 2008) | 6 lines
Backport Hebrew language to voicemail.
(closes issue #13155)
Reported by: greenfieldtech
Patches:
voicemail-hebrew-patch-1.4-SVN.c.patch uploaded by greenfieldtech (license 369)
................
r144420 | murf | 2008-09-25 10:12:14 -0600 (Thu, 25 Sep 2008) | 25 lines
(closes issue #12101)
Reported by: MVF
Tested by: neutrino88, urzedo, murf, thiagofernandes
Many thanks to neutrino88 for this patch, which
solves a problem whereby channels get a CANCEL
request, respond to it properly, but end up
in a hung state, infinitely being rescheduled.
This fix is a bit crude, in that catches the
problem at a rather late phase, but it may
prevent infinite rescheduling problems that
might still arise.
It might have been better to find out why,
in the course of protocol handling, the channel
was not destroyed, but we leave that to
future generations.
Many thanks to urzedo and thiagofernandes for
their work in verifying that the patch code
indeed is being executing, and averting the
problem.
................
r144677 | murf | 2008-09-26 11:47:13 -0600 (Fri, 26 Sep 2008) | 12 lines
(closes issue #13563)
Reported by: mnicholson
Patches:
found1.diff uploaded by mnicholson (license 96)
This patch was mainly meant to apply to trunk and 1.6.x,
but I'm applying it to 1.4 also, which should be a perfectly
harmless fix to the vast majority of users who are not using
external switches, but the few who might be affected
will not have to go to the pain of filing a bug report.
................
r144758 | mmichelson | 2008-09-26 16:14:59 -0600 (Fri, 26 Sep 2008) | 8 lines
This patch was applied to 1.4 but it completely
does not apply since the "found" pointer is not
passed in to this function. If this is going to
be backported, it needs to be done differently or
a deeper backport needs to be done.
Edit: This commit reverts commit number 144677.
................
r144924 | kpfleming | 2008-09-27 09:00:48 -0600 (Sat, 27 Sep 2008) | 6 lines
improve header inclusion process in a few small ways:
- it is no longer necessary to forcibly include asterisk/autoconfig.h; every module already includes asterisk.h as its first header (even before system headers), which serves the same purpose
- astmm.h is now included by asterisk.h when needed, instead of being forced by the Makefile; this means external modules will build properly against installed headers with MALLOC_DEBUG enabled
- simplify the usage of some of these headers in the AEL-related stuff in the utils directory
................
r144925 | kpfleming | 2008-09-27 09:13:30 -0600 (Sat, 27 Sep 2008) | 2 lines
fix some minor issues with rev 144924
................
r145293 | rmudgett | 2008-09-30 17:55:24 -0600 (Tue, 30 Sep 2008) | 54 lines
channels/chan_misdn.c
channels/misdn/isdn_lib.c
* Miscellaneous other fixes from trunk to make merging easier later.
........
r145200 | rmudgett | 2008-09-30 16:00:54 -0500 (Tue, 30 Sep 2008) | 7 lines
* Miscellaneous formatting changes to make v1.4 and trunk
more merge compatible in the mISDN area.
channels/chan_misdn.c
* Eliminated redundant code in cb_events() EVENT_SETUP
........
r144257 | crichter | 2008-09-24 03:42:55 -0500 (Wed, 24 Sep 2008) | 9 lines
improved helptext of misdn_set_opt.
........
r142181 | rmudgett | 2008-09-09 12:30:52 -0500 (Tue, 09 Sep 2008) | 1 line
Cleaned up comment
........
r138738 | rmudgett | 2008-08-18 16:07:28 -0500 (Mon, 18 Aug 2008) | 30 lines
channels/chan_misdn.c
* Made bearer2str() use allowed_bearers_array[]
* Made use the causes.h defines instead of hardcoded numbers.
* Made use Asterisk presentation indicator values if either of the
mISDN presentation or screen options are negative.
* Updated the misdn_set_opt application option descriptions.
* Renamed the awkward Caller ID presentation misdn_set_opt
application option value not_screened to restricted.
Deprecated the not_screened option value.
channels/misdn/isdn_lib.c
* Made use the causes.h defines instead of hardcoded numbers.
* Fixed some spelling errors and typos.
* Added all defined facility code strings to fac2str().
channels/misdn/isdn_lib.h
* Added doxygen comments to struct misdn_bchannel.
channels/misdn/isdn_lib_intern.h
* Added doxygen comments to struct misdn_stack.
channels/misdn_config.c
configs/misdn.conf.sample
* Updated the mISDN presentation and screen parameter descriptions.
doc/misdn.txt (doc/tex/misdn.tex)
* Updated the misdn_set_opt application option descriptions.
* Fixed some spelling errors and typos.
................
r145479 | lmadsen | 2008-10-01 11:18:30 -0600 (Wed, 01 Oct 2008) | 6 lines
Update the realtime_pgsql.sql script to create the setinterfacevar column.
(closes issue #13549)
Reported by: fiddur
................
r145751 | tilghman | 2008-10-02 09:13:21 -0600 (Thu, 02 Oct 2008) | 3 lines
Some sanity checks that may have led to prior crashes, found by codefreeze-lap
(murf) on IRC. Also some cleanup of incorrectly-used constants.
................
Modified:
team/murf/selway/ (props changed)
team/murf/selway/Makefile
team/murf/selway/Makefile.moddir_rules
team/murf/selway/apps/app_voicemail.c
team/murf/selway/channels/chan_misdn.c
team/murf/selway/channels/chan_sip.c
team/murf/selway/channels/misdn/isdn_lib.c
team/murf/selway/channels/misdn/isdn_lib.h
team/murf/selway/channels/misdn/isdn_lib_intern.h
team/murf/selway/channels/misdn_config.c
team/murf/selway/configs/misdn.conf.sample
team/murf/selway/contrib/scripts/realtime_pgsql.sql
team/murf/selway/contrib/scripts/vmail.cgi
team/murf/selway/doc/misdn.txt
team/murf/selway/formats/format_pcm.c
team/murf/selway/include/asterisk.h
team/murf/selway/main/ast_expr2.c
team/murf/selway/main/ast_expr2.fl
team/murf/selway/main/ast_expr2.y
team/murf/selway/main/ast_expr2f.c
team/murf/selway/main/astmm.c
team/murf/selway/main/callerid.c
team/murf/selway/main/stdtime/localtime.c
team/murf/selway/pbx/ael/ael.flex
team/murf/selway/pbx/ael/ael.tab.c
team/murf/selway/pbx/ael/ael.y
team/murf/selway/pbx/ael/ael_lex.c
team/murf/selway/pbx/pbx_ael.c
team/murf/selway/res/res_odbc.c
team/murf/selway/utils/Makefile
team/murf/selway/utils/ael_main.c
team/murf/selway/utils/astman.c
Propchange: team/murf/selway/
------------------------------------------------------------------------------
automerge = yes
Propchange: team/murf/selway/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Oct 2 11:01:40 2008
@@ -1,1 +1,1 @@
-/branches/1.4:1-143670
+/branches/1.4:1-145823
Modified: team/murf/selway/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/selway/Makefile?view=diff&rev=145824&r1=145823&r2=145824
==============================================================================
--- team/murf/selway/Makefile (original)
+++ team/murf/selway/Makefile Thu Oct 2 11:01:40 2008
@@ -202,8 +202,6 @@
endif
ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
-
-ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
ifeq ($(AST_DEVMODE),yes)
ASTCFLAGS+=-Werror -Wunused $(AST_DECLARATION_AFTER_STATEMENT)
Modified: team/murf/selway/Makefile.moddir_rules
URL: http://svn.digium.com/view/asterisk/team/murf/selway/Makefile.moddir_rules?view=diff&rev=145824&r1=145823&r2=145824
==============================================================================
--- team/murf/selway/Makefile.moddir_rules (original)
+++ team/murf/selway/Makefile.moddir_rules Thu Oct 2 11:01:40 2008
@@ -10,12 +10,6 @@
# This program is free software, distributed under the terms of
# the GNU General Public License
#
-
-ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
- ifeq ($(findstring astmm.h,$(ASTCFLAGS)),)
- ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
- endif
-endif
ifeq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
ASTCFLAGS+=${GC_CFLAGS}
Modified: team/murf/selway/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/selway/apps/app_voicemail.c?view=diff&rev=145824&r1=145823&r2=145824
==============================================================================
--- team/murf/selway/apps/app_voicemail.c (original)
+++ team/murf/selway/apps/app_voicemail.c Thu Oct 2 11:01:40 2008
@@ -249,6 +249,7 @@
\arg \b no - Norwegian
\arg \b se - Swedish
\arg \b ua - Ukrainian
+ \arg \b he - Hebrew
German requires the following additional soundfile:
\arg \b 1F einE (feminine)
@@ -305,6 +306,12 @@
\arg \b vm-nuovi new plural
\arg \b vm-vecchio old
\arg \b vm-vecchi old plural
+
+Hebrew also uses:
+\arg \b vm-INBOX1 '1 new message'
+\arg \b vm-OLD1 '1 old message'
+\arg \b vm-shtei 'shtei'
+\arg \b vm-nomessages 'you have no new messages'
\note Don't use vm-INBOX or vm-Old, because they are the name of the INBOX and Old folders,
spelled among others when you have to change folder. For the above reasons, vm-INBOX
@@ -5169,6 +5176,8 @@
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q H 'digits/kai' M ", NULL);
else if (!strcasecmp(chan->language,"pt_BR"))
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/pt-as' HM ", NULL);
+ else if (!strcasecmp(chan->language,"he"))
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'at2' kM", NULL);
else
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
#if 0
@@ -5307,10 +5316,33 @@
vms->starting = 0;
make_file(vms->fn, sizeof(vms->fn), vms->curdir, vms->curmsg);
adsi_message(chan, vms);
- if (!vms->curmsg)
- res = wait_file2(chan, vms, "vm-first"); /* "First" */
- else if (vms->curmsg == vms->lastmsg)
- res = wait_file2(chan, vms, "vm-last"); /* "last" */
+ if (!strcasecmp(chan->language, "he")) { /* HEBREW FORMAT */
+ /*
+ * The syntax in hebrew for counting the number of message is up side down
+ * in comparison to english.
+ */
+ if (!vms->curmsg) {
+ res = wait_file2(chan, vms, "vm-message");
+ res = wait_file2(chan, vms, "vm-first"); /* "First" */
+ } else if (vms->curmsg == vms->lastmsg) {
+ res = wait_file2(chan, vms, "vm-message");
+ res = wait_file2(chan, vms, "vm-last"); /* "last" */
+ } else {
+ res = wait_file2(chan, vms, "vm-message"); /* "message" */
+ if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
+ ast_log(LOG_DEBUG, "curmsg: %d\n", vms->curmsg);
+ ast_log(LOG_DEBUG, "lagmsg: %d\n", vms->lastmsg);
+ if (!res) {
+ res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, "f");
+ }
+ }
+ }
+ } else {
+ if (!vms->curmsg)
+ res = wait_file2(chan, vms, "vm-first"); /* "First" */
+ else if (vms->curmsg == vms->lastmsg)
+ res = wait_file2(chan, vms, "vm-last"); /* "last" */
+ }
if (!res) {
/* POLISH syntax */
if (!strcasecmp(chan->language, "pl")) {
@@ -5576,6 +5608,9 @@
return vm_play_folder_name_pl(chan, mbox);
} else if (!strcasecmp(chan->language, "ua")){ /* Ukrainian syntax */
return vm_play_folder_name_ua(chan, mbox);
+ } else if (!strcasecmp(chan->language, "he")){ /* Hebrew syntax */
+ cmd = ast_play_and_wait(chan, mbox);
+ return cmd;
} else { /* Default English */
cmd = ast_play_and_wait(chan, mbox);
return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages */
@@ -5674,6 +5709,74 @@
}
return res;
}
+
+/* Default Hebrew syntax */
+static int vm_intro_he(struct ast_channel *chan, struct vm_state *vms)
+{
+ int res=0;
+
+ /* Introduce messages they have */
+ if (!res) {
+ if ((vms->newmessages) || (vms->oldmessages)) {
+ res = ast_play_and_wait(chan, "vm-youhave");
+ }
+ /*
+ * The word "shtei" refers to the number 2 in hebrew when performing a count
+ * of elements. In Hebrew, there are 6 forms of enumerating the number 2 for
+ * an element, this is one of them.
+ */
+ if (vms->newmessages) {
+ if (!res) {
+ if (vms->newmessages == 1) {
+ res = ast_play_and_wait(chan, "vm-INBOX1");
+ } else {
+ if (vms->newmessages == 2) {
+ res = ast_play_and_wait(chan, "vm-shtei");
+ } else {
+ res = ast_say_number(chan, vms->newmessages, AST_DIGIT_ANY, chan->language, "f");
+ }
+ res = ast_play_and_wait(chan, "vm-INBOX");
+ }
+ }
+ if (vms->oldmessages && !res) {
+ res = ast_play_and_wait(chan, "vm-and");
+ if (vms->oldmessages == 1) {
+ res = ast_play_and_wait(chan, "vm-Old1");
+ } else {
+ if (vms->oldmessages == 2) {
+ res = ast_play_and_wait(chan, "vm-shtei");
+ } else {
+ res = ast_say_number(chan, vms->oldmessages, AST_DIGIT_ANY, chan->language, "f");
+ }
+ res = ast_play_and_wait(chan, "vm-Old");
+ }
+ }
+ }
+ if (!res && vms->oldmessages && !vms->newmessages) {
+ if (!res) {
+ if (vms->oldmessages == 1) {
+ res = ast_play_and_wait(chan, "vm-Old1");
+ } else {
+ if (vms->oldmessages == 2) {
+ res = ast_play_and_wait(chan, "vm-shtei");
+ } else {
+ res = ast_say_number(chan, vms->oldmessages, AST_DIGIT_ANY, chan->language, "f");
+ }
+ res = ast_play_and_wait(chan, "vm-Old");
+ }
+ }
+ }
+ if (!res) {
+ if (!vms->oldmessages && !vms->newmessages) {
+ if (!res) {
+ res = ast_play_and_wait(chan, "vm-nomessages");
+ }
+ }
+ }
+ }
+ return res;
+}
+
/* ITALIAN syntax */
static int vm_intro_it(struct ast_channel *chan, struct vm_state *vms)
@@ -6422,6 +6525,8 @@
return vm_intro_ru(chan, vms);
} else if (!strcasecmp(chan->language, "ua")) { /* UKRAINIAN syntax */
return vm_intro_ua(chan, vms);
+ } else if (!strcasecmp(chan->language, "he")) { /* HEBREW syntax */
+ return vm_intro_he(chan, vms);
} else { /* Default to ENGLISH */
return vm_intro_en(chan, vms);
}
@@ -6435,6 +6540,8 @@
if (vms->starting) {
if (vms->lastmsg > -1) {
res = ast_play_and_wait(chan, "vm-onefor");
+ if (!strcasecmp(chan->language, "he"))
+ res = ast_play_and_wait(chan, "vm-for");
if (!res)
res = vm_play_folder_name(chan, vms->vmbox);
}
@@ -6777,6 +6884,24 @@
return cmd;
}
+/* Hebrew Syntax */
+static int vm_browse_messages_he(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)
+{
+ int cmd = 0;
+
+ if (vms->lastmsg > -1) {
+ cmd = play_message(chan, vmu, vms);
+ } else {
+ if (!strcasecmp(vms->fn, "INBOX")) {
+ cmd = ast_play_and_wait(chan, "vm-nonewmessages");
+ } else {
+ cmd = ast_play_and_wait(chan, "vm-nomessages");
+ }
+ }
+ return cmd;
+}
+
+
/* ITALIAN syntax */
static int vm_browse_messages_it(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)
{
@@ -6844,6 +6969,8 @@
return vm_browse_messages_pt(chan, vms, vmu);
} else if (!strcasecmp(chan->language, "gr")){
return vm_browse_messages_gr(chan, vms, vmu); /* GREEK */
+ } else if (!strcasecmp(chan->language, "he")) {
+ return vm_browse_messages_he(chan, vms, vmu); /* HEBREW */
} else { /* Default to English syntax */
return vm_browse_messages_en(chan, vms, vmu);
}
@@ -7439,6 +7566,8 @@
case '*':
if (!vms.starting) {
cmd = ast_play_and_wait(chan, "vm-onefor");
+ if (!strcasecmp(chan->language, "he"))
+ cmd = ast_play_and_wait(chan, "vm-for");
if (!cmd)
cmd = vm_play_folder_name(chan, vms.vmbox);
if (!cmd)
Modified: team/murf/selway/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/murf/selway/channels/chan_misdn.c?view=diff&rev=145824&r1=145823&r2=145824
==============================================================================
--- team/murf/selway/channels/chan_misdn.c (original)
+++ team/murf/selway/channels/chan_misdn.c Thu Oct 2 11:01:40 2008
@@ -21,7 +21,10 @@
* \file
*
* \brief the chan_misdn channel driver for Asterisk
+ *
* \author Christian Richter <crich at beronet.com>
+ *
+ * \extref MISDN http://www.misdn.org/
*
* \ingroup channel_drivers
*/
@@ -72,13 +75,14 @@
#include "asterisk/term.h"
#include "asterisk/sched.h"
#include "asterisk/stringfields.h"
+#include "asterisk/causes.h"
#include "chan_misdn_config.h"
#include "isdn_lib.h"
-char global_tracefile[BUFFERSIZE+1];
-
-static int g_config_initialized=0;
+char global_tracefile[BUFFERSIZE + 1];
+
+static int g_config_initialized = 0;
struct misdn_jb{
int size;
@@ -94,17 +98,17 @@
-/* allocates the jb-structure and initialize the elements*/
+/*! \brief allocates the jb-structure and initialize the elements */
struct misdn_jb *misdn_jb_init(int size, int upper_threshold);
-/* frees the data and destroys the given jitterbuffer struct */
+/*! \brief frees the data and destroys the given jitterbuffer struct */
void misdn_jb_destroy(struct misdn_jb *jb);
-/* fills the jitterbuffer with len data returns < 0 if there was an
+/*! \brief fills the jitterbuffer with len data returns < 0 if there was an
error (buffer overrun). */
int misdn_jb_fill(struct misdn_jb *jb, const char *data, int len);
-/* gets len bytes out of the jitterbuffer if available, else only the
+/*! \brief gets len bytes out of the jitterbuffer if available, else only the
available data is returned and the return value indicates the number
of data. */
int misdn_jb_empty(struct misdn_jb *jb, char *data, int len);
@@ -132,9 +136,8 @@
MISDN_RELEASED, /*!< when connected */
MISDN_BRIDGED, /*!< when bridged */
MISDN_CLEANING, /*!< when hangup from * but we were connected before */
- MISDN_HUNGUP_FROM_MISDN, /*!< when DISCONNECT/RELEASE/REL_COMP cam from misdn */
- MISDN_HUNGUP_FROM_AST, /*!< when DISCONNECT/RELEASE/REL_COMP came out of */
- /* misdn_hangup */
+ MISDN_HUNGUP_FROM_MISDN, /*!< when DISCONNECT/RELEASE/REL_COMP came from misdn */
+ MISDN_HUNGUP_FROM_AST, /*!< when DISCONNECT/RELEASE/REL_COMP came out of misdn_hangup */
MISDN_HOLDED, /*!< if this chan is holded */
MISDN_HOLD_DISCONNECT, /*!< if this chan is holded */
@@ -150,17 +153,16 @@
struct chan_list {
- char allowed_bearers[BUFFERSIZE+1];
+ char allowed_bearers[BUFFERSIZE + 1];
enum misdn_chan_state state;
int need_queue_hangup;
int need_hangup;
int need_busy;
+ int originator;
int noautorespond_on_setup;
- int originator;
-
int norxtone;
int notxtone;
@@ -174,7 +176,7 @@
char ast_rd_buf[4096];
struct ast_frame frame;
- int faxdetect; /* 0:no 1:yes 2:yes+nojump */
+ int faxdetect; /*!< 0:no 1:yes 2:yes+nojump */
int faxdetect_timeout;
struct timeval faxdetect_tv;
int faxhandled;
@@ -246,11 +248,13 @@
static inline void free_robin_list_r (struct robin_list *r)
{
- if (r) {
- if (r->next) free_robin_list_r(r->next);
- if (r->group) free(r->group);
- free(r);
- }
+ if (r) {
+ if (r->next)
+ free_robin_list_r(r->next);
+ if (r->group)
+ free(r->group);
+ free(r);
+ }
}
static void free_robin_list ( void )
@@ -267,7 +271,7 @@
if (!strcasecmp(iter->group, group))
return iter;
}
- new = (struct robin_list *)calloc(1, sizeof(struct robin_list));
+ new = (struct robin_list *) calloc(1, sizeof(struct robin_list));
new->group = strndup(group, strlen(group));
new->port = 0;
new->channel = 0;
@@ -280,13 +284,14 @@
}
-/* the main schedule context for stuff like l1 watcher, overlap dial, ... */
+/*! \brief the main schedule context for stuff like l1 watcher, overlap dial, ... */
static struct sched_context *misdn_tasks = NULL;
static pthread_t misdn_tasks_thread;
static int *misdn_ports;
-static void chan_misdn_log(int level, int port, char *tmpl, ...);
+static void chan_misdn_log(int level, int port, char *tmpl, ...)
+ __attribute__ ((format (printf, 3, 4)));
static struct ast_channel *misdn_new(struct chan_list *cl, int state, char *exten, char *callerid, int format, int port, int c);
static void send_digit_to_chan(struct chan_list *cl, char digit );
@@ -297,7 +302,7 @@
#define MISDN_ASTERISK_TECH_PVT(ast) ast->tech_pvt
#define MISDN_ASTERISK_PVT(ast) 1
-#include <asterisk/strings.h>
+#include "asterisk/strings.h"
/* #define MISDN_DEBUG 1 */
@@ -305,7 +310,7 @@
static int tracing = 0 ;
-/* Only alaw and mulaw is allowed for now */
+/*! \brief Only alaw and mulaw is allowed for now */
static int prefformat = AST_FORMAT_ALAW ; /* AST_FORMAT_SLINEAR ; AST_FORMAT_ULAW | */
static int *misdn_debug;
@@ -390,51 +395,35 @@
struct allowed_bearers {
- int cap;
- int val;
- char *name;
- int deprecated;
+ char *name; /*!< Bearer capability name string used in /etc/misdn.conf allowed_bearers */
+ char *display; /*!< Bearer capability displayable name */
+ int cap; /*!< SETUP message bearer capability field code value */
+ int deprecated; /*!< TRUE if this entry is deprecated. (Misspelled or bad name to use) */
};
-static struct allowed_bearers allowed_bearers_array[]= {
- {INFO_CAPABILITY_SPEECH,1,"speech"},
- {INFO_CAPABILITY_AUDIO_3_1K,2,"3_1khz"},
- {INFO_CAPABILITY_DIGITAL_UNRESTRICTED,4,"digital_unrestricted"},
- {INFO_CAPABILITY_DIGITAL_RESTRICTED,8,"digital_restricted"},
- {INFO_CAPABILITY_DIGITAL_RESTRICTED,8,"digital_restriced", 1}, /* Allow misspelling for backwards compatibility */
- {INFO_CAPABILITY_VIDEO,16,"video"}
+/* *INDENT-OFF* */
+static const struct allowed_bearers allowed_bearers_array[]= {
+ /* Name, Displayable Name Bearer Capability, Deprecated */
+ { "speech", "Speech", INFO_CAPABILITY_SPEECH, 0 },
+ { "3_1khz", "3.1KHz Audio", INFO_CAPABILITY_AUDIO_3_1K, 0 },
+ { "digital_unrestricted", "Unrestricted Digital", INFO_CAPABILITY_DIGITAL_UNRESTRICTED, 0 },
+ { "digital_restricted", "Restricted Digital", INFO_CAPABILITY_DIGITAL_RESTRICTED, 0 },
+ { "digital_restriced", "Restricted Digital", INFO_CAPABILITY_DIGITAL_RESTRICTED, 1 }, /* Allow misspelling for backwards compatibility */
+ { "video", "Video", INFO_CAPABILITY_VIDEO, 0 }
};
-
-static char *bearer2str(int cap) {
- static char *bearers[]={
- "Speech",
- "Audio 3.1k",
- "Unres Digital",
- "Res Digital",
- "Video",
- "Unknown Bearer"
- };
-
- switch (cap) {
- case INFO_CAPABILITY_SPEECH:
- return bearers[0];
- break;
- case INFO_CAPABILITY_AUDIO_3_1K:
- return bearers[1];
- break;
- case INFO_CAPABILITY_DIGITAL_UNRESTRICTED:
- return bearers[2];
- break;
- case INFO_CAPABILITY_DIGITAL_RESTRICTED:
- return bearers[3];
- break;
- case INFO_CAPABILITY_VIDEO:
- return bearers[4];
- break;
- default:
- return bearers[5];
- break;
- }
+/* *INDENT-ON* */
+
+static const char *bearer2str(int cap)
+{
+ unsigned index;
+
+ for (index = 0; index < ARRAY_LEN(allowed_bearers_array); ++index) {
+ if (allowed_bearers_array[index].cap == cap) {
+ return allowed_bearers_array[index].display;
+ }
+ } /* end for */
+
+ return "Unknown Bearer";
}
@@ -443,7 +432,7 @@
switch (fac->Function) {
case Fac_CD:
chan_misdn_log(1,bc->port," --> calldeflect to: %s, screened: %s\n", fac->u.CDeflection.DeflectedToNumber,
- fac->u.CDeflection.PresentationAllowed ? "yes" : "no");
+ fac->u.CDeflection.PresentationAllowed ? "yes" : "no");
break;
case Fac_AOCDCurrency:
if (fac->u.AOCDcur.chargeNotAvailable)
@@ -451,13 +440,13 @@
else if (fac->u.AOCDcur.freeOfCharge)
chan_misdn_log(1,bc->port," --> AOCD currency: free of charge\n");
else if (fac->u.AOCDchu.billingId >= 0)
- chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%d billingId:%d\n",
- fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
- (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDcur.billingId);
+ chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s billingId:%d\n",
+ fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
+ (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDcur.billingId);
else
- chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%d\n",
- fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
- (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total");
+ chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s\n",
+ fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
+ (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total");
break;
case Fac_AOCDChargingUnit:
if (fac->u.AOCDchu.chargeNotAvailable)
@@ -466,13 +455,14 @@
chan_misdn_log(1,bc->port," --> AOCD charging unit: free of charge\n");
else if (fac->u.AOCDchu.billingId >= 0)
chan_misdn_log(1,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s billingId:%d\n",
- fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDchu.billingId);
+ fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDchu.billingId);
else
chan_misdn_log(1,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s\n",
- fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total");
+ fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total");
break;
default:
- chan_misdn_log(1,bc->port," --> unknown\n");
+ chan_misdn_log(1,bc->port," --> unknown facility\n");
+ break;
}
}
@@ -687,7 +677,7 @@
} else {
misdn_overlap_dial_task_disconnect:
hanguptone_indicate(ch);
- ch->bc->out_cause=1;
+ ch->bc->out_cause = AST_CAUSE_UNALLOCATED;
ch->state=MISDN_CLEANING;
misdn_lib_send_event(ch->bc, EVENT_DISCONNECT);
}
@@ -729,10 +719,9 @@
else {
/* not handled */
ast_log(LOG_DEBUG, "Unable to handle DTMF tone '%c' for '%s'\n", digit, chan->name);
-
-
- }
-}
+ }
+}
+
/*** CLI HANDLING ***/
static int misdn_set_debug(int fd, int argc, char *argv[])
{
@@ -744,52 +733,55 @@
level = atoi(argv[3]);
switch (argc) {
- case 4:
- case 5: {
- int i;
- int only = 0;
- if (argc == 5) {
- if (strncasecmp(argv[4], "only", strlen(argv[4])))
- return RESULT_SHOWUSAGE;
- else
- only = 1;
- }
- for (i=0; i<=max_ports; i++) {
- misdn_debug[i] = level;
- misdn_debug_only[i] = only;
- }
- ast_cli(fd, "changing debug level for all ports to %d%s\n",misdn_debug[0], only?" (only)":"");
+ case 4:
+ case 5:
+ {
+ int i;
+ int only = 0;
+ if (argc == 5) {
+ if (strncasecmp(argv[4], "only", strlen(argv[4])))
+ return RESULT_SHOWUSAGE;
+ else
+ only = 1;
+ }
+
+ for (i = 0; i <= max_ports; i++) {
+ misdn_debug[i] = level;
+ misdn_debug_only[i] = only;
+ }
+ ast_cli(fd, "changing debug level for all ports to %d%s\n",misdn_debug[0], only?" (only)":"");
+ }
+ break;
+ case 6:
+ case 7:
+ {
+ int port;
+ if (strncasecmp(argv[4], "port", strlen(argv[4])))
+ return RESULT_SHOWUSAGE;
+ port = atoi(argv[5]);
+ if (port <= 0 || port > max_ports) {
+ switch (max_ports) {
+ case 0:
+ ast_cli(fd, "port number not valid! no ports available so you won't get lucky with any number here...\n");
+ break;
+ case 1:
+ ast_cli(fd, "port number not valid! only port 1 is available.\n");
+ break;
+ default:
+ ast_cli(fd, "port number not valid! only ports 1 to %d are available.\n", max_ports);
}
- break;
- case 6:
- case 7: {
- int port;
- if (strncasecmp(argv[4], "port", strlen(argv[4])))
- return RESULT_SHOWUSAGE;
- port = atoi(argv[5]);
- if (port <= 0 || port > max_ports) {
- switch (max_ports) {
- case 0:
- ast_cli(fd, "port number not valid! no ports available so you won't get lucky with any number here...\n");
- break;
- case 1:
- ast_cli(fd, "port number not valid! only port 1 is available.\n");
- break;
- default:
- ast_cli(fd, "port number not valid! only ports 1 to %d are available.\n", max_ports);
- }
- return 0;
- }
- if (argc == 7) {
- if (strncasecmp(argv[6], "only", strlen(argv[6])))
- return RESULT_SHOWUSAGE;
- else
- misdn_debug_only[port] = 1;
- } else
- misdn_debug_only[port] = 0;
- misdn_debug[port] = level;
- ast_cli(fd, "changing debug level to %d%s for port %d\n", misdn_debug[port], misdn_debug_only[port]?" (only)":"", port);
- }
+ return 0;
+ }
+ if (argc == 7) {
+ if (strncasecmp(argv[6], "only", strlen(argv[6])))
+ return RESULT_SHOWUSAGE;
+ else
+ misdn_debug_only[port] = 1;
+ } else
+ misdn_debug_only[port] = 0;
+ misdn_debug[port] = level;
+ ast_cli(fd, "changing debug level to %d%s for port %d\n", misdn_debug[port], misdn_debug_only[port]?" (only)":"", port);
+ }
}
return 0;
}
@@ -920,7 +912,7 @@
if (argc >= 4) {
if (!strcmp(argv[3], "description")) {
if (argc == 5) {
- enum misdn_cfg_elements elem = misdn_cfg_get_elem (argv[4]);
+ enum misdn_cfg_elements elem = misdn_cfg_get_elem(argv[4]);
if (elem == MISDN_CFG_FIRST)
ast_cli(fd, "Unknown element: %s\n", argv[4]);
else
@@ -953,9 +945,9 @@
}
if (argc == 3 || onlyport == 0) {
- ast_cli(fd,"Misdn General-Config: \n");
+ ast_cli(fd, "Misdn General-Config:\n");
for (elem = MISDN_GEN_FIRST + 1, linebreak = 1; elem < MISDN_GEN_LAST; elem++, linebreak++) {
- misdn_cfg_get_config_string( 0, elem, buffer, BUFFERSIZE);
+ misdn_cfg_get_config_string(0, elem, buffer, BUFFERSIZE);
ast_cli(fd, "%-36s%s", buffer, !(linebreak % 2) ? "\n" : "");
}
ast_cli(fd, "\n");
@@ -966,7 +958,7 @@
for (; port > 0; port = misdn_cfg_get_next_port(port)) {
ast_cli(fd, "\n[PORT %d]\n", port);
for (elem = MISDN_CFG_FIRST + 1, linebreak = 1; elem < MISDN_CFG_LAST; elem++, linebreak++) {
- misdn_cfg_get_config_string( port, elem, buffer, BUFFERSIZE);
+ misdn_cfg_get_config_string(port, elem, buffer, BUFFERSIZE);
ast_cli(fd, "%-36s%s", buffer, !(linebreak % 2) ? "\n" : "");
}
ast_cli(fd, "\n");
@@ -985,13 +977,14 @@
ast_cli(fd, "Port %d is not active!\n", onlyport);
}
}
+
return 0;
}
struct state_struct {
enum misdn_chan_state state;
- char txt[255] ;
-} ;
+ char txt[255];
+};
static struct state_struct state_array[] = {
{MISDN_NOTHING,"NOTHING"}, /* at beginning */
@@ -1017,18 +1010,19 @@
{MISDN_HUNGUP_FROM_AST,"HUNGUP_FROM_AST"} /* when DISCONNECT/RELEASE/REL_COMP came out of misdn_hangup */
};
-static char *misdn_get_ch_state(struct chan_list *p)
+static const char *misdn_get_ch_state(struct chan_list *p)
{
int i;
static char state[8];
if( !p) return NULL;
- for (i=0; i< sizeof(state_array)/sizeof(struct state_struct); i++) {
- if ( state_array[i].state == p->state) return state_array[i].txt;
- }
-
- sprintf(state,"%d",p->state) ;
+ for (i = 0; i < sizeof(state_array) / sizeof(struct state_struct); i++) {
+ if (state_array[i].state == p->state)
+ return state_array[i].txt;
+ }
+
+ snprintf(state, sizeof(state), "%d", p->state) ;
return state;
}
@@ -1047,8 +1041,8 @@
free_robin_list();
misdn_cfg_reload();
misdn_cfg_update_ptp();
- misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
- misdn_cfg_get( 0, MISDN_GEN_DEBUG, &cfg_debug, sizeof(int));
+ misdn_cfg_get(0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
+ misdn_cfg_get(0, MISDN_GEN_DEBUG, &cfg_debug, sizeof(int));
for (i = 0; i <= max_ports; i++) {
misdn_debug[i] = cfg_debug;
@@ -1058,24 +1052,24 @@
static int misdn_reload (int fd, int argc, char *argv[])
{
- ast_cli(fd, "Reloading mISDN Config\n");
+ ast_cli(fd, "Reloading mISDN configuration\n");
reload_config();
return 0;
}
-static void print_bc_info (int fd, struct chan_list* help, struct misdn_bchannel* bc)
-{
- struct ast_channel *ast=help->ast;
+static void print_bc_info (int fd, struct chan_list *help, struct misdn_bchannel *bc)
+{
+ struct ast_channel *ast = help->ast;
ast_cli(fd,
"* Pid:%d Prt:%d Ch:%d Mode:%s Org:%s dad:%s oad:%s rad:%s ctx:%s state:%s\n",
bc->pid, bc->port, bc->channel,
- bc->nt?"NT":"TE",
- help->originator == ORG_AST?"*":"I",
- ast?ast->exten:NULL,
- ast?ast->cid.cid_num:NULL,
+ bc->nt ? "NT" : "TE",
+ help->originator == ORG_AST ? "*" : "I",
+ ast ? ast->exten : NULL,
+ ast ? ast->cid.cid_num : NULL,
bc->rad,
- ast?ast->context:NULL,
+ ast ? ast->context : NULL,
misdn_get_ch_state(help)
);
if (misdn_debug[bc->port] > 0)
@@ -1100,7 +1094,7 @@
help->l3id,
help->addr,
bc->addr,
- bc?bc->l3_id:-1,
+ bc ? bc->l3_id : -1,
bc->display,
bc->active,
@@ -1112,21 +1106,23 @@
bc->ec_enable,
#endif
- help->norxtone,help->notxtone,
+ help->norxtone, help->notxtone,
bc->holded
);
+
+}
+
+static int misdn_show_cls (int fd, int argc, char *argv[])
+{
+ struct chan_list *help;
+
+ help = cl_te;
-}
-
-static int misdn_show_cls (int fd, int argc, char *argv[])
-{
- struct chan_list *help=cl_te;
-
- ast_cli(fd,"Chan List: %p\n",cl_te);
-
- for (;help; help=help->next) {
- struct misdn_bchannel *bc=help->bc;
- struct ast_channel *ast=help->ast;
+ ast_cli(fd, "Channel List: %p\n", cl_te);
+
+ for (; help; help = help->next) {
+ struct misdn_bchannel *bc = help->bc;
+ struct ast_channel *ast = help->ast;
if (!ast) {
if (!bc) {
ast_cli(fd, "chan_list obj. with l3id:%x has no bc and no ast Leg\n", help->l3id);
@@ -1135,7 +1131,9 @@
ast_cli(fd, "bc with pid:%d has no Ast Leg\n", bc->pid);
continue;
}
- if (misdn_debug[0] > 2) ast_cli(fd, "Bc:%p Ast:%p\n", bc, ast);
+
+ if (misdn_debug[0] > 2)
+ ast_cli(fd, "Bc:%p Ast:%p\n", bc, ast);
if (bc) {
print_bc_info(fd, help, bc);
} else {
@@ -1144,34 +1142,36 @@
ast_cli(fd, " --> l3_id: %x\n"
" --> dad:%s oad:%s\n"
" --> hold_port: %d\n"
- " --> hold_channel: %d\n"
-
- ,help->l3id
- ,ast->exten
- ,ast->cid.cid_num
- ,help->hold_info.port
- ,help->hold_info.channel
+ " --> hold_channel: %d\n",
+ help->l3id,
+ ast->exten,
+ ast->cid.cid_num,
+ help->hold_info.port,
+ help->hold_info.channel
);
} else {
- ast_cli(fd,"* Channel in unknown STATE !!! Exten:%s, Callerid:%s\n", ast->exten, ast->cid.cid_num);
- }
- }
- }
-
+ ast_cli(fd, "* Channel in unknown STATE !!! Exten:%s, Callerid:%s\n", ast->exten, ast->cid.cid_num);
+ }
+ }
+ }
+
misdn_dump_chanlist();
+
return 0;
}
static int misdn_show_cl (int fd, int argc, char *argv[])
{
- struct chan_list *help=cl_te;
+ struct chan_list *help;
if (argc != 4)
return RESULT_SHOWUSAGE;
-
- for (;help; help=help->next) {
- struct misdn_bchannel *bc=help->bc;
- struct ast_channel *ast=help->ast;
+
+ help = cl_te;
+
+ for (; help; help = help->next) {
+ struct misdn_bchannel *bc = help->bc;
+ struct ast_channel *ast = help->ast;
if (bc && ast) {
if (!strcasecmp(ast->name,argv[3])) {
@@ -1180,21 +1180,20 @@
}
}
}
-
-
+
return 0;
}
ast_mutex_t lock;
-int MAXTICS=8;
+int MAXTICS = 8;
static int misdn_set_tics (int fd, int argc, char *argv[])
{
if (argc != 4)
return RESULT_SHOWUSAGE;
-
- MAXTICS=atoi(argv[3]);
-
+
+ MAXTICS = atoi(argv[3]);
+
return 0;
}
@@ -1203,103 +1202,97 @@
int port;
ast_cli(fd, "BEGIN STACK_LIST:\n");
-
- for (port=misdn_cfg_get_next_port(0); port > 0;
- port=misdn_cfg_get_next_port(port)) {
+ for (port = misdn_cfg_get_next_port(0); port > 0;
+ port = misdn_cfg_get_next_port(port)) {
char buf[128];
[... 8197 lines stripped ...]
More information about the asterisk-commits
mailing list