Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 216171 | Differences between
and this patch

Collapse All | Expand All

(-)libpri-1.6.0-beta1.orig/libpri.h (+6 lines)
Lines 323-328 Link Here
323
	int progressmask;
323
	int progressmask;
324
	q931_call *call;
324
	q931_call *call;
325
	char useruserinfo[260];		/* User->User info */
325
	char useruserinfo[260];		/* User->User info */
326
	char calledname[256];
326
} pri_event_ringing;
327
} pri_event_ringing;
327
328
328
typedef struct pri_event_answer {
329
typedef struct pri_event_answer {
Lines 333-338 Link Here
333
	int progressmask;
334
	int progressmask;
334
	q931_call *call;
335
	q931_call *call;
335
	char useruserinfo[260];		/* User->User info */
336
	char useruserinfo[260];		/* User->User info */
337
	char calledname[256];
336
} pri_event_answer;
338
} pri_event_answer;
337
339
338
typedef struct pri_event_facname {
340
typedef struct pri_event_facname {
Lines 388-393 Link Here
388
	q931_call *call;			/* Opaque call pointer */
390
	q931_call *call;			/* Opaque call pointer */
389
	long aoc_units;				/* Advise of Charge number of charged units */
391
	long aoc_units;				/* Advise of Charge number of charged units */
390
	char useruserinfo[260];		/* User->User info */
392
	char useruserinfo[260];		/* User->User info */
393
	char calledname[256];
391
} pri_event_hangup;	
394
} pri_event_hangup;	
392
395
393
typedef struct pri_event_restart_ack {
396
typedef struct pri_event_restart_ack {
Lines 585-590 Link Here
585
588
586
void pri_call_set_useruser(q931_call *sr, const char *userchars);
589
void pri_call_set_useruser(q931_call *sr, const char *userchars);
587
590
591
/* Set the line called number, name and presentation */
592
void pri_call_set_called_name(q931_call *c, char *number, char *name, int pres);
593
588
int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);
594
int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);
589
595
590
/* Set a call has a call indpendent signalling connection (i.e. no bchan) */
596
/* Set a call has a call indpendent signalling connection (i.e. no bchan) */
(-)libpri-1.6.0-beta1.orig/pri.c (+6 lines)
Lines 267-272 Link Here
267
		libpri_copy_string(c->useruserinfo, userchars, sizeof(c->useruserinfo));
267
		libpri_copy_string(c->useruserinfo, userchars, sizeof(c->useruserinfo));
268
}
268
}
269
269
270
void pri_call_set_called_name(q931_call *c, char *number, char *name, int pres)
271
{
272
	if (name)
273
		libpri_copy_string(c->calledname, name, sizeof(c->calledname));
274
}
275
270
void pri_sr_set_useruser(struct pri_sr *sr, const char *userchars)
276
void pri_sr_set_useruser(struct pri_sr *sr, const char *userchars)
271
{
277
{
272
	sr->useruserinfo = userchars;
278
	sr->useruserinfo = userchars;
(-)libpri-1.6.0-beta1.orig/pri_facility.c (+107 lines)
Lines 1070-1075 Link Here
1070
}
1070
}
1071
/* End Callername */
1071
/* End Callername */
1072
1072
1073
/* Sending calledname information functions */
1074
static int add_calledname_facility_ies(struct pri *pri, q931_call *c,
1075
				       int state, int oper_id)
1076
{
1077
	int res = 0;
1078
	int i = 0;
1079
	unsigned char buffer[256];
1080
	unsigned char namelen = 0;
1081
	struct rose_component *comp = NULL, *compstk[10];
1082
	int compsp = 0;
1083
1084
	i = 0;
1085
	namelen = strlen(c->calledname);
1086
	if (namelen > 50)
1087
		namelen = 50; /* truncate the name */
1088
	if (namelen <= 0)
1089
		return -1;
1090
1091
	buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS);
1092
	/* Interpretation component */
1093
1094
	if (pri->switchtype == PRI_SWITCH_QSIG) {
1095
		ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer, i);
1096
		ASN1_PUSH(compstk, compsp, comp);
1097
		ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer, i, 0);
1098
		ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0);
1099
		ASN1_FIXUP(compstk, compsp, buffer, i);
1100
	}
1101
1102
	ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer, i, 0);
1103
1104
	ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i);
1105
	ASN1_PUSH(compstk, compsp, comp);
1106
1107
	/* Invoke ID */
1108
	ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, get_invokeid(pri));
1109
1110
	/* Operation ID: Called name */
1111
	ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, oper_id);
1112
1113
	res = asn1_string_encode((ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), &buffer[i], sizeof(buffer)-i,  50, c->calledname, namelen);
1114
	if (res < 0)
1115
		return -1;
1116
	i += res;
1117
	ASN1_FIXUP(compstk, compsp, buffer, i);
1118
1119
	if (pri_call_apdu_queue(c, state, buffer, i, NULL, NULL))
1120
		return -1;
1121
1122
	return 0;
1123
}
1124
/* End Calledname */
1125
1073
/* MWI related encode and decode functions */
1126
/* MWI related encode and decode functions */
1074
static void mwi_activate_encode_cb(void *data)
1127
static void mwi_activate_encode_cb(void *data)
1075
{
1128
{
Lines 2217-2222 Link Here
2217
					return -1;
2270
					return -1;
2218
			}
2271
			}
2219
			break;
2272
			break;
2273
		case SS_CNID_CALLEDNAME:
2274
		case SS_CNID_CONNECTEDNAME:
2275
		case SS_CNID_BUSYNAME:
2276
			if (pri->debug & PRI_DEBUG_APDU)
2277
				pri_message(pri, "  Handle Called name display operation\n");
2278
			switch (comp->type) {
2279
				case ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE:
2280
					memcpy(call->calledname, comp->data, comp->len);
2281
					call->calledname[comp->len] = 0;
2282
					if (pri->debug & PRI_DEBUG_APDU)
2283
						pri_message(pri, "    Received called name '%s'\n", call->calledname);
2284
					return 0;
2285
				default:
2286
					if (pri->debug & PRI_DEBUG_APDU)
2287
						pri_message(pri, "Do not handle argument of type 0x%X\n", comp->type);
2288
					return -1;
2289
			}
2290
			break;
2220
		case ROSE_CALL_TRANSFER_IDENTIFY:
2291
		case ROSE_CALL_TRANSFER_IDENTIFY:
2221
			if (pri->debug & PRI_DEBUG_APDU)
2292
			if (pri->debug & PRI_DEBUG_APDU)
2222
				pri_message(pri, "ROSE %i:   CallTransferIdentify - not handled!\n", operation_tag);
2293
				pri_message(pri, "ROSE %i:   CallTransferIdentify - not handled!\n", operation_tag);
Lines 2431-2433 Link Here
2431
	return 0;
2502
	return 0;
