< Previous by Date | Date Index | Next by Date > |
Thread Index | Next in Thread > |
Hello resiprocate developers. In order to implement MWI feature in my application I made simple
notifier that works as my voice mail server and sends towards me NOTIFY
messages with bodies using MessageWaitingContexts class. For example, in ServerSubscriptionHandler::onNewSubscription () I call: Data Txt ("Messages-Waiting: yes\r\n" "Message-Account: sip:a@xxxxxxxxxxx\r\n" "Voice-Message: 2/1 (1/0)\r\n"); HeaderFieldValue Hfv (Txt.begin (), Txt.size ()); MessageWaitingContexts Mwc (& Hfv, Mime ("application",
"message-summary"); Unfortunately, encoder of MessageWaitingContexts class produces a bit
wrong output and after the message is encoded I get exactly following: Messages-Waiting: yes\r\n sip:a@xxxxxxxxxxxxxxxxxxxxxxxx: 2/1(1/0\r\n That is the encoder doesn't place "Message-Account:" at the
start of the second line, doesn't add "\r\n" at its end, forgets to
place space character before '(' in case there are urgent messages and doesn't
add ')' after urgent counters. I slightly changed encoder and now it works as expected. I get correct (to
my mind) output: Messages-Waiting: yes\r\n Message-Account: sip:a@xxxxxxxxxxx\r\n voice-message: 2/1 (1/0)\r\n Here are the changes (signed with “added by S.Y.”) I did in function MessageWaitingContents::encodeParsed:
... if (exists(mw_account)) { s
<< "Message-Account" << Symbols::COLON[0] <<
Symbols::SPACE[0]; //* added by S.Y. the entire line header(mw_account).encode(s); s << Symbols::CRLF;
//* added by S.Y. the entire line } for(int i = 0; i < (int)MW_MAX; i++) { if (mHeaders[i] != 0) { s <<
MessageHeaders[i] << Symbols::COLON[0] << Symbols::SPACE[0] <<
mHeaders[i]->mNew << Symbols::SLASH[0] <<
mHeaders[i]->mOld; if
(mHeaders[i]->mHasUrgent) { s <<
Symbols::SPACE[0] << Symbols::LPAREN[0] //* added by S.Y. SPACE[0] <<
mHeaders[i]->mUrgentNew << Symbols::SLASH[0] <<
mHeaders[i]->mUrgentOld << Symbols::RPAREN[0]; //* added by S.Y.
RPAREN[0] } s <<
Symbols::CRLF; } } ... Best regards, Sasha. |