Sat Nov 25 00:46:16 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_log(), ast_strdupa, ast_strlen_zero(), ast_test_flag, context, dep_warning, dundi_result::dest, dr, DUNDI_FLAG_EXISTS, dundi_lookup(), LOCAL_USER_ADD, LOCAL_USER_REMOVE, LOG_ERROR, LOG_WARNING, MAX_RESULTS, 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 7841 of file chan_iax2.c.

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

Referenced by load_module().

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

static int pbx_builtin_answer struct ast_channel ,
void * 
[static]
 

Definition at line 5457 of file pbx.c.

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

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

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

AbsoluteTimeout

Todo:
Remove in 1.3 dev

Definition at line 5820 of file pbx.c.

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

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

static int pbx_builtin_background struct ast_channel ,
void * 
[static]
 

Definition at line 5720 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.

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

static int pbx_builtin_busy struct ast_channel ,
void * 
[static]
 

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

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

static int pbx_builtin_congestion struct ast_channel ,
void * 
[static]
 

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

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

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

DigitTimeout

Todo:
Remove in 1.3 dev

Definition at line 5865 of file pbx.c.

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

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

static int pbx_builtin_execiftime struct ast_channel ,
void * 
[static]
 

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

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

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

Goto

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

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

static int pbx_builtin_gotoiftime struct ast_channel ,
void * 
[static]
 

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

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

static int pbx_builtin_hangup struct ast_channel ,
void * 
[static]
 

Definition at line 5553 of file pbx.c.

References AST_CAUSE_NORMAL_CLEARING, and ast_channel::hangupcause.

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

static int pbx_builtin_progress struct ast_channel ,
void * 
[static]
 

Definition at line 5415 of file pbx.c.

References AST_CONTROL_PROGRESS, and ast_indicate().

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

static int pbx_builtin_resetcdr struct ast_channel ,
void * 
[static]
 

Definition at line 5505 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.

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

static int pbx_builtin_ringing struct ast_channel ,
void * 
[static]
 

Definition at line 5424 of file pbx.c.

References AST_CONTROL_RINGING, and ast_indicate().

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

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

ResponseTimeout

Todo:
Remove in 1.3 dev

Definition at line 5841 of file pbx.c.

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

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

static int pbx_builtin_setaccount struct ast_channel ,
void * 
[static]
 

Definition at line 5527 of file pbx.c.

References ast_cdr_setaccount().

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

static int pbx_builtin_setamaflags struct ast_channel ,
void * 
[static]
 

Definition at line 5540 of file pbx.c.

References ast_cdr_setamaflags().

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

static int pbx_builtin_setlanguage struct ast_channel ,
void * 
[static]
 

Definition at line 5480 of file pbx.c.

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

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

static int pbx_builtin_wait struct ast_channel ,
void * 
[static]
 

Definition at line 5647 of file pbx.c.

References ast_safe_sleep().

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

static int pbx_builtin_waitexten struct ast_channel ,
void * 
[static]
 

Definition at line 5662 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.

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


Generated on Sat Nov 25 00:46:17 2006 for Asterisk - the Open Source PBX by  doxygen 1.4.6