[libpri-commits] rmudgett: branch group/issue14068 r685 - /team/group/issue14068/

SVN commits to the libpri project libpri-commits at lists.digium.com
Fri Jan 30 16:14:59 CST 2009


Author: rmudgett
Date: Fri Jan 30 16:14:58 2009
New Revision: 685

URL: http://svn.digium.com/svn-view/libpri?view=rev&rev=685
Log:
Applied patch to work in progress branch libpri/team/group/issue14068.

(issue #14068)
Reported by: nreinartz
Patches:
      libpri-issue14068-2009-01-30-colpconp-0.1.5.patch uploaded by nreinartz (license 452)

Modified:
    team/group/issue14068/pri.c
    team/group/issue14068/pri_facility.c
    team/group/issue14068/pri_facility.h
    team/group/issue14068/q931.c

Modified: team/group/issue14068/pri.c
URL: http://svn.digium.com/svn-view/libpri/team/group/issue14068/pri.c?view=diff&rev=685&r1=684&r2=685
==============================================================================
--- team/group/issue14068/pri.c (original)
+++ team/group/issue14068/pri.c Fri Jan 30 16:14:58 2009
@@ -566,8 +566,8 @@
 	if (pri->switchtype == PRI_SWITCH_QSIG) {
 		switch (call->ourcallstate) {
 		case Q931_CALL_STATE_ACTIVE:
-			/* immediately send callTransferComplete APDU */
-			qsig_initiate_call_transfer_complete(pri, call);
+			/* immediately send callTransferComplete APDU, callStatus=answered(0) */
+			qsig_initiate_call_transfer_complete(pri, call, 0);
 			break;
 		case Q931_CALL_STATE_OVERLAP_RECEIVING:
 		case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING:
@@ -649,17 +649,29 @@
 	call->divertedtoreason = redirecting->reason;
 
 	if (pri->switchtype == PRI_SWITCH_QSIG) {
-		call->divertedstate = DIVERTEDSTATE_DIVERTED;
-
-		if (call->divertedtonum[0]) {
-			/* immediately send divertingLegInformation1 APDU */
-			qsig_initiate_diverting_leg_information1(pri, call);
-			call->divertedstate = DIVERTEDSTATE_DIVLEGINFO1SEND;
-		}
-		if ((call->divertedstate == DIVERTEDSTATE_DIVLEGINFO1SEND) && call->divertedtoname[0]) {
-			/* queue divertingLegInformation3 to be send with next Q931_ALERTING */
-			rose_diverting_leg_information3_encode(pri, call, Q931_ALERTING);
-			call->divertedstate = DIVERTEDSTATE_DIVLEGINFO3SEND;
+		switch (call->ourcallstate) {
+		case Q931_CALL_STATE_ACTIVE:
+			/* immediately send callTransferComplete APDU, callStatus=alerting(1) */
+			qsig_initiate_call_transfer_complete(pri, call, 1);
+			break;
+		case Q931_CALL_STATE_OVERLAP_RECEIVING:
+		case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING:
+			call->divertedstate = DIVERTEDSTATE_DIVERTED;
+
+			if (call->divertedtonum[0]) {
+				/* immediately send divertingLegInformation1 APDU */
+				qsig_initiate_diverting_leg_information1(pri, call);
+				call->divertedstate = DIVERTEDSTATE_DIVLEGINFO1SEND;
+			}
+			if ((call->divertedstate == DIVERTEDSTATE_DIVLEGINFO1SEND) && call->divertedtoname[0]) {
+				/* queue divertingLegInformation3 to be send with next Q931_ALERTING */
+				rose_diverting_leg_information3_encode(pri, call, Q931_ALERTING);
+				call->divertedstate = DIVERTEDSTATE_DIVLEGINFO3SEND;
+			}
+			break;
+		default:
+			pri_message(pri, "Redirecting update in state %d\n", call->ourcallstate);
+			break;
 		}
 	}
 

Modified: team/group/issue14068/pri_facility.c
URL: http://svn.digium.com/svn-view/libpri/team/group/issue14068/pri_facility.c?view=diff&rev=685&r1=684&r2=685
==============================================================================
--- team/group/issue14068/pri_facility.c (original)
+++ team/group/issue14068/pri_facility.c Fri Jan 30 16:14:58 2009
@@ -3056,7 +3056,7 @@
 	return -1;
 }
 
-static int rose_call_transfer_complete_encode(struct pri *pri, q931_call *call)
+static int rose_call_transfer_complete_encode(struct pri *pri, q931_call *call, int call_status)
 {
 	int i = 0, compsp = 0;
 	struct rose_component *comp, *compstk[10];
@@ -3150,13 +3150,17 @@
 		ASN1_FIXUP(compstk, compsp, buffer, i);
 	}
 
-	/* callStatus */
-	/*  - not included, default: answered(0) -  */
-
+	if (call_status) {
+		/* callStatus  (0x0a,0x01,0x01) */
+		ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 1);		/* alerting(1) */
+	} else {
+		/* callStatus */
+		/*  - not included, default: answered(0) -  */
 #if 0
-	/* callStatus  (0x0a,0x01,0x00) */
-	ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 0);		/* answered(0) */
+		/* callStatus  (0x0a,0x01,0x00) */
+		ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 0);		/* answered(0) */
 #endif
+	}
 
 	ASN1_FIXUP(compstk, compsp, buffer, i);
 	ASN1_FIXUP(compstk, compsp, buffer, i);
