I'm trying to use the latest version of pjsip for android
https://github.com/VoiSmart/pjsip-android.
And got an error for incoming call:
Error creating SDP answer: SRTP crypto attribute required (PJMEDIA_SRTP_ESDPREQCRYPTO) [status=220228]
inv0x78653290a8 .Sending Response msg 406/INVITE/cseq=47488686 (tdta0x78bfbcf0a8)
Account configuration for use srtp
SrtpOpt opt = new SrtpOpt();
IntVector optVector = new IntVector();
optVector.add(pjmedia_srtp_keying_method.PJMEDIA_SRTP_KEYING_DTLS_SRTP);
optVector.add(pjmedia_srtp_keying_method.PJMEDIA_SRTP_KEYING_SDES);
opt.setKeyings(optVector);
accCfg.getMediaConfig().setSrtpOpt(opt);
accCfg.getMediaConfig().setSrtpUse(pjmedia_srtp_use.PJMEDIA_SRTP_OPTIONAL);
accCfg.getMediaConfig().setRtcpMuxEnabled(true);
accCfg.getMediaConfig().setSrtpSecureSignaling(0);
Looks like that missed a=crypto: attribute in sdp, but I don't understand how to include it.
However, old version that we used before - works and I don't understand the reason.
And I think if error in creating SDP answer then maybe problem is in incoming sdp.
Is it client or server problem?
Please, help me resolve it.
It was a server problem.
Works well after upgrade server and add a=crypto attribute into SDP.
Related
I'm setting TLS + SRTP on my VoIP app in android. So far i have compiled PJSIP 2.8 with OpenSSL 1.0.2g. making call without srtp works fine, but when i force to use SRTP, call in not make.
I enable SRTP with following code:
AccountConfig.getMediaConfig().setSrtpUse(pjmedia_srtp_use.PJMEDIA_SRTP_MANDATORY);
AccountConfig.getMediaConfig().setSrtpSecureSignaling(1);
TLS works fine, because if I set secureSignaling to 1 (need TLS transport) and srtpUse to disable, I still can make call and it works fine.
I checked my server with Zoiper, and Zoiper could make a secure call.
So, I'm sure problem is from my configuration of SRTP.
This is my configs on Android App:
TLS Transport :
sipTpConfig.getTlsConfig().setMethod(pjsip_ssl_method.PJSIP_TLSV1_METHOD);
sipTpConfig.getTlsConfig().setVerifyServer(false);
sipTpConfig.getTlsConfig().setVerifyClient(false);
sipTpConfig.getTlsConfig().setRequireClientCert(false);
Port = 5061
and Media Config:
AccountConfig.getMediaConfig().setSrtpUse(pjmedia_srtp_use.PJMEDIA_SRTP_MANDATORY);
AccountConfig.getMediaConfig().setSrtpSecureSignaling(1);
AccountConfig.getMediaConfig().getTransportConfig().getTlsConfig().setMethod(pjsip_ssl_method.PJSIP_TLSV1_METHOD);
In my Server (Asterisk 13.26) I have these configs:
Sip.conf :
[general]
context=internal
externaddr= 192.168.1.2
externip= 192.168.1.2
externtcpport=5060
externudpport=5060
externtlsport=5061
tcpbindaddr=0.0.0.0:5060
udpbindaddr=0.0.0.0:5060
tlsbindaddr=0.0.0.0:5061
allowguest=no
allowoverlap=no
srvlookup=no
allow=all
alwaysauthreject=yes
canreinvite=no
nat=force_rport,comedia
session-timers=refuse
localnet=192.168.1.0/255.255.255.0
tcpenable=yes
srtpcapable=yes
tlsenable=yes
tlscertfile=/etc/asterisk/keys/asterisk.pem
tlscafile=/etc/asterisk/keys/ca.crt
tlscipher=ALL
tlsclientmethod=tlsv1
encryption=yes
direct_media=no
media_encryption_optimistic=false
media_encryption=sdes
[6002]
type=friend
host=dynamic
secret=12345
context=internal
transport=tls
had anyone same issue or know a way to fix this ?
Log files of android and asterisk :
https://drive.google.com/file/d/18j98zp9FWJGRSvRdKy5k96VNbjUYaRc5/view?usp=sharing
https://drive.google.com/file/d/1eAeX5Gd6phIvKDLCRjVyD6uZV_CP9h6p/view?usp=sharing
Android grpc client is receiving GOAWAY from server with "too many pings" error. Now I realise that this is probably a server side issue, but I think the issue is that the client channel settings do not match that of the servers.
I have a C# gRPC server with the following settings:
List<ChannelOption> channelOptions = new List<ChannelOption>();
channelOptions.Add(new
ChannelOption("GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS",
1000));
channelOptions.Add(new
ChannelOption("GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA", 0));
channelOptions.Add(new
ChannelOption("GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS", 1));
this.server = new Server(channelOptions) {
Services = { TerminalService.BindService(this) },
Ports = {new ServerPort("0.0.0.0", 5000,
ServerCredentials.Insecure)}
};
On Android I have the following channel setup:
private val channel = ManagedChannelBuilder.forAddress(name, port)
.usePlaintext()
.keepAliveTime(10, TimeUnit.SECONDS)
.keepAliveWithoutCalls(true)
.build()
After a few min (however seems to be a random time). I get the goaway error. I noticed that if I stream data on the call then the error never happens. It is only when there is no data on the stream. This leads me to believe the issue is that the GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA needs to be set on the Android client aswell. Problem is for the life of me I cannot find where to set these channel settings on gRPC java. Can someone point out to me where I can set these channel settings? There are no examples where these have been set.
The channel options being specified are using the wrong names. Names like GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA are the C-defines for things like "grpc.http2.max_pings_without_data".
You can map from the C name to the key string by looking at grpc_types.h. You should prefer using one of the C# constants in ChannelOptions when it is available, but that doesn't seem to be an option in this case.
These options are not visible in the Java ManagedChannelBuilder API because they are server-specific settings. So instead they are visible on the ServerBuilder. See A8 client-side keepalive for reference to the Java keepalive API.
I am trying to request some entries from AWS DynamoDB from an App in Android Studio. I am getting a CRC32 mismatch for a scanResult. Does anyone know why this is happening. attaching snippet and stack trace below.
credentials = new CognitoCachingCredentialsProvider(
MapValidate.getContext(), // Context
“FILLED_MY_ID_HERE", // Identity Pool ID
Regions.US_EAST_1 // Region
);
AmazonDynamoDBClient dynamoDB = new AmazonDynamoDBClient(credentials);
Region usEast1 = Region.getRegion(Regions.US_EAST_1);
dynamoDB.setRegion(usEast1);
HashMap<String,Condition> scanFilter = new HashMap<String,Condition>();
Condition condition1lat = new Condition()
.withComparisonOperator(ComparisonOperator.EQ.toString())
.withAttributeValueList(new AttributeValue().withS(user_lat));
scanFilter.put("DegLat", condition1lat);
ScanRequest scanRequest = new ScanRequest()
.withTableName("MY_TABLE_NAME")
.withAttributesToGet("DegLat","DegLong","Latitude")
.withScanFilter(scanFilter);
ScanResult result = dynamoDB.scan(scanRequest);
I am getting the following exception as below:
04-28 19:34:03.729 4744-4793/com.google.sample I/AmazonHttpClient﹕
Unable to execute HTTP request:
Client calculated crc32 checksum didn't match that calculated by server side
CRC checksum errors may be caused by requesting compression in the request header.
If you have not already done this, please try the following with ClientConfiguration:
ClientConfiguration clientConfig = new ClientConfiguration();
clientConfig.withGzip(ClientConfiguration.DEFAULT_USE_GZIP /*false*/);
Update: I just resolved the issue. It is a problem with the sdk-2.2.0 . Upgraded to the latest version of 2.2.1 released a few days ago resolved the issue.
The Android SDK actually does not support ClientConfiguration.DEFAULT_USE_GIP... It does try to take this into consideration thought if you look at the HttpRequestFactory class https://github.com/aws/aws-sdk-android/blob/4de3a3146d66d9ab5684eb5e71d5a2cef9f4dec9/aws-android-sdk-core/src/main/java/com/amazonaws/http/HttpRequestFactory.java If you have not explicitly set an Accept-Encoding, then the sdk will turn off compression by default. If however you DID explicitly set it, you could be running in to compression problems.
Let me know if this does not solve your problem.
Thanks,
Weston
I am using Google Spreadsheet API in my simple Android application. This is the piece of code:
URL spreadSheetUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full");
SpreadsheetQuery query = new SpreadsheetQuery(spreadSheetUrl);
query.setTitleQuery("xyz");
query.setTitleExact(true);
SpreadsheetFeed spreadSheetFeed = service.getFeed(query, SpreadsheetFeed.class);
This piece of code is called from my application's sync adapter.
I am getting this error:
com.google.gdata.util.ParseException: Unrecognized content type:application/binary
com.google.gdata.client.Service.parseResponseData(Service.java:2136)
com.google.gdata.client.Service.parseResponseData(Service.java:2098)
com.google.gdata.client.Service.getFeed(Service.java:1136)
com.google.gdata.client.Service.getFeed(Service.java:1077)
com.google.gdata.client.GoogleService.getFeed(GoogleService.java:676)
com.google.gdata.client.Service.getFeed(Service.java:1034)
Can someone suggest how I can solve this issue?
It turns out that I did not set the user credentials before executing this piece of code.
service.setUserCredentials(user, password);
Adding this line helped solve this issue. Weird.
I am opening a connection setting up a custom protocol like this:
WebSocketSubProtocol d = new WebSocketSubProtocol("MyCustomProto",WebSocketEncoding.TEXT);
mJWC.addSubProtocol(d);
mJWC.open(mURL);
But... Server side, I receive tis in the protocol string
"org.jwebsocket.json MyCustomProto"
How can I remove from the string the "org.jwebsocket.json" ?
I don't wanna do it server side...
Thanks!
I will answer to my own question.
By calling the "addSubProtocol" doesn't seem to be the right solution for couple of reasons:
if you call those 3 lines of code multiple time (if the first time the connection failed for example..) well the the protocol string would be something like
"org.jwebsocket.json MyCustomProto MyCustomProto"
It just keep adding the protocol..
So I found a turn around. Now I don't use that "addSubProtocol" but instead I defined the protocol directly when I create the socket
mJWC = new BaseTokenClient("client||"+code+"||"+name,WebSocketEncoding.TEXT);
Voila.. Now no more "org.jwebsocket.json" anymore