Sat Mar 24 23:31:20 2007

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 7738 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().

07739 {
07740    int res;
07741    char *sdata;
07742    char *opts;
07743    int force =0;
07744    unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
07745    char iabuf[INET_ADDRSTRLEN];
07746    if (ast_strlen_zero(data))
07747       data = "default";
07748    sdata = ast_strdupa(data);
07749    opts = strchr(sdata, '|');
07750    if (opts)
07751       *opts='\0';
07752 
07753    if (chan->type != channeltype) {
07754       ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n");
07755       return -1;
07756    } 
07757    if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) {
07758       ast_log(LOG_NOTICE, "Can't provision something with no IP?\n");
07759       return -1;
07760    }
07761    res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force);
07762    if (option_verbose > 2)
07763       ast_verbose(VERBOSE_PREFIX_3 "Provisioned IAXY at '%s' with '%s'= %d\n", 
07764       ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr),
07765       sdata, res);
07766    return res;
07767 }

static int pbx_builtin_answer struct ast_channel ,
void * 
[static]
 

Definition at line 5449 of file pbx.c.

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

05450 {
05451    int delay = 0;
05452    int res;
05453 
05454    if (chan->_state == AST_STATE_UP)
05455       delay = 0;
05456    else if (!ast_strlen_zero(data))
05457       delay = atoi(data);
05458 
05459    res = ast_answer(chan);
05460    if (res)
05461       return res;
05462 
05463    if (delay)
05464       res = ast_safe_sleep(chan, delay);
05465 
05466    return res;
05467 }

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

AbsoluteTimeout

Todo:
Remove in 1.3 dev

Definition at line 5812 of file pbx.c.

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

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

static int pbx_builtin_background struct ast_channel ,
void * 
[static]
 

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

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

static int pbx_builtin_busy struct ast_channel ,
void * 
[static]
 

Definition at line 5427 of file pbx.c.

References AST_CONTROL_BUSY, ast_indicate(), ast_setstate(), AST_STATE_BUSY, and wait_for_hangup().

05428 {
05429    ast_indicate(chan, AST_CONTROL_BUSY);     
05430    ast_setstate(chan, AST_STATE_BUSY);
05431    wait_for_hangup(chan, data);
05432    return -1;
05433 }

static int pbx_builtin_congestion struct ast_channel ,
void * 
[static]
 

Definition at line 5438 of file pbx.c.

References AST_CONTROL_CONGESTION, ast_indicate(), ast_setstate(), AST_STATE_BUSY, and wait_for_hangup().

05439 {
05440    ast_indicate(chan, AST_CONTROL_CONGESTION);
05441    ast_setstate(chan, AST_STATE_BUSY);
05442    wait_for_hangup(chan, data);
05443    return -1;
05444 }

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

DigitTimeout

Todo:
Remove in 1.3 dev

Definition at line 5857 of file pbx.c.

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

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

static int pbx_builtin_execiftime struct ast_channel ,
void * 
[static]
 

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

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

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

Goto

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

05881 {
05882    int res;
05883    res = ast_parseable_goto(chan, (const char *) data);
05884    if (!res && (option_verbose > 2))
05885       ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
05886    return res;
05887 }

static int pbx_builtin_gotoiftime struct ast_channel ,
void * 
[static]
 

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

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

static int pbx_builtin_hangup struct ast_channel ,
void * 
[static]
 

Definition at line 5545 of file pbx.c.

References AST_CAUSE_NORMAL_CLEARING, and ast_channel::hangupcause.

05546 {
05547    /* Just return non-zero and it will hang up */
05548    if (!chan->hangupcause)
05549       chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
05550    return -1;
05551 }

static int pbx_builtin_progress struct ast_channel ,
void * 
[static]
 

Definition at line 5409 of file pbx.c.

References AST_CONTROL_PROGRESS, and ast_indicate().

05410 {
05411    ast_indicate(chan, AST_CONTROL_PROGRESS);
05412    return 0;
05413 }

static int pbx_builtin_resetcdr struct ast_channel ,
void * 
[static]
 

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

05498 {
05499    char *args;
05500    struct ast_flags flags = { 0 };
05501    
05502    if (!ast_strlen_zero(data)) {
05503       args = ast_strdupa(data);
05504       if (!args) {
05505          ast_log(LOG_ERROR, "Out of memory!\n");
05506          return -1;
05507       }
05508       ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
05509    }
05510 
05511    ast_cdr_reset(chan->cdr, &flags);
05512 
05513    return 0;
05514 }

static int pbx_builtin_ringing struct ast_channel ,
void * 
[static]
 

Definition at line 5418 of file pbx.c.

References AST_CONTROL_RINGING, and ast_indicate().

05419 {
05420    ast_indicate(chan, AST_CONTROL_RINGING);
05421    return 0;
05422 }

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

ResponseTimeout

Todo:
Remove in 1.3 dev

Definition at line 5833 of file pbx.c.

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

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

static int pbx_builtin_setaccount struct ast_channel ,
void * 
[static]
 

Definition at line 5519 of file pbx.c.

References ast_cdr_setaccount().

05520 {
05521    /* Copy the account code  as specified */
05522    if (data)
05523       ast_cdr_setaccount(chan, (char *)data);
05524    else
05525       ast_cdr_setaccount(chan, "");
05526    return 0;
05527 }

static int pbx_builtin_setamaflags struct ast_channel ,
void * 
[static]
 

Definition at line 5532 of file pbx.c.

References ast_cdr_setamaflags().

05533 {
05534    /* Copy the AMA Flags as specified */
05535    if (data)
05536       ast_cdr_setamaflags(chan, (char *)data);
05537    else
05538       ast_cdr_setamaflags(chan, "");
05539    return 0;
05540 }

static int pbx_builtin_setlanguage struct ast_channel ,
void * 
[static]
 

Definition at line 5472 of file pbx.c.

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

05473 {
05474    static int deprecation_warning = 0;
05475 
05476    if (!deprecation_warning) {
05477       ast_log(LOG_WARNING, "SetLanguage is deprecated, please use Set(LANGUAGE()=language) instead.\n");
05478       deprecation_warning = 1;
05479    }
05480 
05481    /* Copy the language as specified */
05482    if (!ast_strlen_zero(data))
05483       ast_copy_string(chan->language, data, sizeof(chan->language));
05484 
05485    return 0;
05486 }

static int pbx_builtin_wait struct ast_channel ,
void * 
[static]
 

Definition at line 5639 of file pbx.c.

References ast_safe_sleep().

05640 {
05641    int ms;
05642 
05643    /* Wait for "n" seconds */
05644    if (data && atof((char *)data)) {
05645       ms = atof((char *)data) * 1000;
05646       return ast_safe_sleep(chan, ms);
05647    }
05648    return 0;
05649 }

static int pbx_builtin_waitexten struct ast_channel ,
void * 
[static]
 

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

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


Generated on Sat Mar 24 23:31:20 2007 for Asterisk - the Open Source PBX by  doxygen 1.4.6