Applications support the dialplan. They register dynamically with. More...
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_celgenuserevent.c |
Generate User-Defined CEL event. | |
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_confbridge.c |
Conference Bridge application. | |
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_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_originate.c |
Originate application. | |
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_playtones.c |
Playtones application. | |
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_saycounted.c |
Applications to decline words according to current language. | |
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_voicemail_imapstorage.c |
Comedian Mail - Voicemail System. | |
file | app_voicemail_odbcstorage.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_fax.c |
Generic FAX Resource for FAX technology resource modules. | |
file | res_realtime.c |
RealTime CLI. | |
Functions | |
static int | iax2_prov_app (struct ast_channel *chan, const char *data) |
static int | pbx_builtin_answer (struct ast_channel *, const char *) |
static int | pbx_builtin_background (struct ast_channel *, const char *) |
static int | pbx_builtin_busy (struct ast_channel *, const char *) |
static int | pbx_builtin_congestion (struct ast_channel *, const char *) |
static int | pbx_builtin_execiftime (struct ast_channel *, const char *) |
static int | pbx_builtin_goto (struct ast_channel *, const char *) |
static int | pbx_builtin_gotoiftime (struct ast_channel *, const char *) |
static int | pbx_builtin_hangup (struct ast_channel *, const char *) |
static int | pbx_builtin_proceeding (struct ast_channel *, const char *) |
static int | pbx_builtin_progress (struct ast_channel *, const char *) |
static int | pbx_builtin_resetcdr (struct ast_channel *, const char *) |
static int | pbx_builtin_ringing (struct ast_channel *, const char *) |
static int | pbx_builtin_setamaflags (struct ast_channel *, const char *) |
static int | pbx_builtin_wait (struct ast_channel *, const char *) |
static int | pbx_builtin_waitexten (struct ast_channel *, const char *) |
Applications support the dialplan. They register dynamically with.
static int iax2_prov_app | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
iax2provision
Definition at line 12137 of file chan_iax2.c.
References iax2_trunk_peer::addr, ast_inet_ntoa(), ast_log(), ast_strdupa, ast_strlen_zero(), ast_verb, iax2_provision(), iax2_tech, iaxs, LOG_NOTICE, PTR_TO_CALLNO, iax2_trunk_peer::sockfd, ast_channel::tech, and ast_channel::tech_pvt.
Referenced by load_module().
12138 { 12139 int res; 12140 char *sdata; 12141 char *opts; 12142 int force =0; 12143 unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt); 12144 if (ast_strlen_zero(data)) 12145 data = "default"; 12146 sdata = ast_strdupa(data); 12147 opts = strchr(sdata, '|'); 12148 if (opts) 12149 *opts='\0'; 12150 12151 if (chan->tech != &iax2_tech) { 12152 ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n"); 12153 return -1; 12154 } 12155 if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) { 12156 ast_log(LOG_NOTICE, "Can't provision something with no IP?\n"); 12157 return -1; 12158 } 12159 res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force); 12160 ast_verb(3, "Provisioned IAXY at '%s' with '%s'= %d\n", 12161 ast_inet_ntoa(iaxs[callno]->addr.sin_addr), 12162 sdata, res); 12163 return res; 12164 }
static int pbx_builtin_answer | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9969 of file pbx.c.
References __ast_answer(), ast_channel::_state, args, AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_strlen_zero(), and parse().
09970 { 09971 int delay = 0; 09972 int answer_cdr = 1; 09973 char *parse; 09974 AST_DECLARE_APP_ARGS(args, 09975 AST_APP_ARG(delay); 09976 AST_APP_ARG(answer_cdr); 09977 ); 09978 09979 if (ast_strlen_zero(data)) { 09980 return __ast_answer(chan, 0, 1); 09981 } 09982 09983 parse = ast_strdupa(data); 09984 09985 AST_STANDARD_APP_ARGS(args, parse); 09986 09987 if (!ast_strlen_zero(args.delay) && (chan->_state != AST_STATE_UP)) 09988 delay = atoi(data); 09989 09990 if (delay < 0) { 09991 delay = 0; 09992 } 09993 09994 if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) { 09995 answer_cdr = 0; 09996 } 09997 09998 return __ast_answer(chan, delay, answer_cdr); 09999 }
static int pbx_builtin_background | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10325 of file pbx.c.
References ast_channel::_state, args, 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_strip(), ast_strlen_zero(), ast_test_flag, ast_waitstream(), ast_waitstream_exten(), BACKGROUND_MATCHEXTEN, BACKGROUND_NOANSWER, background_opts, BACKGROUND_PLAYBACK, BACKGROUND_SKIP, ast_channel::caller, ast_channel::context, ast_channel::exten, ast_flags::flags, ast_party_caller::id, LOG_WARNING, ast_party_id::number, parse(), pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), ast_channel::priority, S_COR, ast_party_number::str, and ast_party_number::valid.
10326 { 10327 int res = 0; 10328 int mres = 0; 10329 struct ast_flags flags = {0}; 10330 char *parse, exten[2] = ""; 10331 AST_DECLARE_APP_ARGS(args, 10332 AST_APP_ARG(filename); 10333 AST_APP_ARG(options); 10334 AST_APP_ARG(lang); 10335 AST_APP_ARG(context); 10336 ); 10337 10338 if (ast_strlen_zero(data)) { 10339 ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); 10340 return -1; 10341 } 10342 10343 parse = ast_strdupa(data); 10344 10345 AST_STANDARD_APP_ARGS(args, parse); 10346 10347 if (ast_strlen_zero(args.lang)) 10348 args.lang = (char *)chan->language; /* XXX this is const */ 10349 10350 if (ast_strlen_zero(args.context)) { 10351 const char *context; 10352 ast_channel_lock(chan); 10353 if ((context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"))) { 10354 args.context = ast_strdupa(context); 10355 } else { 10356 args.context = chan->context; 10357 } 10358 ast_channel_unlock(chan); 10359 } 10360 10361 if (args.options) { 10362 if (!strcasecmp(args.options, "skip")) 10363 flags.flags = BACKGROUND_SKIP; 10364 else if (!strcasecmp(args.options, "noanswer")) 10365 flags.flags = BACKGROUND_NOANSWER; 10366 else 10367 ast_app_parse_options(background_opts, &flags, NULL, args.options); 10368 } 10369 10370 /* Answer if need be */ 10371 if (chan->_state != AST_STATE_UP) { 10372 if (ast_test_flag(&flags, BACKGROUND_SKIP)) { 10373 goto done; 10374 } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) { 10375 res = ast_answer(chan); 10376 } 10377 } 10378 10379 if (!res) { 10380 char *back = ast_strip(args.filename); 10381 char *front; 10382 10383 ast_stopstream(chan); /* Stop anything playing */ 10384 /* Stream the list of files */ 10385 while (!res && (front = strsep(&back, "&")) ) { 10386 if ( (res = ast_streamfile(chan, front, args.lang)) ) { 10387 ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data); 10388 res = 0; 10389 mres = 1; 10390 break; 10391 } 10392 if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) { 10393 res = ast_waitstream(chan, ""); 10394 } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) { 10395 res = ast_waitstream_exten(chan, args.context); 10396 } else { 10397 res = ast_waitstream(chan, AST_DIGIT_ANY); 10398 } 10399 ast_stopstream(chan); 10400 } 10401 } 10402 10403 /* 10404 * If the single digit DTMF is an extension in the specified context, then 10405 * go there and signal no DTMF. Otherwise, we should exit with that DTMF. 10406 * If we're in Macro, we'll exit and seek that DTMF as the beginning of an 10407 * extension in the Macro's calling context. If we're not in Macro, then 10408 * we'll simply seek that extension in the calling context. Previously, 10409 * someone complained about the behavior as it related to the interior of a 10410 * Gosub routine, and the fix (#14011) inadvertently broke FreePBX 10411 * (#14940). This change should fix both of these situations, but with the 10412 * possible incompatibility that if a single digit extension does not exist 10413 * (but a longer extension COULD have matched), it would have previously 10414 * gone immediately to the "i" extension, but will now need to wait for a 10415 * timeout. 10416 * 10417 * Later, we had to add a flag to disable this workaround, because AGI 10418 * users can EXEC Background and reasonably expect that the DTMF code will 10419 * be returned (see #16434). 10420 */ 10421 if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) 10422 && (exten[0] = res) 10423 && ast_canmatch_extension(chan, args.context, exten, 1, 10424 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) 10425 && !ast_matchmore_extension(chan, args.context, exten, 1, 10426 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 10427 snprintf(chan->exten, sizeof(chan->exten), "%c", res); 10428 ast_copy_string(chan->context, args.context, sizeof(chan->context)); 10429 chan->priority = 0; 10430 res = 0; 10431 } 10432 done: 10433 pbx_builtin_setvar_helper(chan, "BACKGROUNDSTATUS", mres ? "FAILED" : "SUCCESS"); 10434 return res; 10435 }
static int pbx_builtin_busy | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9939 of file pbx.c.
References ast_channel::_state, ast_cdr_busy(), AST_CONTROL_BUSY, ast_indicate(), ast_setstate(), AST_STATE_BUSY, AST_STATE_UP, ast_channel::cdr, and wait_for_hangup().
Referenced by __ast_pbx_run().
09940 { 09941 ast_indicate(chan, AST_CONTROL_BUSY); 09942 /* Don't change state of an UP channel, just indicate 09943 busy in audio */ 09944 if (chan->_state != AST_STATE_UP) { 09945 ast_setstate(chan, AST_STATE_BUSY); 09946 ast_cdr_busy(chan->cdr); 09947 } 09948 wait_for_hangup(chan, data); 09949 return -1; 09950 }
static int pbx_builtin_congestion | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9955 of file pbx.c.
References ast_channel::_state, AST_CONTROL_CONGESTION, ast_indicate(), ast_setstate(), AST_STATE_BUSY, AST_STATE_UP, and wait_for_hangup().
Referenced by __ast_pbx_run().
09956 { 09957 ast_indicate(chan, AST_CONTROL_CONGESTION); 09958 /* Don't change state of an UP channel, just indicate 09959 congestion in audio */ 09960 if (chan->_state != AST_STATE_UP) 09961 ast_setstate(chan, AST_STATE_BUSY); 09962 wait_for_hangup(chan, data); 09963 return -1; 09964 }
static int pbx_builtin_execiftime | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10181 of file pbx.c.
References ast_build_timing(), ast_check_timing(), ast_destroy_timing(), ast_log(), ast_strdupa, ast_strlen_zero(), LOG_WARNING, pbx_exec(), pbx_findapp(), and S_OR.
10182 { 10183 char *s, *appname; 10184 struct ast_timing timing; 10185 struct ast_app *app; 10186 static const char * const usage = "ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?<appname>[(<appargs>)]"; 10187 10188 if (ast_strlen_zero(data)) { 10189 ast_log(LOG_WARNING, "%s\n", usage); 10190 return -1; 10191 } 10192 10193 appname = ast_strdupa(data); 10194 10195 s = strsep(&appname, "?"); /* Separate the timerange and application name/data */ 10196 if (!appname) { /* missing application */ 10197 ast_log(LOG_WARNING, "%s\n", usage); 10198 return -1; 10199 } 10200 10201 if (!ast_build_timing(&timing, s)) { 10202 ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage); 10203 ast_destroy_timing(&timing); 10204 return -1; 10205 } 10206 10207 if (!ast_check_timing(&timing)) { /* outside the valid time window, just return */ 10208 ast_destroy_timing(&timing); 10209 return 0; 10210 } 10211 ast_destroy_timing(&timing); 10212 10213 /* now split appname(appargs) */ 10214 if ((s = strchr(appname, '('))) { 10215 char *e; 10216 *s++ = '\0'; 10217 if ((e = strrchr(s, ')'))) 10218 *e = '\0'; 10219 else 10220 ast_log(LOG_WARNING, "Failed to find closing parenthesis\n"); 10221 } 10222 10223 10224 if ((app = pbx_findapp(appname))) { 10225 return pbx_exec(chan, app, S_OR(s, "")); 10226 } else { 10227 ast_log(LOG_WARNING, "Cannot locate application %s\n", appname); 10228 return -1; 10229 } 10230 }
static int pbx_builtin_goto | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Goto
Definition at line 10440 of file pbx.c.
References ast_parseable_goto(), ast_verb, ast_channel::context, ast_channel::exten, and ast_channel::priority.
Referenced by pbx_builtin_gotoif(), and pbx_builtin_gotoiftime().
10441 { 10442 int res = ast_parseable_goto(chan, data); 10443 if (!res) 10444 ast_verb(3, "Goto (%s,%s,%d)\n", chan->context, chan->exten, chan->priority + 1); 10445 return res; 10446 }
static int pbx_builtin_gotoiftime | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10127 of file pbx.c.
References ast_build_timing(), ast_channel_lock, ast_channel_unlock, ast_check_timing2(), ast_debug, ast_destroy_timing(), ast_log(), ast_strdupa, ast_strlen_zero(), ast_tvnow(), LOG_WARNING, pbx_builtin_getvar_helper(), pbx_builtin_goto(), and pbx_builtin_setvar_helper().
10128 { 10129 char *s, *ts, *branch1, *branch2, *branch; 10130 struct ast_timing timing; 10131 const char *ctime; 10132 struct timeval tv = ast_tvnow(); 10133 long timesecs; 10134 10135 if (!chan) { 10136 ast_log(LOG_WARNING, "GotoIfTime requires a channel on which to operate\n"); 10137 return -1; 10138 } 10139 10140 if (ast_strlen_zero(data)) { 10141 ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?'labeliftrue':'labeliffalse'\n"); 10142 return -1; 10143 } 10144 10145 ts = s = ast_strdupa(data); 10146 10147 ast_channel_lock(chan); 10148 if ((ctime = pbx_builtin_getvar_helper(chan, "TESTTIME")) && sscanf(ctime, "%ld", ×ecs) == 1) { 10149 tv.tv_sec = timesecs; 10150 } else if (ctime) { 10151 ast_log(LOG_WARNING, "Using current time to evaluate\n"); 10152 /* Reset when unparseable */ 10153 pbx_builtin_setvar_helper(chan, "TESTTIME", NULL); 10154 } 10155 ast_channel_unlock(chan); 10156 10157 /* Separate the Goto path */ 10158 strsep(&ts, "?"); 10159 branch1 = strsep(&ts,":"); 10160 branch2 = strsep(&ts,""); 10161 10162 /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ 10163 if (ast_build_timing(&timing, s) && ast_check_timing2(&timing, tv)) { 10164 branch = branch1; 10165 } else { 10166 branch = branch2; 10167 } 10168 ast_destroy_timing(&timing); 10169 10170 if (ast_strlen_zero(branch)) { 10171 ast_debug(1, "Not taking any branch\n"); 10172 return 0; 10173 } 10174 10175 return pbx_builtin_goto(chan, branch); 10176 }
static int pbx_builtin_hangup | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10063 of file pbx.c.
References AST_CAUSE_NORMAL_CLEARING, ast_log(), ast_set_hangupsource(), ast_str2cause(), ast_strlen_zero(), ast_channel::hangupcause, and LOG_WARNING.
10064 { 10065 ast_set_hangupsource(chan, "dialplan/builtin", 0); 10066 10067 if (!ast_strlen_zero(data)) { 10068 int cause; 10069 char *endptr; 10070 10071 if ((cause = ast_str2cause(data)) > -1) { 10072 chan->hangupcause = cause; 10073 return -1; 10074 } 10075 10076 cause = strtol((const char *) data, &endptr, 10); 10077 if (cause != 0 || (data != endptr)) { 10078 chan->hangupcause = cause; 10079 return -1; 10080 } 10081 10082 ast_log(LOG_WARNING, "Invalid cause given to Hangup(): \"%s\"\n", (char *) data); 10083 } 10084 10085 if (!chan->hangupcause) { 10086 chan->hangupcause = AST_CAUSE_NORMAL_CLEARING; 10087 } 10088 10089 return -1; 10090 }
static int pbx_builtin_proceeding | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9912 of file pbx.c.
References AST_CONTROL_PROCEEDING, and ast_indicate().
09913 { 09914 ast_indicate(chan, AST_CONTROL_PROCEEDING); 09915 return 0; 09916 }
static int pbx_builtin_progress | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9921 of file pbx.c.
References AST_CONTROL_PROGRESS, and ast_indicate().
09922 { 09923 ast_indicate(chan, AST_CONTROL_PROGRESS); 09924 return 0; 09925 }
static int pbx_builtin_resetcdr | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10033 of file pbx.c.
References args, ast_app_parse_options(), ast_cdr_reset(), ast_strdupa, ast_strlen_zero(), ast_channel::cdr, and resetcdr_opts.
10034 { 10035 char *args; 10036 struct ast_flags flags = { 0 }; 10037 10038 if (!ast_strlen_zero(data)) { 10039 args = ast_strdupa(data); 10040 ast_app_parse_options(resetcdr_opts, &flags, NULL, args); 10041 } 10042 10043 ast_cdr_reset(chan->cdr, &flags); 10044 10045 return 0; 10046 }
static int pbx_builtin_ringing | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9930 of file pbx.c.
References AST_CONTROL_RINGING, and ast_indicate().
09931 { 09932 ast_indicate(chan, AST_CONTROL_RINGING); 09933 return 0; 09934 }
static int pbx_builtin_setamaflags | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10051 of file pbx.c.
References ast_cdr_setamaflags(), ast_channel_lock, and ast_channel_unlock.
10052 { 10053 /* Copy the AMA Flags as specified */ 10054 ast_channel_lock(chan); 10055 ast_cdr_setamaflags(chan, data ? data : ""); 10056 ast_channel_unlock(chan); 10057 return 0; 10058 }
static int pbx_builtin_wait | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10235 of file pbx.c.
References ast_app_parse_timelen(), ast_safe_sleep(), and TIMELEN_SECONDS.
10236 { 10237 int ms; 10238 10239 /* Wait for "n" seconds */ 10240 if (!ast_app_parse_timelen(data, &ms, TIMELEN_SECONDS) && ms > 0) { 10241 return ast_safe_sleep(chan, ms); 10242 } 10243 return 0; 10244 }
static int pbx_builtin_waitexten | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10249 of file pbx.c.
References args, AST_APP_ARG, ast_app_parse_options(), ast_app_parse_timelen(), ast_check_hangup(), 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_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_tone_zone_sound_unref(), ast_tonepair_start(), ast_verb, ast_waitfordigit(), ast_channel::caller, ast_channel::context, ast_tone_zone_sound::data, ast_channel::exten, ast_party_caller::id, LOG_WARNING, ast_party_id::number, parse(), ast_channel::pbx, ast_channel::priority, raise_exception(), ast_pbx::rtimeoutms, S_COR, S_OR, set_ext_pri(), ast_party_number::str, TIMELEN_SECONDS, ast_party_number::valid, WAITEXTEN_DIALTONE, WAITEXTEN_MOH, waitexten_opts, and ast_channel::zone.
10250 { 10251 int ms, res; 10252 struct ast_flags flags = {0}; 10253 char *opts[1] = { NULL }; 10254 char *parse; 10255 AST_DECLARE_APP_ARGS(args, 10256 AST_APP_ARG(timeout); 10257 AST_APP_ARG(options); 10258 ); 10259 10260 if (!ast_strlen_zero(data)) { 10261 parse = ast_strdupa(data); 10262 AST_STANDARD_APP_ARGS(args, parse); 10263 } else 10264 memset(&args, 0, sizeof(args)); 10265 10266 if (args.options) 10267 ast_app_parse_options(waitexten_opts, &flags, opts, args.options); 10268 10269 if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) { 10270 ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n"); 10271 } else if (ast_test_flag(&flags, WAITEXTEN_MOH)) { 10272 ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL), 10273 !ast_strlen_zero(opts[0]) ? strlen(opts[0]) + 1 : 0); 10274 } else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) { 10275 struct ast_tone_zone_sound *ts = ast_get_indication_tone(chan->zone, "dial"); 10276 if (ts) { 10277 ast_playtones_start(chan, 0, ts->data, 0); 10278 ts = ast_tone_zone_sound_unref(ts); 10279 } else { 10280 ast_tonepair_start(chan, 350, 440, 0, 0); 10281 } 10282 } 10283 /* Wait for "n" seconds */ 10284 if (!ast_app_parse_timelen(args.timeout, &ms, TIMELEN_SECONDS) && ms > 0) { 10285 /* Yay! */ 10286 } else if (chan->pbx) { 10287 ms = chan->pbx->rtimeoutms; 10288 } else { 10289 ms = 10000; 10290 } 10291 10292 res = ast_waitfordigit(chan, ms); 10293 if (!res) { 10294 if (ast_check_hangup(chan)) { 10295 /* Call is hungup for some reason. */ 10296 res = -1; 10297 } else if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, 10298 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 10299 ast_verb(3, "Timeout on %s, continuing...\n", chan->name); 10300 } else if (ast_exists_extension(chan, chan->context, "t", 1, 10301 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 10302 ast_verb(3, "Timeout on %s, going to 't'\n", chan->name); 10303 set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */ 10304 } else if (ast_exists_extension(chan, chan->context, "e", 1, 10305 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 10306 raise_exception(chan, "RESPONSETIMEOUT", 0); /* 0 will become 1, next time through the loop */ 10307 } else { 10308 ast_log(LOG_WARNING, "Timeout but no rule 't' or 'e' in context '%s'\n", 10309 chan->context); 10310 res = -1; 10311 } 10312 } 10313 10314 if (ast_test_flag(&flags, WAITEXTEN_MOH)) 10315 ast_indicate(chan, AST_CONTROL_UNHOLD); 10316 else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) 10317 ast_playtones_stop(chan); 10318 10319 return res; 10320 }