char tmpin[AST_CONFIG_MAX_PATH];
char tmpout[AST_CONFIG_MAX_PATH];
char *user, *pass, *rest, *trim;
- 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 *)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);
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)) {
/* Read in the line */
/* Can't think of how other diffs might be helpful, but I'm sure somebody will think of something. */
#endif
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
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
#if 0
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 */
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)
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);
}
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");
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 */