Fri Sep 29 11:15:19 2006

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

Function Documentation

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

Definition at line 3857 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, dr, DUNDI_FLAG_EXISTS, dundi_lookup(), LOCAL_USER_ADD, LOCAL_USER_REMOVE, LOG_ERROR, LOG_WARNING, MAX_RESULTS, option_priority_jumping, pbx_builtin_setvar_helper(), sort_results(), and dundi_result::tech.

Referenced by load_module().

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

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

iax2provision

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

07837 {
07838    int res;
07839    char *sdata;
07840    char *opts;
07841    int force =0;
07842    unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
07843    char iabuf[INET_ADDRSTRLEN];
07844    if (ast_strlen_zero(data))
07845       data = "default";
07846    sdata = ast_strdupa(data);
07847    opts = strchr(sdata, '|');
07848    if (opts)
07849       *opts='\0';
07850 
07851    if (chan->type != channeltype) {
07852       ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n");
07853       return -1;
07854    } 
07855    if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) {
07856       ast_log(LOG_NOTICE, "Can't provision something with no IP?\n");
07857       return -1;
07858    }
07859    res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force);
07860    if (option_verbose > 2)
07861       ast_verbose(VERBOSE_PREFIX_3 "Provisioned IAXY at '%s' with '%s'= %d\n", 
07862       ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr),
07863       sdata, res);
07864    return res;
07865 }

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

Definition at line 5456 of file pbx.c.

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

05457 {
05458    int delay = 0;
05459    int res;
05460 
05461    if (chan->_state == AST_STATE_UP)
05462       delay = 0;
05463    else if (!ast_strlen_zero(data))
05464       delay = atoi(data);
05465 
05466    res = ast_answer(chan);
05467    if (res)
05468       return res;
05469 
05470    if (delay)
05471       res = ast_safe_sleep(chan, delay);
05472 
05473    return res;
05474 }

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

AbsoluteTimeout

Todo:
Remove in 1.3 dev

Definition at line 5819 of file pbx.c.

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

05820 {
05821    static int deprecation_warning = 0;
05822    int x = atoi((char *) data);
05823 
05824    if (!deprecation_warning) {
05825       ast_log(LOG_WARNING, "AbsoluteTimeout is deprecated, please use Set(TIMEOUT(absolute)=timeout) instead.\n");
05826       deprecation_warning = 1;
05827    }
05828          
05829    /* Set the absolute maximum time how long a call can be connected */
05830    ast_channel_setwhentohangup(chan,x);
05831    if (option_verbose > 2)
05832       ast_verbose( VERBOSE_PREFIX_3 "Set Absolute Timeout to %d\n", x);
05833    return 0;
05834 }

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

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

05720 {
05721    int res = 0;
05722    int argc;
05723    char *parse;
05724    char *argv[4];
05725    char *options = NULL; 
05726    char *filename = NULL;
05727    char *front = NULL, *back = NULL;
05728    char *lang = NULL;
05729    char *context = NULL;
05730    struct ast_flags flags = {0};
05731 
05732    parse = ast_strdupa(data);
05733 
05734    if ((argc = ast_app_separate_args(parse, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
05735       switch (argc) {
05736       case 4:
05737          context = argv[3];
05738       case 3:
05739          lang = argv[2];
05740       case 2:
05741          options = argv[1];
05742       case 1:
05743          filename = argv[0];
05744          break;
05745       default:
05746          ast_log(LOG_WARNING, "Background requires an argument (filename)\n");
05747          break;
05748       }
05749    }
05750 
05751    if (!lang)
05752       lang = chan->language;
05753 
05754    if (!context)
05755       context = chan->context;
05756 
05757    if (options) {
05758       if (!strcasecmp(options, "skip"))
05759          flags.flags = BACKGROUND_SKIP;
05760       else if (!strcasecmp(options, "noanswer"))
05761          flags.flags = BACKGROUND_NOANSWER;
05762       else
05763          ast_app_parse_options(background_opts, &flags, NULL, options);
05764    }
05765 
05766    /* Answer if need be */
05767    if (chan->_state != AST_STATE_UP) {
05768       if (ast_test_flag(&flags, BACKGROUND_SKIP)) {
05769          return 0;
05770       } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) {
05771          res = ast_answer(chan);
05772       }
05773    }
05774 
05775    if (!res) {
05776       /* Stop anything playing */
05777       ast_stopstream(chan);
05778       /* Stream a file */
05779       front = filename;
05780       while(!res && front) {
05781          if((back = strchr(front, '&'))) {
05782             *back = '\0';
05783             back++;
05784          }
05785          res = ast_streamfile(chan, front, lang);
05786          if (!res) {
05787             if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) {
05788                res = ast_waitstream(chan, "");
05789             } else {
05790                if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) {
05791                   res = ast_waitstream_exten(chan, context);
05792                } else {
05793                   res = ast_waitstream(chan, AST_DIGIT_ANY);
05794                }
05795             }
05796             ast_stopstream(chan);
05797          } else {
05798             ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data);
05799             res = 0;
05800             break;
05801          }
05802          front = back;
05803       }
05804    }
05805    if (context != chan->context && res) {
05806       snprintf(chan->exten, sizeof(chan->exten), "%c", res);
05807       ast_copy_string(chan->context, context, sizeof(chan->context));
05808       chan->priority = 0;
05809       return 0;
05810    } else {
05811       return res;
05812    }
05813 }

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

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

