Dial plan applications

Applications support the dialplan. They register dynamically with. 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_amd.c
 Answering machine detection.
file  app_authenticate.c
 Execute arbitrary authenticate commands.
file  app_bridgewait.c
 Application to place the channel into a holding Bridge.
file  app_cdr.c
 Applications connected with CDR engine.
file  app_celgenuserevent.c
 Generate User-Defined CEL event.
file  app_chanisavail.c
 Check if Channel is Available.
file  app_channelredirect.c
 ChannelRedirect application.
file  app_chanspy.c
 ChanSpy: Listen in on any channel.
file  app_confbridge.c
 Conference Bridge application.
file  app_controlplayback.c
 Trivial application to control playback of a sound file.
file  app_dahdiras.c
 Execute an ISDN RAS.
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_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 DAHDI trunk.
file  app_followme.c
 Find-Me Follow-Me application.
file  app_forkcdr.c
 Fork CDR application.
file  app_getcpeid.c
 Get ADSI CPE ID.
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_ivrdemo.c
 IVR Demo application.
file  app_jack.c
 Jack Application.
file  app_macro.c
 Dial plan macro Implementation.
file  app_meetme.c
 Meet me conference bridge and Shared Line Appearances.
file  app_milliwatt.c
 Digital Milliwatt Test.
file  app_minivm.c
 MiniVoiceMail - A Minimal Voicemail System for Asterisk.
file  app_mixmonitor.c
 MixMonitor() - Record a call and mix the audio during the recording.
file  app_morsecode.c
 Morsecode application.
file  app_mp3.c
 Silly application to play an MP3 file -- uses mpg123.
file  app_mysql.c
 MYSQL dialplan application.
file  app_nbscat.c
 Silly application to play an NBScat file -- uses nbscat8k.
file  app_originate.c
 Originate application.
file  app_osplookup.c
 Open Settlement Protocol (OSP) Applications.
file  app_page.c
 page() - Paging application
file  app_playback.c
 Trivial application to playback a sound file.
file  app_playtones.c
 Playtones application.
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_read.c
 Trivial application to read a variable.
file  app_readexten.c
 Trivial application to read an extension into a variable.
file  app_record.c
 Trivial application to record a sound file.
file  app_saycounted.c
 Applications to decline words according to current language.
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 presentation.
file  app_skel.c
 Skeleton application.
file  app_sms.c
 SMS application - ETSI ES 201 912 protocol 1 implementation.
file  app_softhangup.c
 SoftHangup application.
file  app_speech_utils.c
 Speech Recognition Utility Applications.
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_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
  • WaitForSilence(300,3,10) will wait for 300ms of silence, 3 times, and return after 10sec
    .

file  app_waituntil.c
 Sleep until the given epoch.
file  app_while.c
 While Loop Implementation.
file  app_zapateller.c
 Playback the special information tone to get rid of telemarketers.
file  conf_state.c
 Confbridge state handling.
file  conf_state_empty.c
 Confbridge state handling for the EMPTY state.
file  conf_state_inactive.c
 Confbridge state handling for the INACTIVE state.
file  conf_state_multi.c
 Confbridge state handling for the MULTI state.
file  conf_state_multi_marked.c
 Confbridge state handling for the MULTI_MARKED state.
file  conf_state_single.c
 Confbridge state handling for the SINGLE state.
file  conf_state_single_marked.c
 Confbridge state handling for the SINGLE_MARKED state.
file  res_ael_share.c
 Shareable AEL code -- mainly between internal and external modules.
file  res_fax.c
 Generic FAX Resource for FAX technology resource modules.
file  res_format_attr_h263.c
 H.263 Format Attribute Module.
file  res_format_attr_h264.c
 H.264 Format Attribute Module.
file  res_realtime.c
 RealTime CLI.

Functions

