Thu Oct 11 06:44:30 2012

Asterisk developer's documentation


Module: Dial plan applications

Applications support the dialplan. They register dynamically with ast_register_application() and unregister with ast_unregister_application(). 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_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_controlplayback.c
 Trivial application to control playback of a sound file.
file  app_dahdibarge.c
 Zap Barge support.
file  app_dahdiras.c
 Execute an ISDN RAS.
file  app_dahdiscan.c
 Zap 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_hasnewvoicemail.c
 HasVoicemail application.
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_lookupblacklist.c
 App to lookup the callerid number, and see if it is blacklisted.
file  app_lookupcidname.c
 App to set callerid name from database, based on directory number.
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_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_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_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_random.c
 Random application.
file  app_read.c
 Trivial application to read a variable.
file  app_readfile.c
 ReadFile application -- Reads in a File for you.
file  app_realtime.c
 RealTime App.
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.
file  app_setcdruserfield.c
 Applictions connected with CDR engine.
file  app_settransfercapability.c
 App to set the ISDN Transfer Capability.
file  app_skel.c
 Skeleton application.
file  app_sms.c
 SMS application - ETSI ES 201 912 protocol 1 implimentation.
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
  • Waits for up to 'x' milliseconds of silence, 'y' times
  • WaitForSilence(500,2) will wait for 1/2 second of silence, twice
  • WaitForSilence(1000,1) will wait for 1 second of silence, once
  • WaitForSilence(300,3,10) will wait for 300ms of silence, 3 times, and return after 10sec
    .

file  app_while.c
 While Loop Implementation.
file  app_zapateller.c
 Playback the special information tone to get rid of telemarketers.

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 *)

Detailed Description

Applications support the dialplan. They register dynamically with ast_register_application() and unregister with ast_unregister_application().

Asterisk Dial Plan Applications

See also

Function Documentation

static int iax2_prov_app ( struct ast_channel chan,
void *  data 
) [static]

iax2provision

Definition at line 10280 of file chan_iax2.c.

References iax2_registry::addr, ast_inet_ntoa(), ast_log(), ast_strdupa, ast_strlen_zero(), ast_verbose(), iax2_registry::callno, iax2_provision(), LOG_NOTICE, option_verbose, PTR_TO_CALLNO, create_addr_info::sockfd, ast_channel::tech, ast_channel::tech_pvt, and VERBOSE_PREFIX_3.

Referenced by load_module().

10281 {
10282    int res;
10283    char *sdata;
10284    char *opts;
10285    int force =0;
10286    unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
10287    if (ast_strlen_zero(data))
10288       data = "default";
10289    sdata = ast_strdupa(data);
10290    opts = strchr(sdata, '|');
10291    if (opts)
10292       *opts='\0';
10293 
10294    if (chan->tech != &iax2_tech) {
10295       ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n");
10296       return -1;
10297    } 
10298    if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) {
10299       ast_log(LOG_NOTICE, "Can't provision something with no IP?\n");
10300       return -1;
10301    }
10302    res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force);
10303    if (option_verbose > 2)
10304       ast_verbose(VERBOSE_PREFIX_3 "Provisioned IAXY at '%s' with '%s'= %d\n", 
10305       ast_inet_ntoa(iaxs[callno]->addr.sin_addr),
10306       sdata, res);
10307    return res;
10308 }

static int pbx_builtin_answer ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5553 of file pbx.c.

References ast_channel::_state, ast_answer(), ast_safe_sleep(), AST_STATE_UP, and ast_strlen_zero().

05554 {
05555    int delay = 0;
05556    int res;
05557 
05558    if (chan->_state == AST_STATE_UP)
05559       delay = 0;
05560    else if (!ast_strlen_zero(data))
05561       delay = atoi(data);
05562 
05563    res = ast_answer(chan);
05564    if (res)
05565       return res;
05566 
05567    if (delay)
05568       res = ast_safe_sleep(chan, delay);
05569 
05570    return res;
05571 }

static int pbx_builtin_background ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5786 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(), and ast_channel::priority.

05787 {
05788    int res = 0;
05789    struct ast_flags flags = {0};
05790    char *parse, exten[2] = "";
05791    AST_DECLARE_APP_ARGS(args,
05792       AST_APP_ARG(filename);
05793       AST_APP_ARG(options);
05794       AST_APP_ARG(lang);
05795       AST_APP_ARG(context);
05796    );
05797 
05798    if (ast_strlen_zero(data)) {
05799       ast_log(LOG_WARNING, "Background requires an argument (filename)\n");
05800       return -1;
05801    }
05802 
05803    parse = ast_strdupa(data);
05804 
05805    AST_STANDARD_APP_ARGS(args, parse);
05806 
05807    if (ast_strlen_zero(args.lang))
05808       args.lang = (char *)chan->language; /* XXX this is const */
05809 
05810    if (ast_strlen_zero(args.context)) {
05811       const char *context;
05812       ast_channel_lock(chan);
05813       if ((context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"))) {
05814          args.context = ast_strdupa(context);
05815       } else {
05816          args.context = chan->context;
05817       }
05818       ast_channel_unlock(chan);
05819    }
05820 
05821    if (args.options) {
05822       if (!strcasecmp(args.options, "skip"))
05823          flags.flags = BACKGROUND_SKIP;
05824       else if (!strcasecmp(args.options, "noanswer"))
05825          flags.flags = BACKGROUND_NOANSWER;
05826       else
05827          ast_app_parse_options(background_opts, &flags, NULL, args.options);
05828    }
05829 
05830    /* Answer if need be */
05831    if (chan->_state != AST_STATE_UP) {
05832       if (ast_test_flag(&flags, BACKGROUND_SKIP)) {
05833          return 0;
05834       } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) {
05835          res = ast_answer(chan);
05836       }
05837    }
05838 
05839    if (!res) {
05840       char *back = args.filename;
05841       char *front;
05842       ast_stopstream(chan);      /* Stop anything playing */
05843       /* Stream the list of files */
05844       while (!res && (front = strsep(&back, "&")) ) {
05845          if ( (res = ast_streamfile(chan, front, args.lang)) ) {
05846             ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data);
05847             res = 0;
05848             break;
05849          }
05850          if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) {
05851             res = ast_waitstream(chan, "");
05852          } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) {
05853             res = ast_waitstream_exten(chan, args.context);
05854          } else {
05855             res = ast_waitstream(chan, AST_DIGIT_ANY);
05856          }
05857          ast_stopstream(chan);
05858       }
05859    }
05860 
05861    /*
05862     * If the single digit DTMF is an extension in the specified context, then
05863     * go there and signal no DTMF.  Otherwise, we should exit with that DTMF.
05864     * If we're in Macro, we'll exit and seek that DTMF as the beginning of an
05865     * extension in the Macro's calling context.  If we're not in Macro, then
05866     * we'll simply seek that extension in the calling context.  Previously,
05867     * someone complained about the behavior as it related to the interior of a
05868     * Gosub routine, and the fix (#14011) inadvertently broke FreePBX
05869     * (#14940).  This change should fix both of these situations, but with the
05870     * possible incompatibility that if a single digit extension does not exist
05871     * (but a longer extension COULD have matched), it would have previously
05872     * gone immediately to the "i" extension, but will now need to wait for a
05873     * timeout.
05874     *
05875     * Later, we had to add a flag to disable this workaround, because AGI
05876     * users can EXEC Background and reasonably expect that the DTMF code will
05877     * be returned (see #16434).
05878     */
05879    if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) &&
05880          (exten[0] = res) &&
05881          ast_canmatch_extension(chan, args.context, exten, 1, chan->cid.cid_num) &&
05882          !ast_matchmore_extension(chan, args.context, exten, 1, chan->cid.cid_num)) {
05883       snprintf(chan->exten, sizeof(chan->exten), "%c", res);
05884       ast_copy_string(chan->context, args.context, sizeof(chan->context));
05885       chan->priority = 0;
05886       res = 0;
05887    }
05888    return res;
05889 }

static int pbx_builtin_busy ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5523 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().

05524 {
05525    ast_indicate(chan, AST_CONTROL_BUSY);
05526    /* Don't change state of an UP channel, just indicate
05527       busy in audio */
05528    if (chan->_state != AST_STATE_UP) {
05529       ast_setstate(chan, AST_STATE_BUSY);
05530       ast_cdr_busy(chan->cdr);
05531    }
05532    wait_for_hangup(chan, data);
05533    return -1;
05534 }

static int pbx_builtin_congestion ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5539 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().

05540 {
05541    ast_indicate(chan, AST_CONTROL_CONGESTION);
05542    /* Don't change state of an UP channel, just indicate
05543       congestion in audio */
05544    if (chan->_state != AST_STATE_UP)
05545       ast_setstate(chan, AST_STATE_BUSY);
05546    wait_for_hangup(chan, data);
05547    return -1;
05548 }

