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 11873 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().
11874 { 11875 int res; 11876 char *sdata; 11877 char *opts; 11878 int force =0; 11879 unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt); 11880 if (ast_strlen_zero(data)) 11881 data = "default"; 11882 sdata = ast_strdupa(data); 11883 opts = strchr(sdata, '|'); 11884 if (opts) 11885 *opts='\0'; 11886 11887 if (chan->tech != &iax2_tech) { 11888 ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n"); 11889 return -1; 11890 } 11891 if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) { 11892 ast_log(LOG_NOTICE, "Can't provision something with no IP?\n"); 11893 return -1; 11894 } 11895 res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force); 11896 ast_verb(3, "Provisioned IAXY at '%s' with '%s'= %d\n", 11897 ast_inet_ntoa(iaxs[callno]->addr.sin_addr), 11898 sdata, res); 11899 return res; 11900 }
static int pbx_builtin_answer | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9368 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().
09369 { 09370 int delay = 0; 09371 int answer_cdr = 1; 09372 char *parse; 09373 AST_DECLARE_APP_ARGS(args, 09374 AST_APP_ARG(delay); 09375 AST_APP_ARG(answer_cdr); 09376 ); 09377 09378 if (ast_strlen_zero(data)) { 09379 return __ast_answer(chan, 0, 1); 09380 } 09381 09382 parse = ast_strdupa(data); 09383 09384 AST_STANDARD_APP_ARGS(args, parse); 09385 09386 if (!ast_strlen_zero(args.delay) && (chan->_state != AST_STATE_UP)) 09387 delay = atoi(data); 09388 09389 if (delay < 0) { 09390 delay = 0; 09391 } 09392 09393 if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) { 09394 answer_cdr = 0; 09395 } 09396 09397 return __ast_answer(chan, delay, answer_cdr); 09398 }
static int pbx_builtin_background | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9719 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.
09720 { 09721 int res = 0; 09722 int mres = 0; 09723 struct ast_flags flags = {0}; 09724 char *parse, exten[2] = ""; 09725 AST_DECLARE_APP_ARGS(args, 09726 AST_APP_ARG(filename); 09727 AST_APP_ARG(options); 09728 AST_APP_ARG(lang); 09729 AST_APP_ARG(context); 09730 ); 09731 09732 if (ast_strlen_zero(data)) { 09733 ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); 09734 return -1; 09735 } 09736 09737 parse = ast_strdupa(data); 09738 09739 AST_STANDARD_APP_ARGS(args, parse); 09740 09741 if (ast_strlen_zero(args.lang)) 09742 args.lang = (char *)chan->language; /* XXX this is const */ 09743 09744 if (ast_strlen_zero(args.context)) { 09745 const char *context; 09746 ast_channel_lock(chan); 09747 if ((context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"))) { 09748 args.context = ast_strdupa(context); 09749 } else { 09750 args.context = chan->context; 09751 } 09752 ast_channel_unlock(chan); 09753 } 09754 09755 if (args.options) { 09756 if (!strcasecmp(args.options, "skip")) 09757 flags.flags = BACKGROUND_SKIP; 09758 else if (!strcasecmp(args.options, "noanswer")) 09759 flags.flags = BACKGROUND_NOANSWER; 09760 else 09761 ast_app_parse_options(background_opts, &flags, NULL, args.options); 09762 } 09763 09764 /* Answer if need be */ 09765 if (chan->_state != AST_STATE_UP) { 09766 if (ast_test_flag(&flags, BACKGROUND_SKIP)) { 09767 goto done; 09768 } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) { 09769 res = ast_answer(chan); 09770 } 09771 } 09772 09773 if (!res) { 09774 char *back = ast_strip(args.filename); 09775 char *front; 09776 09777 ast_stopstream(chan); /* Stop anything playing */ 09778 /* Stream the list of files */ 09779 while (!res && (front = strsep(&back, "&")) ) { 09780 if ( (res = ast_streamfile(chan, front, args.lang)) ) { 09781 ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data); 09782 res = 0; 09783 mres = 1; 09784 break; 09785 } 09786 if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) { 09787 res = ast_waitstream(chan, ""); 09788 } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) { 09789 res = ast_waitstream_exten(chan, args.context); 09790 } else { 09791 res = ast_waitstream(chan, AST_DIGIT_ANY); 09792 } 09793 ast_stopstream(chan); 09794 } 09795 } 09796 09797 /* 09798 * If the single digit DTMF is an extension in the specified context, then 09799 * go there and signal no DTMF. Otherwise, we should exit with that DTMF. 09800 * If we're in Macro, we'll exit and seek that DTMF as the beginning of an 09801 * extension in the Macro's calling context. If we're not in Macro, then 09802 * we'll simply seek that extension in the calling context. Previously, 09803 * someone complained about the behavior as it related to the interior of a 09804 * Gosub routine, and the fix (#14011) inadvertently broke FreePBX 09805 * (#14940). This change should fix both of these situations, but with the 09806 * possible incompatibility that if a single digit extension does not exist 09807 * (but a longer extension COULD have matched), it would have previously 09808 * gone immediately to the "i" extension, but will now need to wait for a 09809 * timeout. 09810 * 09811 * Later, we had to add a flag to disable this workaround, because AGI 09812 * users can EXEC Background and reasonably expect that the DTMF code will 09813 * be returned (see #16434). 09814 */ 09815 if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) 09816 && (exten[0] = res) 09817 && ast_canmatch_extension(chan, args.context, exten, 1, 09818 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) 09819 && !ast_matchmore_extension(chan, args.context, exten, 1, 09820 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 09821 snprintf(chan->exten, sizeof(chan->exten), "%c", res); 09822 ast_copy_string(chan->context, args.context, sizeof(chan->context)); 09823 chan->priority = 0; 09824 res = 0; 09825 } 09826 done: 09827 pbx_builtin_setvar_helper(chan, "BACKGROUNDSTATUS", mres ? "FAILED" : "SUCCESS"); 09828 return res; 09829 }
static int pbx_builtin_busy | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9338 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().
09339 { 09340 ast_indicate(chan, AST_CONTROL_BUSY); 09341 /* Don't change state of an UP channel, just indicate 09342 busy in audio */ 09343 if (chan->_state != AST_STATE_UP) { 09344 ast_setstate(chan, AST_STATE_BUSY); 09345 ast_cdr_busy(chan->cdr); 09346 } 09347 wait_for_hangup(chan, data); 09348 return -1; 09349 }
static int pbx_builtin_congestion | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9354 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().
09355 { 09356 ast_indicate(chan, AST_CONTROL_CONGESTION); 09357 /* Don't change state of an UP channel, just indicate 09358 congestion in audio */ 09359 if (chan->_state != AST_STATE_UP) 09360 ast_setstate(chan, AST_STATE_BUSY); 09361 wait_for_hangup(chan, data); 09362 return -1; 09363 }
static int pbx_builtin_execiftime | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9576 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().
09577 { 09578 char *s, *appname; 09579 struct ast_timing timing; 09580 struct ast_app *app; 09581 static const char * const usage = "ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?<appname>[(<appargs>)]"; 09582 09583 if (ast_strlen_zero(data)) { 09584 ast_log(LOG_WARNING, "%s\n", usage); 09585 return -1; 09586 } 09587 09588 appname = ast_strdupa(data); 09589 09590 s = strsep(&appname, "?"); /* Separate the timerange and application name/data */ 09591 if (!appname) { /* missing application */ 09592 ast_log(LOG_WARNING, "%s\n", usage); 09593 return -1; 09594 } 09595 09596 if (!ast_build_timing(&timing, s)) { 09597 ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage); 09598 ast_destroy_timing(&timing); 09599 return -1; 09600 } 09601 09602 if (!ast_check_timing(&timing)) { /* outside the valid time window, just return */ 09603 ast_destroy_timing(&timing); 09604 return 0; 09605 } 09606 ast_destroy_timing(&timing); 09607 09608 /* now split appname(appargs) */ 09609 if ((s = strchr(appname, '('))) { 09610 char *e; 09611 *s++ = '\0'; 09612 if ((e = strrchr(s, ')'))) 09613 *e = '\0'; 09614 else 09615 ast_log(LOG_WARNING, "Failed to find closing parenthesis\n"); 09616 } 09617 09618 09619 if ((app = pbx_findapp(appname))) { 09620 return pbx_exec(chan, app, S_OR(s, "")); 09621 } else { 09622 ast_log(LOG_WARNING, "Cannot locate application %s\n", appname); 09623 return -1; 09624 } 09625 }
static int pbx_builtin_goto | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Goto
Definition at line 9834 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().
09835 { 09836 int res = ast_parseable_goto(chan, data); 09837 if (!res) 09838 ast_verb(3, "Goto (%s,%s,%d)\n", chan->context, chan->exten, chan->priority + 1); 09839 return res; 09840 }
static int pbx_builtin_gotoiftime | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9526 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().
09527 { 09528 char *s, *ts, *branch1, *branch2, *branch; 09529 struct ast_timing timing; 09530 const char *ctime; 09531 struct timeval tv = ast_tvnow(); 09532 long timesecs; 09533 09534 if (ast_strlen_zero(data)) { 09535 ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?'labeliftrue':'labeliffalse'\n"); 09536 return -1; 09537 } 09538 09539 ts = s = ast_strdupa(data); 09540 09541 if (chan) { 09542 ast_channel_lock(chan); 09543 if ((ctime = pbx_builtin_getvar_helper(chan, "TESTTIME")) && sscanf(ctime, "%ld", ×ecs) == 1) { 09544 tv.tv_sec = timesecs; 09545 } else if (ctime) { 09546 ast_log(LOG_WARNING, "Using current time to evaluate\n"); 09547 /* Reset when unparseable */ 09548 pbx_builtin_setvar_helper(chan, "TESTTIME", NULL); 09549 } 09550 ast_channel_unlock(chan); 09551 } 09552 /* Separate the Goto path */ 09553 strsep(&ts, "?"); 09554 branch1 = strsep(&ts,":"); 09555 branch2 = strsep(&ts,""); 09556 09557 /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ 09558 if (ast_build_timing(&timing, s) && ast_check_timing2(&timing, tv)) { 09559 branch = branch1; 09560 } else { 09561 branch = branch2; 09562 } 09563 ast_destroy_timing(&timing); 09564 09565 if (ast_strlen_zero(branch)) { 09566 ast_debug(1, "Not taking any branch\n"); 09567 return 0; 09568 } 09569 09570 return pbx_builtin_goto(chan, branch); 09571 }
static int pbx_builtin_hangup | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9462 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.
09463 { 09464 ast_set_hangupsource(chan, "dialplan/builtin", 0); 09465 09466 if (!ast_strlen_zero(data)) { 09467 int cause; 09468 char *endptr; 09469 09470 if ((cause = ast_str2cause(data)) > -1) { 09471 chan->hangupcause = cause; 09472 return -1; 09473 } 09474 09475 cause = strtol((const char *) data, &endptr, 10); 09476 if (cause != 0 || (data != endptr)) { 09477 chan->hangupcause = cause; 09478 return -1; 09479 } 09480 09481 ast_log(LOG_WARNING, "Invalid cause given to Hangup(): \"%s\"\n", (char *) data); 09482 } 09483 09484 if (!chan->hangupcause) { 09485 chan->hangupcause = AST_CAUSE_NORMAL_CLEARING; 09486 } 09487 09488 return -1; 09489 }
static int pbx_builtin_proceeding | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9311 of file pbx.c.
References AST_CONTROL_PROCEEDING, and ast_indicate().
09312 { 09313 ast_indicate(chan, AST_CONTROL_PROCEEDING); 09314 return 0; 09315 }
static int pbx_builtin_progress | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9320 of file pbx.c.
References AST_CONTROL_PROGRESS, and ast_indicate().
09321 { 09322 ast_indicate(chan, AST_CONTROL_PROGRESS); 09323 return 0; 09324 }
static int pbx_builtin_resetcdr | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9432 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.
09433 { 09434 char *args; 09435 struct ast_flags flags = { 0 }; 09436 09437 if (!ast_strlen_zero(data)) { 09438 args = ast_strdupa(data); 09439 ast_app_parse_options(resetcdr_opts, &flags, NULL, args); 09440 } 09441 09442 ast_cdr_reset(chan->cdr, &flags); 09443 09444 return 0; 09445 }
static int pbx_builtin_ringing | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9329 of file pbx.c.
References AST_CONTROL_RINGING, and ast_indicate().
09330 { 09331 ast_indicate(chan, AST_CONTROL_RINGING); 09332 return 0; 09333 }
static int pbx_builtin_setamaflags | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9450 of file pbx.c.
References ast_cdr_setamaflags(), ast_channel_lock, and ast_channel_unlock.
09451 { 09452 /* Copy the AMA Flags as specified */ 09453 ast_channel_lock(chan); 09454 ast_cdr_setamaflags(chan, data ? data : ""); 09455 ast_channel_unlock(chan); 09456 return 0; 09457 }
static int pbx_builtin_wait | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9630 of file pbx.c.
References ast_app_parse_timelen(), ast_safe_sleep(), and TIMELEN_SECONDS.
09631 { 09632 int ms; 09633 09634 /* Wait for "n" seconds */ 09635 if (!ast_app_parse_timelen(data, &ms, TIMELEN_SECONDS) && ms > 0) { 09636 return ast_safe_sleep(chan, ms); 09637 } 09638 return 0; 09639 }
static int pbx_builtin_waitexten | ( | struct ast_channel * | , | |
const char * | ||||
) | [static] |
Definition at line 9644 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.
09645 { 09646 int ms, res; 09647 struct ast_flags flags = {0}; 09648 char *opts[1] = { NULL }; 09649 char *parse; 09650 AST_DECLARE_APP_ARGS(args, 09651 AST_APP_ARG(timeout); 09652 AST_APP_ARG(options); 09653 ); 09654 09655 if (!ast_strlen_zero(data)) { 09656 parse = ast_strdupa(data); 09657 AST_STANDARD_APP_ARGS(args, parse); 09658 } else 09659 memset(&args, 0, sizeof(args)); 09660 09661 if (args.options) 09662 ast_app_parse_options(waitexten_opts, &flags, opts, args.options); 09663 09664 if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) { 09665 ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n"); 09666 } else if (ast_test_flag(&flags, WAITEXTEN_MOH)) { 09667 ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL), strlen(opts[0])); 09668 } else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) { 09669 struct ast_tone_zone_sound *ts = ast_get_indication_tone(chan->zone, "dial"); 09670 if (ts) { 09671 ast_playtones_start(chan, 0, ts->data, 0); 09672 ts = ast_tone_zone_sound_unref(ts); 09673 } else { 09674 ast_tonepair_start(chan, 350, 440, 0, 0); 09675 } 09676 } 09677 /* Wait for "n" seconds */ 09678 if (!ast_app_parse_timelen(args.timeout, &ms, TIMELEN_SECONDS) && ms > 0) { 09679 /* Yay! */ 09680 } else if (chan->pbx) { 09681 ms = chan->pbx->rtimeoutms; 09682 } else { 09683 ms = 10000; 09684 } 09685 09686 res = ast_waitfordigit(chan, ms); 09687 if (!res) { 09688 if (ast_check_hangup(chan)) { 09689 /* Call is hungup for some reason. */ 09690 res = -1; 09691 } else if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, 09692 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 09693 ast_verb(3, "Timeout on %s, continuing...\n", chan->name); 09694 } else if (ast_exists_extension(chan, chan->context, "t", 1, 09695 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 09696 ast_verb(3, "Timeout on %s, going to 't'\n", chan->name); 09697 set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */ 09698 } else if (ast_exists_extension(chan, chan->context, "e", 1, 09699 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 09700 raise_exception(chan, "RESPONSETIMEOUT", 0); /* 0 will become 1, next time through the loop */ 09701 } else { 09702 ast_log(LOG_WARNING, "Timeout but no rule 't' or 'e' in context '%s'\n", 09703 chan->context); 09704 res = -1; 09705 } 09706 } 09707 09708 if (ast_test_flag(&flags, WAITEXTEN_MOH)) 09709 ast_indicate(chan, AST_CONTROL_UNHOLD); 09710 else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) 09711 ast_playtones_stop(chan); 09712 09713 return res; 09714 }