Files | |
file | app_adsiprog.c |
Program Asterisk ADSI Scripts into phone. | |
file | app_alarmreceiver.c |
Central Station Alarm receiver for Ademco Contact ID. | |
file | app_authenticate.c |
Execute arbitrary authenticate commands. | |
file | app_cdr.c |
Applications connected with CDR engine. | |
file | app_chanisavail.c |
Check if Channel is Available. | |
file | app_channelredirect.c |
ChannelRedirect application. | |
file | app_chanspy.c |
ChanSpy: Listen in on any channel. | |
file | app_controlplayback.c |
Trivial application to control playback of a sound file. | |
file | app_dahdibarge.c |
DAHDI Barge support. | |
file | app_dahdiras.c |
Execute an ISDN RAS. | |
file | app_dahdiscan.c |
DAHDI Scanner. | |
file | app_db.c |
Database access functions. | |
file | app_dial.c |
dial() & retrydial() - Trivial application to dial a channel and send an URL on answer | |
file | app_dictate.c |
Virtual Dictation Machine Application For Asterisk. | |
file | app_directed_pickup.c |
Directed Call Pickup Support. | |
file | app_directory.c |
Provide a directory of extensions. | |
file | app_disa.c |
DISA -- Direct Inward System Access Application. | |
file | app_dumpchan.c |
Application to dump channel variables. | |
file | app_echo.c |
Echo application -- play back what you hear to evaluate latency. | |
file | app_exec.c |
Exec application. | |
file | app_externalivr.c |
External IVR application interface. | |
file | app_festival.c |
Connect to festival. | |
file | app_flash.c |
App to flash a DAHDI trunk. | |
file | app_followme.c |
Find-Me Follow-Me application. | |
file | app_forkcdr.c |
Fork CDR application. | |
file | app_getcpeid.c |
Get ADSI CPE ID. | |
file | app_ices.c |
Stream to an icecast server via ICES (see contrib/asterisk-ices.xml). | |
file | app_image.c |
App to transmit an image. | |
file | app_ivrdemo.c |
IVR Demo application. | |
file | app_jack.c |
Jack Application. | |
file | app_macro.c |
Dial plan macro Implementation. | |
file | app_meetme.c |
Meet me conference bridge and Shared Line Appearances. | |
file | app_milliwatt.c |
Digital Milliwatt Test. | |
file | app_minivm.c |
MiniVoiceMail - A Minimal Voicemail System for Asterisk. | |
file | app_mixmonitor.c |
MixMonitor() - Record a call and mix the audio during the recording. | |
file | app_morsecode.c |
Morsecode application. | |
file | app_mp3.c |
Silly application to play an MP3 file -- uses mpg123. | |
file | app_nbscat.c |
Silly application to play an NBScat file -- uses nbscat8k. | |
file | app_osplookup.c |
Open Settlement Protocol (OSP) Applications. | |
file | app_page.c |
page() - Paging application | |
file | app_parkandannounce.c |
ParkAndAnnounce application for Asterisk. | |
file | app_playback.c |
Trivial application to playback a sound file. | |
file | app_privacy.c |
Block all calls without Caller*ID, require phone # to be entered. | |
file | app_queue.c |
True call queues with optional send URL on answer. | |
file | app_read.c |
Trivial application to read a variable. | |
file | app_readexten.c |
Trivial application to read an extension into a variable. | |
file | app_readfile.c |
ReadFile application -- Reads in a File for you. | |
file | app_record.c |
Trivial application to record a sound file. | |
file | app_sayunixtime.c |
SayUnixTime application. | |
file | app_senddtmf.c |
App to send DTMF digits. | |
file | app_sendtext.c |
App to transmit a text message. | |
file | app_setcallerid.c |
App to set callerid presentation. | |
file | app_skel.c |
Skeleton application. | |
file | app_sms.c |
SMS application - ETSI ES 201 912 protocol 1 implementation. | |
file | app_softhangup.c |
SoftHangup application. | |
file | app_speech_utils.c |
Speech Recognition Utility Applications. | |
file | app_stack.c |
Stack applications Gosub, Return, etc. | |
file | app_system.c |
Execute arbitrary system commands. | |
file | app_talkdetect.c |
Playback a file with audio detect. | |
file | app_test.c |
Applications to test connection and produce report in text file. | |
file | app_transfer.c |
Transfer a caller. | |
file | app_url.c |
App to transmit a URL. | |
file | app_userevent.c |
UserEvent application -- send manager event. | |
file | app_verbose.c |
Verbose logging application. | |
file | app_voicemail.c |
Comedian Mail - Voicemail System. | |
file | app_waitforring.c |
Wait for Ring Application. | |
file | app_waitforsilence.c |
Wait for Silence
| |
file | app_waituntil.c |
Sleep until the given epoch. | |
file | app_while.c |
While Loop Implementation. | |
file | app_zapateller.c |
Playback the special information tone to get rid of telemarketers. | |
file | res_ael_share.c |
Shareable AEL code -- mainly between internal and external modules. | |
file | res_realtime.c |
RealTime CLI. | |
Functions | |
static int | iax2_prov_app (struct ast_channel *chan, void *data) |
static int | pbx_builtin_answer (struct ast_channel *, void *) |
static int | pbx_builtin_background (struct ast_channel *, void *) |
static int | pbx_builtin_busy (struct ast_channel *, void *) |
static int | pbx_builtin_congestion (struct ast_channel *, void *) |
static int | pbx_builtin_execiftime (struct ast_channel *, void *) |
static int | pbx_builtin_goto (struct ast_channel *, void *) |
static int | pbx_builtin_gotoiftime (struct ast_channel *, void *) |
static int | pbx_builtin_hangup (struct ast_channel *, void *) |
static int | pbx_builtin_proceeding (struct ast_channel *, void *) |
static int | pbx_builtin_progress (struct ast_channel *, void *) |
static int | pbx_builtin_resetcdr (struct ast_channel *, void *) |
static int | pbx_builtin_ringing (struct ast_channel *, void *) |
static int | pbx_builtin_setamaflags (struct ast_channel *, void *) |
static int | pbx_builtin_wait (struct ast_channel *, void *) |
static int | pbx_builtin_waitexten (struct ast_channel *, void *) |
static int iax2_prov_app | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
iax2provision
Definition at line 11205 of file chan_iax2.c.
References ast_inet_ntoa(), ast_log(), ast_strdupa, ast_strlen_zero(), ast_verb, chan, iax2_provision(), iax2_tech, iaxs, LOG_NOTICE, PTR_TO_CALLNO, create_addr_info::sockfd, ast_channel::tech, and ast_channel::tech_pvt.
Referenced by load_module().
11206 { 11207 int res; 11208 char *sdata; 11209 char *opts; 11210 int force =0; 11211 unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt); 11212 if (ast_strlen_zero(data)) 11213 data = "default"; 11214 sdata = ast_strdupa(data); 11215 opts = strchr(sdata, '|'); 11216 if (opts) 11217 *opts='\0'; 11218 11219 if (chan->tech != &iax2_tech) { 11220 ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n"); 11221 return -1; 11222 } 11223 if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) { 11224 ast_log(LOG_NOTICE, "Can't provision something with no IP?\n"); 11225 return -1; 11226 } 11227 res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force); 11228 ast_verb(3, "Provisioned IAXY at '%s' with '%s'= %d\n", 11229 ast_inet_ntoa(iaxs[callno]->addr.sin_addr), 11230 sdata, res); 11231 return res; 11232 }
static int pbx_builtin_answer | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 7957 of file pbx.c.
References __ast_answer(), ast_channel::_state, AST_STATE_UP, ast_strlen_zero(), and chan.
07958 { 07959 int delay = 0; 07960 07961 if ((chan->_state != AST_STATE_UP) && !ast_strlen_zero(data)) 07962 delay = atoi(data); 07963 07964 if (delay < 0) { 07965 delay = 0; 07966 } 07967 07968 return __ast_answer(chan, delay, 1); 07969 }
static int pbx_builtin_background | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 8226 of file pbx.c.
References ast_channel::_state, ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_canmatch_extension(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, AST_FLAG_DISABLE_WORKAROUNDS, ast_log(), ast_matchmore_extension(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_stopstream(), ast_strdupa, ast_streamfile(), ast_strlen_zero(), ast_test_flag, ast_waitstream(), ast_waitstream_exten(), BACKGROUND_MATCHEXTEN, BACKGROUND_NOANSWER, background_opts, BACKGROUND_PLAYBACK, BACKGROUND_SKIP, chan, ast_channel::cid, ast_callerid::cid_num, ast_channel::context, ast_channel::exten, ast_flags::flags, ast_channel::language, LOG_WARNING, ast_channel::name, parse(), pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), ast_channel::priority, and strsep().
08227 { 08228 int res = 0; 08229 int mres = 0; 08230 struct ast_flags flags = {0}; 08231 char *parse, exten[2] = ""; 08232 AST_DECLARE_APP_ARGS(args, 08233 AST_APP_ARG(filename); 08234 AST_APP_ARG(options); 08235 AST_APP_ARG(lang); 08236 AST_APP_ARG(context); 08237 ); 08238 08239 if (ast_strlen_zero(data)) { 08240 ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); 08241 return -1; 08242 } 08243 08244 parse = ast_strdupa(data); 08245 08246 AST_STANDARD_APP_ARGS(args, parse); 08247 08248 if (ast_strlen_zero(args.lang)) 08249 args.lang = (char *)chan->language; /* XXX this is const */ 08250 08251 if (ast_strlen_zero(args.context)) { 08252 const char *context; 08253 ast_channel_lock(chan); 08254 if ((context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"))) { 08255 args.context = ast_strdupa(context); 08256 } else { 08257 args.context = chan->context; 08258 } 08259 ast_channel_unlock(chan); 08260 } 08261 08262 if (args.options) { 08263 if (!strcasecmp(args.options, "skip")) 08264 flags.flags = BACKGROUND_SKIP; 08265 else if (!strcasecmp(args.options, "noanswer")) 08266 flags.flags = BACKGROUND_NOANSWER; 08267 else 08268 ast_app_parse_options(background_opts, &flags, NULL, args.options); 08269 } 08270 08271 /* Answer if need be */ 08272 if (chan->_state != AST_STATE_UP) { 08273 if (ast_test_flag(&flags, BACKGROUND_SKIP)) { 08274 goto done; 08275 } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) { 08276 res = ast_answer(chan); 08277 } 08278 } 08279 08280 if (!res) { 08281 char *back = args.filename; 08282 char *front; 08283 08284 ast_stopstream(chan); /* Stop anything playing */ 08285 /* Stream the list of files */ 08286 while (!res && (front = strsep(&back, "&")) ) { 08287 if ( (res = ast_streamfile(chan, front, args.lang)) ) { 08288 ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data); 08289 res = 0; 08290 mres = 1; 08291 break; 08292 } 08293 if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) { 08294 res = ast_waitstream(chan, ""); 08295 } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) { 08296 res = ast_waitstream_exten(chan, args.context); 08297 } else { 08298 res = ast_waitstream(chan, AST_DIGIT_ANY); 08299 } 08300 ast_stopstream(chan); 08301 } 08302 } 08303 08304 /* 08305 * If the single digit DTMF is an extension in the specified context, then 08306 * go there and signal no DTMF. Otherwise, we should exit with that DTMF. 08307 * If we're in Macro, we'll exit and seek that DTMF as the beginning of an 08308 * extension in the Macro's calling context. If we're not in Macro, then 08309 * we'll simply seek that extension in the calling context. Previously, 08310 * someone complained about the behavior as it related to the interior of a 08311 * Gosub routine, and the fix (#14011) inadvertently broke FreePBX 08312 * (#14940). This change should fix both of these situations, but with the 08313 * possible incompatibility that if a single digit extension does not exist 08314 * (but a longer extension COULD have matched), it would have previously 08315 * gone immediately to the "i" extension, but will now need to wait for a 08316 * timeout. 08317 * 08318 * Later, we had to add a flag to disable this workaround, because AGI 08319 * users can EXEC Background and reasonably expect that the DTMF code will 08320 * be returned (see #16434). 08321 */ 08322 if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) && 08323 (exten[0] = res) && 08324 ast_canmatch_extension(chan, args.context, exten, 1, chan->cid.cid_num) && 08325 !ast_matchmore_extension(chan, args.context, exten, 1, chan->cid.cid_num)) { 08326 snprintf(chan->exten, sizeof(chan->exten), "%c", res); 08327 ast_copy_string(chan->context, args.context, sizeof(chan->context)); 08328 chan->priority = 0; 08329 res = 0; 08330 } 08331 done: 08332 pbx_builtin_setvar_helper(chan, "BACKGROUNDSTATUS", mres ? "FAILED" : "SUCCESS"); 08333 return res; 08334 }
static int pbx_builtin_busy | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 7927 of file pbx.c.
References ast_channel::_state, ast_cdr_busy(), AST_CONTROL_BUSY, ast_indicate(), ast_setstate(), AST_STATE_BUSY, AST_STATE_UP, chan, and wait_for_hangup().
07928 { 07929 ast_indicate(chan, AST_CONTROL_BUSY); 07930 /* Don't change state of an UP channel, just indicate 07931 busy in audio */ 07932 if (chan->_state != AST_STATE_UP) { 07933 ast_setstate(chan, AST_STATE_BUSY); 07934 ast_cdr_busy(chan->cdr); 07935 } 07936 wait_for_hangup(chan, data); 07937 return -1; 07938 }
static int pbx_builtin_congestion | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 7943 of file pbx.c.
References ast_channel::_state, AST_CONTROL_CONGESTION, ast_indicate(), ast_setstate(), AST_STATE_BUSY, AST_STATE_UP, chan, and wait_for_hangup().
07944 { 07945 ast_indicate(chan, AST_CONTROL_CONGESTION); 07946 /* Don't change state of an UP channel, just indicate 07947 congestion in audio */ 07948 if (chan->_state != AST_STATE_UP) 07949 ast_setstate(chan, AST_STATE_BUSY); 07950 wait_for_hangup(chan, data); 07951 return -1; 07952 }
static int pbx_builtin_execiftime | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 8093 of file pbx.c.
References app, ast_build_timing(), ast_check_timing(), ast_log(), ast_strdupa, ast_strlen_zero(), chan, LOG_WARNING, pbx_exec(), pbx_findapp(), s, S_OR, and strsep().
08094 { 08095 char *s, *appname; 08096 struct ast_timing timing; 08097 struct ast_app *app; 08098 static const char *usage = "ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>?<appname>[(<appargs>)]"; 08099 08100 if (ast_strlen_zero(data)) { 08101 ast_log(LOG_WARNING, "%s\n", usage); 08102 return -1; 08103 } 08104 08105 appname = ast_strdupa(data); 08106 08107 s = strsep(&appname, "?"); /* Separate the timerange and application name/data */ 08108 if (!appname) { /* missing application */ 08109 ast_log(LOG_WARNING, "%s\n", usage); 08110 return -1; 08111 } 08112 08113 if (!ast_build_timing(&timing, s)) { 08114 ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage); 08115 return -1; 08116 } 08117 08118 if (!ast_check_timing(&timing)) /* outside the valid time window, just return */ 08119 return 0; 08120 08121 /* now split appname(appargs) */ 08122 if ((s = strchr(appname, '('))) { 08123 char *e; 08124 *s++ = '\0'; 08125 if ((e = strrchr(s, ')'))) 08126 *e = '\0'; 08127 else 08128 ast_log(LOG_WARNING, "Failed to find closing parenthesis\n"); 08129 } 08130 08131 08132 if ((app = pbx_findapp(appname))) { 08133 return pbx_exec(chan, app, S_OR(s, "")); 08134 } else { 08135 ast_log(LOG_WARNING, "Cannot locate application %s\n", appname); 08136 return -1; 08137 } 08138 }
static int pbx_builtin_goto | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Goto
Definition at line 8339 of file pbx.c.
References ast_parseable_goto(), ast_verb, chan, ast_channel::context, ast_channel::exten, and ast_channel::priority.
Referenced by pbx_builtin_gotoif(), and pbx_builtin_gotoiftime().
08340 { 08341 int res = ast_parseable_goto(chan, data); 08342 if (!res) 08343 ast_verb(3, "Goto (%s,%s,%d)\n", chan->context, chan->exten, chan->priority + 1); 08344 return res; 08345 }
static int pbx_builtin_gotoiftime | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 8059 of file pbx.c.
References ast_build_timing(), ast_check_timing(), ast_debug, ast_log(), ast_strdupa, ast_strlen_zero(), chan, LOG_WARNING, pbx_builtin_goto(), s, and strsep().
08060 { 08061 char *s, *ts, *branch1, *branch2, *branch; 08062 struct ast_timing timing; 08063 08064 if (ast_strlen_zero(data)) { 08065 ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>?'labeliftrue':'labeliffalse'\n"); 08066 return -1; 08067 } 08068 08069 ts = s = ast_strdupa(data); 08070 08071 /* Separate the Goto path */ 08072 strsep(&ts, "?"); 08073 branch1 = strsep(&ts,":"); 08074 branch2 = strsep(&ts,""); 08075 08076 /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ 08077 if (ast_build_timing(&timing, s) && ast_check_timing(&timing)) 08078 branch = branch1; 08079 else 08080 branch = branch2; 08081 08082 if (ast_strlen_zero(branch)) { 08083 ast_debug(1, "Not taking any branch\n"); 08084 return 0; 08085 } 08086 08087 return pbx_builtin_goto(chan, branch); 08088 }
static int pbx_builtin_hangup | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 8029 of file pbx.c.
References AST_CAUSE_NORMAL_CLEARING, ast_log(), ast_str2cause(), ast_strlen_zero(), chan, ast_channel::hangupcause, and LOG_WARNING.
08030 { 08031 if (!ast_strlen_zero(data)) { 08032 int cause; 08033 char *endptr; 08034 08035 if ((cause = ast_str2cause(data)) > -1) { 08036 chan->hangupcause = cause; 08037 return -1; 08038 } 08039 08040 cause = strtol((const char *) data, &endptr, 10); 08041 if (cause != 0 || (data != endptr)) { 08042 chan->hangupcause = cause; 08043 return -1; 08044 } 08045 08046 ast_log(LOG_WARNING, "Invalid cause given to Hangup(): \"%s\"\n", (char *) data); 08047 } 08048 08049 if (!chan->hangupcause) { 08050 chan->hangupcause = AST_CAUSE_NORMAL_CLEARING; 08051 } 08052 08053 return -1; 08054 }
static int pbx_builtin_proceeding | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 7900 of file pbx.c.
References AST_CONTROL_PROCEEDING, ast_indicate(), and chan.
07901 { 07902 ast_indicate(chan, AST_CONTROL_PROCEEDING); 07903 return 0; 07904 }
static int pbx_builtin_progress | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 7909 of file pbx.c.
References AST_CONTROL_PROGRESS, ast_indicate(), and chan.
07910 { 07911 ast_indicate(chan, AST_CONTROL_PROGRESS); 07912 return 0; 07913 }
static int pbx_builtin_resetcdr | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 8001 of file pbx.c.
References ast_app_parse_options(), ast_cdr_reset(), ast_strdupa, ast_strlen_zero(), ast_channel::cdr, chan, ast_flags::flags, and resetcdr_opts.
08002 { 08003 char *args; 08004 struct ast_flags flags = { 0 }; 08005 08006 if (!ast_strlen_zero(data)) { 08007 args = ast_strdupa(data); 08008 ast_app_parse_options(resetcdr_opts, &flags, NULL, args); 08009 } 08010 08011 ast_cdr_reset(chan->cdr, &flags); 08012 08013 return 0; 08014 }
static int pbx_builtin_ringing | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 7918 of file pbx.c.
References AST_CONTROL_RINGING, ast_indicate(), and chan.
07919 { 07920 ast_indicate(chan, AST_CONTROL_RINGING); 07921 return 0; 07922 }
static int pbx_builtin_setamaflags | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 8019 of file pbx.c.
References ast_cdr_setamaflags(), and chan.
08020 { 08021 /* Copy the AMA Flags as specified */ 08022 ast_cdr_setamaflags(chan, data ? data : ""); 08023 return 0; 08024 }
static int pbx_builtin_wait | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 8143 of file pbx.c.
References ast_safe_sleep(), chan, and s.
08144 { 08145 double s; 08146 int ms; 08147 08148 /* Wait for "n" seconds */ 08149 if (data && (s = atof(data)) > 0.0) { 08150 ms = s * 1000.0; 08151 return ast_safe_sleep(chan, ms); 08152 } 08153 return 0; 08154 }
static int pbx_builtin_waitexten | ( | struct ast_channel * | , | |
void * | ||||
) | [static] |
Definition at line 8159 of file pbx.c.
References AST_APP_ARG, ast_app_parse_options(), AST_CONTROL_HOLD, AST_CONTROL_UNHOLD, AST_DECLARE_APP_ARGS, ast_exists_extension(), ast_get_indication_tone(), ast_indicate(), ast_indicate_data(), ast_log(), ast_playtones_start(), ast_playtones_stop(), AST_SOFTHANGUP_TIMEOUT, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_tonepair_start(), ast_verb, ast_waitfordigit(), chan, ast_channel::context, tone_zone_sound::data, ast_flags::flags, LOG_WARNING, parse(), ast_channel::pbx, ast_pbx::rtimeoutms, s, S_OR, set_ext_pri(), WAITEXTEN_DIALTONE, WAITEXTEN_MOH, waitexten_opts, and ast_channel::zone.
08160 { 08161 int ms, res; 08162 double s; 08163 struct ast_flags flags = {0}; 08164 char *opts[1] = { NULL }; 08165 char *parse; 08166 AST_DECLARE_APP_ARGS(args, 08167 AST_APP_ARG(timeout); 08168 AST_APP_ARG(options); 08169 ); 08170 08171 if (!ast_strlen_zero(data)) { 08172 parse = ast_strdupa(data); 08173 AST_STANDARD_APP_ARGS(args, parse); 08174 } else 08175 memset(&args, 0, sizeof(args)); 08176 08177 if (args.options) 08178 ast_app_parse_options(waitexten_opts, &flags, opts, args.options); 08179 08180 if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) { 08181 ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n"); 08182 } else if (ast_test_flag(&flags, WAITEXTEN_MOH)) { 08183 ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL), strlen(opts[0])); 08184 } else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) { 08185 const struct tone_zone_sound *ts = ast_get_indication_tone(chan->zone, "dial"); 08186 if (ts) 08187 ast_playtones_start(chan, 0, ts->data, 0); 08188 else 08189 ast_tonepair_start(chan, 350, 440, 0, 0); 08190 } 08191 /* Wait for "n" seconds */ 08192 if (args.timeout && (s = atof(args.timeout)) > 0) 08193 ms = s * 1000.0; 08194 else if (chan->pbx) 08195 ms = chan->pbx->rtimeoutms; 08196 else 08197 ms = 10000; 08198 08199 res = ast_waitfordigit(chan, ms); 08200 if (!res) { 08201 if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) { 08202 ast_verb(3, "Timeout on %s, continuing...\n", chan->name); 08203 } else if (chan->_softhangup == AST_SOFTHANGUP_TIMEOUT) { 08204 ast_verb(3, "Call timeout on %s, checking for 'T'\n", chan->name); 08205 res = -1; 08206 } else if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) { 08207 ast_verb(3, "Timeout on %s, going to 't'\n", chan->name); 08208 set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */ 08209 } else { 08210 ast_log(LOG_WARNING, "Timeout but no rule 't' in context '%s'\n", chan->context); 08211 res = -1; 08212 } 08213 } 08214 08215 if (ast_test_flag(&flags, WAITEXTEN_MOH)) 08216 ast_indicate(chan, AST_CONTROL_UNHOLD); 08217 else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) 08218 ast_playtones_stop(chan); 08219 08220 return res; 08221 }