Skip to content
Snippets Groups Projects
Commit 1e217d4e authored by Yun Liu's avatar Yun Liu
Browse files
parents f0594dad 8c4cba3d
No related branches found
No related tags found
No related merge requests found
...@@ -277,10 +277,6 @@ CodecDescriptor::seemsValid( std::string lib) ...@@ -277,10 +277,6 @@ CodecDescriptor::seemsValid( std::string lib)
return false; return false;
#ifdef HAVE_SPEEX
printf("cadvfsdgvssbsdfbdgfffffffffffffffffffffffffffffffffffffffff\n");
#endif
#ifdef HAVE_SPEEX #ifdef HAVE_SPEEX
// Nothing special // Nothing special
#else #else
......
...@@ -334,6 +334,8 @@ void PulseLayer::writeToSpeaker( void ) ...@@ -334,6 +334,8 @@ void PulseLayer::writeToSpeaker( void )
pa_stream_write( playback->pulseStream() , out , toGet , pa_xfree, 0 , PA_SEEK_RELATIVE); pa_stream_write( playback->pulseStream() , out , toGet , pa_xfree, 0 , PA_SEEK_RELATIVE);
} }
} }
//if(out) pa_xfree(out);
} }
void PulseLayer::readFromMic( void ) void PulseLayer::readFromMic( void )
......
...@@ -263,8 +263,6 @@ IAXVoIPLink::sendAudioFromMic(void) ...@@ -263,8 +263,6 @@ IAXVoIPLink::sendAudioFromMic(void)
// available bytes inside ringbuffer // available bytes inside ringbuffer
availBytesFromMic = audiolayer->canGetMic(); availBytesFromMic = audiolayer->canGetMic();
_debug("max bytes=%i - avail = %i\n", maxBytesToGet, availBytesFromMic);
if (availBytesFromMic < maxBytesToGet) { if (availBytesFromMic < maxBytesToGet) {
// We need packets full! // We need packets full!
return; return;
...@@ -752,7 +750,7 @@ IAXVoIPLink::iaxHandleVoiceEvent(iax_event* event, IAXCall* call) ...@@ -752,7 +750,7 @@ IAXVoIPLink::iaxHandleVoiceEvent(iax_event* event, IAXCall* call)
IAXVoIPLink::iaxHandleRegReply(iax_event* event) IAXVoIPLink::iaxHandleRegReply(iax_event* event)
{ {
int voicemail; int new_voicemails;
std::string account_id; std::string account_id;
if (event->etype == IAX_EVENT_REGREJ) { if (event->etype == IAX_EVENT_REGREJ) {
...@@ -770,11 +768,11 @@ IAXVoIPLink::iaxHandleRegReply(iax_event* event) ...@@ -770,11 +768,11 @@ IAXVoIPLink::iaxHandleRegReply(iax_event* event)
// Looking for the voicemail information // Looking for the voicemail information
//if( event->ies != 0 ) //if( event->ies != 0 )
voicemail = event->ies.msgcount; new_voicemails = processIAXMsgCount(event->ies.msgcount);
_debug("iax voicemail number notification: %i\n", voicemail); _debug("iax voicemail number notification: %i\n", new_voicemails);
// Notify the client if new voicemail waiting for the current account // Notify the client if new voicemail waiting for the current account
account_id = getAccountID(); account_id = getAccountID();
Manager::instance().startVoiceMessageNotification(account_id.c_str(), voicemail); Manager::instance().startVoiceMessageNotification(account_id.c_str(), new_voicemails);
iax_destroy(_regSession); iax_destroy(_regSession);
_mutexIAX.leaveMutex(); _mutexIAX.leaveMutex();
...@@ -787,6 +785,28 @@ IAXVoIPLink::iaxHandleRegReply(iax_event* event) ...@@ -787,6 +785,28 @@ IAXVoIPLink::iaxHandleRegReply(iax_event* event)
} }
} }
int IAXVoIPLink::processIAXMsgCount( int msgcount )
{
// IAX sends the message count under a specific format:
// 1
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | 0x18 | 0x02 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Old messages | New messages |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// For now we just need the new messages informations.
// Thus:
// 0 <= msgcount <= 255 => msgcount new messages, 0 old messages
// msgcount >= 256 => msgcount/256 old messages , msgcount%256 new messages (RULES)
return msgcount%256;
}
void void
IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event) IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event)
{ {
......
...@@ -191,6 +191,17 @@ class IAXVoIPLink : public VoIPLink ...@@ -191,6 +191,17 @@ class IAXVoIPLink : public VoIPLink
void updateAudiolayer( void ); void updateAudiolayer( void );
private: private:
/*
* Decode the message count IAX send.
* Returns only the new messages number
*
* @param msgcount The value sent by IAX in the REGACK message
* @return int The number of new messages waiting for the current registered user
*/
int processIAXMsgCount( int msgcount );
/** /**
* Get IAX Call from an id * Get IAX Call from an id
* @param id CallId * @param id CallId
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment