Merge remote-tracking branch 'origin/master' into dev_im_encryption_engine

This commit is contained in:
Sylvain Berfini 2016-11-09 18:00:43 +01:00
commit e8258de05b
50 changed files with 494 additions and 226 deletions

View file

@ -247,7 +247,7 @@ if(MSVC)
endif()
else()
list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized" "-Wno-error=deprecated-declarations")
list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes" "-Werror=strict-prototypes")
list(APPEND STRICT_OPTIONS_C "-Wstrict-prototypes" "-Werror=strict-prototypes")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND STRICT_OPTIONS_C "-fno-inline-small-functions")
endif()

View file

@ -776,7 +776,7 @@ AC_ARG_ENABLE(strict,
)
STRICT_OPTIONS="-Wall -Wuninitialized"
STRICT_OPTIONS_CC="-Wdeclaration-after-statement -Wstrict-prototypes"
STRICT_OPTIONS_CC="-Wstrict-prototypes"
STRICT_OPTIONS_CXX=""
#for clang

View file

@ -2070,7 +2070,7 @@ static int lpc_cmd_status(LinphoneCore *lc, char *args)
linphonec_out("hook=paused sip:%s\n",linphonec_get_callee());
break;
case LinphoneCallIdle:
linphonec_out("hook=offhook\n");
linphonec_out("hook=on-hook\n");
break;
case LinphoneCallStreamsRunning:
case LinphoneCallConnected:

View file

