snprintf(output, maxlen, "Invalid INT");
}
+static void dump_samprate(char *output, int maxlen, void *value, int len)
+{
+ char tmp[256]="";
+ int sr;
+ if (len == (int)sizeof(unsigned short)) {
+ sr = ntohs(*((unsigned short *)value));
+ if (sr & IAX_RATE_8KHZ)
+ strcat(tmp, ",8khz");
+ if (sr & IAX_RATE_11KHZ)
+ strcat(tmp, ",11.025khz");
+ if (sr & IAX_RATE_16KHZ)
+ strcat(tmp, ",16khz");
+ if (sr & IAX_RATE_22KHZ)
+ strcat(tmp, ",22.05khz");
+ if (sr & IAX_RATE_44KHZ)
+ strcat(tmp, ",44.1khz");
+ if (sr & IAX_RATE_48KHZ)
+ strcat(tmp, ",48khz");
+ if (strlen(tmp))
+ strncpy(output, &tmp[1], maxlen - 1);
+ else
+ strncpy(output, "None specified!\n", maxlen - 1);
+ } else
+ snprintf(output, maxlen, "Invalid SHORT");
+
+}
+
static void dump_prov_ies(char *output, int maxlen, unsigned char *iedata, int len);
static void dump_prov(char *output, int maxlen, void *value, int len)
{
{ IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte },
{ IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte },
{ IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short },
+ { IAX_IE_SAMPLINGRATE, "SAMPLINGRATE", dump_samprate },
};
static struct iax2_ie prov_ies[] = {
ies->calling_ton = -1;
ies->calling_tns = -1;
ies->calling_pres = -1;
+ ies->samprate = IAX_RATE_8KHZ;
while(datalen >= 2) {
ie = data[0];
len = data[1];
} else
ies->adsicpe = ntohs(*((unsigned short *)(data + 2)));
break;
+ case IAX_IE_SAMPLINGRATE:
+ if (len != (int)sizeof(unsigned short)) {
+ snprintf(tmp, (int)sizeof(tmp), "Expecting samplingrate to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ errorf(tmp);
+ } else
+ ies->samprate = ntohs(*((unsigned short *)(data + 2)));
+ break;
case IAX_IE_DNID:
ies->dnid = data + 2;
break;
#define IAX_IE_TRANSFERID 27 /* Transfer Request Identifier -- int */
#define IAX_IE_RDNIS 28 /* Referring DNIS -- string */
#define IAX_IE_PROVISIONING 29 /* Provisioning info */
-#define IAX_IE_AESPROVISIONING 30 /* AES Provisioning info */
+#define IAX_IE_AESPROVISIONING 30 /* AES Provisioning info */
#define IAX_IE_DATETIME 31 /* Date/Time */
#define IAX_IE_DEVICETYPE 32 /* Device Type -- string */
#define IAX_IE_SERVICEIDENT 33 /* Service Identifier -- string */
#define IAX_IE_CALLINGPRES 38 /* Calling presentation (u8) */
#define IAX_IE_CALLINGTON 39 /* Calling type of number (u8) */
#define IAX_IE_CALLINGTNS 40 /* Calling transit network select (u16) */
+#define IAX_IE_SAMPLINGRATE 41 /* Supported sampling rates (u16) */
#define IAX_AUTH_PLAINTEXT (1 << 0)
#define IAX_AUTH_MD5 (1 << 1)
#define IAX_META_TRUNK 1 /* Trunk meta-message */
#define IAX_META_VIDEO 2 /* Video frame */
+#define IAX_RATE_8KHZ (1 << 0) /* 8khz sampling (default if absent) */
+#define IAX_RATE_11KHZ (1 << 1) /* 11.025khz sampling */
+#define IAX_RATE_16KHZ (1 << 2) /* 16khz sampling */
+#define IAX_RATE_22KHZ (1 << 3) /* 22.05khz sampling */
+#define IAX_RATE_44KHZ (1 << 4) /* 44.1khz sampling */
+#define IAX_RATE_48KHZ (1 << 5) /* 48khz sampling */
+
#define IAX_DPSTATUS_EXISTS (1 << 0)
#define IAX_DPSTATUS_CANEXIST (1 << 1)
#define IAX_DPSTATUS_NONEXISTANT (1 << 2)