[Asterisk-cvs] asterisk/channels chan_h323.c,1.95,1.96
jeremy at lists.digium.com
jeremy at lists.digium.com
Wed Dec 15 23:29:11 CST 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv1684
Modified Files:
chan_h323.c
Log Message:
Properly deal with Q.931 cause codes
Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- chan_h323.c 16 Dec 2004 02:03:19 -0000 1.95
+++ chan_h323.c 16 Dec 2004 04:25:49 -0000 1.96
@@ -463,7 +463,6 @@
*/
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;
if (p && p->rtp && (p->dtmfmode & H323_DTMF_RFC2833)) {
ast_rtp_senddigit(p->rtp, digit);
@@ -542,9 +541,8 @@
{
struct oh323_pvt *pvt = (struct oh323_pvt *) c->pvt->pvt;
int needcancel = 0;
- if (h323debug) {
- ast_log(LOG_DEBUG, "oh323_hangup(%s)\n", c->name);
- }
+ int q931cause = AST_CAUSE_NORMAL_CLEARING;
+
if (!c->pvt->pvt) {
ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n");
return 0;
@@ -568,9 +566,28 @@
pvt->owner = 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 */
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");
}
pvt->needdestroy = 1;
More information about the svn-commits
mailing list