@@ -4155,9 +4159,9 @@
 	return 0;
 }
 
-int qsig_initiate_call_transfer_complete(struct pri *pri, q931_call *call)
-{
-	rose_call_transfer_complete_encode(pri, call);
+int qsig_initiate_call_transfer_complete(struct pri *pri, q931_call *call, int call_status)
+{
+	rose_call_transfer_complete_encode(pri, call, call_status);
 
 	if (q931_facility(pri, call)) {
 		pri_message(pri, "Could not schedule facility message for callTransferComplete\n");

Modified: team/group/issue14068/pri_facility.h
URL: http://svn.digium.com/svn-view/libpri/team/group/issue14068/pri_facility.h?view=diff&rev=685&r1=684&r2=685
==============================================================================
--- team/group/issue14068/pri_facility.h (original)
+++ team/group/issue14068/pri_facility.h Fri Jan 30 16:14:58 2009
@@ -328,7 +328,7 @@
 
 int qsig_initiate_diverting_leg_information1(struct pri *pri, q931_call *call);
 
-int qsig_initiate_call_transfer_complete(struct pri *pri, q931_call *call);
+int qsig_initiate_call_transfer_complete(struct pri *pri, q931_call *call, int call_status);
 
 int rose_diverting_leg_information1_encode(struct pri *pri, q931_call *call);
 

Modified: team/group/issue14068/q931.c
URL: http://svn.digium.com/svn-view/libpri/team/group/issue14068/q931.c?view=diff&rev=685&r1=684&r2=685
==============================================================================
--- team/group/issue14068/q931.c (original)
+++ team/group/issue14068/q931.c Fri Jan 30 16:14:58 2009
@@ -3116,8 +3116,11 @@
 		c->callerpres = PRES_NUMBER_NOT_AVAILABLE;
 	}
 	if (req->redirectingnum) {
-		libpri_copy_string(c->redirectingname, req->redirectingname, sizeof(c->redirectingname));
 		libpri_copy_string(c->redirectingnum, req->redirectingnum, sizeof(c->redirectingnum));
+		if (req->redirectingname)
+			libpri_copy_string(c->redirectingname, req->redirectingname, sizeof(c->redirectingname));
+		else
+			c->redirectingname[0] = '\0';
 		c->redirectingplan = req->redirectingplan;
 		if ((pri->switchtype == PRI_SWITCH_DMS100) ||
 		    (pri->switchtype == PRI_SWITCH_ATT4ESS)) {
@@ -3682,7 +3685,7 @@
 			pri->ev.ringing.calledplan = c->divertedtoplan;
 		} else {
 			libpri_copy_string(pri->ev.ringing.calledname, c->calledname, sizeof(pri->ev.ringing.calledname));
-			libpri_copy_string(pri->ev.ringing.callednum, c->callednum, sizeof(pri->ev.ringing.callednum));
+			libpri_copy_string(pri->ev.ringing.callednum, (c->divertedtonum[0]) ? c->divertedtonum : c->callednum, sizeof(pri->ev.ringing.callednum));
 			pri->ev.ringing.calledpres = PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
 			pri->ev.ringing.calledplan = c->calledplan;
 		}




More information about the libpri-commits mailing list