-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performing IP switch based on the pjsip logs.
- Loading branch information
jeremy.norman
committed
Mar 13, 2018
1 parent
063636e
commit 12118c6
Showing
3 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/voipgrid/vialer/logging/sip/SipLogHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.voipgrid.vialer.logging.sip; | ||
|
||
import android.content.Intent; | ||
|
||
import com.voipgrid.vialer.VialerApplication; | ||
|
||
/** | ||
* Performs various actions based on the result of the pjsip logs. | ||
*/ | ||
public class SipLogHandler { | ||
|
||
private static final String NETWORK_UNAVAILABLE = "Error sending RTP: Network is unreachable"; | ||
|
||
public static final String NETWORK_UNAVAILABLE_BROADCAST = "com.voipgrid.vialer.logging.sip.NETWORK_UNAVAILABLE_BROADCAST"; | ||
|
||
/** | ||
* Perform various tasks based on pjsip logs. | ||
* | ||
* @param log | ||
*/ | ||
public void handle(String log) { | ||
if(log == null) return; | ||
|
||
if(log.contains(NETWORK_UNAVAILABLE)) { | ||
performNetworkSwitch(); | ||
} | ||
} | ||
|
||
/** | ||
* When pjsip is reporting that the network is unreachable, we will send out a broadcast so that | ||
* the IP can be updated and RTP can be resumed. | ||
* | ||
*/ | ||
private void performNetworkSwitch() { | ||
VialerApplication.get().sendBroadcast(new Intent(SipLogHandler.NETWORK_UNAVAILABLE_BROADCAST)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters