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 *) |
static int iax2_prov_app | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
iax2provision
Definition at line 11924 of file chan_iax2.c.
References ast_inet_ntoa(), ast_log(), ast_strdupa, ast_strlen_zero(), ast_verb, 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().
11925 { 11926 int res; 11927 char *sdata; 11928 char *opts; 11929 int force =0; 11930 unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt); 11931 if (ast_strlen_zero(data)) 11932 data = "default"; 11933 sdata = ast_strdupa(data); 11934 opts = strchr(sdata, '|'); 11935 if (opts) 11936 *opts='\0'; 11937 11938 if (chan->tech != &iax2_tech) { 11939 ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n"); 11940 return -1; 11941 } 11942 if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) { 11943 ast_log(LOG_NOTICE, "Can't provision something with no IP?\n"); 11944 return -1; 11945 } 11946 res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force); 11947 ast_verb(3, "Provisioned IAXY at '%s' with '%s'= %d\n", 11948 ast_inet_ntoa(iaxs[callno]->addr.sin_addr), 11949 sdata, res); 11950 return res; 11951 }
static int pbx_builtin_answer | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9391 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().
09392 { 09393 int delay = 0; 09394 int answer_cdr = 1; 09395 char *parse; 09396 AST_DECLARE_APP_ARGS(args, 09397 AST_APP_ARG(delay); 09398 AST_APP_ARG(answer_cdr); 09399 ); 09400 09401 if (ast_strlen_zero(data)) { 09402 return __ast_answer(chan, 0, 1); 09403 } 09404 09405 parse = ast_strdupa(data); 09406 09407 AST_STANDARD_APP_ARGS(args, parse); 09408 09409 if (!ast_strlen_zero(args.delay) && (chan->_state != AST_STATE_UP)) 09410 delay = atoi(data); 09411 09412 if (delay < 0) { 09413 delay = 0; 09414 } 09415 09416 if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) { 09417 answer_cdr = 0; 09418 } 09419 09420 return __ast_answer(chan, delay, answer_cdr); 09421 }
static int pbx_builtin_background | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9747 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, ast_channel::language, LOG_WARNING, ast_channel::name, ast_party_id::number, parse(), pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), ast_channel::priority, S_COR, ast_party_number::str, strsep(), and ast_party_number::valid.
09748 { 09749 int res = 0; 09750 int mres = 0; 09751 struct ast_flags flags = {0}; 09752 char *parse, exten[2] = ""; 09753 AST_DECLARE_APP_ARGS(args, 09754 AST_APP_ARG(filename); 09755 AST_APP_ARG(options); 09756 AST_APP_ARG(lang); 09757 AST_APP_ARG(context); 09758 ); 09759 09760 if (ast_strlen_zero(data)) { 09761 ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); 09762 return -1; 09763 } 09764 09765 parse = ast_strdupa(data); 09766 09767 AST_STANDARD_APP_ARGS(args, parse); 09768 09769 if (ast_strlen_zero(args.lang)) 09770 args.lang = (char *)chan->language; /* XXX this is const */ 09771 09772 if (ast_strlen_zero(args.context)) { 09773 const char *context; 09774 ast_channel_lock(chan); 09775 if ((context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"))) { 09776 args.context = ast_strdupa(context); 09777 } else { 09778 args.context = chan->context; 09779 } 09780 ast_channel_unlock(chan); 09781 } 09782 09783 if (args.options) { 09784 if (!strcasecmp(args.options, "skip")) 09785 flags.flags = BACKGROUND_SKIP; 09786 else if (!strcasecmp(args.options, "noanswer")) 09787 flags.flags = BACKGROUND_NOANSWER; 09788 else 09789 ast_app_parse_options(background_opts, &flags, NULL, args.options); 09790 } 09791 09792 /* Answer if need be */ 09793 if (chan->_state != AST_STATE_UP) { 09794 if (ast_test_flag(&flags, BACKGROUND_SKIP)) { 09795 goto done; 09796 } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) { 09797 res = ast_answer(chan); 09798 } 09799 } 09800 09801 if (!res) { 09802 char *back = ast_strip(args.filename); 09803 char *front; 09804 09805 ast_stopstream(chan); /* Stop anything playing */ 09806 /* Stream the list of files */ 09807 while (!res && (front = strsep(&back, "&")) ) { 09808 if ( (res = ast_streamfile(chan, front, args.lang)) ) { 09809 ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data); 09810 res = 0; 09811 mres = 1; 09812 break; 09813 } 09814 if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) { 09815 res = ast_waitstream(chan, ""); 09816 } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) { 09817 res = ast_waitstream_exten(chan, args.context); 09818 } else { 09819 res = ast_waitstream(chan, AST_DIGIT_ANY); 09820 } 09821 ast_stopstream(chan); 09822 } 09823 } 09824 09825 /* 09826 * If the single digit DTMF is an extension in the specified context, then 09827 * go there and signal no DTMF. Otherwise, we should exit with that DTMF. 09828 * If we're in Macro, we'll exit and seek that DTMF as the beginning of an 09829 * extension in the Macro's calling context. If we're not in Macro, then 09830 * we'll simply seek that extension in the calling context. Previously, 09831 * someone complained about the behavior as it related to the interior of a 09832 * Gosub routine, and the fix (#14011) inadvertently broke FreePBX 09833 * (#14940). This change should fix both of these situations, but with the 09834 * possible incompatibility that if a single digit extension does not exist 09835 * (but a longer extension COULD have matched), it would have previously 09836 * gone immediately to the "i" extension, but will now need to wait for a 09837 * timeout. 09838 * 09839 * Later, we had to add a flag to disable this workaround, because AGI 09840 * users can EXEC Background and reasonably expect that the DTMF code will 09841 * be returned (see #16434). 09842 */ 09843 if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) 09844 && (exten[0] = res) 09845 && ast_canmatch_extension(chan, args.context, exten, 1, 09846 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) 09847 && !ast_matchmore_extension(chan, args.context, exten, 1, 09848 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 09849 snprintf(chan->exten, sizeof(chan->exten), "%c", res); 09850 ast_copy_string(chan->context, args.context, sizeof(chan->context)); 09851 chan->priority = 0; 09852 res = 0; 09853 } 09854 done: 09855 pbx_builtin_setvar_helper(chan, "BACKGROUNDSTATUS", mres ? "FAILED" : "SUCCESS"); 09856 return res; 09857 }
static int pbx_builtin_busy | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9361 of file pbx.c.
References ast_channel::_state, ast_cdr_busy(), AST_CONTROL_BUSY, ast_indicate(), ast_setstate(), AST_STATE_BUSY, AST_STATE_UP, and wait_for_hangup().
09362 { 09363 ast_indicate(chan, AST_CONTROL_BUSY); 09364 /* Don't change state of an UP channel, just indicate 09365 busy in audio */ 09366 if (chan->_state != AST_STATE_UP) { 09367 ast_setstate(chan, AST_STATE_BUSY); 09368 ast_cdr_busy(chan->cdr); 09369 } 09370 wait_for_hangup(chan, data); 09371 return -1; 09372 }
static int pbx_builtin_congestion | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9377 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().
09378 { 09379 ast_indicate(chan, AST_CONTROL_CONGESTION); 09380 /* Don't change state of an UP channel, just indicate 09381 congestion in audio */ 09382 if (chan->_state != AST_STATE_UP) 09383 ast_setstate(chan, AST_STATE_BUSY); 09384 wait_for_hangup(chan, data); 09385 return -1; 09386 }
static int pbx_builtin_execiftime | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9603 of file pbx.c.
References app, ast_build_timing(), ast_check_timing(), ast_destroy_timing(), ast_log(), ast_strdupa, ast_strlen_zero(), LOG_WARNING, pbx_exec(), pbx_findapp(), S_OR, and strsep().
09604 { 09605 char *s, *appname; 09606 struct ast_timing timing; 09607 struct ast_app *app; 09608 static const char * const usage = "ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?<appname>[(<appargs>)]"; 09609 09610 if (ast_strlen_zero(data)) { 09611 ast_log(LOG_WARNING, "%s\n", usage); 09612 return -1; 09613 } 09614 09615 appname = ast_strdupa(data); 09616 09617 s = strsep(&appname, "?"); /* Separate the timerange and application name/data */ 09618 if (!appname) { /* missing application */ 09619 ast_log(LOG_WARNING, "%s\n", usage); 09620 return -1; 09621 } 09622 09623 if (!ast_build_timing(&timing, s)) { 09624 ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage); 09625 ast_destroy_timing(&timing); 09626 return -1; 09627 } 09628 09629 if (!ast_check_timing(&timing)) { /* outside the valid time window, just return */ 09630 ast_destroy_timing(&timing); 09631 return 0; 09632 } 09633 ast_destroy_timing(&timing); 09634 09635 /* now split appname(appargs) */ 09636 if ((s = strchr(appname, '('))) { 09637 char *e; 09638 *s++ = '\0'; 09639 if ((e = strrchr(s, ')'))) 09640 *e = '\0'; 09641 else 09642 ast_log(LOG_WARNING, "Failed to find closing parenthesis\n"); 09643 } 09644 09645 09646 if ((app = pbx_findapp(appname))) { 09647 return pbx_exec(chan, app, S_OR(s, "")); 09648 } else { 09649 ast_log(LOG_WARNING, "Cannot locate application %s\n", appname); 09650 return -1; 09651 } 09652 }
static int pbx_builtin_goto | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Goto
Definition at line 9862 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().
09863 { 09864 int res = ast_parseable_goto(chan, data); 09865 if (!res) 09866 ast_verb(3, "Goto (%s,%s,%d)\n", chan->context, chan->exten, chan->priority + 1); 09867 return res; 09868 }
static int pbx_builtin_gotoiftime | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9549 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(), pbx_builtin_setvar_helper(), and strsep().
09550 { 09551 char *s, *ts, *branch1, *branch2, *branch; 09552 struct ast_timing timing; 09553 const char *ctime; 09554 struct timeval tv = ast_tvnow(); 09555 long timesecs; 09556 09557 if (!chan) { 09558 ast_log(LOG_WARNING, "GotoIfTime requires a channel on which to operate\n"); 09559 return -1; 09560 } 09561 09562 if (ast_strlen_zero(data)) { 09563 ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?'labeliftrue':'labeliffalse'\n"); 09564 return -1; 09565 } 09566 09567 ts = s = ast_strdupa(data); 09568 09569 ast_channel_lock(chan); 09570 if ((ctime = pbx_builtin_getvar_helper(chan, "TESTTIME")) && sscanf(ctime, "%ld", ×ecs) == 1) { 09571 tv.tv_sec = timesecs; 09572 } else if (ctime) { 09573 ast_log(LOG_WARNING, "Using current time to evaluate\n"); 09574 /* Reset when unparseable */ 09575 pbx_builtin_setvar_helper(chan, "TESTTIME", NULL); 09576 } 09577 ast_channel_unlock(chan); 09578 09579 /* Separate the Goto path */ 09580 strsep(&ts, "?"); 09581 branch1 = strsep(&ts,":"); 09582 branch2 = strsep(&ts,""); 09583 09584 /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ 09585 if (ast_build_timing(&timing, s) && ast_check_timing2(&timing, tv)) { 09586 branch = branch1; 09587 } else { 09588 branch = branch2; 09589 } 09590 ast_destroy_timing(&timing); 09591 09592 if (ast_strlen_zero(branch)) { 09593 ast_debug(1, "Not taking any branch\n"); 09594 return 0; 09595 } 09596 09597 return pbx_builtin_goto(chan, branch); 09598 }
static int pbx_builtin_hangup | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9485 of file pbx.c.
References AST_CAUSE_NORMAL_CLEARING, ast_log(), ast_set_hangupsource(), ast_str2cause(), ast_strlen_zero(), cause, ast_channel::hangupcause, and LOG_WARNING.
09486 { 09487 ast_set_hangupsource(chan, "dialplan/builtin", 0); 09488 09489 if (!ast_strlen_zero(data)) { 09490 int cause; 09491 char *endptr; 09492 09493 if ((cause = ast_str2cause(data)) > -1) { 09494 chan->hangupcause = cause; 09495 return -1; 09496 } 09497 09498 cause = strtol((const char *) data, &endptr, 10); 09499 if (cause != 0 || (data != endptr)) { 09500 chan->hangupcause = cause; 09501 return -1; 09502 } 09503 09504 ast_log(LOG_WARNING, "Invalid cause given to Hangup(): \"%s\"\n", (char *) data); 09505 } 09506 09507 if (!chan->hangupcause) { 09508 chan->hangupcause = AST_CAUSE_NORMAL_CLEARING; 09509 } 09510 09511 return -1; 09512 }
static int pbx_builtin_proceeding | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9334 of file pbx.c.
References AST_CONTROL_PROCEEDING, and ast_indicate().
09335 { 09336 ast_indicate(chan, AST_CONTROL_PROCEEDING); 09337 return 0; 09338 }
static int pbx_builtin_progress | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9343 of file pbx.c.
References AST_CONTROL_PROGRESS, and ast_indicate().
09344 { 09345 ast_indicate(chan, AST_CONTROL_PROGRESS); 09346 return 0; 09347 }
static int pbx_builtin_resetcdr | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9455 of file pbx.c.
References args, ast_app_parse_options(), ast_cdr_reset(), ast_strdupa, ast_strlen_zero(), ast_channel::cdr, ast_flags::flags, and resetcdr_opts.
09456 { 09457 char *args; 09458 struct ast_flags flags = { 0 }; 09459 09460 if (!ast_strlen_zero(data)) { 09461 args = ast_strdupa(data); 09462 ast_app_parse_options(resetcdr_opts, &flags, NULL, args); 09463 } 09464 09465 ast_cdr_reset(chan->cdr, &flags); 09466 09467 return 0; 09468 }
static int pbx_builtin_ringing | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9352 of file pbx.c.
References AST_CONTROL_RINGING, and ast_indicate().
09353 { 09354 ast_indicate(chan, AST_CONTROL_RINGING); 09355 return 0; 09356 }
static int pbx_builtin_setamaflags | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9473 of file pbx.c.
References ast_cdr_setamaflags(), ast_channel_lock, and ast_channel_unlock.
09474 { 09475 /* Copy the AMA Flags as specified */ 09476 ast_channel_lock(chan); 09477 ast_cdr_setamaflags(chan, data ? data : ""); 09478 ast_channel_unlock(chan); 09479 return 0; 09480 }
static int pbx_builtin_wait | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9657 of file pbx.c.
References ast_app_parse_timelen(), ast_safe_sleep(), and TIMELEN_SECONDS.
09658 { 09659 int ms; 09660 09661 /* Wait for "n" seconds */ 09662 if (!ast_app_parse_timelen(data, &ms, TIMELEN_SECONDS) && ms > 0) { 09663 return ast_safe_sleep(chan, ms); 09664 } 09665 return 0; 09666 }
static int pbx_builtin_waitexten | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9671 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_tone_zone_sound::data, ast_flags::flags, LOG_WARNING, parse(), ast_channel::pbx, raise_exception(), ast_pbx::rtimeoutms, S_COR, S_OR, set_ext_pri(), TIMELEN_SECONDS, WAITEXTEN_DIALTONE, WAITEXTEN_MOH, waitexten_opts, and ast_channel::zone.
09672 { 09673 int ms, res; 09674 struct ast_flags flags = {0}; 09675 char *opts[1] = { NULL }; 09676 char *parse; 09677 AST_DECLARE_APP_ARGS(args, 09678 AST_APP_ARG(timeout); 09679 AST_APP_ARG(options); 09680 ); 09681 09682 if (!ast_strlen_zero(data)) { 09683 parse = ast_strdupa(data); 09684 AST_STANDARD_APP_ARGS(args, parse); 09685 } else 09686 memset(&args, 0, sizeof(args)); 09687 09688 if (args.options) 09689 ast_app_parse_options(waitexten_opts, &flags, opts, args.options); 09690 09691 if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) { 09692 ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n"); 09693 } else if (ast_test_flag(&flags, WAITEXTEN_MOH)) { 09694 ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL), 09695 !ast_strlen_zero(opts[0]) ? strlen(opts[0]) + 1 : 0); 09696 } else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) { 09697 struct ast_tone_zone_sound *ts = ast_get_indication_tone(chan->zone, "dial"); 09698 if (ts) { 09699 ast_playtones_start(chan, 0, ts->data, 0); 09700 ts = ast_tone_zone_sound_unref(ts); 09701 } else { 09702 ast_tonepair_start(chan, 350, 440, 0, 0); 09703 } 09704 } 09705 /* Wait for "n" seconds */ 09706 if (!ast_app_parse_timelen(args.timeout, &ms, TIMELEN_SECONDS) && ms > 0) { 09707 /* Yay! */ 09708 } else if (chan->pbx) { 09709 ms = chan->pbx->rtimeoutms; 09710 } else { 09711 ms = 10000; 09712 } 09713 09714 res = ast_waitfordigit(chan, ms); 09715 if (!res) { 09716 if (ast_check_hangup(chan)) { 09717 /* Call is hungup for some reason. */ 09718 res = -1; 09719 } else if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, 09720 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 09721 ast_verb(3, "Timeout on %s, continuing...\n", chan->name); 09722 } else if (ast_exists_extension(chan, chan->context, "t", 1, 09723 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 09724 ast_verb(3, "Timeout on %s, going to 't'\n", chan->name); 09725 set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */ 09726 } else if (ast_exists_extension(chan, chan->context, "e", 1, 09727 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 09728 raise_exception(chan, "RESPONSETIMEOUT", 0); /* 0 will become 1, next time through the loop */ 09729 } else { 09730 ast_log(LOG_WARNING, "Timeout but no rule 't' or 'e' in context '%s'\n", 09731 chan->context); 09732 res = -1; 09733 } 09734 } 09735 09736 if (ast_test_flag(&flags, WAITEXTEN_MOH)) 09737 ast_indicate(chan, AST_CONTROL_UNHOLD); 09738 else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) 09739 ast_playtones_stop(chan); 09740 09741 return res; 09742 }