diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-04-05 23:34:56 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-04-05 23:34:56 +0000 |
commit | 899e2d0fe0e767b9c8b6557e273514efbd4b54da (patch) | |
tree | a2305eba9473a2b024b26cedd866d2c82d544b3b | |
parent | 4c012d7a1f091d19d82f299ba66ea01154a4d77c (diff) |
report non-codec capabilities in 'sip debug' properly (bug #3960)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5416 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | channels/chan_sip.c | 6 | ||||
-rwxr-xr-x | include/asterisk/rtp.h | 3 | ||||
-rwxr-xr-x | rtp.c | 25 |
3 files changed, 29 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index cf56d9e1c..f0fb73304 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3012,9 +3012,9 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req) ast_getformatname_multiple(s4, slen, p->jointcapability)); ast_verbose("Non-codec capabilities: us - %s, peer - %s, combined - %s\n", - ast_getformatname_multiple(s1, slen, noncodeccapability), - ast_getformatname_multiple(s2, slen, peernoncodeccapability), - ast_getformatname_multiple(s3, slen, p->noncodeccapability)); + ast_rtp_lookup_mime_multiple(s1, slen, noncodeccapability, 0), + ast_rtp_lookup_mime_multiple(s2, slen, peernoncodeccapability, 0), + ast_rtp_lookup_mime_multiple(s3, slen, p->noncodeccapability, 0)); } if (!p->jointcapability) { ast_log(LOG_NOTICE, "No compatible codecs!\n"); diff --git a/include/asterisk/rtp.h b/include/asterisk/rtp.h index 03ac68f03..c2a6d5472 100755 --- a/include/asterisk/rtp.h +++ b/include/asterisk/rtp.h @@ -104,6 +104,9 @@ void ast_rtp_get_current_formats(struct ast_rtp* rtp, /* Mapping an Asterisk code into a MIME subtype (string): */ char* ast_rtp_lookup_mime_subtype(int isAstFormat, int code); +/* Build a string of MIME subtype names from a capability list */ +char *ast_rtp_lookup_mime_multiple(char *buf, int size, const int capability, const int isAstFormat); + void ast_rtp_setnat(struct ast_rtp *rtp, int nat); int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc); @@ -805,7 +805,7 @@ struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt) } /* Looks up an RTP code out of our *static* outbound list */ -int ast_rtp_lookup_code(struct ast_rtp* rtp, int isAstFormat, int code) { +int ast_rtp_lookup_code(struct ast_rtp* rtp, const int isAstFormat, const int code) { int pt; @@ -838,7 +838,7 @@ int ast_rtp_lookup_code(struct ast_rtp* rtp, int isAstFormat, int code) { return -1; } -char* ast_rtp_lookup_mime_subtype(int isAstFormat, int code) { +char* ast_rtp_lookup_mime_subtype(const int isAstFormat, const int code) { int i; @@ -850,6 +850,27 @@ char* ast_rtp_lookup_mime_subtype(int isAstFormat, int code) { return ""; } +char *ast_rtp_lookup_mime_multiple(char *buf, int size, const int capability, const int isAstFormat) +{ + int format; + + if (!buf || !size) + return NULL; + + snprintf(buf, size, "0x%x (", capability); + + for (format = 1; format < AST_RTP_MAX; format <<= 1) { + if (capability & format) { + const char *name = ast_rtp_lookup_mime_subtype(isAstFormat, format); + snprintf(buf + strlen(buf), size - strlen(buf), "%s|", name); + } + } + if (!ast_strlen_zero(buf)) + buf[strlen(buf)] = ')'; + + return buf; +} + static int rtp_socket(void) { int s; |