Wed Oct 28 11:46:24 2009

Asterisk developer's documentation


Module: Dial plan applications

Applications support the dialplan. They register dynamically with. More...


Files

file  app_adsiprog.c
 Program Asterisk ADSI Scripts into phone.
file  app_alarmreceiver.c
 Central Station Alarm receiver for Ademco Contact ID.
file  app_authenticate.c
 Execute arbitrary authenticate commands.
file  app_cdr.c
 Applications connected with CDR engine.
file  app_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
 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_osplookup.c
 Open Settlement Protocol (OSP) Applications.
file  app_page.c
 page() - Paging application
file  app_parkandannounce.c
 ParkAndAnnounce application for Asterisk.
file  app_pickupchan.c
 Pickup a ringing channel.
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_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
  • 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_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 *)

Detailed Description

Applications support the dialplan. They register dynamically with.

Asterisk Dial Plan Applications

See also:
ast_register_application() and unregister with

ast_unregister_application()

See also

Function Documentation

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

iax2provision

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

11141 {
11142    int res;
11143    char *sdata;
11144    char *opts;
11145    int force =0;
11146    unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
11147    if (ast_strlen_zero(data))
11148       data = "default";
11149    sdata = ast_strdupa(data);
11150    opts = strchr(sdata, '|');
11151    if (opts)
11152       *opts='\0';
11153 
11154    if (chan->tech != &iax2_tech) {
11155       ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n");
11156       return -1;
11157    } 
11158    if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) {
11159       ast_log(LOG_NOTICE, "Can't provision something with no IP?\n");
11160       return -1;
11161    }
11162    res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force);
11163    ast_verb(3, "Provisioned IAXY at '%s' with '%s'= %d\n",
11164       ast_inet_ntoa(iaxs[callno]->addr.sin_addr),
11165       sdata, res);
11166    return res;
11167 }

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

Definition at line 7629 of file pbx.c.

References __ast_answer(), ast_channel::_state, AST_STATE_UP, and ast_strlen_zero().

07630 {
07631    int delay = 0;
07632 
07633    if ((chan->_state != AST_STATE_UP) && !ast_strlen_zero(data))
07634       delay = atoi(data);
07635 
07636    if (delay < 0) {
07637       delay = 0;
07638    }
07639 
07640    return __ast_answer(chan, delay, 1);
07641 }

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

Definition at line 7878 of file pbx.c.

References ast_channel::_state, ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_copy_string(), AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, 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_setvar_helper(), ast_channel::priority, and strsep().

