Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
62c62711
Commit
62c62711
authored
Oct 07, 2015
by
Ghislain MARY
Browse files
Add JNI for the API to handle custom SDP attributes.
parent
fe9b63d2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
1 deletion
+133
-1
coreapi/call_params.h
coreapi/call_params.h
+4
-0
coreapi/linphonecore_jni.cc
coreapi/linphonecore_jni.cc
+30
-0
java/common/org/linphone/core/LinphoneCallParams.java
java/common/org/linphone/core/LinphoneCallParams.java
+32
-1
java/common/org/linphone/core/LinphoneCore.java
java/common/org/linphone/core/LinphoneCore.java
+42
-0
java/impl/org/linphone/core/LinphoneCallParamsImpl.java
java/impl/org/linphone/core/LinphoneCallParamsImpl.java
+25
-0
No files found.
coreapi/call_params.h
View file @
62c62711
...
...
@@ -400,6 +400,7 @@ LINPHONE_PUBLIC void linphone_call_params_add_custom_sdp_attribute(LinphoneCallP
/**
* Add a custom attribute related to a specific stream in the SDP exchanged within SIP messages during a call.
* @param[in] params The #LinphoneCallParams to add a custom SDP attribute to.
* @param[in] type The type of the stream to add a custom SDP attribute to.
* @param[in] attribute_name The name of the attribute to add.
* @param[in] attribute_value The content value of the attribute to add.
* @ingroup media_parameters
...
...
@@ -411,14 +412,17 @@ LINPHONE_PUBLIC void linphone_call_params_add_custom_sdp_media_attribute(Linphon
* @param[in] params The #LinphoneCallParams to get the custom SDP attribute from.
* @param[in] attribute_name The name of the attribute to get.
* @return The content value of the attribute or NULL if not found.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC
const
char
*
linphone_call_params_get_custom_sdp_attribute
(
const
LinphoneCallParams
*
params
,
const
char
*
attribute_name
);
/**
* Get a custom SDP attribute that is related to a specific stream.
* @param[in] params The #LinphoneCallParams to get the custom SDP attribute from.
* @param[in] type The type of the stream to add a custom SDP attribute to.
* @param[in] attribute_name The name of the attribute to get.
* @return The content value of the attribute or NULL if not found.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC
const
char
*
linphone_call_params_get_custom_sdp_media_attribute
(
const
LinphoneCallParams
*
params
,
LinphoneStreamType
type
,
const
char
*
attribute_name
);
...
...
coreapi/linphonecore_jni.cc
View file @
62c62711
...
...
@@ -3657,6 +3657,36 @@ extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_addCustomHeader(JN
env
->
ReleaseStringUTFChars
(
jheader_value
,
header_value
);
}
JNIEXPORT
void
JNICALL
Java_org_linphone_core_LinphoneCallParamsImpl_addCustomSdpAttribute
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
,
jstring
jname
,
jstring
jvalue
)
{
const
char
*
name
=
env
->
GetStringUTFChars
(
jname
,
NULL
);
const
char
*
value
=
env
->
GetStringUTFChars
(
jvalue
,
NULL
);
linphone_call_params_add_custom_sdp_attribute
((
LinphoneCallParams
*
)
ptr
,
name
,
value
);
env
->
ReleaseStringUTFChars
(
jname
,
name
);
env
->
ReleaseStringUTFChars
(
jvalue
,
value
);
}
JNIEXPORT
void
JNICALL
Java_org_linphone_core_LinphoneCallParamsImpl_addCustomSdpMediaAttribute
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
,
jint
jtype
,
jstring
jname
,
jstring
jvalue
)
{
const
char
*
name
=
env
->
GetStringUTFChars
(
jname
,
NULL
);
const
char
*
value
=
env
->
GetStringUTFChars
(
jvalue
,
NULL
);
linphone_call_params_add_custom_sdp_media_attribute
((
LinphoneCallParams
*
)
ptr
,
(
LinphoneStreamType
)
jtype
,
name
,
value
);
env
->
ReleaseStringUTFChars
(
jname
,
name
);
env
->
ReleaseStringUTFChars
(
jvalue
,
value
);
}
JNIEXPORT
jstring
JNICALL
Java_org_linphone_core_LinphoneCallParamsImpl_getCustomSdpAttribute
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
,
jstring
jname
)
{
const
char
*
name
=
env
->
GetStringUTFChars
(
jname
,
NULL
);
const
char
*
value
=
linphone_call_params_get_custom_sdp_attribute
((
LinphoneCallParams
*
)
ptr
,
name
);
env
->
ReleaseStringUTFChars
(
jname
,
name
);
return
value
?
env
->
NewStringUTF
(
value
)
:
NULL
;
}
JNIEXPORT
jstring
JNICALL
Java_org_linphone_core_LinphoneCallParamsImpl_getCustomSdpMediaAttribute
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
ptr
,
jint
jtype
,
jstring
jname
)
{
const
char
*
name
=
env
->
GetStringUTFChars
(
jname
,
NULL
);
const
char
*
value
=
linphone_call_params_get_custom_sdp_media_attribute
((
LinphoneCallParams
*
)
ptr
,
(
LinphoneStreamType
)
jtype
,
name
);
env
->
ReleaseStringUTFChars
(
jname
,
name
);
return
value
?
env
->
NewStringUTF
(
value
)
:
NULL
;
}
extern
"C"
void
Java_org_linphone_core_LinphoneCallParamsImpl_setRecordFile
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
lcp
,
jstring
jrecord_file
){
if
(
jrecord_file
){
const
char
*
record_file
=
env
->
GetStringUTFChars
(
jrecord_file
,
NULL
);
...
...
java/common/org/linphone/core/LinphoneCallParams.java
View file @
62c62711
...
...
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package
org.linphone.core
;
import
org.linphone.core.LinphoneCore.MediaEncryption
;
import
org.linphone.core.LinphoneCore.StreamType
;
/**
* The LinphoneCallParams is an object containing various call related parameters.
* It can be used to retrieve parameters from a currently running call or modify the call's characteristics
...
...
@@ -96,7 +97,37 @@ public interface LinphoneCallParams {
* @return value for the header, or null if it doesn't exist.
*/
String
getCustomHeader
(
String
name
);
/**
* Add a custom attribute related to all the streams in the SDP exchanged within SIP messages during a call.
* @param name The name of the attribute to add.
* @param value The content value of the attribute to add.
**/
void
addCustomSdpAttribute
(
String
name
,
String
value
);
/**
* Add a custom attribute related to a specific stream in the SDP exchanged within SIP messages during a call.
* @param type The type of the stream to add a custom SDP attribute to.
* @param name The name of the attribute to add.
* @param value The content value of the attribute to add.
**/
void
addCustomSdpMediaAttribute
(
StreamType
type
,
String
name
,
String
value
);
/**
* Get a custom SDP attribute that is related to all the streams.
* @param name The name of the attribute to get.
* @return The content value of the attribute or null if not found.
**/
String
getCustomSdpAttribute
(
String
name
);
/**
* Get a custom SDP attribute that is related to a specific stream.
* @param type The type of the stream to add a custom SDP attribute to.
* @param name The name of the attribute to get.
* @return The content value of the attribute or null if not found.
**/
String
getCustomSdpMediaAttribute
(
StreamType
type
,
String
name
);
/**
* Set the privacy for the call.
* @param privacy_mask a or'd int of values defined in interface {@link org.linphone.core.Privacy}
...
...
java/common/org/linphone/core/LinphoneCore.java
View file @
62c62711
...
...
@@ -250,6 +250,48 @@ public interface LinphoneCore {
return
"udp["
+
udp
+
"] tcp["
+
tcp
+
"] tls["
+
tls
+
"]"
;
}
}
/**
* Stream type enum-like.
*
*/
static
public
final
class
StreamType
{
static
private
Vector
<
StreamType
>
values
=
new
Vector
<
StreamType
>();
/**
* Audio
*/
static
public
final
StreamType
Audio
=
new
StreamType
(
0
,
"Audio"
);
/**
* Video
*/
static
public
final
StreamType
Video
=
new
StreamType
(
1
,
"Video"
);
/**
* Text
*/
static
public
final
StreamType
Text
=
new
StreamType
(
2
,
"Text"
);
/**
* Unknown
*/
static
public
final
StreamType
Unknown
=
new
StreamType
(
3
,
"Unknown"
);
protected
final
int
mValue
;
private
final
String
mStringValue
;
private
StreamType
(
int
value
,
String
stringValue
)
{
mValue
=
value
;
values
.
addElement
(
this
);
mStringValue
=
stringValue
;
}
public
static
StreamType
fromInt
(
int
value
)
{
for
(
int
i
=
0
;
i
<
values
.
size
();
i
++)
{
StreamType
stype
=
(
StreamType
)
values
.
elementAt
(
i
);
if
(
stype
.
mValue
==
value
)
return
stype
;
}
throw
new
RuntimeException
(
"StreamType not found ["
+
value
+
"]"
);
}
public
String
toString
()
{
return
mStringValue
;
}
}
/**
* Media (RTP) encryption enum-like.
*
...
...
java/impl/org/linphone/core/LinphoneCallParamsImpl.java
View file @
62c62711
...
...
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package
org.linphone.core
;
import
org.linphone.core.LinphoneCore.MediaEncryption
;
import
org.linphone.core.LinphoneCore.StreamType
;
public
class
LinphoneCallParamsImpl
implements
LinphoneCallParams
{
protected
final
long
nativePtr
;
...
...
@@ -107,6 +108,30 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams {
return
getCustomHeader
(
nativePtr
,
name
);
}
private
native
void
addCustomSdpAttribute
(
long
nativePtr
,
String
name
,
String
value
);
@Override
public
void
addCustomSdpAttribute
(
String
name
,
String
value
)
{
addCustomSdpAttribute
(
nativePtr
,
name
,
value
);
}
private
native
void
addCustomSdpMediaAttribute
(
long
nativePtr
,
int
type
,
String
name
,
String
value
);
@Override
public
void
addCustomSdpMediaAttribute
(
StreamType
type
,
String
name
,
String
value
)
{
addCustomSdpMediaAttribute
(
nativePtr
,
type
.
mValue
,
name
,
value
);
}
private
native
String
getCustomSdpAttribute
(
long
nativePtr
,
String
name
);
@Override
public
String
getCustomSdpAttribute
(
String
name
)
{
return
getCustomSdpAttribute
(
nativePtr
,
name
);
}
private
native
String
getCustomSdpMediaAttribute
(
long
nativePtr
,
int
type
,
String
name
);
@Override
public
String
getCustomSdpMediaAttribute
(
StreamType
type
,
String
name
)
{
return
getCustomSdpMediaAttribute
(
nativePtr
,
type
.
mValue
,
name
);
}
private
native
void
setPrivacy
(
long
nativePtr
,
int
mask
);
@Override
public
void
setPrivacy
(
int
privacy_mask
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment