Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:49:24 2009

## 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_chanspy.c
| ChanSpy: Listen in on any channel.

file | app_controlplayback.c
| Trivial application to control playback of a sound file.

file | app_curl.c
| Curl - App to load a URL.

file | app_cut.c
| Cut application.

file | app_datetime.c
| Time of day - Report the time of day.

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_enumlookup.c
| Enumlookup - lookup entry in ENUM.

file | app_eval.c
| Eval application.

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 zap trunk.

file | app_forkcdr.c
| Fork CDR application.

file | app_getcpeid.c
| Get ADSI CPE ID.

file | app_groupcount.c
| Group Manipulation Applications.

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_intercom.c
| Use /dev/dsp as an intercom.

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_math.c
| A simple math application.

file | app_md5.c
| MD5 checksum application.

file | app_meetme.c
| Meet me conference bridge.

file | app_milliwatt.c
| Digital Milliwatt Test.

file | app_mixmonitor.c
| MixMonitor() - Record a call and mix the audio during the recording.

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 Lookup.

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_setcidname.c
| App to set callerid.

file | app_setcidnum.c
| App to set callerid number.

file | app_setrdnis.c
| App to set rdnis.

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_sql_postgres.c
| Connect to PostgreSQL.

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_txtcidname.c
| Caller*id name lookup - Look up the caller's name via DNS.

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
  .

file | app_while.c
| While Loop and ExecIf Implementations.

file | app_zapateller.c
| Playback the special information tone to get rid of telemarketers.

file | app_zapbarge.c
| Zap Barge support.

file | app_zapras.c
| Execute an ISDN RAS.

file | app_zapscan.c
| Zap Scanner.

## Functions

static int | dundi_lookup_exec (struct ast_channel *chan, void *data)
static int | iax2_prov_app (struct ast_channel *chan, void *data)
static int | pbx_builtin_answer (struct ast_channel *, void *)
static int | pbx_builtin_atimeout (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_dtimeout (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_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_rtimeout (struct ast_channel *, void *)
static int | pbx_builtin_setaccount (struct ast_channel *, void *)
static int | pbx_builtin_setamaflags (struct ast_channel *, void *)
static int | pbx_builtin_setlanguage (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
  - Module: Dial plan functions

## Function Documentation

static int dundi_lookup_exec | ( | struct ast_channel * | chan,
|  | void * | data |
| ) |  |  | `[static]`

Definition at line 3863 of file pbx_dundi.c.

References ast_goto_if_exists(), ast_log(), ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_channel::context, context, dep_warning, dundi_result::dest, DUNDI_FLAG_EXISTS, dundi_lookup(), ast_channel::exten, LOCAL_USER_ADD, LOCAL_USER_REMOVE, LOG_ERROR, LOG_WARNING, option_priority_jumping, pbx_builtin_setvar_helper(), ast_channel::priority, sort_results(), and dundi_result::tech.

Referenced by load_module().

    03864 {
    03865    char *num;
    03866    char *context;
    03867    char *opts;
    03868    int results;
    03869    int x;
    03870    int bypass = 0;
    03871    struct localuser *u;
    03872    struct dundi_result dr[MAX_RESULTS];
    03873    static int dep_warning = 0;
    03874
    03875    LOCAL_USER_ADD(u);
    03876
    03877    if (!dep_warning) {
    03878       ast_log(LOG_WARNING, "This application has been deprecated in favor of the DUNDILOOKUP dialplan function.\n");
    03879       dep_warning = 1;
    03880    }
    03881
    03882    if (ast_strlen_zero(data)) {
    03883       ast_log(LOG_WARNING, "DUNDiLookup requires an argument (number)\n");
    03884       LOCAL_USER_REMOVE(u);
    03885       return 0;
    03886    }
    03887
    03888    num = ast_strdupa(data);
    03889    if (!num) {
    03890       ast_log(LOG_ERROR, "Out of memory!\n");
    03891       LOCAL_USER_REMOVE(u);
    03892       return 0;
    03893    }
    03894
    03895    context = strchr(num, '|');
    03896    if (context) {
    03897       *context = '\0';
    03898       context++;
    03899       opts = strchr(context, '|');
    03900       if (opts) {
    03901          *opts = '\0';
    03902          opts++;
    03903          if (strchr(opts, 'b'))
    03904             bypass = 1;
    03905       }
    03906    }
    03907
    03908    if (ast_strlen_zero(context))
    03909       context = "e164";
    03910
    03911    results = dundi_lookup(dr, MAX_RESULTS, NULL, context, num, bypass);
    03912    if (results > 0) {
    03913       sort_results(dr, results);
    03914       for (x = 0; x < results; x++) {
    03915          if (ast_test_flag(dr + x, DUNDI_FLAG_EXISTS)) {
    03916             pbx_builtin_setvar_helper(chan, "DUNDTECH", dr[x].tech);
    03917             pbx_builtin_setvar_helper(chan, "DUNDDEST", dr[x].dest);
    03918             break;
    03919          }
    03920       }
    03921    } else if (option_priority_jumping)
    03922       ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
    03923
    03924    LOCAL_USER_REMOVE(u);
    03925
    03926    return 0;
    03927 }

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

iax2provision

Definition at line 9242 of file chan_iax2.c.

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

Referenced by load_module().

    09243 {
    09244    int res;
    09245    char *sdata;
    09246    char *opts;
    09247    int force =0;
    09248    unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
    09249    char iabuf[INET_ADDRSTRLEN];
    09250    if (ast_strlen_zero(data))
    09251       data = "default";
    09252    sdata = ast_strdupa(data);
    09253    opts = strchr(sdata, '|');
    09254    if (opts)
    09255       *opts='\0';
    09256
    09257    if (chan->type != channeltype) {
    09258       ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n");
    09259       return -1;
    09260    }
    09261    if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) {
    09262       ast_log(LOG_NOTICE, "Can't provision something with no IP?\n");
    09263       return -1;
    09264    }
    09265    res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force);
    09266    if (option_verbose > 2)
    09267       ast_verbose(VERBOSE_PREFIX_3 "Provisioned IAXY at '%s' with '%s'= %d\n",
    09268       ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr),
    09269       sdata, res);
    09270    return res;
    09271 }

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

Definition at line 5484 of file pbx.c.

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

    05485 {
    05486    int delay = 0;
    05487    int res;
    05488
    05489    if (chan->_state == AST_STATE_UP)
    05490       delay = 0;
    05491    else if (!ast_strlen_zero(data))
    05492       delay = atoi(data);
    05493
    05494    res = ast_answer(chan);
    05495    if (res)
    05496       return res;
    05497
    05498    if (delay)
    05499       res = ast_safe_sleep(chan, delay);
    05500
    05501    return res;
    05502 }

static int pbx_builtin_atimeout | ( | struct ast_channel * | chan,
|  | void * | data |
| ) |  |  | `[static]`

AbsoluteTimeout

Todo:
  Remove in 1.3 dev

Definition at line 5847 of file pbx.c.

References ast_channel_setwhentohangup(), ast_log(), ast_verbose(), LOG_WARNING, option_verbose, and VERBOSE_PREFIX_3.

    05848 {
    05849    static int deprecation_warning = 0;
    05850    int x = atoi((char *) data);
    05851
    05852    if (!deprecation_warning) {
    05853       ast_log(LOG_WARNING, "AbsoluteTimeout is deprecated, please use Set(TIMEOUT(absolute)=timeout) instead.\n");
    05854       deprecation_warning = 1;
    05855    }
    05856
    05857    /* Set the absolute maximum time how long a call can be connected */
    05858    ast_channel_setwhentohangup(chan,x);
    05859    if (option_verbose > 2)
    05860       ast_verbose( VERBOSE_PREFIX_3 "Set Absolute Timeout to %d\n", x);
    05861    return 0;
    05862 }

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

