mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-18 18:58:22 +00:00
Properly deal with Q.931 cause codes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4470 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -463,7 +463,6 @@ static struct oh323_peer *build_peer(char *name, struct ast_variable *v)
|
|||||||
*/
|
*/
|
||||||
static int oh323_digit(struct ast_channel *c, char digit)
|
static int oh323_digit(struct ast_channel *c, char digit)
|
||||||
{
|
{
|
||||||
ast_log(LOG_DEBUG, "Sending %c...\n", digit);
|
|
||||||
struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt;
|
struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt;
|
||||||
if (p && p->rtp && (p->dtmfmode & H323_DTMF_RFC2833)) {
|
if (p && p->rtp && (p->dtmfmode & H323_DTMF_RFC2833)) {
|
||||||
ast_rtp_senddigit(p->rtp, digit);
|
ast_rtp_senddigit(p->rtp, digit);
|
||||||
@@ -542,9 +541,8 @@ static int oh323_hangup(struct ast_channel *c)
|
|||||||
{
|
{
|
||||||
struct oh323_pvt *pvt = (struct oh323_pvt *) c->pvt->pvt;
|
struct oh323_pvt *pvt = (struct oh323_pvt *) c->pvt->pvt;
|
||||||
int needcancel = 0;
|
int needcancel = 0;
|
||||||
if (h323debug) {
|
int q931cause = AST_CAUSE_NORMAL_CLEARING;
|
||||||
ast_log(LOG_DEBUG, "oh323_hangup(%s)\n", c->name);
|
|
||||||
}
|
|
||||||
if (!c->pvt->pvt) {
|
if (!c->pvt->pvt) {
|
||||||
ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n");
|
ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -568,9 +566,28 @@ static int oh323_hangup(struct ast_channel *c)
|
|||||||
pvt->owner = NULL;
|
pvt->owner = NULL;
|
||||||
c->pvt->pvt = NULL;
|
c->pvt->pvt = NULL;
|
||||||
|
|
||||||
|
if (c->hangupcause) {
|
||||||
|
q931cause = c->hangupcause;
|
||||||
|
} else {
|
||||||
|
char *cause = pbx_builtin_getvar_helper(c, "DIALSTATUS");
|
||||||
|
if (cause) {
|
||||||
|
if (!strcmp(cause, "CONGESTION")) {
|
||||||
|
q931cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION;
|
||||||
|
} else if (!strcmp(cause, "BUSY")) {
|
||||||
|
q931cause = AST_CAUSE_USER_BUSY;
|
||||||
|
} else if (!strcmp(cause, "CHANISUNVAIL")) {
|
||||||
|
q931cause = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
|
||||||
|
} else if (!strcmp(cause, "NOANSWER")) {
|
||||||
|
q931cause = AST_CAUSE_NO_ANSWER;
|
||||||
|
} else if (!strcmp(cause, "CANCEL")) {
|
||||||
|
q931cause = AST_CAUSE_CALL_REJECTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Start the process if it's not already started */
|
/* Start the process if it's not already started */
|
||||||
if (!pvt->alreadygone) {
|
if (!pvt->alreadygone) {
|
||||||
if (h323_clear_call((pvt->cd).call_token, c->hangupcause)) {
|
if (h323_clear_call((pvt->cd).call_token, q931cause)) {
|
||||||
ast_log(LOG_DEBUG, "ClearCall failed.\n");
|
ast_log(LOG_DEBUG, "ClearCall failed.\n");
|
||||||
}
|
}
|
||||||
pvt->needdestroy = 1;
|
pvt->needdestroy = 1;
|
||||||
|
@@ -301,7 +301,7 @@ BOOL MyH323EndPoint::ClearCall(const PString & token)
|
|||||||
if (h323debug) {
|
if (h323debug) {
|
||||||
cout << "\t-- ClearCall: Request to clear call with token " << token << endl;
|
cout << "\t-- ClearCall: Request to clear call with token " << token << endl;
|
||||||
}
|
}
|
||||||
return ClearCall(token, H323Connection::EndedByLocalUser);
|
return H323EndPoint::ClearCall(token, H323Connection::EndedByLocalUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyH323EndPoint::SendUserTone(const PString &token, char tone)
|
void MyH323EndPoint::SendUserTone(const PString &token, char tone)
|
||||||
@@ -1287,13 +1287,15 @@ int h323_make_call(char *dest, call_details_t *cd, call_options_t *call_options)
|
|||||||
int h323_clear_call(const char *call_token, int cause)
|
int h323_clear_call(const char *call_token, int cause)
|
||||||
{
|
{
|
||||||
H225_ReleaseCompleteReason dummy;
|
H225_ReleaseCompleteReason dummy;
|
||||||
H323Connection::CallEndReason r = H323Connection::NumCallEndReasons;
|
H323Connection::CallEndReason r = H323Connection::EndedByLocalUser;
|
||||||
|
|
||||||
if (!h323_end_point_exist()) {
|
if (!h323_end_point_exist()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cause) {
|
||||||
r = H323TranslateToCallEndReason((Q931::CauseValues)(cause), dummy);
|
r = H323TranslateToCallEndReason((Q931::CauseValues)(cause), dummy);
|
||||||
|
}
|
||||||
|
|
||||||
endPoint->ClearCall(PString(call_token), r);
|
endPoint->ClearCall(PString(call_token), r);
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user