I am looking to develop a voice communication application, I set up an asterisk server and I want to integrate a sip client in my android application. After intensive research on the net, I found no documentation to integrate liblinphone 4 in an android project. Does anyone have an idea? Currently I have integrated this code trying to understand a little example in C of an old version of liblinphone:
(But i have this error : Linphone: Contact has not been fixed, stack will do, i think that if i can fixed contact, I could make registration)
Core core = Factory.instance().createCore(null, null, this);
ProxyConfig proxyConfig = core.createProxyConfig();
Factory.instance().setDebugMode(true, "Linphone");
AuthInfo authInfos;
Address from = Factory.instance().createAddress("sip:112#**.*.*.*");
proxyConfig.setIdentityAddress(from);
proxyConfig.setServerAddr(from.getDomain());
proxyConfig.enableRegister(true);
proxyConfig.setRealm("**.*.*.*");
proxyConfig.setContactParameters("**.*.*.*");
proxyConfig.done();
Address to = Factory.instance().createAddress("sip:105#*.*.*.*");
authInfos = Factory.instance().createAuthInfo(from.getUsername(), null, "*****", null, null, null);
// You must provide the Android app context as createCore last param !
authInfos.setDomain("**.*.*.*");
authInfos.setUsername("112");
authInfos.setPassword("*****");
authInfos.setUserid("112");
core.addAuthInfo(authInfos);
core.setPrimaryContact("sip:112#**.*.*.*");
core.addProxyConfig(proxyConfig);
core.start();
core.inviteAddress(to);
System.out.println("initialization is ok???");
Finally, I followed another track. Doubango, the examples concerning imsdroid. It was necessary to solve problems of dependence but I reassure you that it is better than all the lost time to look for simple bookstores. At the time when I answer my post, I was able to make a call on my server, I will test the other features shortly. But already, the actual joy that I have .... I was starting to be desperate with all the paid bookstores on the market and the lack of liblinphone documentation. Thank you Doubango, if I have enough time, I will write a tutorial on it. Here is the github repository: https://github.com/DoubangoTelecom
Related
I just started programming a new Discord bot for myself to see what I am able to create. Currently, I'm working on an Autorole feature but I just don't get why the Bot doesn't get triggered by a MemberJoinEvent.
Here is my code:
gateway.getEventDispatcher().on(MemberJoinEvent.class).subscribe(memberJoinEvent -> {
final Member member = memberJoinEvent.getMember();
System.out.println(member.toString());
});
I found the problem! I didnt know that discord changed something in their developer portal. Also I used my old project so I didnt notice it.
You have to manualy enable it in the developer portal, that the bot can access member information. A screenshot of the location to enable the gateway feature
In addition to leguans answer, I also had to request the gateway intents as well!
GatewayDiscordClient gatewayDiscordClient() {
return discordClient()
.gateway()
.setEnabledIntents(IntentSet.all())
.login()
.block();
}
https://docs.discord4j.com/migrating-from-v3-1-to-v3-2/#gateway-intents
I'm trying to create an OSGi bundle that'd be installed on a eurotech gateway (reliagate 10 05).
This bundle would essentially connect the gateway to a BLE device.
To do so, I use a framework provided by eurotech called Everyware™ Software Framework (ESF) that adds up an extra layer on top of the kura v1.2.0 framework.
The catch is, the BLE device only accepts random static address type.
I managed to connect the gateway manually to the BLE device using the following commands in console:
hcitool -i hci0 lecc --random <BD_ADDR>
then
gatttool -i hci0 -b <BD_ADDR> --interactive
This works fine. The hard part is when I try to do the same thing in code using the ESF/kura framework.
Here's a snippet from a sample I use that I found on this page
public boolean connect(String adapterName) {
this.bluetoothGatt = this.device.getBluetoothGatt();
boolean connected = false;
try {
connected = this.bluetoothGatt.connect(adapterName);
} catch (KuraException e) {
logger.error(e.toString());
}
if (connected) {
this.bluetoothGatt.setBluetoothLeNotificationListener(this);
this.isConnected = true;
return true;
} else {
// If connect command is not executed, close gatttool
this.bluetoothGatt.disconnect();
this.isConnected = false;
return false;
}
}
Here is a list of some objects that the sample uses to scan and establish a connection:
org.eclipse.kura.bluetooth.BluetoothAdapter;
org.eclipse.kura.bluetooth.BluetoothDevice;
org.eclipse.kura.bluetooth.BluetoothGattSecurityLevel;
org.eclipse.kura.bluetooth.BluetoothGattService;
org.eclipse.kura.bluetooth.BluetoothLeScanListener;
org.eclipse.kura.bluetooth.BluetoothService;
org.eclipse.kura.bluetooth.BluetoothDevice;
org.eclipse.kura.bluetooth.BluetoothGatt;
org.eclipse.kura.bluetooth.BluetoothGattCharacteristic;
org.eclipse.kura.bluetooth.BluetoothLeNotificationListener;
So I searched through the api doc but didn't find anything.
Though, one interesting SO post mentions a command code to send to the device.
I found a method in kura framework that might help.
Here's the signature:
void ExecuteCmd(java.lang.String ogf, java.lang.String ocf, java.lang.String parameter)
but I couldn't figure out the OpCode Group Field (ogf) associated to the OpCode Command Field(ocf) in any documentation (I skimmed the ~2300 pages of the Bluetooth 4.0 core spec). If anyone knows where to search... :)
In the end, the question is: is there a way to set the address type to random (as with the hcitool command) with the kura framework ?
Or am I totally misleaded ? :/
Anyway, I'm really new to the kura and ble ecosystems so, sorry if it looks like an obvious thing to do but I feel like I'm running out of inspiration and could totally use a hand!
PS: Congrats if you made it to the end!
Haha lol. Kura seems to just start a gatttool process, send commands in text, and parse the output as its interface...
Here is where it is stated, using the address as parameter: https://github.com/eclipse/kura/blob/0339ac787f90debdfc270c1dee0c16de16ea6f7e/kura/org.eclipse.kura.linux.bluetooth/src/main/java/org/eclipse/kura/linux/bluetooth/util/BluetoothUtil.java#L319. Unfortunately the Kura developers seem to have missed that there is something called Random Address in the BLE standard and I don't see how that could be worked around using the current API.
Okay so for those who find themselves in my position in the future, I just received an answer from the Eurotech support team.
Dear Mr. Carneiro,
[...]
Regarding the random BD_ADDR, this is a configuration of the BLE device.
So, your BLE device is advertising an address of type random, not public, and you should specify the address type on the connection string, as you already did.
Unfortunately, current Kura Bluetooth API doesn't provide a way to specify the type of address into the connection string. We are developing a new set of APIs for BLE that will be available on preview on the next Kura/ESF release, but the Reliagate 10-05 will not support these yet.
I recently set up a website and pushed it to production using Digital Ocean. However, I noticed that for both SEO purposes and to make Facebook Share work appropriately, I should set up my server to redirect www. requests to non-www. I'm running Play! Java 2.3 with a PostgreSQL database and the default Netty server. Any advice would be greatly appreciated.
There are lots of ways of redirecting. I wouldn't say DNS-redirects are the correct and only way of doing it, it's one way. Google is just fine with you doing a 301 redirect with Play.
Here's one way of accomplishing it with Play! filters (scala):
object NonWwwFilter extends Filter {
def apply(f:RequestHeader => Future[Result])(rh: RequestHeader): Future[Result] =
if (rh.host.startsWith("www.")) {
Future.successful(Results.MovedPermanently("https://" + rh.host.substring(4) + rh.uri))
} else {
f(rh)
}
}
The right way to do it is to do in not on the framework/webserver side, but on the DNS-server side.
You can do it in DNS-management area of GoDaddy or any other domain name registrar.
I am new to android development & I am trying to create an app which connects to available wifi network for data communication. There are various security types for wifi network configuration.(EX WEP, etc). How to know which network is using which security type?
& after knowing that, how to connect to particular network.
I've searched a lot for my problem, & found this:
WEP Network requires:
wifiConfigObj.wepKeys[0] = "\"" + networkPass + "\"";
wifiConfigObj.wepTxKeyIndex = 0;
wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
wifiConfigObj.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
EAP Network requires:
wifiConfigObj.preSharedKey = "\""+ networkPass +"\"";
Public Network requires
wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
But still I am unable to get any clarity. Please Let me know how to get through it.
Thanks..
See answer given by ayj in this question.
In case link doesn't work in future, let me copy paste it for you here.
You need to parse the ScanResult's capabilities string in the scanComplete method. According to the Android developer documentation, :
ScanResult.capabilities describes the authentication, key management, and
encryption schemes supported by the access point.
You might be able to make use of -- or at the very least use as an example -- the static helper methods available in the AccessPointState class.
AccessPointState.getScanResultSecurity
AccessPointState.isEnterprise
I have a JBOSS batch application that sometimes sends hundreds on emails in a minute to the same email address with Log4J errors. This causes problems with Gmail, because it says we are sending emails too quickly for that gmail account.
So I was wondering if there was a way to basically create a "digest" or "aggregate" email puts all the error logs in 1 email and sends that every 5 minutes. So that way every 5 minutes we may get a large email, but at least we actually get the email instead of it being delayed for hours and hours by gmail servers rejecting it.
I read this post that suggested something about using an evaluator to do that, but I couldn't see how that is configured in the Log4J xml configuration file. It also seemed like it might not be able to "digest" all the logs into 1 email anyway.
Has anyone done this before? Or know if it's possible?
From (the archived) SMTPAppender Usage page:
set this property
log4j.appender.myMail.evaluatorClass = com.mydomain.example.MyEvaluator
Now you have to create the evaluator class and implement the org.apache.log4j.spi.TriggeringEventEvaluator interface and place this class in a path where log4j can access it.
//Example TriggeringEventEvaluator impl
package com.mydomain.example;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.spi.TriggeringEventEvaluator;
public class MyEvaluator implements TriggeringEventEvaluator {
public boolean isTriggeringEvent(LoggingEvent event) {
return true;
}
}
You have to write the evaluator logic within this method.
I created a free useable solution for log4j2 with an ExtendedSmtpAppender.
(If you still use log4j 1.x, simply replace your log4j-1.x.jar with log4j-1.2-api-2.x.jar - and log4j-core-2.x.jar + log4j-api-2.x.jar of course.)
You get it from Maven Central as de.it-tw:log4j2-extras (This requires Java 7+ and log4j 2.8+).
If you are restricted to Java 6 (and thus log4j 2.3) then use de.it-tw:log4j2-Java6-extras
Additionally, see the GitLab project: https://gitlab.com/thiesw/log4j2-extras (or https://gitlab.com/thiesw/log4j2-Java6-extras)
[OLD text:
If you use log4j2, see answer to other stack overflow issue: https://stackoverflow.com/a/34072704/5074004
Or directly go to my external but publically available solution presented in https://issues.apache.org/jira/browse/LOG4J2-1192
]