Show a notification message when failed to set media on active channel.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4175 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2011-03-11 14:38:33 +00:00
parent fa7bcca52c
commit d8f69c7603
3 changed files with 57 additions and 0 deletions

View File

@ -5750,6 +5750,11 @@ bool DefaultLogic::handleClientChanUpdate(Message& msg, bool& stopLogic)
if (silence)
Client::self()->ringer(false,true);
}
if (chan) {
bool mic = chan->muted() || (0 != chan->getSource());
bool speaker = (0 != chan->getConsumer());
notifyNoAudio(!(mic && speaker),mic,speaker,chan);
}
break;
case ClientChannel::OnHold:
enableActions = true;
@ -6887,6 +6892,47 @@ bool DefaultLogic::handleFileTransferNotify(Message& msg, bool& stopLogic)
return true;
}
// Show/hide no audio notification (chan==0: initial check)
void DefaultLogic::notifyNoAudio(bool show, bool micOk, bool speakerOk,
ClientChannel* chan)
{
if (!Client::valid())
return;
Window* w = Client::self()->getWindow(s_wndMain);
if (!show) {
String id;
buildNotifAreaId(id,"noaudio",String::empty());
Client::self()->delTableRow("messages",id,w);
return;
}
if (micOk && speakerOk)
return;
NamedList list("");
NamedList* upd = buildNotifArea(list,"noaudio",String::empty(),
String::empty(),"Audio failure");
String text;
if (chan) {
text << "Failed to open ";
if (!(micOk || speakerOk))
text << "audio";
else if (micOk)
text << "speaker";
else
text << "microphone";
text << ".\r\nPlease check your sound card";
}
else
return;
upd->addParam("text",text);
setGenericNotif(*upd);
Client::self()->updateTableRows("messages",&list,false,w);
NamedList p("");
const char* ok = String::boolText(show);
p.addParam("check:messages_show",ok);
p.addParam("show:frame_messages",ok);
Client::self()->setParams(&p,w);
}
// Add/set an account
bool DefaultLogic::updateAccount(const NamedList& account, bool save,
const String& replace, bool loaded)

View File

@ -1979,6 +1979,7 @@ QTextEdit {
<string>property:_yate_itemui=incomingcall:messages_okrejignore.ui</string>
<string>property:_yate_itemui=incomingfile:messages_okrejignore.ui</string>
<string>property:_yate_itemui=rosterreqfail:messages_generic.ui</string>
<string>property:_yate_itemui=noaudio:messages_generic.ui</string>
</stringlist>
</property>
</widget>

View File

@ -3120,6 +3120,16 @@ protected:
*/
virtual bool handleFileTransferNotify(Message& msg, bool& stopLogic);
/**
* Show/hide no audio notification
* @param show Show or hide notification
* @param micOk False if microphone open failed
* @param speakerOk False if speaker open failed
* @param chan Optional failed channel
*/
virtual void notifyNoAudio(bool show, bool micOk = false, bool speakerOk = false,
ClientChannel* chan = 0);
String m_selectedChannel; // The currently selected channel
String m_transferInitiated; // Tranfer initiated id