2432
}
2503
}
2433
2504
2505
int pri_call_add_alerting_apdus(struct pri *pri, q931_call *call)
2506
{
2507
	if (!pri->sendfacility)
2508
		return 0;
2509
2510
	if (pri->switchtype == PRI_SWITCH_QSIG)
2511
		add_calledname_facility_ies(pri, call, Q931_ALERTING,
2512
					    SS_CNID_CALLEDNAME);
2513
2514
	return 0;
2515
}
2516
2517
int pri_call_add_connect_apdus(struct pri *pri, q931_call *call)
2518
{
2519
	if (!pri->sendfacility)
2520
		return 0;
2521
2522
	if (pri->switchtype == PRI_SWITCH_QSIG)
2523
		add_calledname_facility_ies(pri, call, Q931_CONNECT,
2524
					    SS_CNID_CONNECTEDNAME);
2525
2526
	return 0;
2527
}
2528
2529
int pri_call_add_busy_apdus(struct pri *pri, q931_call *call)
2530
{
2531
	if (!pri->sendfacility)
2532
		return 0;
2533
2534
	if (pri->switchtype == PRI_SWITCH_QSIG)
2535
		add_calledname_facility_ies(pri, call, Q931_DISCONNECT,
2536
					    SS_CNID_BUSYNAME);
2537
2538
	return 0;
2539
}
2540
(-)libpri-1.6.0-beta1.orig/pri_facility.h (-1 / +13 lines)
Lines 58-64 Link Here
58
#define ROSE_AOC_IDENTIFICATION_OF_CHARGE	37
58
#define ROSE_AOC_IDENTIFICATION_OF_CHARGE	37
59
/* Q.SIG operations */
59
/* Q.SIG operations */
60
#define SS_CNID_CALLINGNAME					0
60
#define SS_CNID_CALLINGNAME					0
61
#define SS_ANFPR_PATHREPLACEMENT                                4
61
#define SS_CNID_CALLEDNAME					1
62
#define SS_CNID_CONNECTEDNAME					2
63
#define SS_CNID_BUSYNAME					3
64
#define SS_ANFPR_PATHREPLACEMENT				4
62
#define SS_DIVERTING_LEG_INFORMATION2		21
65
#define SS_DIVERTING_LEG_INFORMATION2		21
63
#define SS_MWI_ACTIVATE						80
66
#define SS_MWI_ACTIVATE						80
64
#define SS_MWI_DEACTIVATE					81
67
#define SS_MWI_DEACTIVATE					81
Lines 300-305 Link Here
300
/* Adds the "standard" APDUs to a call */
303
/* Adds the "standard" APDUs to a call */
301
int pri_call_add_standard_apdus(struct pri *pri, q931_call *call);
304
int pri_call_add_standard_apdus(struct pri *pri, q931_call *call);
302
305
306
/* Adds the "alerting" state APDUs to a call */
307
int pri_call_add_alerting_apdus(struct pri *pri, q931_call *call);
308
309
/* Adds the "connected" state APDUs to a call */
310
int pri_call_add_connect_apdus(struct pri *pri, q931_call *call);
311
312
/* Adds the "busy" state APDUs to a call */
313
int pri_call_add_busy_apdus(struct pri *pri, q931_call *call);
314
303
int asn1_dump(struct pri *pri, void *comp, int len);
315
int asn1_dump(struct pri *pri, void *comp, int len);
304
316
305
#endif /* _PRI_FACILITY_H */
317
#endif /* _PRI_FACILITY_H */
(-)libpri-1.6.0-beta1.orig/pri_internal.h (+1 lines)
Lines 223-228 Link Here
223
	int calledplan;
223
	int calledplan;
224
	int nonisdn;
224
	int nonisdn;
225
	char callednum[256];	/* Called Number */
225
	char callednum[256];	/* Called Number */
226
	char calledname[256];	/* Called Name */
226
	int complete;			/* no more digits coming */
227
	int complete;			/* no more digits coming */
227
	int newcall;			/* if the received message has a new call reference value */
228
	int newcall;			/* if the received message has a new call reference value */
228
229
(-)libpri-1.6.0-beta1.orig/q931.c (-5 / +19 lines)
Lines 53-59 Link Here
53
	{ Q931_PROGRESS, "PROGRESS", { Q931_PROGRESS_INDICATOR } },
53
	{ Q931_PROGRESS, "PROGRESS", { Q931_PROGRESS_INDICATOR } },
54
	{ Q931_SETUP, "SETUP", { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT } },
54
	{ Q931_SETUP, "SETUP", { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT } },
55
	{ Q931_SETUP_ACKNOWLEDGE, "SETUP ACKNOWLEDGE" },
55
	{ Q931_SETUP_ACKNOWLEDGE, "SETUP ACKNOWLEDGE" },
56
	
56
57
	/* Call disestablishment messages */
57
	/* Call disestablishment messages */
58
	{ Q931_DISCONNECT, "DISCONNECT", { Q931_CAUSE } },
58
	{ Q931_DISCONNECT, "DISCONNECT", { Q931_CAUSE } },
59
	{ Q931_RELEASE, "RELEASE" },
59
	{ Q931_RELEASE, "RELEASE" },
Lines 2779-2787 Link Here
2779
	return send_message(pri, c, Q931_CALL_PROCEEDING, call_proceeding_ies);
2779
	return send_message(pri, c, Q931_CALL_PROCEEDING, call_proceeding_ies);
2780
}
2780
}
2781
#ifndef ALERTING_NO_PROGRESS
2781
#ifndef ALERTING_NO_PROGRESS
2782
static int alerting_ies[] = { Q931_PROGRESS_INDICATOR, Q931_IE_USER_USER,  -1 };
2782
static int alerting_ies[] = { Q931_PROGRESS_INDICATOR, Q931_IE_FACILITY,
2783
			      Q931_IE_USER_USER,  -1 };
2783
#else
2784
#else
2784
static int alerting_ies[] = { -1 };
2785
static int alerting_ies[] = { Q931_IE_FACILITY, -1 };
2785
#endif
2786
#endif
2786
2787
2787
int q931_alerting(struct pri *pri, q931_call *c, int channel, int info)
2788
int q931_alerting(struct pri *pri, q931_call *c, int channel, int info)
Lines 2797-2806 Link Here
2797
	UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CALL_RECEIVED);
2798
	UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CALL_RECEIVED);
2798
	c->peercallstate = Q931_CALL_STATE_CALL_DELIVERED;
2799
	c->peercallstate = Q931_CALL_STATE_CALL_DELIVERED;
2799
	c->alive = 1;
2800
	c->alive = 1;
2801
	pri_call_add_alerting_apdus(pri, c);
2800
	return send_message(pri, c, Q931_ALERTING, alerting_ies);
2802
	return send_message(pri, c, Q931_ALERTING, alerting_ies);
2801
}
2803
}
2802
2804
2803
static int connect_ies[] = {  Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 };
2805
static int connect_ies[] = {  Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR,
2806
			      Q931_IE_FACILITY, -1 };
2804
 
2807
 
2805
int q931_setup_ack(struct pri *pri, q931_call *c, int channel, int nonisdn)
2808
int q931_setup_ack(struct pri *pri, q931_call *c, int channel, int nonisdn)
2806
{
2809
{
Lines 2910-2915 Link Here
2910
	c->retranstimer = 0;
2913
	c->retranstimer = 0;
2911
	if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (pri->bri || (!pri->subchannel)))
2914
	if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (pri->bri || (!pri->subchannel)))
2912
		c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T313], pri_connect_timeout, c);
2915
		c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T313], pri_connect_timeout, c);
2916
	pri_call_add_connect_apdus(pri, c);
2913
	return send_message(pri, c, Q931_CONNECT, connect_ies);
2917
	return send_message(pri, c, Q931_CONNECT, connect_ies);
2914
}
2918
}
2915
2919
Lines 2961-2967 Link Here
2961
	return send_message(pri, c, Q931_RESTART, restart_ies);
2965
	return send_message(pri, c, Q931_RESTART, restart_ies);
2962
}
2966
}
2963
2967
2964
static int disconnect_ies[] = { Q931_CAUSE, Q931_IE_USER_USER, -1 };
2968
static int disconnect_ies[] = { Q931_CAUSE, Q931_IE_FACILITY, Q931_IE_USER_USER, -1 };
2965
2969
2966
int q931_disconnect(struct pri *pri, q931_call *c, int cause)
2970
int q931_disconnect(struct pri *pri, q931_call *c, int cause)
2967
{
2971
{
Lines 2976-2981 Link Here
2976
		if (c->retranstimer)
2980
		if (c->retranstimer)
2977
			pri_schedule_del(pri, c->retranstimer);
2981
			pri_schedule_del(pri, c->retranstimer);
2978
		c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T305], pri_disconnect_timeout, c);
2982
		c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T305], pri_disconnect_timeout, c);
2983
		if (cause == PRI_CAUSE_USER_BUSY)
2984
			pri_call_add_busy_apdus(pri, c);
2979
		return send_message(pri, c, Q931_DISCONNECT, disconnect_ies);
2985
		return send_message(pri, c, Q931_DISCONNECT, disconnect_ies);
2980
	} else
2986
	} else
2981
		return 0;
2987
		return 0;
Lines 3292-3297 Link Here
3292
		c->callerpres = -1;