05433 {
05434    ast_indicate(chan, AST_CONTROL_BUSY);     
05435    if (chan->_state != AST_STATE_UP)
05436       ast_setstate(chan, AST_STATE_BUSY);
05437    wait_for_hangup(chan, data);
05438    return -1;
05439 }

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

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

05445 {
05446    ast_indicate(chan, AST_CONTROL_CONGESTION);
05447    if (chan->_state != AST_STATE_UP)
05448       ast_setstate(chan, AST_STATE_BUSY);
05449    wait_for_hangup(chan, data);
05450    return -1;
05451 }

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

DigitTimeout

Todo:
Remove in 1.3 dev

Definition at line 5864 of file pbx.c.

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

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

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

Definition at line 5592 of file pbx.c.

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

05593 {
05594    int res = 0;
05595    char *ptr1, *ptr2;
05596    struct ast_timing timing;
05597    struct ast_app *app;
05598    const char *usage = "ExecIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?<appname>[|<appargs>]";
05599 
05600    if (ast_strlen_zero(data)) {
05601       ast_log(LOG_WARNING, "%s\n", usage);   
05602       return -1;
05603    }
05604 
05605    ptr1 = ast_strdupa(data);
05606 
05607    if (!ptr1) {
05608       ast_log(LOG_ERROR, "Out of Memory!\n");
05609       return -1;  
05610    }
05611 
05612    ptr2 = ptr1;
05613    /* Separate the Application data ptr1 is the time spec ptr2 is the app|data */
05614    strsep(&ptr2,"?");
05615    if(!ast_build_timing(&timing, ptr1)) {
05616       ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", ptr1, usage);
05617       res = -1;
05618    }
05619       
05620    if (!res && ast_check_timing(&timing)) {
05621       if (!ptr2) {
05622          ast_log(LOG_WARNING, "%s\n", usage);
05623       }
05624 
05625       /* ptr2 is now the app name 
05626          we're done with ptr1 now so recycle it and use it to point to the app args */
05627       if((ptr1 = strchr(ptr2, '|'))) {
05628          *ptr1 = '\0';
05629          ptr1++;
05630       }
05631       
05632       if ((app = pbx_findapp(ptr2))) {
05633          res = pbx_exec(chan, app, ptr1 ? ptr1 : "", 1);
05634       } else {
05635          ast_log(LOG_WARNING, "Cannot locate application %s\n", ptr2);
05636          res = -1;
05637       }
05638    }
05639    
05640    return res;
05641 }

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

Goto

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

05888 {
05889    int res;
05890    res = ast_parseable_goto(chan, (const char *) data);
05891    if (!res && (option_verbose > 2))
05892       ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
05893    return res;
05894 }

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

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

05564 {
05565    int res=0;
05566    char *s, *ts;
05567    struct ast_timing timing;
05568 
05569    if (ast_strlen_zero(data)) {
05570       ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?[[context|]extension|]priority\n");
05571       return -1;
05572    }
05573 
05574    if ((s = ast_strdupa((char *) data))) {
05575       ts = s;
05576 
05577       /* Separate the Goto path */
05578       strsep(&ts,"?");
05579 
05580       /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */
05581       if (ast_build_timing(&timing, s) && ast_check_timing(&timing))
05582          res = pbx_builtin_goto(chan, (void *)ts);
05583    } else {
05584       ast_log(LOG_ERROR, "Memory Error!\n");
05585    }
05586    return res;
05587 }

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

Definition at line 5552 of file pbx.c.

References AST_CAUSE_NORMAL_CLEARING, and ast_channel::hangupcause.

05553 {
05554    /* Just return non-zero and it will hang up */
05555    if (!chan->hangupcause)
05556       chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
05557    return -1;
05558 }

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

Definition at line 5414 of file pbx.c.

References AST_CONTROL_PROGRESS, and ast_indicate().

05415 {
05416    ast_indicate(chan, AST_CONTROL_PROGRESS);
05417    return 0;
05418 }

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

Definition at line 5504 of file pbx.c.

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

05505 {
05506    char *args;
05507    struct ast_flags flags = { 0 };
05508    
05509    if (!ast_strlen_zero(data)) {
05510       args = ast_strdupa(data);
05511       if (!args) {
05512          ast_log(LOG_ERROR, "Out of memory!\n");
05513          return -1;
05514       }
05515       ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
05516    }
05517 
05518    ast_cdr_reset(chan->cdr, &flags);
05519 
05520    return 0;
05521 }

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

