Review Board 1.7.16


Add ISDN Calling and Called Subaddress support functions to LIBPRI

Review Request #406 - Created Oct. 14, 2009 and submitted

Alec Davis
15604
Reviewers
asterisk-dev
mattf, rmudgett
LibPRI
Further Libpri support for subaddress, previously LIBPRI only supported receiving Calling Subaddress.

The first intentions of this are to add Transmit and Receive capabilites for Calling Subaddress and Called Subaddress.

Calling, Called, Connected and Redirecting Subaddress, now correctly supports User Specific type and the default NSAP.

Redirection and Redirecting Subaddress have been identified, but will come later.

 

Changes between revision 5 and 6

1 2 3 4 5 6 7
1 2 3 4 5 6 7

  1. /team/rmudgett/subaddr/q931.c: Loading...
/team/rmudgett/subaddr/q931.c
Diff Revision 5 Diff Revision 6
[20] 1508 lines
[+20] [+] static void q931_get_subaddr_specific(unsigned char *num, int maxlen, unsigned char *src, int len, char oddflag)
1509
static int transmit_subaddr_helper(int full_ie, struct pri *ctrl, struct q931_party_subaddress *q931_subaddress, int msgtype, q931_ie *ie, int offset, int len, int order)
1509
static int transmit_subaddr_helper(int full_ie, struct pri *ctrl, struct q931_party_subaddress *q931_subaddress, int msgtype, q931_ie *ie, int offset, int len, int order)
1510
{
1510
{
1511
	size_t datalen;
1511
	size_t datalen;
1512

    
   
1512

   
1513
	if (!q931_subaddress->valid) {
1513
	if (!q931_subaddress->valid) {

    
   
1514
		pri_message(ctrl, "ALEC transmit_subaddr_helper valid = '0'!\n");
1514
		return 0;
1515
		return 0;
1515
	}
1516
	}
1516

    
   
1517

   

    
   
1518
	pri_message(ctrl, "ALEC transmit_subaddr_helper valid = '1'\n");
1517
	datalen = q931_subaddress->length;
1519
	datalen = q931_subaddress->length;
1518
	if (!q931_subaddress->type) {
1520
	if (!q931_subaddress->type) {
1519
		/* 0 = NSAP */
1521
		/* 0 = NSAP */
1520
		/* 0 = Odd/Even indicator */
1522
		/* 0 = Odd/Even indicator */
1521
		ie->data[0] = 0x80;
1523
		ie->data[0] = 0x80;
[+20] [20] 144 lines
[+20] [+] static int receive_connected_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
1666
				ie->data[i] & (PRI_PRES_RESTRICTION | PRI_PRES_NUMBER_TYPE);
1668
				ie->data[i] & (PRI_PRES_RESTRICTION | PRI_PRES_NUMBER_TYPE);
1667
			break;
1669
			break;
1668
		}
1670
		}
1669
	} while (!(ie->data[i++] & 0x80));
1671
	} while (!(ie->data[i++] & 0x80));
1670
	q931_get_number((unsigned char *) call->remote_id.number.str, sizeof(call->remote_id.number.str), ie->data + i, ie->len - i);
1672
	q931_get_number((unsigned char *) call->remote_id.number.str, sizeof(call->remote_id.number.str), ie->data + i, ie->len - i);

    
   
1673
	pri_message(ctrl, "ALEC transmit_connected_number str = '%s'\n", call->remote_id.number.str);
1671

    
   
1674

   
1672
	return 0;
1675
	return 0;
1673
}
1676
}
1674

    
   
1677

   
1675
static int transmit_connected_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
1678
static int transmit_connected_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
1676
{
1679
{
1677
	size_t datalen;
1680
	size_t datalen;
1678

    
   
1681

   
1679
	if (!call->local_id.number.valid) {
1682
	if (!call->local_id.number.valid) {

    
   
1683
		pri_message(ctrl, "ALEC transmit_connected_number valid = '0' !\n");
1680
		return 0;
1684
		return 0;
1681
	}
1685
	}
1682

    
   
1686

   
1683
	datalen = strlen(call->local_id.number.str);
1687
	datalen = strlen(call->local_id.number.str);
1684
	ie->data[0] = call->local_id.number.plan;
1688
	ie->data[0] = call->local_id.number.plan;
1685
	ie->data[1] = 0x80 | call->local_id.number.presentation;
1689
	ie->data[1] = 0x80 | call->local_id.number.presentation;
1686
	memcpy(ie->data + 2, call->local_id.number.str, datalen);
1690
	memcpy(ie->data + 2, call->local_id.number.str, datalen);

    
   
1691
	pri_message(ctrl, "ALEC transmit_connected_number str= '%s'\n", call->local_id.number.str);
1687
	return datalen + (2 + 2);
1692
	return datalen + (2 + 2);
1688
}
1693
}
1689

    
   
1694

   
1690
static void dump_connected_number(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
1695
static void dump_connected_number(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
1691
{
1696
{
[+20] [20] 21 lines
[+20] static void dump_connected_number(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
1713
{
1718
{
1714
	if (len < 3) {
1719
	if (len < 3) {
1715
		return -1;
1720
		return -1;
1716
	}
1721
	}
1717

    
   
1722

   

    
   
1723
	pri_message(ctrl, "ALEC receive_connected_subaddr start:\n");
1718
	return receive_subaddr_helper(full_ie, ctrl, &call->remote_id.subaddress, msgtype, ie, 1, len - 3);
1724
	return receive_subaddr_helper(full_ie, ctrl, &call->remote_id.subaddress, msgtype, ie, 1, len - 3);
1719
}
1725
}
1720

    
   
1726

   
1721
static int transmit_connected_subaddr(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
1727
static int transmit_connected_subaddr(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
1722
{
1728
{

    
   
1729
	pri_message(ctrl, "ALEC transmit_connected_subaddr start:\n");
1723
	return transmit_subaddr_helper(full_ie, ctrl, &call->local_id.subaddress, msgtype, ie, 1, len, order);
1730
	return transmit_subaddr_helper(full_ie, ctrl, &call->local_id.subaddress, msgtype, ie, 1, len, order);
1724
}
1731
}
1725

    
   
1732

   
1726
static void dump_connected_subaddr(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
1733
static void dump_connected_subaddr(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
1727
{
1734
{
[+20] [20] 3806 lines
  1. /team/rmudgett/subaddr/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.