07879 {
07880    int res = 0;
07881    int mres = 0;
07882    struct ast_flags flags = {0};
07883    char *parse, exten[2] = "";
07884    AST_DECLARE_APP_ARGS(args,
07885       AST_APP_ARG(filename);
07886       AST_APP_ARG(options);
07887       AST_APP_ARG(lang);
07888       AST_APP_ARG(context);
07889    );
07890 
07891    if (ast_strlen_zero(data)) {
07892       ast_log(LOG_WARNING, "Background requires an argument (filename)\n");
07893       return -1;
07894    }
07895 
07896    parse = ast_strdupa(data);
07897 
07898    AST_STANDARD_APP_ARGS(args, parse);
07899 
07900    if (ast_strlen_zero(args.lang))
07901       args.lang = (char *)chan->language; /* XXX this is const */
07902 
07903    if (ast_strlen_zero(args.context))
07904       args.context = chan->context;
07905 
07906    if (args.options) {
07907       if (!strcasecmp(args.options, "skip"))
07908          flags.flags = BACKGROUND_SKIP;
07909       else if (!strcasecmp(args.options, "noanswer"))
07910          flags.flags = BACKGROUND_NOANSWER;
07911       else
07912          ast_app_parse_options(background_opts, &flags, NULL, args.options);
07913    }
07914 
07915    /* Answer if need be */
07916    if (chan->_state != AST_STATE_UP) {
07917       if (ast_test_flag(&flags, BACKGROUND_SKIP)) {
07918          goto done;
07919       } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) {
07920          res = ast_answer(chan);
07921       }
07922    }
07923 
07924    if (!res) {
07925       char *back = args.filename;
07926       char *front;
07927 
07928       ast_stopstream(chan);      /* Stop anything playing */
07929       /* Stream the list of files */
07930       while (!res && (front = strsep(&back, "&")) ) {
07931          if ( (res = ast_streamfile(chan, front, args.lang)) ) {
07932             ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data);
07933             res = 0;
07934             mres = 1;
07935             break;
07936          }
07937          if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) {
07938             res = ast_waitstream(chan, "");
07939          } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) {
07940             res = ast_waitstream_exten(chan, args.context);
07941          } else {
07942             res = ast_waitstream(chan, AST_DIGIT_ANY);
07943          }
07944          ast_stopstream(chan);
07945       }
07946    }
07947 
07948    /*
07949     * If the single digit DTMF is an extension in the specified context, then
07950     * go there and signal no DTMF.  Otherwise, we should exit with that DTMF.
07951     * If we're in Macro, we'll exit and seek that DTMF as the beginning of an
07952     * extension in the Macro's calling context.  If we're not in Macro, then
07953     * we'll simply seek that extension in the calling context.  Previously,
07954     * someone complained about the behavior as it related to the interior of a
07955     * Gosub routine, and the fix (#14011) inadvertently broke FreePBX
07956     * (#14940).  This change should fix both of these situations, but with the
07957     * possible incompatibility that if a single digit extension does not exist
07958     * (but a longer extension COULD have matched), it would have previously
07959     * gone immediately to the "i" extension, but will now need to wait for a
07960     * timeout.
07961     */
07962    if ((exten[0] = res) && !ast_matchmore_extension(chan, args.context, exten, 1, chan->cid.cid_num)) {
07963       snprintf(chan->exten, sizeof(chan->exten), "%c", res);
07964       ast_copy_string(chan->context, args.context, sizeof(chan->context));
07965       chan->priority = 0;
07966       res = 0;
07967    }
07968 done:
07969    pbx_builtin_setvar_helper(chan, "BACKGROUNDSTATUS", mres ? "FAILED" : "SUCCESS");
07970    return res;
07971 }

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

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

07600 {
07601    ast_indicate(chan, AST_CONTROL_BUSY);
07602    /* Don't change state of an UP channel, just indicate
07603       busy in audio */
07604    if (chan->_state != AST_STATE_UP) {
07605       ast_setstate(chan, AST_STATE_BUSY);
07606       ast_cdr_busy(chan->cdr);
07607    }
07608    wait_for_hangup(chan, data);
07609    return -1;
07610 }

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

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

07616 {
07617    ast_indicate(chan, AST_CONTROL_CONGESTION);
07618    /* Don't change state of an UP channel, just indicate
07619       congestion in audio */
07620    if (chan->_state != AST_STATE_UP)
07621       ast_setstate(chan, AST_STATE_BUSY);
07622    wait_for_hangup(chan, data);
07623    return -1;
07624 }

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

Definition at line 7745 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, S_OR, and strsep().

