don't allow double ALERT_REQ and cleanup of state values

This commit is contained in:
MelwareDE 2005-06-12 14:27:26 +00:00
parent 806cfe6c9c
commit 887913bffc
2 changed files with 15 additions and 14 deletions

View File

@ -477,7 +477,14 @@ static int capi_alert(struct ast_channel *c)
{
struct ast_capi_pvt *i = CC_AST_CHANNEL_PVT(c);
_cmsg CMSG;
if ((i->state != CAPI_STATE_DISCONNECTED) &&
(i->state != CAPI_STATE_DID)) {
ast_log(LOG_WARNING, "CAPI attempting ALERT in state %d\n",
i->state);
return -1;
}
ALERT_REQ_HEADER(&CMSG, ast_capi_ApplID, i->MessageNumber, 0);
ALERT_REQ_PLCI(&CMSG) = i->PLCI;
@ -954,11 +961,6 @@ struct ast_frame *capi_read(struct ast_channel *c)
return NULL;
}
if ((i->state == CAPI_STATE_REMOTE_HANGUP)) {
ast_log(LOG_ERROR, "this channel is not connected\n");
return NULL;
}
if (i->state == CAPI_STATE_ONHOLD) {
i->fr.frametype = AST_FRAME_NULL;
return &i->fr;

View File

@ -86,16 +86,15 @@ static inline void write_capi_word(void *m, unsigned short val)
#define CAPI_STATE_DISCONNECTING 4
#define CAPI_STATE_DISCONNECTED 5
#define CAPI_STATE_REMOTE_HANGUP 6
#define CAPI_STATE_CONNECTPENDING 7
#define CAPI_STATE_ONHOLD 8
#define CAPI_STATE_NETWORKHANGUP 9
#define CAPI_STATE_ANSWERING 10
#define CAPI_STATE_PUTTINGONHOLD 11
#define CAPI_STATE_RETRIEVING 12
#define CAPI_STATE_CONNECTPENDING 6
#define CAPI_STATE_ANSWERING 7
#define CAPI_STATE_DID 8
#define CAPI_STATE_PUTTINGONHOLD 10
#define CAPI_STATE_RETRIEVING 11
#define CAPI_STATE_ONHOLD 12
#define CAPI_STATE_DID 13
#define AST_CAPI_B3_DONT 0
#define AST_CAPI_B3_ALWAYS 1