@ -61,6 +61,14 @@ void linphone_account_creator_cbs_set_user_data(LinphoneAccountCreatorCbs *cbs,
cbs->user_data = ud;
}
LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_update_hash(const LinphoneAccountCreatorCbs *cbs) {
return cbs->update_hash;
}
void linphone_account_creator_cbs_set_update_hash(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsStatusCb cb) {
cbs->update_hash = cb;
}
LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_is_account_used(const LinphoneAccountCreatorCbs *cbs) {
return cbs->is_account_used;
}
@ -367,6 +375,54 @@ const char * linphone_account_creator_get_password(const LinphoneAccountCreator
return creator->password;
}
static void _password_updated_cb(LinphoneXmlRpcRequest *request) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
if (creator->callbacks->update_hash != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorReqFailed;
const char* resp = linphone_xml_rpc_request_get_string_response(request);
if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) {
if (strcmp(resp, "OK") == 0) {
status = LinphoneAccountCreatorOK;
} else if (strcmp(resp, "ERROR_PASSWORD_DOESNT_MATCH") == 0) {
status = LinphoneAccountCreatorAccountNotExist;
} else {
status = LinphoneAccountCreatorErrorServer;
}
}
creator->callbacks->update_hash(creator, status, resp);
}
}
LinphoneAccountCreatorStatus linphone_account_creator_update_password(LinphoneAccountCreator *creator, const char *new_pwd){
LinphoneXmlRpcRequest *request;
char *identity = _get_identity(creator);
if (!identity || (!creator->username && !creator->phone_number
&& !creator->domain && (!creator->password || !creator->ha1))) {
if (creator->callbacks->update_hash != NULL) {
creator->callbacks->update_hash(creator, LinphoneAccountCreatorReqFailed, "Missing required parameters");
}
return LinphoneAccountCreatorReqFailed;
}
const char * username = creator->username ? creator->username : creator->phone_number;
const char * ha1 = ms_strdup(creator->ha1 ? creator->ha1 : ha1_for_passwd(username, creator->domain, creator->password) );
const char * new_ha1 = ms_strdup(ha1_for_passwd(username, creator->domain, new_pwd));
request = linphone_xml_rpc_request_new_with_args("update_hash", LinphoneXmlRpcArgString,
LinphoneXmlRpcArgString, username,
LinphoneXmlRpcArgString, ha1,
LinphoneXmlRpcArgString, new_ha1,
LinphoneXmlRpcArgString, creator->domain,
LinphoneXmlRpcArgNone);
linphone_xml_rpc_request_set_user_data(request, creator);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _password_updated_cb);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
return LinphoneAccountCreatorOK;
}
LinphoneAccountCreatorStatus linphone_account_creator_set_ha1(LinphoneAccountCreator *creator, const char *ha1){
set_string(&creator->ha1, ha1, FALSE);
return LinphoneAccountCreatorOK;

View file

@ -145,6 +145,14 @@ LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_userna
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_username(const LinphoneAccountCreator *creator);
/**
* Update the password.
* @param[in] creator LinphoneAccountCreator object
* @param[in] new_pwd const char * : new password for the account creator
* @return LinphoneAccountCreatorOk if everything is OK, or a specific error otherwise.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_update_password(LinphoneAccountCreator *creator, const char *new_pwd);
/**
* Set the phone number normalized.
* @param[in] creator LinphoneAccountCreator object
@ -379,6 +387,20 @@ LINPHONE_PUBLIC void *linphone_account_creator_cbs_get_user_data(const LinphoneA
**/
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_user_data(LinphoneAccountCreatorCbs *cbs, void *ud);
/**
* Retrieve the user pointer associated with a LinphoneAccountCreatorCbs object.
* @param[in] cbs LinphoneAccountCreatorCbs object.
* @return The user pointer associated with the LinphoneAccountCreatorCbs object.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_update_hash(const LinphoneAccountCreatorCbs *cbs);
/**
* Assign a user pointer to a LinphoneAccountCreatorCbs object.
* @param[in] cbs LinphoneAccountCreatorCbs object.
* @param[in] ud The user pointer to associate with the LinphoneAccountCreatorCbs object.
**/
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_update_hash(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsStatusCb cb);
/**
* Get the current linked tested callback.
* @param[in] cbs LinphoneAccountCreatorCbs object.

View file

@ -484,7 +484,7 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *in
/**
* Returns an unmodifiable list of currently entered LinphoneAuthInfo.
* @param[in] lc The LinphoneCore object
* @return \mslist{LinphoneAuthInfo}
* @return \bctbx_list{LinphoneAuthInfo}
**/
const bctbx_list_t *linphone_core_get_auth_info_list(const LinphoneCore *lc){
return lc->auth_info;

View file

@ -103,7 +103,7 @@ LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *o
* The returned bctbx_list_t contains URIs of all participant. That list must be
* freed after use and each URI must be unref with linphone_address_unref()
* @param obj A #LinphoneConference
* @return \mslist{LinphoneAddress}
* @return \bctbx_list{LinphoneAddress}
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_conference_get_participants(const LinphoneConference *obj);

View file

@ -261,6 +261,10 @@ int linphone_dial_plan_lookup_ccc_from_e164(const char* e164) {
LinphoneDialPlan* elected_dial_plan=NULL;
unsigned int found;
unsigned int i=0;
if (e164[0]!='+') {
return -1;/*not an e164 number*/
}
if (e164[1]=='1') {
/*USA case*/
return 1;
@ -292,14 +296,13 @@ int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) {
return -1;
}
const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc) {
const LinphoneDialPlan* linphone_dial_plan_by_ccc_as_int(int ccc) {
int i;
if (!ccc) {
return &most_common_dialplan;
}
char ccc_as_char[16] = {0};
snprintf(ccc_as_char,sizeof(ccc_as_char)-1,"%i",ccc);
for(i=0;dial_plans[i].country!=NULL;++i){
if (strcmp(ccc,dial_plans[i].ccc)==0){
if (strcmp(ccc_as_char,dial_plans[i].ccc)==0){
return &dial_plans[i];
}
}
@ -307,6 +310,15 @@ const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc) {
return &most_common_dialplan;
}
const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc) {
if (!ccc) {
return &most_common_dialplan;
}
return linphone_dial_plan_by_ccc_as_int((int)strtol(ccc,NULL,10));
}
const LinphoneDialPlan* linphone_dial_plan_get_all() {
return dial_plans;
}

View file

@ -744,8 +744,6 @@ void linphone_friend_edit(LinphoneFriend *fr) {
void linphone_friend_done(LinphoneFriend *fr) {
ms_return_if_fail(fr);
if (!fr->lc) return;
linphone_friend_apply(fr, fr->lc);
linphone_friend_save(fr, fr->lc);
if (fr && linphone_core_vcard_supported() && fr->vcard) {
if (linphone_vcard_compare_md5_hash(fr->vcard) != 0) {
@ -756,6 +754,8 @@ void linphone_friend_done(LinphoneFriend *fr) {
}
}
}
linphone_friend_apply(fr, fr->lc);
linphone_friend_save(fr, fr->lc);
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
@ -1221,7 +1221,7 @@ void linphone_core_friends_storage_init(LinphoneCore *lc) {
linphone_create_table(db);
if (linphone_update_table(db)) {
// After updating schema, database need to be closed/reopenned
sqlite3_close(lc->friends_db);
sqlite3_close(db);
_linphone_sqlite3_open(lc->friends_db_file, &db);
}

View file

@ -87,7 +87,7 @@ LINPHONE_PUBLIC void linphone_core_remove_friend_list(LinphoneCore *lc, Linphone
/**
* Retrieves the list of LinphoneFriendList from the core.
* @param[in] lc LinphoneCore object
* @return \mslist{LinphoneFriendList} a list of LinphoneFriendList
* @return \bctbx_list{LinphoneFriendList} a list of LinphoneFriendList
*/
LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friends_lists(const LinphoneCore *lc);
@ -196,7 +196,7 @@ LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_remove_friend(Linp
/**
* Retrieves the list of LinphoneFriend from this LinphoneFriendList.
* @param[in] list LinphoneFriendList object
* @return \mslist{LinphoneFriend} a list of LinphoneFriend
* @return \bctbx_list{LinphoneFriend} a list of LinphoneFriend
*/
LINPHONE_PUBLIC const bctbx_list_t * linphone_friend_list_get_friends(const LinphoneFriendList *list);

View file

@ -228,7 +228,7 @@ TAB_SIZE = 8
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
ALIASES = "mslist{1}=A list of \ref \1 objects. \xmlonly <mslist>\1</mslist> \endxmlonly"
ALIASES = "bctbx_list{1}=A list of \ref \1 objects. \xmlonly <bctbxlist>\1</bctbxlist> \endxmlonly"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"

View file

@ -111,7 +111,7 @@ int main(int argc, char *argv[]){
/* main loop for sending message and doing background linphonecore work: */
while(running){
char character;
int character;
/*to disable terminal buffering*/
if (system ("/bin/stty raw") == -1){
ms_error("/bin/stty error");

View file

@ -227,7 +227,7 @@ LINPHONE_PUBLIC void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, Linph
/**
* Get added servers
* @param tunnel LinphoneTunnel object
* @return \mslist{LinphoneTunnelConfig}
* @return \bctbx_list{LinphoneTunnelConfig}
*/
LINPHONE_PUBLIC const bctbx_list_t *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel);

View file

@ -668,13 +668,16 @@ static const char *linphone_call_get_bind_ip_for_stream(LinphoneCall *call, int
const char *bind_ip = lp_config_get_string(call->core->config,"rtp","bind_address",
call->af == AF_INET6 ? "::0" : "0.0.0.0");
PortConfig *pc = &call->media_ports[stream_index];
if (stream_index<2 && pc->multicast_ip[0]!='\0'){
if (pc->multicast_ip[0]!='\0'){
if (call->dir==LinphoneCallOutgoing){
/*as multicast sender, we must decide a local interface to use to send multicast, and bind to it*/
linphone_core_get_local_ip_for(strchr(pc->multicast_ip,':') ? AF_INET6 : AF_INET,
NULL, pc->multicast_bind_ip);
bind_ip = pc->multicast_bind_ip;
}else{
/*otherwise we shall use an address family of the same family of the multicast address, because
* dual stack socket and multicast don't work well on Mac OS (linux is OK, as usual).*/
bind_ip = strchr(pc->multicast_ip,':') ? "::0" : "0.0.0.0";
}
}
return bind_ip;
@ -683,7 +686,7 @@ static const char *linphone_call_get_bind_ip_for_stream(LinphoneCall *call, int
static const char *linphone_call_get_public_ip_for_stream(LinphoneCall *call, int stream_index){
const char *public_ip=call->media_localip;
if (stream_index<2 && call->media_ports[stream_index].multicast_ip[0]!='\0')
if (call->media_ports[stream_index].multicast_ip[0]!='\0')
public_ip=call->media_ports[stream_index].multicast_ip;
return public_ip;
}
@ -5160,6 +5163,10 @@ void linphone_call_repair_if_broken(LinphoneCall *call){
case LinphoneCallOutgoingRinging:
linphone_call_repair_by_invite_with_replaces(call);
break;
case LinphoneCallIncomingEarlyMedia:
case LinphoneCallIncomingReceived:
/* Keep the call broken until a forked INVITE is received from the server. */
break;
default:
ms_warning("linphone_call_repair_if_broken(): don't know what to do in state [%s]", linphone_call_state_to_string(call->state));
call->broken = FALSE;
@ -5178,16 +5185,8 @@ void linphone_call_refresh_sockets(LinphoneCall *call){
}
void linphone_call_replace_op(LinphoneCall *call, SalOp *op) {
switch (linphone_call_get_state(call)) {
case LinphoneCallConnected:
case LinphoneCallStreamsRunning:
sal_call_terminate(call->op);
break;
default:
break;
}
sal_op_kill_dialog(call->op);
sal_op_release(call->op);
SalOp *oldop = call->op;
LinphoneCallState oldstate = linphone_call_get_state(call);
call->op = op;
sal_op_set_user_pointer(call->op, call);
sal_call_set_local_media_description(call->op, call->localdesc);
@ -5204,4 +5203,24 @@ void linphone_call_replace_op(LinphoneCall *call, SalOp *op) {
ms_warning("linphone_call_replace_op(): don't know what to do in state [%s]", linphone_call_state_to_string(call->state));
break;
}
switch (oldstate) {
case LinphoneCallIncomingEarlyMedia:
case LinphoneCallIncomingReceived:
sal_op_set_user_pointer(oldop, NULL); /* To make the call does not get terminated by terminating this op. */
/* Do not terminate a forked INVITE */
if (sal_call_get_replaces(op)) {
sal_call_terminate(oldop);
} else {
sal_op_kill_dialog(oldop);
}
break;
case LinphoneCallConnected:
case LinphoneCallStreamsRunning:
sal_call_terminate(oldop);
sal_op_kill_dialog(oldop);
break;
default:
break;
}
sal_op_release(oldop);
}

View file

@ -1989,7 +1989,7 @@ LinphoneAddress *linphone_core_get_primary_contact_parsed(LinphoneCore *lc){
/**
* Sets the list of audio codecs.
* @param[in] lc The LinphoneCore object
* @param[in] codecs \mslist{PayloadType}
* @param[in] codecs \bctbx_list{PayloadType}
* @return 0
*
* @ingroup media_parameters
@ -2007,7 +2007,7 @@ int linphone_core_set_audio_codecs(LinphoneCore *lc, bctbx_list_t *codecs){
/**
* Sets the list of video codecs.
* @param[in] lc The LinphoneCore object
* @param[in] codecs \mslist{PayloadType}
* @param[in] codecs \bctbx_list{PayloadType}
* @return 0
*
* @ingroup media_parameters
@ -3582,7 +3582,7 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){
subject="Conference";
}else if (call->params->internal_call_update){
subject="ICE processing concluded";
}else if (!no_user_consent){
}else if (no_user_consent){
subject="Refreshing";
}else{
subject="Media change";
@ -4144,7 +4144,7 @@ int linphone_core_terminate_all_calls(LinphoneCore *lc){
/**
* Returns the current list of calls.
* @param[in] lc The LinphoneCore object
* @return \mslist{LinphoneCall}
* @return \bctbx_list{LinphoneCall}
*
* Note that this list is read-only and might be changed by the core after a function call to linphone_core_iterate().
* Similarly the LinphoneCall objects inside it might be destroyed without prior notice.

View file

@ -1584,7 +1584,7 @@ LINPHONE_PUBLIC int linphone_chat_room_get_history_size(LinphoneChatRoom *cr);
* Gets nb_message most recent messages from cr chat room, sorted from oldest to most recent.
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which messages should be retrieved
* @param[in] nb_message Number of message to retrieve. 0 means everything.
* @return \mslist{LinphoneChatMessage}
* @return \bctbx_list{LinphoneChatMessage}
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message);
@ -1593,7 +1593,7 @@ LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *c
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which messages should be retrieved
* @param[in] begin The first message of the range to be retrieved. History most recent message has index 0.
* @param[in] end The last message of the range to be retrieved. History oldest message has index of history size - 1 (use #linphone_chat_room_get_history_size to retrieve history size)
* @return \mslist{LinphoneChatMessage}
* @return \bctbx_list{LinphoneChatMessage}
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end);
@ -1644,7 +1644,7 @@ LINPHONE_PUBLIC uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr)
/**
* Returns an list of chat rooms
* @param[in] lc #LinphoneCore object
* @return \mslist{LinphoneChatRoom}
* @return \bctbx_list{LinphoneChatRoom}
**/
LINPHONE_PUBLIC const bctbx_list_t* linphone_core_get_chat_rooms(LinphoneCore *lc);
LINPHONE_PUBLIC unsigned int linphone_chat_message_store(LinphoneChatMessage *msg);
@ -2913,7 +2913,7 @@ LINPHONE_PUBLIC void linphone_core_set_dns_servers(LinphoneCore *lc, const bctbx
/**
* Returns the list of available audio codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
* @return \bctbx_list{PayloadType}
*
* This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
@ -2928,7 +2928,7 @@ LINPHONE_PUBLIC int linphone_core_set_audio_codecs(LinphoneCore *lc, bctbx_list_
/**
* Returns the list of available video codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
* @return \bctbx_list{PayloadType}
*
* This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
@ -2943,7 +2943,7 @@ LINPHONE_PUBLIC int linphone_core_set_video_codecs(LinphoneCore *lc, bctbx_list_
/**
* Returns the list of available text codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
* @return \bctbx_list{PayloadType}
*
* This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
@ -3079,7 +3079,7 @@ LINPHONE_PUBLIC void linphone_core_remove_proxy_config(LinphoneCore *lc, Linphon
/**
* Returns an unmodifiable list of entered proxy configurations.
* @param[in] lc The LinphoneCore object
* @return \mslist{LinphoneProxyConfig}
* @return \bctbx_list{LinphoneProxyConfig}
**/
LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
@ -3540,7 +3540,7 @@ LINPHONE_PUBLIC void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *l
/**
* Get the list of call logs (past calls).
* @param[in] lc LinphoneCore object
* @return \mslist{LinphoneCallLog}
* @return \bctbx_list{LinphoneCallLog}
**/
LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_call_logs(LinphoneCore *lc);
@ -3549,7 +3549,7 @@ LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_call_logs(LinphoneCore *l
* At the contrary of linphone_core_get_call_logs, it is your responsability to unref the logs and free this list once you are done using it.
* @param[in] lc LinphoneCore object
* @param[in] addr LinphoneAddress object
* @return \mslist{LinphoneCallLog}
* @return \bctbx_list{LinphoneCallLog}
**/
LINPHONE_PUBLIC bctbx_list_t * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr);

View file

@ -8224,6 +8224,34 @@ static void account_creator_phone_account_recovered(LinphoneAccountCreator *crea
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
}
static void account_creator_password_updated(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, const char *resp) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
if (result != 0) {
ms_error("cannot attach VM\n");
return;
}
ms_warning("test callback password updated");
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs);
if (listener == NULL) {
ms_error("account_creator_response() notification without listener");
return ;
}
LinphoneCore *lc = (LinphoneCore *)creator->core;
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
jclass clazz = (jclass) env->GetObjectClass(listener);
jmethodID method = env->GetMethodID(clazz, "onAccountCreatorPasswordUpdated","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V");
env->DeleteLocalRef(clazz);
jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status);
env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject);
}
extern "C" jlong Java_org_linphone_core_LinphoneAccountCreatorImpl_newLinphoneAccountCreator(JNIEnv *env, jobject thiz, jlong core, jstring jurl) {
const char *url = GetStringUTFChars(env, jurl);
LinphoneAccountCreator *account_creator = linphone_account_creator_new((LinphoneCore *)core, url);
@ -8252,6 +8280,8 @@ extern "C" void Java_org_linphone_core_LinphoneAccountCreatorImpl_setListener(JN
linphone_account_creator_cbs_set_is_account_activated(cbs, account_creator_is_account_activated);
linphone_account_creator_cbs_set_recover_phone_account(cbs, account_creator_phone_account_recovered);
linphone_account_creator_cbs_set_is_phone_number_used(cbs, account_creator_is_phone_number_used);
linphone_account_creator_cbs_set_is_account_linked(cbs, account_creator_is_account_linked);
linphone_account_creator_cbs_set_update_hash(cbs, account_creator_password_updated);
}
extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_setUsername(JNIEnv *env, jobject thiz, jlong ptr, jstring jusername) {
@ -8450,6 +8480,15 @@ extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_recoverPhoneAc
return (jint) linphone_account_creator_recover_phone_account(account_creator);
}
extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_updatePassword(JNIEnv *env, jobject thiz, jlong ptr, jstring jpasswd) {
jint status;
LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr;
const char* passwd = GetStringUTFChars(env, jpasswd);
status = (jint) linphone_account_creator_update_password(account_creator, passwd);
ReleaseStringUTFChars(env, jpasswd, passwd);
return status;
}
extern "C" jobject Java_org_linphone_core_LinphoneAccountCreatorImpl_configure(JNIEnv *env, jobject thiz, jlong ptr) {
LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr;
LinphoneProxyConfig *lpc = linphone_account_creator_configure(account_creator);

View file

@ -133,7 +133,13 @@ LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_get_all(void);
* @return Return matching dial plan, or a generic one if none found
**/
LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc);
/**
* Find best match for given CCC
* @return Return matching dial plan, or a generic one if none found
**/
LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_by_ccc_as_int(int ccc);
/**
* Return if given plan is generic
**/

View file

@ -175,7 +175,7 @@ LINPHONE_PUBLIC void linphone_friend_add_address(LinphoneFriend *lf, const Linph
/**
* Returns a list of #LinphoneAddress for this friend
* @param lf #LinphoneFriend object
* @return \mslist{LinphoneAddress}
* @return \bctbx_list{LinphoneAddress}
*/
LINPHONE_PUBLIC const bctbx_list_t* linphone_friend_get_addresses(const LinphoneFriend *lf);
@ -196,7 +196,7 @@ LINPHONE_PUBLIC void linphone_friend_add_phone_number(LinphoneFriend *lf, const
/**
* Returns a list of phone numbers for this friend
* @param lf #LinphoneFriend object
* @return \mslist{const char *}
* @return \bctbx_list{const char *}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_phone_numbers(LinphoneFriend *lf);
@ -444,7 +444,7 @@ LINPHONE_PUBLIC void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneF
/**
* Get Buddy list of LinphoneFriend
* @param[in] lc #LinphoneCore object
* @return \mslist{LinphoneFriend}
* @return \bctbx_list{LinphoneFriend}
* @deprecated use linphone_core_get_friends_lists() or linphone_friend_list_get_friends() instead.
*/
LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friend_list(const LinphoneCore *lc);

View file

@ -111,8 +111,8 @@ LINPHONE_PUBLIC const char *lp_config_get_string(const LpConfig *lpconfig, const
* @param[in] lpconfig A LpConfig object
* @param[in] section The section from which to retrieve a configuration item
* @param[in] key The name of the configuration item to retrieve
* @param[in] default_list \mslist{const char *}
* @return \mslist{const char *}
* @param[in] default_list \bctbx_list{const char *}
* @return \bctbx_list{const char *}
*/
LINPHONE_PUBLIC bctbx_list_t * lp_config_get_string_list(const LpConfig *lpconfig, const char *section, const char *key, bctbx_list_t *default_list);
@ -162,7 +162,7 @@ LINPHONE_PUBLIC void lp_config_set_string(LpConfig *lpconfig,const char *section
* @param[in] lpconfig A LpConfig object
* @param[in] section The name of the section to put the configuration item into
* @param[in] key The name of the configuration item to set
* @param[in] value \mslist{const char *} The value to set
* @param[in] value \bctbx_list{const char *} The value to set
*/
LINPHONE_PUBLIC void lp_config_set_string_list(LpConfig *lpconfig, const char *section, const char *key, const bctbx_list_t *value);

View file

@ -41,6 +41,7 @@ static void linphone_nat_policy_destroy(LinphoneNatPolicy *policy) {
if (policy->stun_addrinfo) bctbx_freeaddrinfo(policy->stun_addrinfo);
if (policy->stun_resolver_context) {
sal_resolve_cancel(policy->stun_resolver_context);
sal_resolver_context_unref(policy->stun_resolver_context);
}
}
@ -185,7 +186,6 @@ void linphone_nat_policy_set_stun_server(LinphoneNatPolicy *policy, const char *
}
if (new_stun_server != NULL) {
policy->stun_server = new_stun_server;
linphone_nat_policy_resolve_stun_server(policy);
}
}
@ -250,7 +250,7 @@ const struct addrinfo * linphone_nat_policy_get_stun_server_addrinfo(LinphoneNat
* - if no cached value exists, block for a short time; this case must be unprobable because the resolution will be asked each
* time the stun server value is changed.
*/
if (linphone_nat_policy_stun_server_activated(policy)) {
if (linphone_nat_policy_stun_server_activated(policy) && (policy->stun_addrinfo == NULL)) {
int wait_ms = 0;
int wait_limit = 1000;
linphone_nat_policy_resolve_stun_server(policy);

View file

@ -1344,6 +1344,7 @@ struct _LinphoneAccountCreatorCbs {
LinphoneAccountCreatorCbsStatusCb activate_phone_number_link;
LinphoneAccountCreatorCbsStatusCb recover_phone_account;
LinphoneAccountCreatorCbsStatusCb is_account_linked;
LinphoneAccountCreatorCbsStatusCb update_hash;
};
BELLE_SIP_DECLARE_VPTR(LinphoneAccountCreatorCbs);

View file

@ -594,19 +594,8 @@ static char *flatten_number(const char *number){
char *result=ms_malloc0(strlen(number)+1);
char *w=result;
const char *r;
bool_t removing_trunk_prefix = FALSE;
for(r=number;*r!='\0';++r){
if (result[0] == '+') {
/*e164 case*/
if (*r=='(') {
/*start removing trunk prefix as we are in form +33 (0) 6 222222*/
removing_trunk_prefix=TRUE;
} else if (*r==')') {
/*stop removing trunk prefix*/
removing_trunk_prefix=FALSE;
}
}
if (removing_trunk_prefix == FALSE && (*r=='+' || isdigit(*r))){
if (*r=='+' || isdigit(*r)){
*w++=*r;
}
}
@ -614,9 +603,9 @@ static char *flatten_number(const char *number){
return result;
}
static char* replace_plus_with_icp(char *phone, const char* icp){
/*static char* replace_plus_with_icp(char *phone, const char* icp){
return (icp && phone[0]=='+') ? ms_strdup_printf("%s%s", icp, phone+1) : ms_strdup(phone);
}
}*/
static char* replace_icp_with_plus(char *phone, const char *icp){
return (strstr(phone, icp) == phone) ? ms_strdup_printf("+%s", phone+strlen(icp)) : ms_strdup(phone);
@ -634,46 +623,62 @@ bool_t linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const
char* linphone_proxy_config_normalize_phone_number(LinphoneProxyConfig *proxy, const char *username) {
LinphoneProxyConfig *tmpproxy = proxy ? proxy : linphone_proxy_config_new();
char* result = NULL;
LinphoneDialPlan dialplan = {0};
char * nationnal_significant_number = NULL;
int ccc = -1;
if (linphone_proxy_config_is_phone_number(tmpproxy, username)){
LinphoneDialPlan dialplan = *linphone_dial_plan_by_ccc(tmpproxy->dial_prefix); //copy dial plan;
char * flatten=flatten_number(username);
ms_debug("Flattened number is '%s' for '%s'",flatten, username);
if (tmpproxy->dial_prefix){
if (strcmp(tmpproxy->dial_prefix,dialplan.ccc) != 0){
//probably generic dialplan, preserving proxy dial prefix
strncpy(dialplan.ccc,tmpproxy->dial_prefix,sizeof(dialplan.ccc));
ccc = linphone_dial_plan_lookup_ccc_from_e164(flatten);
if (ccc>-1) { /*e164 like phone number*/
dialplan = *linphone_dial_plan_by_ccc_as_int(ccc);
nationnal_significant_number = strstr(flatten, dialplan.ccc);
if (nationnal_significant_number) {
nationnal_significant_number +=strlen(dialplan.ccc);
}
}
/*if proxy has a dial prefix, modify phonenumber accordingly*/
if (tmpproxy->dial_prefix!=NULL && tmpproxy->dial_prefix[0]!='\0'){
ms_debug("Using dial plan '%s'",dialplan.country);
/* the number already starts with + or international prefix*/
if (flatten[0]=='+'||strstr(flatten,dialplan.icp)==flatten){
ms_debug("Prefix already present.");
if (tmpproxy->dial_escape_plus) {
result = replace_plus_with_icp(flatten,dialplan.icp);
} else {
result = replace_icp_with_plus(flatten,dialplan.icp);
} else if (flatten[0] =='+') {
ms_message ("Unknown ccc for e164 like number [%s]", flatten);
goto end;
} else {
dialplan = *linphone_dial_plan_by_ccc(tmpproxy->dial_prefix); //copy dial plan;
if (tmpproxy->dial_prefix){
if (strcmp(tmpproxy->dial_prefix,dialplan.ccc) != 0){
//probably generic dialplan, preserving proxy dial prefix
strncpy(dialplan.ccc,tmpproxy->dial_prefix,sizeof(dialplan.ccc));
}
}else{
/*0. keep at most national number significant digits */
char* flatten_start = flatten + MAX(0, (int)strlen(flatten) - (int)dialplan.nnl);
ms_debug("Prefix not present. Keeping at most %d digits: %s", dialplan.nnl, flatten_start);
/*1. First prepend international calling prefix or +*/
/*2. Second add prefix*/
/*3. Finally add user digits */
result = ms_strdup_printf("%s%s%s"
, tmpproxy->dial_escape_plus ? dialplan.icp : "+"
, dialplan.ccc
, flatten_start);
ms_debug("Prepended prefix resulted in %s", result);
}
}else if (tmpproxy->dial_escape_plus){
/* user did not provide dial prefix, so we'll take the most generic one */
result = replace_plus_with_icp(flatten,dialplan.icp);
if (strstr(flatten,dialplan.icp)==flatten) {
char *e164 = replace_icp_with_plus(flatten,dialplan.icp);
result = linphone_proxy_config_normalize_phone_number(tmpproxy,e164);
ms_free(e164);
goto end;
}
nationnal_significant_number=flatten;
}
ms_debug("Using dial plan '%s'",dialplan.country);
/*if proxy has a dial prefix, modify phonenumber accordingly*/
if (dialplan.ccc[0]!='\0') {
/* the number already starts with + or international prefix*/
/*0. keep at most national number significant digits */
char* nationnal_significant_number_start = nationnal_significant_number
+ MAX(0, (int)strlen(nationnal_significant_number)
- (int)dialplan.nnl);
ms_debug("Prefix not present. Keeping at most %d digits: %s", dialplan.nnl, nationnal_significant_number_start);
/*1. First prepend international calling prefix or +*/
/*2. Second add prefix*/
/*3. Finally add user digits */
result = ms_strdup_printf("%s%s%s"
, tmpproxy->dial_escape_plus ? dialplan.icp : "+"
, dialplan.ccc
, nationnal_significant_number_start);
ms_debug("Prepended prefix resulted in %s", result);
}
end:
if (result==NULL) {
result = flatten;
} else {

View file

@ -88,7 +88,7 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard);
* Uses belcard to parse the content of a file and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none.
* @param[in] context the vCard context to use (speed up the process by not creating a Belcard parser each time)
* @param[in] file the path to the file to parse
* @return \mslist{LinphoneVcard}
* @return \bctbx_list{LinphoneVcard}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *file);
@ -96,7 +96,7 @@ LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_context_get_vcard_list_from_file(Li
* Uses belcard to parse the content of a buffer and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none.
* @param[in] context the vCard context to use (speed up the process by not creating a Belcard parser each time)
* @param[in] buffer the buffer to parse
* @return \mslist{LinphoneVcard}
* @return \bctbx_list{LinphoneVcard}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_context_get_vcard_list_from_buffer(LinphoneVcardContext *context, const char *buffer);
@ -181,7 +181,7 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_
/**
* Returns the list of SIP addresses (as LinphoneAddress) in the vCard (all the IMPP attributes that has an URI value starting by "sip:") or NULL
* @param[in] vCard the LinphoneVcard
* @return const \mslist{LinphoneAddress *}
* @return \bctbx_list{LinphoneAddress}
*/
LINPHONE_PUBLIC const bctbx_list_t* linphone_vcard_get_sip_addresses(LinphoneVcard *vCard);
@ -202,7 +202,7 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone)
/**
* Returns the list of phone numbers (as string) in the vCard (all the TEL attributes) or NULL
* @param[in] vCard the LinphoneVcard
* @return \mslist{const char *}
* @return \bctbx_list{const char *}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard);
@ -293,4 +293,4 @@ void linphone_vcard_clean_cache(LinphoneVcard *vCard);
}
#endif
#endif
#endif

View file

@ -43,7 +43,7 @@ LinphoneCoreVTable *linphone_core_get_current_vtable(LinphoneCore *lc) {
static void cleanup_dead_vtable_refs(LinphoneCore *lc){
bctbx_list_t *it,*next_it;
if (lc->vtable_notify_recursion > 0) return; /*don't cleanup vtable if we are iterating through a listener list.*/
for(it=lc->vtable_refs; it!=NULL; ){
VTableReference *ref=(VTableReference*)it->data;
@ -327,7 +327,7 @@ void linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable){
void linphone_core_remove_listener(LinphoneCore *lc, const LinphoneCoreVTable *vtable) {
bctbx_list_t *it;
ms_message("Vtable [%p] unregistered on core [%p]",lc,vtable);
ms_message("Vtable [%p] unregistered on core [%p]",vtable,lc);
for(it=lc->vtable_refs; it!=NULL; it=it->next){
VTableReference *ref=(VTableReference*)it->data;
if (ref->vtable==vtable)

View file

@ -314,7 +314,7 @@ void linphone_gtk_call_log_update(GtkWidget *w){
start_date[strlen(start_date) - 1] = '\0';
}
#endif
lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),addr);
lf=linphone_core_find_friend(linphone_gtk_get_core(),la);
if(lf != NULL){
/*update display name from friend*/
display = linphone_friend_get_name(lf);

View file

@ -1297,7 +1297,7 @@ static void linphone_gtk_media_encryption_changed(GtkWidget *combo){
gtk_widget_set_sensitive(mandatory_box,TRUE);
}else if (strcasecmp(selected,"ZRTP")==0){
linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionZRTP);
gtk_widget_set_sensitive(mandatory_box,FALSE);
gtk_widget_set_sensitive(mandatory_box,TRUE);
} else {
linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionNone);
gtk_widget_set_sensitive(mandatory_box,FALSE);
@ -1389,7 +1389,7 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){
case LinphoneMediaEncryptionZRTP:
if (zrtp_id!=-1) {
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),zrtp_id);
linphone_gtk_set_media_encryption_mandatory_sensitive(pb,FALSE);
linphone_gtk_set_media_encryption_mandatory_sensitive(pb,TRUE);
}
break;
}

View file

@ -32,6 +32,7 @@ public interface LinphoneAccountCreator {
void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, Status status);
void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, Status status);
void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, Status status);
void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, Status status);
}
public static class Status {
@ -157,5 +158,7 @@ public interface LinphoneAccountCreator {
Status recoverPhoneAccount();
Status updatePassword(String newPassword);
LinphoneProxyConfig configure();
}

View file

@ -226,6 +226,12 @@ public class LinphoneAccountCreatorImpl implements LinphoneAccountCreator {
return Status.fromInt(recoverPhoneAccount(nativePtr));
}
private native int updatePassword(long ptr, String newPassword);
@Override
public Status updatePassword(String newPassword) {
return Status.fromInt(updatePassword(nativePtr, newPassword));
}
private native LinphoneProxyConfig configure(long ptr);
@Override
public LinphoneProxyConfig configure() {

View file

@ -130,7 +130,6 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
File factory = factoryConfig == null ? null : new File(factoryConfig);
LinphoneCore lc = new LinphoneCoreImpl(listener, user, factory, userdata);
lc.enableOpenH264(openh264Enabled);
if(context!=null) lc.setContext(context);
return lc;
} catch (IOException e) {
throw new LinphoneCoreException("Cannot create LinphoneCore",e);
@ -145,7 +144,6 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
MediastreamerAndroidContext.setContext(context);
LinphoneCore lc = new LinphoneCoreImpl(listener);
lc.enableOpenH264(openh264Enabled);
if(context!=null) lc.setContext(context);
return lc;
} catch (IOException e) {
throw new LinphoneCoreException("Cannot create LinphoneCore",e);

View file

@ -222,13 +222,13 @@ class LinphoneCoreImpl implements LinphoneCore {
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
setAndroidPowerManager(mContext.getSystemService(Context.POWER_SERVICE));
if (Version.sdkAboveOrEqual(Version.API12_HONEYCOMB_MR1_31X)) {
WifiManager wifiManager=(WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
WifiManager wifiManager=(WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
WifiLock lock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "linphonecore ["+ nativePtr+"] wifi-lock");
lock.setReferenceCounted(true);
setAndroidWifiLock(nativePtr,lock);
}
if (Version.sdkAboveOrEqual(Version.API14_ICE_CREAM_SANDWICH_40)) {
WifiManager wifiManager=(WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
WifiManager wifiManager=(WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
MulticastLock lock = wifiManager.createMulticastLock("linphonecore ["+ nativePtr+"] multicast-lock");
lock.setReferenceCounted(true);
setAndroidMulticastLock(nativePtr, lock);
@ -476,17 +476,17 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized void addFriend(LinphoneFriend lf) throws LinphoneCoreException {
addFriend(nativePtr, ((LinphoneFriendImpl) lf).nativePtr);
}
public synchronized LinphoneFriendList createLinphoneFriendList() {
return new LinphoneFriendListImpl(this);
}
public synchronized void addFriendList(LinphoneFriendList friendList) throws LinphoneCoreException {
addFriendList(nativePtr,((LinphoneFriendListImpl)friendList).nativePtr);
}
public synchronized void removeFriendList(LinphoneFriendList friendList) throws LinphoneCoreException {
removeFriendList(nativePtr,((LinphoneFriendListImpl)friendList).nativePtr);
}
@ -494,7 +494,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized LinphoneFriend[] getFriendList() {
return getFriendList(nativePtr);
}
private native LinphoneFriendList[] getFriendLists(long nativePtr);
public synchronized LinphoneFriendList[] getFriendLists() {
return getFriendLists(nativePtr);
@ -932,25 +932,25 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized void tunnelEnable(boolean enable) {
tunnelEnable(nativePtr, enable);
}
private native void tunnelSetMode(long nativePtr, int mode);
@Override
public synchronized void tunnelSetMode(LinphoneCore.TunnelMode mode) {
tunnelSetMode(nativePtr, TunnelMode.enumToInt(mode));
}
private native int tunnelGetMode(long nativePtr);
@Override
public synchronized LinphoneCore.TunnelMode tunnelGetMode() {
return LinphoneCore.TunnelMode.intToEnum(tunnelGetMode(nativePtr));
}
private native void tunnelEnableSip(long nativePtr, boolean enable);
@Override
public void tunnelEnableSip(boolean enable) {
tunnelEnableSip(nativePtr, enable);
}
private native boolean tunnelSipEnabled(long nativePtr);
@Override
public boolean tunnelSipEnabled() {
@ -1270,7 +1270,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized void setCallLogsDatabasePath(String path) {
setCallLogsDatabasePath(nativePtr, path);
}
public synchronized void setFriendsDatabasePath(String path) {
setFriendsDatabasePath(nativePtr, path);
}
@ -1453,13 +1453,13 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized void setVideoJittcomp(int value) {
setVideoJittcomp(nativePtr, value);
}
private native void setFileTransferServer(long ptr, String serverUrl);
@Override
public synchronized void setFileTransferServer(String serverUrl) {
setFileTransferServer(nativePtr, serverUrl);
}
private native String getFileTransferServer(long ptr);
@Override
public synchronized String getFileTransferServer() {
@ -1476,16 +1476,16 @@ class LinphoneCoreImpl implements LinphoneCore {
return null;
}
}
private native void addListener(long nativePtr, LinphoneCoreListener listener);
@Override
public void addListener(LinphoneCoreListener listener) {
public synchronized void addListener(LinphoneCoreListener listener) {
addListener(nativePtr, listener);
}
private native void removeListener(long nativePtr, LinphoneCoreListener listener);
@Override
public void removeListener(LinphoneCoreListener listener) {
public synchronized void removeListener(LinphoneCoreListener listener) {
removeListener(nativePtr, listener);
}
private native void setRemoteRingbackTone(long nativePtr, String file);
@ -1498,7 +1498,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public String getRemoteRingbackTone() {
return getRemoteRingbackTone(nativePtr);
}
private native void uploadLogCollection(long nativePtr);
@Override
public void uploadLogCollection() {
@ -1507,7 +1507,7 @@ class LinphoneCoreImpl implements LinphoneCore {
@Override
public native void resetLogCollection();
private native void setPreferredFramerate(long nativePtr, float fps);
@Override
public void setPreferredFramerate(float fps) {
@ -1518,8 +1518,8 @@ class LinphoneCoreImpl implements LinphoneCore {
public float getPreferredFramerate() {
return getPreferredFramerate(nativePtr);
}
private native int setAudioMulticastAddr(long nativePtr, String ip);
@Override
public void setAudioMulticastAddr(String ip) throws LinphoneCoreException {
@ -1547,18 +1547,18 @@ class LinphoneCoreImpl implements LinphoneCore {
public void setAudioMulticastTtl(int ttl) throws LinphoneCoreException {
if (setAudioMulticastTtl(nativePtr, ttl)!=0)
throw new LinphoneCoreException("bad ttl value ["+ttl+"]");
}
private native int setVideoMulticastTtl(long ptr,int ttl);
@Override
public void setVideoMulticastTtl(int ttl) throws LinphoneCoreException {
if (setVideoMulticastTtl(nativePtr, ttl)!=0)
throw new LinphoneCoreException("bad ttl value ["+ttl+"]");
throw new LinphoneCoreException("bad ttl value ["+ttl+"]");
}
private native int getAudioMulticastTtl(long ptr);
@Override
public int getAudioMulticastTtl() {
return getAudioMulticastTtl(nativePtr);
return getAudioMulticastTtl(nativePtr);
}
private native int getVideoMulticastTtl(long ptr);
@Override
@ -1576,7 +1576,7 @@ class LinphoneCoreImpl implements LinphoneCore {
return audioMulticastEnabled(nativePtr);
}
private native void enableVideoMulticast(long ptr,boolean yesno);
@Override
public void enableVideoMulticast(boolean yesno) {
enableVideoMulticast(nativePtr,yesno);
@ -1683,7 +1683,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public void setSipNetworkReachable(boolean isReachable) {
setSipNetworkReachable(nativePtr, isReachable);
}
private native void setMediaNetworkReachable(long nativePtr, boolean isReachable);
@Override
public void setMediaNetworkReachable(boolean isReachable) {
@ -1717,17 +1717,17 @@ class LinphoneCoreImpl implements LinphoneCore {
public void setDefaultSoundDevices() {
setDefaultSoundDevices(nativePtr);
}
private native boolean isLimeEncryptionAvailable(long nativePtr);
public synchronized boolean isLimeEncryptionAvailable() {
return isLimeEncryptionAvailable(nativePtr);
}
private native void setLimeEncryption(long nativePtr, int value);
public synchronized void setLimeEncryption(LinphoneLimeState lime) {
setLimeEncryption(nativePtr, lime.mValue);
}
private native int getLimeEncryption(long nativePtr);
public synchronized LinphoneLimeState getLimeEncryption() {
return LinphoneLimeState.fromInt(getLimeEncryption(nativePtr));

@ -1 +1 @@
Subproject commit 3e5e374d4e5cb1a0b39e2dfa2c926180b5de35fa
Subproject commit e84be0bfaf9bbd2786228db6064811ef2a58aee6

2
oRTP

@ -1 +1 @@
Subproject commit b1b2c1c2729400762050cdb247a466cd2636d92c
Subproject commit 49fdc102fe59adda8011a9d554493749aebad35b

View file

@ -1325,39 +1325,41 @@ static void ice_added_by_reinvite(void){
LinphoneCallParams *params;
LinphoneCall *c;
bool_t call_ok;
lp_config_set_int(linphone_core_get_config(marie->lc), "net", "allow_late_ice", 1);
lp_config_set_int(linphone_core_get_config(pauline->lc), "net", "allow_late_ice", 1);
BC_ASSERT_TRUE((call_ok=call(pauline,marie)));
if (!call_ok) goto end;
liblinphone_tester_check_rtcp(marie,pauline);
/*enable ICE on both ends*/
pol = linphone_core_get_nat_policy(marie->lc);
linphone_nat_policy_enable_ice(pol, TRUE);
linphone_nat_policy_enable_stun(pol, TRUE);
linphone_core_set_nat_policy(marie->lc, pol);
pol = linphone_core_get_nat_policy(pauline->lc);
linphone_nat_policy_enable_ice(pol, TRUE);
linphone_nat_policy_enable_stun(pol, TRUE);
linphone_core_set_nat_policy(pauline->lc, pol);
linphone_core_manager_wait_for_stun_resolution(marie);
linphone_core_manager_wait_for_stun_resolution(pauline);
c = linphone_core_get_current_call(marie->lc);
params = linphone_core_create_call_params(marie->lc, c);
linphone_core_update_call(marie->lc, c, params);
linphone_call_params_destroy(params);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1));
/*wait for the ICE reINVITE*/
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,3));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,3));
BC_ASSERT_TRUE(check_ice(marie, pauline, LinphoneIceStateHostConnection));
end_call(pauline, marie);
end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -1800,6 +1802,9 @@ static void audio_call_with_ice_no_matching_audio_codecs(void) {
linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
linphone_core_manager_wait_for_stun_resolution(marie);
linphone_core_manager_wait_for_stun_resolution(pauline);
out_call = linphone_core_invite_address(marie->lc, pauline->identity);
linphone_call_ref(out_call);
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1));
@ -4159,6 +4164,7 @@ static void call_record_with_custom_rtp_modifier(void) {
}
static void recovered_call_on_network_switch_in_early_state_1(void) {
const LinphoneCallParams *remote_params;
LinphoneCall *incoming_call;
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
@ -4174,6 +4180,12 @@ static void recovered_call_on_network_switch_in_early_state_1(void) {
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, 2));
incoming_call = linphone_core_get_current_call(pauline->lc);
remote_params = linphone_call_get_remote_params(incoming_call);
BC_ASSERT_PTR_NOT_NULL(remote_params);
if (remote_params != NULL) {
const char *replaces_header = linphone_call_params_get_custom_header(remote_params, "Replaces");
BC_ASSERT_PTR_NOT_NULL(replaces_header);
}
linphone_core_accept_call(pauline->lc, incoming_call);
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
@ -4198,7 +4210,6 @@ static void recovered_call_on_network_switch_in_early_state_2(void) {
incoming_call = linphone_core_get_current_call(pauline->lc);
linphone_core_accept_call(pauline->lc, incoming_call);
//linphone_core_iterate(pauline->lc);
linphone_core_set_network_reachable(marie->lc, FALSE);
wait_for(marie->lc, pauline->lc, &marie->stat.number_of_NetworkReachableFalse, 1);
linphone_core_set_network_reachable(marie->lc, TRUE);
@ -4481,6 +4492,8 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh
if (use_ice){
linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce);
linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce);
linphone_core_manager_wait_for_stun_resolution(marie);
linphone_core_manager_wait_for_stun_resolution(pauline);
}
if (with_socket_refresh){
lp_config_set_int(linphone_core_get_config(marie->lc), "net", "recreate_sockets_when_network_is_up", 1);
@ -5393,14 +5406,14 @@ test_t call_tests[] = {
TEST_NO_TAG("Call record with custom RTP Modifier", call_record_with_custom_rtp_modifier),
TEST_NO_TAG("Call with network switch", call_with_network_switch),
TEST_NO_TAG("Call with network switch and no recovery possible", call_with_network_switch_no_recovery),
TEST_NO_TAG("Recovered call on network switch in early state 1", recovered_call_on_network_switch_in_early_state_1),
TEST_NO_TAG("Recovered call on network switch in early state 2", recovered_call_on_network_switch_in_early_state_2),
TEST_NO_TAG("Recovered call on network switch in early state 3", recovered_call_on_network_switch_in_early_state_3),
TEST_NO_TAG("Recovered call on network switch in early state 4", recovered_call_on_network_switch_in_early_state_4),
TEST_NO_TAG("Recovered call on network switch during re-invite 1", recovered_call_on_network_switch_during_reinvite_1),
TEST_NO_TAG("Recovered call on network switch during re-invite 2", recovered_call_on_network_switch_during_reinvite_2),
TEST_NO_TAG("Recovered call on network switch during re-invite 3", recovered_call_on_network_switch_during_reinvite_3),
TEST_NO_TAG("Recovered call on network switch during re-invite 4", recovered_call_on_network_switch_during_reinvite_4),
TEST_ONE_TAG("Recovered call on network switch in early state 1", recovered_call_on_network_switch_in_early_state_1, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch in early state 2", recovered_call_on_network_switch_in_early_state_2, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch in early state 3", recovered_call_on_network_switch_in_early_state_3, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch in early state 4", recovered_call_on_network_switch_in_early_state_4, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch during re-invite 1", recovered_call_on_network_switch_during_reinvite_1, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch during re-invite 2", recovered_call_on_network_switch_during_reinvite_2, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch during re-invite 3", recovered_call_on_network_switch_during_reinvite_3, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch during re-invite 4", recovered_call_on_network_switch_during_reinvite_4, "CallRecovery"),
TEST_ONE_TAG("Call with network switch and ICE", call_with_network_switch_and_ice, "ICE"),
TEST_ONE_TAG("Call with network switch, ICE and RTT", call_with_network_switch_ice_and_rtt, "ICE"),
TEST_NO_TAG("Call with network switch with socket refresh", call_with_network_switch_and_socket_refresh),

View file

@ -1092,6 +1092,9 @@ static void call_with_ice_video_and_rtt(void) {
linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
linphone_core_manager_wait_for_stun_resolution(marie);
linphone_core_manager_wait_for_stun_resolution(pauline);
linphone_core_set_audio_port(marie->lc, -1);
linphone_core_set_video_port(marie->lc, -1);
linphone_core_set_text_port(marie->lc, -1);

View file

@ -307,6 +307,12 @@ static void subscribe_test_manually_refreshed(void){
}
static void subscribe_loosing_dialog(void) {
#ifdef WIN32
/*Unfortunately this test doesn't work on windows due to the way closed TCP ports behave.
* Unlike linux and macOS, released TCP port don't send an ICMP error (or maybe at least for a period of time.
* This prevents this test from working, see comments below*/
ms_warning("subscribe_loosing_dialog() skipped on windows.");
#else
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneContent* content;
@ -345,12 +351,16 @@ static void subscribe_loosing_dialog(void) {
pauline = linphone_core_manager_new( "pauline_tcp_rc");
lcs = bctbx_list_append(lcs, pauline->lc);
/*marie will retry the subscription*/
/* Marie will retry the subscription.
* She will first receive a 503 Service unavailable from flexisip thanks the ICMP error returned by the no longer existing Pauline.
* Then she will forge a new SUBSCRIBE in order to restart a new dialog, and this one will reach the new Pauline.*/
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingProgress,2,8000));
/*and get it accepted again*/
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000));
BC_ASSERT_EQUAL(linphone_event_get_subscription_state(pauline->lev), LinphoneSubscriptionActive, int, "%d");
BC_ASSERT_PTR_NOT_NULL(pauline->lev);
if (pauline->lev) BC_ASSERT_EQUAL(linphone_event_get_subscription_state(pauline->lev), LinphoneSubscriptionActive, int, "%d");
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,2,5000));
linphone_event_terminate(lev);
@ -362,6 +372,7 @@ static void subscribe_loosing_dialog(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
bctbx_list_free(lcs);
#endif
}
static void subscribe_with_io_error(void) {
@ -418,6 +429,53 @@ static void subscribe_with_io_error(void) {
bctbx_list_free(lcs);
}
static void subscribe_not_timely_responded(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneContent* content;
LinphoneEvent *lev;
int expires= 4;
bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
lcs=bctbx_list_append(lcs,pauline->lc);
content = linphone_core_create_content(marie->lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml");
linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content));
lev=linphone_core_create_subscribe(marie->lc,pauline->identity,"dodo",expires);
linphone_event_add_custom_header(lev,"My-Header","pouet");
linphone_event_add_custom_header(lev,"My-Header2","pimpon");
linphone_event_send_subscribe(lev,content);
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingProgress,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000));
/*make sure marie receives first notification before terminating*/
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,5000));
/* now pauline is no longer scheduled (simulating a very big latency in the network) */
lcs = bctbx_list_remove(lcs, pauline->lc);
/*marie's dialog will expire while the SUBSCRIBE refresh is in progress*/
wait_for_list(lcs, NULL, 0, 8000);
lcs = bctbx_list_append(lcs, pauline->lc);
wait_for_list(lcs, NULL, 0, 3000);
linphone_event_terminate(lev);
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
bctbx_list_free(lcs);
}
static void publish_test_with_args(bool_t refresh, int expires){
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
@ -513,6 +571,7 @@ test_t event_tests[] = {
TEST_ONE_TAG("Subscribe with io error", subscribe_with_io_error, "presence"),
TEST_ONE_TAG("Subscribe manually refreshed", subscribe_test_manually_refreshed, "presence"),
TEST_ONE_TAG("Subscribe terminated by notifier", subscribe_test_terminated_by_notifier, "presence"),
TEST_ONE_TAG("Subscribe not timely responded", subscribe_not_timely_responded, "presence"),
TEST_ONE_TAG("Publish", publish_test, "presence"),
TEST_ONE_TAG("Publish without expires", publish_without_expires, "presence"),
TEST_ONE_TAG("Publish without automatic refresh",publish_no_auto_test, "presence"),

View file

@ -605,7 +605,7 @@ time-period=15000
# Maximum packet rate received in [time-period] millisecond(s) to
# consider it as a DoS attack.
# Default value: 20
packet-rate-limit=5
packet-rate-limit=10
# Number of minutes to ban the ip/port using iptables (might be
# less because it justs uses the minutes of the clock, not the seconds.

View file

@ -1 +1,4 @@
127.0.0.1 sip2.linphone.org sip.example.org sipopen.example.org auth.example.org auth1.example.org auth2.example.org altname.linphone.org sip.wildcard1.linphone.org altname.wildcard2.linphone.org
127.0.0.1 sip2.linphone.org sip.example.org sipopen.example.org auth.example.org auth1.example.org auth2.example.org altname.linphone.org sip.wildcard1.linphone.org altname.wildcard2.linphone.org sipv4.example.org
2001:41d0:2:14b0::1 sip2.linphone.org sip.example.org sipopen.example.org auth.example.org auth1.example.org auth2.example.org altname.linphone.org sip.wildcard1.linphone.org altname.wildcard2.linphone.org
188.165.46.90 tunnel.wildcard2.linphone.org
64:ff9b::94.23.19.176 sipv4-nat64.example.org

View file

@ -910,6 +910,7 @@ void lime_transfer_message_base(bool_t encrypt_file,bool_t download_file_from_st
char *filepath;
char *send_filepath = bc_tester_res("images/nowebcamCIF.jpg");
char *receive_filepath = bc_tester_file("receive_file.dump");
MSList * msg_list = NULL;
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new( "pauline_tcp_rc");
@ -963,11 +964,10 @@ void lime_transfer_message_base(bool_t encrypt_file,bool_t download_file_from_st
const LinphoneContent* content;
if (download_file_from_stored_msg) {
LinphoneChatRoom *marie_room = linphone_core_get_chat_room(marie->lc, pauline->identity);
MSList * msgs = linphone_chat_room_get_history(marie_room,1);
BC_ASSERT_PTR_NOT_NULL(msgs);
if (!msgs) goto end;
recv_msg = (LinphoneChatMessage *)msgs->data;
ms_list_free(msgs);
msg_list = linphone_chat_room_get_history(marie_room,1);
BC_ASSERT_PTR_NOT_NULL(msg_list);
if (!msg_list) goto end;
recv_msg = (LinphoneChatMessage *)msg_list->data;
} else {
recv_msg = marie->stat.last_received_chat_message;
}
@ -987,6 +987,7 @@ void lime_transfer_message_base(bool_t encrypt_file,bool_t download_file_from_st
linphone_chat_message_download_file(recv_msg);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1));
compare_files(send_filepath, receive_filepath);
bctbx_list_free_with_data(msg_list, (bctbx_list_free_func)linphone_chat_message_unref);
}
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,2, int, "%d"); // file transfer

View file

@ -633,13 +633,14 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) {
ms_message("Simulating in/out packets losses");
sal_set_send_error(laure->lc->sal,1500); /*make sure no refresh is sent, trash the message without generating error*/
sal_set_recv_error(laure->lc->sal, 1500); /*make sure server notify to close the dialog is also ignored*/
wait_for_list(lcs, &dummy, 1, 5000); /* Wait a little bit for the subscribe to happen */
wait_for_list(lcs, &dummy, 1, 32000); /* Wait a little bit for the subscribe transaction to timeout */
}
/*restart normal behavior*/
sal_set_send_error(laure->lc->sal,0);
sal_set_recv_error(laure->lc->sal, 1);
/*a new subscribe should be sent */
BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 3, 6000)); /* give time for subscription to recover to avoid to receive 491 Request pending*/
BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 3, 9000)); /* give time for subscription to recover to avoid to receive 491 Request pending*/
linphone_core_set_presence_model(pauline->lc, linphone_core_create_presence_model_with_activity(pauline->lc, LinphonePresenceActivityAway, NULL));

View file

@ -545,7 +545,9 @@ static void simple_subscribe_with_friend_from_rc(void) {
if (bctbx_list_size(linphone_core_get_friend_list(marie->lc))>0) {
pauline_as_friend = (LinphoneFriend*)linphone_core_get_friend_list(marie->lc)->data;
linphone_friend_edit(pauline_as_friend);
linphone_friend_set_address(pauline_as_friend, pauline->identity); /*hack to update addr with port number*/
linphone_friend_done(pauline_as_friend);
}
BC_ASSERT_TRUE (wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnline,1));

View file

@ -36,10 +36,10 @@ static void phone_normalization_without_proxy(void) {
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "012 345 6789"), "0123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+33123456789"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+33012345678"), "+33012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+33 0012345678"), "+330012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+33 0012345678"), "+33012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+33012345678"), "+33012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+3301234567891"), "+3301234567891");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+33 01234567891"), "+3301234567891");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+3301234567891"), "+33234567891");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+33 01234567891"), "+33234567891");
BC_ASSERT_PTR_NULL(phone_normalization(NULL, "I_AM_NOT_A_NUMBER")); // invalid phone number
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "0"), "0");
@ -59,14 +59,16 @@ static void phone_normalization_with_proxy(void) {
LinphoneProxyConfig *proxy = linphone_proxy_config_new();
linphone_proxy_config_set_dial_prefix(proxy, "33");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012 3456 789"), "+33123456789");
linphone_proxy_config_set_dial_prefix(proxy, NULL);
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33123456789"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33 0123456789"), "+330123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330012345678"), "+330012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33 0123456789"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330012345678"), "+33012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301 2345678"), "+33012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234567891"), "+3301234567891");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234567891"), "+33234567891");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33 (0) 1 23 45 67 89"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+90 (903) 1234567"), "+909031234567");
linphone_proxy_config_set_dial_prefix(proxy, "33");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "123456789"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, " 0123456789"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0012345678"), "+12345678");
@ -106,8 +108,8 @@ static void phone_normalization_with_proxy(void) {
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330123456"), "+330123456");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234567"), "+3301234567");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33012345678"), "+33012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330123456789"), "+330123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234567890"), "+3301234567890");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330123456789"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234567890"), "+33234567890");
// invalid prefix - use a generic dialplan with 10 max length
linphone_proxy_config_set_dial_prefix(proxy, "99");

View file

@ -414,7 +414,7 @@ static void quality_reporting_interval_report_video_and_rtt(void) {
end_call(marie, pauline);
/*wait for publish triggered by the end of call to be completed*/
wait_for_until(marie->lc,pauline->lc,NULL,0,3000);
wait_for_until(marie->lc,pauline->lc,NULL,0,6000);
}
linphone_call_params_destroy(marie_params);

View file

@ -592,7 +592,7 @@ static void transport_dont_bind(void){
tr.tls_port = LC_SIP_TRANSPORT_DONTBIND;
linphone_core_set_sip_transports(pauline->lc, &tr);
BC_ASSERT_TRUE(wait_for_until(pauline->lc,pauline->lc,&counters->number_of_LinphoneRegistrationOk,2,9000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc,pauline->lc,&counters->number_of_LinphoneRegistrationOk,2,15000));
memset(&tr, 0, sizeof(tr));
linphone_core_get_sip_transports_used(pauline->lc, &tr);
BC_ASSERT_EQUAL(tr.udp_port, 0, int, "%i");

View file

@ -53,8 +53,8 @@ static void linphone_vcard_import_export_friends_test(void) {
linphone_friend_list_unref(lfl);
remove(export_filepath);
ms_free(import_filepath);
ms_free(export_filepath);
bc_free(import_filepath);
bc_free(export_filepath);
linphone_core_manager_destroy(manager);
}
@ -106,7 +106,7 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
linphone_friend_list_unref(lfl);
ms_free(import_filepath);
bc_free(import_filepath);
linphone_core_manager_destroy(manager);
}
@ -243,9 +243,9 @@ static void friends_migration(void) {
BC_ASSERT_EQUAL(lp_config_get_int(lpc, "misc", "friends_migration_done", 0), 1, int, "%i");
friends_from_db = bctbx_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
unlink(friends_db);
ms_free(friends_db);
linphone_core_manager_destroy(manager);
unlink(friends_db);
bc_free(friends_db);
}
typedef struct _LinphoneFriendListStats {
@ -368,11 +368,11 @@ static void friends_sqlite_storage(void) {
end:
ms_free(stats);
unlink(friends_db);
ms_free(friends_db);
linphone_address_unref(addr);
linphone_core_destroy(lc);
linphone_core_v_table_destroy(v_table);
unlink(friends_db);
bc_free(friends_db);
}
#endif
@ -472,10 +472,10 @@ static void carddav_sync_2(void) {
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
ms_free(stats);
unlink(friends_db);
ms_free(friends_db);
linphone_carddav_context_destroy(c);
linphone_core_manager_destroy(manager);
unlink(friends_db);
bc_free(friends_db);
}
static void carddav_sync_3(void) {
@ -512,11 +512,10 @@ static void carddav_sync_3(void) {
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
ms_free(stats);
unlink(friends_db);
ms_free(friends_db);
linphone_carddav_context_destroy(c);
c = NULL;
linphone_core_manager_destroy(manager);
unlink(friends_db);
bc_free(friends_db);
}
static void carddav_sync_4(void) {
@ -798,8 +797,8 @@ test_t vcard_tests[] = {
TEST_NO_TAG("vCard creation for existing friends", linphone_vcard_update_existing_friends_test),
TEST_NO_TAG("vCard phone numbers and SIP addresses", linphone_vcard_phone_numbers_and_sip_addresses),
#ifdef SQLITE_STORAGE_ENABLED
TEST_ONE_TAG("Friends working if no db set", friends_if_no_db_set, "LeaksMemory"),
TEST_ONE_TAG("Friends storage migration from rc to db", friends_migration, "LeaksMemory"),
TEST_NO_TAG("Friends working if no db set", friends_if_no_db_set),
TEST_NO_TAG("Friends storage migration from rc to db", friends_migration),
TEST_NO_TAG("Friends storage in sqlite database", friends_sqlite_storage),
#endif
TEST_NO_TAG("CardDAV clean", carddav_clean), // This is to ensure the content of the test addressbook is in the correct state for the following tests

View file

@ -305,7 +305,7 @@ class Project:
para.remove(n)
for n in para.findall('.//ref'):
n.attrib = {}
for n in para.findall(".//mslist"):
for n in para.findall(".//bctbx_list"):
para.remove(n)
if descriptionNode.tag == 'parameterdescription':
descriptionNode.tag = 'description'
@ -439,7 +439,7 @@ class Project:
returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']")
if returndesc is not None:
if returnarg.ctype == 'MSList' or returnarg.ctype == 'bctbx_list_t':
n = returndesc.find('.//mslist')
n = returndesc.find('.//bctbxlist')
if n is not None:
returnarg.containedType = n.text
returnarg.description = self.__cleanDescription(returndesc)
@ -510,7 +510,7 @@ class Project:
returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']")
if returndesc is not None:
if returnarg.ctype == 'MSList' or returnarg.ctype == 'bctbx_list_t':
n = returndesc.find('.//mslist')
n = returndesc.find('.//bctbxlist')
if n is not None:
returnarg.containedType = n.text
returnarg.description = self.__cleanDescription(returndesc)
@ -533,7 +533,7 @@ class Project:
for paramdesc in paramdescs:
if arg.name == paramdesc.find('./parameternamelist').find('./parametername').text:
if arg.ctype == 'MSList' or arg.ctype == 'bctbx_list_t':
n = paramdesc.find('.//mslist')
n = paramdesc.find('.//bctbxlist')
if n is not None:
arg.containedType = n.text
arg.description = self.__cleanDescription(paramdesc.find('./parameterdescription'))

View file

@ -24,8 +24,8 @@ typedef struct {
LCSipTransports lcst;
} pylinphone_SipTransportsObject;
PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl);
bctbx_list_t * PyList_AsMSListOfString(PyObject *pyl);
PyObject * PyList_FromBctbxListOfString(const bctbx_list_t *msl);
bctbx_list_t * PyList_AsBctbxListOfString(PyObject *pyl);
int PyLinphoneVideoSize_Check(PyObject *p);
MSVideoSize PyLinphoneVideoSize_AsMSVideoSize(PyObject *obj);
@ -44,4 +44,4 @@ static int pylinphone_Buffer_set_content(PyObject *self, PyObject *value, void *
static PyObject * pylinphone_Content_get_buffer(PyObject *self, void *closure);
static int pylinphone_Content_set_buffer(PyObject *self, PyObject *value, void *closure);
static PyObject * pylinphone_LpConfig_get_sections_names(PyObject *self, void *closure);
static PyObject * pylinphone_LpConfig_get_sections_names(PyObject *self, void *closure);

View file

@ -1,4 +1,4 @@
PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl) {
PyObject * PyList_FromBctbxListOfString(const bctbx_list_t *msl) {
PyObject *pyl = PyList_New(0);
while (msl != NULL) {
PyObject *item = Py_BuildValue("z", (const char *)msl->data);
@ -8,7 +8,7 @@ PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl) {
return pyl;
}
bctbx_list_t * PyList_AsMSListOfString(PyObject *pyl) {
bctbx_list_t * PyList_AsBctbxListOfString(PyObject *pyl) {
bctbx_list_t *msl = NULL;
Py_ssize_t idx;
Py_ssize_t size = PyList_Size(pyl);

View file

@ -53,6 +53,10 @@ def compute_event_name(s, className):
first = False
return event_name
def is_const_from_complete_type(complete_type):
splitted_type = complete_type.split(' ')
return 'const' in splitted_type
class HandWrittenCode:
def __init__(self, _class, name, func_list, doc = ''):
@ -95,6 +99,7 @@ class ArgumentType:
self.check_condition = None
self.convert_code = None
self.convert_from_func = None
self.free_convert_result_func = None
self.fmt_str = 'O'
self.cfmt_str = '%p'
self.cnativefmt_str = '%p'
@ -102,7 +107,7 @@ class ArgumentType:
self.cast_convert_func_result = True
self.__compute()
if (self.basic_type == 'MSList' or self.basic_type == 'bctbx_list_t') and self.contained_type is not None and self.contained_type != 'const char *':
self.linphone_module.mslist_types.add(self.contained_type)
self.linphone_module.bctbxlist_types.add(self.contained_type)
def __compute(self):
splitted_type = self.complete_type.split(' ')
@ -217,12 +222,14 @@ class ArgumentType:
elif self.basic_type == 'MSList' or self.basic_type == 'bctbx_list_t':
if self.contained_type == 'const char *':
self.type_str = 'list of string'
self.convert_code = "{result_name}{result_suffix} = {cast}PyList_AsMSListOfString({arg_name});\n"
self.convert_from_func = 'PyList_FromMSListOfString'
self.convert_code = "{result_name}{result_suffix} = {cast}PyList_AsBctbxListOfString({arg_name});\n"
self.convert_from_func = 'PyList_FromBctbxListOfString'
else:
self.type_str = 'list of linphone.' + self.contained_type
self.convert_code = "{result_name}{result_suffix} = {cast}PyList_AsMSListOf" + self.contained_type + "({arg_name});\n"
self.convert_from_func = 'PyList_FromMSListOf' + self.contained_type
self.convert_code = "{result_name}{result_suffix} = {cast}PyList_AsBctbxListOf" + self.contained_type + "({arg_name});\n"
self.convert_from_func = 'PyList_FromBctbxListOf' + self.contained_type
if not is_const_from_complete_type(self.complete_type):
self.free_convert_result_func = "bctbx_list_free"
self.check_condition = "!PyList_Check({arg_name})"
self.fmt_str = 'O'
self.cfmt_str = '%p'
@ -372,6 +379,7 @@ class MethodDefinition:
def format_c_function_call(self):
arg_names = []
c_function_call_code = ''
cfree_argument_code = ''
for xml_method_arg in self.xml_method_args:
arg_name = "_" + xml_method_arg.get('name')
arg_type = xml_method_arg.get('type')
@ -382,6 +390,10 @@ class MethodDefinition:
arg_names.append(arg_name + "_native_ptr")
elif argument_type.fmt_str == 'O' and argument_type.convert_code is not None:
arg_names.append(arg_name + "_native_obj")
if argument_type.free_convert_result_func is not None and not is_const_from_complete_type(arg_complete_type):
cfree_argument_code = \
"""{free_func}({arg_name}_native_obj);
""".format(free_func=argument_type.free_convert_result_func, arg_name=arg_name)
else:
arg_names.append(arg_name)
if is_callback(self.return_complete_type):
@ -412,6 +424,10 @@ class MethodDefinition:
convert_from_code = \
"""pyresult = {convert_func}(cresult);
""".format(convert_func=return_argument_type.convert_from_func)
if return_argument_type.free_convert_result_func is not None:
cfree_code = \
"""{free_func}(cresult);
""".format(free_func=return_argument_type.free_convert_result_func)
result_variable = 'pyresult'
else:
result_variable = 'cresult'
@ -421,12 +437,14 @@ class MethodDefinition:
cfree_code = 'ms_free(cresult);';
body = \
""" {c_function_call_code}
{cfree_argument_code}
pylinphone_dispatch_messages();
{from_native_pointer_code}
{convert_from_code}
{build_value_code}
{cfree_code}
""".format(c_function_call_code=c_function_call_code,
cfree_argument_code=cfree_argument_code,
from_native_pointer_code=from_native_pointer_code,
convert_from_code=convert_from_code,
build_value_code=build_value_code,
@ -535,12 +553,6 @@ class MethodDefinition:
self.self_arg = self.xml_method_args[0]
self.xml_method_args = self.xml_method_args[1:]
def remove_const_from_complete_type(self, complete_type):
splitted_type = complete_type.split(' ')
while 'const' in splitted_type:
splitted_type.remove('const')
return ' '.join(splitted_type)
def find_class_definition(self, basic_type):
basic_type = strip_leading_linphone(basic_type)
for c in self.linphone_module.classes:
@ -799,15 +811,21 @@ class SetterMethodDefinition(MethodDefinition):
""" {method_name}(native_ptr, pylinphone_{class_name}_callback_{callback_name});
pylinphone_dispatch_messages();
""".format(method_name=self.method_node.get('name'), class_name=self.class_['class_name'], callback_name=compute_event_name(self.first_argument_type.complete_type, self.class_['class_name']))
cfree_argument_code = ''
suffix = ''
if self.first_argument_type.fmt_str == 'O' and self.first_argument_type.use_native_pointer:
suffix = '_native_ptr'
elif self.first_argument_type.fmt_str == 'O' and self.first_argument_type.convert_code is not None:
suffix = '_native_obj'
if self.first_argument_type.free_convert_result_func is not None and not is_const_from_complete_type(self.first_argument_type.complete_type):
cfree_argument_code = \
"""{free_func}({arg_name}_native_obj);
""".format(free_func=self.first_argument_type.free_convert_result_func, arg_name="_" + self.first_arg_name)
return \
""" {method_name}(native_ptr, {arg_name}{suffix});
{cfree_argument_code}
pylinphone_dispatch_messages();
""".format(arg_name="_" + self.first_arg_name, method_name=self.method_node.get('name'), suffix=suffix)
""".format(arg_name="_" + self.first_arg_name, method_name=self.method_node.get('name'), suffix=suffix, cfree_argument_code=cfree_argument_code)
def format_return_trace(self):
return "\tpylinphone_trace(-1, \"[PYLINPHONE] <<< %s -> 0\", __FUNCTION__);\n"
@ -989,7 +1007,7 @@ class LinphoneModule(object):
def __init__(self, tree, blacklisted_classes, blacklisted_events, blacklisted_functions, hand_written_codes):
self.internal_instance_method_names = ['destroy', 'ref', 'unref']
self.internal_property_names = ['user_data']
self.mslist_types = Set([])
self.bctbxlist_types = Set([])
self.enums = []
self.enum_names = []
self.cfunction2methodmap = {}
@ -1225,14 +1243,14 @@ class LinphoneModule(object):
except Exception, e:
e.args += (c['class_name'], 'dealloc_body')
raise
# Convert mslist_types to a list of dictionaries for the template
# Convert bctbxlist_types to a list of dictionaries for the template
d = []
for mslist_type in self.mslist_types:
for bctbxlist_type in self.bctbxlist_types:
t = {}
t['c_contained_type'] = mslist_type
t['python_contained_type'] = strip_leading_linphone(mslist_type)
t['c_contained_type'] = bctbxlist_type
t['python_contained_type'] = strip_leading_linphone(bctbxlist_type)
d.append(t)
self.mslist_types = d
self.bctbxlist_types = d
def __format_doc_node(self, node):
desc = ''

View file

@ -71,8 +71,8 @@ static PyObject * pylinphone_{{class_name}}_instance_method_{{method_name}}(PyOb
{{/class_instance_hand_written_methods}}
{{/classes}}
{{#mslist_types}}
PyObject * PyList_FromMSListOf{{c_contained_type}}(const bctbx_list_t *msl) {
{{#bctbxlist_types}}
PyObject * PyList_FromBctbxListOf{{c_contained_type}}(const bctbx_list_t *msl) {
PyObject *pyl = PyList_New(0);
while (msl != NULL) {
{{c_contained_type}} *native_ptr = ({{c_contained_type}} *)msl->data;
@ -83,7 +83,7 @@ PyObject * PyList_FromMSListOf{{c_contained_type}}(const bctbx_list_t *msl) {
return pyl;
}
bctbx_list_t * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) {
bctbx_list_t * PyList_AsBctbxListOf{{c_contained_type}}(PyObject *pyl) {
bctbx_list_t *msl = NULL;
Py_ssize_t idx;
Py_ssize_t size = PyList_Size(pyl);
@ -95,7 +95,7 @@ bctbx_list_t * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) {
return msl;
}
{{/mslist_types}}
{{/bctbxlist_types}}
{{#core_events}}
{{{event_callback_definition}}}