[asterisk-commits] oej: branch oej/astum r48261 - in
/team/oej/astum: ./ agi/ apps/ channels/ co...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Dec 5 04:33:35 MST 2006
Author: oej
Date: Tue Dec 5 05:33:34 2006
New Revision: 48261
URL: http://svn.digium.com/view/asterisk?view=rev&rev=48261
Log:
Update to trunk
Removed:
team/oej/astum/main/coef_in.h
team/oej/astum/main/coef_out.h
Modified:
team/oej/astum/ (props changed)
team/oej/astum/.cleancount
team/oej/astum/CHANGES
team/oej/astum/Makefile
team/oej/astum/agi/eagi-sphinx-test.c
team/oej/astum/agi/eagi-test.c
team/oej/astum/apps/app_dial.c
team/oej/astum/apps/app_sms.c
team/oej/astum/apps/app_voicemail.c
team/oej/astum/channels/chan_gtalk.c
team/oej/astum/channels/chan_h323.c
team/oej/astum/channels/chan_iax2.c
team/oej/astum/channels/chan_phone.c
team/oej/astum/channels/chan_sip.c
team/oej/astum/channels/chan_zap.c
team/oej/astum/codecs/codec_zap.c
team/oej/astum/configs/extensions.conf.sample
team/oej/astum/configs/http.conf.sample
team/oej/astum/configs/sip.conf.sample
team/oej/astum/configs/voicemail.conf.sample
team/oej/astum/configure
team/oej/astum/configure.ac
team/oej/astum/contrib/asterisk-ng-doxygen
team/oej/astum/doc/asterisk-conf.txt
team/oej/astum/doc/manager.txt
team/oej/astum/doc/snmp.txt
team/oej/astum/funcs/func_cdr.c
team/oej/astum/include/asterisk/causes.h
team/oej/astum/include/asterisk/channel.h
team/oej/astum/include/asterisk/devicestate.h
team/oej/astum/include/asterisk/doxyref.h
team/oej/astum/include/asterisk/frame.h
team/oej/astum/include/asterisk/pbx.h
team/oej/astum/include/asterisk/rtp.h
team/oej/astum/include/asterisk/threadstorage.h
team/oej/astum/include/asterisk/utils.h
team/oej/astum/main/asterisk.c
team/oej/astum/main/callerid.c
team/oej/astum/main/cdr.c
team/oej/astum/main/channel.c
team/oej/astum/main/cli.c
team/oej/astum/main/devicestate.c
team/oej/astum/main/frame.c
team/oej/astum/main/fskmodem.c
team/oej/astum/main/http.c
team/oej/astum/main/manager.c
team/oej/astum/main/pbx.c
team/oej/astum/main/rtp.c
team/oej/astum/main/tdd.c
team/oej/astum/main/translate.c
team/oej/astum/main/utils.c
team/oej/astum/makeopts.in
team/oej/astum/pbx/pbx_spool.c
team/oej/astum/res/res_features.c
team/oej/astum/res/res_musiconhold.c
team/oej/astum/sounds/Makefile
Propchange: team/oej/astum/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/oej/astum/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/oej/astum/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Dec 5 05:33:34 2006
@@ -1,1 +1,1 @@
-/trunk:1-47876
+/trunk:1-48260
Modified: team/oej/astum/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/astum/.cleancount?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/.cleancount (original)
+++ team/oej/astum/.cleancount Tue Dec 5 05:33:34 2006
@@ -1,1 +1,1 @@
-26
+27
Modified: team/oej/astum/CHANGES
URL: http://svn.digium.com/view/asterisk/team/oej/astum/CHANGES?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/CHANGES (original)
+++ team/oej/astum/CHANGES Tue Dec 5 05:33:34 2006
@@ -61,3 +61,5 @@
* CID matching information is now shown when doing 'dialplan show'.
* app_queue now has a 'loose' option which is almost exactly like 'strict' except it
does not count paused queue members as unavailable.
+ * Added maxfiles option to options section of asterisk.conf which allows you to specify
+ what Asterisk should set as the maximum number of open files when it loads.
Modified: team/oej/astum/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/astum/Makefile?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/Makefile (original)
+++ team/oej/astum/Makefile Tue Dec 5 05:33:34 2006
@@ -37,6 +37,11 @@
export ASTVARLIBDIR
export ASTDATADIR
export ASTLOGDIR
+export ASTLIBDIR
+export ASTMANDIR
+export ASTHEADERDIR
+export ASTBINDIR
+export ASTSBINDIR
export AGI_DIR
export ASTCONFPATH
export NOISY_BUILD
@@ -52,6 +57,7 @@
export PROC
export SOLINK
export STRIP
+export DOWNLOAD
# even though we could use '-include makeopts' here, use a wildcard
# lookup anyway, so that make won't try to build makeopts if it doesn't
@@ -268,14 +274,14 @@
@echo " + Asterisk has successfully been built, and +"
@echo " + can be installed by running: +"
@echo " + +"
- @echo " + make install +"
+ @echo " + $(MAKE) install +"
@echo " +-------------------------------------------+"
_all: cleantest $(SUBDIRS)
makeopts: configure
@echo "****"
- @echo "**** The configure script must be executed before running 'make'."
+ @echo "**** The configure script must be executed before running '$(MAKE)'."
@echo "****"
@exit 1
Modified: team/oej/astum/agi/eagi-sphinx-test.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/agi/eagi-sphinx-test.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/agi/eagi-sphinx-test.c (original)
+++ team/oej/astum/agi/eagi-sphinx-test.c Tue Dec 5 05:33:34 2006
@@ -4,6 +4,15 @@
* This code is released into public domain
* without any warranty of any kind.
*
+ */
+
+/*! \file
+ * Extended AGI test application
+ *
+ * This code is released into public domain
+ * without any warranty of any kind.
+ *
+ * \ingroup agi
*/
#include <stdio.h>
Modified: team/oej/astum/agi/eagi-test.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/agi/eagi-test.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/agi/eagi-test.c (original)
+++ team/oej/astum/agi/eagi-test.c Tue Dec 5 05:33:34 2006
@@ -17,6 +17,15 @@
#include "asterisk/compat.h"
#define AUDIO_FILENO (STDERR_FILENO + 1)
+
+/*! \file
+ * Extended AGI test application
+ *
+ * This code is released into the public domain
+ * with no warranty of any kind
+ *
+ * \ingroup agi
+ */
static int read_environment(void)
{
Modified: team/oej/astum/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_dial.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/apps/app_dial.c (original)
+++ team/oej/astum/apps/app_dial.c Tue Dec 5 05:33:34 2006
@@ -419,7 +419,12 @@
src->name, dialstatus);
}
-/* helper function for wait_for_answer() */
+/*!
+ * helper function for wait_for_answer()
+ *
+ * XXX this code is highly suspicious, as it essentially overwrites
+ * the outgoing channel without properly deleting it.
+ */
static void do_forward(struct dial_localuser *o,
struct cause_args *num, struct ast_flags *peerflags, int single)
{
@@ -504,10 +509,10 @@
char cidname[AST_MAX_EXTENSION];
ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
}
- }
- }
- /* Hangup the original channel now, in case we needed it */
- ast_hangup(c);
+ /* Hangup the original channel now, in case we needed it */
+ ast_hangup(c);
+ }
+ }
}
/* argument used for some functions. */
@@ -1425,6 +1430,7 @@
if (ast_test_flag(outgoing, OPT_MUSICBACK)) {
moh = 1;
ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK], NULL);
+ ast_indicate(chan, AST_CONTROL_PROGRESS);
} else if (ast_test_flag(outgoing, OPT_RINGBACK)) {
ast_indicate(chan, AST_CONTROL_RINGING);
sentringing++;
Modified: team/oej/astum/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_sms.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/apps/app_sms.c (original)
+++ team/oej/astum/apps/app_sms.c Tue Dec 5 05:33:34 2006
@@ -119,59 +119,59 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-#define SMSLEN 160 /* max SMS length */
+#define SMSLEN 160 /*!< max SMS length */
typedef struct sms_s
{
- unsigned char hangup; /* we are done... */
- unsigned char err; /* set for any errors */
- unsigned char smsc:1; /* we are SMSC */
- unsigned char rx:1; /* this is a received message */
- char queue[30]; /* queue name */
- char oa[20]; /* originating address */
- char da[20]; /* destination address */
- time_t scts; /* time stamp, UTC */
- unsigned char pid; /* protocol ID */
- unsigned char dcs; /* data coding scheme */
- short mr; /* message reference - actually a byte, but usde -1 for not set */
- int udl; /* user data length */
- int udhl; /* user data header length */
- unsigned char srr:1; /* Status Report request */
- unsigned char udhi:1; /* User Data Header required, even if length 0 */
- unsigned char rp:1; /* Reply Path */
- unsigned int vp; /* validity period in minutes, 0 for not set */
- unsigned short ud[SMSLEN]; /* user data (message), UCS-2 coded */
- unsigned char udh[SMSLEN]; /* user data header */
- char cli[20]; /* caller ID */
- unsigned char ophase; /* phase (0-79) for 0 and 1 frequencies (1300Hz and 2100Hz) */
- unsigned char ophasep; /* phase (0-79) for 1200 bps */
- unsigned char obyte; /* byte being sent */
- unsigned int opause; /* silent pause before sending (in sample periods) */
- unsigned char obitp; /* bit in byte */
- unsigned char osync; /* sync bits to send */
- unsigned char obytep; /* byte in data */
- unsigned char obyten; /* bytes in data */
- unsigned char omsg[256]; /* data buffer (out) */
- unsigned char imsg[200]; /* data buffer (in) */
+ unsigned char hangup; /*!< we are done... */
+ unsigned char err; /*!< set for any errors */
+ unsigned char smsc:1; /*!< we are SMSC */
+ unsigned char rx:1; /*!< this is a received message */
+ char queue[30]; /*!< queue name */
+ char oa[20]; /*!< originating address */
+ char da[20]; /*!< destination address */
+ time_t scts; /*!< time stamp, UTC */
+ unsigned char pid; /*!< protocol ID */
+ unsigned char dcs; /*!< data coding scheme */
+ short mr; /*!< message reference - actually a byte, but usde -1 for not set */
+ int udl; /*!< user data length */
+ int udhl; /*!< user data header length */
+ unsigned char srr:1; /*!< Status Report request */
+ unsigned char udhi:1; /*!< User Data Header required, even if length 0 */
+ unsigned char rp:1; /*!< Reply Path */
+ unsigned int vp; /*!< validity period in minutes, 0 for not set */
+ unsigned short ud[SMSLEN]; /*!< user data (message), UCS-2 coded */
+ unsigned char udh[SMSLEN]; /*!< user data header */
+ char cli[20]; /*!< caller ID */
+ unsigned char ophase; /*!< phase (0-79) for 0 and 1 frequencies (1300Hz and 2100Hz) */
+ unsigned char ophasep; /*!< phase (0-79) for 1200 bps */
+ unsigned char obyte; /*!< byte being sent */
+ unsigned int opause; /*!< silent pause before sending (in sample periods) */
+ unsigned char obitp; /*!< bit in byte */
+ unsigned char osync; /*!< sync bits to send */
+ unsigned char obytep; /*!< byte in data */
+ unsigned char obyten; /*!< bytes in data */
+ unsigned char omsg[256]; /*!< data buffer (out) */
+ unsigned char imsg[200]; /*!< data buffer (in) */
signed long long ims0,
imc0,
ims1,
- imc1; /* magnitude averages sin/cos 0/1 */
+ imc1; /*!< magnitude averages sin/cos 0/1 */
unsigned int idle;
- unsigned short imag; /* signal level */
+ unsigned short imag; /*!< signal level */
unsigned char ips0,
ips1,
ipc0,
- ipc1; /* phase sin/cos 0/1 */
- unsigned char ibitl; /* last bit */
- unsigned char ibitc; /* bit run length count */
- unsigned char iphasep; /* bit phase (0-79) for 1200 bps */
- unsigned char ibitn; /* bit number in byte being received */
- unsigned char ibytev; /* byte value being received */
- unsigned char ibytep; /* byte pointer in messafe */
- unsigned char ibytec; /* byte checksum for message */
- unsigned char ierr; /* error flag */
- unsigned char ibith; /* history of last bits */
+ ipc1; /*!< phase sin/cos 0/1 */
+ unsigned char ibitl; /*!< last bit */
+ unsigned char ibitc; /*!< bit run length count */
+ unsigned char iphasep; /*!< bit phase (0-79) for 1200 bps */
+ unsigned char ibitn; /*!< bit number in byte being received */
+ unsigned char ibytev; /*!< byte value being received */
+ unsigned char ibytep; /*!< byte pointer in messafe */
+ unsigned char ibytec; /*!< byte checksum for message */
+ unsigned char ierr; /*!< error flag */
+ unsigned char ibith; /*!< history of last bits */
unsigned char ibitt; /* total of 1's in last 3 bites */
/* more to go here */
} sms_t;
Modified: team/oej/astum/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_voicemail.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/apps/app_voicemail.c (original)
+++ team/oej/astum/apps/app_voicemail.c Tue Dec 5 05:33:34 2006
@@ -142,6 +142,7 @@
/* Don't modify these here; set your umask at runtime instead */
#define VOICEMAIL_DIR_MODE 0777
#define VOICEMAIL_FILE_MODE 0666
+#define CHUNKSIZE 65536
#define VOICEMAIL_CONFIG "voicemail.conf"
#define ASTERISK_USERNAME "asterisk"
@@ -1099,6 +1100,7 @@
goto yuck;
}
if (!strcasecmp(coltitle, "recording")) {
+ off_t offset;
res = SQLGetData(stmt, x + 1, SQL_BINARY, NULL, 0, &colsize2);
fdlen = colsize2;
if (fd > -1) {
@@ -1109,24 +1111,27 @@
fd = -1;
continue;
}
- if (fd > -1) {
- if ((fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == -1) {
+ /* Read out in small chunks */
+ for (offset = 0; offset < colsize2; offset += CHUNKSIZE) {
+ /* +1 because SQLGetData likes null-terminating binary data */
+ if ((fdm = mmap(NULL, CHUNKSIZE + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
goto yuck;
+ } else {
+ res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE + 1, NULL);
+ munmap(fdm, 0);
+ if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+ ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
+ unlink(full_fn);
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ ast_odbc_release_obj(obj);
+ goto yuck;
+ }
}
}
- }
- if (fdm) {
- memset(fdm, 0, fdlen);
- res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, fdlen, &colsize2);
- if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
- ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
- SQLFreeHandle (SQL_HANDLE_STMT, stmt);
- ast_odbc_release_obj(obj);
- goto yuck;
- }
+ truncate(full_fn, fdlen);
}
} else {
res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), NULL);
@@ -1147,8 +1152,6 @@
yuck:
if (f)
fclose(f);
- if (fdm)
- munmap(fdm, fdlen);
if (fd > -1)
close(fd);
return x - 1;
@@ -4673,7 +4676,7 @@
if(option_debug > 2)
ast_log(LOG_DEBUG,"Before init_mailstream, user is %s\n",vmu->imapuser);
ret = init_mailstream(vms, box);
- if (ret != 0) {
+ if (ret != 0 || !vms->mailstream) {
ast_log (LOG_ERROR,"Could not initialize mailstream\n");
return -1;
}
@@ -6970,22 +6973,13 @@
}
}
AST_LIST_TRAVERSE(&users, vmu, list) {
- char dirname[256];
- DIR *vmdir;
- struct dirent *vment;
- int vmcount = 0;
- char count[12];
+ int newmsgs = 0, oldmsgs = 0;
+ char count[12], tmp[256] = "";
if ((argc == 3) || ((argc == 5) && !strcmp(argv[4],vmu->context))) {
- make_dir(dirname, 255, vmu->context, vmu->mailbox, "INBOX");
- if ((vmdir = opendir(dirname))) {
- /* No matter what the format of VM, there will always be a .txt file for each message. */
- while ((vment = readdir(vmdir)))
- if (strlen(vment->d_name) > 7 && !strncmp(vment->d_name + 7,".txt",4))
- vmcount++;
- closedir(vmdir);
- }
- snprintf(count,sizeof(count),"%d",vmcount);
+ snprintf(tmp, sizeof(tmp), "%s@%s", vmu->mailbox, ast_strlen_zero(vmu->context) ? "default" : vmu->context);
+ inboxcount(tmp, &newmsgs, &oldmsgs);
+ snprintf(count,sizeof(count),"%d",newmsgs);
ast_cli(fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count);
}
}
@@ -8012,6 +8006,8 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
ast_stream_and_wait(chan, "vm-msgsaved", "");
+ STORE(recordfile, vmu->mailbox, vmu->context, -1, chan, vmu, fmt, duration, vms);
+ DISPOSE(recordfile, -1);
cmd = 't';
return res;
}
@@ -8481,15 +8477,16 @@
if(option_debug > 3)
ast_log(LOG_DEBUG, "Entering callback mm_login\n");
- ast_copy_string(user, mb->user,sizeof(user));
+
+ ast_copy_string(user, mb->user, MAILTMPLEN);
/* We should only do this when necessary */
if (!ast_strlen_zero(authpassword)) {
- ast_copy_string(pwd, authpassword, sizeof(pwd));
+ ast_copy_string(pwd, authpassword, MAILTMPLEN);
} else {
AST_LIST_TRAVERSE(&users, vmu, list) {
if(!strcasecmp(mb->user, vmu->imapuser)) {
- ast_copy_string(pwd, vmu->imappassword, sizeof(pwd));
+ ast_copy_string(pwd, vmu->imappassword, MAILTMPLEN);
break;
}
}
Modified: team/oej/astum/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_gtalk.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/channels/chan_gtalk.c (original)
+++ team/oej/astum/channels/chan_gtalk.c Tue Dec 5 05:33:34 2006
@@ -163,7 +163,6 @@
};
static const char desc[] = "Gtalk Channel";
-static const char type[] = "Gtalk";
static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
@@ -192,7 +191,7 @@
/*! \brief PBX interface structure for channel registration */
static const struct ast_channel_tech gtalk_tech = {
- .type = type,
+ .type = "Gtalk",
.description = "Gtalk Channel Driver",
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
.requester = gtalk_request,
@@ -220,7 +219,7 @@
/*! \brief RTP driver interface */
static struct ast_rtp_protocol gtalk_rtp = {
- type: "gtalk",
+ type: "Gtalk",
get_rtp_info: gtalk_get_rtp_peer,
set_rtp_peer: gtalk_set_rtp_peer,
get_codec: gtalk_get_codec,
@@ -921,10 +920,12 @@
fmt = ast_best_codec(tmp->nativeformats);
if (i->rtp) {
+ ast_rtp_setstun(i->rtp, 1);
tmp->fds[0] = ast_rtp_fd(i->rtp);
tmp->fds[1] = ast_rtcp_fd(i->rtp);
}
if (i->vrtp) {
+ ast_rtp_setstun(i->rtp, 1);
tmp->fds[2] = ast_rtp_fd(i->vrtp);
tmp->fds[3] = ast_rtcp_fd(i->vrtp);
}
@@ -1790,7 +1791,7 @@
/* Make sure we can register our channel type */
if (ast_channel_register(>alk_tech)) {
- ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
+ ast_log(LOG_ERROR, "Unable to register channel class %s\n", gtalk_tech.type);
return -1;
}
return 0;
Modified: team/oej/astum/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_h323.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/channels/chan_h323.c (original)
+++ team/oej/astum/channels/chan_h323.c Tue Dec 5 05:33:34 2006
@@ -2754,21 +2754,6 @@
h323_tokens_show, "Show all active call tokens",
show_tokens_usage };
-static struct ast_cli_entry cli_h323_debug_deprecated = {
- { "h.323", "debug", NULL },
- h323_do_debug, "Enable H.323 debug",
- debug_usage };
-
-static struct ast_cli_entry cli_h323_trace_deprecated = {
- { "h.323", "trace", NULL },
- h323_do_trace, "Enable H.323 Stack Tracing",
- trace_usage };
-
-static struct ast_cli_entry cli_h323_gk_cycle_deprecated = {
- { "h323", "cycle", "gk", NULL },
- h323_gk_cycle, "Manually re-register with the Gatekeper",
- show_cycle_usage };
-
static struct ast_cli_entry cli_h323[] = {
{ { "h323", "set", "trace", NULL },
h323_do_trace, "Enable H.323 Stack Tracing",
Modified: team/oej/astum/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_iax2.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/channels/chan_iax2.c (original)
+++ team/oej/astum/channels/chan_iax2.c Tue Dec 5 05:33:34 2006
@@ -1195,6 +1195,20 @@
return res;
}
+/*!
+ * \todo XXX Note that this function contains a very expensive operation that
+ * happens for *every* incoming media frame. It iterates through every
+ * possible call number, locking and unlocking each one, to try to match the
+ * incoming frame to an active call. Call numbers can be up to 2^15, 32768.
+ * So, for an call with a local call number of 20000, every incoming audio
+ * frame would require 20000 mutex lock and unlock operations. Ouch.
+ *
+ * It's a shame that IAX2 media frames carry the source call number instead of
+ * the destination call number. If they did, this lookup wouldn't be needed.
+ * However, it's too late to change that now. Instead, we need to come up with
+ * a better way of indexing active calls so that these frequent lookups are not
+ * so expensive.
+ */
static int find_callno(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int new, int lockpeer, int sockfd)
{
int res = 0;
@@ -6974,7 +6988,7 @@
if (!strcmp(ies.called_number, ast_parking_ext())) {
if (iax_park(ast_bridged_channel(iaxs[fr->callno]->owner), iaxs[fr->callno]->owner)) {
ast_log(LOG_WARNING, "Failed to park call on '%s'\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name);
- } else {
+ } else if (ast_bridged_channel(iaxs[fr->callno]->owner)) {
if (option_debug)
ast_log(LOG_DEBUG, "Parked call on '%s'\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name);
}
Modified: team/oej/astum/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_phone.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/channels/chan_phone.c (original)
+++ team/oej/astum/channels/chan_phone.c Tue Dec 5 05:33:34 2006
@@ -48,11 +48,6 @@
#include <linux/telephony.h>
/* Still use some IXJ specific stuff */
#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
-# include <linux/compiler.h>
-#endif
-#endif
#include <linux/ixjuser.h>
#include "asterisk/lock.h"
Modified: team/oej/astum/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_sip.c?view=diff&rev=48261&r1=48260&r2=48261
==============================================================================
--- team/oej/astum/channels/chan_sip.c (original)
+++ team/oej/astum/channels/chan_sip.c Tue Dec 5 05:33:34 2006
@@ -242,15 +242,15 @@
\note this is for the INVITE that sets up the dialog
*/
enum invitestates {
- INV_NONE = 0, /*!< No state at all, maybe not an INVITE dialog */
- INV_CALLING, /*!< Invite sent, no answer */
- INV_PROCEEDING, /*!< We got 1xx message */
- INV_EARLY_MEDIA, /*!< We got 18x message with to-tag back */
- INV_COMPLETED, /*!< Got final response with error. Wait for ACK, then CONFIRMED */
- INV_CONFIRMED, /*!< Confirmed response - we've got an ack (Incoming calls only) */
- INV_TERMINATED, /*!< Transaction done - either successful (AST_STATE_UP) or failed, but done
- The only way out of this is a BYE from one side */
- INV_CANCELLED /*!< Transaction cancelled by client or server in non-terminated state */
+ INV_NONE = 0, /*!< No state at all, maybe not an INVITE dialog */
+ INV_CALLING = 1, /*!< Invite sent, no answer */
+ INV_PROCEEDING = 2, /*!< We got/sent 1xx message */
+ INV_EARLY_MEDIA = 3, /*!< We got 18x message with to-tag back */
+ INV_COMPLETED = 4, /*!< Got final response with error. Wait for ACK, then CONFIRMED */
+ INV_CONFIRMED = 5, /*!< Confirmed response - we've got an ack (Incoming calls only) */
+ INV_TERMINATED = 6, /*!< Transaction done - either successful (AST_STATE_UP) or failed, but done
+ The only way out of this is a BYE from one side */
+ INV_CANCELLED = 7, /*!< Transaction cancelled by client or server in non-terminated state */
};
/* Do _NOT_ make any changes to this enum, or the array following it;
@@ -558,7 +558,7 @@
static int allow_external_domains; /*!< Accept calls to external SIP domains? */
static int global_callevents; /*!< Whether we send manager events or not */
static int global_t1min; /*!< T1 roundtrip time minimum */
-static int global_autoframing; /*!< ?????????? */
+static int global_autoframing; /*!< Turn autoframing on or off. */
static enum transfermodes global_allowtransfer; /*!< SIP Refer restriction scheme */
/*! \brief Codecs that we support by default: */
@@ -961,8 +961,6 @@
time_t lastrtprx; /*!< Last RTP received */
time_t lastrtptx; /*!< Last RTP sent */
int rtptimeout; /*!< RTP timeout time */
- int rtpholdtimeout; /*!< RTP timeout when on hold */
- int rtpkeepalive; /*!< Send RTP packets for keepalive */
struct sockaddr_in recv; /*!< Received as */
struct in_addr ourip; /*!< Our IP */
struct ast_channel *owner; /*!< Who owns us (if we have an owner) */
@@ -1661,6 +1659,14 @@
ast_verbose("Initreq: %d headers, %d lines\n", p->initreq.headers, p->initreq.lines);
}
+/*! \brief Encapsulate setting of SIP_ALREADYGONE to be able to trace it with debugging */
+static void sip_alreadygone(struct sip_pvt *dialog)
+{
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG, "Setting SIP_ALREADYGONE on dialog %s\n", dialog->callid);
+ ast_set_flag(&dialog->flags[0], SIP_ALREADYGONE);
+}
+
/*! \brief returns true if 'name' (with optional trailing whitespace)
* matches the sip method 'id'.
@@ -1939,7 +1945,7 @@
sip_pvt_lock(pkt->owner);
}
if (pkt->owner->owner) {
- ast_set_flag(&pkt->owner->flags[0], SIP_ALREADYGONE);
+ sip_alreadygone(pkt->owner);
ast_log(LOG_WARNING, "Hanging up call %s - no reply to our critical packet.\n", pkt->owner->callid);
ast_queue_hangup(pkt->owner->owner);
ast_channel_unlock(pkt->owner->owner);
@@ -2726,17 +2732,21 @@
if (dialog->rtp) {
ast_rtp_setdtmf(dialog->rtp, ast_test_flag(&dialog->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
ast_rtp_setdtmfcompensate(dialog->rtp, ast_test_flag(&dialog->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
+ ast_rtp_set_rtptimeout(dialog->rtp, peer->rtptimeout);
+ ast_rtp_set_rtpholdtimeout(dialog->rtp, peer->rtpholdtimeout);
+ ast_rtp_set_rtpkeepalive(dialog->rtp, peer->rtpkeepalive);
+ /* Set Frame packetization */
+ ast_rtp_codec_setpref(dialog->rtp, &dialog->prefs);
+ dialog->autoframing = peer->autoframing;
}
if (dialog->vrtp) {
ast_rtp_setdtmf(dialog->vrtp, 0);
ast_rtp_setdtmfcompensate(dialog->vrtp, 0);
- }
-
- /* Set Frame packetization */
- if (dialog->rtp) {
- ast_rtp_codec_setpref(dialog->rtp, &dialog->prefs);
- dialog->autoframing = peer->autoframing;
- }
+ ast_rtp_set_rtptimeout(dialog->vrtp, peer->rtptimeout);
+ ast_rtp_set_rtpholdtimeout(dialog->vrtp, peer->rtpholdtimeout);
+ ast_rtp_set_rtpkeepalive(dialog->vrtp, peer->rtpkeepalive);
+ }
+
ast_string_field_set(dialog, peername, peer->username);
ast_string_field_set(dialog, authname, peer->username);
ast_string_field_set(dialog, username, peer->username);
@@ -2774,8 +2784,6 @@
dialog->noncodeccapability &= ~AST_RTP_DTMF;
ast_string_field_set(dialog, context, peer->context);
dialog->rtptimeout = peer->rtptimeout;
- dialog->rtpholdtimeout = peer->rtpholdtimeout;
- dialog->rtpkeepalive = peer->rtpkeepalive;
if (peer->call_limit)
ast_set_flag(&dialog->flags[0], SIP_CALL_LIMIT);
dialog->maxcallbitrate = peer->maxcallbitrate;
@@ -3099,9 +3107,9 @@
/* Check the list of users only for incoming calls */
if (global_limitonpeers == FALSE && !outgoing && (u = find_user(name, 1))) {
- inuse = &u->inUse;
- call_limit = &u->call_limit;
- inringing = NULL;
+ inuse = &u->inUse;
+ call_limit = &u->call_limit;
+ inringing = NULL;
} else if ( (p = find_peer(ast_strlen_zero(fup->peername) ? name : fup->peername, NULL, 1) ) ) { /* Try to find peer */
inuse = &p->inUse;
call_limit = &p->call_limit;
@@ -3405,7 +3413,7 @@
return 0;
}
/* If the call is not UP, we need to send CANCEL instead of BYE */
- if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
+ if (p->invitestate < INV_COMPLETED) {
needcancel = TRUE;
if (option_debug > 3)
ast_log(LOG_DEBUG, "Hanging up channel in state %s (not UP)\n", ast_state2str(ast->_state));
@@ -3426,7 +3434,7 @@
*/
if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE))
needdestroy = 1; /* Set destroy flag at end of this function */
- else
+ else if (p->invitestate != INV_CALLING)
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
/* Start the process if it's not already started */
@@ -3488,6 +3496,7 @@
but we can't send one while we have "INVITE" outstanding. */
ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
+ sip_cancel_destroy(p);
}
}
}
@@ -3605,15 +3614,12 @@
case AST_FRAME_MODEM:
if (p) {
sip_pvt_lock(p);
- if (p->udptl) {
- if ((ast->_state != AST_STATE_UP) &&
- !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
- !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
- transmit_response_with_t38_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE);
- ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
- }
+ /* UDPTL requires two-way communication, so early media is not needed here.
+ we simply forget the frames if we get modem frames before the bridge is up.
+ Fax will re-transmit.
+ */
+ if (p->udptl && ast->_state != AST_STATE_UP)
res = ast_udptl_write(p->udptl, frame);
- }
sip_pvt_unlock(p);
}
break;
@@ -3740,6 +3746,7 @@
switch(condition) {
case AST_CONTROL_RINGING:
if (ast->_state == AST_STATE_RING) {
+ p->invitestate = INV_EARLY_MEDIA;
if (!ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) ||
(ast_test_flag(&p->flags[0], SIP_PROG_INBAND) == SIP_PROG_INBAND_NEVER)) {
/* Send 180 ringing if out-of-band seems reasonable */
@@ -3756,7 +3763,8 @@
case AST_CONTROL_BUSY:
if (ast->_state != AST_STATE_UP) {
transmit_response(p, "486 Busy Here", &p->initreq);
- ast_set_flag(&p->flags[0], SIP_ALREADYGONE);
+ p->invitestate = INV_TERMINATED;
+ sip_alreadygone(p);
ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
break;
}
@@ -3765,7 +3773,8 @@
case AST_CONTROL_CONGESTION:
if (ast->_state != AST_STATE_UP) {
transmit_response(p, "503 Service Unavailable", &p->initreq);
- ast_set_flag(&p->flags[0], SIP_ALREADYGONE);
+ p->invitestate = INV_TERMINATED;
+ sip_alreadygone(p);
ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
break;
}
@@ -3776,6 +3785,7 @@
!ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
!ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
transmit_response(p, "100 Trying", &p->initreq);
+ p->invitestate = INV_PROCEEDING;
break;
}
res = -1;
@@ -3784,6 +3794,7 @@
if ((ast->_state != AST_STATE_UP) &&
!ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
!ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
+ p->invitestate = INV_EARLY_MEDIA;
transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE);
ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
break;
@@ -4302,16 +4313,19 @@
ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
ast_rtp_settos(p->rtp, global_tos_audio);
+ ast_rtp_set_rtptimeout(p->rtp, global_rtptimeout);
+ ast_rtp_set_rtpholdtimeout(p->rtp, global_rtpholdtimeout);
+ ast_rtp_set_rtpkeepalive(p->rtp, global_rtpkeepalive);
if (p->vrtp) {
ast_rtp_settos(p->vrtp, global_tos_video);
ast_rtp_setdtmf(p->vrtp, 0);
ast_rtp_setdtmfcompensate(p->vrtp, 0);
+ ast_rtp_set_rtptimeout(p->vrtp, global_rtptimeout);
+ ast_rtp_set_rtpholdtimeout(p->vrtp, global_rtpholdtimeout);
+ ast_rtp_set_rtpkeepalive(p->vrtp, global_rtpkeepalive);
}
if (p->udptl)
ast_udptl_settos(p->udptl, global_tos_audio);
- p->rtptimeout = global_rtptimeout;
- p->rtpholdtimeout = global_rtpholdtimeout;
- p->rtpkeepalive = global_rtpkeepalive;
p->maxcallbitrate = default_maxcallbitrate;
}
@@ -7347,7 +7361,8 @@
ast_string_field_set(p, domain, r->domain);
ast_string_field_set(p, opaque, r->opaque);
ast_string_field_set(p, qop, r->qop);
- p->noncecount = r->noncecount++;
+ r->noncecount++;
+ p->noncecount = r->noncecount;
memset(digest,0,sizeof(digest));
if(!build_reply_digest(p, sipmethod, digest, sizeof(digest)))
@@ -10429,6 +10444,7 @@
ast_cli(fd, " T1 minimum: %d\n", global_t1min);
ast_cli(fd, " Relax DTMF: %s\n", global_relaxdtmf ? "Yes" : "No");
ast_cli(fd, " Compact SIP headers: %s\n", compactheaders ? "Yes" : "No");
+ ast_cli(fd, " RTP Keepalive: %d %s\n", global_rtpkeepalive, global_rtpkeepalive ? "" : "(Disabled)" );
ast_cli(fd, " RTP Timeout: %d %s\n", global_rtptimeout, global_rtptimeout ? "" : "(Disabled)" );
ast_cli(fd, " RTP Hold Timeout: %d %s\n", global_rtpholdtimeout, global_rtpholdtimeout ? "" : "(Disabled)");
ast_cli(fd, " MWI NOTIFY mime type: %s\n", default_notifymime);
@@ -11724,7 +11740,7 @@
/* RFC3261 says we must treat every 1xx response (but not 100)
that we don't recognize as if it was 183.
*/
- if (resp > 100 && resp < 200 && resp != 180 && resp != 183)
+ if (resp > 100 && resp < 200 && resp!=101 && resp != 180 && resp != 183)
resp = 183;
/* Any response between 100 and 199 is PROCEEDING */
@@ -11738,6 +11754,7 @@
switch (resp) {
case 100: /* Trying */
+ case 101: /* Dialog establishment */
if (!ast_test_flag(req, SIP_PKT_IGNORE))
sip_cancel_destroy(p);
check_pendings(p);
@@ -11824,6 +11841,9 @@
if (bridgepvt->udptl) {
if (p->t38.state == T38_PEER_REINVITE) {
sip_handle_t38_reinvite(bridgepeer, p, 0);
+ ast_rtp_set_rtptimers_onhold(p->rtp);
+ if (p->vrtp)
+ ast_rtp_set_rtptimers_onhold(p->vrtp); /* Turn off RTP timers while we send fax */
} else if (p->t38.state == T38_DISABLED && bridgepeer && (bridgepvt->t38.state == T38_ENABLED)) {
ast_log(LOG_WARNING, "RTP re-inivte after T38 session not handled yet !\n");
/* Insted of this we should somehow re-invite the other side of the bridge to RTP */
@@ -11890,7 +11910,7 @@
if (p->authtries == MAX_AUTHTRIES || do_proxy_auth(p, req, resp, SIP_INVITE, 1)) {
ast_log(LOG_NOTICE, "Failed to authenticate on INVITE to '%s'\n", get_header(&p->initreq, "From"));
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
- ast_set_flag(&p->flags[0], SIP_ALREADYGONE);
+ sip_alreadygone(p);
if (p->owner)
ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
}
@@ -11904,20 +11924,23 @@
if (!ast_test_flag(req, SIP_PKT_IGNORE) && p->owner)
ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
- ast_set_flag(&p->flags[0], SIP_ALREADYGONE);
+ sip_alreadygone(p);
break;
case 404: /* Not found */
transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
if (p->owner && !ast_test_flag(req, SIP_PKT_IGNORE))
ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
- ast_set_flag(&p->flags[0], SIP_ALREADYGONE);
+ sip_alreadygone(p);
break;
case 481: /* Call leg does not exist */
- /* Could be REFER or INVITE */
+ /* Could be REFER caused INVITE with replaces */
ast_log(LOG_WARNING, "Re-invite to non-existing call leg on other UA. SIP dialog '%s'. Giving up.\n", p->callid);
transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
+ if (p->owner)
+ ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
+ sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
break;
case 491: /* Pending */
@@ -11970,7 +11993,16 @@
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
}
break;
-
+ case 481: /* Call leg does not exist */
+
+ /* A transfer with Replaces did not work */
+ /* OEJ: We should Set flag, cancel the REFER, go back
+ to original call - but right now we can't */
+ ast_log(LOG_WARNING, "Remote host can't match REFER request to call '%s'. Giving up.\n", p->callid);
+ if (p->owner)
+ ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
+ ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
+ break;
case 500: /* Server error */
case 501: /* Method not implemented */
@@ -12232,6 +12264,7 @@
} else if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
switch(resp) {
case 100: /* 100 Trying */
+ case 101: /* 101 Dialog establishment */
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
break;
@@ -12327,20 +12360,9 @@
break;
case 481: /* Call leg does not exist */
if (sipmethod == SIP_INVITE) {
- /* First we ACK */
- transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
- ast_log(LOG_WARNING, "INVITE with REPLACEs failed to '%s'\n", get_header(&p->initreq, "From"));
- if (owner)
- ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
- sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
+ handle_response_invite(p, resp, rest, req, seqno);
} else if (sipmethod == SIP_REFER) {
- /* A transfer with Replaces did not work */
- /* OEJ: We should Set flag, cancel the REFER, go back
- to original call - but right now we can't */
- ast_log(LOG_WARNING, "Remote host can't match request %s to call '%s'. Giving up.\n", sip_methods[sipmethod].text, p->callid);
- if (owner)
- ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
- ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
+ handle_response_refer(p, resp, rest, req, seqno);
} else if (sipmethod == SIP_BYE) {
/* The other side has no transaction to bye,
just assume it's all right then */
@@ -12382,7 +12404,6 @@
/* Fatal response */
if ((option_verbose > 2) && (resp != 487))
[... 4049 lines stripped ...]
More information about the asterisk-commits
mailing list