mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 00:30:20 +00:00
Keep voicemail from segging on a permissions problem (bug #245)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -375,10 +375,24 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
|
|||||||
char tmpin[AST_CONFIG_MAX_PATH];
|
char tmpin[AST_CONFIG_MAX_PATH];
|
||||||
char tmpout[AST_CONFIG_MAX_PATH];
|
char tmpout[AST_CONFIG_MAX_PATH];
|
||||||
char *user, *pass, *rest, *trim;
|
char *user, *pass, *rest, *trim;
|
||||||
snprintf((char *)tmpin, sizeof(tmpin)-1, "%s/voicemail.conf",(char *)ast_config_AST_CONFIG_DIR);
|
snprintf((char *)tmpin, sizeof(tmpin)-1, "%s/voicemail.conf",(char *)ast_config_AST_CONFIG_DIR);
|
||||||
snprintf((char *)tmpout, sizeof(tmpout)-1, "%s/voicemail.conf.new",(char *)ast_config_AST_CONFIG_DIR);
|
snprintf((char *)tmpout, sizeof(tmpout)-1, "%s/voicemail.conf.new",(char *)ast_config_AST_CONFIG_DIR);
|
||||||
configin = fopen((char *)tmpin,"r");
|
configin = fopen((char *)tmpin,"r");
|
||||||
configout = fopen((char *)tmpout,"w+");
|
if (configin)
|
||||||
|
configout = fopen((char *)tmpout,"w+");
|
||||||
|
else
|
||||||
|
configout = NULL;
|
||||||
|
if(!configin || !configout) {
|
||||||
|
if (configin)
|
||||||
|
fclose(configin);
|
||||||
|
else
|
||||||
|
ast_log(LOG_WARNING, "Warning: Unable to open '%s' for reading: %s\n", tmpin, strerror(errno));
|
||||||
|
if (configout)
|
||||||
|
fclose(configout);
|
||||||
|
else
|
||||||
|
ast_log(LOG_WARNING, "Warning: Unable to open '%s' for writing: %s\n", tmpout, strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while (!feof(configin)) {
|
while (!feof(configin)) {
|
||||||
/* Read in the line */
|
/* Read in the line */
|
||||||
@@ -1955,7 +1969,7 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
|
|||||||
/* Can't think of how other diffs might be helpful, but I'm sure somebody will think of something. */
|
/* Can't think of how other diffs might be helpful, but I'm sure somebody will think of something. */
|
||||||
#endif
|
#endif
|
||||||
if (the_zone)
|
if (the_zone)
|
||||||
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, &(the_zone->timezone));
|
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone);
|
||||||
else
|
else
|
||||||
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
|
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ static struct sip_pvt {
|
|||||||
int alreadygone; /* Whether or not we've already been destroyed by or peer */
|
int alreadygone; /* Whether or not we've already been destroyed by or peer */
|
||||||
int needdestroy; /* if we need to be destroyed */
|
int needdestroy; /* if we need to be destroyed */
|
||||||
int capability; /* Special capability */
|
int capability; /* Special capability */
|
||||||
|
int jointcapability; /* Supported capability at both ends */
|
||||||
int noncodeccapability;
|
int noncodeccapability;
|
||||||
int outgoing; /* Outgoing or incoming call? */
|
int outgoing; /* Outgoing or incoming call? */
|
||||||
int authtries; /* Times we've tried to authenticate */
|
int authtries; /* Times we've tried to authenticate */
|
||||||
@@ -1224,9 +1225,11 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
|
|||||||
if (tmp) {
|
if (tmp) {
|
||||||
/* Select our native format based on codec preference until we receive
|
/* Select our native format based on codec preference until we receive
|
||||||
something from another device to the contrary. */
|
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);
|
tmp->nativeformats = sip_codec_choose(i->capability);
|
||||||
else
|
else
|
||||||
tmp->nativeformats = sip_codec_choose(capability);
|
tmp->nativeformats = sip_codec_choose(capability);
|
||||||
fmt = ast_best_codec(tmp->nativeformats);
|
fmt = ast_best_codec(tmp->nativeformats);
|
||||||
if (title)
|
if (title)
|
||||||
@@ -1847,24 +1850,24 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
|
|||||||
if (p->vrtp)
|
if (p->vrtp)
|
||||||
ast_rtp_get_current_formats(p->vrtp,
|
ast_rtp_get_current_formats(p->vrtp,
|
||||||
&vpeercapability, &vpeernoncodeccapability);
|
&vpeercapability, &vpeernoncodeccapability);
|
||||||
p->capability = capability & (peercapability | vpeercapability);
|
p->jointcapability = p->capability & (peercapability | vpeercapability);
|
||||||
p->noncodeccapability = noncodeccapability & (peernoncodeccapability | vpeernoncodeccapability);
|
p->noncodeccapability = noncodeccapability & (peernoncodeccapability | vpeernoncodeccapability);
|
||||||
|
|
||||||
if (sipdebug) {
|
if (sipdebug) {
|
||||||
ast_verbose("Capabilities: us - %d, them - %d/%d, combined - %d\n",
|
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",
|
ast_verbose("Non-codec capabilities: us - %d, them - %d, combined - %d\n",
|
||||||
noncodeccapability, peernoncodeccapability,
|
noncodeccapability, peernoncodeccapability,
|
||||||
p->noncodeccapability);
|
p->noncodeccapability);
|
||||||
}
|
}
|
||||||
if (!p->capability) {
|
if (!p->jointcapability) {
|
||||||
ast_log(LOG_WARNING, "No compatible codecs!\n");
|
ast_log(LOG_WARNING, "No compatible codecs!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (p->owner) {
|
if (p->owner) {
|
||||||
if (!(p->owner->nativeformats & 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->capability, p->owner->nativeformats);
|
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->capability);
|
p->owner->nativeformats = sip_codec_choose(p->jointcapability);
|
||||||
ast_set_read_format(p->owner, p->owner->readformat);
|
ast_set_read_format(p->owner, p->owner->readformat);
|
||||||
ast_set_write_format(p->owner, p->owner->writeformat);
|
ast_set_write_format(p->owner, p->owner->writeformat);
|
||||||
}
|
}
|
||||||
@@ -4128,8 +4131,9 @@ static int sip_show_channel(int fd, int argc, char *argv[])
|
|||||||
while(cur) {
|
while(cur) {
|
||||||
if (!strcasecmp(cur->callid, argv[3])) {
|
if (!strcasecmp(cur->callid, argv[3])) {
|
||||||
ast_cli(fd, "Call-ID: %s\n", cur->callid);
|
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, "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, "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, "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");
|
ast_cli(fd, "NAT Support: %s\n", cur->nat ? "Yes" : "No");
|
||||||
@@ -4831,7 +4835,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
|
|||||||
if (process_sdp(p, req))
|
if (process_sdp(p, req))
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
p->capability = capability;
|
p->jointcapability = p->capability;
|
||||||
ast_log(LOG_DEBUG, "Hm.... No sdp for the moemnt\n");
|
ast_log(LOG_DEBUG, "Hm.... No sdp for the moemnt\n");
|
||||||
}
|
}
|
||||||
/* Queue NULL frame to prod ast_rtp_bridge if appropriate */
|
/* Queue NULL frame to prod ast_rtp_bridge if appropriate */
|
||||||
|
|||||||
Reference in New Issue
Block a user