[asterisk-commits] branch murf/AEL2 r22156 - in /team/murf/AEL2: ./
apps/ channels/ include/aste...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Apr 22 11:21:30 MST 2006
Author: murf
Date: Sat Apr 22 13:21:30 2006
New Revision: 22156
URL: http://svn.digium.com/view/asterisk?rev=22156&view=rev
Log:
Merged revisions 22075-22076,22078,22082,22128 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r22075 | rizzo | 2006-04-21 14:28:32 -0600 (Fri, 21 Apr 2006) | 5 lines
move wait_and_stream to ast_wait_and_stream() because equivalent
code is replicated in way too many places not to have a global
function for that.
........
r22076 | rizzo | 2006-04-21 14:39:50 -0600 (Fri, 21 Apr 2006) | 3 lines
convert to use ast_stream_and_wait
........
r22078 | rizzo | 2006-04-21 14:51:55 -0600 (Fri, 21 Apr 2006) | 3 lines
convert to use ast_strem_and_wait
........
r22082 | rizzo | 2006-04-21 14:57:29 -0600 (Fri, 21 Apr 2006) | 3 lines
convert to use ast_stream_and_wait
........
r22128 | jdixon | 2006-04-22 05:30:06 -0600 (Sat, 22 Apr 2006) | 3 lines
Added "Operator Services" connection mode for Zap channels, and the 'O' option
in app_dial to support the use of this mode.
........
Modified:
team/murf/AEL2/ (props changed)
team/murf/AEL2/app.c
team/murf/AEL2/apps/app_dial.c
team/murf/AEL2/apps/app_directory.c
team/murf/AEL2/apps/app_voicemail.c
team/murf/AEL2/channel.c
team/murf/AEL2/channels/chan_zap.c
team/murf/AEL2/file.c
team/murf/AEL2/include/asterisk/file.h
team/murf/AEL2/include/asterisk/frame.h
team/murf/AEL2/res/res_features.c
Propchange: team/murf/AEL2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr 22 13:21:30 2006
@@ -1,1 +1,1 @@
-/trunk:1-22053
+/trunk:1-22155
Modified: team/murf/AEL2/app.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/app.c?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/app.c (original)
+++ team/murf/AEL2/app.c Sat Apr 22 13:21:30 2006
@@ -155,10 +155,7 @@
struct ast_dsp *sildet;
/* Play prompt if requested */
if (prompt) {
- res = ast_streamfile(c, prompt, c->language);
- if (res < 0)
- return res;
- res = ast_waitstream(c,"");
+ res = ast_stream_and_wait(c, prompt, c->language, "");
if (res < 0)
return res;
}
@@ -573,9 +570,7 @@
if (playfile) {
d = ast_play_and_wait(chan, playfile);
if (d > -1)
- d = ast_streamfile(chan, "beep",chan->language);
- if (!d)
- d = ast_waitstream(chan,"");
+ d = ast_stream_and_wait(chan, "beep", chan->language, "");
if (d < 0)
return -1;
}
@@ -749,8 +744,7 @@
}
if (outmsg > 1) {
/* Let them know recording is stopped */
- if(!ast_streamfile(chan, "auth-thankyou", chan->language))
- ast_waitstream(chan, "");
+ ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
}
if (sildet)
ast_dsp_free(sildet);
@@ -794,9 +788,7 @@
if (!beep)
d = ast_play_and_wait(chan, playfile);
if (d > -1)
- d = ast_streamfile(chan, "beep",chan->language);
- if (!d)
- d = ast_waitstream(chan,"");
+ d = ast_stream_and_wait(chan, "beep",chan->language, "");
if (d < 0)
return -1;
}
@@ -981,8 +973,7 @@
}
if (outmsg > 1) {
/* Let them know it worked */
- ast_streamfile(chan, "auth-thankyou", chan->language);
- ast_waitstream(chan, "");
+ ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
}
return res;
}
@@ -1205,16 +1196,14 @@
cmd = '3';
break;
} else {
- ast_streamfile(chan, "vm-msgsaved", chan->language);
- ast_waitstream(chan, "");
+ ast_stream_and_wait(chan, "vm-msgsaved", chan->language, "");
cmd = 't';
return res;
}
case '2':
/* Review */
ast_verbose(VERBOSE_PREFIX_3 "Reviewing the recording\n");
- ast_streamfile(chan, recordfile, chan->language);
- cmd = ast_waitstream(chan, AST_DIGIT_ANY);
+ cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY);
break;
case '3':
message_exists = 0;
@@ -1300,19 +1289,15 @@
case AST_ACTION_NOOP:
return 0;
case AST_ACTION_BACKGROUND:
- res = ast_streamfile(chan, (char *)option->adata, chan->language);
- if (!res) {
- res = ast_waitstream(chan, AST_DIGIT_ANY);
- } else {
+ res = ast_stream_and_wait(chan, (char *)option->adata, chan->language, AST_DIGIT_ANY);
+ if (res < 0) {
ast_log(LOG_NOTICE, "Unable to find file '%s'!\n", (char *)option->adata);
res = 0;
}
return res;
case AST_ACTION_PLAYBACK:
- res = ast_streamfile(chan, (char *)option->adata, chan->language);
- if (!res) {
- res = ast_waitstream(chan, "");
- } else {
+ res = ast_stream_and_wait(chan, (char *)option->adata, chan->language, "");
+ if (res < 0) {
ast_log(LOG_NOTICE, "Unable to find file '%s'!\n", (char *)option->adata);
res = 0;
}
@@ -1339,11 +1324,13 @@
case AST_ACTION_BACKLIST:
res = 0;
c = ast_strdupa(option->adata);
- while ((n = strsep(&c, ";"))) {
- if ((res = ast_streamfile(chan, n, chan->language)) || (res = ast_waitstream(chan, (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
- break;
- }
- ast_stopstream(chan);
+ if (c) {
+ while((n = strsep(&c, ";")))
+ if ((res = ast_stream_and_wait(chan, n, chan->language,
+ (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
+ break;
+ ast_stopstream(chan);
+ }
return res;
default:
ast_log(LOG_NOTICE, "Unknown dispatch function %d, ignoring!\n", option->action);
Modified: team/murf/AEL2/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/apps/app_dial.c?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/apps/app_dial.c (original)
+++ team/murf/AEL2/apps/app_dial.c Sat Apr 22 13:21:30 2006
@@ -154,6 +154,16 @@
" o - Specify that the CallerID that was present on the *calling* channel\n"
" be set as the CallerID on the *called* channel. This was the\n"
" behavior of Asterisk 1.0 and earlier.\n"
+" O([x]) - \"Operator Services\" mode (Zaptel channel to Zaptel channel\n"
+" only, if specified on non-Zaptel interface, it will be ignored).\n"
+" When the destination answers (presumably an operator services\n"
+" station), the originator no longer has control of their line.\n"
+" They may hang up, but the switch will not release their line\n"
+" until the destination party hangs up (the operator). Specified\n"
+" without an arg, or with 1 as an arg, the originator hanging up\n"
+" will cause the phone to ring back immediately. With a 2 specified,\n"
+" when the \"operator\" flashes the trunk, it will ring their phone\n"
+" back.\n"
" p - This option enables screening mode. This is basically Privacy mode\n"
" without memory.\n"
" P([x]) - Enable privacy mode. Use 'x' as the family/key in the database if\n"
@@ -213,6 +223,7 @@
OPT_CALLEE_MONITOR = (1 << 21),
OPT_CALLER_MONITOR = (1 << 22),
OPT_GOTO = (1 << 23),
+ OPT_OPERMODE = (1 << 24),
} dial_exec_option_flags;
#define DIAL_STILLGOING (1 << 30)
@@ -227,6 +238,7 @@
OPT_ARG_CALLEE_MACRO,
OPT_ARG_PRIVACY,
OPT_ARG_DURATION_STOP,
+ OPT_ARG_OPERMODE,
/* note: this entry _MUST_ be the last one in the enum */
OPT_ARG_ARRAY_SIZE,
} dial_exec_option_args;
@@ -247,6 +259,7 @@
AST_APP_OPTION_ARG('M', OPT_CALLEE_MACRO, OPT_ARG_CALLEE_MACRO),
AST_APP_OPTION('n', OPT_SCREEN_NOINTRO),
AST_APP_OPTION('N', OPT_SCREEN_NOCLID),
+ AST_APP_OPTION_ARG('O', OPT_OPERMODE,OPT_ARG_OPERMODE),
AST_APP_OPTION('o', OPT_ORIGINAL_CLID),
AST_APP_OPTION('p', OPT_SCREENING),
AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
@@ -744,6 +757,7 @@
char privintro[1024];
char privcid[256];
char *parse;
+ int opermode = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(peers);
AST_APP_ARG(timeout);
@@ -772,6 +786,14 @@
if (ast_strlen_zero(args.peers)) {
ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
goto done;
+ }
+
+ if (ast_test_flag(&opts, OPT_OPERMODE)) {
+ if (ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]))
+ opermode = 1;
+ else opermode = atoi(opt_args[OPT_ARG_OPERMODE]);
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Setting operator services mode to %d.\n", opermode);
}
if (ast_test_flag(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
@@ -1483,6 +1505,17 @@
res = -1;
goto done;
}
+ if (opermode && (!strncmp(chan->name,"Zap",3)) &&
+ (!strncmp(peer->name,"Zap",3)))
+ {
+ struct oprmode oprmode;
+
+ oprmode.peer = peer;
+ oprmode.mode = opermode;
+
+ ast_channel_setoption(chan,
+ AST_OPTION_OPRMODE,&oprmode,sizeof(struct oprmode),0);
+ }
res = ast_bridge_call(chan,peer,&config);
time(&end_time);
{
Modified: team/murf/AEL2/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/apps/app_directory.c?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/apps/app_directory.c (original)
+++ team/murf/AEL2/apps/app_directory.c Sat Apr 22 13:21:30 2006
@@ -168,47 +168,32 @@
(char *)ast_config_AST_SPOOL_DIR, ext);
if (ast_fileexists(fn, NULL, chan->language) > 0) {
- res = ast_streamfile(chan, fn, chan->language);
- if (!res) {
- res = ast_waitstream(chan, AST_DIGIT_ANY);
- }
+ res = ast_stream_and_wait(chan, fn, chan->language, AST_DIGIT_ANY);
ast_stopstream(chan);
/* If Option 'e' was specified, also read the extension number with the name */
if (readext) {
- res = ast_streamfile(chan, "vm-extension", chan->language);
- if (!res)
- res = ast_waitstream(chan, AST_DIGIT_ANY);
+ ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
}
} else if (ast_fileexists(fn2, NULL, chan->language) > 0) {
- res = ast_streamfile(chan, fn2, chan->language);
- if (!res)
- res = ast_waitstream(chan, AST_DIGIT_ANY);
+ res = ast_stream_and_wait(chan, fn2, chan->language, AST_DIGIT_ANY);
ast_stopstream(chan);
/* If Option 'e' was specified, also read the extension number with the name */
if (readext) {
- res = ast_streamfile(chan, "vm-extension", chan->language);
- if (!res) {
- res = ast_waitstream(chan, AST_DIGIT_ANY);
- }
+ ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
}
} else {
- res = ast_say_character_str(chan, S_OR(name, ext),
- AST_DIGIT_ANY, chan->language);
+ res = ast_say_character_str(chan, S_OR(name, ext), AST_DIGIT_ANY, chan->language);
if (!ast_strlen_zero(name) && readext) {
- res = ast_streamfile(chan, "vm-extension", chan->language);
- if (!res)
- res = ast_waitstream(chan, AST_DIGIT_ANY);
+ ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
}
}
while (loop) {
if (!res)
- res = ast_streamfile(chan, "dir-instr", chan->language);
- if (!res)
- res = ast_waitstream(chan, AST_DIGIT_ANY);
+ res = ast_stream_and_wait(chan, "dir-instr", chan->language, AST_DIGIT_ANY);
if (!res)
res = ast_waitfordigit(chan, 3000);
ast_stopstream(chan);
@@ -479,9 +464,7 @@
for (;;) {
if (!res)
- res = ast_streamfile(chan, dirintro, chan->language);
- if (!res)
- res = ast_waitstream(chan, AST_DIGIT_ANY);
+ res = ast_stream_and_wait(chan, dirintro, chan->language, AST_DIGIT_ANY);
ast_stopstream(chan);
if (!res)
res = ast_waitfordigit(chan, 5000);
Modified: team/murf/AEL2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/apps/app_voicemail.c?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/apps/app_voicemail.c (original)
+++ team/murf/AEL2/apps/app_voicemail.c Sat Apr 22 13:21:30 2006
@@ -1909,12 +1909,7 @@
snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
RETRIEVE(fn, -1);
if (ast_fileexists(fn, NULL, NULL) > 0) {
- res = ast_streamfile(chan, fn, chan->language);
- if (res) {
- DISPOSE(fn, -1);
- return -1;
- }
- res = ast_waitstream(chan, ecodes);
+ res = ast_stream_and_wait(chan, fn, chan->language, ecodes);
if (res) {
DISPOSE(fn, -1);
return res;
@@ -1922,20 +1917,14 @@
} else {
/* Dispose just in case */
DISPOSE(fn, -1);
- res = ast_streamfile(chan, "vm-theperson", chan->language);
- if (res)
- return -1;
- res = ast_waitstream(chan, ecodes);
+ res = ast_stream_and_wait(chan, "vm-theperson", chan->language, ecodes);
if (res)
return res;
res = ast_say_digit_str(chan, ext, ecodes, chan->language);
if (res)
return res;
}
- res = ast_streamfile(chan, busy ? "vm-isonphone" : "vm-isunavail", chan->language);
- if (res)
- return -1;
- res = ast_waitstream(chan, ecodes);
+ res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", chan->language, ecodes);
return res;
}
@@ -2459,9 +2448,7 @@
res = 0;
}
if (!res && !ast_test_flag(options, OPT_SILENT)) {
- res = ast_streamfile(chan, INTRO, chan->language);
- if (!res)
- res = ast_waitstream(chan, ecodes);
+ res = ast_stream_and_wait(chan, INTRO, chan->language, ecodes);
if (res == '#') {
ast_set_flag(options, OPT_SILENT);
res = 0;
@@ -2536,9 +2523,7 @@
/* Now play the beep once we have the message number for our next message. */
if (res >= 0) {
/* Unless we're *really* silent, try to send the beep */
- res = ast_streamfile(chan, "beep", chan->language);
- if (!res)
- res = ast_waitstream(chan, "");
+ res = ast_stream_and_wait(chan, "beep", chan->language, "");
}
if (msgnum < vmu->maxmsg) {
/* assign a variable with the name of the voicemail file */
@@ -2624,9 +2609,7 @@
pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
} else {
ast_unlock_path(dir);
- res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
- if (!res)
- res = ast_waitstream(chan, "");
+ res = ast_stream_and_wait(chan, "vm-mailboxfull", chan->language, "");
ast_log(LOG_WARNING, "No more messages possible\n");
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
}
@@ -3574,10 +3557,8 @@
static int wait_file2(struct ast_channel *chan, struct vm_state *vms, char *file)
{
int res;
- if ((res = ast_streamfile(chan, file, chan->language)))
+ if ((res = ast_stream_and_wait(chan, file, chan->language, AST_DIGIT_ANY)) < 0)
ast_log(LOG_WARNING, "Unable to play message %s\n", file);
- if (!res)
- res = ast_waitstream(chan, AST_DIGIT_ANY);
return res;
}
@@ -3694,8 +3675,7 @@
ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid);
if (!callback)
res = wait_file2(chan, vms, "vm-from");
- res = ast_streamfile(chan, prefile, chan->language) > -1;
- res = ast_waitstream(chan, "");
+ res = ast_stream_and_wait(chan, prefile, chan->language, "");
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: message from '%s'\n", callerid);
@@ -6691,8 +6671,7 @@
/* Otherwise 1 is to save the existing message */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
- ast_streamfile(chan, "vm-msgsaved", chan->language);
- ast_waitstream(chan, "");
+ ast_stream_and_wait(chan, "vm-msgsaved", chan->language, "");
STORE(recordfile, vmu->mailbox, vmu->context, -1);
DISPOSE(recordfile, -1);
cmd = 't';
@@ -6702,8 +6681,7 @@
/* Review */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n");
- ast_streamfile(chan, recordfile, chan->language);
- cmd = ast_waitstream(chan, AST_DIGIT_ANY);
+ cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY);
break;
case '3':
message_exists = 0;
Modified: team/murf/AEL2/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/channel.c?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/channel.c (original)
+++ team/murf/AEL2/channel.c Sat Apr 22 13:21:30 2006
@@ -3230,24 +3230,20 @@
}
if (!strcmp(sound,"timeleft")) { /* Queue support */
- ast_streamfile(chan, "vm-youhave", chan->language);
- ast_waitstream(chan, "");
+ ast_stream_and_wait(chan, "vm-youhave", chan->language, "");
if (min) {
ast_say_number(chan, min, AST_DIGIT_ANY, chan->language, NULL);
- ast_streamfile(chan, "queue-minutes", chan->language);
- ast_waitstream(chan, "");
+ ast_stream_and_wait(chan, "queue-minutes", chan->language, "");
}
if (sec) {
ast_say_number(chan, sec, AST_DIGIT_ANY, chan->language, NULL);
- ast_streamfile(chan, "queue-seconds", chan->language);
- ast_waitstream(chan, "");
+ ast_stream_and_wait(chan, "queue-seconds", chan->language, "");
}
} else {
- ast_streamfile(chan, sound, chan->language);
- ast_waitstream(chan, "");
- }
-
- check = ast_autoservice_stop(peer);
+ ast_stream_and_wait(chan, sound, chan->language, "");
+ }
+
+ ast_autoservice_stop(peer);
}
static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct ast_channel *c1,
Modified: team/murf/AEL2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/channels/chan_zap.c?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/channels/chan_zap.c (original)
+++ team/murf/AEL2/channels/chan_zap.c Sat Apr 22 13:21:30 2006
@@ -543,6 +543,8 @@
int sig; /*!< Signalling style */
int radio; /*!< radio type */
int outsigmod; /*!< Outbound Signalling style (modifier) */
+ int oprmode; /*!< "Operator Services" mode */
+ struct zt_pvt *oprpeer; /*!< "Operator Services" peer tech_pvt ptr */
float rxgain;
float txgain;
int tonezone; /*!< tone zone for this chan, or -1 for default */
@@ -1771,7 +1773,7 @@
return -1;
}
p->dialednone = 0;
- if (p->radio) /* if a radio channel, up immediately */
+ if ((p->radio || (p->oprmode < 0))) /* if a radio channel, up immediately */
{
/* Special pseudo -- automatically up */
ast_setstate(ast, AST_STATE_UP);
@@ -2616,7 +2618,7 @@
ast_log(LOG_DEBUG, "Hanging up channel %d, offhook = %d\n", p->channel, par.rxisoffhook);
#endif
/* If they're off hook, try playing congestion */
- if ((par.rxisoffhook) && (!p->radio))
+ if ((par.rxisoffhook) && (!(p->radio || (p->oprmode < 0))))
tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
else
tone_zone_play_tone(p->subs[SUB_REAL].zfd, -1);
@@ -2676,6 +2678,7 @@
p->callwaitingrepeat = 0;
p->cidcwexpire = 0;
+ p->oprmode = 0;
ast->tech_pvt = NULL;
ast_mutex_unlock(&p->lock);
ast_mutex_lock(&usecnt_lock);
@@ -2717,7 +2720,7 @@
if (index < 0)
index = SUB_REAL;
/* nothing to do if a radio channel */
- if (p->radio) {
+ if ((p->radio || (p->oprmode < 0))) {
ast_mutex_unlock(&p->lock);
return 0;
}
@@ -2803,7 +2806,9 @@
signed char *scp;
int x;
int index;
- struct zt_pvt *p = chan->tech_pvt;
+ struct zt_pvt *p = chan->tech_pvt,*pp;
+ struct oprmode *oprmode;
+
/* all supported options require data */
if (!data || (datalen < 1)) {
@@ -2938,6 +2943,22 @@
}
if (ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &x) == -1)
ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d\n", p->channel, x);
+ break;
+ case AST_OPTION_OPRMODE: /* Operator services mode */
+ oprmode = (struct oprmode *) data;
+ pp = oprmode->peer->tech_pvt;
+ p->oprmode = pp->oprmode = 0;
+ /* setup peers */
+ p->oprpeer = pp;
+ pp->oprpeer = p;
+ /* setup modes, if any */
+ if (oprmode->mode)
+ {
+ pp->oprmode = oprmode->mode;
+ p->oprmode = -oprmode->mode;
+ }
+ ast_log(LOG_DEBUG, "Set Operator Services mode, value: %d on %s/%s\n",
+ oprmode->mode, chan->name,oprmode->peer->name);;
break;
}
errno = 0;
@@ -3685,7 +3706,7 @@
break;
case ZT_EVENT_DIALCOMPLETE:
if (p->inalarm) break;
- if (p->radio) break;
+ if ((p->radio || (p->oprmode < 0))) break;
if (ioctl(p->subs[index].zfd,ZT_DIALING,&x) == -1) {
ast_log(LOG_DEBUG, "ZT_DIALING ioctl failed on %s\n",ast->name);
return NULL;
@@ -3758,6 +3779,19 @@
if (p->radio) {
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RADIO_UNKEY;
+ break;
+ }
+ if (p->oprmode < 0)
+ {
+ if (p->oprmode != -1) break;
+ if ((p->sig == SIG_FXOLS) || (p->sig == SIG_FXOKS) || (p->sig == SIG_FXOGS))
+ {
+ /* Make sure it starts ringing */
+ zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RINGOFF);
+ zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RING);
+ save_conference(p->oprpeer);
+ tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
+ }
break;
}
switch(p->sig) {
@@ -3869,11 +3903,23 @@
break;
case ZT_EVENT_RINGOFFHOOK:
if (p->inalarm) break;
- if (p->radio) {
+ if (p->oprmode < 0)
+ {
+ if ((p->sig == SIG_FXOLS) || (p->sig == SIG_FXOKS) || (p->sig == SIG_FXOGS))
+ {
+ /* Make sure it stops ringing */
+ zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RINGOFF);
+ tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].zfd, -1);
+ restore_conference(p->oprpeer);
+ }
+ break;
+ }
+ if (p->radio)
+ {
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RADIO_KEY;
break;
- }
+ }
/* for E911, its supposed to wait for offhook then dial
the second half of the dial string */
if (((mysig == SIG_E911) || (mysig == SIG_FGC_CAMA) || (mysig == SIG_FGC_CAMAMF)) && (ast->_state == AST_STATE_DIALING_OFFHOOK)) {
@@ -4038,7 +4084,7 @@
#endif
case ZT_EVENT_RINGEROFF:
if (p->inalarm) break;
- if (p->radio) break;
+ if ((p->radio || (p->oprmode < 0))) break;
ast->rings++;
if ((ast->rings > p->cidrings) && (p->cidspill)) {
ast_log(LOG_WARNING, "Didn't finish Caller-ID spill. Cancelling.\n");
@@ -4065,6 +4111,24 @@
case ZT_EVENT_WINKFLASH:
if (p->inalarm) break;
if (p->radio) break;
+ if (p->oprmode < 0) break;
+ if (p->oprmode > 1)
+ {
+ struct zt_params par;
+
+ if (ioctl(p->oprpeer->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &par) != -1)
+ {
+ if (!par.rxisoffhook)
+ {
+ /* Make sure it stops ringing */
+ zt_set_hook(p->oprpeer->subs[SUB_REAL].zfd, ZT_RINGOFF);
+ zt_set_hook(p->oprpeer->subs[SUB_REAL].zfd, ZT_RING);
+ save_conference(p);
+ tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
+ }
+ }
+ break;
+ }
/* Remember last time we got a flash-hook */
gettimeofday(&p->flashtime, NULL);
switch(mysig) {
@@ -4267,7 +4331,7 @@
break;
case ZT_EVENT_HOOKCOMPLETE:
if (p->inalarm) break;
- if (p->radio) break;
+ if ((p->radio || (p->oprmode < 0))) break;
switch(mysig) {
case SIG_FXSLS: /* only interesting for FXS */
case SIG_FXSGS:
@@ -4375,7 +4439,7 @@
p->subs[index].f.data = NULL;
- if ((!p->owner) && (!p->radio)) {
+ if ((!p->owner) && (!(p->radio || (p->oprmode < 0)))) {
/* If nobody owns us, absorb the event appropriately, otherwise
we loop indefinitely. This occurs when, during call waiting, the
other end hangs up our channel so that it no longer exists, but we
@@ -4446,7 +4510,7 @@
f = &p->subs[index].f;
return f;
}
- if (!p->radio) ast_log(LOG_DEBUG, "Exception on %d, channel %d\n", ast->fds[0],p->channel);
+ if (!(p->radio || (p->oprmode < 0))) ast_log(LOG_DEBUG, "Exception on %d, channel %d\n", ast->fds[0],p->channel);
/* If it's not us, return NULL immediately */
if (ast != p->owner) {
ast_log(LOG_WARNING, "We're %s, not %s\n", ast->name, p->owner->name);
@@ -4487,7 +4551,7 @@
return NULL;
}
- if (p->radio && p->inalarm) return NULL;
+ if ((p->radio || (p->oprmode < 0)) && p->inalarm) return NULL;
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.datalen = 0;
@@ -4500,7 +4564,7 @@
p->subs[index].f.data = NULL;
/* make sure it sends initial key state as first frame */
- if (p->radio && (!p->firstradio))
+ if ((p->radio || (p->oprmode < 0)) && (!p->firstradio))
{
ZT_PARAMS ps;
@@ -7539,7 +7603,7 @@
return 1;
}
#endif
- if (!p->radio)
+ if (!(p->radio || (p->oprmode < 0)))
{
if (!p->sig || (p->sig == SIG_FXSLS))
return 1;
Modified: team/murf/AEL2/file.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/file.c?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/file.c (original)
+++ team/murf/AEL2/file.c Sat Apr 22 13:21:30 2006
@@ -1101,6 +1101,23 @@
-1, -1, context);
}
+/*
+ * if the file name is non-empty, try to play it.
+ * Return 0 if success, -1 if error, digit if interrupted by a digit.
+ * If digits == "" then we can simply check for non-zero.
+ */
+int ast_stream_and_wait(struct ast_channel *chan, const char *file,
+ const char *language, const char *digits)
+{
+ int res = 0;
+ if (!ast_strlen_zero(file)) {
+ res = ast_streamfile(chan, file, language);
+ if (!res)
+ res = ast_waitstream(chan, digits);
+ }
+ return res;
+}
+
static int show_file_formats(int fd, int argc, char *argv[])
{
#define FORMAT "%-10s %-10s %-20s\n"
Modified: team/murf/AEL2/include/asterisk/file.h
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/include/asterisk/file.h?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/include/asterisk/file.h (original)
+++ team/murf/AEL2/include/asterisk/file.h Sat Apr 22 13:21:30 2006
@@ -162,6 +162,14 @@
*/
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang);
+/*
+ * if the file name is non-empty, try to play it.
+ * Return 0 if success, -1 if error, digit if interrupted by a digit.
+ * If digits == "" then we can simply check for non-zero.
+ */
+int ast_stream_and_wait(struct ast_channel *chan, const char *file,
+ const char *language, const char *digits);
+
/*! Stops a stream */
/*!
* \param c The channel you wish to stop playback on
Modified: team/murf/AEL2/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/include/asterisk/frame.h?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/include/asterisk/frame.h (original)
+++ team/murf/AEL2/include/asterisk/frame.h Sat Apr 22 13:21:30 2006
@@ -321,6 +321,14 @@
*/
#define AST_OPTION_RXGAIN 6
+/* set channel into "Operator Services" mode */
+#define AST_OPTION_OPRMODE 7
+
+struct oprmode {
+ struct ast_channel *peer;
+ int mode;
+} ;
+
struct ast_option_header {
/* Always keep in network byte order */
#if __BYTE_ORDER == __BIG_ENDIAN
Modified: team/murf/AEL2/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/res/res_features.c?rev=22156&r1=22155&r2=22156&view=diff
==============================================================================
--- team/murf/AEL2/res/res_features.c (original)
+++ team/murf/AEL2/res/res_features.c Sat Apr 22 13:21:30 2006
@@ -405,26 +405,6 @@
#define FEATURE_SENSE_PEER (1 << 1)
/*
- * if the file name is non-empty, try to play it.
- * Return 0 if success, -1 if error, digit if interrupted by a digit.
- * If digits == "" then we can simply check for non-zero.
- */
-/*
- *! \todo XXX there are probably many replicas of this function in the source tree,
- * that should be merged.
- */
-static int stream_and_wait(struct ast_channel *chan, const char *file, const char *language, const char *digits)
-{
- int res = 0;
- if (!ast_strlen_zero(file)) {
- res = ast_streamfile(chan, file, language);
- if (!res)
- res = ast_waitstream(chan, digits);
- }
- return res;
-}
-
-/*
* set caller and callee according to the direction
*/
static void set_peers(struct ast_channel **caller, struct ast_channel **callee,
@@ -462,7 +442,7 @@
if (!ast_strlen_zero(courtesytone)) {
if (ast_autoservice_start(callee_chan))
return -1;
- if (stream_and_wait(caller_chan, courtesytone, caller_chan->language, "")) {
+ if (ast_stream_and_wait(caller_chan, courtesytone, caller_chan->language, "")) {
ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
ast_autoservice_stop(callee_chan);
return -1;
@@ -570,7 +550,7 @@
memset(xferto, 0, sizeof(xferto));
/* Transfer */
- res = stream_and_wait(transferer, "pbx-transfer", transferer->language, AST_DIGIT_ANY);
+ res = ast_stream_and_wait(transferer, "pbx-transfer", transferer->language, AST_DIGIT_ANY);
if (res < 0) {
finishup(transferee);
return -1; /* error ? */
@@ -620,7 +600,7 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Unable to find extension '%s' in context '%s'\n", xferto, transferer_real_context);
}
- if (stream_and_wait(transferer, xferfailsound, transferee->language, AST_DIGIT_ANY) < 0 ) {
+ if (ast_stream_and_wait(transferer, xferfailsound, transferee->language, AST_DIGIT_ANY) < 0 ) {
finishup(transferee);
return -1;
}
@@ -670,7 +650,7 @@
ast_moh_start(transferee, NULL);
memset(xferto, 0, sizeof(xferto));
/* Transfer */
- res = stream_and_wait(transferer, "pbx-transfer", transferer->language, AST_DIGIT_ANY);
+ res = ast_stream_and_wait(transferer, "pbx-transfer", transferer->language, AST_DIGIT_ANY);
if (res < 0) {
finishup(transferee);
return res;
@@ -687,7 +667,7 @@
if (res == 0) {
ast_log(LOG_WARNING, "Did not read data.\n");
finishup(transferee);
- if (stream_and_wait(transferer, "beeperr", transferer->language, ""))
+ if (ast_stream_and_wait(transferer, "beeperr", transferer->language, ""))
return -1;
return FEATURE_RETURN_SUCCESS;
}
@@ -696,7 +676,7 @@
if (!ast_exists_extension(transferer, transferer_real_context, xferto, 1, transferer->cid.cid_num)) {
ast_log(LOG_WARNING, "Extension %s does not exist in context %s\n",xferto,transferer_real_context);
finishup(transferee);
- if (stream_and_wait(transferer, "beeperr", transferer->language, ""))
+ if (ast_stream_and_wait(transferer, "beeperr", transferer->language, ""))
return -1;
return FEATURE_RETURN_SUCCESS;
}
@@ -710,7 +690,7 @@
finishup(transferee);
/* any reason besides user requested cancel and busy triggers the failed sound */
if (outstate != AST_CONTROL_UNHOLD && outstate != AST_CONTROL_BUSY &&
- stream_and_wait(transferer, xferfailsound, transferer->language, ""))
+ ast_stream_and_wait(transferer, xferfailsound, transferer->language, ""))
return -1;
return FEATURE_RETURN_SUCCESS;
}
@@ -723,7 +703,7 @@
res = ast_bridge_call(transferer, newchan, &bconfig);
if (newchan->_softhangup || newchan->_state != AST_STATE_UP || !transferer->_softhangup) {
ast_hangup(newchan);
- if (stream_and_wait(transferer, xfersound, transferer->language, ""))
+ if (ast_stream_and_wait(transferer, xfersound, transferer->language, ""))
ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
finishup(transferee);
transferer->_softhangup = 0;
@@ -776,7 +756,7 @@
tobj->peer = newchan;
tobj->bconfig = *config;
- if (stream_and_wait(newchan, xfersound, newchan->language, ""))
+ if (ast_stream_and_wait(newchan, xfersound, newchan->language, ""))
ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
ast_bridge_call_thread_launch(tobj);
return -1; /* XXX meaning the channel is bridged ? */
@@ -1663,9 +1643,9 @@
ast_moh_stop(peer);
ast_indicate(peer, AST_CONTROL_UNHOLD);
if (parkedplay == 0) {
- error = stream_and_wait(chan, courtesytone, chan->language, "");
+ error = ast_stream_and_wait(chan, courtesytone, chan->language, "");
} else if (parkedplay == 1) {
- error = stream_and_wait(peer, courtesytone, chan->language, "");
+ error = ast_stream_and_wait(peer, courtesytone, chan->language, "");
} else if (parkedplay == 2) {
if (!ast_streamfile(chan, courtesytone, chan->language) &&
!ast_streamfile(peer, courtesytone, chan->language)) {
@@ -1710,7 +1690,7 @@
return res;
} else {
/*! \todo XXX Play a message XXX */
- if (stream_and_wait(chan, "pbx-invalidpark", chan->language, ""))
+ if (ast_stream_and_wait(chan, "pbx-invalidpark", chan->language, ""))
ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", "pbx-invalidpark", chan->name);
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel %s tried to talk to nonexistent parked call %d\n", chan->name, park);
More information about the asterisk-commits
mailing list