[asterisk-commits] mattf: branch mattf/asterisk-ss7 r38040 - /team/mattf/asterisk-ss7/channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jul 20 15:04:20 MST 2006


Author: mattf
Date: Thu Jul 20 17:04:19 2006
New Revision: 38040

URL: http://svn.digium.com/view/asterisk?rev=38040&view=rev
Log:
Modernize some of the hangup routines.

Modified:
    team/mattf/asterisk-ss7/channels/chan_zap.c

Modified: team/mattf/asterisk-ss7/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-ss7/channels/chan_zap.c?rev=38040&r1=38039&r2=38040&view=diff
==============================================================================
--- team/mattf/asterisk-ss7/channels/chan_zap.c (original)
+++ team/mattf/asterisk-ss7/channels/chan_zap.c Thu Jul 20 17:04:19 2006
@@ -2611,14 +2611,12 @@
 		if (p->ss7) {
 			if (p->ss7call) {
 				if (!ss7_grab(p, p->ss7)) {
-					if (p->alreadyhungup) {
-						ast_log(LOG_DEBUG, "Already hungup...  Calling hangup once, and clearing call\n");
-						isup_rlc(p->ss7->ss7, p->ss7call);
-						p->ss7call = NULL;
-					} else {
-						isup_rel(p->ss7->ss7, p->ss7call, 16);
-					}
-					ss7_rel(p->ss7);
+					if (!p->alreadyhungup) {
+						isup_rel(p->ss7->ss7, p->ss7call, ast->hangupcause ? ast->hangupcause : -1);
+						ss7_rel(p->ss7);
+						p->alreadyhungup = 1;
+					} else
+						ast_log(LOG_WARNING, "Trying to hangup twice!\n");
 				} else {
 					ast_log(LOG_WARNING, "Unable to grab SS7 on CIC %d\n", p->cic);
 					res = -1;
@@ -8188,6 +8186,14 @@
 				}
 				p = linkset->pvts[chanpos];
 				ast_mutex_lock(&p->lock);
+				if (p->owner)
+					ast_queue_hangup(p->owner);
+				else
+					ast_log(LOG_WARNING, "REL on channel (CIC %d) without owner!\n", p->cic);
+
+				isup_rlc(ss7, e->rel.call);
+
+#if 0
 				if (!p->alreadyhungup) {
 					p->alreadyhungup = 1;
 					p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
@@ -8198,6 +8204,7 @@
 					isup_rlc(ss7, e->rel.call);
 					p->ss7call = NULL;
 				}
+#endif
 				ast_mutex_unlock(&p->lock);
 				break;
 			case SS7_EVENT_ACM:
@@ -8238,6 +8245,16 @@
 				break;
 			case SS7_EVENT_RLC:
 				printf("Got RLC for cic %d\n", e->rlc.cic);
+				chanpos = ss7_find_cic(linkset, e->rlc.cic);
+				if (chanpos < 0) {
+					ast_log(LOG_WARNING, "RLC on unconfigured CIC %d\n", e->rlc.cic);
+					break;
+				} else {
+					p = linkset->pvts[chanpos];
+					ast_mutex_lock(&p->lock);
+					p->ss7call = NULL;
+					ast_mutex_unlock(&p->lock);
+				}
 				break;
 			default:
 				ast_log(LOG_DEBUG, "Unknown event %s\n", ss7_event2str(e->e));



More information about the asterisk-commits mailing list