[Asterisk-code-review] chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up (...asterisk[13])

Joshua Colp asteriskteam at digium.com
Wed Sep 11 07:09:34 CDT 2019


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/12857 )

Change subject: chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up
......................................................................

chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up

When the remote ISDN party ends an ISDN call on a PRI link
(DISCONNECT), CHANNEL(hangupsource) information is not available.

chan_dahdi already contains an ast_set_hangupsource() in
__dahdi_exception() function but it seems that ISDN message processing
does not use this part of code.

Two other channel modules associate ast_queue_hangup() and
ast_set_hangupsource() functions calls:
- chan_pjsip in chan_pjsip_session_end() function,
- chan_sip in sip_queue_hangup_cause() function.
chan_iax2 separates them, in iax2_queue_hangup()/iax2_destroy() and
set_hangup_source_and_cause().

Thus, I propose to add ast_set_hangupsource() beside
ast_queue_hangup() in sig_pri_queue_hangup(), like chan_pjsip and
chan_sip already do.

ASTERISK-28525

Change-Id: I0f588a4bcf15ccd0648fd69830d1b801c3f21b7c
---
M channels/sig_pri.c
1 file changed, 14 insertions(+), 3 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index ecf160d..37b494e 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -1391,14 +1391,25 @@
  */
 static void sig_pri_queue_hangup(struct sig_pri_span *pri, int chanpos)
 {
+	struct ast_channel *owner;
+
 	if (sig_pri_callbacks.queue_control) {
 		sig_pri_callbacks.queue_control(pri->pvts[chanpos]->chan_pvt, AST_CONTROL_HANGUP);
 	}
 
 	sig_pri_lock_owner(pri, chanpos);
-	if (pri->pvts[chanpos]->owner) {
-		ast_queue_hangup(pri->pvts[chanpos]->owner);
-		ast_channel_unlock(pri->pvts[chanpos]->owner);
+	owner = pri->pvts[chanpos]->owner;
+	if (owner) {
+		ao2_ref(owner, +1);
+		ast_queue_hangup(owner);
+		ast_channel_unlock(owner);
+
+		/* Tell the CDR this DAHDI channel hung up */
+		sig_pri_unlock_private(pri->pvts[chanpos]);
+		ast_set_hangupsource(owner, ast_channel_name(owner), 0);
+		sig_pri_lock_private(pri->pvts[chanpos]);
+
+		ao2_ref(owner, -1);
 	}
 }
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12857
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I0f588a4bcf15ccd0648fd69830d1b801c3f21b7c
Gerrit-Change-Number: 12857
Gerrit-PatchSet: 1
Gerrit-Owner: Frederic LE FOLL <frederic.lefoll at c-s.fr>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190911/fde8eae5/attachment.html>


More information about the asterisk-code-review mailing list