mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
add get_remote_contact() api and clean java API.
This commit is contained in:
parent
3b722ada22
commit
e2707b8d5c
8 changed files with 84 additions and 24 deletions
|
|
@ -898,6 +898,16 @@ const char *linphone_call_get_remote_user_agent(LinphoneCall *call){
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the far end's sip contact as a string, if available.
|
||||
**/
|
||||
const char *linphone_call_get_remote_contact(LinphoneCall *call){
|
||||
if (call->op){
|
||||
return sal_op_get_remote_contact(call->op);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this calls has received a transfer that has not been
|
||||
* executed yet.
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
|
|||
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
|
||||
LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
|
||||
const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
|
||||
const char *linphone_call_get_remote_contact(LinphoneCall *call);
|
||||
float linphone_call_get_play_volume(LinphoneCall *call);
|
||||
float linphone_call_get_record_volume(LinphoneCall *call);
|
||||
float linphone_call_get_current_quality(LinphoneCall *call);
|
||||
|
|
|
|||
|
|
@ -1508,7 +1508,17 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress( JNIEn
|
|||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getRemoteUserAgent(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
LinphoneCall *call = (LinphoneCall *)ptr;
|
||||
jstring jvalue = env->NewStringUTF(linphone_call_get_remote_user_agent(call));
|
||||
const char *value=linphone_call_get_remote_user_agent(call);
|
||||
jstring jvalue=NULL;
|
||||
if (value) jvalue=env->NewStringUTF();
|
||||
return jvalue;
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getRemoteContact(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
LinphoneCall *call = (LinphoneCall *)ptr;
|
||||
const char *value=linphone_call_get_remote_contact(call);
|
||||
jstring jvalue = NULL;
|
||||
if (value) jvalue=env->NewStringUTF(value);
|
||||
return jvalue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -273,6 +273,10 @@ const char *sal_op_get_contact(const SalOp *op){
|
|||
return ((SalOpBase*)op)->contact;
|
||||
}
|
||||
|
||||
const char *sal_op_get_remote_contact(const SalOp *op){
|
||||
return ((SalOpBase*)op)->remote_contact;
|
||||
}
|
||||
|
||||
const char *sal_op_get_route(const SalOp *op){
|
||||
return ((SalOpBase*)op)->route;
|
||||
}
|
||||
|
|
@ -304,6 +308,9 @@ void __sal_op_set_network_origin(SalOp *op, const char *origin){
|
|||
assign_string(&((SalOpBase*)op)->origin,origin);
|
||||
}
|
||||
|
||||
void __sal_op_set_remote_contact(SalOp *op, const char *ct){
|
||||
assign_string(&((SalOpBase*)op)->remote_contact,ct);
|
||||
}
|
||||
|
||||
void __sal_op_free(SalOp *op){
|
||||
SalOpBase *b=(SalOpBase *)op;
|
||||
|
|
@ -331,12 +338,16 @@ void __sal_op_free(SalOp *op){
|
|||
ms_free(b->remote_ua);
|
||||
b->remote_ua=NULL;
|
||||
}
|
||||
if (b->remote_contact){
|
||||
ms_free(b->remote_contact);
|
||||
b->remote_contact=NULL;
|
||||
}
|
||||
if (b->local_media)
|
||||
sal_media_description_unref(b->local_media);
|
||||
if (b->remote_media)
|
||||
sal_media_description_unref(b->remote_media);
|
||||
if (b->call_id)
|
||||
ms_free((void*)b->call_id);
|
||||
ms_free(b->call_id);
|
||||
ms_free(op);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,8 @@ typedef struct SalOpBase{
|
|||
SalMediaDescription *local_media;
|
||||
SalMediaDescription *remote_media;
|
||||
void *user_pointer;
|
||||
const char* call_id;
|
||||
char* call_id;
|
||||
char *remote_contact;
|
||||
} SalOpBase;
|
||||
|
||||
|
||||
|
|
@ -385,6 +386,7 @@ const char *sal_op_get_to(const SalOp *op);
|
|||
const char *sal_op_get_contact(const SalOp *op);
|
||||
const char *sal_op_get_route(const SalOp *op);
|
||||
const char *sal_op_get_proxy(const SalOp *op);
|
||||
const char *sal_op_get_remote_contact(const SalOp *op);
|
||||
/*for incoming requests, returns the origin of the packet as a sip uri*/
|
||||
const char *sal_op_get_network_origin(const SalOp *op);
|
||||
/*returns far-end "User-Agent" string */
|
||||
|
|
@ -442,7 +444,7 @@ int sal_ping(SalOp *op, const char *from, const char *to);
|
|||
|
||||
|
||||
|
||||
#define payload_type_set_number(pt,n) (pt)->user_data=(void*)((long)n);
|
||||
#define payload_type_set_number(pt,n) (pt)->user_data=(void*)((long)n);
|
||||
#define payload_type_get_number(pt) ((int)(long)(pt)->user_data)
|
||||
|
||||
/*misc*/
|
||||
|
|
@ -452,6 +454,7 @@ void sal_get_default_local_ip(Sal *sal, int address_family, char *ip, size_t ipl
|
|||
/*internal API */
|
||||
void __sal_op_init(SalOp *b, Sal *sal);
|
||||
void __sal_op_set_network_origin(SalOp *op, const char *origin /*a sip uri*/);
|
||||
void __sal_op_set_remote_contact(SalOp *op, const char *ct);
|
||||
void __sal_op_free(SalOp *b);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -671,8 +671,11 @@ int sal_call(SalOp *h, const char *from, const char *to){
|
|||
ms_error("Fail to send invite ! Error code %d", err);
|
||||
return -1;
|
||||
}else{
|
||||
char *tmp=NULL;
|
||||
callid=osip_message_get_call_id(invite);
|
||||
osip_call_id_to_str(callid,(char **)(&h->base.call_id));
|
||||
osip_call_id_to_str(callid,&tmp);
|
||||
h->base.call_id=ms_strdup(tmp);
|
||||
osip_free(tmp);
|
||||
sal_add_call(h->base.root,h);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1014,6 +1017,19 @@ static void set_remote_ua(SalOp* op, osip_message_t *req){
|
|||
}
|
||||
}
|
||||
|
||||
static void set_remote_contact(SalOp* op, osip_message_t *req){
|
||||
if (op->base.remote_contact==NULL){
|
||||
osip_contact_t *h=NULL;
|
||||
osip_message_get_contact(req,0,&h);
|
||||
if (h){
|
||||
char *tmp=NULL;
|
||||
osip_contact_to_str(h,&tmp);
|
||||
__sal_op_set_remote_contact(op,tmp);
|
||||
osip_free(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void set_replaces(SalOp *op, osip_message_t *req){
|
||||
osip_header_t *h=NULL;
|
||||
|
||||
|
|
@ -1051,12 +1067,17 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){
|
|||
SalOp *op=sal_op_new(sal);
|
||||
osip_from_t *from,*to;
|
||||
osip_call_info_t *call_info;
|
||||
char *tmp;
|
||||
char *tmp=NULL;
|
||||
sdp_message_t *sdp=eXosip_get_sdp_info(ev->request);
|
||||
|
||||
osip_call_id_t *callid=osip_message_get_call_id(ev->request);
|
||||
osip_call_id_to_str(callid,(char**)(&op->base.call_id));
|
||||
|
||||
|
||||
osip_call_id_to_str(callid,&tmp);
|
||||
op->base.call_id=ms_strdup(tmp);
|
||||
osip_free(tmp);
|
||||
|
||||
set_network_origin(op,ev->request);
|
||||
set_remote_contact(op,ev->request);
|
||||
set_remote_ua(op,ev->request);
|
||||
set_replaces(op,ev->request);
|
||||
|
||||
|
|
@ -1234,6 +1255,7 @@ static void call_accepted(Sal *sal, eXosip_event_t *ev){
|
|||
|
||||
op->did=ev->did;
|
||||
set_remote_ua(op,ev->response);
|
||||
set_remote_contact(op,ev->response);
|
||||
|
||||
sdp=eXosip_get_sdp_info(ev->response);
|
||||
if (sdp){
|
||||
|
|
|
|||
|
|
@ -102,22 +102,22 @@ public interface LinphoneCall {
|
|||
/**
|
||||
* The call's parameters are updated, used for example when video is asked by remote
|
||||
*/
|
||||
public static final State CallUpdatedByRemote = new State(15, "CallUpdatedByRemote");
|
||||
public static final State CallUpdatedByRemote = new State(15, "UpdatedByRemote");
|
||||
|
||||
/**
|
||||
* We are proposing early media to an incoming call
|
||||
*/
|
||||
public static final State CallIncomingEarlyMedia = new State(16,"CallIncomingEarlyMedia");
|
||||
public static final State CallIncomingEarlyMedia = new State(16,"IncomingEarlyMedia");
|
||||
|
||||
/**
|
||||
* The remote accepted the call update initiated by us
|
||||
* We have initiated a call update. When the remote accepts the call update, state will move to StreamsRunning.
|
||||
*/
|
||||
public static final State CallUpdated = new State(17, "CallUpdated");
|
||||
public static final State CallUpdating = new State(17, "Updating");
|
||||
|
||||
/**
|
||||
* The call object is now released.
|
||||
*/
|
||||
public static final State CallReleased = new State(18,"CallReleased");
|
||||
public static final State CallReleased = new State(18,"Released");
|
||||
|
||||
|
||||
private State(int value,String stringValue) {
|
||||
|
|
@ -160,17 +160,6 @@ public interface LinphoneCall {
|
|||
**/
|
||||
LinphoneCallLog getCallLog();
|
||||
|
||||
/**
|
||||
* Set the audio statistics associated with this call.
|
||||
* @return LinphoneCallStats
|
||||
*/
|
||||
void setAudioStats(LinphoneCallStats stats);
|
||||
|
||||
/**
|
||||
* Set the video statistics associated with this call.
|
||||
* @return LinphoneCallStats
|
||||
*/
|
||||
void setVideoStats(LinphoneCallStats stats);
|
||||
|
||||
/**
|
||||
* Get the audio statistics associated with this call.
|
||||
|
|
@ -184,6 +173,10 @@ public interface LinphoneCall {
|
|||
*/
|
||||
LinphoneCallStats getVideoStats();
|
||||
|
||||
/**
|
||||
* Get call's remote parameters, as proposed by far end.
|
||||
* This is useful for example to know if far end supports video or encryption.
|
||||
**/
|
||||
LinphoneCallParams getRemoteParams();
|
||||
|
||||
LinphoneCallParams getCurrentParamsCopy();
|
||||
|
|
@ -273,6 +266,11 @@ public interface LinphoneCall {
|
|||
* Obtain the remote user agent string.
|
||||
*/
|
||||
String getRemoteUserAgent();
|
||||
|
||||
/**
|
||||
* Obtain the remote sip contact string.
|
||||
**/
|
||||
String getRemoteContact();
|
||||
|
||||
/**
|
||||
* Take a photo of currently received video and write it into a jpeg file.
|
||||
|
|
|
|||
|
|
@ -179,6 +179,11 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
public String getRemoteUserAgent() {
|
||||
return getRemoteUserAgent(nativePtr);
|
||||
}
|
||||
|
||||
private native String getRemoteContact(long nativePtr);
|
||||
public String getRemoteContact() {
|
||||
return getRemoteContact(nativePtr);
|
||||
}
|
||||
|
||||
private native void takeSnapshot(long nativePtr, String path);
|
||||
public void takeSnapshot(String path) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue