Bug#297977: libpri1: Updated patch
Mikael Magnusson
Mikael Magnusson <mikma@users.sourceforge.net>, 297977@bugs.debian.org
Wed, 13 Apr 2005 23:10:06 +0200
--J/dobhs11T7y2rNN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
I have updated the keypad patch for libpri_1.0.7-1. I have also added support
for receiving keypad facility and called party number in the same
packet.
For example when dialing #31#1234 on Topcom Deskmaster 520i, both keypad
facility #31# and called party number 1234 are sent in the same packet.
/Mikael Magnusson
--J/dobhs11T7y2rNN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="10_keypad.dpatch"
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10_keypad.dpatch by <mikma@users.sourceforge.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Use received keypad facility in setup as callednum, and add
## DP: received called party number to callednum.
@DPATCH@
diff -urNad libpri-1.0.6.patch/q931.c /tmp/dpep.cXoQUV/libpri-1.0.6.patch/q931.c
--- libpri-1.0.6.patch/q931.c 2005-03-20 20:54:14.348548258 +0100
+++ /tmp/dpep.cXoQUV/libpri-1.0.6.patch/q931.c 2005-03-20 20:54:34.239900432 +0100
@@ -1035,7 +1035,9 @@
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);
+ int oldlen = strlen(call->callednum);
+
+ q931_get_number(call->callednum + oldlen, sizeof(call->callednum) - oldlen, ie->data + 1, len - 3);
}
call->calledplan = ie->data[0] & 0x7f;
} else {
@@ -1483,12 +1485,18 @@
static FUNC_RECV(receive_keypad_facility)
{
/* copy digits to call->callednum or call->digits */
- if (msgtype == Q931_SETUP) {
+ if (msgtype == Q931_INFORMATION) {
if (len >= 2) {
q931_get_number(call->digits, sizeof(call->digits), ie->data , len - 2);
} else {
pri_error("Keypad facility (len=%2d) too short.\n", len);
}
+ } else if (msgtype == Q931_SETUP) {
+ if (len >= 2) {
+ q931_get_number(call->callednum, sizeof(call->callednum), ie->data , len - 2);
+ } else {
+ pri_error("Keypad facility (len=%2d) too short.\n", len);
+ }
} else {
// XXX we assume 1 byte keypad
call->digits[0] = ie->data[0] & 0x7f;
--J/dobhs11T7y2rNN--