[asterisk-commits] branch russell/cli_originate - r7504 in
/team/russell/cli_originate: ./ apps/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Dec 16 09:58:51 CST 2005
Author: russell
Date: Fri Dec 16 09:58:47 2005
New Revision: 7504
URL: http://svn.digium.com/view/asterisk?rev=7504&view=rev
Log:
Merged revisions 7457,7469,7471-7472,7481,7494,7496,7498 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r7457 | kpfleming | 2005-12-13 01:00:17 -0500 (Tue, 13 Dec 2005) | 25 lines
Merged revisions 7448-7449,7451,7453 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7448 | kpfleming | 2005-12-12 22:25:14 -0600 (Mon, 12 Dec 2005) | 2 lines
use the stream's current point when pausing/unpausing, instead of elapsed time (which doesn't work when the stream has been skipped forward or backward) (issue #5897)
........
r7449 | kpfleming | 2005-12-12 22:43:38 -0600 (Mon, 12 Dec 2005) | 2 lines
only report AGENT_IDLE for callback mode agents when they are actually idle (issue #5902)
........
r7451 | kpfleming | 2005-12-12 23:14:27 -0600 (Mon, 12 Dec 2005) | 2 lines
ensure that hangups while incoming calls are in early state are handled properly (issue #5919)
........
r7453 | kpfleming | 2005-12-12 23:53:00 -0600 (Mon, 12 Dec 2005) | 2 lines
restore ability of caller to hangup calls that are still ringing (issue #5839)
........
................
r7469 | kpfleming | 2005-12-13 11:07:19 -0500 (Tue, 13 Dec 2005) | 10 lines
Merged revisions 7468 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7468 | kpfleming | 2005-12-13 10:06:27 -0600 (Tue, 13 Dec 2005) | 2 lines
correct broken math in tvfix() for timestamp values over one million
........
................
r7471 | kpfleming | 2005-12-13 13:54:41 -0500 (Tue, 13 Dec 2005) | 10 lines
Merged revisions 7470 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7470 | kpfleming | 2005-12-13 12:54:22 -0600 (Tue, 13 Dec 2005) | 2 lines
clarify substring documentation
........
................
r7472 | russell | 2005-12-13 17:03:06 -0500 (Tue, 13 Dec 2005) | 2 lines
reduce some duplicated code when doing a strdup (issue #5986)
................
r7481 | bweschke | 2005-12-14 21:49:17 -0500 (Wed, 14 Dec 2005) | 3 lines
Bug #6003 - Don't free the channel structure until after having sent the manager event.
................
r7494 | tilghman | 2005-12-15 12:31:52 -0500 (Thu, 15 Dec 2005) | 2 lines
Make sure the functions CUT and SORT are built.
................
r7496 | tilghman | 2005-12-15 14:05:41 -0500 (Thu, 15 Dec 2005) | 2 lines
Properly move these functions over to the funcs directory (since they no longer contain apps)
................
r7498 | tilghman | 2005-12-15 19:55:39 -0500 (Thu, 15 Dec 2005) | 3 lines
First field was truncated.
(Don't kill me; this attempted merge didn't work because the paths changed.)
................
Added:
team/russell/cli_originate/funcs/func_cut.c
- copied unchanged from r7498, trunk/funcs/func_cut.c
Removed:
team/russell/cli_originate/apps/app_cut.c
Modified:
team/russell/cli_originate/ (props changed)
team/russell/cli_originate/app.c
team/russell/cli_originate/apps/app_dial.c
team/russell/cli_originate/apps/app_macro.c
team/russell/cli_originate/channel.c
team/russell/cli_originate/channels/chan_agent.c
team/russell/cli_originate/channels/chan_sip.c
team/russell/cli_originate/doc/README.variables
team/russell/cli_originate/pbx.c
team/russell/cli_originate/utils.c
Propchange: team/russell/cli_originate/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Dec 16 09:58:47 2005
@@ -1,1 +1,1 @@
-/trunk:1-7455
+/trunk:1-7503
Modified: team/russell/cli_originate/app.c
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/app.c?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/app.c (original)
+++ team/russell/cli_originate/app.c Fri Dec 16 09:58:47 2005
@@ -430,11 +430,11 @@
const char *stop, const char *pause,
const char *restart, int skipms)
{
- long elapsed = 0, last_elapsed = 0;
char *breaks = NULL;
char *end = NULL;
int blen = 2;
int res;
+ long pause_restart_point = 0;
if (stop)
blen += strlen(stop);
@@ -456,9 +456,6 @@
if (chan->_state != AST_STATE_UP)
res = ast_answer(chan);
- if (chan)
- ast_stopstream(chan);
-
if (file) {
if ((end = strchr(file,':'))) {
if (!strcasecmp(end, ":end")) {
@@ -469,25 +466,18 @@
}
for (;;) {
- struct timeval started = ast_tvnow();
-
- if (chan)
- ast_stopstream(chan);
+ ast_stopstream(chan);
res = ast_streamfile(chan, file, chan->language);
if (!res) {
- if (end) {
+ if (pause_restart_point) {
+ ast_seekstream(chan->stream, pause_restart_point, SEEK_SET);
+ pause_restart_point = 0;
+ }
+ else if (end) {
ast_seekstream(chan->stream, 0, SEEK_END);
- end=NULL;
- }
- res = 1;
- if (elapsed) {
- ast_stream_fastforward(chan->stream, elapsed);
- last_elapsed = elapsed - 200;
- }
- if (res)
- res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
- else
- break;
+ end = NULL;
+ };
+ res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
}
if (res < 1)
@@ -496,17 +486,16 @@
/* We go at next loop if we got the restart char */
if (restart && strchr(restart, res)) {
ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
- elapsed=0; /* To make sure the next stream will start at beginning */
+ pause_restart_point = 0;
continue;
}
- if (pause != NULL && strchr(pause, res)) {
- elapsed = ast_tvdiff_ms(ast_tvnow(), started) + last_elapsed;
- for(;;) {
- if (chan)
- ast_stopstream(chan);
+ if (pause && strchr(pause, res)) {
+ pause_restart_point = ast_tellstream(chan->stream);
+ for (;;) {
+ ast_stopstream(chan);
res = ast_waitfordigit(chan, 1000);
- if (res == 0)
+ if (!res)
continue;
else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
break;
@@ -516,17 +505,16 @@
continue;
}
}
+
if (res == -1)
break;
/* if we get one of our stop chars, return it to the calling function */
- if (stop && strchr(stop, res)) {
- /* res = 0; */
- break;
- }
- }
- if (chan)
- ast_stopstream(chan);
+ if (stop && strchr(stop, res))
+ break;
+ }
+
+ ast_stopstream(chan);
return res;
}
Modified: team/russell/cli_originate/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/apps/app_dial.c?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/apps/app_dial.c (original)
+++ team/russell/cli_originate/apps/app_dial.c Fri Dec 16 09:58:47 2005
@@ -962,7 +962,7 @@
/* If a channel group has been specified, get it for use when we create peer channels */
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
- ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID);
+ ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP);
cur = args.peers;
do {
/* Remember where to start next time */
Modified: team/russell/cli_originate/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/apps/app_macro.c?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/apps/app_macro.c (original)
+++ team/russell/cli_originate/apps/app_macro.c Fri Dec 16 09:58:47 2005
@@ -86,6 +86,11 @@
STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
+
+static char *safe_strdup(const char *s)
+{
+ return s ? strdup(s) : NULL;
+}
static int macro_exec(struct ast_channel *chan, void *data)
{
@@ -162,25 +167,17 @@
}
argc = 1;
/* Save old macro variables */
- save_macro_exten = pbx_builtin_getvar_helper(chan, "MACRO_EXTEN");
- if (save_macro_exten)
- save_macro_exten = strdup(save_macro_exten);
+ save_macro_exten = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_EXTEN"));
pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", oldexten);
- save_macro_context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT");
- if (save_macro_context)
- save_macro_context = strdup(save_macro_context);
+ save_macro_context = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"));
pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", oldcontext);
- save_macro_priority = pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY");
- if (save_macro_priority)
- save_macro_priority = strdup(save_macro_priority);
+ save_macro_priority = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY"));
snprintf(pc, sizeof(pc), "%d", oldpriority);
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", pc);
- save_macro_offset = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET");
- if (save_macro_offset)
- save_macro_offset = strdup(save_macro_offset);
+ save_macro_offset = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", NULL);
/* Setup environment for new run */
Modified: team/russell/cli_originate/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/channel.c?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/channel.c (original)
+++ team/russell/cli_originate/channel.c Fri Dec 16 09:58:47 2005
@@ -3055,7 +3055,6 @@
if (ast_test_flag(clone, AST_FLAG_ZOMBIE)) {
ast_log(LOG_DEBUG, "Destroying channel clone '%s'\n", clone->name);
ast_mutex_unlock(&clone->lock);
- ast_channel_free(clone);
manager_event(EVENT_FLAG_CALL, "Hangup",
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
@@ -3066,6 +3065,7 @@
clone->hangupcause,
ast_cause2str(clone->hangupcause)
);
+ ast_channel_free(clone);
} else {
struct ast_frame null_frame = { AST_FRAME_NULL, };
ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
Modified: team/russell/cli_originate/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/channels/chan_agent.c?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/channels/chan_agent.c (original)
+++ team/russell/cli_originate/channels/chan_agent.c Fri Dec 16 09:58:47 2005
@@ -1417,7 +1417,7 @@
/* Set a default status. It 'should' get changed. */
status = "AGENT_UNKNOWN";
- if (!ast_strlen_zero(p->loginchan)) {
+ if (!ast_strlen_zero(p->loginchan) && !p->chan) {
loginChan = p->loginchan;
talkingtoChan = "n/a";
status = "AGENT_IDLE";
Modified: team/russell/cli_originate/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/channels/chan_sip.c?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/channels/chan_sip.c (original)
+++ team/russell/cli_originate/channels/chan_sip.c Fri Dec 16 09:58:47 2005
@@ -2279,6 +2279,7 @@
/* Possible values taken from causes.h */
switch(cause) {
+ case 603: /* Declined */
case 403: /* Not found */
return AST_CAUSE_CALL_REJECTED;
case 404: /* Not found */
@@ -2458,7 +2459,7 @@
if (ast->hangupcause && ((res = hangup_cause2sip(ast->hangupcause)))) {
transmit_response_reliable(p, res, &p->initreq, 1);
} else
- transmit_response_reliable(p, "403 Forbidden", &p->initreq, 1);
+ transmit_response_reliable(p, "603 Declined", &p->initreq, 1);
}
} else { /* Call is in UP state, send BYE */
if (!p->pendinginvite) {
Modified: team/russell/cli_originate/doc/README.variables
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/doc/README.variables?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/doc/README.variables (original)
+++ team/russell/cli_originate/doc/README.variables Fri Dec 16 09:58:47 2005
@@ -94,17 +94,17 @@
-_______________________________
-REMOVING CHARACTERS FROM STRING
--------------------------------
-
-The format for removing characters from a variable can be expressed as:
+___________________________________
+SELECTING CHARACTERS FROM VARIABLES
+-----------------------------------
+
+The format for selecting characters from a variable can be expressed as:
${variable_name[:offset[:length]]}
-If you want to remove the first N characters from the string assigned
+If you want to select the first N characters from the string assigned
to a variable, simply append a colon and the number of characters to
-remove from the beginning of the string to the variable name.
+skip from the beginning of the string to the variable name.
;Remove the first character of extension, save in "number" variable
exten => _9X.,1,Set(number=${EXTEN:1})
@@ -115,7 +115,7 @@
digit.
If you use a negative offset number, Asterisk starts counting from the end
-of the string and then removes everything before the new position. The following
+of the string and then selects everything after the new position. The following
example will save the numbers 1234 to the 'number' variable, still assuming
we've dialed 918005551234.
Modified: team/russell/cli_originate/pbx.c
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/pbx.c?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/pbx.c (original)
+++ team/russell/cli_originate/pbx.c Fri Dec 16 09:58:47 2005
@@ -5443,6 +5443,8 @@
static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
{
/* Just return non-zero and it will hang up */
+ if (!chan->hangupcause)
+ chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
return -1;
}
Modified: team/russell/cli_originate/utils.c
URL: http://svn.digium.com/view/asterisk/team/russell/cli_originate/utils.c?rev=7504&r1=7503&r2=7504&view=diff
==============================================================================
--- team/russell/cli_originate/utils.c (original)
+++ team/russell/cli_originate/utils.c Fri Dec 16 09:58:47 2005
@@ -613,11 +613,11 @@
if (a.tv_usec >= ONE_MILLION) {
ast_log(LOG_WARNING, "warning too large timestamp %ld.%ld\n",
a.tv_sec, (long int) a.tv_usec);
- a.tv_sec += a.tv_usec % ONE_MILLION;
+ a.tv_sec += a.tv_usec / ONE_MILLION;
a.tv_usec %= ONE_MILLION;
} else if (a.tv_usec < 0) {
ast_log(LOG_WARNING, "warning negative timestamp %ld.%ld\n",
- a.tv_sec, (long int) a.tv_usec);
+ a.tv_sec, (long int) a.tv_usec);
a.tv_usec = 0;
}
return a;
More information about the asterisk-commits
mailing list