Mon Mar 20 08:20:33 2006

Asterisk developer's documentation


Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Module: Dial plan applications


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

int dundi_lookup_exec (struct ast_channel *chan, void *data)
int iax2_prov_app (struct ast_channel *chan, void *data)
int pbx_builtin_answer (struct ast_channel *, void *)
int pbx_builtin_atimeout (struct ast_channel *, void *)
int pbx_builtin_background (struct ast_channel *, void *)
int pbx_builtin_busy (struct ast_channel *, void *)
int pbx_builtin_congestion (struct ast_channel *, void *)
int pbx_builtin_dtimeout (struct ast_channel *, void *)
int pbx_builtin_execiftime (struct ast_channel *, void *)
int pbx_builtin_goto (struct ast_channel *, void *)
int pbx_builtin_gotoiftime (struct ast_channel *, void *)
int pbx_builtin_hangup (struct ast_channel *, void *)
int pbx_builtin_progress (struct ast_channel *, void *)
int pbx_builtin_resetcdr (struct ast_channel *, void *)
int pbx_builtin_ringing (struct ast_channel *, void *)
int pbx_builtin_rtimeout (struct ast_channel *, void *)
int pbx_builtin_setaccount (struct ast_channel *, void *)
int pbx_builtin_setamaflags (struct ast_channel *, void *)
int pbx_builtin_setlanguage (struct ast_channel *, void *)
int pbx_builtin_wait (struct ast_channel *, void *)
int pbx_builtin_waitexten (struct ast_channel *, void *)

Detailed Description

Asterisk Dial Plan Applications

Applications support the dialplan. They register dynamically with ast_register_application() and unregister with ast_unregister_application()
See also

Function Documentation

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, dep_warning, DUNDI_FLAG_EXISTS, dundi_lookup(), ast_channel::exten, LOCAL_USER_ADD, LOCAL_USER_REMOVE, LOG_ERROR, LOG_WARNING, MAX_RESULTS, pbx_builtin_setvar_helper(), ast_channel::priority, and sort_results().

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 }

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

iax2provision

Definition at line 7726 of file chan_iax2.c.

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

Referenced by load_module().

07727 {
07728    int res;
07729    char *sdata;
07730    char *opts;
07731    int force =0;
07732    unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
07733    char iabuf[INET_ADDRSTRLEN];
07734    if (ast_strlen_zero(data))
07735       data = "default";
07736    sdata = ast_strdupa(data);
07737    opts = strchr(sdata, '|');
07738    if (opts)
07739       *opts='\0';
07740 
07741    if (chan->type != channeltype) {
07742       ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n");
07743       return -1;
07744    } 
07745    if (!callno || !iaxs[callno] || !iaxs[callno]->addr.sin_addr.s_addr) {
07746       ast_log(LOG_NOTICE, "Can't provision something with no IP?\n");
07747       return -1;
07748    }
07749    res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force);
07750    if (option_verbose > 2)
07751       ast_verbose(VERBOSE_PREFIX_3 "Provisioned IAXY at '%s' with '%s'= %d\n", 
07752       ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr),
07753       sdata, res);
07754    return res;
07755 }

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

Definition at line 5424 of file pbx.c.

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

05425 {
05426    int delay = 0;
05427    int res;
05428 
05429    if (chan->_state == AST_STATE_UP)
05430       delay = 0;
05431    else if (!ast_strlen_zero(data))
05432       delay = atoi(data);
05433 
05434    res = ast_answer(chan);
05435    if (res)
05436       return res;
05437 
05438    if (delay)
05439       res = ast_safe_sleep(chan, delay);
05440 
05441    return res;
05442 }

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

AbsoluteTimeout

Todo:
Remove in 1.3 dev

Definition at line 5787 of file pbx.c.

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

05788 {
05789    static int deprecation_warning = 0;
05790    int x = atoi((char *) data);
05791 
05792    if (!deprecation_warning) {
05793       ast_log(LOG_WARNING, "AbsoluteTimeout is deprecated, please use Set(TIMEOUT(absolute)=timeout) instead.\n");
05794       deprecation_warning = 1;
05795    }
05796          
05797    /* Set the absolute maximum time how long a call can be connected */
05798    ast_channel_setwhentohangup(chan,x);
05799    if (option_verbose > 2)
05800       ast_verbose( VERBOSE_PREFIX_3 "Set Absolute Timeout to %d\n", x);
05801    return 0;
05802 }

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

