[Pkg-voip-commits] r1877 - in libpri/trunk/debian: . patches

Mark Purcell msp at costa.debian.org
Wed Jun 14 02:14:53 UTC 2006


Author: msp
Date: 2006-06-14 02:14:52 +0000 (Wed, 14 Jun 2006)
New Revision: 1877

Modified:
   libpri/trunk/debian/changelog
   libpri/trunk/debian/patches/bristuff.dpatch
Log:
* Cleanup bristuff.dpatch for Upstream 1.2.3. 

Modified: libpri/trunk/debian/changelog
===================================================================
--- libpri/trunk/debian/changelog	2006-06-14 01:12:47 UTC (rev 1876)
+++ libpri/trunk/debian/changelog	2006-06-14 02:14:52 UTC (rev 1877)
@@ -1,6 +1,5 @@
-libpri (1.2.3-1) UNRELEASED; urgency=low
+libpri (1.2.3-1) unstable; urgency=low
 
-  * NOT RELEASED YET
   * New upstream release.
 
   [ Tzafrir Cohen ]
@@ -8,8 +7,11 @@
   * Makefile.dpatch: Remove unused fix from patches
   * bristuff 0.3.0-PRE1p
 
- -- Kilian Krause <kilian at debian.org>  Sat, 10 Jun 2006 15:10:53 +0200
+  [ Mark Purcell ]
+  * Cleanup bristuff.dpatch for Upstream 1.2.3. 
 
+ -- Mark Purcell <msp at debian.org>  Wed, 14 Jun 2006 12:11:36 +1000
+
 libpri (1.2.2-3) unstable; urgency=low
 
   * Use CURDIR rather than PWD to make sure we can build with sudo.

Modified: libpri/trunk/debian/patches/bristuff.dpatch
===================================================================
--- libpri/trunk/debian/patches/bristuff.dpatch	2006-06-14 01:12:47 UTC (rev 1876)
+++ libpri/trunk/debian/patches/bristuff.dpatch	2006-06-14 02:14:52 UTC (rev 1877)
@@ -9,11 +9,11 @@
 ## DP: copyright statements.
 
 @DPATCH@
---- libpri-1.2.2.orig/README	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/README	2006-01-18 12:28:07.000000000 +0100
+diff -urNad libpri-1.2.3~/README libpri-1.2.3/README
+--- libpri-1.2.3~/README	2006-02-16 04:59:38.000000000 +1100
++++ libpri-1.2.3/README	2006-06-14 12:09:23.000000000 +1000
 @@ -1,6 +1,7 @@
--libpri: An implementation of Primate Rate ISDN
-+libpri: An implementation of Primate Rate ISDN (and BRI ISDN)
+ libpri: An implementation of Primary Rate ISDN
  
  Written by Mark Spencer <markster at digium.com>
 +Modified for BRI support by Klaus-Peter Junghanns <kpj at junghanns.net>
@@ -40,9 +40,9 @@
  
  
  How do I report bugs or contribute?
-diff -urN libpri-1.2.2.orig/TODO libpri-1.2.2/TODO
---- libpri-1.2.2.orig/TODO	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/TODO	2006-01-18 12:28:07.000000000 +0100
+diff -urNad libpri-1.2.3~/TODO libpri-1.2.3/TODO
+--- libpri-1.2.3~/TODO	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/TODO	2006-06-14 12:09:23.000000000 +1000
 @@ -2,9 +2,7 @@
  -- D-Channel Backup
  -- Test against 4e
@@ -56,9 +56,9 @@
 +-- Locking Shift IE (you did that already, didnt you??)
 +-- Implement the 10 missing Q.931 timers
 +-- more facilities
-diff -urN libpri-1.2.2.orig/libpri.h libpri-1.2.2/libpri.h
---- libpri-1.2.2.orig/libpri.h	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/libpri.h	2006-04-15 21:56:47.000000000 +0200
+diff -urNad libpri-1.2.3~/libpri.h libpri-1.2.3/libpri.h
+--- libpri-1.2.3~/libpri.h	2006-04-28 02:08:39.000000000 +1000
++++ libpri-1.2.3/libpri.h	2006-06-14 12:09:23.000000000 +1000
 @@ -5,6 +5,8 @@
   *
   * Copyright (C) 2001, Linux Support Services, Inc.
@@ -187,15 +187,7 @@
  	q931_call *call;			/* Opaque call pointer */
  	long aoc_units;				/* Advise of Charge number of charged units */
  	char useruserinfo[260];		/* User->User info */
-@@ -359,6 +381,7 @@
- typedef struct pri_event_setup_ack {
- 	int e;
- 	int channel;
-+	q931_call *call;			/* Opaque call pointer */
- } pri_event_setup_ack;
- 
- typedef struct pri_event_notify {
-@@ -374,20 +397,80 @@
+@@ -375,20 +397,80 @@
  	char digits[64];
  } pri_event_keypad_digit;
  
@@ -277,7 +269,7 @@
  	pri_event_keypad_digit digit;			/* Digits that come during a call */
  } pri_event;
  
-@@ -402,7 +485,9 @@
+@@ -403,7 +485,9 @@
     channel operating in HDLC mode with FCS computed by the fd's driver.  Also it
     must be NON-BLOCKING! Frames received on the fd should include FCS.  Nodetype 
     must be one of PRI_NETWORK or PRI_CPE.  switchtype should be PRI_SWITCH_* */
@@ -288,7 +280,7 @@
  
  /* Create D-channel just as above with user defined I/O callbacks and data */
  extern struct pri *pri_new_cb(int fd, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata);
-@@ -426,6 +511,9 @@
+@@ -427,6 +511,9 @@
  /* Enable transmission support of Facility IEs on the pri */
  extern void pri_facility_enable(struct pri *pri);
  
@@ -298,7 +290,7 @@
  /* Run PRI on the given D-channel, taking care of any events that
     need to be handled.  If block is set, it will block until an event
     occurs which needs to be handled */
-@@ -462,6 +550,12 @@
+@@ -463,6 +550,12 @@
  /* Send a digit in overlap mode */
  extern int pri_information(struct pri *pri, q931_call *call, char digit);
  
@@ -311,7 +303,7 @@
  /* Answer the incomplete(call without called number) call on the given channel.
     Set non-isdn to non-zero if you are not connecting to ISDN equipment */
  extern int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn);
-@@ -470,6 +564,35 @@
+@@ -471,6 +564,35 @@
     Set non-isdn to non-zero if you are not connecting to ISDN equipment */
  extern int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);
  
@@ -347,7 +339,7 @@
  /* Set CRV reference for GR-303 calls */
  
  
-@@ -478,14 +601,14 @@
+@@ -479,14 +601,14 @@
  
  /* backwards compatibility for those who don't use asterisk with libpri */
  #define pri_release(a,b,c) \
@@ -365,7 +357,7 @@
  
  #define PRI_DESTROYCALL
  extern void pri_destroycall(struct pri *pri, q931_call *call);
-@@ -518,14 +641,13 @@
+@@ -519,14 +641,13 @@
  extern void pri_sr_free(struct pri_sr *sr);
  
  extern int pri_sr_set_channel(struct pri_sr *sr, int channel, int exclusive, int nonisdn);
@@ -381,7 +373,7 @@
  extern void pri_call_set_useruser(q931_call *sr, char *userchars);
  
  extern int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);
-@@ -546,8 +668,8 @@
+@@ -547,8 +668,8 @@
  
  /* Override message and error stuff */
  #define PRI_NEW_SET_API
@@ -392,12 +384,10 @@
  
  /* Set overlap mode */
  #define PRI_SET_OVERLAPDIAL
