Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv30822/channels
Modified Files:
chan_sip.c
Log Message:
Keep voicemail from segging on a permissions problem (bug #245)
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- chan_sip.c 17 Sep 2003 20:51:53 -0000 1.179
+++ chan_sip.c 25 Sep 2003 13:18:03 -0000 1.180
@@ -187,6 +187,7 @@
int alreadygone; /* Whether or not we've already been destroyed by or peer */
int needdestroy; /* if we need to be destroyed */
int capability; /* Special capability */
+ int jointcapability; /* Supported capability at both ends */
int noncodeccapability;
int outgoing; /* Outgoing or incoming call? */
int authtries; /* Times we've tried to authenticate */
@@ -1224,9 +1225,11 @@
if (tmp) {
/* Select our native format based on codec preference until we receive
something from another device to the contrary. */
- if (i->capability)
+ if (i->jointcapability)
+ tmp->nativeformats = sip_codec_choose(i->jointcapability);
+ else if (i->capability)
tmp->nativeformats = sip_codec_choose(i->capability);
- else
+ else
tmp->nativeformats = sip_codec_choose(capability);
fmt = ast_best_codec(tmp->nativeformats);
if (title)
@@ -1847,24 +1850,24 @@
if (p->vrtp)
ast_rtp_get_current_formats(p->vrtp,
&vpeercapability, &vpeernoncodeccapability);
- p->capability = capability & (peercapability | vpeercapability);
+ p->jointcapability = p->capability & (peercapability | vpeercapability);
p->noncodeccapability = noncodeccapability & (peernoncodeccapability | vpeernoncodeccapability);
if (sipdebug) {
ast_verbose("Capabilities: us - %d, them - %d/%d, combined - %d\n",
- capability, peercapability, vpeercapability, p->capability);
+ p->capability, peercapability, vpeercapability, p->jointcapability);
ast_verbose("Non-codec capabilities: us - %d, them - %d, combined - %d\n",
noncodeccapability, peernoncodeccapability,
p->noncodeccapability);
}
- if (!p->capability) {
+ if (!p->jointcapability) {
ast_log(LOG_WARNING, "No compatible codecs!\n");
return -1;
}
if (p->owner) {
- if (!(p->owner->nativeformats & p->capability)) {
- ast_log(LOG_DEBUG, "Oooh, we need to change our formats since our peer supports only %d and not %d\n", p->capability, p->owner->nativeformats);
- p->owner->nativeformats = sip_codec_choose(p->capability);
+ if (!(p->owner->nativeformats & p->jointcapability)) {
+ ast_log(LOG_DEBUG, "Oooh, we need to change our formats since our peer supports only %d and not %d\n", p->jointcapability, p->owner->nativeformats);
+ p->owner->nativeformats = sip_codec_choose(p->jointcapability);
ast_set_read_format(p->owner, p->owner->readformat);
ast_set_write_format(p->owner, p->owner->writeformat);
}
@@ -4128,8 +4131,9 @@
while(cur) {
if (!strcasecmp(cur->callid, argv[3])) {
ast_cli(fd, "Call-ID: %s\n", cur->callid);
- ast_cli(fd, "Codec Capability: %d\n", cur->capability);
+ ast_cli(fd, "Our Codec Capability: %d\n", cur->capability);
ast_cli(fd, "Non-Codec Capability: %d\n", cur->noncodeccapability);
+ ast_cli(fd, "Joint Codec Capability: %d\n", cur->jointcapability);
ast_cli(fd, "Theoretical Address: %s:%d\n", inet_ntoa(cur->sa.sin_addr), ntohs(cur->sa.sin_port));
ast_cli(fd, "Received Address: %s:%d\n", inet_ntoa(cur->recv.sin_addr), ntohs(cur->recv.sin_port));
ast_cli(fd, "NAT Support: %s\n", cur->nat ? "Yes" : "No");
@@ -4831,7 +4835,7 @@
if (process_sdp(p, req))
return -1;
} else {
- p->capability = capability;
+ p->jointcapability = p->capability;
ast_log(LOG_DEBUG, "Hm.... No sdp for the moemnt\n");
}
/* Queue NULL frame to prod ast_rtp_bridge if appropriate */
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum