Fixes informing for new voice messages when there is no detail information.

cusax-fix
Damian Minkov 15 years ago
parent 7c5bced04c
commit f4a87bc373

@ -424,12 +424,17 @@ protected void processActiveRequest(
BufferedReader input = new BufferedReader(new InputStreamReader(
new ByteArrayInputStream(rawContent)));
String line;
boolean messageWaiting = false;
boolean eventFired = false;
while((line = input.readLine()) != null)
{
String lcaseLine = line.toLowerCase();
if(lcaseLine.startsWith("messages-waiting"))
{
// we fire event for every message notification
String messageWaitingStr =
line.substring(line.indexOf(":") + 1).trim();
if(messageWaitingStr.equalsIgnoreCase("yes"))
messageWaiting = true;
}
else if(lcaseLine.startsWith("message-account"))
{
@ -460,9 +465,29 @@ else if(lcaseLine.startsWith(MessageType.VOICE.toString())
Integer.valueOf(matcher.group(2)),
Integer.valueOf(matcher.group(3)),
Integer.valueOf(matcher.group(4)));
eventFired = true;
}
}
}
// as defined in rfc3842
//'In some cases, detailed message summaries are not available.'
// this is a simple workaround that will trigger a notification
// for one message so we can inform the user that there are
// messages waiting
// FIXME: account is null, UI will throw NPE when trying to
// call account mailbox, account is also not mandatory
if(messageWaiting && !eventFired)
{
// what is the account to call for retrieving messages?
fireVoicemailNotificationEvent(
MessageType.VOICE.toString(),
null,
1,
0,
0,
0);
}
}
catch(IOException ex)
{

Loading…
Cancel
Save