-diff -urN libpri-1.2.2.orig/pri.c libpri-1.2.2/pri.c
---- libpri-1.2.2.orig/pri.c	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri.c	2006-04-15 21:57:09.000000000 +0200
-@@ -1,24 +1,14 @@
- /*
-  * libpri: An implementation of Primary Rate ISDN
+diff -urNad libpri-1.2.3~/pri.c libpri-1.2.3/pri.c
+--- libpri-1.2.3~/pri.c	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/pri.c	2006-06-14 12:09:23.000000000 +1000
+@@ -3,22 +3,12 @@
   *
   * Written by Mark Spencer <markster at digium.com>
   *
@@ -777,9 +767,9 @@
 +	q921_reset(pri, pri->tei, 1);
 +    }
 +}
-diff -urN libpri-1.2.2.orig/pri_facility.c libpri-1.2.2/pri_facility.c
---- libpri-1.2.2.orig/pri_facility.c	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_facility.c	2006-04-15 21:56:10.000000000 +0200
+diff -urNad libpri-1.2.3~/pri_facility.c libpri-1.2.3/pri_facility.c
+--- libpri-1.2.3~/pri_facility.c	2006-02-14 10:06:02.000000000 +1100
++++ libpri-1.2.3/pri_facility.c	2006-06-14 12:09:23.000000000 +1000
 @@ -1,26 +1,17 @@
 -/*
 - * libpri: An implementation of Primary Rate ISDN
@@ -1172,7 +1162,7 @@
  	}
  
  	return 0;
-@@ -1148,13 +1216,15 @@
+@@ -1152,13 +1220,15 @@
  		NEXT_COMPONENT(comp, i);
  
  		/* No argument - return with error */
@@ -1193,7 +1183,7 @@
  
  		if (pri->debug & PRI_DEBUG_APDU)
  			pri_message(pri, "  [ Handling operation %d ]\n", operation_tag);
-@@ -1178,7 +1248,11 @@
+@@ -1182,7 +1252,11 @@
  		case ROSE_DIVERTING_LEG_INFORMATION2:
  			if (pri->debug & PRI_DEBUG_APDU)
  				pri_message(pri, "  Handle DivertingLegInformation2\n");
@@ -1206,7 +1196,7 @@
  		case ROSE_AOC_NO_CHARGING_INFO_AVAILABLE:
  			if (pri->debug & PRI_DEBUG_APDU) {
  				pri_message(pri, "ROSE %i: AOC No Charging Info Available - not handled!", operation_tag);
-@@ -1206,6 +1280,7 @@
+@@ -1210,6 +1284,7 @@
  			}
  			return -1;
  		case ROSE_AOC_AOCD_CHARGING_UNIT:
@@ -1214,7 +1204,7 @@
  			if (pri->debug & PRI_DEBUG_APDU) {
  				pri_message(pri, "ROSE %i: AOC-D Charging Unit - not handled!", operation_tag);
  				dump_apdu (pri, (u_int8_t *)comp, comp->len + 2);
-@@ -1220,7 +1295,7 @@
+@@ -1224,7 +1299,7 @@
  		case ROSE_AOC_AOCE_CHARGING_UNIT:
  			return aoc_aoce_charging_unit_decode(pri, call, (u_int8_t *)comp, comp->len + 2);
  			if (0) { /* the following function is currently not used - just to make the compiler happy */
@@ -1223,7 +1213,7 @@
  				return 0;
  			}
  		case ROSE_AOC_IDENTIFICATION_OF_CHARGE:
-@@ -1229,6 +1304,22 @@
+@@ -1233,6 +1308,22 @@
  				dump_apdu (pri, (u_int8_t *)comp, comp->len + 2);
  			}
  			return -1;
@@ -1246,9 +1236,9 @@
  		default:
  			if (pri->debug & PRI_DEBUG_APDU) {
  				pri_message(pri, "!! Unable to handle ROSE operation %d", operation_tag);
-diff -urN libpri-1.2.2.orig/pri_facility.h libpri-1.2.2/pri_facility.h
---- libpri-1.2.2.orig/pri_facility.h	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_facility.h	2006-04-15 21:35:05.000000000 +0200
+diff -urNad libpri-1.2.3~/pri_facility.h libpri-1.2.3/pri_facility.h
+--- libpri-1.2.3~/pri_facility.h	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/pri_facility.h	2006-06-14 12:09:23.000000000 +1000
 @@ -34,7 +34,7 @@
  /* Operation ID values */
  /* Q.952 ROSE operations (Diverting) */
@@ -1297,9 +1287,9 @@
 +extern int aoc_aoce_charging_unit_encode(struct pri *pri, q931_call *c, long chargedunits, int send_facility_message);
 +
  #endif /* _PRI_FACILITY_H */
-diff -urN libpri-1.2.2.orig/pri_internal.h libpri-1.2.2/pri_internal.h
---- libpri-1.2.2.orig/pri_internal.h	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_internal.h	2006-04-15 21:57:19.000000000 +0200
+diff -urNad libpri-1.2.3~/pri_internal.h libpri-1.2.3/pri_internal.h
+--- libpri-1.2.3~/pri_internal.h	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/pri_internal.h	2006-06-14 12:09:23.000000000 +1000
 @@ -5,6 +5,8 @@
   *
   * Copyright (C) 2001, Linux Support Services, Inc.
@@ -1527,9 +1517,9 @@
  extern void pri_error(struct pri *pri, char *fmt, ...);
  
  void libpri_copy_string(char *dst, const char *src, size_t size);
-diff -urN libpri-1.2.2.orig/pri_q921.h libpri-1.2.2/pri_q921.h
---- libpri-1.2.2.orig/pri_q921.h	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_q921.h	2006-04-15 21:57:24.000000000 +0200
+diff -urNad libpri-1.2.3~/pri_q921.h libpri-1.2.3/pri_q921.h
+--- libpri-1.2.3~/pri_q921.h	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/pri_q921.h	2006-06-14 12:09:23.000000000 +1000
 @@ -5,6 +5,8 @@
   *
   * Copyright (C) 2001, Linux Support Services, Inc.
@@ -1571,9 +1561,9 @@
 +extern int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr, int tei);
  
  #endif
-diff -urN libpri-1.2.2.orig/pri_q931.h libpri-1.2.2/pri_q931.h
---- libpri-1.2.2.orig/pri_q931.h	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_q931.h	2006-04-15 21:57:29.000000000 +0200
+diff -urNad libpri-1.2.3~/pri_q931.h libpri-1.2.3/pri_q931.h
+--- libpri-1.2.3~/pri_q931.h	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/pri_q931.h	2006-06-14 12:09:23.000000000 +1000
 @@ -5,6 +5,8 @@
   *
   * Copyright (C) 2001, Linux Support Services, Inc.
@@ -1658,9 +1648,9 @@
 +//extern int q931_facility(struct pri *pri, q931_call *c, int operation, char *arguments);
 +
  #endif
-diff -urN libpri-1.2.2.orig/pri_timers.h libpri-1.2.2/pri_timers.h
---- libpri-1.2.2.orig/pri_timers.h	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pri_timers.h	2006-01-18 12:28:07.000000000 +0100
+diff -urNad libpri-1.2.3~/pri_timers.h libpri-1.2.3/pri_timers.h
+--- libpri-1.2.3~/pri_timers.h	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/pri_timers.h	2006-06-14 12:09:23.000000000 +1000
 @@ -27,17 +27,17 @@
  
  /* -1 means we dont currently support the timer/counter */
@@ -1684,9 +1674,9 @@
  				-1,	/* T304 */ \
  				30000,	/* T305 */ \
  				-1,	/* T306 */ \
-diff -urN libpri-1.2.2.orig/pridump.c libpri-1.2.2/pridump.c
---- libpri-1.2.2.orig/pridump.c	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pridump.c	2006-01-18 12:28:07.000000000 +0100
+diff -urNad libpri-1.2.3~/pridump.c libpri-1.2.3/pridump.c
+--- libpri-1.2.3~/pridump.c	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/pridump.c	2006-06-14 12:09:23.000000000 +1000
 @@ -1,9 +1,9 @@
  /*
   * libpri: An implementation of Primary Rate ISDN
@@ -1699,9 +1689,9 @@
   * All Rights Reserved.
   *
   * This program is free software; you can redistribute it and/or modify
-diff -urN libpri-1.2.2.orig/prisched.c libpri-1.2.2/prisched.c
---- libpri-1.2.2.orig/prisched.c	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/prisched.c	2006-04-15 21:57:42.000000000 +0200
+diff -urNad libpri-1.2.3~/prisched.c libpri-1.2.3/prisched.c
+--- libpri-1.2.3~/prisched.c	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/prisched.c	2006-06-14 12:09:23.000000000 +1000
 @@ -1,10 +1,12 @@
  /*
   * libpri: An implementation of Primary Rate ISDN
@@ -1838,9 +1828,9 @@
 +	pri->pri_sched[id].callback2 = NULL;
  }
 +
-diff -urN libpri-1.2.2.orig/pritest.c libpri-1.2.2/pritest.c
---- libpri-1.2.2.orig/pritest.c	2005-11-29 19:39:18.000000000 +0100
-+++ libpri-1.2.2/pritest.c	2006-01-18 12:28:07.000000000 +0100
+diff -urNad libpri-1.2.3~/pritest.c libpri-1.2.3/pritest.c
+--- libpri-1.2.3~/pritest.c	2005-11-30 05:39:18.000000000 +1100
++++ libpri-1.2.3/pritest.c	2006-06-14 12:09:23.000000000 +1000
 @@ -1,9 +1,9 @@
  /*
   * libpri: An implementation of Primary Rate ISDN
@@ -1899,9 +1889,9 @@
  	default:
  		fprintf(stderr, "--!! Unknown PRI event %d\n", e->e);
  	}
-diff -urN libpri-1.2.2.orig/q921.c libpri-1.2.2/q921.c
---- libpri-1.2.2.orig/q921.c	2005-12-06 22:35:50.000000000 +0100
-+++ libpri-1.2.2/q921.c	2006-04-24 13:44:24.000000000 +0200
+diff -urNad libpri-1.2.3~/q921.c libpri-1.2.3/q921.c
+--- libpri-1.2.3~/q921.c	2005-12-07 08:35:50.000000000 +1100
++++ libpri-1.2.3/q921.c	2006-06-14 12:09:23.000000000 +1000
 @@ -1,10 +1,12 @@
  /*
   * libpri: An implementation of Primary Rate ISDN
@@ -2463,9 +2453,16 @@
 +static void t203_expire(void *, int tei);
 +static void t200_expire(void *, int tei);
 +static pri_event *q921_dchannel_down(struct pri *pri, int tei);
-+
+ 
+-static void reschedule_t203(struct pri *pri)
 +static void reschedule_t203(struct pri *pri, int tei)
-+{
+ {
+-	if (pri->t203_timer) {
+-		pri_schedule_del(pri, pri->t203_timer);
+-		if (pri->debug &  PRI_DEBUG_Q921_STATE)
+-			pri_message(pri, "-- Restarting T203 counter\n");
+-		/* Nothing to transmit, start the T203 counter instead */
+-		pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri);
 + 	int teio=tei - Q921_TEI_BASE;
 + 	if (((teio < 0) || (teio > Q921_MAX_TEIS)) || (pri->localtype != BRI_NETWORK_PTMP)) { teio=0; }
 + 	if (pri->t203_timer[teio]) {
@@ -2479,16 +2476,9 @@
 +		}
 +  	}
 +}
- 
--static void reschedule_t203(struct pri *pri)
++
 +static void q921_flush_txqueue(struct pri *pri, int tei, int devnull)
- {
--	if (pri->t203_timer) {
--		pri_schedule_del(pri, pri->t203_timer);
--		if (pri->debug &  PRI_DEBUG_Q921_STATE)
--			pri_message(pri, "-- Restarting T203 counter\n");
--		/* Nothing to transmit, start the T203 counter instead */
--		pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri);
++{
 +	struct q921_frame *f, *tmp = NULL;	
 +	int teio=tei - Q921_TEI_BASE;
 +	if (((teio < 0) || (teio > Q921_MAX_TEIS)) || (pri->localtype != BRI_NETWORK_PTMP)) { teio=0; }
@@ -3832,9 +3822,9 @@
 -	/* Do the SABME XXX Maybe we should implement T_WAIT? XXX */
 -	q921_send_sabme(pri, now);
  }
-diff -urN libpri-1.2.2.orig/q931.c libpri-1.2.2/q931.c
---- libpri-1.2.2.orig/q931.c	2006-01-17 14:43:18.000000000 +0100
-+++ libpri-1.2.2/q931.c	2006-04-24 10:35:43.000000000 +0200
+diff -urNad libpri-1.2.3~/q931.c libpri-1.2.3/q931.c
+--- libpri-1.2.3~/q931.c	2006-04-28 02:08:39.000000000 +1000
++++ libpri-1.2.3/q931.c	2006-06-14 12:10:18.000000000 +1000
 @@ -1,10 +1,12 @@
  /*
   * libpri: An implementation of Primary Rate ISDN
@@ -4011,37 +4001,36 @@
  	pri_error(pri, "!! No channel map, no channel, and no ds1?  What am I supposed to identify?\n");
  	return -1;
  }
-@@ -734,8 +797,12 @@
+@@ -734,10 +797,11 @@
  	return code2str(pres, press, sizeof(press) / sizeof(press[0]));
  }
  
 -static void q931_get_number(unsigned char *num, int maxlen, unsigned char *src, int len)
 +static void q931_get_number(char *num, int maxlen, unsigned char *src, int len)
  {
-+	if (len < 0) {
-+	    pri_error(NULL, "q931_get_number received invalid len = %d\n", len);
-+	    return;
-+	}
- 	if (len > maxlen - 1) {
+ 	if ((len < 0) || (len > maxlen - 1)) {
  		num[0] = 0;
++		pri_error(NULL, "q931_get_number received invalid len = %d\n", len);
  		return;
-@@ -746,50 +813,75 @@
+ 	}
+ 	memcpy(num, src, len);
+@@ -746,50 +810,78 @@
  
  static FUNC_DUMP(dump_called_party_number)
  {
 -	unsigned char cnum[256];
--
++	char cnum[256];
++	if (len >= 3) {
++	    q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
++	    pri_message(pri, "%c Called Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d) '%s' ]\n",
++		    prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f, cnum);
++	} else {
++	    pri_error(pri, "Called Number (len=%2d) too short.\n", len);
++	}
+ 
 -	q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
 -	pri_message(pri, "%c Called Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d) '%s' ]\n",
 -		prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f, cnum);
-+	char cnum[256];
-+ 	if (len >= 3) {
-+ 	    q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
-+	    pri_message(pri, "%c Called Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d) '%s' ]\n",
-+ 		    prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f, cnum);
-+ 	} else {
-+ 	    pri_error(pri, "Called Number (len=%2d) too short.\n", len);
-+ 	}
  }
  
  static FUNC_DUMP(dump_called_party_subaddr)
@@ -4049,19 +4038,17 @@
 -	unsigned char cnum[256];
 -	q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
 -	pri_message(pri, "%c Called Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
--		prefix, len, ie->data[0] >> 7,
--		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
--		(ie->data[0] & 0x08) >> 3, cnum);
 +	char cnum[256];
-+ 	if (len >= 3) {
-+ 	    q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
-+ 	    pri_message(pri, "%c Called Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
-+  		prefix, len, ie->data[0] >> 7,
-+  		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
-+  		(ie->data[0] & 0x08) >> 3, cnum);
-+ 	} else {
-+ 	    pri_error(pri, "Called Party Subaddress (len=%2d) too short.\n", len);
-+ 	}
++	if (len >= 3) {
++	    q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
++	    pri_message(pri, "%c Called Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
+ 		prefix, len, ie->data[0] >> 7,
+ 		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
+ 		(ie->data[0] & 0x08) >> 3, cnum);
++	} else {
++	    pri_error(pri, "Called Party Subaddress (len=%2d) too short.\n", len);
++	}
++
  }
  
  static FUNC_DUMP(dump_calling_party_number)
@@ -4073,53 +4060,49 @@
 -		q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
 -	pri_message(pri, "%c Calling Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
 -	if (ie->data[0] & 0x80)
--		pri_message(pri, "%c                           Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(0), 0, cnum);
++	char cnum[256];
++	if ((ie->data[0] & 0x80) && (len >= 3)) {
++	    	q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
++		pri_message(pri, "%c Calling Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
+ 		pri_message(pri, "%c                           Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(0), 0, cnum);
 -	else
--		pri_message(pri, "%c                           Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum);
-+  	char cnum[256];
-+ 	if ((ie->data[0] & 0x80) && (len >= 3)) {
-+  		q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
-+ 		pri_message(pri, "%c Calling Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
-+  		pri_message(pri, "%c                           Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(0), 0, cnum);
-+ 	} else if (len >= 4) {
-+ 		q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
-+ 		pri_message(pri, "%c Calling Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
-+  		pri_message(pri, "%c                           Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum);
-+ 	} else {
-+ 	    pri_error(pri, "Calling Party Number (len=%2d) too short.\n", len);
-+ 	}
++	} else if (len >= 4) {
++		q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
++		pri_message(pri, "%c Calling Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
+ 		pri_message(pri, "%c                           Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum);
++	} else {
++	    pri_error(pri, "Calling Party Number (len=%2d) too short.\n", len);
++	}
++
  }
  
  static FUNC_DUMP(dump_calling_party_subaddr)
  {
 -	unsigned char cnum[256];
--	q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
+-	q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
 -	pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
--		prefix, len, ie->data[0] >> 7,
--		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
--		(ie->data[0] & 0x08) >> 3, cnum);
 +	char cnum[256];
-+ 	if (len >= 4) {
-+ 	    q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
-+ 	    pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
-+  		prefix, len, ie->data[0] >> 7,
-+  		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
-+  		(ie->data[0] & 0x08) >> 3, cnum);
-+ 	} else {
-+ 	    pri_error(pri, "Calling Party Subaddress (len=%2d) too short.\n", len);
-+ 	}
++	if (len >= 4) {
++	    q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
++	    pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
+ 		prefix, len, ie->data[0] >> 7,
+ 		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
+ 		(ie->data[0] & 0x08) >> 3, cnum);
++	} else {
++	    pri_error(pri, "Calling Party Subaddress (len=%2d) too short.\n", len);
++	}
 +}
 +
 +static FUNC_DUMP(dump_colp)
 +{
-+ 	char cnum[256];
-+ 	if (len >= 4) {
-+ 	    q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
-+ 	    pri_message(pri, "%c COLP (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
-+ 	    pri_message(pri, "%c                           Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum);
-+ 	} else {
-+ 	    pri_error(pri, "COLP (len=%2d) too short.\n", len);
-+ 	}
++	char cnum[256];
++	if (len >= 4) {
++	    q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
++	    pri_message(pri, "%c COLP (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
++	    pri_message(pri, "%c                           Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum);
++	} else {
++	    pri_error(pri, "COLP (len=%2d) too short.\n", len);
++	}
  }
  
  static FUNC_DUMP(dump_redirecting_number)
@@ -4183,37 +4166,35 @@
  		ie->data[0] = call->redirectingplan;
  		ie->data[1] = call->redirectingpres;
  		ie->data[2] = (call->redirectingreason & 0x0f) | 0x80;
-@@ -878,67 +978,90 @@
+@@ -878,67 +978,91 @@
  
  static FUNC_DUMP(dump_redirecting_subaddr)
  {
 -	unsigned char cnum[256];
 -	q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
 -	pri_message(pri, "%c Redirecting Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
--		prefix, len, ie->data[0] >> 7,
--		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
--		(ie->data[0] & 0x08) >> 3, cnum);
 +	char cnum[256];
-+ 	if (len >= 4) {
-+ 	    q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
-+ 	    pri_message(pri, "%c Redirecting Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
-+  		prefix, len, ie->data[0] >> 7,
-+  		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
-+  		(ie->data[0] & 0x08) >> 3, cnum);
-+ 	} else {
-+ 	    pri_error(pri, "Redirecting Subaddress (len=%2d) too short.\n", len);
-+ 	}
++	if (len >= 4) {
++	    q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
++	    pri_message(pri, "%c Redirecting Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d) O: %d '%s' ]\n",
+ 		prefix, len, ie->data[0] >> 7,
+ 		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
+ 		(ie->data[0] & 0x08) >> 3, cnum);
++	} else {
++	    pri_error(pri, "Redirecting Subaddress (len=%2d) too short.\n", len);
++	}
++
  }
  
  static FUNC_RECV(receive_calling_party_subaddr)
  {
  	/* copy digits to call->callingsubaddr */
-- 	q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 2, len - 4);
-+ 	if (len >= 4) {
-+  	    q931_get_number(call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 2, len - 4);
-+ 	} else {
+- 	q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 1, len - 3);
++	if (len >= 4) {
++	    q931_get_number(call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 2, len - 4);
++	} else {
 +	    pri_error(call->pri, "Calling Party Subaddress (len=%2d) too short.\n", len);
-+ 	}
++	}
  	return 0;
  }
  
@@ -4222,17 +4203,17 @@
 -	/* copy digits to call->callednum */
 - 	q931_get_number((unsigned char *) call->callednum, sizeof(call->callednum), ie->data + 1, len - 3);
 -	call->calledplan = ie->data[0] & 0x7f;
-+ 	/* copy digits to call->callednum or call->digits */
-+ 	if (len >= 3) {
-+ 	    if (msgtype == Q931_INFORMATION) {
-+  		q931_get_number(call->digits, sizeof(call->digits), ie->data + 1, len - 3);
-+ 	    } else {
-+  		q931_get_number(call->callednum, sizeof(call->callednum), ie->data + 1, len - 3);
-+ 	    }
-+ 	    call->calledplan = ie->data[0] & 0x7f;
-+ 	} else {
-+ 	    pri_error(call->pri, "Called Party Number (len=%2d) too short.\n", len);
-+ 	}
++	/* copy digits to call->callednum or call->digits */
++	if (len >= 3) {
++	    if (msgtype == Q931_INFORMATION) {
++		q931_get_number(call->digits, sizeof(call->digits), ie->data + 1, len - 3);
++	    } else {
++		q931_get_number(call->callednum, sizeof(call->callednum), ie->data + 1, len - 3);
++	    }
++	    call->calledplan = ie->data[0] & 0x7f;
++	} else {
++	    pri_error(call->pri, "Called Party Number (len=%2d) too short.\n", len);
++	}
  	return 0;
  }
  
@@ -4240,7 +4221,7 @@
  {
  	ie->data[0] = 0x80 | call->calledplan;
 -	if (*call->callednum)
-+	if (strlen(call->callednum)) 
++	if (strlen(call->callednum))
  		memcpy(ie->data + 1, call->callednum, strlen(call->callednum));
  	return strlen(call->callednum) + 3;
  }
@@ -4254,12 +4235,16 @@
 -		data = ie->data + 1;
 -		length = len - 3;
 -		call->callerpres = 0; /* PI presentation allowed SI user-provided, not screened */        
--	} else {
++/// callerani!!
++	if (strlen(call->callernum)) {
++	    call->callerplanuser = ie->data[0] & 0x7f;
+ 	} else {
 -		data = ie->data + 2;
 -		length = len - 4;
 -		call->callerpres = ie->data[1] & 0x7f;
--	}
--
++	    call->callerplan = ie->data[0] & 0x7f;
+ 	}
+ 
 -	if (call->callerpres == PRES_ALLOWED_NETWORK_NUMBER ||
 -		call->callerpres == PRES_PROHIB_NETWORK_NUMBER) {
 -		q931_get_number((u_int8_t *)call->callerani, sizeof(call->callerani), data, length);
@@ -4270,49 +4255,41 @@
 -			call->callerplan = call->callerplanani;
 -		}
 -		
