[asterisk-commits] branch oej/siptransfer r17987 - in
/team/oej/siptransfer: ./ apps/ channels/ ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Apr 6 12:21:37 MST 2006
Author: oej
Date: Thu Apr 6 14:21:00 2006
New Revision: 17987
URL: http://svn.digium.com/view/asterisk?rev=17987&view=rev
Log:
- Update to trunk
- Expand README with development notes
Added:
team/oej/siptransfer/res/res_config_pgsql.c
- copied unchanged from r17740, trunk/res/res_config_pgsql.c
Removed:
team/oej/siptransfer/formats/format_au.c
team/oej/siptransfer/formats/format_pcm_alaw.c
Modified:
team/oej/siptransfer/ (props changed)
team/oej/siptransfer/.cleancount
team/oej/siptransfer/CREDITS
team/oej/siptransfer/Makefile
team/oej/siptransfer/README.siptransfer
team/oej/siptransfer/app.c
team/oej/siptransfer/apps/app_alarmreceiver.c
team/oej/siptransfer/apps/app_channelredirect.c
team/oej/siptransfer/apps/app_exec.c
team/oej/siptransfer/apps/app_page.c
team/oej/siptransfer/apps/app_queue.c
team/oej/siptransfer/apps/app_senddtmf.c
team/oej/siptransfer/apps/app_voicemail.c
team/oej/siptransfer/channel.c
team/oej/siptransfer/channels/chan_agent.c
team/oej/siptransfer/channels/chan_h323.c
team/oej/siptransfer/channels/chan_iax2.c
team/oej/siptransfer/channels/chan_local.c
team/oej/siptransfer/channels/chan_mgcp.c
team/oej/siptransfer/channels/chan_misdn.c
team/oej/siptransfer/channels/chan_sip.c
team/oej/siptransfer/channels/chan_zap.c
team/oej/siptransfer/channels/h323/ast_h323.cpp
team/oej/siptransfer/channels/misdn/Makefile
team/oej/siptransfer/channels/misdn/isdn_lib.c
team/oej/siptransfer/channels/misdn/isdn_lib.h
team/oej/siptransfer/channels/misdn/isdn_msg_parser.c
team/oej/siptransfer/channels/misdn/portinfo.c
team/oej/siptransfer/configs/features.conf.sample
team/oej/siptransfer/configs/sip.conf.sample
team/oej/siptransfer/devicestate.c
team/oej/siptransfer/dns.c
team/oej/siptransfer/doc/CODING-GUIDELINES
team/oej/siptransfer/doc/manager.txt
team/oej/siptransfer/enum.c
team/oej/siptransfer/file.c
team/oej/siptransfer/formats/Makefile
team/oej/siptransfer/formats/format_g723.c
team/oej/siptransfer/formats/format_g726.c
team/oej/siptransfer/formats/format_g729.c
team/oej/siptransfer/formats/format_gsm.c
team/oej/siptransfer/formats/format_h263.c
team/oej/siptransfer/formats/format_h264.c
team/oej/siptransfer/formats/format_ilbc.c
team/oej/siptransfer/formats/format_ogg_vorbis.c
team/oej/siptransfer/formats/format_pcm.c
team/oej/siptransfer/formats/format_sln.c
team/oej/siptransfer/formats/format_vox.c
team/oej/siptransfer/formats/format_wav.c
team/oej/siptransfer/formats/format_wav_gsm.c
team/oej/siptransfer/http.c
team/oej/siptransfer/include/asterisk/channel.h
team/oej/siptransfer/include/asterisk/doxyref.h
team/oej/siptransfer/include/asterisk/file.h
team/oej/siptransfer/include/asterisk/http.h
team/oej/siptransfer/include/asterisk/linkedlists.h
team/oej/siptransfer/include/asterisk/pbx.h
team/oej/siptransfer/manager.c
team/oej/siptransfer/pbx.c
team/oej/siptransfer/pbx/pbx_dundi.c
team/oej/siptransfer/res/Makefile
team/oej/siptransfer/res/res_musiconhold.c
team/oej/siptransfer/rtp.c
team/oej/siptransfer/udptl.c
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Apr 6 14:21:00 2006
@@ -1,1 +1,1 @@
-/trunk:1-17102
+/trunk:1-17742
Modified: team/oej/siptransfer/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/.cleancount?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/.cleancount (original)
+++ team/oej/siptransfer/.cleancount Thu Apr 6 14:21:00 2006
@@ -1,1 +1,1 @@
-12
+13
Modified: team/oej/siptransfer/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/CREDITS?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/CREDITS (original)
+++ team/oej/siptransfer/CREDITS Thu Apr 6 14:21:00 2006
@@ -12,6 +12,8 @@
Telesthetic - for supporting SIP development
Christos Ricudis - for substantial code contributions
+
+nic.at - ENUM support in Asterisk
Paul Bagyenda, Digital Solutions - for initial Voicetronix driver development
Modified: team/oej/siptransfer/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/Makefile?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/Makefile (original)
+++ team/oej/siptransfer/Makefile Thu Apr 6 14:21:00 2006
@@ -28,6 +28,7 @@
ifeq ($(CROSS_COMPILE),)
OSARCH=$(shell uname -s)
OSREV=$(shell uname -r)
+ MARCH=$(shell uname -m)
else
OSARCH=$(CROSS_ARCH)
OSREV=$(CROSS_REV)
@@ -397,8 +398,11 @@
AUDIO_LIBS=-framework CoreAudio
ASTLINK=-Wl,-dynamic
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
- OBJS+=poll.o
- ASTCFLAGS+=-DPOLLCOMPAT
+ # Mac on Intel CoreDuo does not need poll compatibility layer
+ ifneq ($(MARCH),i386)
+ OBJS+=poll.o
+ ASTCFLAGS+=-DPOLLCOMPAT
+ endif
else
#These are used for all but Darwin
ASTLINK=-Wl,-E
Modified: team/oej/siptransfer/README.siptransfer
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/README.siptransfer?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/README.siptransfer (original)
+++ team/oej/siptransfer/README.siptransfer Thu Apr 6 14:21:00 2006
@@ -25,3 +25,99 @@
/Olle E. Johansson
oej at edvina.net
+
+
+----------------DEVELOPMENT NOTES-------------------
+
+ * -- Transfer changes:
+ * Parse SIP extensions supported by opposite side -done
+ * Announce that we support NOTIFY and replaces -done
+ * Use ${TRANSFER_CONTEXT} on transfers -done
+ * Removed 484 on REFER, a REFER is to a complete URI -done
+ * Actually send replaces on invite if needed -done
+ * Add SIPTRANSFER variable to the new INVITE -done
+ * Send SIPDOMAIN to dialplan - will we find extension then? -done
+ * Determine how to handle replace on refer...
+ * - If the refer is to this server, replace (masq/rebridge) - done
+ * - If the refer is to another server -?
+ * If it is SIP, send INVITE with replace
+ * If it is not SIP, rebridge
+ * Make sure we have BRIDGEPEER -done
+ * Accept required: replaces -done
+ * Fix SIP text message for call parking. -done
+ * Fix remote one-legged transfers (voicemail etc) -done
+ * Fix remote early transfers (ringing/ring state) -done
+ * -- Todo
+ * Clean up debug messages
+ * Go over changes in channel.c again
+ * Fix local one-legged transfers (ringing/ring state) -done
+ * Handle incoming 200 OK on NOTIFY correctly -not done
+ * Transfer is done when we get 200 OK
+ * We should hangup only then
+ * Send replaces only if supported -not done
+ * Parse incoming NOTIFY -not done
+ * Send NOTIFY until new call is up -no solution yet, faking
+ * Complete transfer (hangup call) only if we get 200 OK
+ * -not done
+ * Go back to call parking (transfer to 700 and find the problem)
+ * -not done
+ * Fix CANCEL on proxy auth required -not done
+ *
+ * -- Tests
+ * * Set up OUTBOUND call
+ *
+ * Let the other end send a REFER to transfer to local extension
+ * Let the other end send a REFER to transfer to remote SIP uri
+ * Let the other end send a REFER to a not existing extension
+ * Let the other end send a REFER to a busy extension
+ *
+ * * Receive INBOUND CALL
+ * Let the other end send a REFER to transfer to local extension
+ * Handle the transfer
+ * Let the other end send a REFER to a non existing extension
+ * Let the other end send a REFER to a busy extension
+ *
+ * exten => transfertest,1,answer
+ * exten => transfertest,2,wait(2)
+ * exten => transfertest,3,playback(beep)
+ * exten => transfertest,4,transfer(SIP/localextension)
+ * exten => transfertest,4,transfer(SIP/exten at remotehost)
+ *
+ * * Receive INBOUND CALL
+ * Send REFER to local extension
+ * Send REFER to remote SIP uri
+ *
+ * Test with devices
+ * -- Cisco -- terry
+ * -- Snom 360 -- olle
+ * -- Sipura -- olle
+ * -- Xten Eye-Beam -- olle
+ * -- Polycom -- olle/terry
+ * -- GSX2000 -- olle
+ *
+ * Test with another Asterisk 1.0
+ * Test with another Asterisk with this patch -- olle/terry
+ *
+ * - Is the call coming back when transfer fails?
+ * Blind transfer: yes
+ * Attended transfer: no
+ * -- not yet, not yet
+ * With Async GOTO we are messed up so we can't continue
+ * to use the channel
+ * - We need a new kind of bridge in Asterisk to do this
+ * properly
+ * -------------------------------------------------------
+ * Authentication/security
+ *
+ * With the allowtransfer setting (per peer or general)
+ * you set who that we accept a incoming REFER from
+ *
+ * Allowtransfer setting Strict Open Closed
+ * - Inbound call from authenticated user yes yes no
+ * - Inbound call from known authenticated peer yes yes no
+ * - Inbound call from known peer no yes no
+ * - Inbound call from unknown no yes no
+ * - Outbound call to known peer yes yes no
+ * - Outbound call to unknown no yes no
+ *
+ */
Modified: team/oej/siptransfer/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/app.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/app.c (original)
+++ team/oej/siptransfer/app.c Thu Apr 6 14:21:00 2006
@@ -1157,7 +1157,7 @@
return AST_LOCK_FAILURE;
}
- snprintf(fs, strlen(path) + 19, "%s/.lock-%08x", path, rand());
+ snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random());
fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
if (fd < 0) {
fprintf(stderr, "Unable to create lock file '%s': %s\n", path, strerror(errno));
Modified: team/oej/siptransfer/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_alarmreceiver.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_alarmreceiver.c (original)
+++ team/oej/siptransfer/apps/app_alarmreceiver.c Thu Apr 6 14:21:00 2006
@@ -551,13 +551,12 @@
checksum = checksum % 15;
- if(checksum){
+ if (checksum) {
database_increment("checksum-errors");
- if(option_verbose >= 2){
+ if (option_verbose >= 2)
ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Nonzero checksum\n");
ast_log(LOG_DEBUG, "AlarmReceiver: Nonzero checksum\n");
continue;
- }
}
/* Check the message type for correctness */
Modified: team/oej/siptransfer/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_channelredirect.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_channelredirect.c (original)
+++ team/oej/siptransfer/apps/app_channelredirect.c Thu Apr 6 14:21:00 2006
@@ -99,15 +99,16 @@
context = NULL;
}
- if (!(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten),
- priority, chan2->cid.cid_num))) {
+ /* ast_findlabel_extension does not convert numeric priorities; it only does a lookup */
+ if (!(prio = atoi(priority)) && !(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context),
+ S_OR(exten, chan2->exten), priority, chan2->cid.cid_num))) {
ast_log(LOG_WARNING, "'%s' is not a known priority or label\n", priority);
goto chanquit;
}
- ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s\n", args.channel, args.label);
+ ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
- if (ast_async_goto_if_exists(chan2, context ? context : chan2->context, exten ? exten : chan2->exten, prio))
+ if (ast_async_goto_if_exists(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio))
ast_log(LOG_WARNING, "%s failed for %s\n", app, args.channel);
else
res = 0;
Modified: team/oej/siptransfer/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_exec.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_exec.c (original)
+++ team/oej/siptransfer/apps/app_exec.c Thu Apr 6 14:21:00 2006
@@ -2,8 +2,9 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (c) 2004 - 2005, Tilghman Lesher. All rights reserved.
+ * Portions copyright (c) 2006, Philipp Dunkel.
*
- * Tilghman Lesher <app_exec__v001 at the-tilghman.com>
+ * Tilghman Lesher <app_exec__v002 at the-tilghman.com>
*
* This code is released by the author with no restrictions on usage.
*
@@ -19,7 +20,8 @@
*
* \brief Exec application
*
- * \author Tilghman Lesher <app_exec__v001 at the-tilghman.com>
+ * \author Tilghman Lesher <app_exec__v002 at the-tilghman.com>
+ * \author Philipp Dunkel <philipp.dunkel at ebox.at>
*
* \ingroup applications
*/
@@ -43,18 +45,43 @@
/* Maximum length of any variable */
#define MAXRESULT 1024
-static char *tdesc = "Executes applications";
+static char *tdesc = "Executes dialplan applications";
+
+/*! Note
+ *
+ * The key difference between these two apps is exit status. In a
+ * nutshell, Exec tries to be transparent as possible, behaving
+ * in exactly the same way as if the application it calls was
+ * directly invoked from the dialplan.
+ *
+ * TryExec, on the other hand, provides a way to execute applications
+ * and catch any possible fatal error without actually fatally
+ * affecting the dialplan.
+ */
static char *app_exec = "Exec";
-
-static char *exec_synopsis = "Executes internal application";
-
+static char *exec_synopsis = "Executes dialplan application";
static char *exec_descrip =
"Usage: Exec(appname(arguments))\n"
" Allows an arbitrary application to be invoked even when not\n"
+"hardcoded into the dialplan. If the underlying application\n"
+"terminates the dialplan, or if the application cannot be found,\n"
+"Exec will terminate the dialplan.\n"
+" To invoke external applications, see the application System.\n"
+" If you would like to catch any error instead, see TryExec.\n";
+
+static char *app_tryexec = "TryExec";
+static char *tryexec_synopsis = "Executes dialplan application, always returning";
+static char *tryexec_descrip =
+"Usage: TryExec(appname(arguments))\n"
+" Allows an arbitrary application to be invoked even when not\n"
"hardcoded into the dialplan. To invoke external applications\n"
-"see the application System. Returns whatever value the\n"
-"app returns or a non-zero value if the app cannot be found.\n";
+"see the application System. Always returns to the dialplan.\n"
+"The channel variable TRYSTATUS will be set to:\n"
+" SUCCESS if the application returned zero\n"
+" FAILED if the application returned non-zero\n"
+" NOAPP if the application was not found or was not specified\n"
+" NOMEMORY if there was not enough memory to execute.\n";
LOCAL_USER_DECL;
@@ -62,12 +89,10 @@
{
int res=0;
struct localuser *u;
- char *s, *appname, *endargs, args[MAXRESULT];
+ char *s, *appname, *endargs, args[MAXRESULT] = "";
struct ast_app *app;
LOCAL_USER_ADD(u);
-
- memset(args, 0, MAXRESULT);
/* Check and parse arguments */
if (data) {
@@ -96,11 +121,51 @@
return res;
}
+static int tryexec_exec(struct ast_channel *chan, void *data)
+{
+ int res=0;
+ struct localuser *u;
+ char *s, *appname, *endargs, args[MAXRESULT] = "";
+ struct ast_app *app;
+
+ LOCAL_USER_ADD(u);
+
+ /* Check and parse arguments */
+ if (data) {
+ if ((s = ast_strdupa(data))) {
+ appname = strsep(&s, "(");
+ if (s) {
+ endargs = strrchr(s, ')');
+ if (endargs)
+ *endargs = '\0';
+ pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+ }
+ if (appname) {
+ app = pbx_findapp(appname);
+ if (app) {
+ res = pbx_exec(chan, app, args);
+ pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
+ } else {
+ ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+ pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
+ }
+ }
+ } else {
+ ast_log(LOG_ERROR, "Out of memory\n");
+ pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOMEMORY");
+ }
+ }
+
+ LOCAL_USER_REMOVE(u);
+ return 0;
+}
+
int unload_module(void)
{
int res;
res = ast_unregister_application(app_exec);
+ res |= ast_unregister_application(app_tryexec);
STANDARD_HANGUP_LOCALUSERS;
@@ -109,7 +174,9 @@
int load_module(void)
{
- return ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
+ int res = ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
+ res |= ast_register_application(app_tryexec, tryexec_exec, tryexec_synopsis, tryexec_descrip);
+ return res;
}
char *description(void)
Modified: team/oej/siptransfer/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_page.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_page.c (original)
+++ team/oej/siptransfer/apps/app_page.c Thu Apr 6 14:21:00 2006
@@ -143,7 +143,7 @@
char *tech, *resource;
char meetmeopts[80];
struct ast_flags flags = { 0 };
- unsigned int confid = rand();
+ unsigned int confid = ast_random();
struct ast_app *app;
char *tmp;
int res=0;
Modified: team/oej/siptransfer/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_queue.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_queue.c (original)
+++ team/oej/siptransfer/apps/app_queue.c Thu Apr 6 14:21:00 2006
@@ -1211,7 +1211,7 @@
ast_mutex_lock(&qe->parent->lock);
if (newvalue <= qe->parent->servicelevel)
- qe->parent->callscompletedinsl++;
+ qe->parent->callscompletedinsl++;
oldvalue = qe->parent->holdtime;
qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newvalue) >> 2;
ast_mutex_unlock(&qe->parent->lock);
@@ -1753,7 +1753,7 @@
if (f) {
if (f->frametype == AST_FRAME_CONTROL) {
switch(f->subclass) {
- case AST_CONTROL_ANSWER:
+ case AST_CONTROL_ANSWER:
/* This is our guy if someone answered. */
if (!peer) {
if (option_verbose > 2)
@@ -1992,7 +1992,7 @@
tmp->metric += mem->penalty * 1000000;
break;
case QUEUE_STRATEGY_RANDOM:
- tmp->metric = rand() % 1000;
+ tmp->metric = ast_random() % 1000;
tmp->metric += mem->penalty * 1000000;
break;
case QUEUE_STRATEGY_FEWESTCALLS:
@@ -2193,7 +2193,7 @@
/* Agent must have hung up */
ast_log(LOG_WARNING, "Agent on %s hungup on the customer. They're going to be pissed.\n", peer->name);
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "AGENTDUMP", "%s", "");
- record_abandoned(qe);
+ record_abandoned(qe);
if (qe->parent->eventwhencalled) {
manager_event(EVENT_FLAG_AGENT, "AgentDump",
"Queue: %s\r\n"
@@ -2223,7 +2223,7 @@
if (res < 0) {
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "SYSCOMPAT", "%s", "");
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
- record_abandoned(qe);
+ record_abandoned(qe);
ast_hangup(peer);
return -1;
}
@@ -2241,7 +2241,7 @@
else {
/* Last ditch effort -- no CDR, make up something */
char tmpid[256];
- snprintf(tmpid, sizeof(tmpid), "chan-%x", rand());
+ snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 );
}
if (qe->parent->monjoin)
@@ -2403,7 +2403,7 @@
free(last_member);
if (queue_persistent_members)
- dump_queue_members(q);
+ dump_queue_members(q);
res = RES_OKAY;
} else {
@@ -2440,17 +2440,17 @@
new_member->next = q->members;
q->members = new_member;
manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
- "Queue: %s\r\n"
- "Location: %s\r\n"
- "Membership: %s\r\n"
- "Penalty: %d\r\n"
- "CallsTaken: %d\r\n"
- "LastCall: %d\r\n"
- "Status: %d\r\n"
- "Paused: %d\r\n",
- q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
- new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
-
+ "Queue: %s\r\n"
+ "Location: %s\r\n"
+ "Membership: %s\r\n"
+ "Penalty: %d\r\n"
+ "CallsTaken: %d\r\n"
+ "LastCall: %d\r\n"
+ "Status: %d\r\n"
+ "Paused: %d\r\n",
+ q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
+ new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
+
if (dump)
dump_queue_members(q);
@@ -2489,7 +2489,7 @@
mem->paused = paused;
if (queue_persistent_members)
- dump_queue_members(q);
+ dump_queue_members(q);
ast_queue_log(q->name, "NONE", interface, (paused ? "PAUSE" : "UNPAUSE"), "%s", "");
@@ -2944,7 +2944,7 @@
check_turns:
if (ringing) {
ast_indicate(chan, AST_CONTROL_RINGING);
- } else {
+ } else {
ast_moh_start(chan, qe.moh);
}
for (;;) {
@@ -2958,8 +2958,8 @@
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
if (option_verbose > 2) {
ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s while waiting their turn\n", args.queuename);
- res = -1;
}
+ res = -1;
break;
}
if (!res)
@@ -2981,7 +2981,7 @@
/* Leave if we have exceeded our queuetimeout */
if (qe.expire && (time(NULL) > qe.expire)) {
- record_abandoned(&qe);
+ record_abandoned(&qe);
reason = QUEUE_TIMEOUT;
res = 0;
ast_queue_log(args.queuename, chan->uniqueid,"NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
@@ -3057,8 +3057,8 @@
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
if (option_verbose > 2) {
ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s when they almost made it\n", args.queuename);
- res = -1;
}
+ res = -1;
break;
}
if (res && valid_exit(&qe, res)) {
@@ -3067,12 +3067,10 @@
}
/* exit after 'timeout' cycle if 'n' option enabled */
if (go_on) {
- if (option_verbose > 2) {
+ if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Exiting on time-out cycle\n");
- res = -1;
- }
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
- record_abandoned(&qe);
+ record_abandoned(&qe);
reason = QUEUE_TIMEOUT;
res = 0;
break;
Modified: team/oej/siptransfer/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_senddtmf.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_senddtmf.c (original)
+++ team/oej/siptransfer/apps/app_senddtmf.c Thu Apr 6 14:21:00 2006
@@ -52,7 +52,7 @@
static char *descrip =
" SendDTMF(digits[|timeout_ms]): Sends DTMF digits on a channel. \n"
-" Accepted digits: 0-9, *#abcd\n"
+" Accepted digits: 0-9, *#abcd, w (.5s pause)\n"
" The application will either pass the assigned digits or terminate if it\n"
" encounters an error.\n";
Modified: team/oej/siptransfer/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_voicemail.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_voicemail.c (original)
+++ team/oej/siptransfer/apps/app_voicemail.c Thu Apr 6 14:21:00 2006
@@ -1753,11 +1753,11 @@
fprintf(p, "Subject: New message %d in mailbox %s\n", msgnum + 1, mailbox);
else
fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum + 1, mailbox);
- fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)rand(), mailbox, getpid(), host);
+ fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)ast_random(), mailbox, getpid(), host);
fprintf(p, "MIME-Version: 1.0\n");
if (attach_user_voicemail) {
/* Something unique. */
- snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)rand());
+ snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)ast_random());
fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound);
Modified: team/oej/siptransfer/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channel.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/channel.c (original)
+++ team/oej/siptransfer/channel.c Thu Apr 6 14:21:00 2006
@@ -333,7 +333,7 @@
shutting_down = 1;
if (hangup) {
AST_LIST_LOCK(&channels);
- AST_LIST_TRAVERSE(&channels, c, list)
+ AST_LIST_TRAVERSE(&channels, c, chan_list)
ast_softhangup(c, AST_SOFTHANGUP_SHUTDOWN);
AST_LIST_UNLOCK(&channels);
}
@@ -345,7 +345,7 @@
struct ast_channel *c;
int cnt = 0;
AST_LIST_LOCK(&channels);
- AST_LIST_TRAVERSE(&channels, c, list)
+ AST_LIST_TRAVERSE(&channels, c, chan_list)
cnt++;
AST_LIST_UNLOCK(&channels);
return cnt;
@@ -682,7 +682,7 @@
tmp->tech = &null_tech;
AST_LIST_LOCK(&channels);
- AST_LIST_INSERT_HEAD(&channels, tmp, list);
+ AST_LIST_INSERT_HEAD(&channels, tmp, chan_list);
AST_LIST_UNLOCK(&channels);
return tmp;
}
@@ -816,7 +816,7 @@
for (retries = 0; retries < 10; retries++) {
AST_LIST_LOCK(&channels);
- AST_LIST_TRAVERSE(&channels, c, list) {
+ AST_LIST_TRAVERSE(&channels, c, chan_list) {
if (!prev) {
/* want head of list */
if (!name && !exten)
@@ -845,7 +845,7 @@
break;
}
} else if (c == prev) { /* found, return c->next */
- c = AST_LIST_NEXT(c, list);
+ c = AST_LIST_NEXT(c, chan_list);
break;
}
}
@@ -952,7 +952,7 @@
headp=&chan->varshead;
AST_LIST_LOCK(&channels);
- AST_LIST_REMOVE(&channels, chan, list);
+ AST_LIST_REMOVE(&channels, chan, chan_list);
/* Lock and unlock the channel just to be sure nobody
has it locked still */
ast_mutex_lock(&chan->lock);
Modified: team/oej/siptransfer/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_agent.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_agent.c (original)
+++ team/oej/siptransfer/channels/chan_agent.c Thu Apr 6 14:21:00 2006
@@ -924,7 +924,7 @@
tmp->rawreadformat = AST_FORMAT_SLINEAR;
}
if (p->pending)
- ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, rand() & 0xffff);
+ ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, ast_random() & 0xffff);
else
ast_string_field_build(tmp, name, "Agent/%s", p->agent);
/* Safe, agentlock already held */
Modified: team/oej/siptransfer/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_h323.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_h323.c (original)
+++ team/oej/siptransfer/channels/chan_h323.c Thu Apr 6 14:21:00 2006
@@ -78,6 +78,7 @@
#include "asterisk/cli.h"
#include "asterisk/dsp.h"
#include "asterisk/causes.h"
+#include "asterisk/stringfields.h"
#ifdef __cplusplus
}
#endif
@@ -101,12 +102,13 @@
int h323debug;
/** Variables required by Asterisk */
-static const char type[] = "H323";
static const char desc[] = "The NuFone Network's Open H.323 Channel Driver";
static const char tdesc[] = "The NuFone Network's Open H.323 Channel Driver";
static const char config[] = "h323.conf";
static char default_context[AST_MAX_CONTEXT] = "default";
static struct sockaddr_in bindaddr;
+
+#define GLOBAL_CAPABILITY (AST_FORMAT_G723_1 | AST_FORMAT_GSM | AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_G729A | AST_FORMAT_H261)
/** H.323 configuration values */
static int h323_signalling_port = 1720;
@@ -206,9 +208,9 @@
static int oh323_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static const struct ast_channel_tech oh323_tech = {
- .type = type,
+ .type = "H323",
.description = tdesc,
- .capabilities = AST_FORMAT_ULAW,
+ .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
.properties = AST_CHAN_TP_WANTSJITTER,
.requester = oh323_request,
.send_digit = oh323_digit,
@@ -496,7 +498,7 @@
if (c->hangupcause) {
q931cause = c->hangupcause;
} else {
- char *cause = pbx_builtin_getvar_helper(c, "DIALSTATUS");
+ const char *cause = pbx_builtin_getvar_helper(c, "DIALSTATUS");
if (cause) {
if (!strcmp(cause, "CONGESTION")) {
q931cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION;
@@ -735,14 +737,13 @@
ast_mutex_lock(&pvt->lock);
if (ch) {
ch->tech = &oh323_tech;
- snprintf(ch->name, sizeof(ch->name), "H323/%s", host);
+ ast_string_field_build(ch, name, "H323/%s", host);
ch->nativeformats = pvt->options.capability;
if (!ch->nativeformats) {
ch->nativeformats = global_options.capability;
}
pvt->nativeformats = ch->nativeformats;
fmt = ast_best_codec(ch->nativeformats);
- ch->type = type;
ch->fds[0] = ast_rtp_fd(pvt->rtp);
if (state == AST_STATE_RING) {
ch->rings = 1;
@@ -765,7 +766,7 @@
strncpy(ch->exten, pvt->exten, sizeof(ch->exten) - 1);
ch->priority = 1;
if (!ast_strlen_zero(pvt->accountcode)) {
- strncpy(ch->accountcode, pvt->accountcode, sizeof(ch->accountcode) - 1);
+ ast_string_field_set(ch, accountcode, pvt->accountcode);
}
if (pvt->amaflags) {
ch->amaflags = pvt->amaflags;
@@ -1234,7 +1235,6 @@
*/
void connection_made(unsigned call_reference, const char *token)
{
- struct ast_channel *c = NULL;
struct oh323_pvt *pvt;
if (h323debug)
@@ -1436,7 +1436,6 @@
*/
void chan_ringing(unsigned call_reference, const char *token)
{
- struct ast_channel *c = NULL;
struct oh323_pvt *pvt;
if (h323debug)
@@ -1479,7 +1478,7 @@
break;
#if 1
#ifdef DEBUG_THREADS
- ast_log(LOG_NOTICE, "Avoiding H.323 destory deadlock on %s, locked at %ld/%d by %s (%s:%d)\n", call_token, pvt->owner->lock.thread, pvt->owner->lock.reentrancy, pvt->owner->lock.func, pvt->owner->lock.file, pvt->owner->lock.lineno);
+ ast_log(LOG_NOTICE, "Avoiding H.323 destory deadlock on %s, locked at %ld/%d by %s (%s:%d)\n", call_token, pvt->owner->lock.thread[0], pvt->owner->lock.reentrancy, pvt->owner->lock.func[0], pvt->owner->lock.file[0], pvt->owner->lock.lineno[0]);
#else
ast_log(LOG_NOTICE, "Avoiding H.323 destory deadlock on %s\n", call_token);
#endif
@@ -2026,7 +2025,7 @@
memset(&global_options, 0, sizeof(global_options));
global_options.dtmfcodec = 101;
global_options.dtmfmode = H323_DTMF_RFC2833;
- global_options.capability = ~0; /* All capabilities */
+ global_options.capability = GLOBAL_CAPABILITY;
global_options.bridge = 1; /* Do native bridging by default */
v = ast_variable_browse(cfg, "general");
while(v) {
@@ -2282,7 +2281,7 @@
}
}
-static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs)
+static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active)
{
/* XXX Deal with Video */
struct oh323_pvt *pvt;
@@ -2308,7 +2307,7 @@
}
static struct ast_rtp_protocol oh323_rtp = {
- .type = type,
+ .type = "H323",
.get_rtp_info = oh323_get_rtp_peer,
.get_vrtp_info = oh323_get_vrtp_peer,
.set_rtp_peer= oh323_set_rtp_peer,
@@ -2334,7 +2333,7 @@
} else {
/* Make sure we can register our channel type */
if (ast_channel_register(&oh323_tech)) {
- ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
+ ast_log(LOG_ERROR, "Unable to register channel class 'H323'\n");
h323_end_process();
return -1;
}
Modified: team/oej/siptransfer/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/channels/chan_iax2.c?rev=17987&r1=17986&r2=17987&view=diff
==============================================================================
--- team/oej/siptransfer/channels/chan_iax2.c (original)
+++ team/oej/siptransfer/channels/chan_iax2.c Thu Apr 6 14:21:00 2006
@@ -778,6 +778,7 @@
static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
static int send_command_final(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int);
+static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, int temponly);
static struct iax2_user *build_user(const char *name, struct ast_variable *v, int temponly);
static void destroy_user(struct iax2_user *user);
static int expire_registry(void *data);
@@ -1291,7 +1292,7 @@
last++;
else
last = s;
- snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)rand());
+ snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)ast_random());
res = stat(s, &stbuf);
if (res < 0) {
ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno));
@@ -1609,19 +1610,14 @@
int res;
char iabuf[INET_ADDRSTRLEN];
int callno = f->callno;
+
+ /* Don't send if there was an error, but return error instead */
+ if (!callno || !iaxs[callno] || iaxs[callno]->error)
+ return -1;
/* Called with iaxsl held */
- if (!iaxs[callno])
- return -1;
if (option_debug > 2 && iaxdebug)
ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port));
- /* Don't send if there was an error, but return error instead */
- if (!callno) {
- ast_log(LOG_WARNING, "Call number = %d\n", callno);
- return -1;
- }
- if (iaxs[callno]->error)
- return -1;
if (f->transfer) {
if (iaxdebug)
iax_showframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr));
@@ -1642,6 +1638,30 @@
return res;
}
+static void iax2_destroy_helper(struct chan_iax2_pvt *pvt)
+{
+ /* No more pings or lagrq's */
+ if (pvt->pingid > -1)
+ ast_sched_del(sched, pvt->pingid);
+ pvt->pingid = -1;
+ if (pvt->lagid > -1)
+ ast_sched_del(sched, pvt->lagid);
+ pvt->lagid = -1;
+ if (pvt->autoid > -1)
+ ast_sched_del(sched, pvt->autoid);
+ pvt->autoid = -1;
+ if (pvt->authid > -1)
+ ast_sched_del(sched, pvt->authid);
+ pvt->authid = -1;
+ if (pvt->initid > -1)
+ ast_sched_del(sched, pvt->initid);
+ pvt->initid = -1;
+#ifdef NEWJB
+ if (pvt->jbid > -1)
+ ast_sched_del(sched, pvt->jbid);
+ pvt->jbid = -1;
+#endif
+}
static int iax2_predestroy(int callno)
{
@@ -1654,27 +1674,7 @@
return -1;
}
if (!ast_test_flag(pvt, IAX_ALREADYGONE)) {
- /* No more pings or lagrq's */
- if (pvt->pingid > -1)
- ast_sched_del(sched, pvt->pingid);
- if (pvt->lagid > -1)
- ast_sched_del(sched, pvt->lagid);
- if (pvt->autoid > -1)
- ast_sched_del(sched, pvt->autoid);
- if (pvt->authid > -1)
- ast_sched_del(sched, pvt->authid);
- if (pvt->initid > -1)
- ast_sched_del(sched, pvt->initid);
-#ifdef NEWJB
- if (pvt->jbid > -1)
- ast_sched_del(sched, pvt->jbid);
- pvt->jbid = -1;
-#endif
- pvt->pingid = -1;
- pvt->lagid = -1;
- pvt->autoid = -1;
- pvt->initid = -1;
- pvt->authid = -1;
+ iax2_destroy_helper(pvt);
ast_set_flag(pvt, IAX_ALREADYGONE);
}
c = pvt->owner;
@@ -1729,27 +1729,7 @@
if (pvt) {
if (!owner)
pvt->owner = NULL;
- /* No more pings or lagrq's */
- if (pvt->pingid > -1)
- ast_sched_del(sched, pvt->pingid);
- if (pvt->lagid > -1)
- ast_sched_del(sched, pvt->lagid);
- if (pvt->autoid > -1)
- ast_sched_del(sched, pvt->autoid);
- if (pvt->authid > -1)
- ast_sched_del(sched, pvt->authid);
- if (pvt->initid > -1)
- ast_sched_del(sched, pvt->initid);
-#ifdef NEWJB
- if (pvt->jbid > -1)
- ast_sched_del(sched, pvt->jbid);
- pvt->jbid = -1;
-#endif
- pvt->pingid = -1;
- pvt->lagid = -1;
- pvt->autoid = -1;
- pvt->authid = -1;
- pvt->initid = -1;
+ iax2_destroy_helper(pvt);
if (pvt->bridgetrans)
ast_translator_free_path(pvt->bridgetrans);
pvt->bridgetrans = NULL;
@@ -2706,12 +2686,6 @@
return 0;
}
-static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, int temponly);
-static struct iax2_user *build_user(const char *name, struct ast_variable *v, int temponly);
-
-static void destroy_user(struct iax2_user *user);
-static int expire_registry(void *data);
-
static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in *sin)
{
struct ast_variable *var;
@@ -3275,7 +3249,7 @@
int res;
struct iax_ie_data ied0;
struct iax_ie_data ied1;
- unsigned int transferid = rand();
+ unsigned int transferid = (unsigned int)ast_random();
memset(&ied0, 0, sizeof(ied0));
iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &iaxs[callno1]->addr);
iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[callno1]->peercallno);
@@ -3816,9 +3790,9 @@
ms = ast_tvdiff_ms(ast_tvnow(), p->rxcore);
#ifdef IAXTESTS
if (test_jit) {
- if (!test_jitpct || ((100.0 * rand() / (RAND_MAX + 1.0)) < test_jitpct)) {
- jit = (int)((float)test_jit * rand() / (RAND_MAX + 1.0));
- if ((int)(2.0 * rand() / (RAND_MAX + 1.0)))
+ if (!test_jitpct || ((100.0 * ast_random() / (RAND_MAX + 1.0)) < test_jitpct)) {
+ jit = (int)((float)test_jit * ast_random() / (RAND_MAX + 1.0));
+ if ((int)(2.0 * ast_random() / (RAND_MAX + 1.0)))
jit = -jit;
ms += jit;
}
@@ -5170,7 +5144,7 @@
memset(&ied, 0, sizeof(ied));
iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
if (p->authmethods & (IAX_AUTH_MD5 | IAX_AUTH_RSA)) {
- snprintf(p->challenge, sizeof(p->challenge), "%d", rand());
+ snprintf(p->challenge, sizeof(p->challenge), "%d", (int)ast_random());
iax_ie_append_str(&ied, IAX_IE_CHALLENGE, p->challenge);
}
if (p->encmethods)
@@ -5720,17 +5694,19 @@
if (reg->expire > -1)
ast_sched_del(sched, reg->expire);
reg->expire = ast_sched_add(sched, (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg);
- if ((inaddrcmp(&oldus, ®->us) || (reg->messages != oldmsgs)) && (option_verbose > 2)) {
- if (reg->messages > 65534)
- snprintf(msgstatus, sizeof(msgstatus), " with message(s) waiting\n");
- else if (reg->messages > 1)
- snprintf(msgstatus, sizeof(msgstatus), " with %d messages waiting\n", reg->messages);
- else if (reg->messages > 0)
[... 9468 lines stripped ...]
More information about the asterisk-commits
mailing list