static int pbx_builtin_execiftime ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5666 of file pbx.c.

References ast_build_timing(), ast_check_timing(), ast_log(), ast_strdupa, ast_strlen_zero(), LOG_WARNING, pbx_exec(), pbx_findapp(), s, and S_OR.

05667 {
05668    char *s, *appname;
05669    struct ast_timing timing;
05670    struct ast_app *app;
05671    static const char *usage = "ExecIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?<appname>[|<appargs>]";
05672 
05673    if (ast_strlen_zero(data)) {
05674       ast_log(LOG_WARNING, "%s\n", usage);
05675       return -1;
05676    }
05677 
05678    appname = ast_strdupa(data);
05679 
05680    s = strsep(&appname,"?");  /* Separate the timerange and application name/data */
05681    if (!appname) {   /* missing application */
05682       ast_log(LOG_WARNING, "%s\n", usage);
05683       return -1;
05684    }
05685 
05686    if (!ast_build_timing(&timing, s)) {
05687       ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage);
05688       return -1;
05689    }
05690 
05691    if (!ast_check_timing(&timing))  /* outside the valid time window, just return */
05692       return 0;
05693 
05694    /* now split appname|appargs */
05695    if ((s = strchr(appname, '|')))
05696       *s++ = '\0';
05697 
05698    if ((app = pbx_findapp(appname))) {
05699       return pbx_exec(chan, app, S_OR(s, ""));
05700    } else {
05701       ast_log(LOG_WARNING, "Cannot locate application %s\n", appname);
05702       return -1;
05703    }
05704 }

static int pbx_builtin_goto ( struct ast_channel chan,
void *  data 
) [static]

Goto

Definition at line 5894 of file pbx.c.

References ast_parseable_goto(), ast_verbose(), ast_channel::context, ast_channel::exten, option_verbose, ast_channel::priority, and VERBOSE_PREFIX_3.

Referenced by pbx_builtin_gotoif(), and pbx_builtin_gotoiftime().

05895 {
05896    int res = ast_parseable_goto(chan, data);
05897    if (!res && (option_verbose > 2))
05898       ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
05899    return res;
05900 }

static int pbx_builtin_gotoiftime ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5640 of file pbx.c.

References ast_build_timing(), ast_check_timing(), ast_log(), ast_strdupa, ast_strlen_zero(), LOG_WARNING, pbx_builtin_goto(), and s.

05641 {
05642    int res=0;
05643    char *s, *ts;
05644    struct ast_timing timing;
05645 
05646    if (ast_strlen_zero(data)) {
05647       ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?[[context|]extension|]priority\n");
05648       return -1;
05649    }
05650 
05651    ts = s = ast_strdupa(data);
05652 
05653    /* Separate the Goto path */
05654    strsep(&ts,"?");
05655 
05656    /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */
05657    if (ast_build_timing(&timing, s) && ast_check_timing(&timing))
05658       res = pbx_builtin_goto(chan, ts);
05659    
05660    return res;
05661 }

static int pbx_builtin_hangup ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5610 of file pbx.c.

References AST_CAUSE_NORMAL_CLEARING, ast_log(), ast_str2cause(), ast_strlen_zero(), ast_channel::hangupcause, and LOG_NOTICE.

05611 {
05612    if (!ast_strlen_zero(data)) {
05613       int cause;
05614       char *endptr;
05615 
05616       if ((cause = ast_str2cause(data)) > -1) {
05617          chan->hangupcause = cause;
05618          return -1;
05619       }
05620       
05621       cause = strtol((const char *) data, &endptr, 10);
05622       if (cause != 0 || (data != endptr)) {
05623          chan->hangupcause = cause;
05624          return -1;
05625       }
05626          
05627       ast_log(LOG_NOTICE, "Invalid cause given to Hangup(): \"%s\"\n", (char *) data);
05628    }
05629 
05630    if (!chan->hangupcause) {
05631       chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
05632    }
05633 
05634    return -1;
05635 }

static int pbx_builtin_proceeding ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5496 of file pbx.c.

References AST_CONTROL_PROCEEDING, and ast_indicate().

05497 {
05498    ast_indicate(chan, AST_CONTROL_PROCEEDING);
05499    return 0;
05500 }

static int pbx_builtin_progress ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5505 of file pbx.c.

References AST_CONTROL_PROGRESS, and ast_indicate().

05506 {
05507    ast_indicate(chan, AST_CONTROL_PROGRESS);
05508    return 0;
05509 }

static int pbx_builtin_resetcdr ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5582 of file pbx.c.

References ast_app_parse_options(), ast_cdr_reset(), ast_strdupa, ast_strlen_zero(), ast_channel::cdr, and resetcdr_opts.

05583 {
05584    char *args;
05585    struct ast_flags flags = { 0 };
05586 
05587    if (!ast_strlen_zero(data)) {
05588       args = ast_strdupa(data);
05589       ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
05590    }
05591 
05592    ast_cdr_reset(chan->cdr, &flags);
05593 
05594    return 0;
05595 }

static int pbx_builtin_ringing ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5514 of file pbx.c.

References AST_CONTROL_RINGING, and ast_indicate().

05515 {
05516    ast_indicate(chan, AST_CONTROL_RINGING);
05517    return 0;
05518 }

static int pbx_builtin_setamaflags ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5600 of file pbx.c.

References ast_cdr_setamaflags().

05601 {
05602    /* Copy the AMA Flags as specified */
05603    ast_cdr_setamaflags(chan, data ? data : "");
05604    return 0;
05605 }

static int pbx_builtin_wait ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5709 of file pbx.c.

References ast_safe_sleep(), and s.

05710 {
05711    double s;
05712    int ms;
05713 
05714    /* Wait for "n" seconds */
05715    if (data && (s = atof(data)) > 0) {
05716       ms = s * 1000.0;
05717       return ast_safe_sleep(chan, ms);
05718    }
05719    return 0;
05720 }

static int pbx_builtin_waitexten ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 5725 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_indicate(), ast_indicate_data(), ast_log(), AST_SOFTHANGUP_TIMEOUT, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_verbose(), ast_waitfordigit(), ast_channel::cid, ast_callerid::cid_num, ast_channel::context, ast_channel::exten, LOG_WARNING, ast_channel::name, option_verbose, parse(), ast_channel::pbx, ast_channel::priority, ast_pbx::rtimeout, S_OR, set_ext_pri(), VERBOSE_PREFIX_3, WAITEXTEN_MOH, and waitexten_opts.

05726 {
05727    int ms, res;
05728    double sec;
05729    struct ast_flags flags = {0};
05730    char *opts[1] = { NULL };
05731    char *parse;
05732    AST_DECLARE_APP_ARGS(args,
05733       AST_APP_ARG(timeout);
05734       AST_APP_ARG(options);
05735    );
05736 
05737    if (!ast_strlen_zero(data)) {
05738       parse = ast_strdupa(data);
05739       AST_STANDARD_APP_ARGS(args, parse);
05740    } else
05741       memset(&args, 0, sizeof(args));
05742 
05743    if (args.options)
05744       ast_app_parse_options(waitexten_opts, &flags, opts, args.options);
05745    
05746    if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) {
05747       ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n"); 
05748    } else if (ast_test_flag(&flags, WAITEXTEN_MOH))
05749       ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL), strlen(opts[0]));
05750 
05751    /* Wait for "n" seconds */
05752    if (args.timeout && (sec = atof(args.timeout)) > 0.0)
05753       ms = 1000 * sec;
05754    else if (chan->pbx)
05755       ms = chan->pbx->rtimeout * 1000;
05756    else
05757       ms = 10000;
05758    res = ast_waitfordigit(chan, ms);
05759    if (!res) {
05760       if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) {
05761          if (option_verbose > 2)
05762             ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, continuing...\n", chan->name);
05763       } else if (chan->_softhangup & AST_SOFTHANGUP_TIMEOUT) {
05764          if (option_verbose > 2)
05765             ast_verbose(VERBOSE_PREFIX_3 "Call timeout on %s, checking for 'T'\n", chan->name);
05766          res = -1;
05767       } else if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) {
05768          if (option_verbose > 2)
05769             ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, going to 't'\n", chan->name);
05770          set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */
05771       } else {
05772          ast_log(LOG_WARNING, "Timeout but no rule 't' in context '%s'\n", chan->context);
05773          res = -1;
05774       }
05775    }
05776 
05777    if (ast_test_flag(&flags, WAITEXTEN_MOH))
05778       ast_indicate(chan, AST_CONTROL_UNHOLD);
05779 
05780    return res;
05781 }


Generated on Thu Oct 11 06:44:30 2012 for Asterisk - the Open Source PBX by  doxygen 1.5.6