summaryrefslogtreecommitdiff
path: root/channels/iax2-parser.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2005-01-09 10:32:53 +0000
committerMark Spencer <markster@digium.com>2005-01-09 10:32:53 +0000
commit4038178ccb08b48a29927e595370324b527757d9 (patch)
tree1c048137012b536c03e70f3c507dfd4448393a69 /channels/iax2-parser.c
parent88979c2a4a705dd1254504c0e049a8f6617e17bf (diff)
Merge experimental codec preferences for IAX2 (bug #2971)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/iax2-parser.c')
-rwxr-xr-xchannels/iax2-parser.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c
index 78374074f..44e3a7590 100755
--- a/channels/iax2-parser.c
+++ b/channels/iax2-parser.c
@@ -80,6 +80,25 @@ static void dump_string(char *output, int maxlen, void *value, int len)
output[maxlen] = '\0';
}
+static void dump_prefs(char *output, int maxlen, void *value, int len)
+{
+ struct ast_codec_pref pref;
+ int total_len = 0;
+
+ maxlen--;
+ total_len = maxlen;
+
+ if (maxlen > len)
+ maxlen = len;
+
+ strncpy(output,value, maxlen);
+ output[maxlen] = '\0';
+
+ ast_codec_pref_convert(&pref, output, total_len, 0);
+ memset(output,0,total_len);
+ ast_codec_pref_string(&pref, output, total_len);
+}
+
static void dump_int(char *output, int maxlen, void *value, int len)
{
if (len == (int)sizeof(unsigned int))
@@ -208,6 +227,7 @@ static struct iax2_ie {
{ IAX_IE_CAUSECODE, "CAUSE CODE", dump_byte },
{ IAX_IE_ENCRYPTION, "ENCRYPTION", dump_short },
{ IAX_IE_ENCKEY, "ENCRYPTION KEY" },
+ { IAX_IE_CODEC_PREFS, "CODEC_PREFS", dump_prefs },
};
static struct iax2_ie prov_ies[] = {
@@ -564,6 +584,9 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
case IAX_IE_PASSWORD:
ies->password = data + 2;
break;
+ case IAX_IE_CODEC_PREFS:
+ ies->codec_prefs = data + 2;
+ break;
case IAX_IE_CAPABILITY:
if (len != (int)sizeof(unsigned int)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);