Files | |
| file | app_adsiprog.c |
| Program Asterisk ADSI Scripts into phone. | |
| file | app_alarmreceiver.c |
| Central Station Alarm receiver for Ademco Contact ID. | |
| file | app_authenticate.c |
| Execute arbitrary authenticate commands. | |
| file | app_cdr.c |
| Applications connected with CDR engine. | |
| file | app_chanisavail.c |
| Check if Channel is Available. | |
| file | app_channelredirect.c |
| ChannelRedirect application. | |
| file | app_chanspy.c |
| ChanSpy: Listen in on any channel. | |
| file | app_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_dahdiscan.c |
| DAHDI Scanner. | |
| file | app_db.c |
| Database access functions. | |
| file | app_dial.c |
| dial() & retrydial() - Trivial application to dial a channel and send an URL on answer | |
| file | app_dictate.c |
| Virtual Dictation Machine Application For Asterisk. | |
| file | app_directed_pickup.c |
| Directed Call Pickup Support. | |
| file | app_directory.c |
| Provide a directory of extensions. | |
| file | app_disa.c |
| DISA -- Direct Inward System Access Application. | |
| file | app_dumpchan.c |
| Application to dump channel variables. | |
| file | app_echo.c |
| Echo application -- play back what you hear to evaluate latency. | |
| file | app_exec.c |
| Exec application. | |
| file | app_externalivr.c |
| External IVR application interface. | |
| file | app_festival.c |
| Connect to festival. | |
| file | app_flash.c |
| App to flash a DAHDI trunk. | |
| file | app_followme.c |
| Find-Me Follow-Me application. | |
| file | app_forkcdr.c |
| Fork CDR application. | |
| file | app_getcpeid.c |
| Get ADSI CPE ID. | |
| file | app_ices.c |
| Stream to an icecast server via ICES (see contrib/asterisk-ices.xml). | |
| file | app_image.c |
| App to transmit an image. | |
| file | app_ivrdemo.c |
| IVR Demo application. | |
| file | app_jack.c |
| Jack Application. | |
| file | app_macro.c |
| Dial plan macro Implementation. | |
| file | app_meetme.c |
| Meet me conference bridge and Shared Line Appearances. | |
| file | app_milliwatt.c |
| Digital Milliwatt Test. | |
| file | app_minivm.c |
| MiniVoiceMail - A Minimal Voicemail System for Asterisk. | |
| file | app_mixmonitor.c |
| MixMonitor() - Record a call and mix the audio during the recording. | |
| file | app_morsecode.c |
| Morsecode application. | |
| file | app_mp3.c |
| Silly application to play an MP3 file -- uses mpg123. | |
| file | app_nbscat.c |
| Silly application to play an NBScat file -- uses nbscat8k. | |
| file | app_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_sayunixtime.c |
| SayUnixTime application. | |
| file | app_senddtmf.c |
| App to send DTMF digits. | |
| file | app_sendtext.c |
| App to transmit a text message. | |
| file | app_setcallerid.c |
| App to set callerid presentation. | |
| file | app_skel.c |
| Skeleton application. | |
| file | app_sms.c |
| SMS application - ETSI ES 201 912 protocol 1 implementation. | |
| file | app_softhangup.c |
| SoftHangup application. | |
| file | app_speech_utils.c |
| Speech Recognition Utility Applications. | |
| file | app_stack.c |
| Stack applications Gosub, Return, etc. | |
| file | app_system.c |
| Execute arbitrary system commands. | |
| file | app_talkdetect.c |
| Playback a file with audio detect. | |
| file | app_test.c |
| Applications to test connection and produce report in text file. | |
| file | app_transfer.c |
| Transfer a caller. | |
| file | app_url.c |
| App to transmit a URL. | |
| file | app_userevent.c |
| UserEvent application -- send manager event. | |
| file | app_verbose.c |
| Verbose logging application. | |
| file | app_voicemail.c |
| Comedian Mail - Voicemail System. | |
| file | app_waitforring.c |
| Wait for Ring Application. | |
| file | app_waitforsilence.c |
Wait for Silence
| |
| file | app_waituntil.c |
| Sleep until the given epoch. | |
| file | app_while.c |
| While Loop Implementation. | |
| file | app_zapateller.c |
| Playback the special information tone to get rid of telemarketers. | |
| file | res_ael_share.c |
| Shareable AEL code -- mainly between internal and external modules. | |
| file | res_realtime.c |
| RealTime CLI. | |
Functions | |
| static int | iax2_prov_app (struct ast_channel *chan, void *data) |
| static int | pbx_builtin_answer (struct ast_channel *, void *) |
| static int | pbx_builtin_background (struct ast_channel *, void *) |
| static int | pbx_builtin_busy (struct ast_channel *, void *) |
| static int | pbx_builtin_congestion (struct ast_channel *, void *) |
| static int | pbx_builtin_execiftime (struct ast_channel *, void *) |
| static int | pbx_builtin_goto (struct ast_channel *, void *) |
| static int | pbx_builtin_gotoiftime (struct ast_channel *, void *) |
| static int | pbx_builtin_hangup (struct ast_channel *, void *) |
| static int | pbx_builtin_proceeding (struct ast_channel *, void *) |
| static int | pbx_builtin_progress (struct ast_channel *, void *) |
| static int | pbx_builtin_resetcdr (struct ast_channel *, void *) |
| static int | pbx_builtin_ringing (struct ast_channel *, void *) |
| static int | pbx_builtin_setamaflags (struct ast_channel *, void *) |
| static int | pbx_builtin_wait (struct ast_channel *, void *) |
| static int | pbx_builtin_waitexten (struct ast_channel *, void *) |
| static int iax2_prov_app | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
iax2provision
Definition at line 11416 of file chan_iax2.c.
References iax2_trunk_peer::addr, ast_inet_ntoa(), ast_log(), ast_strdupa, ast_strlen_zero(), ast_verb, iax2_provision(), LOG_NOTICE, PTR_TO_CALLNO, iax2_trunk_peer::sockfd, ast_channel::tech, and ast_channel::tech_pvt.
Referenced by load_module().
11417 { 11418 int res; 11419 char *sdata; 11420 char *opts; 11421 int force =0; 11422 unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt); 11423 if (ast_strlen_zero(data)) 11424 data = "default"; 11425 sdata = ast_strdupa(data); 11426 opts = strchr(sdata, '|'); 11427 if (opts) 11428 *opts='\0'; 11429 11430 if (chan->tech != &iax2_tech) { 11431 ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n"); 11432 return -1; 11433 } 11434 if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) { 11435 ast_log(LOG_NOTICE, "Can't provision something with no IP?\n"); 11436 return -1; 11437 } 11438 res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force); 11439 ast_verb(3, "Provisioned IAXY at '%s' with '%s'= %d\n", 11440 ast_inet_ntoa(iaxs[callno]->addr.sin_addr), 11441 sdata, res); 11442 return res; 11443 }
| static int pbx_builtin_answer | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8570 of file pbx.c.
References __ast_answer(), ast_channel::_state, AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_strlen_zero(), and parse().
08571 { 08572 int delay = 0; 08573 int answer_cdr = 1; 08574 char *parse; 08575 AST_DECLARE_APP_ARGS(args, 08576 AST_APP_ARG(delay); 08577 AST_APP_ARG(answer_cdr); 08578 ); 08579 08580 if (ast_strlen_zero(data)) { 08581 return __ast_answer(chan, 0, 1); 08582 } 08583 08584 parse = ast_strdupa(data); 08585 08586 AST_STANDARD_APP_ARGS(args, parse); 08587 08588 if (!ast_strlen_zero(args.delay) && (chan->_state != AST_STATE_UP)) 08589 delay = atoi(data); 08590 08591 if (delay < 0) { 08592 delay = 0; 08593 } 08594 08595 if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) { 08596 answer_cdr = 0; 08597 } 08598 08599 return __ast_answer(chan, delay, answer_cdr); 08600 }
| static int pbx_builtin_background | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8864 of file pbx.c.
References ast_channel::_state, ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_canmatch_extension(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, AST_FLAG_DISABLE_WORKAROUNDS, ast_log(), ast_matchmore_extension(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_stopstream(), ast_strdupa, ast_streamfile(), ast_strlen_zero(), ast_test_flag, ast_waitstream(), ast_waitstream_exten(), BACKGROUND_MATCHEXTEN, BACKGROUND_NOANSWER, background_opts, BACKGROUND_PLAYBACK, BACKGROUND_SKIP, ast_channel::cid, ast_callerid::cid_num, ast_channel::context, ast_channel::exten, ast_flags::flags, ast_channel::language, LOG_WARNING, ast_channel::name, parse(), pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), ast_channel::priority, and strsep().
08865 { 08866 int res = 0; 08867 int mres = 0; 08868 struct ast_flags flags = {0}; 08869 char *parse, exten[2] = ""; 08870 AST_DECLARE_APP_ARGS(args, 08871 AST_APP_ARG(filename); 08872 AST_APP_ARG(options); 08873 AST_APP_ARG(lang); 08874 AST_APP_ARG(context); 08875 ); 08876 08877 if (ast_strlen_zero(data)) { 08878 ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); 08879 return -1; 08880 } 08881 08882 parse = ast_strdupa(data); 08883 08884 AST_STANDARD_APP_ARGS(args, parse); 08885 08886 if (ast_strlen_zero(args.lang)) 08887 args.lang = (char *)chan->language; /* XXX this is const */ 08888 08889 if (ast_strlen_zero(args.context)) { 08890 const char *context; 08891 ast_channel_lock(chan); 08892 if ((context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"))) { 08893 args.context = ast_strdupa(context); 08894 } else { 08895 args.context = chan->context; 08896 } 08897 ast_channel_unlock(chan); 08898 } 08899 08900 if (args.options) { 08901 if (!strcasecmp(args.options, "skip")) 08902 flags.flags = BACKGROUND_SKIP; 08903 else if (!strcasecmp(args.options, "noanswer")) 08904 flags.flags = BACKGROUND_NOANSWER; 08905 else 08906 ast_app_parse_options(background_opts, &flags, NULL, args.options); 08907 } 08908 08909 /* Answer if need be */ 08910 if (chan->_state != AST_STATE_UP) { 08911 if (ast_test_flag(&flags, BACKGROUND_SKIP)) { 08912 goto done; 08913 } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) { 08914 res = ast_answer(chan); 08915 } 08916 } 08917 08918 if (!res) { 08919 char *back = args.filename; 08920 char *front; 08921 08922 ast_stopstream(chan); /* Stop anything playing */ 08923 /* Stream the list of files */ 08924 while (!res && (front = strsep(&back, "&")) ) { 08925 if ( (res = ast_streamfile(chan, front, args.lang)) ) { 08926 ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data); 08927 res = 0; 08928 mres = 1; 08929 break; 08930 } 08931 if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) { 08932 res = ast_waitstream(chan, ""); 08933 } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) { 08934 res = ast_waitstream_exten(chan, args.context); 08935 } else { 08936 res = ast_waitstream(chan, AST_DIGIT_ANY); 08937 } 08938 ast_stopstream(chan); 08939 } 08940 } 08941 08942 /* 08943 * If the single digit DTMF is an extension in the specified context, then 08944 * go there and signal no DTMF. Otherwise, we should exit with that DTMF. 08945 * If we're in Macro, we'll exit and seek that DTMF as the beginning of an 08946 * extension in the Macro's calling context. If we're not in Macro, then 08947 * we'll simply seek that extension in the calling context. Previously, 08948 * someone complained about the behavior as it related to the interior of a 08949 * Gosub routine, and the fix (#14011) inadvertently broke FreePBX 08950 * (#14940). This change should fix both of these situations, but with the 08951 * possible incompatibility that if a single digit extension does not exist 08952 * (but a longer extension COULD have matched), it would have previously 08953 * gone immediately to the "i" extension, but will now need to wait for a 08954 * timeout. 08955 * 08956 * Later, we had to add a flag to disable this workaround, because AGI 08957 * users can EXEC Background and reasonably expect that the DTMF code will 08958 * be returned (see #16434). 08959 */ 08960 if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) && 08961 (exten[0] = res) && 08962 ast_canmatch_extension(chan, args.context, exten, 1, chan->cid.cid_num) && 08963 !ast_matchmore_extension(chan, args.context, exten, 1, chan->cid.cid_num)) { 08964 snprintf(chan->exten, sizeof(chan->exten), "%c", res); 08965 ast_copy_string(chan->context, args.context, sizeof(chan->context)); 08966 chan->priority = 0; 08967 res = 0; 08968 } 08969 done: 08970 pbx_builtin_setvar_helper(chan, "BACKGROUNDSTATUS", mres ? "FAILED" : "SUCCESS"); 08971 return res; 08972 }
| static int pbx_builtin_busy | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8540 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().
08541 { 08542 ast_indicate(chan, AST_CONTROL_BUSY); 08543 /* Don't change state of an UP channel, just indicate 08544 busy in audio */ 08545 if (chan->_state != AST_STATE_UP) { 08546 ast_setstate(chan, AST_STATE_BUSY); 08547 ast_cdr_busy(chan->cdr); 08548 } 08549 wait_for_hangup(chan, data); 08550 return -1; 08551 }
| static int pbx_builtin_congestion | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8556 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().
08557 { 08558 ast_indicate(chan, AST_CONTROL_CONGESTION); 08559 /* Don't change state of an UP channel, just indicate 08560 congestion in audio */ 08561 if (chan->_state != AST_STATE_UP) 08562 ast_setstate(chan, AST_STATE_BUSY); 08563 wait_for_hangup(chan, data); 08564 return -1; 08565 }
| static int pbx_builtin_execiftime | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8725 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(), s, S_OR, and strsep().
08726 { 08727 char *s, *appname; 08728 struct ast_timing timing; 08729 struct ast_app *app; 08730 static const char *usage = "ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?<appname>[(<appargs>)]"; 08731 08732 if (ast_strlen_zero(data)) { 08733 ast_log(LOG_WARNING, "%s\n", usage); 08734 return -1; 08735 } 08736 08737 appname = ast_strdupa(data); 08738 08739 s = strsep(&appname, "?"); /* Separate the timerange and application name/data */ 08740 if (!appname) { /* missing application */ 08741 ast_log(LOG_WARNING, "%s\n", usage); 08742 return -1; 08743 } 08744 08745 if (!ast_build_timing(&timing, s)) { 08746 ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage); 08747 ast_destroy_timing(&timing); 08748 return -1; 08749 } 08750 08751 if (!ast_check_timing(&timing)) { /* outside the valid time window, just return */ 08752 ast_destroy_timing(&timing); 08753 return 0; 08754 } 08755 ast_destroy_timing(&timing); 08756 08757 /* now split appname(appargs) */ 08758 if ((s = strchr(appname, '('))) { 08759 char *e; 08760 *s++ = '\0'; 08761 if ((e = strrchr(s, ')'))) 08762 *e = '\0'; 08763 else 08764 ast_log(LOG_WARNING, "Failed to find closing parenthesis\n"); 08765 } 08766 08767 08768 if ((app = pbx_findapp(appname))) { 08769 return pbx_exec(chan, app, S_OR(s, "")); 08770 } else { 08771 ast_log(LOG_WARNING, "Cannot locate application %s\n", appname); 08772 return -1; 08773 } 08774 }
| static int pbx_builtin_goto | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Goto
Definition at line 8977 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().
08978 { 08979 int res = ast_parseable_goto(chan, data); 08980 if (!res) 08981 ast_verb(3, "Goto (%s,%s,%d)\n", chan->context, chan->exten, chan->priority + 1); 08982 return res; 08983 }
| static int pbx_builtin_gotoiftime | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8690 of file pbx.c.
References ast_build_timing(), ast_check_timing(), ast_debug, ast_destroy_timing(), ast_log(), ast_strdupa, ast_strlen_zero(), LOG_WARNING, pbx_builtin_goto(), s, and strsep().
08691 { 08692 char *s, *ts, *branch1, *branch2, *branch; 08693 struct ast_timing timing; 08694 08695 if (ast_strlen_zero(data)) { 08696 ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?'labeliftrue':'labeliffalse'\n"); 08697 return -1; 08698 } 08699 08700 ts = s = ast_strdupa(data); 08701 08702 /* Separate the Goto path */ 08703 strsep(&ts, "?"); 08704 branch1 = strsep(&ts,":"); 08705 branch2 = strsep(&ts,""); 08706 08707 /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ 08708 if (ast_build_timing(&timing, s) && ast_check_timing(&timing)) 08709 branch = branch1; 08710 else 08711 branch = branch2; 08712 ast_destroy_timing(&timing); 08713 08714 if (ast_strlen_zero(branch)) { 08715 ast_debug(1, "Not taking any branch\n"); 08716 return 0; 08717 } 08718 08719 return pbx_builtin_goto(chan, branch); 08720 }
| static int pbx_builtin_hangup | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8660 of file pbx.c.
References AST_CAUSE_NORMAL_CLEARING, ast_log(), ast_str2cause(), ast_strlen_zero(), cause, ast_channel::hangupcause, and LOG_WARNING.
08661 { 08662 if (!ast_strlen_zero(data)) { 08663 int cause; 08664 char *endptr; 08665 08666 if ((cause = ast_str2cause(data)) > -1) { 08667 chan->hangupcause = cause; 08668 return -1; 08669 } 08670 08671 cause = strtol((const char *) data, &endptr, 10); 08672 if (cause != 0 || (data != endptr)) { 08673 chan->hangupcause = cause; 08674 return -1; 08675 } 08676 08677 ast_log(LOG_WARNING, "Invalid cause given to Hangup(): \"%s\"\n", (char *) data); 08678 } 08679 08680 if (!chan->hangupcause) { 08681 chan->hangupcause = AST_CAUSE_NORMAL_CLEARING; 08682 } 08683 08684 return -1; 08685 }
| static int pbx_builtin_proceeding | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8513 of file pbx.c.
References AST_CONTROL_PROCEEDING, and ast_indicate().
08514 { 08515 ast_indicate(chan, AST_CONTROL_PROCEEDING); 08516 return 0; 08517 }
| static int pbx_builtin_progress | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8522 of file pbx.c.
References AST_CONTROL_PROGRESS, and ast_indicate().
08523 { 08524 ast_indicate(chan, AST_CONTROL_PROGRESS); 08525 return 0; 08526 }
| static int pbx_builtin_resetcdr | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8632 of file pbx.c.
References ast_app_parse_options(), ast_cdr_reset(), ast_strdupa, ast_strlen_zero(), ast_channel::cdr, and resetcdr_opts.
08633 { 08634 char *args; 08635 struct ast_flags flags = { 0 }; 08636 08637 if (!ast_strlen_zero(data)) { 08638 args = ast_strdupa(data); 08639 ast_app_parse_options(resetcdr_opts, &flags, NULL, args); 08640 } 08641 08642 ast_cdr_reset(chan->cdr, &flags); 08643 08644 return 0; 08645 }
| static int pbx_builtin_ringing | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8531 of file pbx.c.
References AST_CONTROL_RINGING, and ast_indicate().
08532 { 08533 ast_indicate(chan, AST_CONTROL_RINGING); 08534 return 0; 08535 }
| static int pbx_builtin_setamaflags | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8650 of file pbx.c.
References ast_cdr_setamaflags().
08651 { 08652 /* Copy the AMA Flags as specified */ 08653 ast_cdr_setamaflags(chan, data ? data : ""); 08654 return 0; 08655 }
| static int pbx_builtin_wait | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8779 of file pbx.c.
References ast_safe_sleep(), and s.
08780 { 08781 double s; 08782 int ms; 08783 08784 /* Wait for "n" seconds */ 08785 if (data && (s = atof(data)) > 0.0) { 08786 ms = s * 1000.0; 08787 return ast_safe_sleep(chan, ms); 08788 } 08789 return 0; 08790 }
| static int pbx_builtin_waitexten | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 8795 of file pbx.c.
References ast_channel::_softhangup, AST_APP_ARG, ast_app_parse_options(), AST_CONTROL_HOLD, AST_CONTROL_UNHOLD, AST_DECLARE_APP_ARGS, ast_exists_extension(), ast_get_indication_tone(), ast_indicate(), ast_indicate_data(), ast_log(), ast_playtones_start(), ast_playtones_stop(), AST_SOFTHANGUP_TIMEOUT, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_tone_zone_sound_unref(), ast_tonepair_start(), ast_verb, ast_waitfordigit(), ast_channel::cid, ast_callerid::cid_num, ast_channel::context, ast_tone_zone_sound::data, ast_channel::exten, LOG_WARNING, ast_channel::name, parse(), ast_channel::pbx, ast_channel::priority, ast_pbx::rtimeoutms, s, S_OR, set_ext_pri(), WAITEXTEN_DIALTONE, WAITEXTEN_MOH, waitexten_opts, and ast_channel::zone.
08796 { 08797 int ms, res; 08798 double s; 08799 struct ast_flags flags = {0}; 08800 char *opts[1] = { NULL }; 08801 char *parse; 08802 AST_DECLARE_APP_ARGS(args, 08803 AST_APP_ARG(timeout); 08804 AST_APP_ARG(options); 08805 ); 08806 08807 if (!ast_strlen_zero(data)) { 08808 parse = ast_strdupa(data); 08809 AST_STANDARD_APP_ARGS(args, parse); 08810 } else 08811 memset(&args, 0, sizeof(args)); 08812 08813 if (args.options) 08814 ast_app_parse_options(waitexten_opts, &flags, opts, args.options); 08815 08816 if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) { 08817 ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n"); 08818 } else if (ast_test_flag(&flags, WAITEXTEN_MOH)) { 08819 ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL), strlen(opts[0])); 08820 } else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) { 08821 struct ast_tone_zone_sound *ts = ast_get_indication_tone(chan->zone, "dial"); 08822 if (ts) { 08823 ast_playtones_start(chan, 0, ts->data, 0); 08824 ts = ast_tone_zone_sound_unref(ts); 08825 } else { 08826 ast_tonepair_start(chan, 350, 440, 0, 0); 08827 } 08828 } 08829 /* Wait for "n" seconds */ 08830 if (args.timeout && (s = atof(args.timeout)) > 0) 08831 ms = s * 1000.0; 08832 else if (chan->pbx) 08833 ms = chan->pbx->rtimeoutms; 08834 else 08835 ms = 10000; 08836 08837 res = ast_waitfordigit(chan, ms); 08838 if (!res) { 08839 if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) { 08840 ast_verb(3, "Timeout on %s, continuing...\n", chan->name); 08841 } else if (chan->_softhangup == AST_SOFTHANGUP_TIMEOUT) { 08842 ast_verb(3, "Call timeout on %s, checking for 'T'\n", chan->name); 08843 res = -1; 08844 } else if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) { 08845 ast_verb(3, "Timeout on %s, going to 't'\n", chan->name); 08846 set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */ 08847 } else { 08848 ast_log(LOG_WARNING, "Timeout but no rule 't' in context '%s'\n", chan->context); 08849 res = -1; 08850 } 08851 } 08852 08853 if (ast_test_flag(&flags, WAITEXTEN_MOH)) 08854 ast_indicate(chan, AST_CONTROL_UNHOLD); 08855 else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) 08856 ast_playtones_stop(chan); 08857 08858 return res; 08859 }
1.5.9