static int iax2_prov_app (struct ast_channel *chan, const char *data)
static int pbx_builtin_answer (struct ast_channel *, const char *)
static int pbx_builtin_background (struct ast_channel *, const char *)
static int pbx_builtin_busy (struct ast_channel *, const char *)
static int pbx_builtin_congestion (struct ast_channel *, const char *)
static int pbx_builtin_execiftime (struct ast_channel *, const char *)
static int pbx_builtin_goto (struct ast_channel *, const char *)
static int pbx_builtin_gotoiftime (struct ast_channel *, const char *)
static int pbx_builtin_hangup (struct ast_channel *, const char *)
static int pbx_builtin_proceeding (struct ast_channel *, const char *)
static int pbx_builtin_progress (struct ast_channel *, const char *)
static int pbx_builtin_ringing (struct ast_channel *, const char *)
static int pbx_builtin_setamaflags (struct ast_channel *, const char *)
static int pbx_builtin_wait (struct ast_channel *, const char *)
static int pbx_builtin_waitexten (struct ast_channel *, const char *)

Detailed Description

Applications support the dialplan. They register dynamically with.

Asterisk Dial Plan Applications

See also:
ast_register_application() and unregister with

ast_unregister_application()

See also

Function Documentation

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

iax2provision

Definition at line 12184 of file chan_iax2.c.

References iax2_trunk_peer::addr, ast_channel_tech(), ast_channel_tech_pvt(), ast_log, ast_sockaddr_isnull(), ast_sockaddr_stringify(), ast_strdupa, ast_strlen_zero, ast_verb, iax2_provision(), LOG_NOTICE, NULL, PTR_TO_CALLNO, and iax2_trunk_peer::sockfd.

Referenced by load_module().

12185 {
12186    int res;
12187    char *sdata;
12188    char *opts;
12189    int force =0;
12190    unsigned short callno = PTR_TO_CALLNO(ast_channel_tech_pvt(chan));
12191    if (ast_strlen_zero(data))
12192       data = "default";
12193    sdata = ast_strdupa(data);
12194    opts = strchr(sdata, '|');
12195    if (opts)
12196       *opts='\0';
12197 
12198    if (ast_channel_tech(chan) != &iax2_tech) {
12199       ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n");
12200       return -1;
12201    }
12202    if (!callno || !iaxs[callno] || ast_sockaddr_isnull(&iaxs[callno]->addr)) {
12203       ast_log(LOG_NOTICE, "Can't provision something with no IP?\n");
12204       return -1;
12205    }
12206    res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force);
12207    ast_verb(3, "Provisioned IAXY at '%s' with '%s'= %d\n",
12208       ast_sockaddr_stringify(&iaxs[callno]->addr),
12209       sdata, res);
12210    return res;
12211 }

static int pbx_builtin_answer ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 10909 of file pbx.c.

References __ast_answer(), args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_LOG_WARNING, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_strlen_zero, and parse().

10910 {
10911    int delay = 0;
10912    char *parse;
10913    AST_DECLARE_APP_ARGS(args,
10914       AST_APP_ARG(delay);
10915       AST_APP_ARG(answer_cdr);
10916    );
10917 
10918    if (ast_strlen_zero(data)) {
10919       return __ast_answer(chan, 0);
10920    }
10921 
10922    parse = ast_strdupa(data);
10923 
10924    AST_STANDARD_APP_ARGS(args, parse);
10925 
10926    if (!ast_strlen_zero(args.delay) && (ast_channel_state(chan) != AST_STATE_UP))
10927       delay = atoi(data);
10928 
10929    if (delay < 0) {
10930       delay = 0;
10931    }
10932 
10933    if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) {
10934       ast_log(AST_LOG_WARNING, "The nocdr option for the Answer application has been removed and is no longer supported.\n");
10935    }
10936 
10937    return __ast_answer(chan, delay);
10938 }

static int pbx_builtin_background ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 11258 of file pbx.c.

References args, ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_canmatch_extension(), ast_channel_caller(), ast_channel_context(), ast_channel_context_set(), ast_channel_exten_set(), ast_channel_flags(), ast_channel_language(), ast_channel_lock, ast_channel_name(), ast_channel_priority_set(), ast_channel_unlock, AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, AST_FLAG_DISABLE_WORKAROUNDS, ast_log, ast_matchmore_extension(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_stopstream(), ast_strdupa, ast_streamfile(), ast_strip(), ast_strlen_zero, ast_test_flag, ast_waitstream(), ast_waitstream_exten(), BACKGROUND_MATCHEXTEN, BACKGROUND_NOANSWER, background_opts, BACKGROUND_PLAYBACK, BACKGROUND_SKIP, buf, ast_flags::flags, LOG_WARNING, NULL, parse(), pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), S_COR, and strsep().

11259 {
11260    int res = 0;
11261    int mres = 0;
11262    struct ast_flags flags = {0};
11263    char *parse, exten[2] = "";
11264    AST_DECLARE_APP_ARGS(args,
11265       AST_APP_ARG(filename);
11266       AST_APP_ARG(options);
11267       AST_APP_ARG(lang);
11268       AST_APP_ARG(context);
11269    );
11270 
11271    if (ast_strlen_zero(data)) {
11272       ast_log(LOG_WARNING, "Background requires an argument (filename)\n");
11273       return -1;
11274    }
11275 
11276    parse = ast_strdupa(data);
11277 
11278    AST_STANDARD_APP_ARGS(args, parse);
11279 
11280    if (ast_strlen_zero(args.lang))
11281       args.lang = (char *)ast_channel_language(chan); /* XXX this is const */
11282 
11283    if (ast_strlen_zero(args.context)) {
11284       const char *context;
11285       ast_channel_lock(chan);
11286       if ((context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"))) {
11287          args.context = ast_strdupa(context);
11288       } else {
11289          args.context = ast_strdupa(ast_channel_context(chan));
11290       }
11291       ast_channel_unlock(chan);
11292    }
11293 
11294    if (args.options) {
11295       if (!strcasecmp(args.options, "skip"))
11296          flags.flags = BACKGROUND_SKIP;
11297       else if (!strcasecmp(args.options, "noanswer"))
11298          flags.flags = BACKGROUND_NOANSWER;
11299       else
11300          ast_app_parse_options(background_opts, &flags, NULL, args.options);
11301    }
11302 
11303    /* Answer if need be */
11304    if (ast_channel_state(chan) != AST_STATE_UP) {
11305       if (ast_test_flag(&flags, BACKGROUND_SKIP)) {
11306          goto done;
11307       } else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) {
11308          res = ast_answer(chan);
11309       }
11310    }
11311 
11312    if (!res) {
11313       char *back = ast_strip(args.filename);
11314       char *front;
11315 
11316       ast_stopstream(chan);      /* Stop anything playing */
11317       /* Stream the list of files */
11318       while (!res && (front = strsep(&back, "&")) ) {
11319          if ( (res = ast_streamfile(chan, front, args.lang)) ) {
11320             ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", ast_channel_name(chan), (char*)data);
11321             res = 0;
11322             mres = 1;
11323             break;
11324          }
11325          if (ast_test_flag(&flags, BACKGROUND_PLAYBACK)) {
11326             res = ast_waitstream(chan, "");
11327          } else if (ast_test_flag(&flags, BACKGROUND_MATCHEXTEN)) {
11328             res = ast_waitstream_exten(chan, args.context);
11329          } else {
11330             res = ast_waitstream(chan, AST_DIGIT_ANY);
11331          }
11332          ast_stopstream(chan);
11333       }
11334    }
11335 
11336    /*
11337     * If the single digit DTMF is an extension in the specified context, then
11338     * go there and signal no DTMF.  Otherwise, we should exit with that DTMF.
11339     * If we're in Macro, we'll exit and seek that DTMF as the beginning of an
11340     * extension in the Macro's calling context.  If we're not in Macro, then
11341     * we'll simply seek that extension in the calling context.  Previously,
11342     * someone complained about the behavior as it related to the interior of a
11343     * Gosub routine, and the fix (#14011) inadvertently broke FreePBX
11344     * (#14940).  This change should fix both of these situations, but with the
11345     * possible incompatibility that if a single digit extension does not exist
11346     * (but a longer extension COULD have matched), it would have previously
11347     * gone immediately to the "i" extension, but will now need to wait for a
11348     * timeout.
11349     *
11350     * Later, we had to add a flag to disable this workaround, because AGI
11351     * users can EXEC Background and reasonably expect that the DTMF code will
11352     * be returned (see #16434).
11353     */
11354    if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS)
11355       && (exten[0] = res)
11356       && ast_canmatch_extension(chan, args.context, exten, 1,
11357          S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
11358       && !ast_matchmore_extension(chan, args.context, exten, 1,
11359          S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
11360       char buf[2] = { 0, };
11361       snprintf(buf, sizeof(buf), "%c", res);
11362       ast_channel_exten_set(chan, buf);
11363       ast_channel_context_set(chan, args.context);
11364       ast_channel_priority_set(chan, 0);
11365       res = 0;
11366    }
11367 done:
11368    pbx_builtin_setvar_helper(chan, "BACKGROUNDSTATUS", mres ? "FAILED" : "SUCCESS");
11369    return res;
11370 }

