use of org.pjsip.pjsua2.Endpoint in project crnk-framework by crnk-project.
the class AbstractBraveModuleTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
Endpoint localEndpoint = Endpoint.newBuilder().serviceName("testClient").build();
clientReporter = Mockito.mock(Reporter.class);
Tracing clientTracing = Tracing.newBuilder().spanReporter(clientReporter).localEndpoint(localEndpoint).build();
client = new CrnkClient(getBaseUri().toString());
client.setHttpAdapter(httpAdapter);
client.addModule(BraveClientModule.create(clientTracing));
taskRepo = client.getRepositoryForType(Task.class);
TaskRepository.clear();
ProjectRepository.clear();
httpAdapter.setReceiveTimeout(10000, TimeUnit.SECONDS);
}
use of org.pjsip.pjsua2.Endpoint in project vialer-android by VoIPGRID.
the class SipConfig method createEndpoint.
/**
* Create the Endpoint and init/start the Endpoint.
* @return
* @throws LibraryInitFailedException
*/
private Endpoint createEndpoint() throws LibraryInitFailedException {
mRemoteLogger.d("createEndpoint");
Endpoint endpoint = new Endpoint();
EpConfig endpointConfig = new EpConfig();
// Set echo cancellation options for endpoint.
MediaConfig mediaConfig = createMediaConfig(endpointConfig);
endpointConfig.setMedConfig(mediaConfig);
try {
endpoint.libCreate();
} catch (Exception e) {
Log.e(TAG, "Unable to create the PJSIP library");
mRemoteLogger.e("" + Log.getStackTraceString(e));
e.printStackTrace();
throw new LibraryInitFailedException();
}
if (BuildConfig.DEBUG || mSipService.getPreferences().remoteLoggingIsActive()) {
setSipLogging(endpointConfig);
}
UaConfig uaConfig = endpointConfig.getUaConfig();
uaConfig.setUserAgent(getUserAgentHeader(mSipService));
configureStunServer(uaConfig);
try {
endpoint.libInit(endpointConfig);
} catch (Exception e) {
Log.e(TAG, "Unable to init the PJSIP library");
mRemoteLogger.e("" + Log.getStackTraceString(e));
e.printStackTrace();
throw new LibraryInitFailedException();
}
TransportConfig transportConfig = createTransportConfig();
try {
mCurrentTransportId = endpoint.transportCreate(getTransportType(), transportConfig);
endpoint.libStart();
} catch (Exception exception) {
Log.e(TAG, "Unable to start the PJSIP library");
mRemoteLogger.e("" + Log.getStackTraceString(exception));
throw new LibraryInitFailedException();
}
return endpoint;
}
use of org.pjsip.pjsua2.Endpoint in project cloudbreak by hortonworks.
the class OpenStackClient method getRegion.
public Set<String> getRegion(CloudCredential cloudCredential) {
Access access = createAccess(cloudCredential);
Token token = createToken(cloudCredential);
Set<String> regions = new HashSet<>();
if (token == null && access == null) {
throw new CloudConnectorException("Unsupported keystone version");
} else if (token != null) {
for (Service service : token.getCatalog()) {
for (Endpoint endpoint : service.getEndpoints()) {
regions.add(endpoint.getRegion());
}
}
} else {
for (Access.Service service : access.getServiceCatalog()) {
for (org.openstack4j.model.identity.v2.Endpoint endpoint : service.getEndpoints()) {
regions.add(endpoint.getRegion());
}
}
}
LOGGER.info("regions from openstack: {}", regions);
return regions;
}
use of org.pjsip.pjsua2.Endpoint in project zipkin by openzipkin.
the class JacksonSpanDecoder method parseEndpoint.
static Endpoint parseEndpoint(JsonParser jsonParser) throws IOException {
if (!jsonParser.isExpectedStartObjectToken()) {
throw new IOException("Not a valid JSON object, start token: " + jsonParser.currentToken());
}
String serviceName = null, ipv4 = null, ipv6 = null;
int port = 0;
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
String fieldName = jsonParser.currentName();
JsonToken value = jsonParser.nextToken();
if (value == JsonToken.VALUE_NULL) {
continue;
}
switch(fieldName) {
case "serviceName":
serviceName = jsonParser.getValueAsString();
break;
case "ipv4":
ipv4 = jsonParser.getValueAsString();
break;
case "ipv6":
ipv6 = jsonParser.getValueAsString();
break;
case "port":
port = jsonParser.getValueAsInt();
break;
default:
jsonParser.skipChildren();
}
}
if (serviceName == null && ipv4 == null && ipv6 == null && port == 0)
return null;
return Endpoint.newBuilder().serviceName(serviceName).ip(ipv4).ip(ipv6).port(port).build();
}
use of org.pjsip.pjsua2.Endpoint in project zipkin by openzipkin.
the class ProtobufSpanDecoder method decodeEndpoint.
private static Endpoint decodeEndpoint(CodedInputStream input) throws IOException {
Endpoint.Builder endpoint = Endpoint.newBuilder();
boolean done = false;
while (!done) {
int tag = input.readTag();
switch(tag) {
case 0:
done = true;
break;
case 10:
{
endpoint.serviceName(input.readStringRequireUtf8());
break;
}
case 18:
case 26:
{
endpoint.parseIp(input.readByteArray());
break;
}
case 32:
{
endpoint.port(input.readInt32());
break;
}
default:
{
logAndSkip(input, tag);
break;
}
}
}
return endpoint.build();
}
Aggregations