[Asterisk-Users] DeadAGI and Hangup on channel

Grigoriy Puzankin gpuzankin at b-great.net
Tue Jan 31 00:48:32 MST 2006


Hello,

GP> I'm trying to catch channel hangup in DeadAgi script.

Googling didn't help. Channel status AGI command returns 6 - "line is
up", because hangup has been requested only (and not completed).

I found the following solution. In res_agi.c source I found usage of
ast_check_hangup(chan) function. Then I added one AGI command to
retrieve ast_check_hangup function value.

Add the following routine to res_agi.c:

static int handle_getchannelhangup(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
{                                                                                                         
        int res;                                                                                          
        res = ast_check_hangup(chan))
        fdprintf(agi->fd, "200 result=%d\n", res);
        return RESULT_SUCCESS;
}

Declare agi command usage:

static char usage_getchannelhangup[] =
" Usage: GET CHANNEL HANGUP\n"
" \tChecks if hangup was requested on channel.\n"
" Returns 1 if hangup was requested on the channel, otherwise - 0.\n";

Add function definition to static agi_command commands[MAX_COMMANDS]:

{ { "get", "channel", "hangup", NULL }, handle_getchannelhangup, "Checks if hangup requested on current channel.", usage_getchannelhangup },

I'm not C programmer, my apologies to gurus.

If anyone find it useful then this could be a FEATURE REQUEST.

--
Grigoriy Puzankin




More information about the asterisk-users mailing list