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 9918 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().
09919 { 09920 int delay = 0; 09921 int answer_cdr = 1; 09922 char *parse; 09923 AST_DECLARE_APP_ARGS(args, 09924 AST_APP_ARG(delay); 09925 AST_APP_ARG(answer_cdr); 09926 ); 09927 09928 if (ast_strlen_zero(data)) { 09929 return __ast_answer(chan, 0, 1); 09930 } 09931 09932 parse = ast_strdupa(data); 09933 09934 AST_STANDARD_APP_ARGS(args, parse); 09935 09936 if (!ast_strlen_zero(args.delay) && (chan->_state != AST_STATE_UP)) 09937 delay = atoi(data); 09938 09939 if (delay < 0) { 09940 delay = 0; 09941 } 09942 09943 if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) { 09944 answer_cdr = 0; 09945 } 09946 09947 return __ast_answer(chan, delay, answer_cdr); 09948 }
static int pbx_builtin_background | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10274 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.
10275 { 10276 int res = 0; 10277 int mres = 0; 10278 struct ast_flags flags = {0}; 10279 char *parse, exten[2] = ""; 10280 AST_DECLARE_APP_ARGS(args, 10281 AST_APP_ARG(filename); 10282 AST_APP_ARG(options); 10283 AST_APP_ARG(lang); 10284 AST_APP_ARG(context); 10285 ); 10286 10287 if (ast_strlen_zero(data)) { 10288 ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); 10289 return -1; 10290 } 10291 10292 parse = ast_strdupa(data); 10293 10294 AST_STANDARD_APP_ARGS(args, parse); 10295 10296 if (ast_strlen_zero(args.lang)) 10297 args.lang = (char *)chan->language; /* XXX this is const */ 10298 10299 if (ast_strlen_zero(args.context)) { 10300 const char *context; 10301 ast_channel_lock(chan); 10302 if ((context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"))) { 10303 args.context = ast_strdupa(context); 10304 } else { 10305 args.context = chan->context; 10306 } 10307 ast_channel_unlock(chan); 10308 } 10309 10310 if (args.options) { 10311 if (!strcasecmp(args.options, "skip")) 10312 flags.flags = BACKGROUND_SKIP; 10313 else if (!strcasecmp(args.options, "noanswer")) 10314 flags.flags = BACKGROUND_NOANSWER; 10315 else 10316 ast_app_parse_options(background_opts, &flags, NULL, args.options); 10317 } 10318 10319 /* Answer if need be */ 10320 if (chan->_state != AST_STATE_UP) { 10321 if (ast_test_flag(&flags, BACKGROUND_SKIP)) { 10322 goto done; 10323 } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) { 10324 res = ast_answer(chan); 10325 } 10326 } 10327 10328 if (!res) { 10329 char *back = ast_strip(args.filename); 10330 char *front; 10331 10332 ast_stopstream(chan); /* Stop anything playing */ 10333 /* Stream the list of files */ 10334 while (!res && (front = strsep(&back, "&")) ) { 10335 if ( (res = ast_streamfile(chan, front, args.lang)) ) { 10336 ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data); 10337 res = 0; 10338 mres = 1; 10339 break; 10340 } 10341 if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) { 10342 res = ast_waitstream(chan, ""); 10343 } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) { 10344 res = ast_waitstream_exten(chan, args.context); 10345 } else { 10346 res = ast_waitstream(chan, AST_DIGIT_ANY); 10347 } 10348 ast_stopstream(chan); 10349 } 10350 } 10351 10352 /* 10353 * If the single digit DTMF is an extension in the specified context, then 10354 * go there and signal no DTMF. Otherwise, we should exit with that DTMF. 10355 * If we're in Macro, we'll exit and seek that DTMF as the beginning of an 10356 * extension in the Macro's calling context. If we're not in Macro, then 10357 * we'll simply seek that extension in the calling context. Previously, 10358 * someone complained about the behavior as it related to the interior of a 10359 * Gosub routine, and the fix (#14011) inadvertently broke FreePBX 10360 * (#14940). This change should fix both of these situations, but with the 10361 * possible incompatibility that if a single digit extension does not exist 10362 * (but a longer extension COULD have matched), it would have previously 10363 * gone immediately to the "i" extension, but will now need to wait for a 10364 * timeout. 10365 * 10366 * Later, we had to add a flag to disable this workaround, because AGI 10367 * users can EXEC Background and reasonably expect that the DTMF code will 10368 * be returned (see #16434). 10369 */ 10370 if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) 10371 && (exten[0] = res) 10372 && ast_canmatch_extension(chan, args.context, exten, 1, 10373 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) 10374 && !ast_matchmore_extension(chan, args.context, exten, 1, 10375 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 10376 snprintf(chan->exten, sizeof(chan->exten), "%c", res); 10377 ast_copy_string(chan->context, args.context, sizeof(chan->context)); 10378 chan->priority = 0; 10379 res = 0; 10380 } 10381 done: 10382 pbx_builtin_setvar_helper(chan, "BACKGROUNDSTATUS", mres ? "FAILED" : "SUCCESS"); 10383 return res; 10384 }
static int pbx_builtin_busy | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9888 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().
09889 { 09890 ast_indicate(chan, AST_CONTROL_BUSY); 09891 /* Don't change state of an UP channel, just indicate 09892 busy in audio */ 09893 if (chan->_state != AST_STATE_UP) { 09894 ast_setstate(chan, AST_STATE_BUSY); 09895 ast_cdr_busy(chan->cdr); 09896 } 09897 wait_for_hangup(chan, data); 09898 return -1; 09899 }
static int pbx_builtin_congestion | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9904 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().
09905 { 09906 ast_indicate(chan, AST_CONTROL_CONGESTION); 09907 /* Don't change state of an UP channel, just indicate 09908 congestion in audio */ 09909 if (chan->_state != AST_STATE_UP) 09910 ast_setstate(chan, AST_STATE_BUSY); 09911 wait_for_hangup(chan, data); 09912 return -1; 09913 }
static int pbx_builtin_execiftime | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10130 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.
10131 { 10132 char *s, *appname; 10133 struct ast_timing timing; 10134 struct ast_app *app; 10135 static const char * const usage = "ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?<appname>[(<appargs>)]"; 10136 10137 if (ast_strlen_zero(data)) { 10138 ast_log(LOG_WARNING, "%s\n", usage); 10139 return -1; 10140 } 10141 10142 appname = ast_strdupa(data); 10143 10144 s = strsep(&appname, "?"); /* Separate the timerange and application name/data */ 10145 if (!appname) { /* missing application */ 10146 ast_log(LOG_WARNING, "%s\n", usage); 10147 return -1; 10148 } 10149 10150 if (!ast_build_timing(&timing, s)) { 10151 ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage); 10152 ast_destroy_timing(&timing); 10153 return -1; 10154 } 10155 10156 if (!ast_check_timing(&timing)) { /* outside the valid time window, just return */ 10157 ast_destroy_timing(&timing); 10158 return 0; 10159 } 10160 ast_destroy_timing(&timing); 10161 10162 /* now split appname(appargs) */ 10163 if ((s = strchr(appname, '('))) { 10164 char *e; 10165 *s++ = '\0'; 10166 if ((e = strrchr(s, ')'))) 10167 *e = '\0'; 10168 else 10169 ast_log(LOG_WARNING, "Failed to find closing parenthesis\n"); 10170 } 10171 10172 10173 if ((app = pbx_findapp(appname))) { 10174 return pbx_exec(chan, app, S_OR(s, "")); 10175 } else { 10176 ast_log(LOG_WARNING, "Cannot locate application %s\n", appname); 10177 return -1; 10178 } 10179 }
static int pbx_builtin_goto | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Goto
Definition at line 10389 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().
10390 { 10391 int res = ast_parseable_goto(chan, data); 10392 if (!res) 10393 ast_verb(3, "Goto (%s,%s,%d)\n", chan->context, chan->exten, chan->priority + 1); 10394 return res; 10395 }
static int pbx_builtin_gotoiftime | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10076 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().
10077 { 10078 char *s, *ts, *branch1, *branch2, *branch; 10079 struct ast_timing timing; 10080 const char *ctime; 10081 struct timeval tv = ast_tvnow(); 10082 long timesecs; 10083 10084 if (!chan) { 10085 ast_log(LOG_WARNING, "GotoIfTime requires a channel on which to operate\n"); 10086 return -1; 10087 } 10088 10089 if (ast_strlen_zero(data)) { 10090 ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?'labeliftrue':'labeliffalse'\n"); 10091 return -1; 10092 } 10093 10094 ts = s = ast_strdupa(data); 10095 10096 ast_channel_lock(chan); 10097 if ((ctime = pbx_builtin_getvar_helper(chan, "TESTTIME")) && sscanf(ctime, "%ld", ×ecs) == 1) { 10098 tv.tv_sec = timesecs; 10099 } else if (ctime) { 10100 ast_log(LOG_WARNING, "Using current time to evaluate\n"); 10101 /* Reset when unparseable */ 10102 pbx_builtin_setvar_helper(chan, "TESTTIME", NULL); 10103 } 10104 ast_channel_unlock(chan); 10105 10106 /* Separate the Goto path */ 10107 strsep(&ts, "?"); 10108 branch1 = strsep(&ts,":"); 10109 branch2 = strsep(&ts,""); 10110 10111 /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ 10112 if (ast_build_timing(&timing, s) && ast_check_timing2(&timing, tv)) { 10113 branch = branch1; 10114 } else { 10115 branch = branch2; 10116 } 10117 ast_destroy_timing(&timing); 10118 10119 if (ast_strlen_zero(branch)) { 10120 ast_debug(1, "Not taking any branch\n"); 10121 return 0; 10122 } 10123 10124 return pbx_builtin_goto(chan, branch); 10125 }
static int pbx_builtin_hangup | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10012 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.
10013 { 10014 ast_set_hangupsource(chan, "dialplan/builtin", 0); 10015 10016 if (!ast_strlen_zero(data)) { 10017 int cause; 10018 char *endptr; 10019 10020 if ((cause = ast_str2cause(data)) > -1) { 10021 chan->hangupcause = cause; 10022 return -1; 10023 } 10024 10025 cause = strtol((const char *) data, &endptr, 10); 10026 if (cause != 0 || (data != endptr)) { 10027 chan->hangupcause = cause; 10028 return -1; 10029 } 10030 10031 ast_log(LOG_WARNING, "Invalid cause given to Hangup(): \"%s\"\n", (char *) data); 10032 } 10033 10034 if (!chan->hangupcause) { 10035 chan->hangupcause = AST_CAUSE_NORMAL_CLEARING; 10036 } 10037 10038 return -1; 10039 }
static int pbx_builtin_proceeding | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9861 of file pbx.c.
References AST_CONTROL_PROCEEDING, and ast_indicate().
09862 { 09863 ast_indicate(chan, AST_CONTROL_PROCEEDING); 09864 return 0; 09865 }
static int pbx_builtin_progress | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9870 of file pbx.c.
References AST_CONTROL_PROGRESS, and ast_indicate().
09871 { 09872 ast_indicate(chan, AST_CONTROL_PROGRESS); 09873 return 0; 09874 }
static int pbx_builtin_resetcdr | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9982 of file pbx.c.
References args, ast_app_parse_options(), ast_cdr_reset(), ast_strdupa, ast_strlen_zero(), ast_channel::cdr, and resetcdr_opts.
09983 { 09984 char *args; 09985 struct ast_flags flags = { 0 }; 09986 09987 if (!ast_strlen_zero(data)) { 09988 args = ast_strdupa(data); 09989 ast_app_parse_options(resetcdr_opts, &flags, NULL, args); 09990 } 09991 09992 ast_cdr_reset(chan->cdr, &flags); 09993 09994 return 0; 09995 }
static int pbx_builtin_ringing | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 9879 of file pbx.c.
References AST_CONTROL_RINGING, and ast_indicate().
09880 { 09881 ast_indicate(chan, AST_CONTROL_RINGING); 09882 return 0; 09883 }
static int pbx_builtin_setamaflags | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10000 of file pbx.c.
References ast_cdr_setamaflags(), ast_channel_lock, and ast_channel_unlock.
10001 { 10002 /* Copy the AMA Flags as specified */ 10003 ast_channel_lock(chan); 10004 ast_cdr_setamaflags(chan, data ? data : ""); 10005 ast_channel_unlock(chan); 10006 return 0; 10007 }
static int pbx_builtin_wait | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10184 of file pbx.c.
References ast_app_parse_timelen(), ast_safe_sleep(), and TIMELEN_SECONDS.
10185 { 10186 int ms; 10187 10188 /* Wait for "n" seconds */ 10189 if (!ast_app_parse_timelen(data, &ms, TIMELEN_SECONDS) && ms > 0) { 10190 return ast_safe_sleep(chan, ms); 10191 } 10192 return 0; 10193 }
static int pbx_builtin_waitexten | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 10198 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.
10199 { 10200 int ms, res; 10201 struct ast_flags flags = {0}; 10202 char *opts[1] = { NULL }; 10203 char *parse; 10204 AST_DECLARE_APP_ARGS(args, 10205 AST_APP_ARG(timeout); 10206 AST_APP_ARG(options); 10207 ); 10208 10209 if (!ast_strlen_zero(data)) { 10210 parse = ast_strdupa(data); 10211 AST_STANDARD_APP_ARGS(args, parse); 10212 } else 10213 memset(&args, 0, sizeof(args)); 10214 10215 if (args.options) 10216 ast_app_parse_options(waitexten_opts, &flags, opts, args.options); 10217 10218 if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) { 10219 ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n"); 10220 } else if (ast_test_flag(&flags, WAITEXTEN_MOH)) { 10221 ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL), 10222 !ast_strlen_zero(opts[0]) ? strlen(opts[0]) + 1 : 0); 10223 } else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) { 10224 struct ast_tone_zone_sound *ts = ast_get_indication_tone(chan->zone, "dial"); 10225 if (ts) { 10226 ast_playtones_start(chan, 0, ts->data, 0); 10227 ts = ast_tone_zone_sound_unref(ts); 10228 } else { 10229 ast_tonepair_start(chan, 350, 440, 0, 0); 10230 } 10231 } 10232 /* Wait for "n" seconds */ 10233 if (!ast_app_parse_timelen(args.timeout, &ms, TIMELEN_SECONDS) && ms > 0) { 10234 /* Yay! */ 10235 } else if (chan->pbx) { 10236 ms = chan->pbx->rtimeoutms; 10237 } else { 10238 ms = 10000; 10239 } 10240 10241 res = ast_waitfordigit(chan, ms); 10242 if (!res) { 10243 if (ast_check_hangup(chan)) { 10244 /* Call is hungup for some reason. */ 10245 res = -1; 10246 } else if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, 10247 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 10248 ast_verb(3, "Timeout on %s, continuing...\n", chan->name); 10249 } else if (ast_exists_extension(chan, chan->context, "t", 1, 10250 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 10251 ast_verb(3, "Timeout on %s, going to 't'\n", chan->name); 10252 set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */ 10253 } else if (ast_exists_extension(chan, chan->context, "e", 1, 10254 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 10255 raise_exception(chan, "RESPONSETIMEOUT", 0); /* 0 will become 1, next time through the loop */ 10256 } else { 10257 ast_log(LOG_WARNING, "Timeout but no rule 't' or 'e' in context '%s'\n", 10258 chan->context); 10259 res = -1; 10260 } 10261 } 10262 10263 if (ast_test_flag(&flags, WAITEXTEN_MOH)) 10264 ast_indicate(chan, AST_CONTROL_UNHOLD); 10265 else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) 10266 ast_playtones_stop(chan); 10267 10268 return res; 10269 }