07746 {
07747    char *s, *appname;
07748    struct ast_timing timing;
07749    struct ast_app *app;
07750    static const char *usage = "ExecIfTime requires an argument:\n  <time range>,<days of week>,<days of month>,<months>?<appname>[(<appargs>)]";
07751 
07752    if (ast_strlen_zero(data)) {
07753       ast_log(LOG_WARNING, "%s\n", usage);
07754       return -1;
07755    }
07756 
07757    appname = ast_strdupa(data);
07758 
07759    s = strsep(&appname, "?"); /* Separate the timerange and application name/data */
07760    if (!appname) {   /* missing application */
07761       ast_log(LOG_WARNING, "%s\n", usage);
07762       return -1;
07763    }
07764 
07765    if (!ast_build_timing(&timing, s)) {
07766       ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage);
07767       return -1;
07768    }
07769 
07770    if (!ast_check_timing(&timing))  /* outside the valid time window, just return */
07771       return 0;
07772 
07773    /* now split appname(appargs) */
07774    if ((s = strchr(appname, '('))) {
07775       char *e;
07776       *s++ = '\0';
07777       if ((e = strrchr(s, ')')))
07778          *e = '\0';
07779       else
07780          ast_log(LOG_WARNING, "Failed to find closing parenthesis\n");
07781    }
07782       
07783 
07784    if ((app = pbx_findapp(appname))) {
07785       return pbx_exec(chan, app, S_OR(s, ""));
07786    } else {
07787       ast_log(LOG_WARNING, "Cannot locate application %s\n", appname);
07788       return -1;
07789    }
07790 }

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

Goto

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

07977 {
07978    int res = ast_parseable_goto(chan, data);
07979    if (!res)
07980       ast_verb(3, "Goto (%s,%s,%d)\n", chan->context, chan->exten, chan->priority + 1);
07981    return res;
07982 }

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

Definition at line 7711 of file pbx.c.

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

07712 {
07713    char *s, *ts, *branch1, *branch2, *branch;
07714    struct ast_timing timing;
07715 
07716    if (ast_strlen_zero(data)) {
07717       ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n  <time range>,<days of week>,<days of month>,<months>?'labeliftrue':'labeliffalse'\n");
07718       return -1;
07719    }
07720 
07721    ts = s = ast_strdupa(data);
07722 
07723    /* Separate the Goto path */
07724    strsep(&ts, "?");
07725    branch1 = strsep(&ts,":");
07726    branch2 = strsep(&ts,"");
07727 
07728    /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */
07729    if (ast_build_timing(&timing, s) && ast_check_timing(&timing))
07730       branch = branch1;
07731    else
07732       branch = branch2;
07733 
07734    if (ast_strlen_zero(branch)) {
07735       ast_debug(1, "Not taking any branch\n");
07736       return 0;
07737    }
07738 
07739    return pbx_builtin_goto(chan, branch);
07740 }

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

Definition at line 7681 of file pbx.c.

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

07682 {
07683    if (!ast_strlen_zero(data)) {
07684       int cause;
07685       char *endptr;
07686 
07687       if ((cause = ast_str2cause(data)) > -1) {
07688          chan->hangupcause = cause;
07689          return -1;
07690       }
07691       
07692       cause = strtol((const char *) data, &endptr, 10);
07693       if (cause != 0 || (data != endptr)) {
07694          chan->hangupcause = cause;
07695          return -1;
07696       }
07697          
07698       ast_log(LOG_WARNING, "Invalid cause given to Hangup(): \"%s\"\n", (char *) data);
07699    }
07700 
07701    if (!chan->hangupcause) {
07702       chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
07703    }
07704 
07705    return -1;
07706 }

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

Definition at line 7572 of file pbx.c.

References AST_CONTROL_PROCEEDING, and ast_indicate().

07573 {
07574    ast_indicate(chan, AST_CONTROL_PROCEEDING);
07575    return 0;
07576 }

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

Definition at line 7581 of file pbx.c.

References AST_CONTROL_PROGRESS, and ast_indicate().

07582 {
07583    ast_indicate(chan, AST_CONTROL_PROGRESS);
07584    return 0;
07585 }

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

Definition at line 7653 of file pbx.c.

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

07654 {
07655    char *args;
07656    struct ast_flags flags = { 0 };
07657 
07658    if (!ast_strlen_zero(data)) {
07659       args = ast_strdupa(data);
07660       ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
07661    }
07662 
07663    ast_cdr_reset(chan->cdr, &flags);
07664 
07665    return 0;
07666 }

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

Definition at line 7590 of file pbx.c.

References AST_CONTROL_RINGING, and ast_indicate().

07591 {
07592    ast_indicate(chan, AST_CONTROL_RINGING);
07593    return 0;
07594 }

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

Definition at line 7671 of file pbx.c.

References ast_cdr_setamaflags().

07672 {
07673    /* Copy the AMA Flags as specified */
07674    ast_cdr_setamaflags(chan, data ? data : "");
07675    return 0;
07676 }

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

Definition at line 7795 of file pbx.c.

References ast_safe_sleep(), and s.

07796 {
07797    double s;
07798    int ms;
07799 
07800    /* Wait for "n" seconds */
07801    if (data && (s = atof(data)) > 0.0) {
07802       ms = s * 1000.0;
07803       return ast_safe_sleep(chan, ms);
07804    }
07805    return 0;
07806 }

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

Definition at line 7811 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_tonepair_start(), ast_verb, ast_waitfordigit(), ast_channel::cid, ast_callerid::cid_num, ast_channel::context, tone_zone_sound::data, ast_channel::exten, LOG_WARNING, ast_channel::name, parse(), ast_channel::pbx, ast_channel::priority, ast_pbx::rtimeout, s, set_ext_pri(), WAITEXTEN_DIALTONE, WAITEXTEN_MOH, waitexten_opts, and ast_channel::zone.

07812 {
07813    int ms, res;
07814    double s;
07815    struct ast_flags flags = {0};
07816    char *opts[1] = { NULL };
07817    char *parse;
07818    AST_DECLARE_APP_ARGS(args,
07819       AST_APP_ARG(timeout);
07820       AST_APP_ARG(options);
07821    );
07822 
07823    if (!ast_strlen_zero(data)) {
07824       parse = ast_strdupa(data);
07825       AST_STANDARD_APP_ARGS(args, parse);
07826    } else
07827       memset(&args, 0, sizeof(args));
07828 
07829    if (args.options)
07830       ast_app_parse_options(waitexten_opts, &flags, opts, args.options);
07831    
07832    if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) {
07833       ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n"); 
07834    } else if (ast_test_flag(&flags, WAITEXTEN_MOH)) {
07835       ast_indicate_data(chan, AST_CONTROL_HOLD, opts[0], strlen(opts[0]));
07836    } else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) {
07837       const struct tone_zone_sound *ts = ast_get_indication_tone(chan->zone, "dial");
07838       if (ts)
07839          ast_playtones_start(chan, 0, ts->data, 0);
07840       else
07841          ast_tonepair_start(chan, 350, 440, 0, 0);
07842    }
07843    /* Wait for "n" seconds */
07844    if (args.timeout && (s = atof(args.timeout)) > 0)
07845        ms = s * 1000.0;
07846    else if (chan->pbx)
07847       ms = chan->pbx->rtimeout * 1000;
07848    else
07849       ms = 10000;
07850 
07851    res = ast_waitfordigit(chan, ms);
07852    if (!res) {
07853       if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) {
07854          ast_verb(3, "Timeout on %s, continuing...\n", chan->name);
07855       } else if (chan->_softhangup == AST_SOFTHANGUP_TIMEOUT) {
07856          ast_verb(3, "Call timeout on %s, checking for 'T'\n", chan->name);
07857          res = -1;
07858       } else if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) {
07859          ast_verb(3, "Timeout on %s, going to 't'\n", chan->name);
07860          set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */
07861       } else {
07862          ast_log(LOG_WARNING, "Timeout but no rule 't' in context '%s'\n", chan->context);
07863          res = -1;
07864       }
07865    }
07866 
07867    if (ast_test_flag(&flags, WAITEXTEN_MOH))
07868       ast_indicate(chan, AST_CONTROL_UNHOLD);
07869    else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE))
07870       ast_playtones_stop(chan);
07871 
07872    return res;
07873 }


Generated on Wed Oct 28 11:46:24 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6