Definition at line 5687 of file pbx.c.

References ast_channel::_state, ast_answer(), ast_app_parse_options(), ast_app_separate_args(), AST_DIGIT_ANY, ast_log(), 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, and ast_channel::priority.

05688 {
05689    int res = 0;
05690    int argc;
05691    char *parse;
05692    char *argv[4];
05693    char *options = NULL; 
05694    char *filename = NULL;
05695    char *front = NULL, *back = NULL;
05696    char *lang = NULL;
05697    char *context = NULL;
05698    struct ast_flags flags = {0};
05699 
05700    parse = ast_strdupa(data);
05701 
05702    if ((argc = ast_app_separate_args(parse, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
05703       switch (argc) {
05704       case 4:
05705          context = argv[3];
05706       case 3:
05707          lang = argv[2];
05708       case 2:
05709          options = argv[1];
05710       case 1:
05711          filename = argv[0];
05712          break;
05713       default:
05714          ast_log(LOG_WARNING, "Background requires an argument (filename)\n");
05715          break;
05716       }
05717    }
05718 
05719    if (!lang)
05720       lang = chan->language;
05721 
05722    if (!context)
05723       context = chan->context;
05724 
05725    if (options) {
05726       if (!strcasecmp(options, "skip"))
05727          flags.flags = BACKGROUND_SKIP;
05728       else if (!strcasecmp(options, "noanswer"))
05729          flags.flags = BACKGROUND_NOANSWER;
05730       else
05731          ast_app_parse_options(background_opts, &flags, NULL, options);
05732    }
05733 
05734    /* Answer if need be */
05735    if (chan->_state != AST_STATE_UP) {
05736       if (ast_test_flag(&flags, BACKGROUND_SKIP)) {
05737          return 0;
05738       } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) {
05739          res = ast_answer(chan);
05740       }
05741    }
05742 
05743    if (!res) {
05744       /* Stop anything playing */
05745       ast_stopstream(chan);
05746       /* Stream a file */
05747       front = filename;
05748       while(!res && front) {
05749          if((back = strchr(front, '&'))) {
05750             *back = '\0';
05751             back++;
05752          }
05753          res = ast_streamfile(chan, front, lang);
05754          if (!res) {
05755             if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) {
05756                res = ast_waitstream(chan, "");
05757             } else {
05758                if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) {
05759                   res = ast_waitstream_exten(chan, context);
05760                } else {
05761                   res = ast_waitstream(chan, AST_DIGIT_ANY);
05762                }
05763             }
05764             ast_stopstream(chan);
05765          } else {
05766             ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data);
05767             res = 0;
05768             break;
05769          }
05770          front = back;
05771       }
05772    }
05773    if (context != chan->context && res) {
05774       snprintf(chan->exten, sizeof(chan->exten), "%c", res);
05775       ast_copy_string(chan->context, context, sizeof(chan->context));
05776       chan->priority = 0;
05777       return 0;
05778    } else {
05779       return res;
05780    }
05781 }

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

Definition at line 5402 of file pbx.c.

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

Referenced by __ast_pbx_run().

05403 {
05404    ast_indicate(chan, AST_CONTROL_BUSY);     
05405    ast_setstate(chan, AST_STATE_BUSY);
05406    wait_for_hangup(chan, data);
05407    return -1;
05408 }

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

Definition at line 5413 of file pbx.c.

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

Referenced by __ast_pbx_run().

05414 {
05415    ast_indicate(chan, AST_CONTROL_CONGESTION);
05416    ast_setstate(chan, AST_STATE_BUSY);
05417    wait_for_hangup(chan, data);
05418    return -1;
05419 }

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

DigitTimeout

Todo:
Remove in 1.3 dev

Definition at line 5832 of file pbx.c.

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

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

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

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

