mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-03 20:46:28 +00:00
Merge branch 'master' of git.savannah.nongnu.org:/srv/git/linphone
This commit is contained in:
commit
b70ea12149
9 changed files with 118 additions and 24 deletions
|
|
@ -66,19 +66,36 @@ static void new_subscription_request (LinphoneCore *lc, LinphoneFriend *friend,
|
||||||
linphone_core_add_friend(lc,friend); /* add this new friend to the buddy list*/
|
linphone_core_add_friend(lc,friend); /* add this new friend to the buddy list*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Registration state notification callback
|
||||||
|
*/
|
||||||
|
static void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message){
|
||||||
|
printf("New registration state %s for user id [%s] at proxy [%s]\n"
|
||||||
|
,linphone_registration_state_to_string(cstate)
|
||||||
|
,linphone_proxy_config_get_identity(cfg)
|
||||||
|
,linphone_proxy_config_get_addr(cfg));
|
||||||
|
}
|
||||||
|
|
||||||
LinphoneCore *lc;
|
LinphoneCore *lc;
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
LinphoneCoreVTable vtable={0};
|
LinphoneCoreVTable vtable={0};
|
||||||
|
|
||||||
char* dest_friend=NULL;
|
char* dest_friend=NULL;
|
||||||
|
char* identity=NULL;
|
||||||
|
char* password=NULL;
|
||||||
|
|
||||||
/* takes sip uri identity from the command line arguments */
|
/* takes sip uri identity from the command line arguments */
|
||||||
if (argc>1){
|
if (argc>1){
|
||||||
dest_friend=argv[1];
|
dest_friend=argv[1];
|
||||||
}
|
}
|
||||||
|
/* takes sip uri identity from the command line arguments */
|
||||||
|
if (argc>2){
|
||||||
|
identity=argv[2];
|
||||||
|
}
|
||||||
|
/* takes password from the command line arguments */
|
||||||
|
if (argc>3){
|
||||||
|
password=argv[3];
|
||||||
|
}
|
||||||
signal(SIGINT,stop);
|
signal(SIGINT,stop);
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
@ -91,11 +108,47 @@ int main(int argc, char *argv[]){
|
||||||
*/
|
*/
|
||||||
vtable.notify_presence_recv=notify_presence_recv_updated;
|
vtable.notify_presence_recv=notify_presence_recv_updated;
|
||||||
vtable.new_subscription_request=new_subscription_request;
|
vtable.new_subscription_request=new_subscription_request;
|
||||||
|
vtable.registration_state_changed=registration_state_changed; /*just in case sip proxy is used*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Instantiate a LinphoneCore object given the LinphoneCoreVTable
|
Instantiate a LinphoneCore object given the LinphoneCoreVTable
|
||||||
*/
|
*/
|
||||||
lc=linphone_core_new(&vtable,NULL,NULL,NULL);
|
lc=linphone_core_new(&vtable,NULL,NULL,NULL);
|
||||||
|
/*sip proxy might be requested*/
|
||||||
|
if (identity != NULL) {
|
||||||
|
/*create proxy config*/
|
||||||
|
LinphoneProxyConfig* proxy_cfg = linphone_proxy_config_new();
|
||||||
|
/*parse identity*/
|
||||||
|
LinphoneAddress *from = linphone_address_new(identity);
|
||||||
|
if (from==NULL){
|
||||||
|
printf("%s not a valid sip uri, must be like sip:toto@sip.linphone.org \n",identity);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
LinphoneAuthInfo *info;
|
||||||
|
if (password!=NULL){
|
||||||
|
info=linphone_auth_info_new(linphone_address_get_username(from),NULL,password,NULL,NULL); /*create authentication structure from identity*/
|
||||||
|
linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
|
||||||
|
}
|
||||||
|
|
||||||
|
// configure proxy entries
|
||||||
|
linphone_proxy_config_set_identity(proxy_cfg,identity); /*set identity with user name and domain*/
|
||||||
|
linphone_proxy_config_set_server_addr(proxy_cfg,linphone_address_get_domain(from)); /* we assume domain = proxy server address*/
|
||||||
|
linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/
|
||||||
|
linphone_proxy_config_enable_publish(proxy_cfg,TRUE); /* enable presence satus publication for this proxy*/
|
||||||
|
linphone_address_destroy(from); /*release resource*/
|
||||||
|
|
||||||
|
linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/
|
||||||
|
linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Loop until registration status is available */
|
||||||
|
do {
|
||||||
|
linphone_core_iterate(lc); /* first iterate initiates registration */
|
||||||
|
ms_usleep(100000);
|
||||||
|
}
|
||||||
|
while( running && linphone_proxy_config_get_state(proxy_cfg) == LinphoneRegistrationProgress);
|
||||||
|
|
||||||
|
}
|
||||||
LinphoneFriend* my_friend=NULL;
|
LinphoneFriend* my_friend=NULL;
|
||||||
|
|
||||||
if (dest_friend) {
|
if (dest_friend) {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@ import org.linphone.core.LinphoneFriend.SubscribePolicy;
|
||||||
* from a sip uri identity passed from the command line.
|
* from a sip uri identity passed from the command line.
|
||||||
* <br>Argument must be like sip:jehan@sip.linphone.org .
|
* <br>Argument must be like sip:jehan@sip.linphone.org .
|
||||||
* ex budy_list sip:jehan@sip.linphone.org
|
* ex budy_list sip:jehan@sip.linphone.org
|
||||||
* <br>Subscription is cleared on SIGINT
|
* <br>
|
||||||
|
* Optionnally argument 2 can be registration sip identy.Argument 3 can be passord.
|
||||||
|
* ex: budy_list sip:jehan@sip.linphone.org sip:myidentity@sip.linphone.org mypassword
|
||||||
*
|
*
|
||||||
* Ported from buddy_status.c
|
* Ported from buddy_status.c
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -3961,13 +3961,21 @@ static PayloadType* find_payload_type_from_list(const char* type, int rate,const
|
||||||
const MSList *elem;
|
const MSList *elem;
|
||||||
for(elem=from;elem!=NULL;elem=elem->next){
|
for(elem=from;elem!=NULL;elem=elem->next){
|
||||||
PayloadType *pt=(PayloadType*)elem->data;
|
PayloadType *pt=(PayloadType*)elem->data;
|
||||||
if ((strcmp((char*)type, payload_type_get_mime(pt)) == 0) && rate==pt->clock_rate) {
|
if ((strcmp((char*)type, payload_type_get_mime(pt)) == 0) && (rate == -1 || rate==pt->clock_rate)) {
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void printCodecs(const MSList* from) {
|
||||||
|
const MSList *elem;
|
||||||
|
for(elem=from;elem!=NULL;elem=elem->next){
|
||||||
|
PayloadType *pt=(PayloadType*)elem->data;
|
||||||
|
ms_message(payload_type_get_mime(pt));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get payload type from mime type and clock rate
|
* Get payload type from mime type and clock rate
|
||||||
* @ingroup media_parameters
|
* @ingroup media_parameters
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include "linphonecore.h"
|
#include "linphonecore.h"
|
||||||
|
#include "mediastreamer2/msjava.h"
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
extern "C" void libmsilbc_init();
|
extern "C" void libmsilbc_init();
|
||||||
extern "C" void libmsx264_init();
|
extern "C" void libmsx264_init();
|
||||||
#endif /*ANDROID*/
|
#endif /*ANDROID*/
|
||||||
|
|
||||||
extern "C" void ms_andsnd_set_jvm(JavaVM *jvm) ;
|
|
||||||
extern "C" void ms_andvid_set_jvm(JavaVM *jvm) ;
|
|
||||||
|
|
||||||
static JavaVM *jvm=0;
|
static JavaVM *jvm=0;
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
|
@ -47,10 +46,7 @@ static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_l
|
||||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
ms_andsnd_set_jvm(ajvm);
|
ms_set_jvm(ajvm);
|
||||||
#ifdef VIDEO_ENABLED
|
|
||||||
ms_andvid_set_jvm(ajvm);
|
|
||||||
#endif /*VIDEO_ENABLED*/
|
|
||||||
#endif /*ANDROID*/
|
#endif /*ANDROID*/
|
||||||
jvm=ajvm;
|
jvm=ajvm;
|
||||||
return JNI_VERSION_1_2;
|
return JNI_VERSION_1_2;
|
||||||
|
|
@ -307,9 +303,6 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*
|
||||||
const char* userConfig = juserConfig?env->GetStringUTFChars(juserConfig, NULL):NULL;
|
const char* userConfig = juserConfig?env->GetStringUTFChars(juserConfig, NULL):NULL;
|
||||||
const char* factoryConfig = jfactoryConfig?env->GetStringUTFChars(jfactoryConfig, NULL):NULL;
|
const char* factoryConfig = jfactoryConfig?env->GetStringUTFChars(jfactoryConfig, NULL):NULL;
|
||||||
LinphoneCoreData* ldata = new LinphoneCoreData(env,thiz,jlistener,juserdata);
|
LinphoneCoreData* ldata = new LinphoneCoreData(env,thiz,jlistener,juserdata);
|
||||||
#ifdef ANDROID
|
|
||||||
ms_andsnd_set_jvm(jvm);
|
|
||||||
#endif /*ANDROID*/
|
|
||||||
|
|
||||||
#ifdef HAVE_ILBC
|
#ifdef HAVE_ILBC
|
||||||
libmsilbc_init(); // requires an fpu
|
libmsilbc_init(); // requires an fpu
|
||||||
|
|
@ -516,6 +509,24 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv*
|
||||||
env->ReleaseStringUTFChars(jmime, mime);
|
env->ReleaseStringUTFChars(jmime, mime);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTypes(JNIEnv* env
|
||||||
|
,jobject thiz
|
||||||
|
,jlong lc) {
|
||||||
|
const MSList* codecs = linphone_core_get_video_codecs((LinphoneCore*)lc);
|
||||||
|
int codecsCount = ms_list_size(codecs);
|
||||||
|
jlongArray jCodecs = env->NewLongArray(codecsCount);
|
||||||
|
jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL);
|
||||||
|
|
||||||
|
for (int i = 0; i < codecsCount; i++ ) {
|
||||||
|
jInternalArray[i] = (unsigned long) (codecs->data);
|
||||||
|
codecs = codecs->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
env->ReleaseLongArrayElements(jCodecs, jInternalArray, 0);
|
||||||
|
|
||||||
|
return jCodecs;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env
|
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env
|
||||||
,jobject thiz
|
,jobject thiz
|
||||||
,jlong lc
|
,jlong lc
|
||||||
|
|
@ -846,12 +857,9 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_isIncoming(JNIEnv
|
||||||
return ((LinphoneCallLog*)ptr)->dir==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
|
return ((LinphoneCallLog*)ptr)->dir==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env
|
extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) {
|
||||||
,jobject thiz
|
|
||||||
,jlong ptr) {
|
|
||||||
|
|
||||||
PayloadType* pt = (PayloadType*)ptr;
|
PayloadType* pt = (PayloadType*)ptr;
|
||||||
char* value = ms_strdup_printf("[%s] clock [%s], bitrate [%s]"
|
char* value = ms_strdup_printf("[%s] clock [%i], bitrate [%i]"
|
||||||
,payload_type_get_mime(pt)
|
,payload_type_get_mime(pt)
|
||||||
,payload_type_get_rate(pt)
|
,payload_type_get_rate(pt)
|
||||||
,payload_type_get_bitrate(pt));
|
,payload_type_get_bitrate(pt));
|
||||||
|
|
@ -859,6 +867,16 @@ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env
|
||||||
ms_free(value);
|
ms_free(value);
|
||||||
return jvalue;
|
return jvalue;
|
||||||
}
|
}
|
||||||
|
extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_getMime(JNIEnv* env,jobject thiz,jlong ptr) {
|
||||||
|
PayloadType* pt = (PayloadType*)ptr;
|
||||||
|
jstring jvalue =env->NewStringUTF(payload_type_get_mime(pt));
|
||||||
|
return jvalue;
|
||||||
|
}
|
||||||
|
extern "C" jint Java_org_linphone_core_PayloadTypeImpl_getRate(JNIEnv* env,jobject thiz, jlong ptr) {
|
||||||
|
PayloadType* pt = (PayloadType*)ptr;
|
||||||
|
return payload_type_get_rate(pt);
|
||||||
|
}
|
||||||
|
|
||||||
//LinphoneCall
|
//LinphoneCall
|
||||||
extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv* env
|
extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv* env
|
||||||
,jobject thiz
|
,jobject thiz
|
||||||
|
|
@ -1023,6 +1041,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCurrentParams(JNIEnv
|
||||||
return (jlong) linphone_call_get_current_params((LinphoneCall*)lc);
|
return (jlong) linphone_call_get_current_params((LinphoneCall*)lc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *env, jobject thiz, jlong lc, jboolean b){
|
||||||
|
linphone_call_enable_camera((LinphoneCall *)lc, (bool_t) b);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_inviteAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong addr, jlong params){
|
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_inviteAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong addr, jlong params){
|
||||||
return (jlong) linphone_core_invite_address_with_params((LinphoneCore *)lc, (const LinphoneAddress *)addr, (const LinphoneCallParams *)params);
|
return (jlong) linphone_core_invite_address_with_params((LinphoneCore *)lc, (const LinphoneAddress *)addr, (const LinphoneCallParams *)params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,4 +155,6 @@ public interface LinphoneCall {
|
||||||
*/
|
*/
|
||||||
public LinphoneCallParams getCurrentParamsReadOnly();
|
public LinphoneCallParams getCurrentParamsReadOnly();
|
||||||
|
|
||||||
|
public void enableCamera(boolean enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -485,4 +485,7 @@ public interface LinphoneCore {
|
||||||
public void setPreferredVideoSize(VideoSize vSize);
|
public void setPreferredVideoSize(VideoSize vSize);
|
||||||
|
|
||||||
public VideoSize getPreferredVideoSize();
|
public VideoSize getPreferredVideoSize();
|
||||||
|
|
||||||
|
public PayloadType[] listVideoCodecs();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,5 @@ package org.linphone.core;
|
||||||
|
|
||||||
public interface PayloadType {
|
public interface PayloadType {
|
||||||
|
|
||||||
|
String getMime();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ public final class VideoSize {
|
||||||
public static final int QCIF = 0;
|
public static final int QCIF = 0;
|
||||||
public static final int CIF = 1;
|
public static final int CIF = 1;
|
||||||
public static final int HVGA = 2;
|
public static final int HVGA = 2;
|
||||||
|
public static final int QVGA = 3;
|
||||||
|
|
||||||
private int width;
|
private int width;
|
||||||
public int getWidth() {return width;}
|
public int getWidth() {return width;}
|
||||||
|
|
@ -40,14 +41,16 @@ public final class VideoSize {
|
||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final VideoSize createStandard(int code) {
|
public static final VideoSize createStandard(int code, boolean inverted) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case QCIF:
|
case QCIF:
|
||||||
return new VideoSize(176, 144);
|
return inverted? new VideoSize(144, 176) : new VideoSize(176, 144);
|
||||||
case CIF:
|
case CIF:
|
||||||
return new VideoSize(352, 288);
|
return inverted? new VideoSize(288, 352) : new VideoSize(352, 288);
|
||||||
case HVGA:
|
case HVGA:
|
||||||
return new VideoSize(320, 480);
|
return inverted? new VideoSize(320,480) : new VideoSize(480, 320);
|
||||||
|
case QVGA:
|
||||||
|
return inverted? new VideoSize(240, 320) : new VideoSize(320, 240);
|
||||||
default:
|
default:
|
||||||
return new VideoSize(); // Invalid one
|
return new VideoSize(); // Invalid one
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 28a6e7f22fbdd93a01676fc9cc47a2605c846d75
|
Subproject commit bc6aeef2ee689c5efe5222c2e696bd1f42a4846c
|
||||||
Loading…
Add table
Reference in a new issue