mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
chan_iax2: Add ANI2/OLI information element
Adds an information element for ANI2 so that Originating Line Information can be transmitted over IAX2 channels. ASTERISK-29605 #close Change-Id: Iaeacdf6ccde18eaff7f776a0f49fee87dcb549d2
This commit is contained in:
committed by
George Joseph
parent
bbf4f30059
commit
3072c540bb
@@ -187,6 +187,8 @@ enum iax_frame_subclass {
|
||||
#define IAX_IE_CAPABILITY2 55 /*!< Actual codec capability - u8 version + integer array */
|
||||
#define IAX_IE_FORMAT2 56 /*!< Desired codec format - u8 version + integer array */
|
||||
|
||||
#define IAX_IE_CALLINGANI2 57 /*!< Calling Originating Line Information (ANI2) digits */
|
||||
|
||||
#define IAX_MAX_OSPBLOCK_SIZE 254 /*!< Max OSP token block size, 255 bytes - 1 byte OSP token block index */
|
||||
#define IAX_MAX_OSPBLOCK_NUM 4
|
||||
#define IAX_MAX_OSPTOKEN_SIZE (IAX_MAX_OSPBLOCK_SIZE * IAX_MAX_OSPBLOCK_NUM)
|
||||
|
@@ -32,6 +32,7 @@ struct iax_ies {
|
||||
int calling_ton;
|
||||
int calling_tns;
|
||||
int calling_pres;
|
||||
int calling_ani2;
|
||||
char *called_context;
|
||||
char *username;
|
||||
char *password;
|
||||
|
@@ -313,6 +313,7 @@ static struct iax2_ie infoelts[] = {
|
||||
{ IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte },
|
||||
{ IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte },
|
||||
{ IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short },
|
||||
{ IAX_IE_CALLINGANI2, "CALLING ANI2", dump_int },
|
||||
{ IAX_IE_SAMPLINGRATE, "SAMPLINGRATE", dump_samprate },
|
||||
{ IAX_IE_CAUSECODE, "CAUSE CODE", dump_byte },
|
||||
{ IAX_IE_ENCRYPTION, "ENCRYPTION", dump_short },
|
||||
@@ -805,6 +806,7 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
|
||||
ies->calling_ton = -1;
|
||||
ies->calling_tns = -1;
|
||||
ies->calling_pres = -1;
|
||||
ies->calling_ani2 = -1;
|
||||
ies->samprate = IAX_RATE_8KHZ;
|
||||
while(datalen >= 2) {
|
||||
ie = data[0];
|
||||
@@ -1057,6 +1059,14 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
|
||||
errorf(tmp);
|
||||
}
|
||||
break;
|
||||
case IAX_IE_CALLINGANI2:
|
||||
if (len == (int)sizeof(unsigned int)) {
|
||||
ies->calling_ani2 = ntohl(get_unaligned_uint32(data + 2));
|
||||
} else {
|
||||
snprintf(tmp, (int)sizeof(tmp), "callingani2 was %d long: %s\n", len, data + 2);
|
||||
errorf(tmp);
|
||||
}
|
||||
break;
|
||||
case IAX_IE_CALLINGTNS:
|
||||
if (len != (int)sizeof(unsigned short)) {
|
||||
snprintf(tmp, (int)sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
|
||||
|
Reference in New Issue
Block a user