Added variable DISCONNECT_IND_REASON when DISCONNECT_IND is received.

This commit is contained in:
MelwareDE 2010-07-22 05:31:51 +00:00
parent c5f9794303
commit a4f7b18361
3 changed files with 21 additions and 7 deletions

View File

@ -10,6 +10,7 @@ HEAD
- Fixed memory leak in chat_play if using with 's' option
- Add 'econtransitconn' configurations parameter. Allows to preserve
EC for transit connections
- added variable DISCONNECT_IND_REASON to get real reason code from CAPI
chan_capi-1.1.5
------------------

7
README
View File

@ -530,6 +530,13 @@ CONNECTEDNUMBER
Can be set before answering and if set, the content is used for
IE 'Connected Number' on answering.
DISCONNECT_IND_REASON
When CAPI reports DISCONNECT_IND, some CAPI reason codes are not set
in HANGUPCAUSE, because they are not valid cause codes. To also
get those CAPI reason codes, you can check this variable on hangup.
This is e.g. useful for reason 0x3301, which tells that the ISDN
connection is physically broken (cable).
FAXEXTEN
If chan_capi sends the call to extensions 'fax', the original extension number
is saved in this variable.

View File

@ -4698,6 +4698,7 @@ static void capidev_handle_disconnect_indication(_cmsg *CMSG, unsigned int PLCI,
{
struct ast_frame fr = { AST_FRAME_CONTROL, };
int state;
char buffer[CAPI_MAX_STRING];
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_HANGUP;
@ -4717,13 +4718,18 @@ static void capidev_handle_disconnect_indication(_cmsg *CMSG, unsigned int PLCI,
i->reason = DISCONNECT_IND_REASON(CMSG);
if ((i->owner) && (i->owner->hangupcause == 0)) {
/* set hangupcause, in case there is no
* "cause" information element:
*/
i->owner->hangupcause =
((i->reason & 0xFF00) == 0x3400) ?
i->reason & 0x7F : AST_CAUSE_NORMAL_CLEARING;
if (i->owner) {
if (i->owner->hangupcause == 0) {
/* set hangupcause, in case there is no
* "cause" information element:
*/
i->owner->hangupcause =
((i->reason & 0xFF00) == 0x3400) ?
i->reason & 0x7F : AST_CAUSE_NORMAL_CLEARING;
}
/* the real reason could be != 0x34xx, so provide this value in variable */
sprintf(buffer, "%d", i->reason);
pbx_builtin_setvar_helper(i->owner, "DISCONNECT_IND_REASON", buffer);
}
if (i->FaxState & CAPI_FAX_STATE_ACTIVE) {