static int pbx_builtin_busy ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 10873 of file pbx.c.

References AST_CAUSE_BUSY, ast_channel_hangupcause_set(), ast_channel_lock, ast_channel_unlock, AST_CONTROL_BUSY, ast_indicate(), ast_setstate(), AST_STATE_BUSY, AST_STATE_UP, and wait_for_hangup().

Referenced by __ast_pbx_run().

10874 {
10875    ast_indicate(chan, AST_CONTROL_BUSY);
10876    /* Don't change state of an UP channel, just indicate
10877       busy in audio */
10878    ast_channel_lock(chan);
10879    if (ast_channel_state(chan) != AST_STATE_UP) {
10880       ast_channel_hangupcause_set(chan, AST_CAUSE_BUSY);
10881       ast_setstate(chan, AST_STATE_BUSY);
10882    }
10883    ast_channel_unlock(chan);
10884    wait_for_hangup(chan, data);
10885    return -1;
10886 }

static int pbx_builtin_congestion ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 10891 of file pbx.c.

References AST_CAUSE_CONGESTION, ast_channel_hangupcause_set(), ast_channel_lock, ast_channel_unlock, AST_CONTROL_CONGESTION, ast_indicate(), ast_setstate(), AST_STATE_BUSY, AST_STATE_UP, and wait_for_hangup().

Referenced by __ast_pbx_run().

10892 {
10893    ast_indicate(chan, AST_CONTROL_CONGESTION);
10894    /* Don't change state of an UP channel, just indicate
10895       congestion in audio */
10896    ast_channel_lock(chan);
10897    if (ast_channel_state(chan) != AST_STATE_UP) {
10898       ast_channel_hangupcause_set(chan, AST_CAUSE_CONGESTION);
10899       ast_setstate(chan, AST_STATE_BUSY);
10900    }
10901    ast_channel_unlock(chan);
10902    wait_for_hangup(chan, data);
10903    return -1;
10904 }

static int pbx_builtin_execiftime ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 11114 of file pbx.c.

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

11115 {
11116    char *s, *appname;
11117    struct ast_timing timing;
11118    struct ast_app *app;
11119    static const char * const usage = "ExecIfTime requires an argument:\n  <time range>,<days of week>,<days of month>,<months>[,<timezone>]?<appname>[(<appargs>)]";
11120 
11121    if (ast_strlen_zero(data)) {
11122       ast_log(LOG_WARNING, "%s\n", usage);
11123       return -1;
11124    }
11125 
11126    appname = ast_strdupa(data);
11127 
11128    s = strsep(&appname, "?"); /* Separate the timerange and application name/data */
11129    if (!appname) {   /* missing application */
11130       ast_log(LOG_WARNING, "%s\n", usage);
11131       return -1;
11132    }
11133 
11134    if (!ast_build_timing(&timing, s)) {
11135       ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", s, usage);
11136       ast_destroy_timing(&timing);
11137       return -1;
11138    }
11139 
11140    if (!ast_check_timing(&timing))  { /* outside the valid time window, just return */
11141       ast_destroy_timing(&timing);
11142       return 0;
11143    }
11144    ast_destroy_timing(&timing);
11145 
11146    /* now split appname(appargs) */
11147    if ((s = strchr(appname, '('))) {
11148       char *e;
11149       *s++ = '\0';
11150       if ((e = strrchr(s, ')')))
11151          *e = '\0';
11152       else
11153          ast_log(LOG_WARNING, "Failed to find closing parenthesis\n");
11154    }
11155 
11156 
11157    if ((app = pbx_findapp(appname))) {
11158       return pbx_exec(chan, app, S_OR(s, ""));
11159    } else {
11160       ast_log(LOG_WARNING, "Cannot locate application %s\n", appname);
11161       return -1;
11162    }
11163 }

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

Goto

Definition at line 11375 of file pbx.c.

References ast_channel_context(), ast_channel_exten(), ast_channel_priority(), ast_parseable_goto(), and ast_verb.

Referenced by pbx_builtin_gotoif(), and pbx_builtin_gotoiftime().

11376 {
11377    int res = ast_parseable_goto(chan, data);
11378    if (!res)
11379       ast_verb(3, "Goto (%s,%s,%d)\n", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan) + 1);
11380    return res;
11381 }

static int pbx_builtin_gotoiftime ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 11060 of file pbx.c.

References ast_build_timing(), ast_channel_lock, ast_channel_unlock, ast_check_timing2(), ast_debug, ast_destroy_timing(), ast_log, ast_strdupa, ast_strlen_zero, ast_tvnow(), LOG_WARNING, NULL, pbx_builtin_getvar_helper(), pbx_builtin_goto(), pbx_builtin_setvar_helper(), and strsep().

11061 {
11062    char *s, *ts, *branch1, *branch2, *branch;
11063    struct ast_timing timing;
11064    const char *ctime;
11065    struct timeval tv = ast_tvnow();
11066    long timesecs;
11067 
11068    if (!chan) {
11069       ast_log(LOG_WARNING, "GotoIfTime requires a channel on which to operate\n");
11070       return -1;
11071    }
11072 
11073    if (ast_strlen_zero(data)) {
11074       ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n  <time range>,<days of week>,<days of month>,<months>[,<timezone>]?'labeliftrue':'labeliffalse'\n");
11075       return -1;
11076    }
11077 
11078    ts = s = ast_strdupa(data);
11079 
11080    ast_channel_lock(chan);
11081    if ((ctime = pbx_builtin_getvar_helper(chan, "TESTTIME")) && sscanf(ctime, "%ld", &timesecs) == 1) {
11082       tv.tv_sec = timesecs;
11083    } else if (ctime) {
11084       ast_log(LOG_WARNING, "Using current time to evaluate\n");
11085       /* Reset when unparseable */
11086       pbx_builtin_setvar_helper(chan, "TESTTIME", NULL);
11087    }
11088    ast_channel_unlock(chan);
11089 
11090    /* Separate the Goto path */
11091    strsep(&ts, "?");
11092    branch1 = strsep(&ts,":");
11093    branch2 = strsep(&ts,"");
11094 
11095    /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */
11096    if (ast_build_timing(&timing, s) && ast_check_timing2(&timing, tv)) {
11097       branch = branch1;
11098    } else {
11099       branch = branch2;
11100    }
11101    ast_destroy_timing(&timing);
11102 
11103    if (ast_strlen_zero(branch)) {
11104       ast_debug(1, "Not taking any branch\n");
11105       return 0;
11106    }
11107 
11108    return pbx_builtin_goto(chan, branch);
11109 }

static int pbx_builtin_hangup ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 10993 of file pbx.c.

References AST_CAUSE_NORMAL_CLEARING, ast_channel_hangupcause(), ast_channel_hangupcause_set(), ast_channel_lock, ast_channel_unlock, ast_log, ast_set_hangupsource(), AST_SOFTHANGUP_EXPLICIT, ast_softhangup_nolock(), ast_str2cause(), ast_strlen_zero, and LOG_WARNING.

10994 {
10995    int cause;
10996 
10997    ast_set_hangupsource(chan, "dialplan/builtin", 0);
10998 
10999    if (!ast_strlen_zero(data)) {
11000       cause = ast_str2cause(data);
11001       if (cause <= 0) {
11002          if (sscanf(data, "%30d", &cause) != 1 || cause <= 0) {
11003             ast_log(LOG_WARNING, "Invalid cause given to Hangup(): \"%s\"\n", data);
11004             cause = 0;
11005          }
11006       }
11007    } else {
11008       cause = 0;
11009    }
11010 
11011    ast_channel_lock(chan);
11012    if (cause <= 0) {
11013       cause = ast_channel_hangupcause(chan);
11014       if (cause <= 0) {
11015          cause = AST_CAUSE_NORMAL_CLEARING;
11016       }
11017    }
11018    ast_channel_hangupcause_set(chan, cause);
11019    ast_softhangup_nolock(chan, AST_SOFTHANGUP_EXPLICIT);
11020    ast_channel_unlock(chan);
11021 
11022    return -1;
11023 }

static int pbx_builtin_proceeding ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 10846 of file pbx.c.

References AST_CONTROL_PROCEEDING, and ast_indicate().

10847 {
10848    ast_indicate(chan, AST_CONTROL_PROCEEDING);
10849    return 0;
10850 }

static int pbx_builtin_progress ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 10855 of file pbx.c.

References AST_CONTROL_PROGRESS, and ast_indicate().

10856 {
10857    ast_indicate(chan, AST_CONTROL_PROGRESS);
10858    return 0;
10859 }

static int pbx_builtin_ringing ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 10864 of file pbx.c.

References AST_CONTROL_RINGING, and ast_indicate().

10865 {
10866    ast_indicate(chan, AST_CONTROL_RINGING);
10867    return 0;
10868 }

static int pbx_builtin_setamaflags ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 10965 of file pbx.c.

References amaflags, ast_channel_amaflags_set(), ast_channel_lock, ast_channel_name(), ast_channel_string2amaflag(), ast_channel_unlock, ast_log, AST_LOG_WARNING, and ast_strlen_zero.

10966 {
10967    ast_log(AST_LOG_WARNING, "The SetAMAFlags application is deprecated. Please use the CHANNEL function instead.\n");
10968 
10969    if (ast_strlen_zero(data)) {
10970       ast_log(AST_LOG_WARNING, "No parameter passed to SetAMAFlags\n");
10971       return 0;
10972    }
10973    /* Copy the AMA Flags as specified */
10974    ast_channel_lock(chan);
10975    if (isdigit(data[0])) {
10976       int amaflags;
10977       if (sscanf(data, "%30d", &amaflags) != 1) {
10978          ast_log(AST_LOG_WARNING, "Unable to set AMA flags on channel %s\n", ast_channel_name(chan));
10979          ast_channel_unlock(chan);
10980          return 0;
10981       }
10982       ast_channel_amaflags_set(chan, amaflags);
10983    } else {
10984       ast_channel_amaflags_set(chan, ast_channel_string2amaflag(data));
10985    }
10986    ast_channel_unlock(chan);
10987    return 0;
10988 }

static int pbx_builtin_wait ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 11168 of file pbx.c.

References ast_app_parse_timelen(), ast_safe_sleep(), and TIMELEN_SECONDS.

11169 {
11170    int ms;
11171 
11172    /* Wait for "n" seconds */
11173    if (!ast_app_parse_timelen(data, &ms, TIMELEN_SECONDS) && ms > 0) {
11174       return ast_safe_sleep(chan, ms);
11175    }
11176    return 0;
11177 }

static int pbx_builtin_waitexten ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 11182 of file pbx.c.

References args, AST_APP_ARG, ast_app_parse_options(), ast_app_parse_timelen(), ast_channel_caller(), ast_channel_context(), ast_channel_exten(), ast_channel_name(), ast_channel_pbx(), ast_channel_priority(), ast_channel_zone(), ast_check_hangup(), AST_CONTROL_HOLD, AST_CONTROL_UNHOLD, AST_DECLARE_APP_ARGS, ast_exists_extension(), ast_get_indication_tone(), ast_indicate(), ast_indicate_data(), ast_log, ast_playtones_start(), ast_playtones_stop(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero, ast_test_flag, ast_tone_zone_sound_unref(), ast_tonepair_start(), ast_verb, ast_waitfordigit(), ast_tone_zone_sound::data, LOG_WARNING, NULL, parse(), raise_exception(), ast_pbx::rtimeoutms, S_COR, S_OR, set_ext_pri(), TIMELEN_SECONDS, timeout, WAITEXTEN_DIALTONE, WAITEXTEN_MOH, and waitexten_opts.

11183 {
11184    int ms, res;
11185    struct ast_flags flags = {0};
11186    char *opts[1] = { NULL };
11187    char *parse;
11188    AST_DECLARE_APP_ARGS(args,
11189       AST_APP_ARG(timeout);
11190       AST_APP_ARG(options);
11191    );
11192 
11193    if (!ast_strlen_zero(data)) {
11194       parse = ast_strdupa(data);
11195       AST_STANDARD_APP_ARGS(args, parse);
11196    } else
11197       memset(&args, 0, sizeof(args));
11198 
11199    if (args.options)
11200       ast_app_parse_options(waitexten_opts, &flags, opts, args.options);
11201 
11202    if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) {
11203       ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n");
11204    } else if (ast_test_flag(&flags, WAITEXTEN_MOH)) {
11205       ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL),
11206          !ast_strlen_zero(opts[0]) ? strlen(opts[0]) + 1 : 0);
11207    } else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) {
11208       struct ast_tone_zone_sound *ts = ast_get_indication_tone(ast_channel_zone(chan), "dial");
11209       if (ts) {
11210          ast_playtones_start(chan, 0, ts->data, 0);
11211          ts = ast_tone_zone_sound_unref(ts);
11212       } else {
11213          ast_tonepair_start(chan, 350, 440, 0, 0);
11214       }
11215    }
11216    /* Wait for "n" seconds */
11217    if (!ast_app_parse_timelen(args.timeout, &ms, TIMELEN_SECONDS) && ms > 0) {
11218       /* Yay! */
11219    } else if (ast_channel_pbx(chan)) {
11220       ms = ast_channel_pbx(chan)->rtimeoutms;
11221    } else {
11222       ms = 10000;
11223    }
11224 
11225    res = ast_waitfordigit(chan, ms);
11226    if (!res) {
11227       if (ast_check_hangup(chan)) {
11228          /* Call is hungup for some reason. */
11229          res = -1;
11230       } else if (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan) + 1,
11231          S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
11232          ast_verb(3, "Timeout on %s, continuing...\n", ast_channel_name(chan));
11233       } else if (ast_exists_extension(chan, ast_channel_context(chan), "t", 1,
11234          S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
11235          ast_verb(3, "Timeout on %s, going to 't'\n", ast_channel_name(chan));
11236          set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */
11237       } else if (ast_exists_extension(chan, ast_channel_context(chan), "e", 1,
11238          S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
11239          raise_exception(chan, "RESPONSETIMEOUT", 0); /* 0 will become 1, next time through the loop */
11240       } else {
11241          ast_log(LOG_WARNING, "Timeout but no rule 't' or 'e' in context '%s'\n",
11242             ast_channel_context(chan));
11243          res = -1;
11244       }
11245    }
11246 
11247    if (ast_test_flag(&flags, WAITEXTEN_MOH))
11248       ast_indicate(chan, AST_CONTROL_UNHOLD);
11249    else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE))
11250       ast_playtones_stop(chan);
11251 
11252    return res;
11253 }


Generated on Thu Apr 16 06:34:45 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6