05561 {
05562    int res = 0;
05563    char *ptr1, *ptr2;
05564    struct ast_timing timing;
05565    struct ast_app *app;
05566    const char *usage = "ExecIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?<appname>[|<appargs>]";
05567 
05568    if (ast_strlen_zero(data)) {
05569       ast_log(LOG_WARNING, "%s\n", usage);   
05570       return -1;
05571    }
05572 
05573    ptr1 = ast_strdupa(data);
05574 
05575    if (!ptr1) {
05576       ast_log(LOG_ERROR, "Out of Memory!\n");
05577       return -1;  
05578    }
05579 
05580    ptr2 = ptr1;
05581    /* Separate the Application data ptr1 is the time spec ptr2 is the app|data */
05582    strsep(&ptr2,"?");
05583    if(!ast_build_timing(&timing, ptr1)) {
05584       ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", ptr1, usage);
05585       res = -1;
05586    }
05587       
05588    if (!res && ast_check_timing(&timing)) {
05589       if (!ptr2) {
05590          ast_log(LOG_WARNING, "%s\n", usage);
05591       }
05592 
05593       /* ptr2 is now the app name 
05594          we're done with ptr1 now so recycle it and use it to point to the app args */
05595       if((ptr1 = strchr(ptr2, '|'))) {
05596          *ptr1 = '\0';
05597          ptr1++;
05598       }
05599       
05600       if ((app = pbx_findapp(ptr2))) {
05601          res = pbx_exec(chan, app, ptr1 ? ptr1 : "", 1);
05602       } else {
05603          ast_log(LOG_WARNING, "Cannot locate application %s\n", ptr2);
05604          res = -1;
05605       }
05606    }
05607    
05608    return res;
05609 }

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

Goto

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

05856 {
05857    int res;
05858    res = ast_parseable_goto(chan, (const char *) data);
05859    if (!res && (option_verbose > 2))
05860       ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
05861    return res;
05862 }

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

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

05532 {
05533    int res=0;
05534    char *s, *ts;
05535    struct ast_timing timing;
05536 
05537    if (ast_strlen_zero(data)) {
05538       ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n  <time range>|<days of week>|<days of month>|<months>?[[context|]extension|]priority\n");
05539       return -1;
05540    }
05541 
05542    if ((s = ast_strdupa((char *) data))) {
05543       ts = s;
05544 
05545       /* Separate the Goto path */
05546       strsep(&ts,"?");
05547 
05548       /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */
05549       if (ast_build_timing(&timing, s) && ast_check_timing(&timing))
05550          res = pbx_builtin_goto(chan, (void *)ts);
05551    } else {
05552       ast_log(LOG_ERROR, "Memory Error!\n");
05553    }
05554    return res;
05555 }

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

Definition at line 5520 of file pbx.c.

References ast_channel::hangupcause.

05521 {
05522    /* Just return non-zero and it will hang up */
05523    if (!chan->hangupcause)
05524       chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
05525    return -1;
05526 }

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

Definition at line 5384 of file pbx.c.

References AST_CONTROL_PROGRESS, and ast_indicate().

05385 {
05386    ast_indicate(chan, AST_CONTROL_PROGRESS);
05387    return 0;
05388 }

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

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

05473 {
05474    char *args;
05475    struct ast_flags flags = { 0 };
05476    
05477    if (!ast_strlen_zero(data)) {
05478       args = ast_strdupa(data);
05479       if (!args) {
05480          ast_log(LOG_ERROR, "Out of memory!\n");
05481          return -1;
05482       }
05483       ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
05484    }
05485 
05486    ast_cdr_reset(chan->cdr, &flags);
05487 
05488    return 0;
05489 }

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

Definition at line 5393 of file pbx.c.

References AST_CONTROL_RINGING, and ast_indicate().

05394 {
05395    ast_indicate(chan, AST_CONTROL_RINGING);
05396    return 0;
05397 }

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

ResponseTimeout

Todo:
Remove in 1.3 dev

Definition at line 5808 of file pbx.c.

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

05809 {
05810    static int deprecation_warning = 0;
05811 
05812    if (!deprecation_warning) {
05813       ast_log(LOG_WARNING, "ResponseTimeout is deprecated, please use Set(TIMEOUT(response)=timeout) instead.\n");
05814       deprecation_warning = 1;
05815    }
05816 
05817    /* If the channel is not in a PBX, return now */
05818    if (!chan->pbx)
05819       return 0;
05820 
05821    /* Set the timeout for how long to wait between digits */
05822    chan->pbx->rtimeout = atoi((char *)data);
05823    if (option_verbose > 2)
05824       ast_verbose( VERBOSE_PREFIX_3 "Set Response Timeout to %d\n", chan->pbx->rtimeout);
05825    return 0;
05826 }

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

Definition at line 5494 of file pbx.c.

References ast_cdr_setaccount().

05495 {
05496    /* Copy the account code  as specified */
05497    if (data)
05498       ast_cdr_setaccount(chan, (char *)data);
05499    else
05500       ast_cdr_setaccount(chan, "");
05501    return 0;
05502 }

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

Definition at line 5507 of file pbx.c.

References ast_cdr_setamaflags().

05508 {
05509    /* Copy the AMA Flags as specified */
05510    if (data)
05511       ast_cdr_setamaflags(chan, (char *)data);
05512    else
05513       ast_cdr_setamaflags(chan, "");
05514    return 0;
05515 }

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

Definition at line 5447 of file pbx.c.

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

05448 {
05449    static int deprecation_warning = 0;
05450 
05451    if (!deprecation_warning) {
05452       ast_log(LOG_WARNING, "SetLanguage is deprecated, please use Set(LANGUAGE()=language) instead.\n");
05453       deprecation_warning = 1;
05454    }
05455 
05456    /* Copy the language as specified */
05457    if (!ast_strlen_zero(data))
05458       ast_copy_string(chan->language, data, sizeof(chan->language));
05459 
05460    return 0;
05461 }

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

Definition at line 5614 of file pbx.c.

References ast_safe_sleep().

05615 {
05616    int ms;
05617 
05618    /* Wait for "n" seconds */
05619    if (data && atof((char *)data)) {
05620       ms = atof((char *)data) * 1000;
05621       return ast_safe_sleep(chan, ms);
05622    }
05623    return 0;
05624 }

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

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

05630 {
05631    int ms, res, argc;
05632    char *args;
05633    char *argv[2];
05634    char *options = NULL; 
05635    char *timeout = NULL;
05636    struct ast_flags flags = {0};
05637    char *opts[1] = { NULL };
05638 
05639    args = ast_strdupa(data);
05640 
05641    if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
05642       if (argc > 0) {
05643          timeout = argv[0];
05644          if (argc > 1)
05645             options = argv[1];
05646       }
05647    }
05648 
05649    if (options)
05650       ast_app_parse_options(waitexten_opts, &flags, opts, options);
05651    
05652    if (ast_test_flag(&flags, WAITEXTEN_MOH))
05653       ast_moh_start(chan, opts[0]);
05654 
05655    /* Wait for "n" seconds */
05656    if (timeout && atof((char *)timeout)) 
05657       ms = atof((char *)timeout) * 1000;
05658    else if (chan->pbx)
05659       ms = chan->pbx->rtimeout * 1000;
05660    else
05661       ms = 10000;
05662    res = ast_waitfordigit(chan, ms);
05663    if (!res) {
05664       if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) {
05665          if (option_verbose > 2)
05666             ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, continuing...\n", chan->name);
05667       } else if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) {
05668          if (option_verbose > 2)
05669             ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, going to 't'\n", chan->name);
05670          ast_copy_string(chan->exten, "t", sizeof(chan->exten));
05671          chan->priority = 0;
05672       } else {
05673          ast_log(LOG_WARNING, "Timeout but no rule 't' in context '%s'\n", chan->context);
05674          res = -1;
05675       }
05676    }
05677 
05678    if (ast_test_flag(&flags, WAITEXTEN_MOH))
05679       ast_moh_stop(chan);
05680 
05681    return res;
05682 }


Generated on Mon Mar 20 08:20:33 2006 for Asterisk - the Open Source PBX by  doxygen 1.3.9.1