--	} else {
++	  if (ie->data[0] & 0x80) {
++	  if (len >= 3) {
++	     if (strlen(call->callernum)) {
++ 		// got A NUM already (this is not 100% correct, but the network should do it this way to protect bad implementations
++		 q931_get_number(call->callerani, sizeof(call->callerani), ie->data + 1, len - 3);
++		call->callerpresuser = 0; /* PI presentation allowed
++				   SI user-provided, not screened */
++	    } else {
++ 		q931_get_number(call->callernum, sizeof(call->callernum), ie->data + 1, len - 3);
++		call->callerpres = 0; /* PI presentation allowed
++				   SI user-provided, not screened */
++	    }
+ 	} else {
 -		q931_get_number((u_int8_t *)call->callernum, sizeof(call->callernum), data, length);
 -		call->callerplan = ie->data[0] & 0x7f;
--	}
-+/// callerani!!
-+ 	if (strlen(call->callernum)) {
-+     	    call->callerplanuser = ie->data[0] & 0x7f;
-+ 	} else {
-+     	    call->callerplan = ie->data[0] & 0x7f;
-+ 	}
- 
-+        if (ie->data[0] & 0x80) {
-+ 	  if (len >= 3) {
-+ 	     if (strlen(call->callernum)) {
-+ 		// got A NUM already (this is not 100% correct, but the network should do it this way to protect bad implementations
-+ 		 q931_get_number(call->callerani, sizeof(call->callerani), ie->data + 1, len - 3);
-+ 	        call->callerpresuser = 0; /* PI presentation allowed
-+ 				   SI user-provided, not screened */        
-+ 	    } else {
-+ 		 q931_get_number(call->callernum, sizeof(call->callernum), ie->data + 1, len - 3);
-+ 		 call->callerpres = 0; /* PI presentation allowed
-+  				   SI user-provided, not screened */        
-+ 	    }
-+ 	  } else {
-+ 		pri_error(call->pri, "Calling Party Number (len=%2d) too short.\n", len);
-+ 	  }
-+        } else {
-+ 	  if (len >= 4) {
-+ 	     if (strlen(call->callernum)) {
-+ 	        q931_get_number(call->callerani, sizeof(call->callerani), ie->data + 2, len - 4);
-+ 		 call->callerpresuser = ie->data[1] & 0x7f;
-+ 	      } else {
-+ 		 q931_get_number(call->callernum, sizeof(call->callernum), ie->data + 2, len - 4);
-+ 	         call->callerpres = ie->data[1] & 0x7f;
-+ 	    }
-+ 	  } else {
-+ 		pri_error(call->pri, "Calling Party Number (len=%2d) too short.\n", len);
-+ 	  }
-+        }
++		pri_error(call->pri, "Calling Party Number (len=%2d) too short.\n", len);
+ 	}
+-
++	} else {
++	  if (len >= 4) {
++	     if (strlen(call->callernum)) {
++		q931_get_number(call->callerani, sizeof(call->callerani), ie->data + 2, len - 4);
++		 call->callerpresuser = ie->data[1] & 0x7f;
++	     } else {
++		 q931_get_number(call->callernum, sizeof(call->callernum), ie->data + 2, len - 4);
++		 call->callerpres = ie->data[1] & 0x7f;
++	    }
++   	  } else {
++		pri_error(call->pri, "Calling Party Number (len=%2d) too short.\n", len);
++	  }
++	  }
  	return 0;
  }
  
-@@ -946,7 +1069,7 @@
+@@ -946,7 +1070,7 @@
  {
  	ie->data[0] = call->callerplan;
  	ie->data[1] = 0x80 | call->callerpres;
@@ -4321,7 +4298,7 @@
  		memcpy(ie->data + 2, call->callernum, strlen(call->callernum));
  	return strlen(call->callernum) + 4;
  }
-@@ -964,11 +1087,89 @@
+@@ -964,11 +1088,89 @@
  static FUNC_RECV(receive_user_user)
  {        
          call->useruserprotocoldisc = ie->data[0] & 0xff;
@@ -4413,7 +4390,7 @@
  static FUNC_SEND(transmit_user_user)
  {        
  	int datalen = strlen(call->useruserinfo);
-@@ -1050,22 +1251,41 @@
+@@ -1050,22 +1252,41 @@
  		data++;
  		len--;
  	}
@@ -4460,7 +4437,7 @@
  	}
  	return 0;
  }
-@@ -1112,6 +1332,111 @@
+@@ -1112,6 +1333,111 @@
  	return 0;
  }
  
@@ -4572,7 +4549,7 @@
  static FUNC_SEND(transmit_facility)
  {
  	struct apdu_event *tmp;
-@@ -1138,6 +1463,182 @@
+@@ -1138,6 +1464,182 @@
  	return i + 2;
  }
  
@@ -4755,7 +4732,7 @@
  static FUNC_RECV(receive_facility)
  {
  	int i = 0;
-@@ -1346,6 +1847,7 @@
+@@ -1346,6 +1848,7 @@
  	pri_message(pri, " ]\n");
  }
  
@@ -4763,7 +4740,7 @@
  static FUNC_DUMP(dump_time_date)
  {
  	pri_message(pri, "%c Time Date (len=%2d) [ ", prefix, len);
-@@ -1366,7 +1868,7 @@
+@@ -1366,7 +1869,7 @@
  
  static FUNC_DUMP(dump_keypad_facility)
  {
@@ -4772,7 +4749,7 @@
  	
  	if (ie->len == 0 || ie->len > sizeof(tmp))
  		return;
-@@ -1377,28 +1879,49 @@
+@@ -1377,28 +1880,49 @@
  
  static FUNC_RECV(receive_keypad_facility)
  {
@@ -4827,7 +4804,7 @@
  	if (buf) {
  		x=y=0;
  		if ((x < ie->len) && (ie->data[x] & 0x80)) {
-@@ -1413,7 +1936,7 @@
+@@ -1413,7 +1937,7 @@
  	}
  }
  
@@ -4836,7 +4813,7 @@
  {
  	char tmp[1024] = "";
  	int x=0;
-@@ -1423,7 +1946,7 @@
+@@ -1423,7 +1947,7 @@
  		    ((*c >= 'a') && (*c <= 'z')) ||
  		    ((*c >= '0') && (*c <= '9'))) {
  			if (!lastascii) {
@@ -4845,7 +4822,7 @@
  					tmp[x++] = ',';
  					tmp[x++] = ' ';
  				}
-@@ -1435,7 +1958,7 @@
+@@ -1435,7 +1959,7 @@
  			if (lastascii) {
  				tmp[x++] = '\'';
  			}
@@ -4854,7 +4831,7 @@
  				tmp[x++] = ',';
  				tmp[x++] = ' ';
  			}
-@@ -1448,14 +1971,14 @@
+@@ -1448,14 +1972,14 @@
  	}
  	if (lastascii)
  		tmp[x++] = '\'';
@@ -4872,7 +4849,7 @@
  }
  
  static FUNC_DUMP(dump_network_spec_fac)
-@@ -1465,7 +1988,7 @@
+@@ -1465,7 +1989,7 @@
  		pri_message(pri, code2str(ie->data[1], facilities, sizeof(facilities) / sizeof(facilities[0])));
  	}
  	else
@@ -4881,7 +4858,7 @@
  	pri_message(pri, " ]\n");
  }
  
-@@ -1932,8 +2455,8 @@
+@@ -1932,8 +2456,8 @@
  	{ 1, Q931_REDIRECTING_SUBADDR, "Redirecting Subaddress", dump_redirecting_subaddr },
  	{ 0, Q931_TRANSIT_NET_SELECT, "Transit Network Selection" },
  	{ 1, Q931_RESTART_INDICATOR, "Restart Indicator", dump_restart_indicator, receive_restart_indicator, transmit_restart_indicator },
@@ -4892,7 +4869,7 @@
  	{ 1, Q931_PACKET_SIZE, "Packet Size" },
  	{ 1, Q931_IE_FACILITY, "Facility" , dump_facility, receive_facility, transmit_facility },
  	{ 1, Q931_IE_REDIRECTION_NUMBER, "Redirection Number" },
-@@ -1942,11 +2465,11 @@
+@@ -1942,11 +2466,11 @@
  	{ 1, Q931_IE_INFO_REQUEST, "Feature Request" },
  	{ 1, Q931_IE_FEATURE_IND, "Feature Indication" },
  	{ 1, Q931_IE_SEGMENTED_MSG, "Segmented Message" },
@@ -4906,7 +4883,7 @@
  	{ 1, Q931_IE_KEYPAD_FACILITY, "Keypad Facility", dump_keypad_facility, receive_keypad_facility },
  	{ 0, Q931_IE_SIGNAL, "Signal", dump_signal },
  	{ 1, Q931_IE_SWITCHHOOK, "Switch-hook" },
-@@ -1954,6 +2477,7 @@
+@@ -1954,6 +2478,7 @@
  	{ 1, Q931_IE_ESCAPE_FOR_EXT, "Escape for Extension" },
  	{ 1, Q931_IE_CALL_STATUS, "Call Status" },
  	{ 1, Q931_IE_CHANGE_STATUS, "Change Status" },
@@ -4914,7 +4891,7 @@
  	{ 1, Q931_IE_CONNECTED_ADDR, "Connected Number", dump_connected_number },
  	{ 1, Q931_IE_CONNECTED_NUM, "Connected Number", dump_connected_number },
  	{ 1, Q931_IE_ORIGINAL_CALLED_NUMBER, "Original Called Number", dump_redirecting_number, receive_redirecting_number, transmit_redirecting_number },
-@@ -2024,7 +2548,7 @@
+@@ -2024,7 +2549,7 @@
  {
  	if ((ie->ie & 0x80) != 0)
  		return 1;
@@ -4923,7 +4900,7 @@
  		return 2 + ie->len;
  }
  
-@@ -2054,10 +2578,10 @@
+@@ -2054,10 +2579,10 @@
  			break;
  		case 1:
  			cr = h->crv[0];
@@ -4936,7 +4913,7 @@
  			break;
  		default:
  			pri_error(NULL, "Call Reference Length not supported: %d\n", h->crlen);
-@@ -2071,14 +2595,14 @@
+@@ -2071,14 +2596,14 @@
  	int full_ie = Q931_FULL_IE(codeset, ie->ie);
  	int base_ie;
  
@@ -4956,7 +4933,7 @@
  
  	/* Special treatment for shifts */
  	if((full_ie & 0xf0) == Q931_LOCKING_SHIFT)
-@@ -2098,14 +2622,46 @@
+@@ -2098,14 +2623,46 @@
  	pri_error(pri, "!! %c Unknown IE %d (len = %d)\n", prefix, base_ie, ielen(ie));
  }
  
@@ -5006,7 +4983,7 @@
  		prev = cur;
  		cur = cur->next;
  	}
-@@ -2118,6 +2674,7 @@
+@@ -2118,6 +2675,7 @@
  		/* Call reference */
  		cur->cr = cr;
  		cur->pri = pri;
@@ -5014,7 +4991,7 @@
  		/* Append to end of list */
  		if (prev)
  			prev->next = cur;
-@@ -2133,24 +2690,42 @@
+@@ -2133,24 +2691,42 @@
  	do {
  		cur = *pri->callpool;
  		pri->cref++;
@@ -5064,7 +5041,7 @@
  			if (prev)
  				prev->next = cur->next;
  			else
-@@ -2159,6 +2734,8 @@
+@@ -2159,6 +2735,8 @@
  				pri_message(pri, "NEW_HANGUP DEBUG: Destroying the call, ourstate %s, peerstate %s\n",callstate2str(cur->ourcallstate),callstate2str(cur->peercallstate));
  			if (cur->retranstimer)
  				pri_schedule_del(pri, cur->retranstimer);
@@ -5073,7 +5050,7 @@
  			pri_call_apdu_queue_cleanup(cur);
  			free(cur);
  			return;
-@@ -2169,16 +2746,16 @@
+@@ -2169,16 +2747,16 @@
  	pri_error(pri, "Can't destroy call %d!\n", cr);
  }
  
@@ -5093,7 +5070,7 @@
  	return;
  }
  
-@@ -2290,6 +2867,10 @@
+@@ -2290,6 +2868,10 @@
  {
  	unsigned int x;
  	int full_ie = Q931_FULL_IE(codeset, ie->ie);
@@ -5104,7 +5081,7 @@
  	if (pri->debug & PRI_DEBUG_Q931_STATE)
  		pri_message(pri, "-- Processing IE %d (cs%d, %s)\n", ie->ie, codeset, ie2str(full_ie));
  	for (x=0;x<sizeof(ies) / sizeof(ies[0]);x++) {
-@@ -2307,21 +2888,36 @@
+@@ -2307,21 +2889,36 @@
  	return -1;
  }
  
@@ -5146,7 +5123,7 @@
  	}
  	if (pri->subchannel) {
  		/* On GR-303, top bit is always 0 */
-@@ -2330,13 +2926,23 @@
+@@ -2330,13 +2927,23 @@
  	mh->f = 0;
  	*hb = h;
  	*mhb = mh;
@@ -5174,7 +5151,7 @@
  	/* The transmit operation might dump the q921 header, so logging the q931
  	   message body after the transmit puts the sections of the message in the
  	   right order in the log */
-@@ -2362,7 +2968,11 @@
+@@ -2362,7 +2969,11 @@
  	
  	memset(buf, 0, sizeof(buf));
  	len = sizeof(buf);
@@ -5187,7 +5164,7 @@
  	mh->msg = msgtype;
  	x=0;
  	codeset = 0;
-@@ -2397,11 +3007,34 @@
+@@ -2397,11 +3008,34 @@
  	}
  	/* Invert the logic */
  	len = sizeof(buf) - len;
@@ -5223,7 +5200,7 @@
  static int status_ies[] = { Q931_CAUSE, Q931_CALL_STATE, -1 };
  
  static int q931_status(struct pri *pri, q931_call *c, int cause)
-@@ -2439,17 +3072,45 @@
+@@ -2439,17 +3073,45 @@
  	return send_message(pri, c, Q931_INFORMATION, information_ies);
  }
  
@@ -5271,7 +5248,7 @@
  int q931_facility(struct pri*pri, q931_call *c)
  {
  	return send_message(pri, c, Q931_FACILITY, facility_ies);
-@@ -2463,7 +3124,6 @@
+@@ -2463,7 +3125,6 @@
  		if ((info > 0x2) || (info < 0x00))
  			return 0;
  	}
@@ -5279,7 +5256,7 @@
  	if (info >= 0)
  		c->notify = info & 0x7F;
  	else
-@@ -2506,6 +3166,8 @@
+@@ -2506,6 +3167,8 @@
  
  int q931_call_proceeding(struct pri *pri, q931_call *c, int channel, int info)
  {
@@ -5288,7 +5265,7 @@
  	if (channel) { 
  		c->ds1no = (channel & 0xff00) >> 8;
  		c->ds1explicit = (channel & 0x10000) >> 16;
-@@ -2532,8 +3194,12 @@
+@@ -2532,8 +3195,12 @@
  static int alerting_ies[] = { -1 };
  #endif
  
@@ -5301,12 +5278,13 @@
  	if (!c->proc) 
  		q931_call_proceeding(pri, c, channel, 0);
  	if (info) {
-@@ -2544,14 +3210,130 @@
+@@ -2544,14 +3211,130 @@
  		c->progressmask = 0;
  	c->ourcallstate = Q931_CALL_STATE_CALL_RECEIVED;
  	c->peercallstate = Q931_CALL_STATE_CALL_DELIVERED;
 +	c->alert = 1;
-+	c->alive = 1;
+ 	c->alive = 1;
+-	return send_message(pri, c, Q931_ALERTING, alerting_ies);
 +	if ((pri->localtype == PRI_NETWORK) || (pri->localtype == PRI_CPE)) {
 +	    return send_message(pri, c, Q931_ALERTING, alerting_ies);
 +	} else {
@@ -5317,8 +5295,9 @@
 +		return send_message(pri, c, Q931_ALERTING, alerting_BRI_ies);
 +	    }
 +	}
-+}
-+
+ }
+ 
+-static int connect_ies[] = {  Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 };
 +static int hold_acknowledge_ies[] = { -1 };
 +
 +int q931_hold_acknowledge(struct pri *pri, q931_call *c)
@@ -5412,8 +5391,7 @@
 +		c->channelno = channel;
 +	c->chanflags &= ~FLAG_PREFERRED;
 +	c->chanflags |= FLAG_EXCLUSIVE;
- 	c->alive = 1;
--	return send_message(pri, c, Q931_ALERTING, alerting_ies);
++	c->alive = 1;
 +	c->ourcallstate = Q931_CALL_STATE_ACTIVE;
 +	c->peercallstate = Q931_CALL_STATE_ACTIVE;
 +	strncpy(tempcallername,c->callername,sizeof(tempcallername));
@@ -5421,10 +5399,9 @@
 +	res = send_message(pri, c, Q931_RESUME_ACKNOWLEDGE, resume_acknowledge_ies);
 +	strncpy(c->callername,tempcallername,sizeof(c->callername));
 +	return res;
- }
- 
--static int connect_ies[] = {  Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 };
++}
 +
++
 +static int connect_ies[] = {  Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, Q931_DISPLAY, -1 };
 +static int connect_NET_ies[] = {  Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, Q931_IE_TIME_DATE, -1 };
   
@@ -5434,7 +5411,7 @@
  	if (channel) { 
  		c->ds1no = (channel & 0xff00) >> 8;
  		c->ds1explicit = (channel & 0x10000) >> 16;
-@@ -2569,9 +3351,36 @@
+@@ -2569,9 +3352,36 @@
  	c->ourcallstate = Q931_CALL_STATE_OVERLAP_RECEIVING;
  	c->peercallstate = Q931_CALL_STATE_OVERLAP_SENDING;
  	c->alive = 1;
@@ -5471,7 +5448,7 @@
  static void pri_connect_timeout(void *data)
  {
  	struct q931_call *c = data;
-@@ -2624,6 +3433,7 @@
+@@ -2624,6 +3434,7 @@
  
  int q931_connect(struct pri *pri, q931_call *c, int channel, int nonisdn)
  {
@@ -5479,7 +5456,7 @@
  	if (channel) { 
  		c->ds1no = (channel & 0xff00) >> 8;
  		c->ds1explicit = (channel & 0x10000) >> 16;
-@@ -2638,22 +3448,37 @@
+@@ -2638,22 +3449,37 @@
  		c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
  	} else
  		c->progressmask = 0;
@@ -5520,7 +5497,7 @@
  	c->ourcallstate = Q931_CALL_STATE_RELEASE_REQUEST;
  	/* c->peercallstate stays the same */
  	if (c->alive) {
-@@ -2669,7 +3494,14 @@
+@@ -2669,7 +3495,14 @@
  			} else {
  				c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T308], pri_release_finaltimeout, c);
  			}
@@ -5536,7 +5513,7 @@
  		} else
  			return send_message(pri, c, Q931_RELEASE_COMPLETE, release_ies); /* Yes, release_ies, not release_complete_ies */
  	} else
-@@ -2681,7 +3513,7 @@
+@@ -2681,7 +3514,7 @@
  int q931_restart(struct pri *pri, int channel)
  {
  	struct q931_call *c;
@@ -5545,7 +5522,7 @@
  	if (!c)
  		return -1;
  	if (!channel)
-@@ -2698,10 +3530,12 @@
+@@ -2698,10 +3531,12 @@
  	return send_message(pri, c, Q931_RESTART, restart_ies);
  }
  
@@ -5558,7 +5535,7 @@
  	c->ourcallstate = Q931_CALL_STATE_DISCONNECT_REQUEST;
  	c->peercallstate = Q931_CALL_STATE_DISCONNECT_INDICATION;
  	if (c->alive) {
-@@ -2713,14 +3547,27 @@
+@@ -2713,14 +3548,27 @@
  		if (c->retranstimer)
  			pri_schedule_del(pri, c->retranstimer);
  		c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T305], pri_disconnect_timeout, c);
@@ -5587,7 +5564,7 @@
  static int gr303_setup_ies[] =  { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 };
  
  static int cis_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_CALLED_PARTY_NUMBER, -1 };
-@@ -2728,7 +3575,12 @@
+@@ -2728,7 +3576,12 @@
  int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
  {
  	int res;
@@ -5601,7 +5578,7 @@
  	
  	c->transcapability = req->transmode;
  	c->transmoderate = TRANS_MODE_64_CIRCUIT;
-@@ -2753,6 +3605,7 @@
+@@ -2753,6 +3606,7 @@
  		c->chanflags = FLAG_EXCLUSIVE;
  	else if (c->channelno)
  		c->chanflags = FLAG_PREFERRED;
@@ -5609,7 +5586,7 @@
  	if (req->caller) {
  		libpri_copy_string(c->callernum, req->caller, sizeof(c->callernum));
  		c->callerplan = req->callerplan;
-@@ -2812,14 +3665,19 @@
+@@ -2812,14 +3666,19 @@
  		res = send_message(pri, c, Q931_SETUP, gr303_setup_ies);
  	else if (c->justsignalling)
  		res = send_message(pri, c, Q931_SETUP, cis_setup_ies);
@@ -5629,7 +5606,7 @@
  	}
  	return res;
  	
-@@ -2835,7 +3693,11 @@
+@@ -2835,7 +3694,11 @@
  	if (cause > -1) {
  		c->cause = cause;
  		c->causecode = CODE_CCITT;
@@ -5642,7 +5619,7 @@
  		/* release_ies has CAUSE in it */
  		res = send_message(pri, c, Q931_RELEASE_COMPLETE, release_ies);
  	} else
-@@ -2860,6 +3722,117 @@
+@@ -2860,6 +3723,117 @@
  	return 0;
  }
  
@@ -5760,7 +5737,7 @@
  int q931_hangup(struct pri *pri, q931_call *c, int cause)
  {
  	int disconnect = 1;
-@@ -2871,7 +3844,7 @@
+@@ -2871,7 +3845,7 @@
  	/* If mandatory IE was missing, insist upon that cause code */
  	if (c->cause == PRI_CAUSE_MANDATORY_IE_MISSING)
  		cause = c->cause;
@@ -5769,7 +5746,7 @@
  		/* We'll send RELEASE_COMPLETE with these causes */
  		disconnect = 0;
  		release_compl = 1;
-@@ -2885,7 +3858,7 @@
+@@ -2885,7 +3859,7 @@
  	case Q931_CALL_STATE_NULL:
  		if (c->peercallstate == Q931_CALL_STATE_NULL)
  			/* free the resources if we receive or send REL_COMPL */
@@ -5778,7 +5755,7 @@
  		else if (c->peercallstate == Q931_CALL_STATE_RELEASE_REQUEST)
  			q931_release_complete(pri,c,cause);
  		break;
-@@ -2911,6 +3884,11 @@
+@@ -2911,6 +3885,11 @@
  		/* received SETUP_ACKNOWLEDGE */
  		/* send DISCONNECT in general */
  		if (c->peercallstate != Q931_CALL_STATE_NULL && c->peercallstate != Q931_CALL_STATE_DISCONNECT_REQUEST && c->peercallstate != Q931_CALL_STATE_DISCONNECT_INDICATION && c->peercallstate != Q931_CALL_STATE_RELEASE_REQUEST && c->peercallstate != Q931_CALL_STATE_RESTART_REQUEST && c->peercallstate != Q931_CALL_STATE_RESTART) {
@@ -5790,7 +5767,7 @@
  			if (disconnect)
  				q931_disconnect(pri,c,cause);
  			else if (release_compl)
-@@ -2926,8 +3904,14 @@
+@@ -2926,8 +3905,14 @@
  		break;
  	case Q931_CALL_STATE_DISCONNECT_INDICATION:
  		/* received DISCONNECT */
@@ -5805,7 +5782,7 @@
  			q931_release(pri,c,cause);
  		}
  		break;
-@@ -2941,19 +3925,17 @@
+@@ -2941,19 +3926,17 @@
  		pri_error(pri, "q931_hangup shouldn't be called in this state, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate));
  		break;
  	default:
@@ -5828,7 +5805,7 @@
  	q931_call *c;
  	q931_ie *ie;
  	unsigned int x;
-@@ -2965,6 +3947,7 @@
+@@ -2965,6 +3948,7 @@
  	int codeset, cur_codeset;
  	int last_ie[8];
  	struct apdu_event *cur = NULL;
@@ -5836,7 +5813,7 @@
  
  	memset(last_ie, 0, sizeof(last_ie));
  	if (pri->debug & PRI_DEBUG_Q931_DUMP)
-@@ -2978,13 +3961,13 @@
+@@ -2978,13 +3962,13 @@
  		   KLUDGE this by changing byte 4 from a 0xf (SERVICE) 
  		   to a 0x7 (SERVICE ACKNOWLEDGE) */
  		h->raw[h->crlen + 2] -= 0x8;
@@ -5852,7 +5829,7 @@
  	if (!c) {
  		pri_error(pri, "Unable to locate call %d\n", q931_cr(h));
  		return -1;
-@@ -3007,6 +3990,7 @@
+@@ -3007,6 +3991,7 @@
  	case Q931_SETUP:
  		if (pri->debug & PRI_DEBUG_Q931_STATE)
  			pri_message(pri, "-- Processing Q.931 Call Setup\n");
@@ -5860,7 +5837,7 @@
  		c->channelno = -1;
  		c->slotmap = -1;
  		c->chanflags = 0;
-@@ -3027,28 +4011,44 @@
+@@ -3027,28 +4012,44 @@
  		c->callername[0] = '\0';
  		c->callerani[0] = '\0';
  		c->callerplanani = -1;
@@ -5915,7 +5892,7 @@
  		c->progress = -1;
  		c->progressmask = 0;
  		break;
-@@ -3059,20 +4059,22 @@
+@@ -3059,20 +4060,22 @@
  		break;
  	case Q931_RELEASE:
  	case Q931_DISCONNECT:
@@ -5945,7 +5922,7 @@
  	case Q931_STATUS:
  		c->cause = -1;
  		c->causecode = -1;
-@@ -3089,22 +4091,32 @@
+@@ -3089,22 +4092,32 @@
  	case Q931_STATUS_ENQUIRY:
  		break;
  	case Q931_SETUP_ACKNOWLEDGE:
@@ -5982,7 +5959,7 @@
  	case Q931_SUSPEND_ACKNOWLEDGE:
  	case Q931_SUSPEND_REJECT:
  		pri_error(pri, "!! Not yet handling pre-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg);
-@@ -3113,7 +4125,7 @@
+@@ -3113,7 +4126,7 @@
  		pri_error(pri, "!! Don't know how to post-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg);
  		q931_status(pri,c, PRI_CAUSE_MESSAGE_TYPE_NONEXIST);
  		if (c->newcall) 
@@ -5991,7 +5968,7 @@
  		return -1;
  	}
  	memset(mandies, 0, sizeof(mandies));
-@@ -3193,12 +4205,19 @@
+@@ -3193,12 +4206,19 @@
  	missingmand = 0;
  	for (x=0;x<MAX_MAND_IES;x++) {
  		if (mandies[x]) {
@@ -6016,7 +5993,7 @@
  		}
  	}
  	
-@@ -3207,7 +4226,7 @@
+@@ -3207,7 +4227,7 @@
  	case Q931_RESTART:
  		if (missingmand) {
  			q931_status(pri, c, PRI_CAUSE_MANDATORY_IE_MISSING);
@@ -6025,7 +6002,7 @@
  			break;
  		}
  		c->ourcallstate = Q931_CALL_STATE_RESTART;
-@@ -3225,6 +4244,7 @@
+@@ -3225,6 +4245,7 @@
  		}
  		/* Must be new call */
  		if (!c->newcall) {
@@ -6033,7 +6010,7 @@
  			break;
  		}
  		if (c->progressmask & PRI_PROG_CALLER_NOT_ISDN)
-@@ -3242,16 +4262,20 @@
+@@ -3242,16 +4263,20 @@
  		pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
  		pri->ev.ring.callingpres = c->callerpres;
  		pri->ev.ring.callingplan = c->callerplan;
@@ -6056,7 +6033,7 @@
  		libpri_copy_string(pri->ev.ring.origcalledname, c->origcalledname, sizeof(pri->ev.ring.origcalledname));
  		libpri_copy_string(pri->ev.ring.origcallednum, c->origcallednum, sizeof(pri->ev.ring.origcallednum));
                  libpri_copy_string(pri->ev.ring.redirectingnum, c->redirectingnum, sizeof(pri->ev.ring.redirectingnum));
-@@ -3261,11 +4285,13 @@
+@@ -3261,11 +4286,13 @@
  		pri->ev.ring.redirectingreason = c->redirectingreason;
  		pri->ev.ring.origredirectingreason = c->origredirectingreason;
  		pri->ev.ring.flexible = ! (c->chanflags & FLAG_EXCLUSIVE);
@@ -6071,7 +6048,7 @@
  		pri->ev.ring.redirectingreason = c->redirectingreason;
  		pri->ev.ring.progress = c->progress;
  		pri->ev.ring.progressmask = c->progressmask;
-@@ -3275,6 +4301,9 @@
+@@ -3275,6 +4302,9 @@
  			q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE);
  			break;
  		}
@@ -6081,7 +6058,7 @@
  		c->ourcallstate = Q931_CALL_STATE_CALL_DELIVERED;
  		c->peercallstate = Q931_CALL_STATE_CALL_RECEIVED;
  		pri->ev.e = PRI_EVENT_RINGING;
-@@ -3295,17 +4324,24 @@
+@@ -3295,17 +4325,24 @@
  			q931_status(pri, c, PRI_CAUSE_WRONG_MESSAGE);
  			break;
  		}
@@ -6106,7 +6083,7 @@
  		if (c->justsignalling) {  /* Make sure WE release when we initiatie a signalling only connection */
  			q931_release(pri, c, PRI_CAUSE_NORMAL_CLEARING);
  			break;
-@@ -3313,23 +4349,43 @@
+@@ -3313,23 +4350,43 @@
  			return Q931_RES_HAVEEVENT;
  	case Q931_FACILITY:
  		if (c->newcall) {
@@ -6163,7 +6140,7 @@
  			break;
  		}
  		pri->ev.e = PRI_EVENT_PROGRESS;
-@@ -3347,6 +4403,11 @@
+@@ -3347,6 +4404,11 @@
  			q931_status(pri,c,PRI_CAUSE_WRONG_MESSAGE);
  			break;
  		}
@@ -6175,7 +6152,7 @@
  		pri->ev.proceeding.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
  		if (mh->msg == Q931_CALL_PROCEEDING) {
  			pri->ev.e = PRI_EVENT_PROCEEDING;
-@@ -3364,16 +4425,21 @@
+@@ -3364,16 +4426,21 @@
  			break;
  		}
  		if (c->ourcallstate != Q931_CALL_STATE_CONNECT_REQUEST) {
@@ -6199,7 +6176,7 @@
  			break;
  		}
  		if (c->newcall) {
-@@ -3410,31 +4476,69 @@
+@@ -3410,31 +4477,69 @@
  			if (res)
  				return res;
  		}
@@ -6293,7 +6270,7 @@
  		break;
  	case Q931_RELEASE:
  		if (missingmand) {
-@@ -3450,6 +4554,7 @@
+@@ -3450,6 +4555,7 @@
  		pri->ev.e = PRI_EVENT_HANGUP;
  		pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
  		pri->ev.hangup.cref = c->cr;
@@ -6301,7 +6278,7 @@
  		pri->ev.hangup.cause = c->cause;
  		pri->ev.hangup.call = c;
  		pri->ev.hangup.aoc_units = c->aoc_units;
-@@ -3478,9 +4583,16 @@
+@@ -3478,9 +4584,16 @@
  		pri->ev.e = PRI_EVENT_HANGUP_REQ;
  		pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
  		pri->ev.hangup.cref = c->cr;
@@ -6318,7 +6295,7 @@
  		if (c->alive)
  			return Q931_RES_HAVEEVENT;
  		else
-@@ -3511,7 +4623,7 @@
+@@ -3511,7 +4624,7 @@
  		pri->ev.e = PRI_EVENT_INFO_RECEIVED;
  		pri->ev.ring.call = c;
  		pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
@@ -6327,16 +6304,7 @@
  		libpri_copy_string(pri->ev.ring.callingsubaddr, c->callingsubaddr, sizeof(pri->ev.ring.callingsubaddr));
  		pri->ev.ring.complete = c->complete; 	/* this covers IE 33 (Sending Complete) */
  		return Q931_RES_HAVEEVENT;
-@@ -3530,7 +4642,7 @@
- 		c->peercallstate = Q931_CALL_STATE_OVERLAP_RECEIVING;
- 		pri->ev.e = PRI_EVENT_SETUP_ACK;
- 		pri->ev.setup_ack.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
--
-+		pri->ev.setup_ack.call = c;
- 		cur = c->apdus;
- 		while (cur) {
- 			if (!cur->sent && cur->message == Q931_FACILITY) {
-@@ -3546,19 +4658,53 @@
+@@ -3547,19 +4660,53 @@
  		pri->ev.notify.channel = c->channelno;
  		pri->ev.notify.info = c->notify;
  		return Q931_RES_HAVEEVENT;
@@ -6394,7 +6362,7 @@
  	case Q931_SUSPEND_ACKNOWLEDGE:
  	case Q931_SUSPEND_REJECT:
  		pri_error(pri, "!! Not yet handling post-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg);
-@@ -3568,7 +4714,7 @@
+@@ -3569,7 +4716,7 @@
  		pri_error(pri, "!! Don't know how to post-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg);
  		q931_status(pri,c, PRI_CAUSE_MESSAGE_TYPE_NONEXIST);
  		if (c->newcall) 




More information about the Pkg-voip-commits mailing list