Definition at line 5423 of file pbx.c.

References AST_CONTROL_RINGING, and ast_indicate().

05424 {
05425    ast_indicate(chan, AST_CONTROL_RINGING);
05426    return 0;
05427 }

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

ResponseTimeout

Todo:
Remove in 1.3 dev

Definition at line 5840 of file pbx.c.

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

05841 {
05842    static int deprecation_warning = 0;
05843 
05844    if (!deprecation_warning) {
05845       ast_log(LOG_WARNING, "ResponseTimeout is deprecated, please use Set(TIMEOUT(response)=timeout) instead.\n");
05846       deprecation_warning = 1;
05847    }
05848 
05849    /* If the channel is not in a PBX, return now */
05850    if (!chan->pbx)
05851       return 0;
05852 
05853    /* Set the timeout for how long to wait between digits */
05854    chan->pbx->rtimeout = atoi((char *)data);
05855    if (option_verbose > 2)
05856       ast_verbose( VERBOSE_PREFIX_3 "Set Response Timeout to %d\n", chan->pbx->rtimeout);
05857    return 0;
05858 }

static int pbx_builtin_setaccount ( struct ast_channel ,
void *   
) [static]

Definition at line 5526 of file pbx.c.

References ast_cdr_setaccount().

05527 {
05528    /* Copy the account code  as specified */
05529    if (data)
05530       ast_cdr_setaccount(chan, (char *)data);
05531    else
05532       ast_cdr_setaccount(chan, "");
05533    return 0;
05534 }

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

Definition at line 5539 of file pbx.c.

References ast_cdr_setamaflags().

05540 {
05541    /* Copy the AMA Flags as specified */
05542    if (data)
05543       ast_cdr_setamaflags(chan, (char *)data);
05544    else
05545       ast_cdr_setamaflags(chan, "");
05546    return 0;
05547 }

static int pbx_builtin_setlanguage ( struct ast_channel ,
void *   
) [static]

Definition at line 5479 of file pbx.c.

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

05480 {
05481    static int deprecation_warning = 0;
05482 
05483    if (!deprecation_warning) {
05484       ast_log(LOG_WARNING, "SetLanguage is deprecated, please use Set(LANGUAGE()=language) instead.\n");
05485       deprecation_warning = 1;
05486    }
05487 
05488    /* Copy the language as specified */
05489    if (!ast_strlen_zero(data))
05490       ast_copy_string(chan->language, data, sizeof(chan->language));
05491 
05492    return 0;
05493 }

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

Definition at line 5646 of file pbx.c.

References ast_safe_sleep().

05647 {
05648    int ms;
05649 
05650    /* Wait for "n" seconds */
05651    if (data && atof((char *)data)) {
05652       ms = atof((char *)data) * 1000;
05653       return ast_safe_sleep(chan, ms);
05654    }
05655    return 0;
05656 }

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

Definition at line 5661 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_flags::flags, LOG_WARNING, option_verbose, VERBOSE_PREFIX_3, and WAITEXTEN_MOH.

05662 {
05663    int ms, res, argc;
05664    char *args;
05665    char *argv[2];
05666    char *options = NULL; 
05667    char *timeout = NULL;
05668    struct ast_flags flags = {0};
05669    char *opts[1] = { NULL };
05670 
05671    args = ast_strdupa(data);
05672 
05673    if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
05674       if (argc > 0) {
05675          timeout = argv[0];
05676          if (argc > 1)
05677             options = argv[1];
05678       }
05679    }
05680 
05681    if (options)
05682       ast_app_parse_options(waitexten_opts, &flags, opts, options);
05683    
05684    if (ast_test_flag(&flags, WAITEXTEN_MOH))
05685       ast_moh_start(chan, opts[0]);
05686 
05687    /* Wait for "n" seconds */
05688    if (timeout && atof((char *)timeout)) 
05689       ms = atof((char *)timeout) * 1000;
05690    else if (chan->pbx)
05691       ms = chan->pbx->rtimeout * 1000;
05692    else
05693       ms = 10000;
05694    res = ast_waitfordigit(chan, ms);
05695    if (!res) {
05696       if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) {
05697          if (option_verbose > 2)
05698             ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, continuing...\n", chan->name);
05699       } else if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) {
05700          if (option_verbose > 2)
05701             ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, going to 't'\n", chan->name);
05702          ast_copy_string(chan->exten, "t", sizeof(chan->exten));
05703          chan->priority = 0;
05704       } else {
05705          ast_log(LOG_WARNING, "Timeout but no rule 't' in context '%s'\n", chan->context);
05706          res = -1;
05707       }
05708    }
05709 
05710    if (ast_test_flag(&flags, WAITEXTEN_MOH))
05711       ast_moh_stop(chan);
05712 
05713    return res;
05714 }


Generated on Fri Sep 29 11:15:19 2006 for Asterisk - the Open Source PBX by  doxygen 1.4.7