Review Board 1.7.16


Add call transfer exchange of subaddresses support and fix PTMP call transfer signaling.

Review Request #1051 - Created Dec. 8, 2010 and submitted

rmudgett
1.4
Reviewers
asterisk-dev
alecdavis
LibPRI
Add call transfer exchange of subaddresses support.

* Add the ability to exchange subaddresses for ETSI PTMP, ETSI PTP, and
Q.SIG.

* Fix ETSI PTMP to send the correct messages depending on the call state.

JIRA LIBPRI-47
JIRA SWP-2363


Alec, could you give this patch some real line testing?  Thanks.
Transfered calls with:
1) Q.SIG
2) ETSI PTP
3) ETSI PTMP while call ringing.
4) ETSI PTMP after call answered.
/branches/1.4/pri.c
Revision 2161 New Change
[20] 946 lines
[+20] [+] void pri_copy_party_id_to_q931(struct q931_party_id *q931_id, const struct pri_party_id *pri_id)
947

    
   
947

   
948
int pri_connected_line_update(struct pri *ctrl, q931_call *call, const struct pri_party_connected_line *connected)
948
int pri_connected_line_update(struct pri *ctrl, q931_call *call, const struct pri_party_connected_line *connected)
949
{
949
{
950
	struct q931_party_id party_id;
950
	struct q931_party_id party_id;
951
	unsigned idx;
951
	unsigned idx;

    
   
952
	unsigned new_name;

    
   
953
	unsigned new_number;

    
   
954
	unsigned new_subaddress;
952
	struct q931_call *subcall;
955
	struct q931_call *subcall;
953

    
   
956

   
954
	if (!ctrl || !pri_is_call_valid(ctrl, call)) {
957
	if (!ctrl || !pri_is_call_valid(ctrl, call)) {
955
		return -1;
958
		return -1;
956
	}
959
	}
957

    
   
960

   
958
	pri_copy_party_id_to_q931(&party_id, &connected->id);
961
	pri_copy_party_id_to_q931(&party_id, &connected->id);
959
	q931_party_id_fixup(ctrl, &party_id);
962
	q931_party_id_fixup(ctrl, &party_id);
960
	if (!q931_party_id_cmp(&party_id, &call->local_id)) {

   
961
		/* The local party information did not change so do nothing. */

   
962
		return 0;

   
963
	}

   
964
	call->local_id = party_id;

   
965

    
   
963

   
966
	/* Update all subcalls with new local_id. */
964
	new_name = q931_party_name_cmp(&party_id.name, &call->local_id.name);

    
   
965
	new_number = q931_party_number_cmp(&party_id.number, &call->local_id.number);

    
   
966
	new_subaddress = party_id.subaddress.valid

    
   
967
		&& q931_party_subaddress_cmp(&party_id.subaddress, &call->local_id.subaddress);

    
   
968

   

    
   
969
	/* Update the call and all subcalls with new local_id. */

    
   
970
	call->local_id = party_id;
967
	if (call->outboundbroadcast && call->master_call == call) {
971
	if (call->outboundbroadcast && call->master_call == call) {
968
		for (idx = 0; idx < ARRAY_LEN(call->subcalls); ++idx) {
972
		for (idx = 0; idx < ARRAY_LEN(call->subcalls); ++idx) {
969
			subcall = call->subcalls[idx];
973
			subcall = call->subcalls[idx];
970
			if (subcall) {
974
			if (subcall) {
971
				subcall->local_id = party_id;
975
				subcall->local_id = party_id;
[+20] [20] 8 lines
[+20] int pri_connected_line_update(struct pri *ctrl, q931_call *call, const struct pri_party_connected_line *connected)
980
	case Q931_CALL_STATE_CALL_DELIVERED:
984
	case Q931_CALL_STATE_CALL_DELIVERED:
981
		/*
985
		/*
982
		 * The local party transferred to someone else before
986
		 * The local party transferred to someone else before
983
		 * the remote end answered.
987
		 * the remote end answered.
984
		 */
988
		 */
985
	case Q931_CALL_STATE_ACTIVE:

   
986
		switch (ctrl->switchtype) {
989
		switch (ctrl->switchtype) {
987
		case PRI_SWITCH_EUROISDN_E1:
990
		case PRI_SWITCH_EUROISDN_E1:
988
		case PRI_SWITCH_EUROISDN_T1:
991
		case PRI_SWITCH_EUROISDN_T1:
989
			if (PTMP_MODE(ctrl)) {
992
			if (BRI_NT_PTMP(ctrl)) {
990
				/* PTMP mode */
993
				/*

    
   
994
				 * NT PTMP mode

    
   
995
				 *

    
   
996
				 * We should not send these messages to the network if we are

    
   
997
				 * the CPE side since phones do not transfer calls within

    
   
998
				 * themselves.  Well... If you consider handing the handset to

    
   
999
				 * someone else a transfer then how is the network to know?

    
   
1000
				 */

    
   
1001
				if (new_number) {
991
				q931_notify_redirection(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,
1002
					q931_notify_redirection(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,
992
					&call->local_id.number);
1003
						&party_id.number);
993
			} else {
1004
				}

    
   
1005
				if (new_subaddress || (party_id.subaddress.valid && new_number)) {

    
   
1006
					q931_subaddress_transfer(ctrl, call);

    
   
1007
				}

    
   
1008
			} else if (PTP_MODE(ctrl)) {

    
   
1009
				/* PTP mode */

    
   
1010
				if (new_number) {

    
   
1011
					/* Immediately send EctInform APDU, callStatus=answered(0) */

    
   
1012
					send_call_transfer_complete(ctrl, call, 0);

    
   
1013
				}

    
   
1014
				if (new_subaddress || (party_id.subaddress.valid && new_number)) {

    
   
1015
					q931_subaddress_transfer(ctrl, call);

    
   
1016
				}

    
   
1017
			}

    
   
1018
			break;

    
   
1019
		case PRI_SWITCH_QSIG:

    
   
1020
			if (new_name || new_number) {

    
   
1021
				/* Immediately send CallTransferComplete APDU, callStatus=answered(0) */

    
   
1022
				send_call_transfer_complete(ctrl, call, 0);

    
   
1023
			}

    
   
1024
			if (new_subaddress

    
   
1025
				|| (party_id.subaddress.valid && (new_name || new_number))) {

    
   
1026
				q931_subaddress_transfer(ctrl, call);

    
   
1027
			}

    
   
1028
			break;

    
   
1029
		default:

    
   
1030
			break;

    
   
1031
		}

    
   
1032
		break;

    
   
1033
	case Q931_CALL_STATE_ACTIVE:

    
   
1034
		switch (ctrl->switchtype) {

    
   
1035
		case PRI_SWITCH_EUROISDN_E1:

    
   
1036
		case PRI_SWITCH_EUROISDN_T1:

    
   
1037
			if (BRI_NT_PTMP(ctrl)) {

    
   
1038
				/*

    
   
1039
				 * NT PTMP mode

    
   
1040
				 *

    
   
1041
				 * We should not send these messages to the network if we are

    
   
1042
				 * the CPE side since phones do not transfer calls within

    
   
1043
				 * themselves.  Well... If you consider handing the handset to

    
   
1044
				 * someone else a transfer then how is the network to know?

    
   
1045
				 */

    
   
1046
				if (new_number) {

    
   
1047
					q931_request_subaddress(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,

    
   
1048
						&party_id.number);

    
   
1049
				}

    
   
1050
				if (new_subaddress || (party_id.subaddress.valid && new_number)) {

    
   
1051
					q931_subaddress_transfer(ctrl, call);

    
   
1052
				}

    
   
1053
			} else if (PTP_MODE(ctrl)) {
994
				/* PTP mode */
1054
				/* PTP mode */

    
   
1055
				if (new_number) {
995
				/* Immediately send EctInform APDU, callStatus=answered(0) */
1056
					/* Immediately send EctInform APDU, callStatus=answered(0) */
996
				send_call_transfer_complete(ctrl, call, 0);
1057
					send_call_transfer_complete(ctrl, call, 0);
997
			}
1058
				}

    
   
1059
				if (new_subaddress || (party_id.subaddress.valid && new_number)) {

    
   
1060
					q931_subaddress_transfer(ctrl, call);

    
   
1061
				}

    
   
1062
			}
998
			break;
1063
			break;
999
		case PRI_SWITCH_QSIG:
1064
		case PRI_SWITCH_QSIG:

    
   
1065
			if (new_name || new_number) {
1000
			/* Immediately send CallTransferComplete APDU, callStatus=answered(0) */
1066
				/* Immediately send CallTransferComplete APDU, callStatus=answered(0) */
1001
			send_call_transfer_complete(ctrl, call, 0);
1067
				send_call_transfer_complete(ctrl, call, 0);

    
   
1068
			}

    
   
1069
			if (new_subaddress

    
   
1070
				|| (party_id.subaddress.valid && (new_name || new_number))) {

    
   
1071
				q931_subaddress_transfer(ctrl, call);

    
   
1072
			}
1002
			break;
1073
			break;
1003
		default:
1074
		default:
1004
			break;
1075
			break;
1005
		}
1076
		}
1006
		break;
1077
		break;
[+20] [20] 961 lines
/branches/1.4/pri_facility.h
Revision 2161 New Change
 
/branches/1.4/pri_facility.c
Revision 2161 New Change
 
/branches/1.4/pri_internal.h
Revision 2161 New Change
 
/branches/1.4/q931.c
Revision 2161 New Change
 
  1. /branches/1.4/pri.c: Loading...
  2. /branches/1.4/pri_facility.h: Loading...
  3. /branches/1.4/pri_facility.c: Loading...
  4. /branches/1.4/pri_internal.h: Loading...
  5. /branches/1.4/q931.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.