· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Asterisk Ver0-1-0/Pbx Builtin

AsteriskVer0-1-0/PbxBuiltin

static int pbx_builtin_answer(struct ast_channel *, void *);
static int pbx_builtin_goto(struct ast_channel *, void *);
static int pbx_builtin_hangup(struct ast_channel *, void *);
static int pbx_builtin_background(struct ast_channel *, void *);
static int pbx_builtin_dtimeout(struct ast_channel *, void *);
static int pbx_builtin_rtimeout(struct ast_channel *, void *);
static int pbx_builtin_wait(struct ast_channel *, void *);

static struct pbx_builtin {
        char name[AST_MAX_APP];
        int (*execute)(struct ast_channel *chan, void *data);
} builtins[] =
        { "Answer", pbx_builtin_answer },
        { "Goto", pbx_builtin_goto },
        { "Hangup", pbx_builtin_hangup },
        { "DigitTimeout", pbx_builtin_dtimeout },
        { "ResponseTimeout", pbx_builtin_rtimeout },
        { "BackGround", pbx_builtin_background },
        { "Wait", pbx_builtin_wait },

* int pbx_builtin_answer(struct ast_channel *chan, void *data)
  • if (chan->state != AST_STATE_RING) {
    • Ignoring answer request since line is not ringing
    • return 0;
  • return ast_answer(chan);
    • channel ¿¡ ÇØ´çÇÏ´Â answer ÇÔ¼ö°¡ ¼öÇàµÈ´Ù.

* int ast_answer(struct ast_channel *chan)
  • if (chan->state == AST_STATE_RING) {
    • if (chan->pvt->answer)
      • return chan->pvt->answer(chan);
  • }
  • return 0;

0.1.0
Goto requires an argument (optional context|optional extension|priority)

GoTo(5) ; example for priority
GoTo(112,5) ; example for extension and priority
GoTo(test1,112,5) ; example for context extension and priority
* int pbx_builtin_goto(struct ast_channel *chan, void *data)
  • data ¸¦ ó¸®ÇÏ¿© context, extension, priority °ªÀ» ã¾Æ³»°í, À̸¦ chan structure ¿¡ assign ÇÑ´Ù.
  • return 0;

* int pbx_builtin_hangup(struct ast_channel *chan, void *data)
  • return -1;

* int pbx_builtin_background(struct ast_channel *chan, void *data)
  • ast_stopstream(chan);
  • res = ast_streamfile(chan, (char *)data);
  • return res;
  • È­ÀÏÀ» ã°í, ÀÖÀ¸¸é ÀÌ¿¡ ¾Ë¸Â´Â codec À» ã¾Æ play ÇÑ´Ù.

The maximum amount of time permitted between digits when the
         user is typing in an extension.  When this timeout expires,
         after the user has started to type in an extension, the
         extension will be considered complete, and will be
         interpreted.  Note that if an extension typed in is valid,
         it will not have to timeout to be tested, so typically at
         the expiry of this timeout, the extension will be considered
         invalid (and thus control would be passed to the 'i'
         extension, or if it doesn't exist the call would be
         terminated).  The default timeout is 5 seconds. 
* int pbx_builtin_dtimeout(struct ast_channel *chan, void *data)
  • chan->pbx->dtimeout = atoi((char *)data);
  • Set the timeout for how long to wait between digits
  • return 0;

The maximum amount of time permitted after falling through a
          series of priorities for a channel in which the user may
          begin typing an extension.  If the user does not begin typing an
          extension in this amount of time, control will pass to the
          't' extension if it exists, and if not the call would be
          terminated. Once the user begins to type an extension Asterisk
          will wait for digit timeout to be reached and response timeout has
          no effect. The default timeout is 10 seconds. 
* int pbx_builtin_rtimeout(struct ast_channel *chan, void *data)
  • chan->pbx->rtimeout = atoi((char *)data);
  • Set Response Timeout
  • return 0;

* int pbx_builtin_wait(struct ast_channel *chan, void *data)
  • if (data && atoi((char *)data))
    • sleep(atoi((char *)data));
  • return 0;

ID
Password
Join
Promptness is its own reward, if one lives by the clock instead of the sword.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-07-14 08:51:51
Processing time 0.0037 sec