[asterisk-commits] branch group/asterisk-xmpp r26380 - in
/team/group/asterisk-xmpp: ./ apps/ bu...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed May 10 04:56:19 MST 2006
Author: mogorman
Date: Wed May 10 06:56:18 2006
New Revision: 26380
URL: http://svn.digium.com/view/asterisk?rev=26380&view=rev
Log:
Merged revisions 25989,26016-26017,26019-26020,26046-26049,26051,26054-26055,26091-26094,26103,26131,26166,26170,26216,26250,26281-26283,26314,26345-26347,26378 via svnmerge from
https://svn.digium.com/svn/asterisk/trunk
................
r25989 | russell | 2006-05-09 05:43:08 -0500 (Tue, 09 May 2006) | 8 lines
change the check for zaptel to only check for linux/zaptel.h on Linux, and
zaptel.h otherwise
If you did ./configure --with-tonezone=/usr/local/ on FreeBSD, it would run
the first macro which would not find it, but it wouldn't make it to the second
macro because the first check saw that --with-tonezone was specified and would
exit with error
................
r26016 | rizzo | 2006-05-09 06:27:33 -0500 (Tue, 09 May 2006) | 3 lines
do not use a variable name that hides a useful library symbol (time())
................
r26017 | rizzo | 2006-05-09 06:29:34 -0500 (Tue, 09 May 2006) | 2 lines
change some log_warning into log_debug
................
r26019 | markster | 2006-05-09 06:44:50 -0500 (Tue, 09 May 2006) | 2 lines
Make SIP early media work more efficiently without so many reinvites
................
r26020 | rizzo | 2006-05-09 06:45:26 -0500 (Tue, 09 May 2006) | 3 lines
add default values for CPPFLAGS and LDFLAGS on FreeBSD
................
r26046 | russell | 2006-05-09 08:14:37 -0500 (Tue, 09 May 2006) | 2 lines
add regenerated configure script
................
r26047 | kpfleming | 2006-05-09 08:19:43 -0500 (Tue, 09 May 2006) | 2 lines
update to include latest FreeBSD changes
................
r26048 | kpfleming | 2006-05-09 08:20:52 -0500 (Tue, 09 May 2006) | 2 lines
ignore some more auto-generated files
................
r26049 | kpfleming | 2006-05-09 08:26:50 -0500 (Tue, 09 May 2006) | 2 lines
use aclocal version 1.9 instead of 1.4 :-)
................
r26051 | bweschke | 2006-05-09 08:33:54 -0500 (Tue, 09 May 2006) | 11 lines
Merged revisions 26050 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r26050 | bweschke | 2006-05-09 08:28:39 -0500 (Tue, 09 May 2006) | 3 lines
Correct memory leak in find_user_realtime #7118 (fnordian)
........
................
r26054 | rizzo | 2006-05-09 08:52:01 -0500 (Tue, 09 May 2006) | 3 lines
normalize code, remove some useless casts
................
r26055 | rizzo | 2006-05-09 08:55:33 -0500 (Tue, 09 May 2006) | 3 lines
remove duplicate atof() invokation
................
r26091 | bweschke | 2006-05-09 09:21:33 -0500 (Tue, 09 May 2006) | 3 lines
This app is deprecated in /trunk, and thus, the change should not come forward.
................
r26092 | kpfleming | 2006-05-09 09:25:31 -0500 (Tue, 09 May 2006) | 2 lines
minor cleanups and removal of duplicate prototypes
................
r26093 | kpfleming | 2006-05-09 09:25:57 -0500 (Tue, 09 May 2006) | 3 lines
use an enum for control frame types
support sending control frames with payload
................
r26094 | kpfleming | 2006-05-09 09:43:00 -0500 (Tue, 09 May 2006) | 2 lines
remove rule for running bootstrap, it's only safe to run it manually now
................
r26103 | markster | 2006-05-09 10:01:10 -0500 (Tue, 09 May 2006) | 2 lines
Make sure that we don't accept an answer on an inbound call and don't permit asterisk to answer an outbound call
................
r26131 | oej | 2006-05-09 10:17:12 -0500 (Tue, 09 May 2006) | 2 lines
Formatting fix
................
r26166 | rizzo | 2006-05-09 11:19:24 -0500 (Tue, 09 May 2006) | 5 lines
clear memory before passing to ASTOBJ_INIT
Mayne it is unnecessary, but otherwise there code believes
the mutex is already initialized.
................
r26170 | kpfleming | 2006-05-09 11:24:07 -0500 (Tue, 09 May 2006) | 2 lines
various doxygen fixes
................
r26216 | rizzo | 2006-05-09 13:34:30 -0500 (Tue, 09 May 2006) | 14 lines
implement the new sorting algorithm for extensions,
see the documentation near functions ext_cmp1() and ext_cmp().
All sorting decisions are now in one place so it is easy
to revise them.
NOTE
the major change is that now most specific patterns come first,
so there might be differences in how diaplans behave.
If you really really really need to revert to the old sorting order
while you adapt your dialplan, you can uncomment the '#if 0' line
in ext_cmp().
................
r26250 | bweschke | 2006-05-09 21:57:20 -0500 (Tue, 09 May 2006) | 3 lines
Implement new support for "meetme list <confno> concise"
................
r26281 | rizzo | 2006-05-10 02:13:23 -0500 (Wed, 10 May 2006) | 3 lines
prevent a warning for uninitialized variable.
................
r26282 | rizzo | 2006-05-10 02:19:29 -0500 (Wed, 10 May 2006) | 3 lines
indentation fixes
................
r26283 | rizzo | 2006-05-10 02:45:14 -0500 (Wed, 10 May 2006) | 3 lines
document special character interpretation.
................
r26314 | markster | 2006-05-10 04:09:16 -0500 (Wed, 10 May 2006) | 3 lines
Allow media to go directly between IAX endpoints while signalling still
goes through the existing path.
................
r26345 | rizzo | 2006-05-10 05:10:03 -0500 (Wed, 10 May 2006) | 3 lines
use 'switch' insteaf of multiple 'if'
................
r26346 | rizzo | 2006-05-10 05:41:38 -0500 (Wed, 10 May 2006) | 7 lines
provide a correct return value in case everything goes well,
so you won't get random failures running menuselect.
Detected by -Wall -Werror
................
r26347 | rizzo | 2006-05-10 05:48:29 -0500 (Wed, 10 May 2006) | 3 lines
add missing rule
................
r26378 | rizzo | 2006-05-10 06:38:43 -0500 (Wed, 10 May 2006) | 6 lines
fix a couple of misindented lines;
prepare reduce nesting level in a couple of blocks by
inverting an if () statement (indentation change to be committed
separately).
................
Modified:
team/group/asterisk-xmpp/ (props changed)
team/group/asterisk-xmpp/Makefile
team/group/asterisk-xmpp/apps/app_dial.c
team/group/asterisk-xmpp/apps/app_meetme.c
team/group/asterisk-xmpp/apps/app_voicemail.c
team/group/asterisk-xmpp/build_tools/menuselect.c
team/group/asterisk-xmpp/build_tools/menuselect_curses.c
team/group/asterisk-xmpp/channel.c
team/group/asterisk-xmpp/channels/chan_iax2.c
team/group/asterisk-xmpp/channels/chan_sip.c
team/group/asterisk-xmpp/channels/iax2.h
team/group/asterisk-xmpp/configs/iax.conf.sample
team/group/asterisk-xmpp/configure
team/group/asterisk-xmpp/configure.ac
team/group/asterisk-xmpp/include/asterisk/astosp.h
team/group/asterisk-xmpp/include/asterisk/channel.h
team/group/asterisk-xmpp/include/asterisk/frame.h
team/group/asterisk-xmpp/include/asterisk/module.h
team/group/asterisk-xmpp/include/asterisk/pbx.h
team/group/asterisk-xmpp/include/asterisk/rtp.h
team/group/asterisk-xmpp/include/asterisk/translate.h
team/group/asterisk-xmpp/include/asterisk/utils.h
team/group/asterisk-xmpp/mxml/ (props changed)
team/group/asterisk-xmpp/netsock.c
team/group/asterisk-xmpp/pbx.c
team/group/asterisk-xmpp/pbx/ael/ (props changed)
team/group/asterisk-xmpp/pbx/pbx_config.c
team/group/asterisk-xmpp/res/res_smdi.c
team/group/asterisk-xmpp/rtp.c
team/group/asterisk-xmpp/say.c
Propchange: team/group/asterisk-xmpp/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/group/asterisk-xmpp/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/group/asterisk-xmpp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed May 10 06:56:18 2006
@@ -1,1 +1,1 @@
-/trunk:1-25960
+/trunk:1-26379
Modified: team/group/asterisk-xmpp/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/Makefile?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- team/group/asterisk-xmpp/Makefile (original)
+++ team/group/asterisk-xmpp/Makefile Wed May 10 06:56:18 2006
@@ -434,9 +434,6 @@
all: config.status menuselect.makeopts cleantest depend asterisk subdirs
-configure:
- - at ./bootstrap.sh
-
config.status: configure
@CFLAGS="" ./configure
@echo "****"
@@ -482,7 +479,7 @@
include .tags-depend
endif
-ast_expr2.c:
+ast_expr2.c ast_expr2.h:
bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
ast_expr2f.c:
Modified: team/group/asterisk-xmpp/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/apps/app_dial.c?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- team/group/asterisk-xmpp/apps/app_dial.c (original)
+++ team/group/asterisk-xmpp/apps/app_dial.c Wed May 10 06:56:18 2006
@@ -482,7 +482,7 @@
ast_clear_flag(o, DIAL_STILLGOING);
HANDLE_CAUSE(cause, in);
} else {
- ast_rtp_make_compatible(c, in);
+ ast_rtp_make_compatible(c, in, single);
if (c->cid.cid_num)
free(c->cid.cid_num);
c->cid.cid_num = NULL;
@@ -550,6 +550,8 @@
OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
DIAL_NOFORWARDHTML);
+ /* Setup early media if appropriate */
+ ast_rtp_early_media(in, peer);
}
/* If call has been answered, then the eventual hangup is likely to be normal hangup */
in->hangupcause = AST_CAUSE_NORMAL_CLEARING;
@@ -576,6 +578,9 @@
case AST_CONTROL_RINGING:
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s is ringing\n", c->name);
+ /* Setup early media if appropriate */
+ if (single)
+ ast_rtp_early_media(in, c);
if (!(*sentringing) && !ast_test_flag(outgoing, OPT_MUSICBACK)) {
ast_indicate(in, AST_CONTROL_RINGING);
(*sentringing)++;
@@ -584,6 +589,9 @@
case AST_CONTROL_PROGRESS:
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "%s is making progress passing it to %s\n", c->name, in->name);
+ /* Setup early media if appropriate */
+ if (single)
+ ast_rtp_early_media(in, c);
if (!ast_test_flag(outgoing, OPT_RINGBACK))
ast_indicate(in, AST_CONTROL_PROGRESS);
break;
@@ -595,6 +603,8 @@
case AST_CONTROL_PROCEEDING:
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding passing it to %s\n", c->name, in->name);
+ if (single)
+ ast_rtp_early_media(in, c);
if (!ast_test_flag(outgoing, OPT_RINGBACK))
ast_indicate(in, AST_CONTROL_PROCEEDING);
break;
@@ -1056,7 +1066,7 @@
}
/* Setup outgoing SDP to match incoming one */
- ast_rtp_make_compatible(tmp->chan, chan);
+ ast_rtp_make_compatible(tmp->chan, chan, !outgoing && !rest);
/* Inherit specially named variables from parent channel */
ast_channel_inherit_variables(chan, tmp->chan);
@@ -1550,6 +1560,7 @@
sentringing = 0;
ast_indicate(chan, -1);
}
+ ast_rtp_early_media(chan, NULL);
hanguptree(outgoing, NULL);
pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
if (option_debug)
Modified: team/group/asterisk-xmpp/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/apps/app_meetme.c?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- team/group/asterisk-xmpp/apps/app_meetme.c (original)
+++ team/group/asterisk-xmpp/apps/app_meetme.c Wed May 10 06:56:18 2006
@@ -647,9 +647,11 @@
strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
}
} else if(strcmp(argv[1], "list") == 0) {
+ int concise = ( 4 == argc && ( !strcasecmp(argv[3], "concise") ) );
/* List all the users in a conference */
if (AST_LIST_EMPTY(&confs)) {
- ast_cli(fd, "No active conferences.\n");
+ if ( !concise )
+ ast_cli(fd, "No active conferences.\n");
return RESULT_SUCCESS;
}
/* Find the right conference */
@@ -658,7 +660,8 @@
break;
}
if (!cnf) {
- ast_cli(fd, "No such conference: %s.\n",argv[2]);
+ if ( !concise )
+ ast_cli(fd, "No such conference: %s.\n",argv[2]);
return RESULT_SUCCESS;
}
/* Show all the users */
@@ -667,19 +670,30 @@
hr = (now - user->jointime) / 3600;
min = ((now - user->jointime) % 3600) / 60;
sec = (now - user->jointime) % 60;
-
-
- ast_cli(fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %02d:%02d:%02d\n",
- user->user_no,
- S_OR(user->chan->cid.cid_num, "<unknown>"),
- S_OR(user->chan->cid.cid_name, "<no name>"),
- user->chan->name,
- user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
- user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
- user->adminflags & ADMINFLAG_MUTED ? "(Admn Muted)" : "",
- istalking(user->talking), hr, min, sec);
- }
- ast_cli(fd,"%d users in that conference.\n",cnf->users);
+ if ( !concise )
+ ast_cli(fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %02d:%02d:%02d\n",
+ user->user_no,
+ S_OR(user->chan->cid.cid_num, "<unknown>"),
+ S_OR(user->chan->cid.cid_name, "<no name>"),
+ user->chan->name,
+ user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
+ user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
+ user->adminflags & ADMINFLAG_MUTED ? "(Admn Muted)" : "",
+ istalking(user->talking), hr, min, sec);
+ else
+ ast_cli(fd, "%d!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n",
+ user->user_no,
+ S_OR(user->chan->cid.cid_num, ""),
+ S_OR(user->chan->cid.cid_name, ""),
+ user->chan->name,
+ user->userflags & CONFFLAG_ADMIN ? "1" : "",
+ user->userflags & CONFFLAG_MONITOR ? "1" : "",
+ user->adminflags & ADMINFLAG_MUTED ? "1" : "",
+ user->talking, hr, min, sec);
+
+ }
+ if ( !concise )
+ ast_cli(fd,"%d users in that conference.\n",cnf->users);
return RESULT_SUCCESS;
} else
@@ -745,14 +759,15 @@
}
AST_LIST_UNLOCK(&confs);
return usr ? strdup(usrno) : NULL;
- }
+ } else if ( strstr(line, "list") && ( 0 == state ) )
+ return strdup("concise");
}
return NULL;
}
static char conf_usage[] =
-"Usage: meetme (un)lock|(un)mute|kick|list <confno> <usernumber>\n"
+"Usage: meetme (un)lock|(un)mute|kick|list [concise] <confno> <usernumber>\n"
" Executes a command for the conference or on a conferee\n";
static struct ast_cli_entry cli_conf = {
Modified: team/group/asterisk-xmpp/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/apps/app_voicemail.c?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- team/group/asterisk-xmpp/apps/app_voicemail.c (original)
+++ team/group/asterisk-xmpp/apps/app_voicemail.c Wed May 10 06:56:18 2006
@@ -586,6 +586,7 @@
apply_option(retval, tmp->name, tmp->value);
tmp = tmp->next;
}
+ ast_variables_destroy(var);
} else {
if (!ivm)
free(retval);
@@ -6191,7 +6192,7 @@
AST_LIST_LOCK(&users);
while ((cur = AST_LIST_REMOVE_HEAD(&users, list))) {
- ast_set_flag(cur, VM_ALLOCED);
+ ast_set_flag(cur, VM_ALLOCED);
free_user(cur);
}
@@ -6751,18 +6752,21 @@
if (!strncasecmp("macro",context,5)) /* Macro names in contexts are useless for our needs */
context = ast_variable_retrieve(msg_cfg, "message","macrocontext");
- if (option == 3) {
-
+ switch (option) {
+ case 3:
if (!res)
res = play_message_datetime(chan, vmu, origtime, filename);
if (!res)
res = play_message_callerid(chan, vms, cid, context, 0);
res = 't';
-
- } else if (option == 2) { /* Call back */
-
- if (!ast_strlen_zero(cid)) {
+ break;
+
+ case 2: /* Call back */
+
+ if (ast_strlen_zero(cid))
+ break;
+
ast_callerid_parse(cid, &name, &num);
while ((res > -1) && (res != 't')) {
switch(res) {
@@ -6833,20 +6837,21 @@
retries++;
if (retries > 3)
res = 't';
- break;
-
- }
+ break;
+
+ }
if (res == 't')
res = 0;
else if (res == '*')
res = -1;
}
- }
-
- }
- else if (option == 1) { /* Reply */
+ break;
+
+ case 1: /* Reply */
/* Send reply directly to sender */
- if (!ast_strlen_zero(cid)) {
+ if (ast_strlen_zero(cid))
+ break;
+
ast_callerid_parse(cid, &name, &num);
if (!num) {
if (option_verbose > 2)
@@ -6879,7 +6884,8 @@
}
}
res = 0;
- }
+
+ break;
}
ast_config_destroy(msg_cfg);
Modified: team/group/asterisk-xmpp/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/build_tools/menuselect.c?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- team/group/asterisk-xmpp/build_tools/menuselect.c (original)
+++ team/group/asterisk-xmpp/build_tools/menuselect.c Wed May 10 06:56:18 2006
@@ -633,6 +633,7 @@
}
}
}
+ return 0; /* all good... */
}
/* \brief Set the forced default values if they exist */
@@ -725,5 +726,6 @@
if (force_clean)
unlink(".lastclean");
+ fprintf(stderr, "\nmenuselect about to exit with res %d\n", res);
exit(res);
}
Modified: team/group/asterisk-xmpp/build_tools/menuselect_curses.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/build_tools/menuselect_curses.c?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- team/group/asterisk-xmpp/build_tools/menuselect_curses.c (original)
+++ team/group/asterisk-xmpp/build_tools/menuselect_curses.c Wed May 10 06:56:18 2006
@@ -128,7 +128,7 @@
int j = 0;
struct member *mem;
char buf[64];
- char *desc = NULL;
+ const char *desc = NULL;
wclear(menu);
Modified: team/group/asterisk-xmpp/channel.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/channel.c?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- team/group/asterisk-xmpp/channel.c (original)
+++ team/group/asterisk-xmpp/channel.c Wed May 10 06:56:18 2006
@@ -738,10 +738,25 @@
}
/*! \brief Queue a control frame */
-int ast_queue_control(struct ast_channel *chan, int control)
+int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
{
struct ast_frame f = { AST_FRAME_CONTROL, };
+
f.subclass = control;
+
+ return ast_queue_frame(chan, &f);
+}
+
+/*! \brief Queue a control frame with payload */
+int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control,
+ const void *data, size_t datalen)
+{
+ struct ast_frame f = { AST_FRAME_CONTROL, };
+
+ f.subclass = control;
+ f.data = (void *) data;
+ f.datalen = datalen;
+
return ast_queue_frame(chan, &f);
}
@@ -1470,6 +1485,9 @@
{
int res = 0;
ast_channel_lock(chan);
+ /* You can't answer an outbound call */
+ if (ast_test_flag(chan, AST_FLAG_OUTGOING))
+ return 0;
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
ast_channel_unlock(chan);
@@ -1938,13 +1956,17 @@
switch (f->frametype) {
case AST_FRAME_CONTROL:
if (f->subclass == AST_CONTROL_ANSWER) {
- if (prestate == AST_STATE_UP) {
+ if (!ast_test_flag(chan, AST_FLAG_OUTGOING)) {
+ ast_log(LOG_DEBUG, "Ignoring answer on an inbound call!\n");
+ f = &ast_null_frame;
+ } else if (prestate == AST_STATE_UP) {
ast_log(LOG_DEBUG, "Dropping duplicate answer!\n");
f = &ast_null_frame;
+ } else {
+ /* Answer the CDR */
+ ast_setstate(chan, AST_STATE_UP);
+ ast_cdr_answer(chan->cdr);
}
- /* Answer the CDR */
- ast_setstate(chan, AST_STATE_UP);
- ast_cdr_answer(chan->cdr);
}
break;
case AST_FRAME_DTMF:
@@ -2623,9 +2645,11 @@
int res = -1;
/* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan);
- if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan))
+ if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
if (chan->tech->call)
res = chan->tech->call(chan, addr, timeout);
+ ast_set_flag(chan, AST_FLAG_OUTGOING);
+ }
ast_channel_unlock(chan);
return res;
}
Modified: team/group/asterisk-xmpp/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/channels/chan_iax2.c?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- team/group/asterisk-xmpp/channels/chan_iax2.c (original)
+++ team/group/asterisk-xmpp/channels/chan_iax2.c Wed May 10 06:56:18 2006
@@ -282,7 +282,8 @@
IAX_RTAUTOCLEAR = (1 << 19), /*!< erase me on expire */
IAX_FORCEJITTERBUF = (1 << 20), /*!< Force jitterbuffer, even when bridged to a channel that can take jitter */
IAX_RTIGNOREREGEXPIRE = (1 << 21), /*!< When using realtime, ignore registration expiration */
- IAX_TRUNKTIMESTAMPS = (1 << 22) /*!< Send trunk timestamps */
+ IAX_TRUNKTIMESTAMPS = (1 << 22), /*!< Send trunk timestamps */
+ IAX_TRANSFERMEDIA = (1 << 23) /*!< When doing IAX2 transfers, transfer media only */
} iax2_flags;
static int global_rtautoclear = 120;
@@ -406,7 +407,13 @@
TRANSFER_BEGIN,
TRANSFER_READY,
TRANSFER_RELEASED,
- TRANSFER_PASSTHROUGH
+ TRANSFER_PASSTHROUGH,
+ TRANSFER_MBEGIN,
+ TRANSFER_MREADY,
+ TRANSFER_MRELEASED,
+ TRANSFER_MPASSTHROUGH,
+ TRANSFER_MEDIA,
+ TRANSFER_MEDIAPASS
};
struct iax2_registry {
@@ -775,38 +782,36 @@
static ast_mutex_t iaxsl[IAX_MAX_CALLS];
static struct timeval lastused[IAX_MAX_CALLS];
-
+static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
+static int expire_registry(void *data);
+static int iax2_answer(struct ast_channel *c);
+static int iax2_call(struct ast_channel *c, char *dest, int timeout);
+static int iax2_devicestate(void *data);
+static int iax2_digit(struct ast_channel *c, char digit);
+static int iax2_do_register(struct iax2_registry *reg);
+static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan);
+static int iax2_hangup(struct ast_channel *c);
+static int iax2_indicate(struct ast_channel *c, int condition);
+static int iax2_poke_peer(struct iax2_peer *peer, int heldcall);
+static int iax2_provision(struct sockaddr_in *end, int sockfd, char *dest, const char *template, int force);
+static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final);
+static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen);
+static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img);
+static int iax2_sendtext(struct ast_channel *c, const char *text);
+static int iax2_setoption(struct ast_channel *c, int option, void *data, int datalen);
+static int iax2_transfer(struct ast_channel *c, const char *dest);
+static int iax2_write(struct ast_channel *c, struct ast_frame *f);
static int send_command(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_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
static int send_command_locked(unsigned short callno, char, int, unsigned int, const unsigned char *, int, int);
-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 ast_channel *iax2_request(const char *type, int format, void *data, int *cause);
+static struct ast_frame *iax2_read(struct ast_channel *c);
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 int iax2_write(struct ast_channel *c, struct ast_frame *f);
-static int iax2_do_register(struct iax2_registry *reg);
static void prune_peers(void);
-static int iax2_poke_peer(struct iax2_peer *peer, int heldcall);
-static int iax2_provision(struct sockaddr_in *end, int sockfd, char *dest, const char *template, int force);
-
-static struct ast_channel *iax2_request(const char *type, int format, void *data, int *cause);
-static int iax2_devicestate(void *data);
-static int iax2_digit(struct ast_channel *c, char digit);
-static int iax2_sendtext(struct ast_channel *c, const char *text);
-static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img);
-static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen);
-static int iax2_call(struct ast_channel *c, char *dest, int timeout);
-static int iax2_hangup(struct ast_channel *c);
-static int iax2_answer(struct ast_channel *c);
-static struct ast_frame *iax2_read(struct ast_channel *c);
-static int iax2_write(struct ast_channel *c, struct ast_frame *f);
-static int iax2_indicate(struct ast_channel *c, int condition);
-static int iax2_setoption(struct ast_channel *c, int option, void *data, int datalen);
-static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
-static int iax2_transfer(struct ast_channel *c, const char *dest);
-static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan);
static const struct ast_channel_tech iax2_tech = {
.type = "IAX2",
@@ -1260,7 +1265,7 @@
iaxs[x]->pingid = ast_sched_add(sched, ping_time * 1000, send_ping, (void *)(long)x);
iaxs[x]->lagid = ast_sched_add(sched, lagrq_time * 1000, send_lagrq, (void *)(long)x);
iaxs[x]->amaflags = amaflags;
- ast_copy_flags(iaxs[x], (&globalflags), IAX_NOTRANSFER | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+ ast_copy_flags(iaxs[x], (&globalflags), IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
ast_copy_string(iaxs[x]->accountcode, accountcode, sizeof(iaxs[x]->accountcode));
} else {
ast_log(LOG_WARNING, "Out of resources\n");
@@ -1562,8 +1567,6 @@
}
ast_mutex_unlock(&waresl.lock);
}
-
-static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final);
static int __do_deliver(void *data)
{
@@ -2948,7 +2951,7 @@
return -1;
}
- ast_copy_flags(cai, peer, IAX_SENDANI | IAX_TRUNK | IAX_NOTRANSFER | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+ ast_copy_flags(cai, peer, IAX_SENDANI | IAX_TRUNK | IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
cai->maxtime = peer->maxms;
cai->capability = peer->capability;
cai->encmethods = peer->encmethods;
@@ -3295,7 +3298,7 @@
return &ast_null_frame;
}
-static int iax2_start_transfer(unsigned short callno0, unsigned short callno1)
+static int iax2_start_transfer(unsigned short callno0, unsigned short callno1, int mediaonly)
{
int res;
struct iax_ie_data ied0;
@@ -3317,8 +3320,8 @@
res = send_command(iaxs[callno1], AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied1.buf, ied1.pos, -1);
if (res)
return -1;
- iaxs[callno0]->transferring = TRANSFER_BEGIN;
- iaxs[callno1]->transferring = TRANSFER_BEGIN;
+ iaxs[callno0]->transferring = mediaonly ? TRANSFER_MBEGIN : TRANSFER_BEGIN;
+ iaxs[callno1]->transferring = mediaonly ? TRANSFER_MBEGIN : TRANSFER_BEGIN;
return 0;
}
@@ -3395,10 +3398,10 @@
return AST_BRIDGE_FAILED_NOWARN;
}
/* check if transfered and if we really want native bridging */
- if (!transferstarted && !ast_test_flag(iaxs[callno0], IAX_NOTRANSFER) && !ast_test_flag(iaxs[callno1], IAX_NOTRANSFER) &&
- !(flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1))) {
+ if (!transferstarted && !ast_test_flag(iaxs[callno0], IAX_NOTRANSFER) && !ast_test_flag(iaxs[callno1], IAX_NOTRANSFER)) {
/* Try the transfer */
- if (iax2_start_transfer(callno0, callno1))
+ if (iax2_start_transfer(callno0, callno1, (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1)) ||
+ ast_test_flag(iaxs[callno0], IAX_TRANSFERMEDIA) | ast_test_flag(iaxs[callno1], IAX_TRANSFERMEDIA)))
ast_log(LOG_WARNING, "Unable to start the transfer\n");
transferstarted = 1;
}
@@ -3518,9 +3521,6 @@
return send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1);
}
-
-static int iax2_write(struct ast_channel *c, struct ast_frame *f);
-
static int iax2_getpeertrunk(struct sockaddr_in sin)
{
struct iax2_peer *peer = NULL;
@@ -4130,7 +4130,9 @@
return 0;
- if ((ast_test_flag(pvt, IAX_TRUNK) || ((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)))
+ if ((ast_test_flag(pvt, IAX_TRUNK) ||
+ (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) ||
+ ((fts & 0xFFFF0000L) == ((lastsent + 0x10000) & 0xFFFF0000L))))
/* High two bytes are the same on timestamp, or sending on a trunk */ &&
(f->frametype == AST_FRAME_VOICE)
/* is a voice frame */ &&
@@ -4251,6 +4253,8 @@
fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_mini_hdr);
fr->data = mh;
fr->retries = -1;
+ if (pvt->transferring == TRANSFER_MEDIAPASS)
+ fr->transfer = 1;
if (ast_test_flag(pvt, IAX_ENCRYPTED)) {
if (ast_test_flag(pvt, IAX_KEYPOPULATED)) {
encrypt_frame(&pvt->ecx, (struct ast_iax2_full_hdr *)mh, pvt->semirand, &fr->datalen);
@@ -4262,8 +4266,6 @@
}
return res;
}
-
-
static int iax2_show_users(int fd, int argc, char *argv[])
{
@@ -5125,7 +5127,7 @@
iaxs[callno]->amaflags = user->amaflags;
if (!ast_strlen_zero(user->language))
ast_copy_string(iaxs[callno]->language, user->language, sizeof(iaxs[callno]->language));
- ast_copy_flags(iaxs[callno], user, IAX_NOTRANSFER | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+ ast_copy_flags(iaxs[callno], user, IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
/* Keep this check last */
if (!ast_strlen_zero(user->dbsecret)) {
char *family, *key=NULL;
@@ -7770,32 +7772,53 @@
}
break;
case IAX_COMMAND_TXREADY:
- if (iaxs[fr.callno]->transferring == TRANSFER_BEGIN) {
- iaxs[fr.callno]->transferring = TRANSFER_READY;
+ if ((iaxs[fr.callno]->transferring == TRANSFER_BEGIN) ||
+ (iaxs[fr.callno]->transferring == TRANSFER_MBEGIN)) {
+ if (iaxs[fr.callno]->transferring == TRANSFER_MBEGIN)
+ iaxs[fr.callno]->transferring = TRANSFER_MREADY;
+ else
+ iaxs[fr.callno]->transferring = TRANSFER_READY;
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel '%s' ready to transfer\n", iaxs[fr.callno]->owner ? iaxs[fr.callno]->owner->name : "<Unknown>");
if (iaxs[fr.callno]->bridgecallno) {
- if (iaxs[iaxs[fr.callno]->bridgecallno]->transferring == TRANSFER_READY) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Releasing %s and %s\n", iaxs[fr.callno]->owner ? iaxs[fr.callno]->owner->name : "<Unknown>",
+ if ((iaxs[iaxs[fr.callno]->bridgecallno]->transferring == TRANSFER_READY) ||
+ (iaxs[iaxs[fr.callno]->bridgecallno]->transferring == TRANSFER_MREADY)) {
+ /* They're both ready, now release them. */
+ if (iaxs[fr.callno]->transferring == TRANSFER_MREADY) {
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Attempting media bridge of %s and %s\n", iaxs[fr.callno]->owner ? iaxs[fr.callno]->owner->name : "<Unknown>",
iaxs[iaxs[fr.callno]->bridgecallno]->owner ? iaxs[iaxs[fr.callno]->bridgecallno]->owner->name : "<Unknown>");
- /* They're both ready, now release them. */
- iaxs[iaxs[fr.callno]->bridgecallno]->transferring = TRANSFER_RELEASED;
- iaxs[fr.callno]->transferring = TRANSFER_RELEASED;
- ast_set_flag(iaxs[iaxs[fr.callno]->bridgecallno], IAX_ALREADYGONE);
- ast_set_flag(iaxs[fr.callno], IAX_ALREADYGONE);
-
- /* Stop doing lag & ping requests */
- stop_stuff(fr.callno);
- stop_stuff(iaxs[fr.callno]->bridgecallno);
-
- memset(&ied0, 0, sizeof(ied0));
- memset(&ied1, 0, sizeof(ied1));
- iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr.callno]->bridgecallno]->peercallno);
- iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr.callno]->peercallno);
- send_command(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos, -1);
- send_command(iaxs[iaxs[fr.callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos, -1);
+ iaxs[iaxs[fr.callno]->bridgecallno]->transferring = TRANSFER_MEDIA;
+ iaxs[fr.callno]->transferring = TRANSFER_MEDIA;
+
+ memset(&ied0, 0, sizeof(ied0));
+ memset(&ied1, 0, sizeof(ied1));
+ iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr.callno]->bridgecallno]->peercallno);
+ iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr.callno]->peercallno);
+ send_command(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied0.buf, ied0.pos, -1);
+ send_command(iaxs[iaxs[fr.callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied1.buf, ied1.pos, -1);
+ } else {
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Releasing %s and %s\n", iaxs[fr.callno]->owner ? iaxs[fr.callno]->owner->name : "<Unknown>",
+ iaxs[iaxs[fr.callno]->bridgecallno]->owner ? iaxs[iaxs[fr.callno]->bridgecallno]->owner->name : "<Unknown>");
+
+ iaxs[iaxs[fr.callno]->bridgecallno]->transferring = TRANSFER_RELEASED;
+ iaxs[fr.callno]->transferring = TRANSFER_RELEASED;
+ ast_set_flag(iaxs[iaxs[fr.callno]->bridgecallno], IAX_ALREADYGONE);
+ ast_set_flag(iaxs[fr.callno], IAX_ALREADYGONE);
+
+ /* Stop doing lag & ping requests */
+ stop_stuff(fr.callno);
+ stop_stuff(iaxs[fr.callno]->bridgecallno);
+
+ memset(&ied0, 0, sizeof(ied0));
+ memset(&ied1, 0, sizeof(ied1));
+ iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr.callno]->bridgecallno]->peercallno);
+ iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr.callno]->peercallno);
+ send_command(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos, -1);
+ send_command(iaxs[iaxs[fr.callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos, -1);
+ }
}
}
@@ -7813,6 +7836,12 @@
send_command_immediate(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr.ts, NULL, 0,fr.iseqno);
complete_transfer(fr.callno, &ies);
stop_stuff(fr.callno); /* for attended transfer to work with libiax */
+ break;
+ case IAX_COMMAND_TXMEDIA:
+ if (iaxs[fr.callno]->transferring == TRANSFER_READY) {
+ /* Start sending our media to the transfer address, but otherwise leave the call as-is */
+ iaxs[fr.callno]->transferring = TRANSFER_MEDIAPASS;
+ }
break;
case IAX_COMMAND_DPREP:
complete_dpreply(iaxs[fr.callno], &ies);
@@ -8288,7 +8317,7 @@
memset(&cai, 0, sizeof(cai));
cai.capability = iax2_capability;
- ast_copy_flags(&cai, &globalflags, IAX_NOTRANSFER | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+ ast_copy_flags(&cai, &globalflags, IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
if (!pds.peer) {
ast_log(LOG_WARNING, "No peer given\n");
@@ -8315,7 +8344,7 @@
ast_mutex_lock(&iaxsl[callno]);
/* If this is a trunk, update it now */
- ast_copy_flags(iaxs[callno], &cai, IAX_TRUNK | IAX_SENDANI | IAX_NOTRANSFER | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
+ ast_copy_flags(iaxs[callno], &cai, IAX_TRUNK | IAX_SENDANI | IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
if (ast_test_flag(&cai, IAX_TRUNK))
callno = make_trunk(callno, 1);
iaxs[callno]->maxtime = cai.maxtime;
@@ -8639,7 +8668,16 @@
} else if (!strcasecmp(v->name, "encryption")) {
peer->encmethods = get_encrypt_methods(v->value);
} else if (!strcasecmp(v->name, "notransfer")) {
+ ast_log(LOG_NOTICE, "The option 'notransfer' is deprecated in favor of 'transfer' which has options 'yes', 'no', and 'mediaonly'\n");
+ ast_clear_flag(peer, IAX_TRANSFERMEDIA);
ast_set2_flag(peer, ast_true(v->value), IAX_NOTRANSFER);
+ } else if (!strcasecmp(v->name, "transfer")) {
+ if (!strcasecmp(v->value, "mediaonly")) {
+ ast_set_flags_to(peer, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_TRANSFERMEDIA);
+ } else if (ast_true(v->value)) {
+ ast_set_flags_to(peer, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, 0);
+ } else
+ ast_set_flags_to(peer, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_NOTRANSFER);
} else if (!strcasecmp(v->name, "jitterbuffer")) {
ast_set2_flag(peer, ast_true(v->value), IAX_USEJITTERBUF);
} else if (!strcasecmp(v->name, "forcejitterbuffer")) {
@@ -8832,7 +8870,16 @@
} else if (!strcasecmp(v->name, "encryption")) {
user->encmethods = get_encrypt_methods(v->value);
} else if (!strcasecmp(v->name, "notransfer")) {
+ ast_log(LOG_NOTICE, "The option 'notransfer' is deprecated in favor of 'transfer' which has options 'yes', 'no', and 'mediaonly'\n");
+ ast_clear_flag(user, IAX_TRANSFERMEDIA);
ast_set2_flag(user, ast_true(v->value), IAX_NOTRANSFER);
+ } else if (!strcasecmp(v->name, "transfer")) {
+ if (!strcasecmp(v->value, "mediaonly")) {
+ ast_set_flags_to(user, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_TRANSFERMEDIA);
+ } else if (ast_true(v->value)) {
+ ast_set_flags_to(user, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, 0);
+ } else
+ ast_set_flags_to(user, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_NOTRANSFER);
} else if (!strcasecmp(v->name, "codecpriority")) {
if(!strcasecmp(v->value, "caller"))
ast_set_flag(user, IAX_CODEC_USER_FIRST);
@@ -9153,9 +9200,18 @@
authdebug = ast_true(v->value);
else if (!strcasecmp(v->name, "encryption"))
iax2_encryption = get_encrypt_methods(v->value);
- else if (!strcasecmp(v->name, "notransfer"))
+ else if (!strcasecmp(v->name, "notransfer")) {
+ ast_log(LOG_NOTICE, "The option 'notransfer' is deprecated in favor of 'transfer' which has options 'yes', 'no', and 'mediaonly'\n");
+ ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);
ast_set2_flag((&globalflags), ast_true(v->value), IAX_NOTRANSFER);
- else if (!strcasecmp(v->name, "codecpriority")) {
+ } else if (!strcasecmp(v->name, "transfer")) {
+ if (!strcasecmp(v->value, "mediaonly")) {
+ ast_set_flags_to((&globalflags), IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_TRANSFERMEDIA);
+ } else if (ast_true(v->value)) {
+ ast_set_flags_to((&globalflags), IAX_NOTRANSFER|IAX_TRANSFERMEDIA, 0);
+ } else
+ ast_set_flags_to((&globalflags), IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_NOTRANSFER);
+ } else if (!strcasecmp(v->name, "codecpriority")) {
if(!strcasecmp(v->value, "caller"))
ast_set_flag((&globalflags), IAX_CODEC_USER_FIRST);
else if(!strcasecmp(v->value, "disabled"))
@@ -9304,6 +9360,7 @@
amaflags = 0;
delayreject = 0;
ast_clear_flag((&globalflags), IAX_NOTRANSFER);
+ ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);
ast_clear_flag((&globalflags), IAX_USEJITTERBUF);
ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF);
delete_users();
Modified: team/group/asterisk-xmpp/channels/chan_sip.c
[... 1064 lines stripped ...]
More information about the asterisk-commits
mailing list