Definition at line 5747 of file pbx.c.

References ast_channel::_state, ast_answer(), ast_app_parse_options(), ast_app_separate_args(), AST_DIGIT_ANY, ast_log(), AST_STATE_UP, ast_stopstream(), ast_strdupa, ast_streamfile(), ast_test_flag, ast_waitstream(), ast_waitstream_exten(), BACKGROUND_MATCHEXTEN, BACKGROUND_NOANSWER, BACKGROUND_PLAYBACK, BACKGROUND_SKIP, ast_channel::context, ast_channel::exten, ast_flags::flags, ast_channel::language, LOG_WARNING, ast_channel::name, parse(), and ast_channel::priority.

    05748 {
    05749    int res = 0;
    05750    int argc;
    05751    char *parse;
    05752    char *argv[4];
    05753    char *options = NULL;
    05754    char *filename = NULL;
    05755    char *front = NULL, *back = NULL;
    05756    char *lang = NULL;
    05757    char *context = NULL;
    05758    struct ast_flags flags = {0};
    05759
    05760    parse = ast_strdupa(data);
    05761
    05762    if ((argc = ast_app_separate_args(parse, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
    05763       switch (argc) {
    05764       case 4:
    05765          context = argv[3];
    05766       case 3:
    05767          lang = argv[2];
    05768       case 2:
    05769          options = argv[1];
    05770       case 1:
    05771          filename = argv[0];
    05772          break;
    05773       default:
    05774          ast_log(LOG_WARNING, "Background requires an argument (filename)\n");
    05775          return -1;
    05776       }
    05777    }
    05778
    05779    if (!lang)
    05780       lang = chan->language;
    05781
    05782    if (!context)
    05783       context = chan->context;
    05784
    05785    if (options) {
    05786       if (!strcasecmp(options, "skip"))
    05787          flags.flags = BACKGROUND_SKIP;
    05788       else if (!strcasecmp(options, "noanswer"))
    05789          flags.flags = BACKGROUND_NOANSWER;
    05790       else
    05791          ast_app_parse_options(background_opts, &flags, NULL, options);
    05792    }
    05793
    05794    /* Answer if need be */
    05795    if (chan->_state != AST_STATE_UP) {
    05796       if (ast_test_flag(&flags, BACKGROUND_SKIP)) {
    05797          return 0;
    05798       } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) {
    05799          res = ast_answer(chan);
    05800       }
    05801    }
    05802
    05803    if (!res) {
    05804       /* Stop anything playing */
    05805       ast_stopstream(chan);
    05806       /* Stream a file */
    05807       front = filename;
    05808       while(!res && front) {
    05809          if((back = strchr(front, '&'))) {
    05810             *back = '\0';
    05811             back++;
    05812          }
    05813          res = ast_streamfile(chan, front, lang);
    05814          if (!res) {
    05815             if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) {
    05816                res = ast_waitstream(chan, "");
    05817             } else {
    05818                if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) {
    05819                   res = ast_waitstream_exten(chan, context);
    05820                } else {
    05821                   res = ast_waitstream(chan, AST_DIGIT_ANY);
    05822                }
    05823             }
    05824             ast_stopstream(chan);
    05825          } else {
    05826             ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data);
    05827             res = 0;
    05828             break;
    05829          }
    05830          front = back;
    05831       }
    05832    }
    05833    if (context != chan->context && res) {
    05834       snprintf(chan->exten, sizeof(chan->exten), "%c", res);
    05835       ast_copy_string(chan->context, context, sizeof(chan->context));
    05836       chan->priority = 0;
    05837       return 0;
    05838    } else {
    05839       return res;
    05840    }
    05841 }

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

Definition at line 5460 of file pbx.c.

References ast_channel::_state, AST_CONTROL_BUSY, ast_indicate(), ast_setstate(), AST_STATE_BUSY, AST_STATE_UP, and wait_for_hangup().

Referenced by __ast_pbx_run().

    05461 {
    05462    ast_indicate(chan, AST_CONTROL_BUSY);
    05463    if (chan->_state != AST_STATE_UP)
    05464       ast_setstate(chan, AST_STATE_BUSY);
    05465    wait_for_hangup(chan, data);
    05466    return -1;
    05467 }

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

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

    05473 {
    05474    ast_indicate(chan, AST_CONTROL_CONGESTION);
    05475    if (chan->_state != AST_STATE_UP)
    05476       ast_setstate(chan, AST_STATE_BUSY);
    05477    wait_for_hangup(chan, data);
    05478    return -1;
    05479 }

static int pbx_builtin_dtimeout | ( | struct ast_channel * | chan,
|  | void * | data |
| ) |  |  | `[static]`

DigitTimeout

Todo:
  Remove in 1.3 dev

Definition at line 5892 of file pbx.c.

References ast_log(), ast_verbose(), ast_pbx::dtimeout, LOG_WARNING, option_verbose, ast_channel::pbx, and VERBOSE_PREFIX_3.

    05893 {
    05894    static int deprecation_warning = 0;
    05895
    05896    if (!deprecation_warning) {
    05897       ast_log(LOG_WARNING, "DigitTimeout is deprecated, please use Set(TIMEOUT(digit)=timeout) instead.\n");
    05898       deprecation_warning = 1;
    05899    }
    05900
    05901    /* If the channel is not in a PBX, return now */
    05902    if (!chan->pbx)
    05903       return 0;
    05904
    05905    /* Set the timeout for how long to wait between digits */
    05906    chan->pbx->dtimeout = atoi((char *)data);
    05907    if (option_verbose > 2)
    05908       ast_verbose( VERBOSE_PREFIX_3 "Set Digit Timeout to %d\n", chan->pbx->dtimeout);
    05909    return 0;
    05910 }

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

Definition at line 5620 of file pbx.c.

References ast_build_timing(), ast_check_timing(), ast_log(), ast_strdupa, ast_strlen_zero(), LOG_ERROR, LOG_WARNING, pbx_exec(), pbx_findapp(), strsep(), and usage().

    05621 {
    05622    int res = 0;
    05623    char *ptr1, *ptr2;
    05624    struct ast_timing timing;
    05625    struct ast_app *app;
    05626    const char *usage = "ExecIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?<appname>[|<appargs>]";
    05627
    05628    if (ast_strlen_zero(data)) {
    05629       ast_log(LOG_WARNING, "%s\n", usage);
    05630       return -1;
    05631    }
    05632
    05633    ptr1 = ast_strdupa(data);
    05634
    05635    if (!ptr1) {
    05636       ast_log(LOG_ERROR, "Out of Memory!\n");
    05637       return -1;
    05638    }
    05639
    05640    ptr2 = ptr1;
    05641    /* Separate the Application data ptr1 is the time spec ptr2 is the app|data */
    05642    strsep(&ptr2,"?");
    05643    if(!ast_build_timing(&timing, ptr1)) {
    05644       ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", ptr1, usage);
    05645       res = -1;
    05646    }
    05647
    05648    if (!res && ast_check_timing(&timing)) {
    05649       if (!ptr2) {
    05650          ast_log(LOG_WARNING, "%s\n", usage);
    05651       }
    05652
    05653       /* ptr2 is now the app name
    05654          we're done with ptr1 now so recycle it and use it to point to the app args */
    05655       if((ptr1 = strchr(ptr2, '|'))) {
    05656          *ptr1 = '\0';
    05657          ptr1++;
    05658       }
    05659
    05660       if ((app = pbx_findapp(ptr2))) {
    05661          res = pbx_exec(chan, app, ptr1 ? ptr1 : "", 1);
    05662       } else {
    05663          ast_log(LOG_WARNING, "Cannot locate application %s\n", ptr2);
    05664          res = -1;
    05665       }
    05666    }
    05667
    05668    return res;
    05669 }

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

Goto

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

    05916 {
    05917    int res;
    05918    res = ast_parseable_goto(chan, (const char *) data);
    05919    if (!res && (option_verbose > 2))
    05920       ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
    05921    return res;
    05922 }

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

Definition at line 5591 of file pbx.c.

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

    05592 {
    05593    int res=0;
    05594    char *s, *ts;
    05595    struct ast_timing timing;
    05596
    05597    if (ast_strlen_zero(data)) {
    05598       ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?[[context|]extension|]priority\n");
    05599       return -1;
    05600    }
    05601
    05602    if ((s = ast_strdupa((char *) data))) {
    05603       ts = s;
    05604
    05605       /* Separate the Goto path */
    05606       strsep(&ts,"?");
    05607
    05608       /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */
    05609       if (ast_build_timing(&timing, s) && ast_check_timing(&timing))
    05610          res = pbx_builtin_goto(chan, (void *)ts);
    05611    } else {
    05612       ast_log(LOG_ERROR, "Memory Error!\n");
    05613    }
    05614    return res;
    05615 }

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

Definition at line 5580 of file pbx.c.

References AST_CAUSE_NORMAL_CLEARING, and ast_channel::hangupcause.

    05581 {
    05582    /* Just return non-zero and it will hang up */
    05583    if (!chan->hangupcause)
    05584       chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
    05585    return -1;
    05586 }

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

Definition at line 5442 of file pbx.c.

References AST_CONTROL_PROGRESS, and ast_indicate().

    05443 {
    05444    ast_indicate(chan, AST_CONTROL_PROGRESS);
    05445    return 0;
    05446 }

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

Definition at line 5532 of file pbx.c.

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

    05533 {
    05534    char *args;
    05535    struct ast_flags flags = { 0 };
    05536
    05537    if (!ast_strlen_zero(data)) {
    05538       args = ast_strdupa(data);
    05539       if (!args) {
    05540          ast_log(LOG_ERROR, "Out of memory!\n");
    05541          return -1;
    05542       }
    05543       ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
    05544    }
    05545
    05546    ast_cdr_reset(chan->cdr, &flags);
    05547
    05548    return 0;
    05549 }

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

Definition at line 5451 of file pbx.c.

References AST_CONTROL_RINGING, and ast_indicate().

    05452 {
    05453    ast_indicate(chan, AST_CONTROL_RINGING);
    05454    return 0;
    05455 }

static int pbx_builtin_rtimeout | ( | struct ast_channel * | chan,
|  | void * | data |
| ) |  |  | `[static]`

ResponseTimeout

Todo:
  Remove in 1.3 dev

Definition at line 5868 of file pbx.c.

References ast_log(), ast_verbose(), LOG_WARNING, option_verbose, ast_channel::pbx, ast_pbx::rtimeout, and VERBOSE_PREFIX_3.

    05869 {
    05870    static int deprecation_warning = 0;
    05871
    05872    if (!deprecation_warning) {
    05873       ast_log(LOG_WARNING, "ResponseTimeout is deprecated, please use Set(TIMEOUT(response)=timeout) instead.\n");
    05874       deprecation_warning = 1;
    05875    }
    05876
    05877    /* If the channel is not in a PBX, return now */
    05878    if (!chan->pbx)
    05879       return 0;
    05880
    05881    /* Set the timeout for how long to wait between digits */
    05882    chan->pbx->rtimeout = atoi((char *)data);
    05883    if (option_verbose > 2)
    05884       ast_verbose( VERBOSE_PREFIX_3 "Set Response Timeout to %d\n", chan->pbx->rtimeout);
    05885    return 0;
    05886 }

static int pbx_builtin_setaccount | ( | struct ast_channel * | chan,
|  | void * | data |
| ) |  |  | `[static]`

Definition at line 5554 of file pbx.c.

References ast_cdr_setaccount().

    05555 {
    05556    /* Copy the account code  as specified */
    05557    if (data)
    05558       ast_cdr_setaccount(chan, (char *)data);
    05559    else
    05560       ast_cdr_setaccount(chan, "");
    05561    return 0;
    05562 }

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

Definition at line 5567 of file pbx.c.

References ast_cdr_setamaflags().

    05568 {
    05569    /* Copy the AMA Flags as specified */
    05570    if (data)
    05571       ast_cdr_setamaflags(chan, (char *)data);
    05572    else
    05573       ast_cdr_setamaflags(chan, "");
    05574    return 0;
    05575 }

static int pbx_builtin_setlanguage | ( | struct ast_channel * | chan,
|  | void * | data |
| ) |  |  | `[static]`

Definition at line 5507 of file pbx.c.

References ast_log(), ast_strlen_zero(), ast_channel::language, and LOG_WARNING.

    05508 {
    05509    static int deprecation_warning = 0;
    05510
    05511    if (!deprecation_warning) {
    05512       ast_log(LOG_WARNING, "SetLanguage is deprecated, please use Set(LANGUAGE()=language) instead.\n");
    05513       deprecation_warning = 1;
    05514    }
    05515
    05516    /* Copy the language as specified */
    05517    if (!ast_strlen_zero(data))
    05518       ast_copy_string(chan->language, data, sizeof(chan->language));
    05519
    05520    return 0;
    05521 }

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

Definition at line 5674 of file pbx.c.

References ast_safe_sleep().

    05675 {
    05676    int ms;
    05677
    05678    /* Wait for "n" seconds */
    05679    if (data && atof((char *)data)) {
    05680       ms = atof((char *)data) * 1000;
    05681       return ast_safe_sleep(chan, ms);
    05682    }
    05683    return 0;
    05684 }

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

Definition at line 5689 of file pbx.c.

References ast_app_parse_options(), ast_app_separate_args(), ast_exists_extension(), ast_log(), ast_moh_start(), ast_moh_stop(), ast_strdupa, 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, ast_channel::pbx, ast_channel::priority, ast_pbx::rtimeout, VERBOSE_PREFIX_3, and WAITEXTEN_MOH.

    05690 {
    05691    int ms, res, argc;
    05692    char *args;
    05693    char *argv[2];
    05694    char *options = NULL;
    05695    char *timeout = NULL;
    05696    struct ast_flags flags = {0};
    05697    char *opts[1] = { NULL };
    05698
    05699    args = ast_strdupa(data);
    05700
    05701    if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
    05702       if (argc > 0) {
    05703          timeout = argv[0];
    05704          if (argc > 1)
    05705             options = argv[1];
    05706       }
    05707    }
    05708
    05709    if (options)
    05710       ast_app_parse_options(waitexten_opts, &flags, opts, options);
    05711
    05712    if (ast_test_flag(&flags, WAITEXTEN_MOH))
    05713       ast_moh_start(chan, opts[0]);
    05714
    05715    /* Wait for "n" seconds */
    05716    if (timeout && atof((char *)timeout))
    05717       ms = atof((char *)timeout) * 1000;
    05718    else if (chan->pbx)
    05719       ms = chan->pbx->rtimeout * 1000;
    05720    else
    05721       ms = 10000;
    05722    res = ast_waitfordigit(chan, ms);
    05723    if (!res) {
    05724       if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) {
    05725          if (option_verbose > 2)
    05726             ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, continuing...\n", chan->name);
    05727       } else if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) {
    05728          if (option_verbose > 2)
    05729             ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, going to 't'\n", chan->name);
    05730          ast_copy_string(chan->exten, "t", sizeof(chan->exten));
    05731          chan->priority = 0;
    05732       } else {
    05733          ast_log(LOG_WARNING, "Timeout but no rule 't' in context '%s'\n", chan->context);
    05734          res = -1;
    05735       }
    05736    }
    05737
    05738    if (ast_test_flag(&flags, WAITEXTEN_MOH))
    05739       ast_moh_stop(chan);
    05740
    05741    return res;
    05742 }