3298
		c->callerpres = -1;
3293
		c->callernum[0] = '\0';
3299
		c->callernum[0] = '\0';
3294
		c->callednum[0] = '\0';
3300
		c->callednum[0] = '\0';
3301
		c->calledname[0] = '\0';
3295
		c->callername[0] = '\0';
3302
		c->callername[0] = '\0';
3296
		c->callerani[0] = '\0';
3303
		c->callerani[0] = '\0';
3297
		c->callerplanani = -1;
3304
		c->callerplanani = -1;
Lines 3556-3561 Link Here
3556
		pri->ev.ringing.progressmask = c->progressmask;
3563
		pri->ev.ringing.progressmask = c->progressmask;
3557
		libpri_copy_string(pri->ev.ringing.useruserinfo, c->useruserinfo, sizeof(pri->ev.ringing.useruserinfo));
3564
		libpri_copy_string(pri->ev.ringing.useruserinfo, c->useruserinfo, sizeof(pri->ev.ringing.useruserinfo));
3558
		c->useruserinfo[0] = '\0';
3565
		c->useruserinfo[0] = '\0';
3566
		libpri_copy_string(pri->ev.ringing.calledname, c->calledname, sizeof(pri->ev.ringing.calledname));
3567
		c->calledname[0] = '\0';
3559
3568
3560
		cur = c->apdus;
3569
		cur = c->apdus;
3561
		while (cur) {
3570
		while (cur) {
Lines 3586-3591 Link Here
3586
		pri->ev.answer.progressmask = c->progressmask;
3595
		pri->ev.answer.progressmask = c->progressmask;
3587
		libpri_copy_string(pri->ev.answer.useruserinfo, c->useruserinfo, sizeof(pri->ev.answer.useruserinfo));
3596
		libpri_copy_string(pri->ev.answer.useruserinfo, c->useruserinfo, sizeof(pri->ev.answer.useruserinfo));
3588
		c->useruserinfo[0] = '\0';
3597
		c->useruserinfo[0] = '\0';
3598
		libpri_copy_string(pri->ev.answer.calledname, c->calledname, sizeof(pri->ev.answer.calledname));
3599
		c->calledname[0] = '\0';
3589
		q931_connect_acknowledge(pri, c);
3600
		q931_connect_acknowledge(pri, c);
3590
		if (c->justsignalling) {  /* Make sure WE release when we initiatie a signalling only connection */
3601
		if (c->justsignalling) {  /* Make sure WE release when we initiatie a signalling only connection */
3591
			q931_release(pri, c, PRI_CAUSE_NORMAL_CLEARING);
3602
			q931_release(pri, c, PRI_CAUSE_NORMAL_CLEARING);
Lines 3752-3757 Link Here
3752
		pri->ev.hangup.aoc_units = c->aoc_units;
3763
		pri->ev.hangup.aoc_units = c->aoc_units;
3753
		libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
3764
		libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
3754
		c->useruserinfo[0] = '\0';
3765
		c->useruserinfo[0] = '\0';
3766
		pri->ev.hangup.calledname[0] = '\0';
3755
		/* Don't send release complete if they send us release 
3767
		/* Don't send release complete if they send us release 
3756
		   while we sent it, assume a NULL state */
3768
		   while we sent it, assume a NULL state */
3757
		if (c->newcall)
3769
		if (c->newcall)
Lines 3786-3791 Link Here
3786
		pri->ev.hangup.aoc_units = c->aoc_units;
3798
		pri->ev.hangup.aoc_units = c->aoc_units;
3787
		libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
3799
		libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
3788
		c->useruserinfo[0] = '\0';
3800
		c->useruserinfo[0] = '\0';
3801
		libpri_copy_string(pri->ev.hangup.calledname, c->calledname, sizeof(pri->ev.hangup.calledname));
3802
		c->calledname[0] = '\0';
3789
		if (c->alive)
3803
		if (c->alive)
3790
			return Q931_RES_HAVEEVENT;
3804
			return Q931_RES_HAVEEVENT;
3791
		else
3805
		else

Return to bug 216171