mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-03 20:46:28 +00:00
Merge branch 'dev_refactor_cpp' into dev_chatroom_list_subscription
This commit is contained in:
commit
5d6fbe9e3c
58 changed files with 1191 additions and 918 deletions
|
|
@ -2150,7 +2150,7 @@ static int lpc_cmd_speak(LinphoneCore *lc, char *args){
|
|||
#ifndef _WIN32
|
||||
char voice[64];
|
||||
char *sentence;
|
||||
char cl[128];
|
||||
char cl[256];
|
||||
char wavfile[128]="/tmp/linphonec-espeak-XXXXXX";
|
||||
int status;
|
||||
FILE *file;
|
||||
|
|
|
|||
|
|
@ -452,8 +452,6 @@ LinphoneAuthInfo * linphone_core_create_auth_info(LinphoneCore *lc, const char *
|
|||
|
||||
void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info){
|
||||
LinphoneAuthInfo *ai;
|
||||
bctbx_list_t *elem;
|
||||
bctbx_list_t *l;
|
||||
int restarted_op_count=0;
|
||||
bool_t updating=FALSE;
|
||||
|
||||
|
|
@ -472,8 +470,8 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
|
|||
lc->auth_info=bctbx_list_append(lc->auth_info,linphone_auth_info_clone(info));
|
||||
|
||||
/* retry pending authentication operations */
|
||||
for(l=elem=lc->sal->getPendingAuths();elem!=NULL;elem=elem->next){
|
||||
LinphonePrivate::SalOp *op= static_cast<LinphonePrivate::SalOp*>(elem->data);
|
||||
auto pendingAuths = lc->sal->getPendingAuths();
|
||||
for (const auto &op : pendingAuths) {
|
||||
LinphoneAuthInfo *ai;
|
||||
const SalAuthInfo *req_sai=op->getAuthRequested();
|
||||
ai=(LinphoneAuthInfo*)_linphone_core_find_auth_info(lc,req_sai->realm,req_sai->username,req_sai->domain, FALSE);
|
||||
|
|
@ -504,7 +502,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
|
|||
restarted_op_count++;
|
||||
}
|
||||
}
|
||||
if (l){
|
||||
if (!pendingAuths.empty()) {
|
||||
ms_message("linphone_core_add_auth_info(): restarted [%i] operation(s) after %s auth info for\n"
|
||||
"\tusername: [%s]\n"
|
||||
"\trealm [%s]\n"
|
||||
|
|
@ -515,7 +513,6 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
|
|||
info->realm ? info->realm : "",
|
||||
info->domain ? info->domain : "");
|
||||
}
|
||||
bctbx_list_free(l);
|
||||
write_auth_infos(lc);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ static void call_received(SalCallOp *h) {
|
|||
if (pAssertedId) {
|
||||
LinphoneAddress *pAssertedIdAddr = linphone_address_new(pAssertedId);
|
||||
if (pAssertedIdAddr) {
|
||||
ms_message("Using P-Asserted-Identity [%s] instead of from [%s] for op [%p]", pAssertedId, h->getFrom(), h);
|
||||
ms_message("Using P-Asserted-Identity [%s] instead of from [%s] for op [%p]", pAssertedId, h->getFrom().c_str(), h);
|
||||
fromAddr = pAssertedIdAddr;
|
||||
} else
|
||||
ms_warning("Unsupported P-Asserted-Identity header for op [%p] ", h);
|
||||
|
|
@ -86,8 +86,8 @@ static void call_received(SalCallOp *h) {
|
|||
}
|
||||
|
||||
if (!fromAddr)
|
||||
fromAddr = linphone_address_new(h->getFrom());
|
||||
LinphoneAddress *toAddr = linphone_address_new(h->getTo());
|
||||
fromAddr = linphone_address_new(h->getFrom().c_str());
|
||||
LinphoneAddress *toAddr = linphone_address_new(h->getTo().c_str());
|
||||
|
||||
if (_linphone_core_is_conference_creation(lc, toAddr)) {
|
||||
linphone_address_unref(toAddr);
|
||||
|
|
@ -136,7 +136,7 @@ static void call_received(SalCallOp *h) {
|
|||
);
|
||||
if (!chatRoom) {
|
||||
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(
|
||||
L_C_TO_STRING(h->getSubject()), h->getRemoteContact(), h->getRemoteBody(), false
|
||||
h->getSubject(), h->getRemoteContact(), h->getRemoteBody(), false
|
||||
);
|
||||
}
|
||||
L_GET_PRIVATE(static_pointer_cast<ClientGroupChatRoom>(chatRoom))->confirmJoining(h);
|
||||
|
|
@ -218,7 +218,7 @@ static void call_rejected(SalCallOp *h){
|
|||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(h->getSal()->getUserPointer());
|
||||
LinphoneErrorInfo *ei = linphone_error_info_new();
|
||||
linphone_error_info_from_sal_op(ei, h);
|
||||
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, linphone_address_new(h->getFrom()), linphone_address_new(h->getTo()), ei);
|
||||
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, linphone_address_new(h->getFrom().c_str()), linphone_address_new(h->getTo().c_str()), ei);
|
||||
}
|
||||
|
||||
static void call_ringing(SalOp *h) {
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room (
|
|||
|
||||
int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *sal_msg) {
|
||||
LinphoneReason reason = LinphoneReasonNotAcceptable;
|
||||
const char *peerAddress;
|
||||
const char *localAddress;
|
||||
std::string peerAddress;
|
||||
std::string localAddress;
|
||||
if (linphone_core_conference_server_enabled(lc)) {
|
||||
localAddress = peerAddress = op->getTo();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1315,7 +1315,7 @@ static void sip_config_read(LinphoneCore *lc) {
|
|||
|
||||
lc->sal->useNoInitialRoute(!!lp_config_get_int(lc->config,"sip","use_no_initial_route",0));
|
||||
lc->sal->useRport(!!lp_config_get_int(lc->config,"sip","use_rport",1));
|
||||
lc->sal->setContactLinphoneSpecs(lp_config_get_string(lc->config, "sip", "linphone_specs", NULL));
|
||||
lc->sal->setContactLinphoneSpecs(lp_config_get_string(lc->config, "sip", "linphone_specs", ""));
|
||||
|
||||
if (!lp_config_get_int(lc->config,"sip","ipv6_migration_done",FALSE) && lp_config_has_entry(lc->config,"sip","use_ipv6")) {
|
||||
lp_config_clean_entry(lc->config,"sip","use_ipv6");
|
||||
|
|
@ -2253,7 +2253,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
|
||||
lc->sal=new Sal(NULL);
|
||||
lc->sal->setRefresherRetryAfter(lp_config_get_int(lc->config, "sip", "refresher_retry_after", 60000));
|
||||
lc->sal->setHttpProxyHost(linphone_core_get_http_proxy_host(lc));
|
||||
lc->sal->setHttpProxyHost(L_C_TO_STRING(linphone_core_get_http_proxy_host(lc)));
|
||||
lc->sal->setHttpProxyPort(linphone_core_get_http_proxy_port(lc));
|
||||
|
||||
lc->sal->setUserPointer(lc);
|
||||
|
|
@ -2262,6 +2262,8 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
#ifdef __ANDROID__
|
||||
if (system_context)
|
||||
lc->platform_helper = LinphonePrivate::createAndroidPlatformHelpers(lc, system_context);
|
||||
#elif TARGET_OS_IPHONE
|
||||
lc->platform_helper = LinphonePrivate::createIosPlatformHelpers(lc, system_context);
|
||||
#endif
|
||||
if (lc->platform_helper == NULL)
|
||||
lc->platform_helper = new LinphonePrivate::StubbedPlatformHelpers(lc);
|
||||
|
|
@ -2351,8 +2353,8 @@ void linphone_core_start (LinphoneCore *lc) {
|
|||
}else if (strcmp(uuid,"0")!=0) /*to allow to disable sip.instance*/
|
||||
lc->sal->setUuid(uuid);
|
||||
|
||||
if (lc->sal->getRootCa()) {
|
||||
belle_tls_crypto_config_set_root_ca(lc->http_crypto_config, lc->sal->getRootCa());
|
||||
if (!lc->sal->getRootCa().empty()) {
|
||||
belle_tls_crypto_config_set_root_ca(lc->http_crypto_config, lc->sal->getRootCa().c_str());
|
||||
belle_http_provider_set_tls_crypto_config(lc->http_provider, lc->http_crypto_config);
|
||||
}
|
||||
|
||||
|
|
@ -2887,7 +2889,7 @@ void linphone_core_set_user_agent(LinphoneCore *lc, const char *name, const char
|
|||
}
|
||||
}
|
||||
const char *linphone_core_get_user_agent(LinphoneCore *lc){
|
||||
return lc->sal->getUserAgent();
|
||||
return lc->sal->getUserAgent().c_str();
|
||||
}
|
||||
|
||||
const char *linphone_core_get_user_agent_name(void){
|
||||
|
|
@ -3573,7 +3575,7 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon
|
|||
op->setToAddress(L_GET_PRIVATE_FROM_C_OBJECT(dest)->getInternalAddress());
|
||||
op->setFrom(identity);
|
||||
op->setSentCustomHeaders(headers);
|
||||
op->setRealm(linphone_proxy_config_get_realm(proxy));
|
||||
op->setRealm(L_C_TO_STRING(linphone_proxy_config_get_realm(proxy)));
|
||||
|
||||
if (with_contact && proxy && proxy->op){
|
||||
const LinphoneAddress *contact = linphone_proxy_config_get_contact(proxy);
|
||||
|
|
@ -4329,7 +4331,7 @@ const char *linphone_core_get_ring(const LinphoneCore *lc){
|
|||
}
|
||||
|
||||
void linphone_core_set_root_ca(LinphoneCore *lc, const char *path) {
|
||||
lc->sal->setRootCa(path);
|
||||
lc->sal->setRootCa(L_C_TO_STRING(path));
|
||||
if (lc->http_crypto_config) {
|
||||
belle_tls_crypto_config_set_root_ca(lc->http_crypto_config, path);
|
||||
}
|
||||
|
|
@ -4337,8 +4339,8 @@ void linphone_core_set_root_ca(LinphoneCore *lc, const char *path) {
|
|||
}
|
||||
|
||||
void linphone_core_set_root_ca_data(LinphoneCore *lc, const char *data) {
|
||||
lc->sal->setRootCa(NULL);
|
||||
lc->sal->setRootCaData(data);
|
||||
lc->sal->setRootCa("");
|
||||
lc->sal->setRootCaData(L_C_TO_STRING(data));
|
||||
if (lc->http_crypto_config) {
|
||||
belle_tls_crypto_config_set_root_ca_data(lc->http_crypto_config, data);
|
||||
}
|
||||
|
|
@ -6797,12 +6799,12 @@ const char * linphone_core_get_file_transfer_server(LinphoneCore *core) {
|
|||
|
||||
void linphone_core_add_supported_tag(LinphoneCore *lc, const char *tag){
|
||||
lc->sal->addSupportedTag(tag);
|
||||
lp_config_set_string(lc->config,"sip","supported",lc->sal->getSupportedTags());
|
||||
lp_config_set_string(lc->config,"sip","supported",lc->sal->getSupportedTags().c_str());
|
||||
}
|
||||
|
||||
void linphone_core_remove_supported_tag(LinphoneCore *lc, const char *tag){
|
||||
lc->sal->removeSupportedTag(tag);
|
||||
lp_config_set_string(lc->config,"sip","supported",lc->sal->getSupportedTags());
|
||||
lp_config_set_string(lc->config,"sip","supported",lc->sal->getSupportedTags().c_str());
|
||||
}
|
||||
|
||||
void linphone_core_set_avpf_mode(LinphoneCore *lc, LinphoneAVPFMode mode){
|
||||
|
|
@ -7358,5 +7360,5 @@ const char *linphone_core_get_linphone_specs (const LinphoneCore *core) {
|
|||
|
||||
void linphone_core_set_linphone_specs (LinphoneCore *core, const char *specs) {
|
||||
lp_config_set_string(linphone_core_get_config(core), "sip", "linphone_specs", specs);
|
||||
core->sal->setContactLinphoneSpecs(specs);
|
||||
core->sal->setContactLinphoneSpecs(L_C_TO_STRING(specs));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4768,6 +4768,7 @@ static void file_transfer_progress_indication(LinphoneChatMessage *msg, const Li
|
|||
if (jmessage) {
|
||||
env->DeleteLocalRef(jmessage);
|
||||
}
|
||||
env->DeleteLocalRef(listener);
|
||||
}
|
||||
|
||||
static void file_transfer_recv(LinphoneChatMessage *msg, const LinphoneContent* content, const LinphoneBuffer *buffer) {
|
||||
|
|
@ -4797,6 +4798,7 @@ static void file_transfer_recv(LinphoneChatMessage *msg, const LinphoneContent*
|
|||
if (jmessage) {
|
||||
env->DeleteLocalRef(jmessage);
|
||||
}
|
||||
env->DeleteLocalRef(listener);
|
||||
}
|
||||
|
||||
static LinphoneBuffer* file_transfer_send(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t size) {
|
||||
|
|
@ -4827,6 +4829,7 @@ static LinphoneBuffer* file_transfer_send(LinphoneChatMessage *msg, const Linph
|
|||
|
||||
buffer = create_c_linphone_buffer_from_java_linphone_buffer(env, jbuffer);
|
||||
env->DeleteLocalRef(jbuffer);
|
||||
env->DeleteLocalRef(listener);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -222,6 +222,10 @@ void lsd_player_set_gain(LsdPlayer *p, float gain){
|
|||
ms_filter_call_method(p->lsd->mixer,MS_AUDIO_MIXER_SET_INPUT_GAIN,&gainctl);
|
||||
}
|
||||
|
||||
static void lsd_player_configure_notify_func (void *userdata, MSFilter *, unsigned int, void *) {
|
||||
lsd_player_configure((LsdPlayer *)userdata);
|
||||
}
|
||||
|
||||
LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char *cardname, int rate, int nchannels){
|
||||
int i;
|
||||
MSConnectionPoint mp;
|
||||
|
|
@ -251,7 +255,7 @@ LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char *
|
|||
mp.pin=0;
|
||||
|
||||
lsd_player_init(factory, &lsd->branches[0],mp,MS_ITC_SOURCE_ID,lsd);
|
||||
ms_filter_add_notify_callback(lsd->branches[0].player,(MSFilterNotifyFunc)lsd_player_configure,&lsd->branches[0],FALSE);
|
||||
ms_filter_add_notify_callback(lsd->branches[0].player,lsd_player_configure_notify_func,&lsd->branches[0],FALSE);
|
||||
for(i=1;i<MAX_BRANCHES;++i){
|
||||
mp.pin=i;
|
||||
lsd_player_init(factory,&lsd->branches[i],mp,MS_FILE_PLAYER_ID,lsd);
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ static void initiate_incoming(MSFactory *factory, const SalStreamDescription *lo
|
|||
|
||||
if (remote_offer->haveZrtpHash == 1) {
|
||||
if (local_cap->zrtphash[0] != 0) { /* if ZRTP is available, set the zrtp hash even if it is not selected */
|
||||
strncpy((char *)(result->zrtphash), (char *)(local_cap->zrtphash), sizeof(local_cap->zrtphash));
|
||||
strncpy((char *)(result->zrtphash), (char *)(local_cap->zrtphash), sizeof(result->zrtphash));
|
||||
result->haveZrtpHash = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ static void presence_note_uninit(LinphonePresenceNote *note) {
|
|||
}
|
||||
}
|
||||
|
||||
static void presence_note_unref(void *note) {
|
||||
linphone_presence_note_unref((LinphonePresenceNote *)note);
|
||||
}
|
||||
|
||||
static LinphonePresenceService * presence_service_new(const char *id, LinphonePresenceBasicStatus status) {
|
||||
LinphonePresenceService *service = belle_sip_object_new(LinphonePresenceService);
|
||||
if (id != NULL) {
|
||||
|
|
@ -143,10 +147,14 @@ static void presence_service_uninit(LinphonePresenceService *service) {
|
|||
if (service->contact != NULL) {
|
||||
ms_free(service->contact);
|
||||
}
|
||||
bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(service->notes, presence_note_unref);
|
||||
bctbx_list_free(service->notes);
|
||||
};
|
||||
|
||||
static void presence_service_unref(void *service) {
|
||||
linphone_presence_service_unref((LinphonePresenceService *)service);
|
||||
}
|
||||
|
||||
static void presence_service_set_timestamp(LinphonePresenceService *service, time_t timestamp) {
|
||||
service->timestamp = timestamp;
|
||||
}
|
||||
|
|
@ -161,6 +169,10 @@ static void presence_activity_uninit(LinphonePresenceActivity *activity) {
|
|||
}
|
||||
}
|
||||
|
||||
static void presence_activity_unref(void *activity) {
|
||||
linphone_presence_activity_unref((LinphonePresenceActivity *)activity);
|
||||
}
|
||||
|
||||
static time_t parse_timestamp(const char *timestamp) {
|
||||
struct tm ret;
|
||||
time_t seconds;
|
||||
|
|
@ -219,14 +231,18 @@ static void presence_person_uninit(LinphonePresencePerson *person) {
|
|||
if (person->id != NULL) {
|
||||
ms_free(person->id);
|
||||
}
|
||||
bctbx_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
|
||||
bctbx_list_for_each(person->activities, presence_activity_unref);
|
||||
bctbx_list_free(person->activities);
|
||||
bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(person->activities_notes, presence_note_unref);
|
||||
bctbx_list_free(person->activities_notes);
|
||||
bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(person->notes, presence_note_unref);
|
||||
bctbx_list_free(person->notes);
|
||||
}
|
||||
|
||||
static void presence_person_unref(void *person) {
|
||||
linphone_presence_person_unref((LinphonePresencePerson *)person);
|
||||
}
|
||||
|
||||
static void presence_person_add_activities_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
|
||||
person->activities_notes = bctbx_list_append(person->activities_notes, note);
|
||||
}
|
||||
|
|
@ -256,11 +272,11 @@ static void presence_model_find_open_basic_status(LinphonePresenceService *servi
|
|||
static void presence_model_uninit(LinphonePresenceModel *model) {
|
||||
if (model->presentity)
|
||||
linphone_address_unref(model->presentity);
|
||||
bctbx_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
|
||||
bctbx_list_for_each(model->services, presence_service_unref);
|
||||
bctbx_list_free(model->services);
|
||||
bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
|
||||
bctbx_list_for_each(model->persons, presence_person_unref);
|
||||
bctbx_list_free(model->persons);
|
||||
bctbx_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(model->notes, presence_note_unref);
|
||||
bctbx_list_free(model->notes);
|
||||
}
|
||||
|
||||
|
|
@ -446,10 +462,14 @@ LinphoneStatus linphone_presence_model_add_activity(LinphonePresenceModel *model
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void presence_person_clear_activities(void *person) {
|
||||
linphone_presence_person_clear_activities((LinphonePresencePerson *)person);
|
||||
}
|
||||
|
||||
LinphoneStatus linphone_presence_model_clear_activities(LinphonePresenceModel *model) {
|
||||
if (model == NULL) return -1;
|
||||
|
||||
bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_clear_activities);
|
||||
bctbx_list_for_each(model->persons, presence_person_clear_activities);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -580,16 +600,16 @@ LinphoneStatus linphone_presence_model_add_note(LinphonePresenceModel *model, co
|
|||
}
|
||||
|
||||
static void clear_presence_person_notes(LinphonePresencePerson *person) {
|
||||
bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(person->activities_notes, presence_note_unref);
|
||||
bctbx_list_free(person->activities_notes);
|
||||
person->activities_notes = NULL;
|
||||
bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(person->notes, presence_note_unref);
|
||||
bctbx_list_free(person->notes);
|
||||
person->notes = NULL;
|
||||
}
|
||||
|
||||
static void clear_presence_service_notes(LinphonePresenceService *service) {
|
||||
bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(service->notes, presence_note_unref);
|
||||
bctbx_list_free(service->notes);
|
||||
service->notes = NULL;
|
||||
}
|
||||
|
|
@ -600,7 +620,7 @@ LinphoneStatus linphone_presence_model_clear_notes(LinphonePresenceModel *model)
|
|||
|
||||
bctbx_list_for_each(model->persons, (MSIterateFunc)clear_presence_person_notes);
|
||||
bctbx_list_for_each(model->services, (MSIterateFunc)clear_presence_service_notes);
|
||||
bctbx_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(model->notes, presence_note_unref);
|
||||
bctbx_list_free(model->notes);
|
||||
model->notes = NULL;
|
||||
|
||||
|
|
@ -636,7 +656,7 @@ LinphoneStatus linphone_presence_model_add_service(LinphonePresenceModel *model,
|
|||
LinphoneStatus linphone_presence_model_clear_services(LinphonePresenceModel *model) {
|
||||
if (model == NULL) return -1;
|
||||
|
||||
bctbx_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
|
||||
bctbx_list_for_each(model->services, presence_service_unref);
|
||||
bctbx_list_free(model->services);
|
||||
model->services = NULL;
|
||||
return 0;
|
||||
|
|
@ -662,7 +682,7 @@ LinphoneStatus linphone_presence_model_add_person(LinphonePresenceModel *model,
|
|||
LinphoneStatus linphone_presence_model_clear_persons(LinphonePresenceModel *model) {
|
||||
if (model == NULL) return -1;
|
||||
|
||||
bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
|
||||
bctbx_list_for_each(model->persons, presence_person_unref);
|
||||
bctbx_list_free(model->persons);
|
||||
model->persons = NULL;
|
||||
return 0;
|
||||
|
|
@ -798,7 +818,7 @@ LinphoneStatus linphone_presence_service_add_note(LinphonePresenceService *servi
|
|||
LinphoneStatus linphone_presence_service_clear_notes(LinphonePresenceService *service) {
|
||||
if (service == NULL) return -1;
|
||||
|
||||
bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(service->notes, presence_note_unref);
|
||||
bctbx_list_free(service->notes);
|
||||
service->notes = NULL;
|
||||
return 0;
|
||||
|
|
@ -859,7 +879,7 @@ LinphoneStatus linphone_presence_person_add_activity(LinphonePresencePerson *per
|
|||
|
||||
LinphoneStatus linphone_presence_person_clear_activities(LinphonePresencePerson *person) {
|
||||
if (person == NULL) return -1;
|
||||
bctbx_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
|
||||
bctbx_list_for_each(person->activities, presence_activity_unref);
|
||||
bctbx_list_free(person->activities);
|
||||
person->activities = NULL;
|
||||
return 0;
|
||||
|
|
@ -884,7 +904,7 @@ LinphoneStatus linphone_presence_person_add_note(LinphonePresencePerson *person,
|
|||
|
||||
LinphoneStatus linphone_presence_person_clear_notes(LinphonePresencePerson *person) {
|
||||
if (person == NULL) return -1;
|
||||
bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(person->notes, presence_note_unref);
|
||||
bctbx_list_free(person->notes);
|
||||
person->notes = NULL;
|
||||
return 0;
|
||||
|
|
@ -909,7 +929,7 @@ LinphoneStatus linphone_presence_person_add_activities_note(LinphonePresencePers
|
|||
|
||||
LinphoneStatus linphone_presence_person_clear_activities_notes(LinphonePresencePerson *person) {
|
||||
if (person == NULL) return -1;
|
||||
bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
|
||||
bctbx_list_for_each(person->activities_notes, presence_note_unref);
|
||||
bctbx_list_free(person->activities_notes);
|
||||
person->activities_notes = NULL;
|
||||
return 0;
|
||||
|
|
@ -1438,7 +1458,7 @@ static int process_pidf_xml_presence_persons(xmlparsing_context_t *xml_ctx, Linp
|
|||
|
||||
if (err < 0) {
|
||||
/* Remove all the persons added since there was an error. */
|
||||
bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
|
||||
bctbx_list_for_each(model->persons, presence_person_unref);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
@ -2000,7 +2020,7 @@ void linphone_subscription_closed(LinphoneCore *lc, SalOp *op){
|
|||
linphone_friend_remove_incoming_subscription(lf, op);
|
||||
}else{
|
||||
/*case of an op that we already released because the friend was destroyed*/
|
||||
ms_message("Receiving unsuscribe for unknown in-subscribtion from %s", op->getFrom());
|
||||
ms_message("Receiving unsuscribe for unknown in-subscribtion from %s", op->getFrom().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -505,13 +505,12 @@ void linphone_reporting_update_media_info(LinphoneCall * call, int stats_type) {
|
|||
const LinphoneCallParams * current_params = linphone_call_get_current_params(call);
|
||||
LinphoneCallLog *log = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getLog();
|
||||
reporting_session_report_t * report = log->reporting.reports[stats_type];
|
||||
char * dialog_id;
|
||||
|
||||
// call->op might be already released if hanging up in state LinphoneCallOutgoingInit
|
||||
if (!media_report_enabled(call, stats_type) || !L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp())
|
||||
return;
|
||||
|
||||
dialog_id = L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp()->getDialogId();
|
||||
std::string dialogId = L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp()->getDialogId();
|
||||
|
||||
STR_REASSIGN(report->info.call_id, ms_strdup(log->call_id));
|
||||
|
||||
|
|
@ -521,13 +520,13 @@ void linphone_reporting_update_media_info(LinphoneCall * call, int stats_type) {
|
|||
// RFC states: "LocalGroupID provides the identification for the purposes
|
||||
// of aggregation for the local endpoint.".
|
||||
STR_REASSIGN(report->info.local_addr.group, ms_strdup_printf("%s-%s-%s"
|
||||
, dialog_id ? dialog_id : ""
|
||||
, dialogId.c_str()
|
||||
, "local"
|
||||
, report->local_metrics.user_agent ? report->local_metrics.user_agent : ""
|
||||
)
|
||||
);
|
||||
STR_REASSIGN(report->info.remote_addr.group, ms_strdup_printf("%s-%s-%s"
|
||||
, dialog_id ? dialog_id : ""
|
||||
, dialogId.c_str()
|
||||
, "remote"
|
||||
, report->remote_metrics.user_agent ? report->remote_metrics.user_agent : ""
|
||||
)
|
||||
|
|
@ -582,7 +581,7 @@ void linphone_reporting_update_media_info(LinphoneCall * call, int stats_type) {
|
|||
}
|
||||
}
|
||||
|
||||
STR_REASSIGN(report->dialog_id, ms_strdup_printf("%s;%u", dialog_id ? dialog_id : "", report->info.local_addr.ssrc));
|
||||
STR_REASSIGN(report->dialog_id, ms_strdup_printf("%s;%u", dialogId.c_str(), report->info.local_addr.ssrc));
|
||||
|
||||
if (local_payload != NULL) {
|
||||
report->local_metrics.session_description.payload_type = local_payload->type;
|
||||
|
|
@ -597,8 +596,6 @@ void linphone_reporting_update_media_info(LinphoneCall * call, int stats_type) {
|
|||
report->remote_metrics.session_description.sample_rate = remote_payload->clock_rate;
|
||||
STR_REASSIGN(report->remote_metrics.session_description.fmtp, ms_strdup(remote_payload->recv_fmtp));
|
||||
}
|
||||
|
||||
ms_free(dialog_id);
|
||||
}
|
||||
|
||||
/* generate random float in interval ] 0.9 t ; 1.1 t [*/
|
||||
|
|
|
|||
|
|
@ -95,10 +95,10 @@ void RegisterInfoCommand::exec(Daemon *app, const string& args) {
|
|||
int id;
|
||||
try {
|
||||
id = atoi(param.c_str());
|
||||
} catch (invalid_argument) {
|
||||
} catch (invalid_argument&) {
|
||||
app->sendResponse(Response("Invalid ID.", Response::Error));
|
||||
return;
|
||||
} catch (out_of_range) {
|
||||
} catch (out_of_range&) {
|
||||
app->sendResponse(Response("Out of range ID.", Response::Error));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ typedef struct _LinphoneAddress LinphoneAddress;
|
|||
/**
|
||||
* The #LinphoneCall object represents a call issued or received by the #LinphoneCore
|
||||
* @ingroup call_control
|
||||
**/
|
||||
*/
|
||||
typedef struct _LinphoneCall LinphoneCall;
|
||||
|
||||
/** Callback prototype */
|
||||
|
|
@ -147,42 +147,64 @@ typedef struct _LinphoneEventLog LinphoneEventLog;
|
|||
/**
|
||||
* The LinphoneContent object holds data that can be embedded in a signaling message.
|
||||
* @ingroup misc
|
||||
**/
|
||||
*/
|
||||
typedef struct _LinphoneContent LinphoneContent;
|
||||
|
||||
/**
|
||||
* Represents a dial plan
|
||||
* @ingroup misc
|
||||
**/
|
||||
*/
|
||||
typedef struct _LinphoneDialPlan LinphoneDialPlan;
|
||||
|
||||
/**
|
||||
* A #LinphoneMagicSearch is used to do specifics searchs
|
||||
* @ingroup misc
|
||||
**/
|
||||
*/
|
||||
typedef struct _LinphoneMagicSearch LinphoneMagicSearch;
|
||||
|
||||
/**
|
||||
* @ingroup misc
|
||||
**/
|
||||
*/
|
||||
typedef struct _LinphoneParticipant LinphoneParticipant;
|
||||
|
||||
/**
|
||||
* The LinphoneParticipantImdnState object represents the state of chat message for a participant of a conference chat room.
|
||||
* @ingroup misc
|
||||
**/
|
||||
*/
|
||||
typedef struct _LinphoneParticipantImdnState LinphoneParticipantImdnState;
|
||||
|
||||
/**
|
||||
* The LinphoneSearchResult object represents a result of a search
|
||||
* @ingroup misc
|
||||
**/
|
||||
*/
|
||||
typedef struct _LinphoneSearchResult LinphoneSearchResult;
|
||||
|
||||
// =============================================================================
|
||||
// C Enums.
|
||||
// =============================================================================
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// How-to: Declare one enum
|
||||
//
|
||||
// 1. Declare a macro like this example in include/linphone/enums/chat-message-enums.h:
|
||||
//
|
||||
// #define L_ENUM_VALUES_CHAT_MESSAGE_DIRECTION(F) \ //
|
||||
// F(Incoming /**< Incoming message */) \ //
|
||||
// F(Outgoing /**< Outgoing message */)
|
||||
//
|
||||
// 2. And in this file, call L_DECLARE_C_ENUM with the enum name and values as params:
|
||||
//
|
||||
// L_DECLARE_C_ENUM(ChatMessageDirection, L_ENUM_VALUES_CHAT_MESSAGE_DIRECTION);
|
||||
//
|
||||
// 3. Do not forget to replace each single quote (with ') or other special char like
|
||||
// to an escaped sequence. Otherwise you get this error at compilation:
|
||||
//
|
||||
// [ 99%] Building CXX object wrappers/cpp/CMakeFiles/linphone++.dir/src/linphone++.cc.o
|
||||
// c++: error: WORK/desktop/Build/linphone/wrappers/cpp/src/linphone++.cc: No such file or directory
|
||||
// c++: fatal error: no input files
|
||||
// compilation terminated.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Call.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -191,7 +213,7 @@ typedef struct _LinphoneSearchResult LinphoneSearchResult;
|
|||
* #LinphoneCallState enum represents the different state a call can reach into.
|
||||
* The application is notified of state changes through the LinphoneCoreVTable::call_state_changed callback.
|
||||
* @ingroup call_control
|
||||
**/
|
||||
*/
|
||||
L_DECLARE_C_ENUM(CallState, L_ENUM_VALUES_CALL_SESSION_STATE);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -207,7 +229,7 @@ L_DECLARE_C_ENUM(ChatMessageDirection, L_ENUM_VALUES_CHAT_MESSAGE_DIRECTION);
|
|||
/**
|
||||
* #LinphoneChatMessageState is used to notify if messages have been succesfully delivered or not.
|
||||
* @ingroup chatroom
|
||||
*/
|
||||
*/
|
||||
L_DECLARE_C_ENUM(ChatMessageState, L_ENUM_VALUES_CHAT_MESSAGE_STATE);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -23,27 +23,27 @@
|
|||
// =============================================================================
|
||||
|
||||
#define L_ENUM_VALUES_CALL_SESSION_STATE(F) \
|
||||
F(Idle) \
|
||||
F(IncomingReceived) \
|
||||
F(OutgoingInit) \
|
||||
F(OutgoingProgress) \
|
||||
F(OutgoingRinging) \
|
||||
F(OutgoingEarlyMedia) \
|
||||
F(Connected) \
|
||||
F(StreamsRunning) \
|
||||
F(Pausing) \
|
||||
F(Paused) \
|
||||
F(Resuming) \
|
||||
F(Referred) \
|
||||
F(Error) \
|
||||
F(End) \
|
||||
F(PausedByRemote) \
|
||||
F(UpdatedByRemote) \
|
||||
F(IncomingEarlyMedia) \
|
||||
F(Updating) \
|
||||
F(Released) \
|
||||
F(EarlyUpdatedByRemote) \
|
||||
F(EarlyUpdating)
|
||||
F(Idle /**< Initial state */) \
|
||||
F(IncomingReceived /**< Incoming call received */) \
|
||||
F(OutgoingInit /**< Outgoing call initialized */) \
|
||||
F(OutgoingProgress /**< Outgoing call in progress */) \
|
||||
F(OutgoingRinging /**< Outgoing call ringing */) \
|
||||
F(OutgoingEarlyMedia /**< Outgoing call early media */) \
|
||||
F(Connected /**< Connected */) \
|
||||
F(StreamsRunning /**< Streams running */) \
|
||||
F(Pausing /**< Pausing */) \
|
||||
F(Paused /**< Paused */) \
|
||||
F(Resuming /**< Resuming */) \
|
||||
F(Referred /**< Referred */) \
|
||||
F(Error /**< Error */) \
|
||||
F(End /**< Call end */) \
|
||||
F(PausedByRemote /**< Paused by remote */) \
|
||||
F(UpdatedByRemote /**< The call's parameters are updated for example when video is asked by remote */) \
|
||||
F(IncomingEarlyMedia /**< We are proposing early media to an incoming call */) \
|
||||
F(Updating /**< We have initiated a call update */) \
|
||||
F(Released /**< The call object is now released */) \
|
||||
F(EarlyUpdatedByRemote /**< The call is updated by remote while not yet answered (SIP UPDATE in early dialog received) */) \
|
||||
F(EarlyUpdating /**< We are updating the call while not yet answered (SIP UPDATE in early dialog sent) */)
|
||||
|
||||
// =============================================================================
|
||||
// DEPRECATED
|
||||
|
|
|
|||
|
|
@ -23,17 +23,17 @@
|
|||
// =============================================================================
|
||||
|
||||
#define L_ENUM_VALUES_CHAT_MESSAGE_STATE(F) \
|
||||
F(Idle) \
|
||||
F(InProgress) \
|
||||
F(Delivered) \
|
||||
F(NotDelivered) \
|
||||
F(FileTransferError) \
|
||||
F(FileTransferDone) \
|
||||
F(DeliveredToUser) \
|
||||
F(Displayed)
|
||||
F(Idle /**< Initial state */) \
|
||||
F(InProgress /**< Delivery in progress */) \
|
||||
F(Delivered /**< Message successfully delivered and acknowledged by the server */) \
|
||||
F(NotDelivered /**< Message was not delivered */) \
|
||||
F(FileTransferError /**< Message was received and acknowledged but cannot get file from server */) \
|
||||
F(FileTransferDone /**< File transfer has been completed successfully */) \
|
||||
F(DeliveredToUser /**< Message successfully delivered an acknowledged by the remote user */) \
|
||||
F(Displayed /**< Message successfully displayed to the remote user */)
|
||||
|
||||
#define L_ENUM_VALUES_CHAT_MESSAGE_DIRECTION(F) \
|
||||
F(Incoming) \
|
||||
F(Outgoing)
|
||||
F(Incoming /**< Incoming message */) \
|
||||
F(Outgoing /**< Outgoing message */)
|
||||
|
||||
#endif // ifndef _L_CHAT_MESSAGE_ENUMS_H_
|
||||
|
|
|
|||
|
|
@ -23,22 +23,22 @@
|
|||
// =============================================================================
|
||||
|
||||
#define L_ENUM_VALUES_CHAT_ROOM_STATE(F) \
|
||||
F(None) \
|
||||
F(Instantiated) \
|
||||
F(CreationPending) \
|
||||
F(Created) \
|
||||
F(CreationFailed) \
|
||||
F(TerminationPending) \
|
||||
F(Terminated) \
|
||||
F(TerminationFailed) \
|
||||
F(Deleted)
|
||||
F(None /**< Initial state */) \
|
||||
F(Instantiated /**< Chat room is now instantiated on local */) \
|
||||
F(CreationPending /**< One creation request was sent to the server */) \
|
||||
F(Created /**< Chat room was created on the server */) \
|
||||
F(CreationFailed /**< Chat room creation failed */) \
|
||||
F(TerminationPending /**< Wait for chat room termination */) \
|
||||
F(Terminated /**< Chat room exists on server but not in local */) \
|
||||
F(TerminationFailed /**< The chat room termination failed */) \
|
||||
F(Deleted /**< Chat room was deleted on the server */)
|
||||
|
||||
#define L_ENUM_VALUES_CHAT_ROOM_CAPABILITIES(F) \
|
||||
F(Basic, 1 << 0) \
|
||||
F(RealTimeText, 1 << 1) \
|
||||
F(Conference, 1 << 2) \
|
||||
F(Proxy, 1 << 3) \
|
||||
F(Migratable, 1 << 4) \
|
||||
F(OneToOne, 1 << 5)
|
||||
F(Basic /**< No server. It's a direct communication */, 1 << 0) \
|
||||
F(RealTimeText /**< Supports RTT */, 1 << 1) \
|
||||
F(Conference /**< Use server (supports group chat) */, 1 << 2) \
|
||||
F(Proxy /**< Special proxy chat room flag */, 1 << 3) \
|
||||
F(Migratable /**< Chat room migratable from Basic to Conference */, 1 << 4) \
|
||||
F(OneToOne /**< A communication between two participants (can be Basic or Conference) */, 1 << 5)
|
||||
|
||||
#endif // ifndef _L_CHAT_ROOM_ENUMS_H_
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Utils {
|
|||
|
||||
template<typename T>
|
||||
LINPHONE_PUBLIC const T &getEmptyConstRefObject () {
|
||||
static const T object;
|
||||
static const T object{};
|
||||
return object;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -353,6 +353,7 @@ set(LINPHONE_OBJC_SOURCE_FILES)
|
|||
if (APPLE)
|
||||
list(APPEND LINPHONE_OBJC_SOURCE_FILES core/paths/paths-apple.mm)
|
||||
list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-apple.h)
|
||||
list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/platform-helpers/ios-platform-helpers.cpp)
|
||||
elseif (ANDROID)
|
||||
list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES core/paths/paths-android.cpp core/platform-helpers/android-platform-helpers.cpp)
|
||||
list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES core/paths/paths-android.h)
|
||||
|
|
@ -404,6 +405,7 @@ if(ENABLE_SHARED)
|
|||
${LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES} ${LINPHONE_CXX_OBJECTS_SOURCE_FILES} ${LINPHONE_OBJC_SOURCE_FILES}
|
||||
$<TARGET_OBJECTS:linphone-coreapi>
|
||||
)
|
||||
#TODO: replace by if(APPLE) when we want to make apple framework on linphone-desktop too
|
||||
if(IOS)
|
||||
if(IOS)
|
||||
set(MIN_OS ${LINPHONE_IOS_DEPLOYMENT_TARGET})
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ void linphone_call_ogl_render (const LinphoneCall *call) {
|
|||
LinphoneStatus linphone_call_send_info_message (LinphoneCall *call, const LinphoneInfoMessage *info) {
|
||||
SalBodyHandler *body_handler = sal_body_handler_from_content(linphone_info_message_get_content(info));
|
||||
linphone_call_get_op(call)->setSentCustomHeaders(linphone_info_message_get_headers(info));
|
||||
return linphone_call_get_op(call)->sendInfo(nullptr, nullptr, body_handler);
|
||||
return linphone_call_get_op(call)->sendInfo(body_handler);
|
||||
}
|
||||
|
||||
LinphoneCallStats *linphone_call_get_stats (LinphoneCall *call, LinphoneStreamType type) {
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ void FileTransferChatMessageModifier::processResponseFromPostFile (const belle_h
|
|||
string first_part_header;
|
||||
belle_sip_body_handler_t *first_part_bh;
|
||||
|
||||
bool_t is_file_encryption_enabled = FALSE;
|
||||
bool is_file_encryption_enabled = false;
|
||||
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(message->getCore()->getCCore());
|
||||
if (imee && message->getChatRoom()) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
|
|
|
|||
|
|
@ -177,11 +177,11 @@ bool CallSessionPrivate::startPing () {
|
|||
pingReplied = false;
|
||||
pingOp = new SalOp(q->getCore()->getCCore()->sal);
|
||||
if (direction == LinphoneCallIncoming) {
|
||||
const char *from = pingOp->getFrom();
|
||||
const char *to = pingOp->getTo();
|
||||
string from = pingOp->getFrom();
|
||||
string to = pingOp->getTo();
|
||||
linphone_configure_op(q->getCore()->getCCore(), pingOp, log->from, nullptr, false);
|
||||
pingOp->setRoute(op->getNetworkOrigin());
|
||||
pingOp->ping(from, to);
|
||||
pingOp->ping(from.c_str(), to.c_str());
|
||||
} else if (direction == LinphoneCallOutgoing) {
|
||||
char *from = linphone_address_as_string(log->from);
|
||||
char *to = linphone_address_as_string(log->to);
|
||||
|
|
@ -786,12 +786,12 @@ void CallSessionPrivate::reinviteToRecoverFromConnectionLoss () {
|
|||
|
||||
void CallSessionPrivate::repairByInviteWithReplaces () {
|
||||
L_Q();
|
||||
const char *callId = op->getCallId();
|
||||
string callId = op->getCallId();
|
||||
const char *fromTag = op->getLocalTag();
|
||||
const char *toTag = op->getRemoteTag();
|
||||
op->killDialog();
|
||||
createOp();
|
||||
op->setReplaces(callId, fromTag, toTag);
|
||||
op->setReplaces(callId.c_str(), fromTag, toTag);
|
||||
q->startInvite(nullptr);
|
||||
}
|
||||
|
||||
|
|
@ -937,7 +937,7 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg
|
|||
linphone_core_get_config(getCore()->getCCore()), "sip", "cnx_ip_to_0000_if_sendonly_enabled", 0
|
||||
)
|
||||
);
|
||||
d->log->call_id = ms_strdup(op->getCallId()); /* Must be known at that time */
|
||||
d->log->call_id = ms_strdup(op->getCallId().c_str()); /* Must be known at that time */
|
||||
}
|
||||
|
||||
if (direction == LinphoneCallOutgoing) {
|
||||
|
|
@ -1109,7 +1109,7 @@ int CallSession::startInvite (const Address *destination, const string &subject,
|
|||
d->setState(CallSession::State::Error, "Call failed");
|
||||
}
|
||||
} else {
|
||||
d->log->call_id = ms_strdup(d->op->getCallId()); /* Must be known at that time */
|
||||
d->log->call_id = ms_strdup(d->op->getCallId().c_str()); /* Must be known at that time */
|
||||
d->setState(CallSession::State::OutgoingProgress, "Outgoing call in progress");
|
||||
}
|
||||
return result;
|
||||
|
|
@ -1326,7 +1326,7 @@ string CallSession::getToHeader (const string &name) const {
|
|||
|
||||
string CallSession::getRemoteUserAgent () const {
|
||||
L_D();
|
||||
if (d->op && d->op->getRemoteUserAgent())
|
||||
if (d->op)
|
||||
return d->op->getRemoteUserAgent();
|
||||
return string();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2865,7 +2865,7 @@ void MediaSessionPrivate::startTextStream () {
|
|||
configureRtpSessionForRtcpFb(tstream);
|
||||
configureRtpSessionForRtcpXr(SalText);
|
||||
rtp_session_enable_rtcp_mux(textStream->ms.sessions.rtp_session, tstream->rtcp_mux);
|
||||
bool_t isMulticast = ms_is_multicast(rtpAddr);
|
||||
bool isMulticast = ms_is_multicast(rtpAddr);
|
||||
if (isMulticast)
|
||||
rtp_session_set_multicast_ttl(textStream->ms.sessions.rtp_session, tstream->ttl);
|
||||
text_stream_start(textStream, textProfile, rtpAddr, tstream->rtp_port, rtcpAddr,
|
||||
|
|
|
|||
|
|
@ -66,10 +66,8 @@ bool CorePrivate::inviteReplacesABrokenCall (SalCallOp *op) {
|
|||
shared_ptr<CallSession> session = call->getPrivate()->getActiveSession();
|
||||
if (session
|
||||
&& ((session->getPrivate()->isBroken() && op->compareOp(session->getPrivate()->getOp()))
|
||||
|| ((replacedSession == session.get())
|
||||
&& (strcmp(op->getFrom(), replacedOp->getFrom()) == 0)
|
||||
&& (strcmp(op->getTo(), replacedOp->getTo()) == 0)))
|
||||
) {
|
||||
|| (replacedSession == session.get() && op->getFrom() == replacedOp->getFrom() && op->getTo() == replacedOp->getTo())
|
||||
)) {
|
||||
session->getPrivate()->replaceOp(op);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
119
src/core/platform-helpers/ios-platform-helpers.cpp
Normal file
119
src/core/platform-helpers/ios-platform-helpers.cpp
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
linphone
|
||||
Copyright (C) 2017 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "logger/logger.h"
|
||||
#include "platform-helpers.h"
|
||||
|
||||
// TODO: Remove me
|
||||
#include "private.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class IosPlatformHelpers : public PlatformHelpers {
|
||||
public:
|
||||
IosPlatformHelpers (LinphoneCore *lc, void *system_context);
|
||||
~IosPlatformHelpers () = default;
|
||||
|
||||
void setDnsServers () override {}
|
||||
void acquireWifiLock () override {}
|
||||
void releaseWifiLock () override {}
|
||||
void acquireMcastLock () override {}
|
||||
void releaseMcastLock () override {}
|
||||
void acquireCpuLock () override;
|
||||
void releaseCpuLock () override;
|
||||
string getDataPath () override {return Utils::getEmptyConstRefObject<string>();}
|
||||
string getConfigPath () override {return Utils::getEmptyConstRefObject<string>();}
|
||||
|
||||
private:
|
||||
void bgTaskTimeout ();
|
||||
static void sBgTaskTimeout (void *data);
|
||||
|
||||
long int mCpuLockTaskId;
|
||||
int mCpuLockCount;
|
||||
};
|
||||
|
||||
// =============================================================================
|
||||
|
||||
IosPlatformHelpers::IosPlatformHelpers (LinphoneCore *lc, void *system_context) : PlatformHelpers(lc) {
|
||||
mCpuLockCount = 0;
|
||||
mCpuLockTaskId = 0;
|
||||
lInfo() << "IosPlatformHelpers is fully initialised";
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void IosPlatformHelpers::bgTaskTimeout () {
|
||||
lError() << "IosPlatformHelpers: the system requests that the cpu lock is released now.";
|
||||
if (mCpuLockTaskId != 0) {
|
||||
belle_sip_end_background_task(static_cast<unsigned long>(mCpuLockTaskId));
|
||||
mCpuLockTaskId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void IosPlatformHelpers::sBgTaskTimeout (void *data) {
|
||||
IosPlatformHelpers *zis = static_cast<IosPlatformHelpers *>(data);
|
||||
zis->bgTaskTimeout();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void IosPlatformHelpers::acquireCpuLock () {
|
||||
// on iOS, cpu lock is implemented by a long running task and it is abstracted by belle-sip, so let's use belle-sip directly.
|
||||
if (mCpuLockCount == 0)
|
||||
mCpuLockTaskId = static_cast<long>(belle_sip_begin_background_task("Liblinphone cpu lock", sBgTaskTimeout, this));
|
||||
|
||||
mCpuLockCount++;
|
||||
}
|
||||
|
||||
void IosPlatformHelpers::releaseCpuLock () {
|
||||
mCpuLockCount--;
|
||||
if (mCpuLockCount != 0)
|
||||
return;
|
||||
|
||||
if (mCpuLockTaskId == 0) {
|
||||
lError() << "IosPlatformHelpers::releaseCpuLock(): too late, the lock has been released already by the system.";
|
||||
return;
|
||||
}
|
||||
|
||||
belle_sip_end_background_task(static_cast<unsigned long>(mCpuLockTaskId));
|
||||
mCpuLockTaskId = 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
PlatformHelpers *createIosPlatformHelpers (LinphoneCore *lc, void *system_context) {
|
||||
return new IosPlatformHelpers(lc, system_context);
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
@ -72,6 +72,7 @@ public:
|
|||
};
|
||||
|
||||
PlatformHelpers *createAndroidPlatformHelpers (LinphoneCore *lc, void *systemContext);
|
||||
PlatformHelpers *createIosPlatformHelpers (LinphoneCore *lc, void *systemContext);
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ void IceAgent::createIceCheckListsAndParseIceAttributes (const SalMediaDescripti
|
|||
);
|
||||
}
|
||||
if (!iceRestarted) {
|
||||
bool_t losingPairsAdded = false;
|
||||
bool losingPairsAdded = false;
|
||||
for (int j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; j++) {
|
||||
const SalIceRemoteCandidate *remoteCandidate = &stream->ice_remote_candidates[j];
|
||||
const char *addr = nullptr;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ int SalCallOp::setLocalBody(const Content &&body) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
belle_sip_header_allow_t *SalCallOp::createAllow(bool_t enable_update) {
|
||||
belle_sip_header_allow_t *SalCallOp::createAllow(bool enable_update) {
|
||||
belle_sip_header_allow_t* header_allow;
|
||||
char allow [256];
|
||||
snprintf(allow,sizeof(allow),"INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO%s",(enable_update?", UPDATE":""));
|
||||
|
|
@ -370,7 +370,7 @@ void SalCallOp::handleBodyFromResponse(belle_sip_response_t* response) {
|
|||
}
|
||||
}
|
||||
|
||||
void SalCallOp::setError(belle_sip_response_t* response, bool_t fatal){
|
||||
void SalCallOp::setError(belle_sip_response_t* response, bool fatal){
|
||||
setErrorInfoFromResponse(response);
|
||||
if (fatal) mState = State::Terminating;
|
||||
mRoot->mCallbacks.call_failure(this);
|
||||
|
|
@ -464,7 +464,7 @@ void SalCallOp::processResponseCb(void *op_base, const belle_sip_response_event_
|
|||
belle_sip_object_unref(op->mSdpAnswer);
|
||||
op->mSdpAnswer=NULL;
|
||||
}
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(ack),BELLE_SIP_HEADER(op->mRoot->mUserAgent));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(ack),BELLE_SIP_HEADER(op->mRoot->mUserAgentHeader));
|
||||
op->mRoot->mCallbacks.call_accepted(op); /*INVITE*/
|
||||
op->mRoot->mCallbacks.call_ack_being_sent(op, (SalCustomHeader*)ack);
|
||||
belle_sip_dialog_send_ack(op->mDialog,ack);
|
||||
|
|
@ -495,7 +495,7 @@ void SalCallOp::processResponseCb(void *op_base, const belle_sip_response_event_
|
|||
break;
|
||||
case State::Terminated:
|
||||
default:
|
||||
ms_error("Call op [%p] receives unexpected answer [%i] while in state [%s].",op,code, toString(op->mState));
|
||||
lError() << "Call op [" << op << "] receives unexpected answer [" << code << "] while in state [" << toString(op->mState) << "]";
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -538,7 +538,7 @@ void SalCallOp::processTransactionTerminatedCb(void *user_ctx, const belle_sip_t
|
|||
belle_sip_request_t* req;
|
||||
belle_sip_response_t* resp;
|
||||
int code = 0;
|
||||
bool_t release_call=FALSE;
|
||||
bool release_call = false;
|
||||
|
||||
if (client_transaction) {
|
||||
req=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(client_transaction));
|
||||
|
|
@ -554,13 +554,13 @@ void SalCallOp::processTransactionTerminatedCb(void *user_ctx, const belle_sip_t
|
|||
&& (!resp || (belle_sip_response_get_status_code(resp) != 401
|
||||
&& belle_sip_response_get_status_code(resp) != 407))
|
||||
&& op->mDialog==NULL) {
|
||||
release_call=TRUE;
|
||||
release_call=true;
|
||||
}else if (op->mState == State::Early && code < 200){
|
||||
/*call terminated early*/
|
||||
sal_error_info_set(&op->mErrorInfo, SalReasonIOError, "SIP", 503, "I/O error", NULL);
|
||||
op->mState = State::Terminating;
|
||||
op->mRoot->mCallbacks.call_failure(op);
|
||||
release_call=TRUE;
|
||||
release_call=true;
|
||||
}
|
||||
if (server_transaction){
|
||||
if (op->mPendingServerTransaction==server_transaction){
|
||||
|
|
@ -645,7 +645,7 @@ void SalCallOp::callTerminated(belle_sip_server_transaction_t* server_transactio
|
|||
setReasonErrorInfo(BELLE_SIP_MESSAGE(cancel_request ? cancel_request : server_req));
|
||||
resp=createResponseFromRequest(server_req,status_code);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
mRoot->mCallbacks.call_terminated(this,mDir==Dir::Incoming?getFrom():getTo());
|
||||
mRoot->mCallbacks.call_terminated(this,mDir==Dir::Incoming?getFrom().c_str():getTo().c_str());
|
||||
}
|
||||
|
||||
void SalCallOp::resetDescriptions() {
|
||||
|
|
@ -665,7 +665,7 @@ void SalCallOp::unsupportedMethod(belle_sip_server_transaction_t* server_transac
|
|||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
}
|
||||
|
||||
bool_t SalCallOp::isAPendingIncomingInviteTransaction(belle_sip_transaction_t *tr){
|
||||
bool SalCallOp::isAPendingIncomingInviteTransaction(belle_sip_transaction_t *tr){
|
||||
return BELLE_SIP_OBJECT_IS_INSTANCE_OF(tr, belle_sip_ist_t) && belle_sip_transaction_state_is_transient(
|
||||
belle_sip_transaction_get_state(tr));
|
||||
}
|
||||
|
|
@ -679,8 +679,8 @@ void SalCallOp::processRequestEventCb(void *op_base, const belle_sip_request_eve
|
|||
belle_sip_response_t* resp;
|
||||
belle_sip_header_t* call_info;
|
||||
const char *method=belle_sip_request_get_method(req);
|
||||
bool_t is_update=FALSE;
|
||||
bool_t drop_op = FALSE;
|
||||
bool is_update = false;
|
||||
bool drop_op = false;
|
||||
|
||||
if (strcmp("ACK",method)!=0){ /*ACK doesn't create a server transaction*/
|
||||
server_transaction = belle_sip_provider_create_server_transaction(op->mRoot->mProvider,belle_sip_request_event_get_request(event));
|
||||
|
|
@ -704,7 +704,7 @@ void SalCallOp::processRequestEventCb(void *op_base, const belle_sip_request_eve
|
|||
|
||||
if (!op->mDialog) {
|
||||
op->setOrUpdateDialog(belle_sip_provider_create_dialog(op->mRoot->mProvider, BELLE_SIP_TRANSACTION(op->mPendingServerTransaction)));
|
||||
ms_message("new incoming call from [%s] to [%s]",op->getFrom(),op->getTo());
|
||||
ms_message("new incoming call from [%s] to [%s]",op->getFrom().c_str(),op->getTo().c_str());
|
||||
}
|
||||
dialog_state=belle_sip_dialog_get_state(op->mDialog);
|
||||
switch(dialog_state) {
|
||||
|
|
@ -728,7 +728,7 @@ void SalCallOp::processRequestEventCb(void *op_base, const belle_sip_request_eve
|
|||
sal_error_info_set(&op->mErrorInfo, reason, "SIP", 0, NULL, NULL);
|
||||
op->mRoot->mCallbacks.call_rejected(op);
|
||||
/*the INVITE was declined by process_sdp_for_invite(). As we are not inside an established dialog, we can drop the op immediately*/
|
||||
drop_op = TRUE;
|
||||
drop_op = true;
|
||||
}
|
||||
break;
|
||||
}BCTBX_NO_BREAK; /* else same behavior as for EARLY state, thus NO BREAK*/
|
||||
|
|
@ -874,7 +874,7 @@ void SalCallOp::processDialogTerminatedCb(void *ctx, const belle_sip_dialog_term
|
|||
case BELLE_SIP_DIALOG_CONFIRMED:
|
||||
if (op->mState!=State::Terminated && op->mState!=State::Terminating) {
|
||||
/*this is probably a normal termination from a BYE*/
|
||||
op->mRoot->mCallbacks.call_terminated(op,op->mDir==Dir::Incoming?op->getFrom():op->getTo());
|
||||
op->mRoot->mCallbacks.call_terminated(op,op->mDir==Dir::Incoming?op->getFrom().c_str():op->getTo().c_str());
|
||||
op->mState=State::Terminating;
|
||||
}
|
||||
break;
|
||||
|
|
@ -931,16 +931,15 @@ int SalCallOp::call(const char *from, const char *to, const char *subject) {
|
|||
return sendRequest(invite);
|
||||
}
|
||||
|
||||
int SalCallOp::notifyRinging(bool_t early_media){
|
||||
int SalCallOp::notifyRinging(bool early_media){
|
||||
int status_code =early_media?183:180;
|
||||
belle_sip_request_t* req=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(mPendingServerTransaction));
|
||||
belle_sip_response_t* ringing_response = createResponseFromRequest(req,status_code);
|
||||
belle_sip_header_t *require;
|
||||
const char *tags=NULL;
|
||||
|
||||
if (early_media){
|
||||
handleOfferAnswerResponse(ringing_response);
|
||||
}
|
||||
if (early_media)
|
||||
handleOfferAnswerResponse(ringing_response);
|
||||
require=belle_sip_message_get_header((belle_sip_message_t*)req,"Require");
|
||||
if (require) tags=belle_sip_header_get_unparsed_value(require);
|
||||
/* if client requires 100rel, then add necessary stuff*/
|
||||
|
|
@ -1085,16 +1084,14 @@ int SalCallOp::declineWithErrorInfo(const SalErrorInfo *info, const SalAddress *
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SalCallOp::update(const char *subject, bool_t no_user_consent) {
|
||||
int SalCallOp::update(const char *subject, bool no_user_consent) {
|
||||
belle_sip_request_t *update;
|
||||
belle_sip_dialog_state_t state;
|
||||
|
||||
if (mDialog == NULL) {
|
||||
/* If the dialog does not exist, this is that we are trying to recover from a connection loss
|
||||
during a very early state of outgoing call initiation (the dialog has not been created yet). */
|
||||
const char *from = getFrom();
|
||||
const char *to = getTo();
|
||||
return call(from, to, subject);
|
||||
return call(mFrom.c_str(), mTo.c_str(), subject);
|
||||
}
|
||||
|
||||
state = belle_sip_dialog_get_state(mDialog);
|
||||
|
|
@ -1127,7 +1124,7 @@ int SalCallOp::update(const char *subject, bool_t no_user_consent) {
|
|||
|
||||
int SalCallOp::cancelInvite(const SalErrorInfo *info) {
|
||||
belle_sip_request_t* cancel;
|
||||
ms_message("Cancelling INVITE request from [%s] to [%s] ",getFrom(), getTo());
|
||||
ms_message("Cancelling INVITE request from [%s] to [%s] ",getFrom().c_str(), getTo().c_str());
|
||||
|
||||
if (mPendingClientTransaction == NULL) {
|
||||
ms_warning("There is no transaction to cancel.");
|
||||
|
|
@ -1316,7 +1313,7 @@ int SalCallOp::terminate(const SalErrorInfo *info) {
|
|||
p_sei = info;
|
||||
}
|
||||
if (mState==State::Terminating || mState==State::Terminated) {
|
||||
ms_error("Cannot terminate op [%p] in state [%s]",this,toString(mState));
|
||||
lError() << "Cannot terminate op [" << this << "] in state [" << toString(mState) << "]";
|
||||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -1394,10 +1391,10 @@ void SalCallOp::sendVfuRequest() {
|
|||
error=sendRequest(info);
|
||||
}
|
||||
if (error)
|
||||
ms_warning("Cannot send vfu request to [%s] ", getTo());
|
||||
ms_warning("Cannot send vfu request to [%s] ", getTo().c_str());
|
||||
|
||||
} else {
|
||||
ms_warning("Cannot send vfu request to [%s] because dialog [%p] in wrong state [%s]",getTo()
|
||||
ms_warning("Cannot send vfu request to [%s] because dialog [%p] in wrong state [%s]",getTo().c_str()
|
||||
,mDialog
|
||||
,belle_sip_dialog_state_to_string(dialog_state));
|
||||
}
|
||||
|
|
@ -1538,8 +1535,8 @@ int SalCallOp::sendMessage (const Content &content) {
|
|||
return sendRequest(req);
|
||||
}
|
||||
|
||||
bool_t SalCallOp::compareOp(const SalCallOp *op2) const {
|
||||
return (strcmp(mCallId, op2->mCallId) == 0);
|
||||
bool SalCallOp::compareOp(const SalCallOp *op2) const {
|
||||
return mCallId == op2->mCallId;
|
||||
}
|
||||
|
||||
void SalCallOp::handleOfferAnswerResponse(belle_sip_response_t* response) {
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ public:
|
|||
SalMediaDescription *getFinalMediaDescription ();
|
||||
|
||||
int call (const char *from, const char *to, const char *subject);
|
||||
int notifyRinging (bool_t earlyMedia);
|
||||
int notifyRinging (bool earlyMedia);
|
||||
int accept ();
|
||||
int decline (SalReason reason, const char *redirection = nullptr);
|
||||
int declineWithErrorInfo (const SalErrorInfo *info, const SalAddress *redirectionAddr = nullptr);
|
||||
int update (const char *subject, bool_t noUserConsent);
|
||||
int update (const char *subject, bool noUserConsent);
|
||||
int cancelInvite (const SalErrorInfo *info = nullptr);
|
||||
int refer (const char *referTo);
|
||||
int referWithReplaces (SalCallOp *otherCallOp);
|
||||
|
|
@ -52,12 +52,12 @@ public:
|
|||
SalCallOp *getReplaces () const;
|
||||
int sendDtmf (char dtmf);
|
||||
int terminate (const SalErrorInfo *info = nullptr);
|
||||
bool_t autoAnswerAsked () const { return mAutoAnswerAsked; }
|
||||
bool autoAnswerAsked () const { return mAutoAnswerAsked; }
|
||||
void sendVfuRequest ();
|
||||
int isOfferer () const { return mSdpOffering; }
|
||||
int notifyReferState (SalCallOp *newCallOp);
|
||||
bool_t compareOp (const SalCallOp *otherCallOp) const;
|
||||
bool_t dialogRequestPending () const { return (belle_sip_dialog_request_pending(mDialog) != 0); }
|
||||
bool compareOp (const SalCallOp *otherCallOp) const;
|
||||
bool dialogRequestPending () const { return (belle_sip_dialog_request_pending(mDialog) != 0); }
|
||||
const char *getLocalTag () { return belle_sip_dialog_get_local_tag(mDialog); }
|
||||
const char *getRemoteTag () { return belle_sip_dialog_get_remote_tag(mDialog); }
|
||||
void setReplaces (const char *callId, const char *fromTag, const char *toTag);
|
||||
|
|
@ -71,7 +71,7 @@ private:
|
|||
virtual void fillCallbacks () override;
|
||||
void setReleased ();
|
||||
|
||||
void setError (belle_sip_response_t *response, bool_t fatal);
|
||||
void setError (belle_sip_response_t *response, bool fatal);
|
||||
void callTerminated (belle_sip_server_transaction_t *serverTransaction, int statusCode, belle_sip_request_t *cancelRequest);
|
||||
void resetDescriptions ();
|
||||
|
||||
|
|
@ -92,11 +92,11 @@ private:
|
|||
|
||||
static void setAddrTo0000 (char value[], size_t sz);
|
||||
static int isMediaDescriptionAcceptable (SalMediaDescription *md);
|
||||
static bool_t isAPendingIncomingInviteTransaction (belle_sip_transaction_t *tr);
|
||||
static bool isAPendingIncomingInviteTransaction (belle_sip_transaction_t *tr);
|
||||
static void setCallAsReleased (SalCallOp *op);
|
||||
static void unsupportedMethod (belle_sip_server_transaction_t *serverTransaction, belle_sip_request_t *request);
|
||||
static belle_sip_header_reason_t *makeReasonHeader (const SalErrorInfo *info);
|
||||
static belle_sip_header_allow_t *createAllow (bool_t enableUpdate);
|
||||
static belle_sip_header_allow_t *createAllow (bool enableUpdate);
|
||||
static std::vector<char> marshalMediaDescription (belle_sdp_session_description_t *sessionDesc, belle_sip_error_code &error);
|
||||
|
||||
// belle_sip_message handlers
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ void SalSubscribeOp::handleNotify(belle_sip_request_t *req, const char *eventnam
|
|||
|
||||
if (!subscription_state_header || strcasecmp(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,belle_sip_header_subscription_state_get_state(subscription_state_header)) ==0) {
|
||||
sub_state=SalSubscribeTerminated;
|
||||
ms_message("Outgoing subscription terminated by remote [%s]",getTo());
|
||||
ms_message("Outgoing subscription terminated by remote [%s]",getTo().c_str());
|
||||
} else
|
||||
sub_state=SalSubscribeActive;
|
||||
ref();
|
||||
|
|
@ -133,7 +133,7 @@ void SalSubscribeOp::subscribeProcessRequestEventCb(void *op_base, const belle_s
|
|||
return;
|
||||
}
|
||||
op->setOrUpdateDialog(dialog);
|
||||
ms_message("new incoming subscription from [%s] to [%s]",op->getFrom(),op->getTo());
|
||||
ms_message("new incoming subscription from [%s] to [%s]",op->getFrom().c_str(),op->getTo().c_str());
|
||||
}else{ /*this is a NOTIFY*/
|
||||
op->handleNotify(req, eventname, (SalBodyHandler *)body_handler);
|
||||
return;
|
||||
|
|
@ -162,7 +162,7 @@ void SalSubscribeOp::subscribeProcessRequestEventCb(void *op_base, const belle_s
|
|||
resp=op->createResponseFromRequest(req,200);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
} else if(expires) {
|
||||
ms_message("Unsubscribe received from [%s]",op->getFrom());
|
||||
ms_message("Unsubscribe received from [%s]",op->getFrom().c_str());
|
||||
resp=op->createResponseFromRequest(req,200);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
op->mRoot->mCallbacks.incoming_subscribe_closed(op);
|
||||
|
|
@ -366,16 +366,16 @@ void SalPublishOp::publishRefresherListenerCb (belle_sip_refresher_t* refresher,
|
|||
SalPublishOp * op = (SalPublishOp *)user_pointer;
|
||||
const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->mRefresher);
|
||||
belle_sip_response_t *response=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(last_publish_trans));
|
||||
ms_message("Publish refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase?reason_phrase:"none",op->getProxy());
|
||||
ms_message("Publish refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase?reason_phrase:"none",op->getProxy().c_str());
|
||||
if (status_code==0){
|
||||
op->mRoot->mCallbacks.on_expire(op);
|
||||
}else if (status_code>=200){
|
||||
belle_sip_header_t *sip_etag;
|
||||
const char *sip_etag_string = NULL;
|
||||
string sipEtagStr;
|
||||
if (response && (sip_etag = belle_sip_message_get_header(BELLE_SIP_MESSAGE(response), "SIP-ETag"))) {
|
||||
sip_etag_string = belle_sip_header_get_unparsed_value(sip_etag);
|
||||
sipEtagStr = belle_sip_header_get_unparsed_value(sip_etag);
|
||||
}
|
||||
op->setEntityTag(sip_etag_string);
|
||||
op->setEntityTag(sipEtagStr);
|
||||
sal_error_info_set(&op->mErrorInfo,SalReasonUnknown, "SIP", (int)status_code, reason_phrase, NULL);
|
||||
op->assignRecvHeaders((belle_sip_message_t*)response);
|
||||
op->mRoot->mCallbacks.on_publish_response(op);
|
||||
|
|
@ -395,11 +395,10 @@ int SalPublishOp::publish(const char *from, const char *to, const char *eventnam
|
|||
if( req == NULL ){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (getEntityTag()) {
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("SIP-If-Match", getEntityTag()));
|
||||
}
|
||||
|
||||
|
||||
if (!mEntityTag.empty())
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req), belle_sip_header_create("SIP-If-Match", mEntityTag.c_str()));
|
||||
|
||||
if (getContactAddress()){
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(createContact()));
|
||||
}
|
||||
|
|
|
|||
434
src/sal/op.cpp
434
src/sal/op.cpp
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <cstring>
|
||||
|
||||
#include "c-wrapper/internal/c-tools.h"
|
||||
#include "sal/op.h"
|
||||
#include "bellesip_sal/sal_impl.h"
|
||||
|
||||
|
|
@ -35,7 +36,7 @@ SalOp::SalOp(Sal *sal) {
|
|||
}
|
||||
|
||||
SalOp::~SalOp() {
|
||||
ms_message("Destroying op [%p] of type [%s]",this,toString(mType));
|
||||
lInfo() << "Destroying op [" << this << "] of type [" << toString(mType) << "]";
|
||||
|
||||
if (mPendingAuthTransaction) belle_sip_object_unref(mPendingAuthTransaction);
|
||||
mRoot->removePendingAuth(this);
|
||||
|
|
@ -77,62 +78,21 @@ SalOp::~SalOp() {
|
|||
mOriginAddress=NULL;
|
||||
}
|
||||
|
||||
if (mFrom) {
|
||||
ms_free(mFrom);
|
||||
mFrom=NULL;
|
||||
}
|
||||
if (mTo) {
|
||||
ms_free(mTo);
|
||||
mTo=NULL;
|
||||
}
|
||||
if (mSubject) {
|
||||
ms_free(mSubject);
|
||||
mSubject = NULL;
|
||||
}
|
||||
if (mRoute) {
|
||||
ms_free(mRoute);
|
||||
mRoute=NULL;
|
||||
}
|
||||
if (mRealm) {
|
||||
ms_free(mRealm);
|
||||
mRealm=NULL;
|
||||
}
|
||||
if (mContactAddress) {
|
||||
sal_address_destroy(mContactAddress);
|
||||
}
|
||||
if (mOrigin){
|
||||
ms_free(mOrigin);
|
||||
mOrigin=NULL;
|
||||
}
|
||||
if (mRemoteUserAgent){
|
||||
ms_free(mRemoteUserAgent);
|
||||
mRemoteUserAgent=NULL;
|
||||
}
|
||||
if (mRemoteContact){
|
||||
ms_free(mRemoteContact);
|
||||
mRemoteContact=NULL;
|
||||
}
|
||||
if (mRemoteContactAddress){
|
||||
sal_address_destroy(mRemoteContactAddress);
|
||||
}
|
||||
if (mCallId)
|
||||
ms_free(mCallId);
|
||||
if (mServiceRoute) {
|
||||
sal_address_destroy(mServiceRoute);
|
||||
}
|
||||
if (mRouteAddresses){
|
||||
bctbx_list_for_each(mRouteAddresses,(void (*)(void*)) sal_address_destroy);
|
||||
mRouteAddresses=bctbx_list_free(mRouteAddresses);
|
||||
}
|
||||
for (auto &addr : mRouteAddresses)
|
||||
sal_address_unref(addr);
|
||||
if (mRecvCustomHeaders)
|
||||
sal_custom_header_free(mRecvCustomHeaders);
|
||||
if (mSentCustomHeaders)
|
||||
sal_custom_header_free(mSentCustomHeaders);
|
||||
|
||||
if (mEntityTag != NULL){
|
||||
ms_free(mEntityTag);
|
||||
mEntityTag = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SalOp *SalOp::ref() {
|
||||
|
|
@ -155,37 +115,28 @@ void SalOp::setContactAddress(const SalAddress *address) {
|
|||
mContactAddress=address?sal_address_clone(address):NULL;
|
||||
}
|
||||
|
||||
void SalOp::assignAddress(SalAddress** address, const char *value) {
|
||||
if (*address){
|
||||
void SalOp::assignAddress (SalAddress **address, const string &value) {
|
||||
if (*address) {
|
||||
sal_address_destroy(*address);
|
||||
*address=NULL;
|
||||
*address = nullptr;
|
||||
}
|
||||
if (value)
|
||||
*address=sal_address_new(value);
|
||||
if (!value.empty())
|
||||
*address = sal_address_new(value.c_str());
|
||||
}
|
||||
|
||||
void SalOp::assignString(char **str, const char *arg) {
|
||||
if (*str){
|
||||
ms_free(*str);
|
||||
*str=NULL;
|
||||
void SalOp::setRoute (const string &value) {
|
||||
for (auto &address : mRouteAddresses)
|
||||
sal_address_unref(address);
|
||||
mRouteAddresses.clear();
|
||||
if (value.empty()) {
|
||||
mRoute.clear();
|
||||
} else {
|
||||
auto address = sal_address_new(value.c_str());
|
||||
mRouteAddresses.push_back(address);
|
||||
char *routeStr = sal_address_as_string(address);
|
||||
mRoute = routeStr;
|
||||
ms_free(routeStr);
|
||||
}
|
||||
if (arg)
|
||||
*str=ms_strdup(arg);
|
||||
}
|
||||
|
||||
void SalOp::setRoute(const char *route) {
|
||||
char* route_string=NULL;
|
||||
if (mRouteAddresses) {
|
||||
bctbx_list_for_each(mRouteAddresses,(void (*)(void *))sal_address_destroy);
|
||||
mRouteAddresses=bctbx_list_free(mRouteAddresses);
|
||||
}
|
||||
if (route) {
|
||||
mRouteAddresses=bctbx_list_append(NULL,NULL);
|
||||
assignAddress((SalAddress**)&(mRouteAddresses->data),route);
|
||||
route_string=sal_address_as_string((SalAddress*)mRouteAddresses->data);
|
||||
}
|
||||
assignString(&mRoute,route_string);
|
||||
if(route_string) ms_free(route_string);
|
||||
}
|
||||
|
||||
void SalOp::setRouteAddress(const SalAddress *address){
|
||||
|
|
@ -194,33 +145,22 @@ void SalOp::setRouteAddress(const SalAddress *address){
|
|||
ms_free(address_string);
|
||||
}
|
||||
|
||||
void SalOp::addRouteAddress(const SalAddress *address) {
|
||||
if (mRouteAddresses) {
|
||||
mRouteAddresses=bctbx_list_append(mRouteAddresses,(void*)sal_address_clone(address));
|
||||
} else {
|
||||
setRouteAddress(address);
|
||||
}
|
||||
void SalOp::addRouteAddress (const SalAddress *address) {
|
||||
if (mRouteAddresses.empty())
|
||||
setRouteAddress(address);
|
||||
else
|
||||
mRouteAddresses.push_back(sal_address_clone(address));
|
||||
}
|
||||
|
||||
void SalOp::setRealm(const char *realm) {
|
||||
if (mRealm != NULL){
|
||||
ms_free(mRealm);
|
||||
}
|
||||
mRealm = ms_strdup(realm);
|
||||
}
|
||||
|
||||
void SalOp::setSubject (const char *subject) {
|
||||
assignString(&mSubject, subject);
|
||||
}
|
||||
|
||||
void SalOp::setFrom (const char *value) {
|
||||
char *valueStr = nullptr;
|
||||
void SalOp::setFrom (const string &value) {
|
||||
assignAddress(&mFromAddress, value);
|
||||
if (mFromAddress)
|
||||
valueStr = sal_address_as_string(mFromAddress);
|
||||
assignString(&mFrom, valueStr);
|
||||
if (valueStr)
|
||||
if (mFromAddress) {
|
||||
char *valueStr = sal_address_as_string(mFromAddress);
|
||||
mFrom = valueStr;
|
||||
ms_free(valueStr);
|
||||
} else {
|
||||
mFrom.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void SalOp::setFromAddress(const SalAddress *from) {
|
||||
|
|
@ -229,14 +169,15 @@ void SalOp::setFromAddress(const SalAddress *from) {
|
|||
ms_free(address_string);
|
||||
}
|
||||
|
||||
void SalOp::setTo (const char *value) {
|
||||
char *valueStr = nullptr;
|
||||
void SalOp::setTo (const string &value) {
|
||||
assignAddress(&mToAddress, value);
|
||||
if (mToAddress)
|
||||
valueStr = sal_address_as_string(mToAddress);
|
||||
assignString(&mTo, valueStr);
|
||||
if (valueStr)
|
||||
if (mToAddress) {
|
||||
char *valueStr = sal_address_as_string(mToAddress);
|
||||
mTo = valueStr;
|
||||
ms_free(valueStr);
|
||||
} else {
|
||||
mTo.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void SalOp::setToAddress(const SalAddress *to) {
|
||||
|
|
@ -255,7 +196,7 @@ int SalOp::refresh() {
|
|||
belle_sip_refresher_refresh(mRefresher,belle_sip_refresher_get_expires(mRefresher));
|
||||
return 0;
|
||||
}
|
||||
ms_warning("sal_refresh on op [%p] of type [%s] no refresher",this,toString(mType));
|
||||
lWarning() << "No refresher on op [" << this << "] of type [" << toString(mType) << "]";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -278,10 +219,9 @@ void SalOp::release() {
|
|||
unref();
|
||||
}
|
||||
|
||||
int SalOp::sendRequestWithContact(belle_sip_request_t* request, bool_t add_contact) {
|
||||
int SalOp::sendRequestWithContact(belle_sip_request_t* request, bool add_contact) {
|
||||
belle_sip_client_transaction_t* client_transaction;
|
||||
belle_sip_provider_t* prov=mRoot->mProvider;
|
||||
belle_sip_uri_t* outbound_proxy=NULL;
|
||||
belle_sip_header_contact_t* contact;
|
||||
int result =-1;
|
||||
belle_sip_uri_t *next_hop_uri=NULL;
|
||||
|
|
@ -295,17 +235,15 @@ int SalOp::sendRequestWithContact(belle_sip_request_t* request, bool_t add_conta
|
|||
|
||||
if (!mDialog || belle_sip_dialog_get_state(mDialog) == BELLE_SIP_DIALOG_NULL) {
|
||||
/*don't put route header if dialog is in confirmed state*/
|
||||
const MSList *elem=getRouteAddresses();
|
||||
auto routeAddresses = getRouteAddresses();
|
||||
const char *transport;
|
||||
const char *method=belle_sip_request_get_method(request);
|
||||
belle_sip_listening_point_t *udplp=belle_sip_provider_get_listening_point(prov,"UDP");
|
||||
|
||||
if (elem) {
|
||||
outbound_proxy=belle_sip_header_address_get_uri((belle_sip_header_address_t*)elem->data);
|
||||
next_hop_uri=outbound_proxy;
|
||||
}else{
|
||||
next_hop_uri=(belle_sip_uri_t*)belle_sip_object_clone((belle_sip_object_t*)belle_sip_request_get_uri(request));
|
||||
}
|
||||
if (routeAddresses.empty())
|
||||
next_hop_uri = (belle_sip_uri_t*)belle_sip_object_clone((belle_sip_object_t*)belle_sip_request_get_uri(request));
|
||||
else
|
||||
next_hop_uri = belle_sip_header_address_get_uri((belle_sip_header_address_t*)routeAddresses.front());
|
||||
transport=belle_sip_uri_get_transport_param(next_hop_uri);
|
||||
if (transport==NULL){
|
||||
/*compatibility mode: by default it should be udp as not explicitely set and if no udp listening point is available, then use
|
||||
|
|
@ -350,18 +288,19 @@ int SalOp::sendRequestWithContact(belle_sip_request_t* request, bool_t add_conta
|
|||
belle_sip_object_ref(mPendingClientTransaction);
|
||||
|
||||
if (belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request),belle_sip_header_user_agent_t)==NULL)
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_HEADER(mRoot->mUserAgent));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_HEADER(mRoot->mUserAgentHeader));
|
||||
|
||||
if (!belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_AUTHORIZATION)
|
||||
&& !belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_PROXY_AUTHORIZATION)) {
|
||||
/*hmm just in case we already have authentication param in cache*/
|
||||
belle_sip_provider_add_authorization(mRoot->mProvider,request,NULL,NULL,NULL,mRealm);
|
||||
belle_sip_provider_add_authorization(mRoot->mProvider,request,NULL,NULL,NULL,L_STRING_TO_C(mRealm));
|
||||
}
|
||||
result = belle_sip_client_transaction_send_request_to(client_transaction,next_hop_uri/*might be null*/);
|
||||
|
||||
/*update call id if not set yet for this OP*/
|
||||
if (result == 0 && !mCallId) {
|
||||
mCallId=ms_strdup(belle_sip_header_call_id_get_call_id(BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request), belle_sip_header_call_id_t))));
|
||||
if (result == 0 && mCallId.empty()) {
|
||||
mCallId = belle_sip_header_call_id_get_call_id(
|
||||
BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request), belle_sip_header_call_id_t)));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -369,7 +308,7 @@ int SalOp::sendRequestWithContact(belle_sip_request_t* request, bool_t add_conta
|
|||
}
|
||||
|
||||
int SalOp::sendRequest(belle_sip_request_t* request) {
|
||||
bool_t need_contact=FALSE;
|
||||
bool need_contact=FALSE;
|
||||
if (request==NULL) {
|
||||
return -1; /*sanity check*/
|
||||
}
|
||||
|
|
@ -383,7 +322,7 @@ int SalOp::sendRequest(belle_sip_request_t* request) {
|
|||
||strcmp(belle_sip_request_get_method(request),"SUBSCRIBE")==0
|
||||
||strcmp(belle_sip_request_get_method(request),"OPTIONS")==0
|
||||
||strcmp(belle_sip_request_get_method(request),"REFER")==0) /* Despite contact seems not mandatory, call flow example show a Contact in REFER requests*/
|
||||
need_contact=TRUE;
|
||||
need_contact=true;
|
||||
|
||||
return sendRequestWithContact(request,need_contact);
|
||||
}
|
||||
|
|
@ -421,11 +360,7 @@ int SalOp::processRedirect(){
|
|||
setOrUpdateDialog(NULL);
|
||||
belle_sip_message_remove_header_from_ptr((belle_sip_message_t*)request, (belle_sip_header_t*)callid);
|
||||
belle_sip_message_add_header((belle_sip_message_t*)request, (belle_sip_header_t*)(callid = belle_sip_provider_create_call_id(getSal()->mProvider)));
|
||||
if (mCallId){
|
||||
/*reset the call-id of op, it will be set when new request will be sent*/
|
||||
ms_free(mCallId);
|
||||
mCallId = NULL;
|
||||
}
|
||||
mCallId.clear(); // Reset the call-id of op, it will be set when new request will be sent
|
||||
belle_sip_request_set_uri(request, redirect_uri);
|
||||
redirect_uri = BELLE_SIP_URI(belle_sip_object_clone(BELLE_SIP_OBJECT(redirect_uri)));
|
||||
belle_sip_uri_set_port(redirect_uri, 0);
|
||||
|
|
@ -438,7 +373,7 @@ int SalOp::processRedirect(){
|
|||
void SalOp::processAuthentication() {
|
||||
belle_sip_request_t* initial_request=belle_sip_transaction_get_request((belle_sip_transaction_t*)mPendingAuthTransaction);
|
||||
belle_sip_request_t* new_request;
|
||||
bool_t is_within_dialog=FALSE;
|
||||
bool is_within_dialog=false;
|
||||
belle_sip_list_t* auth_list=NULL;
|
||||
belle_sip_auth_event_t* auth_event;
|
||||
belle_sip_response_t *response=belle_sip_transaction_get_response((belle_sip_transaction_t*)mPendingAuthTransaction);
|
||||
|
|
@ -454,7 +389,7 @@ void SalOp::processAuthentication() {
|
|||
new_request = belle_sip_dialog_create_request_from(mDialog,initial_request);
|
||||
if (!new_request)
|
||||
new_request = belle_sip_dialog_create_queued_request_from(mDialog,initial_request);
|
||||
is_within_dialog=TRUE;
|
||||
is_within_dialog=true;
|
||||
} else {
|
||||
new_request=initial_request;
|
||||
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(new_request),BELLE_SIP_AUTHORIZATION);
|
||||
|
|
@ -465,12 +400,11 @@ void SalOp::processAuthentication() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (belle_sip_provider_add_authorization(mRoot->mProvider,new_request,response,from_uri,&auth_list,mRealm)) {
|
||||
if (is_within_dialog) {
|
||||
sendRequest(new_request);
|
||||
} else {
|
||||
resendRequest(new_request);
|
||||
}
|
||||
if (belle_sip_provider_add_authorization(mRoot->mProvider,new_request,response,from_uri,&auth_list,L_STRING_TO_C(mRealm))) {
|
||||
if (is_within_dialog)
|
||||
sendRequest(new_request);
|
||||
else
|
||||
resendRequest(new_request);
|
||||
mRoot->removePendingAuth(this);
|
||||
}else {
|
||||
belle_sip_header_from_t *from=belle_sip_message_get_header_by_type(response,belle_sip_header_from_t);
|
||||
|
|
@ -495,12 +429,12 @@ void SalOp::processAuthentication() {
|
|||
}
|
||||
}
|
||||
|
||||
char *SalOp::getDialogId() const {
|
||||
if (mDialog != NULL) {
|
||||
return ms_strdup_printf("%s;to-tag=%s;from-tag=%s", mCallId,
|
||||
belle_sip_dialog_get_remote_tag(mDialog), belle_sip_dialog_get_local_tag(mDialog));
|
||||
}
|
||||
return NULL;
|
||||
string SalOp::getDialogId () const {
|
||||
if (!mDialog)
|
||||
return string();
|
||||
stringstream ss;
|
||||
ss << mCallId << ";to-tag=" << belle_sip_dialog_get_remote_tag(mDialog) << ";from-tag=" << belle_sip_dialog_get_local_tag(mDialog);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
int SalOp::getAddressFamily() const {
|
||||
|
|
@ -540,52 +474,44 @@ int SalOp::getAddressFamily() const {
|
|||
}
|
||||
}
|
||||
|
||||
bool_t SalOp::isIdle() const {
|
||||
if (mDialog){
|
||||
bool SalOp::isIdle() const {
|
||||
if (mDialog)
|
||||
return !belle_sip_dialog_request_pending(mDialog);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SalOp::setEntityTag(const char* entity_tag) {
|
||||
if (mEntityTag != NULL) ms_free(mEntityTag);
|
||||
mEntityTag = entity_tag ? ms_strdup(entity_tag) : NULL;
|
||||
}
|
||||
|
||||
void SalOp::setEvent(const char *eventname) {
|
||||
belle_sip_header_event_t *header = NULL;
|
||||
if (mEvent) belle_sip_object_unref(mEvent);
|
||||
if (eventname){
|
||||
header = belle_sip_header_event_create(eventname);
|
||||
void SalOp::setEvent (const string &eventName) {
|
||||
belle_sip_header_event_t *header = nullptr;
|
||||
if (mEvent)
|
||||
belle_sip_object_unref(mEvent);
|
||||
if (!eventName.empty()) {
|
||||
header = belle_sip_header_event_create(eventName.c_str());
|
||||
belle_sip_object_ref(header);
|
||||
}
|
||||
mEvent = header;
|
||||
}
|
||||
|
||||
void SalOp::addInitialRouteSet(belle_sip_request_t *request, const MSList *list) {
|
||||
const MSList *elem;
|
||||
for (elem=list;elem!=NULL;elem=elem->next){
|
||||
SalAddress *addr=(SalAddress*)elem->data;
|
||||
belle_sip_header_route_t *route;
|
||||
belle_sip_uri_t *uri;
|
||||
/*Optimization: if the initial route set only contains one URI which is the same as the request URI, ommit it*/
|
||||
if (elem==list && list->next==NULL){
|
||||
belle_sip_uri_t *requri=belle_sip_request_get_uri(request);
|
||||
/*skip the first route it is the same as the request uri*/
|
||||
if (strcmp(sal_address_get_domain(addr),belle_sip_uri_get_host(requri))==0 ){
|
||||
ms_message("Skipping top route of initial route-set because same as request-uri.");
|
||||
void SalOp::addInitialRouteSet (belle_sip_request_t *request, const list<SalAddress *> &routeAddresses) {
|
||||
bool uniqueRoute = routeAddresses.size() == 1;
|
||||
for (const auto &address : routeAddresses) {
|
||||
// Optimization: if the initial route set only contains one URI which is the same as the request URI, ommit it
|
||||
if (uniqueRoute) {
|
||||
belle_sip_uri_t *requestUri = belle_sip_request_get_uri(request);
|
||||
// Skip the first route it is the same as the request uri
|
||||
if (strcmp(sal_address_get_domain(address), belle_sip_uri_get_host(requestUri)) == 0) {
|
||||
ms_message("Skipping top route of initial route-set because same as request-uri");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
route=belle_sip_header_route_create((belle_sip_header_address_t*)addr);
|
||||
uri=belle_sip_header_address_get_uri((belle_sip_header_address_t*)route);
|
||||
belle_sip_uri_set_lr_param(uri,1);
|
||||
belle_sip_message_add_header((belle_sip_message_t*)request,(belle_sip_header_t*)route);
|
||||
belle_sip_header_route_t *route = belle_sip_header_route_create((belle_sip_header_address_t *)address);
|
||||
belle_sip_uri_t *uri = belle_sip_header_address_get_uri((belle_sip_header_address_t *)route);
|
||||
belle_sip_uri_set_lr_param(uri, 1);
|
||||
belle_sip_message_add_header((belle_sip_message_t *)request, (belle_sip_header_t *)route);
|
||||
}
|
||||
}
|
||||
|
||||
belle_sip_request_t* SalOp::buildRequest(const char* method) {
|
||||
belle_sip_request_t* SalOp::buildRequest (const string &method) {
|
||||
belle_sip_header_from_t* from_header;
|
||||
belle_sip_header_to_t* to_header;
|
||||
belle_sip_provider_t* prov=mRoot->mProvider;
|
||||
|
|
@ -595,7 +521,6 @@ belle_sip_request_t* SalOp::buildRequest(const char* method) {
|
|||
belle_sip_header_call_id_t *call_id_header;
|
||||
|
||||
const SalAddress* to_address;
|
||||
const MSList *elem=getRouteAddresses();
|
||||
char token[10];
|
||||
|
||||
/* check that the op has a correct to address */
|
||||
|
|
@ -611,7 +536,7 @@ belle_sip_request_t* SalOp::buildRequest(const char* method) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (strcmp("REGISTER",method)==0 || mPrivacy==SalPrivacyNone) {
|
||||
if ((method == "REGISTER") || (mPrivacy == SalPrivacyNone)) {
|
||||
from_header = belle_sip_header_from_create(BELLE_SIP_HEADER_ADDRESS(getFromAddress())
|
||||
,belle_sip_random_token(token,sizeof(token)));
|
||||
} else {
|
||||
|
|
@ -624,15 +549,14 @@ belle_sip_request_t* SalOp::buildRequest(const char* method) {
|
|||
|
||||
to_header = belle_sip_header_to_create(BELLE_SIP_HEADER_ADDRESS(to_address),NULL);
|
||||
call_id_header = belle_sip_provider_create_call_id(prov);
|
||||
if (getCallId()) {
|
||||
belle_sip_header_call_id_set_call_id(call_id_header, getCallId());
|
||||
}
|
||||
if (!mCallId.empty())
|
||||
belle_sip_header_call_id_set_call_id(call_id_header, mCallId.c_str());
|
||||
|
||||
req=belle_sip_request_create(
|
||||
req_uri,
|
||||
method,
|
||||
method.c_str(),
|
||||
call_id_header,
|
||||
belle_sip_header_cseq_create(20,method),
|
||||
belle_sip_header_cseq_create(20,method.c_str()),
|
||||
from_header,
|
||||
to_header,
|
||||
belle_sip_header_via_new(),
|
||||
|
|
@ -643,11 +567,11 @@ belle_sip_request_t* SalOp::buildRequest(const char* method) {
|
|||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(p_preferred_identity));
|
||||
}
|
||||
|
||||
if (elem && strcmp(method,"REGISTER")!=0 && !mRoot->mNoInitialRoute){
|
||||
addInitialRouteSet(req,elem);
|
||||
}
|
||||
auto routeAddresses = getRouteAddresses();
|
||||
if (!routeAddresses.empty() && (method != "REGISTER") && !mRoot->mNoInitialRoute)
|
||||
addInitialRouteSet(req, routeAddresses);
|
||||
|
||||
if (strcmp("REGISTER",method)!=0 && mPrivacy!=SalPrivacyNone ){
|
||||
if ((method != "REGISTER") && (mPrivacy != SalPrivacyNone)) {
|
||||
belle_sip_header_privacy_t* privacy_header=belle_sip_header_privacy_new();
|
||||
if (mPrivacy&SalPrivacyCritical)
|
||||
belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacyCritical));
|
||||
|
|
@ -663,7 +587,7 @@ belle_sip_request_t* SalOp::buildRequest(const char* method) {
|
|||
belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacyUser));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(privacy_header));
|
||||
}
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),mRoot->mSupported);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),mRoot->mSupportedHeader);
|
||||
return req;
|
||||
}
|
||||
|
||||
|
|
@ -679,14 +603,18 @@ void SalOp::setErrorInfoFromResponse(belle_sip_response_t *response) {
|
|||
setReasonErrorInfo(BELLE_SIP_MESSAGE(response));
|
||||
}
|
||||
|
||||
const char* SalOp::toString(const State value) {
|
||||
switch(value) {
|
||||
case State::Early: return"SalOpStateEarly";
|
||||
case State::Active: return "SalOpStateActive";
|
||||
case State::Terminating: return "SalOpStateTerminating";
|
||||
case State::Terminated: return "SalOpStateTerminated";
|
||||
default:
|
||||
return "Unknown";
|
||||
string SalOp::toString (const State value) {
|
||||
switch (value) {
|
||||
case State::Early:
|
||||
return"SalOpStateEarly";
|
||||
case State::Active:
|
||||
return "SalOpStateActive";
|
||||
case State::Terminating:
|
||||
return "SalOpStateTerminating";
|
||||
case State::Terminated:
|
||||
return "SalOpStateTerminated";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -745,7 +673,7 @@ int SalOp::sendRequestAndCreateRefresher(belle_sip_request_t* req, int expires,b
|
|||
notify the user as a normal transaction*/
|
||||
belle_sip_refresher_set_listener(mRefresher,listener, this);
|
||||
belle_sip_refresher_set_retry_after(mRefresher,mRoot->mRefresherRetryAfter);
|
||||
belle_sip_refresher_set_realm(mRefresher,mRealm);
|
||||
belle_sip_refresher_set_realm(mRefresher,L_STRING_TO_C(mRealm));
|
||||
belle_sip_refresher_enable_manual_mode(mRefresher, mManualRefresher);
|
||||
return 0;
|
||||
} else {
|
||||
|
|
@ -779,18 +707,19 @@ belle_sip_header_contact_t *SalOp::createContact() {
|
|||
/*don't touch contact in case of gruu*/
|
||||
if (!belle_sip_parameters_has_parameter(BELLE_SIP_PARAMETERS(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(contact_header))),"gr")) {
|
||||
belle_sip_header_contact_set_automatic(contact_header,mRoot->mAutoContacts);
|
||||
if (mRoot->mUuid) {
|
||||
if (belle_sip_parameters_has_parameter(BELLE_SIP_PARAMETERS(contact_header),"+sip.instance")==0){
|
||||
char *instance_id=belle_sip_strdup_printf("\"<urn:uuid:%s>\"",mRoot->mUuid);
|
||||
belle_sip_parameters_set_parameter(BELLE_SIP_PARAMETERS(contact_header),"+sip.instance",instance_id);
|
||||
belle_sip_free(instance_id);
|
||||
}
|
||||
if (!mRoot->mUuid.empty()
|
||||
&& !belle_sip_parameters_has_parameter(BELLE_SIP_PARAMETERS(contact_header), "+sip.instance")
|
||||
) {
|
||||
stringstream ss;
|
||||
ss << "\"<urn:uuid:" << mRoot->mUuid << ">\"";
|
||||
string instanceId = ss.str();
|
||||
belle_sip_parameters_set_parameter(BELLE_SIP_PARAMETERS(contact_header), "+sip.instance", instanceId.c_str());
|
||||
}
|
||||
}
|
||||
if (mRoot->mLinphoneSpecs && strlen(mRoot->mLinphoneSpecs) > 0) {
|
||||
if (belle_sip_parameters_has_parameter(BELLE_SIP_PARAMETERS(contact_header),"+org.linphone.specs") == 0) {
|
||||
belle_sip_parameters_set_parameter(BELLE_SIP_PARAMETERS(contact_header), "+org.linphone.specs", mRoot->mLinphoneSpecs);
|
||||
}
|
||||
if (!mRoot->mLinphoneSpecs.empty()
|
||||
&& !belle_sip_parameters_has_parameter(BELLE_SIP_PARAMETERS(contact_header), "+org.linphone.specs")
|
||||
) {
|
||||
belle_sip_parameters_set_parameter(BELLE_SIP_PARAMETERS(contact_header), "+org.linphone.specs", mRoot->mLinphoneSpecs.c_str());
|
||||
}
|
||||
return contact_header;
|
||||
}
|
||||
|
|
@ -824,21 +753,20 @@ void SalOp::setOrUpdateDialog(belle_sip_dialog_t* dialog) {
|
|||
unref();
|
||||
}
|
||||
|
||||
int SalOp::ping(const char *from, const char *to) {
|
||||
setFrom(from);
|
||||
setTo(to);
|
||||
int SalOp::ping (const string &from, const string &to) {
|
||||
setFrom(from);
|
||||
setTo(to);
|
||||
return sendRequest(buildRequest("OPTIONS"));
|
||||
}
|
||||
|
||||
int SalOp::sendInfo(const char *from, const char *to, const SalBodyHandler *body_handler) {
|
||||
if (mDialog && belle_sip_dialog_get_state(mDialog) == BELLE_SIP_DIALOG_CONFIRMED) {
|
||||
belle_sip_request_t *req;
|
||||
belle_sip_dialog_enable_pending_trans_checking(mDialog,mRoot->mPendingTransactionChecking);
|
||||
req=belle_sip_dialog_create_queued_request(mDialog,"INFO");
|
||||
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(req), BELLE_SIP_BODY_HANDLER(body_handler));
|
||||
return sendRequest(req);
|
||||
}else{
|
||||
ms_error("Cannot send INFO message on op [%p] because dialog is not in confirmed state yet.", this);
|
||||
int SalOp::sendInfo (const SalBodyHandler *bodyHandler) {
|
||||
if (mDialog && (belle_sip_dialog_get_state(mDialog) == BELLE_SIP_DIALOG_CONFIRMED)) {
|
||||
belle_sip_dialog_enable_pending_trans_checking(mDialog, mRoot->mPendingTransactionChecking);
|
||||
belle_sip_request_t *request = belle_sip_dialog_create_queued_request(mDialog, "INFO");
|
||||
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(request), BELLE_SIP_BODY_HANDLER(bodyHandler));
|
||||
return sendRequest(request);
|
||||
} else {
|
||||
lError() << "Cannot send INFO message on op [" << this << "] because dialog is not in confirmed state yet";
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -867,26 +795,26 @@ void SalOp::assignRecvHeaders(belle_sip_message_t *incoming) {
|
|||
}
|
||||
}
|
||||
|
||||
void SalOp::setRemoteContact(const char* remote_contact) {
|
||||
assignAddress(&mRemoteContactAddress,remote_contact);
|
||||
/*to preserve header params*/
|
||||
assignString(&mRemoteContact,remote_contact);
|
||||
void SalOp::setRemoteContact (const string &value) {
|
||||
assignAddress(&mRemoteContactAddress, value);
|
||||
mRemoteContact = value; // To preserve header params
|
||||
}
|
||||
|
||||
void SalOp::setNetworkOrigin (const char *value) {
|
||||
char *valueStr = nullptr;
|
||||
void SalOp::setNetworkOrigin (const string &value) {
|
||||
assignAddress(&mOriginAddress, value);
|
||||
if (mOriginAddress)
|
||||
valueStr = sal_address_as_string(mOriginAddress);
|
||||
assignString(&mOrigin, valueStr);
|
||||
if (valueStr)
|
||||
if (mOriginAddress) {
|
||||
char *valueStr = sal_address_as_string(mOriginAddress);
|
||||
mOrigin = valueStr;
|
||||
ms_free(valueStr);
|
||||
} else {
|
||||
mOrigin.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void SalOp::setNetworkOriginAddress(SalAddress *origin){
|
||||
char* address_string=sal_address_as_string(origin); /*can probably be optimized*/
|
||||
setNetworkOrigin(address_string);
|
||||
ms_free(address_string);
|
||||
void SalOp::setNetworkOriginAddress (SalAddress *value) {
|
||||
char *valueStr = sal_address_as_string(value); // Can probably be optimized
|
||||
setNetworkOrigin(valueStr);
|
||||
ms_free(valueStr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -924,28 +852,32 @@ void SalOp::setPrivacyFromMessage(belle_sip_message_t* msg) {
|
|||
}
|
||||
}
|
||||
|
||||
void SalOp::setRemoteUserAgent(belle_sip_message_t* message) {
|
||||
belle_sip_header_user_agent_t* user_agent=belle_sip_message_get_header_by_type(message,belle_sip_header_user_agent_t);
|
||||
char user_agent_string[256];
|
||||
if (user_agent && belle_sip_header_user_agent_get_products_as_string(user_agent,user_agent_string,sizeof(user_agent_string))>0) {
|
||||
if (mRemoteUserAgent!=NULL){
|
||||
ms_free(mRemoteUserAgent);
|
||||
}
|
||||
mRemoteUserAgent=ms_strdup(user_agent_string);
|
||||
void SalOp::setRemoteUserAgent (belle_sip_message_t *message) {
|
||||
belle_sip_header_user_agent_t *userAgentHeader = belle_sip_message_get_header_by_type(message, belle_sip_header_user_agent_t);
|
||||
char userAgentStr[256];
|
||||
if (userAgentHeader
|
||||
&& belle_sip_header_user_agent_get_products_as_string(userAgentHeader, userAgentStr, sizeof(userAgentStr)) > 0
|
||||
) {
|
||||
mRemoteUserAgent = userAgentStr;
|
||||
}
|
||||
}
|
||||
|
||||
const char *SalOp::toString(const Type type) {
|
||||
switch(type) {
|
||||
case Type::Register: return "SalOpRegister";
|
||||
case Type::Call: return "SalOpCall";
|
||||
case Type::Message: return "SalOpMessage";
|
||||
case Type::Presence: return "SalOpPresence";
|
||||
default: return "SalOpUnknown";
|
||||
string SalOp::toString (const Type type) {
|
||||
switch (type) {
|
||||
case Type::Register:
|
||||
return "SalOpRegister";
|
||||
case Type::Call:
|
||||
return "SalOpCall";
|
||||
case Type::Message:
|
||||
return "SalOpMessage";
|
||||
case Type::Presence:
|
||||
return "SalOpPresence";
|
||||
default:
|
||||
return "SalOpUnknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool_t SalOp::isSecure() const {
|
||||
bool SalOp::isSecure() const {
|
||||
const SalAddress* from = getFromAddress();
|
||||
const SalAddress* to = getToAddress();
|
||||
return from && to && strcasecmp("sips",sal_address_get_scheme(from))==0 && strcasecmp("sips",sal_address_get_scheme(to))==0;
|
||||
|
|
@ -1013,7 +945,7 @@ void SalOp::processIncomingMessage(const belle_sip_request_event_t *event) {
|
|||
belle_sip_header_cseq_t* cseq = belle_sip_message_get_header_by_type(req,belle_sip_header_cseq_t);
|
||||
belle_sip_header_date_t *date=belle_sip_message_get_header_by_type(req,belle_sip_header_date_t);
|
||||
char* from;
|
||||
bool_t external_body=FALSE;
|
||||
bool external_body = false;
|
||||
|
||||
from_header=belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_from_t);
|
||||
content_type=belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_content_type_t);
|
||||
|
|
@ -1067,7 +999,7 @@ void SalOp::processIncomingMessage(const belle_sip_request_event_t *event) {
|
|||
}
|
||||
}
|
||||
|
||||
bool_t SalOp::isExternalBody(belle_sip_header_content_type_t* content_type) {
|
||||
bool SalOp::isExternalBody(belle_sip_header_content_type_t* content_type) {
|
||||
return strcmp("message",belle_sip_header_content_type_get_type(content_type))==0
|
||||
&& strcmp("external-body",belle_sip_header_content_type_get_subtype(content_type))==0;
|
||||
}
|
||||
|
|
@ -1083,21 +1015,13 @@ int SalOp::replyMessage(SalReason reason) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
void SalOp::addMessageAccept(belle_sip_message_t *msg) {
|
||||
bctbx_list_t *item;
|
||||
const char *str;
|
||||
char *old;
|
||||
char *header = ms_strdup("xml/cipher, application/cipher.vnd.gsma.rcs-ft-http+xml");
|
||||
|
||||
for (item = mRoot->mSupportedContentTypes; item != NULL; item = bctbx_list_next(item)) {
|
||||
str = (const char *)bctbx_list_get_data(item);
|
||||
old = header;
|
||||
header = ms_strdup_printf("%s, %s", old, str);
|
||||
ms_free(old);
|
||||
}
|
||||
|
||||
belle_sip_message_add_header(msg, belle_sip_header_create("Accept", header));
|
||||
ms_free(header);
|
||||
void SalOp::addMessageAccept (belle_sip_message_t *message) {
|
||||
stringstream ss;
|
||||
ss << "xml/cipher, application/cipher.vnd.gsma.rcs-ft-http+xml";
|
||||
for (const auto &supportedContentType : mRoot->mSupportedContentTypes)
|
||||
ss << ", " << supportedContentType;
|
||||
string headerValue = ss.str();
|
||||
belle_sip_message_add_header(message, belle_sip_header_create("Accept", headerValue.c_str()));
|
||||
}
|
||||
|
||||
void SalOp::setServiceRoute(const SalAddress* service_route) {
|
||||
|
|
|
|||
111
src/sal/op.h
111
src/sal/op.h
|
|
@ -44,25 +44,25 @@ public:
|
|||
void setUserPointer (void *value) { mUserPointer = value; }
|
||||
void *getUserPointer () const { return mUserPointer; }
|
||||
|
||||
void setSubject (const char *value);
|
||||
const char *getSubject () const { return mSubject; }
|
||||
void setSubject (const std::string &value) { mSubject = value; }
|
||||
const std::string &getSubject () const { return mSubject; }
|
||||
|
||||
void setFrom (const char *value);
|
||||
void setFrom (const std::string &value);
|
||||
void setFromAddress (const SalAddress *value);
|
||||
const char *getFrom () const { return mFrom; }
|
||||
const std::string &getFrom () const { return mFrom; }
|
||||
const SalAddress *getFromAddress () const { return mFromAddress; }
|
||||
|
||||
void setTo (const char *value);
|
||||
void setTo (const std::string &value);
|
||||
void setToAddress (const SalAddress *value);
|
||||
const char *getTo () const { return mTo; }
|
||||
const std::string &getTo () const { return mTo; }
|
||||
const SalAddress *getToAddress () const { return mToAddress; }
|
||||
|
||||
void setContactAddress (const SalAddress* value);
|
||||
const SalAddress *getContactAddress() const { return mContactAddress; }
|
||||
|
||||
void setRoute (const char *value);
|
||||
void setRoute (const std::string &value);
|
||||
void setRouteAddress (const SalAddress *value);
|
||||
const bctbx_list_t *getRouteAddresses () const { return mRouteAddresses; }
|
||||
const std::list<SalAddress *> &getRouteAddresses () const { return mRouteAddresses; }
|
||||
void addRouteAddress (const SalAddress *address);
|
||||
|
||||
void setDiversionAddress (const SalAddress *value);
|
||||
|
|
@ -71,32 +71,32 @@ public:
|
|||
void setServiceRoute (const SalAddress *value);
|
||||
const SalAddress *getServiceRoute () const { return mServiceRoute; }
|
||||
|
||||
void setManualRefresherMode (bool_t value) { mManualRefresher = value; }
|
||||
void setManualRefresherMode (bool value) { mManualRefresher = value; }
|
||||
|
||||
void setEntityTag (const char *value);
|
||||
const char *getEntityTag() const { return mEntityTag; }
|
||||
void setEntityTag (const std::string &value) { mEntityTag = value; }
|
||||
const std::string &getEntityTag() const { return mEntityTag; }
|
||||
|
||||
void setEvent (const char *eventName);
|
||||
void setEvent (const std::string &eventName);
|
||||
|
||||
void setPrivacy (SalPrivacyMask value) { mPrivacy = value; }
|
||||
SalPrivacyMask getPrivacy() const { return mPrivacy; }
|
||||
|
||||
void setRealm (const char *value);
|
||||
void setRealm (const std::string &value) { mRealm = value; }
|
||||
|
||||
void setSentCustomHeaders (SalCustomHeader *ch);
|
||||
|
||||
void enableCnxIpTo0000IfSendOnly (bool_t value) { mCnxIpTo0000IfSendOnlyEnabled = value; }
|
||||
bool_t cnxIpTo0000IfSendOnlyEnabled () const { return mCnxIpTo0000IfSendOnlyEnabled; }
|
||||
void enableCnxIpTo0000IfSendOnly (bool value) { mCnxIpTo0000IfSendOnlyEnabled = value; }
|
||||
bool cnxIpTo0000IfSendOnlyEnabled () const { return mCnxIpTo0000IfSendOnlyEnabled; }
|
||||
|
||||
const char *getProxy () const { return mRoute; }
|
||||
const char *getNetworkOrigin () const { return mOrigin; }
|
||||
const char *getCallId () const { return mCallId; }
|
||||
char *getDialogId () const;
|
||||
const std::string &getProxy () const { return mRoute; }
|
||||
const std::string &getNetworkOrigin () const { return mOrigin; }
|
||||
const std::string &getCallId () const { return mCallId; }
|
||||
std::string getDialogId () const;
|
||||
int getAddressFamily () const;
|
||||
const SalCustomHeader *getRecvCustomHeaders () const { return mRecvCustomHeaders; }
|
||||
const char *getRemoteContact () const { return mRemoteContact; }
|
||||
const std::string &getRemoteContact () const { return mRemoteContact; }
|
||||
const SalAddress *getRemoteContactAddress () const { return mRemoteContactAddress; }
|
||||
const char *getRemoteUserAgent () const { return mRemoteUserAgent; }
|
||||
const std::string &getRemoteUserAgent () const { return mRemoteUserAgent; }
|
||||
|
||||
const char *getPublicAddress (int *port) {
|
||||
return mRefresher ? belle_sip_refresher_get_public_address(mRefresher, port) : nullptr;
|
||||
|
|
@ -108,10 +108,10 @@ public:
|
|||
const SalErrorInfo *getErrorInfo () const { return &mErrorInfo; }
|
||||
const SalErrorInfo *getReasonErrorInfo () const { return &mReasonErrorInfo; }
|
||||
|
||||
bool_t isForkedOf (const SalOp *op) const {
|
||||
return mCallId && op->mCallId && strcmp(mCallId, op->mCallId) == 0;
|
||||
bool isForkedOf (const SalOp *op) const {
|
||||
return !mCallId.empty() && !op->mCallId.empty() && (mCallId == op->mCallId);
|
||||
}
|
||||
bool_t isIdle () const;
|
||||
bool isIdle () const;
|
||||
|
||||
void stopRefreshing () {
|
||||
if (mRefresher)
|
||||
|
|
@ -126,8 +126,8 @@ public:
|
|||
void cancelAuthentication () { lFatal() << "SalOp::cancelAuthentication not implemented yet"; }
|
||||
SalAuthInfo *getAuthRequested () { return mAuthInfo; }
|
||||
|
||||
int ping (const char *from, const char *to);
|
||||
int sendInfo (const char *from, const char *to, const SalBodyHandler *bodyHandler);
|
||||
int ping (const std::string &from, const std::string &to);
|
||||
int sendInfo (const SalBodyHandler *bodyHandler);
|
||||
|
||||
protected:
|
||||
enum class State {
|
||||
|
|
@ -137,7 +137,7 @@ protected:
|
|||
Terminated
|
||||
};
|
||||
|
||||
static const char *toString (const State value);
|
||||
static std::string toString (const State value);
|
||||
|
||||
enum class Dir {
|
||||
Incoming = 0,
|
||||
|
|
@ -155,7 +155,7 @@ protected:
|
|||
Refer // For out of dialog refer only
|
||||
};
|
||||
|
||||
static const char *toString (const Type type);
|
||||
static std::string toString (const Type type);
|
||||
|
||||
using ReleaseCb = void (*) (SalOp *op);
|
||||
|
||||
|
|
@ -164,9 +164,9 @@ protected:
|
|||
void processAuthentication ();
|
||||
int processRedirect ();
|
||||
|
||||
belle_sip_request_t *buildRequest (const char *method);
|
||||
belle_sip_request_t *buildRequest (const std::string &method);
|
||||
int sendRequest (belle_sip_request_t *request);
|
||||
int sendRequestWithContact (belle_sip_request_t *request, bool_t addContact);
|
||||
int sendRequestWithContact (belle_sip_request_t *request, bool addContact);
|
||||
int sendRequestWithExpires (belle_sip_request_t *request, int expires);
|
||||
void resendRequest (belle_sip_request_t *request);
|
||||
int sendRequestAndCreateRefresher (belle_sip_request_t *request, int expires, belle_sip_refresher_listener_t listener);
|
||||
|
|
@ -177,8 +177,8 @@ protected:
|
|||
void setReferredBy (belle_sip_header_referred_by_t *referredByHeader);
|
||||
void setReplaces (belle_sip_header_replaces_t *replacesHeader);
|
||||
|
||||
void setRemoteContact (const char *value);
|
||||
void setNetworkOrigin (const char *value);
|
||||
void setRemoteContact (const std::string &value);
|
||||
void setNetworkOrigin (const std::string &value);
|
||||
void setNetworkOriginAddress (SalAddress *value);
|
||||
void setPrivacyFromMessage (belle_sip_message_t *message);
|
||||
void setRemoteUserAgent (belle_sip_message_t *message);
|
||||
|
|
@ -196,7 +196,7 @@ protected:
|
|||
|
||||
void assignRecvHeaders (belle_sip_message_t *message);
|
||||
|
||||
bool_t isSecure () const;
|
||||
bool isSecure () const;
|
||||
void addHeaders (belle_sip_header_t *h, belle_sip_message_t *message);
|
||||
void addCustomHeaders (belle_sip_message_t *message);
|
||||
int unsubscribe ();
|
||||
|
|
@ -205,35 +205,34 @@ protected:
|
|||
int replyMessage (SalReason reason);
|
||||
void addMessageAccept (belle_sip_message_t *message);
|
||||
|
||||
static bool_t isExternalBody (belle_sip_header_content_type_t* contentType);
|
||||
static bool isExternalBody (belle_sip_header_content_type_t* contentType);
|
||||
|
||||
static void assignAddress (SalAddress **address, const char *value);
|
||||
static void assignString (char **str, const char *arg);
|
||||
static void addInitialRouteSet (belle_sip_request_t *request, const MSList *list);
|
||||
static void assignAddress (SalAddress **address, const std::string &value);
|
||||
static void addInitialRouteSet (belle_sip_request_t *request, const std::list<SalAddress *> &routeAddresses);
|
||||
|
||||
// SalOpBase
|
||||
Sal *mRoot = nullptr;
|
||||
char *mRoute = nullptr; // Or request-uri for REGISTER
|
||||
MSList *mRouteAddresses = nullptr; // List of SalAddress *
|
||||
std::string mRoute; // Or request-uri for REGISTER
|
||||
std::list<SalAddress *> mRouteAddresses;
|
||||
SalAddress *mContactAddress = nullptr;
|
||||
char *mSubject = nullptr;
|
||||
char *mFrom = nullptr;
|
||||
std::string mSubject;
|
||||
std::string mFrom;
|
||||
SalAddress* mFromAddress = nullptr;
|
||||
char *mTo = nullptr;
|
||||
std::string mTo;
|
||||
SalAddress *mToAddress = nullptr;
|
||||
char *mOrigin = nullptr;
|
||||
std::string mOrigin;
|
||||
SalAddress *mOriginAddress = nullptr;
|
||||
SalAddress *mDiversionAddress = nullptr;
|
||||
char *mRemoteUserAgent = nullptr;
|
||||
std::string mRemoteUserAgent;
|
||||
SalAddress *mRemoteContactAddress = nullptr;
|
||||
char *mRemoteContact = nullptr;
|
||||
std::string mRemoteContact;
|
||||
void *mUserPointer = nullptr;
|
||||
char *mCallId = nullptr;
|
||||
char *mRealm = nullptr;
|
||||
std::string mCallId;
|
||||
std::string mRealm;
|
||||
SalAddress *mServiceRoute = nullptr; // As defined by rfc3608, might be a list
|
||||
SalCustomHeader *mSentCustomHeaders = nullptr;
|
||||
SalCustomHeader *mRecvCustomHeaders = nullptr;
|
||||
char *mEntityTag = nullptr; // As defined by rfc3903 (I.E publih)
|
||||
std::string mEntityTag; // As defined by rfc3903 (I.E publih)
|
||||
ReleaseCb mReleaseCb = nullptr;
|
||||
|
||||
const belle_sip_listener_callbacks_t *mCallbacks = nullptr;
|
||||
|
|
@ -258,14 +257,14 @@ protected:
|
|||
belle_sip_header_event_t *mEvent = nullptr; // Used by SalOpSubscribe kinds
|
||||
SalOpSDPHandling mSdpHandling = SalOpSDPNormal;
|
||||
int mAuthRequests = 0; // number of auth requested for this op
|
||||
bool_t mCnxIpTo0000IfSendOnlyEnabled = FALSE;
|
||||
bool_t mAutoAnswerAsked = FALSE;
|
||||
bool_t mSdpOffering = FALSE;
|
||||
bool_t mCallReleased = FALSE;
|
||||
bool_t mManualRefresher = FALSE;
|
||||
bool_t mHasAuthPending = FALSE;
|
||||
bool_t mSupportsSessionTimers = FALSE;
|
||||
bool_t mOpReleased = FALSE;
|
||||
bool mCnxIpTo0000IfSendOnlyEnabled = false;
|
||||
bool mAutoAnswerAsked = false;
|
||||
bool mSdpOffering = false;
|
||||
bool mCallReleased = false;
|
||||
bool mManualRefresher = false;
|
||||
bool mHasAuthPending = false;
|
||||
bool mSupportsSessionTimers = false;
|
||||
bool mOpReleased = false;
|
||||
|
||||
friend class Sal;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "c-wrapper/internal/c-tools.h"
|
||||
#include "sal/presence-op.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -42,7 +43,7 @@ void SalPresenceOp::presenceProcessIoErrorCb(void *user_ctx, const belle_sip_io_
|
|||
ms_warning("presence_process_io_error() refresher is present, should not happen");
|
||||
return;
|
||||
}
|
||||
ms_message("subscription to [%s] io error",op->getTo());
|
||||
ms_message("subscription to [%s] io error",op->getTo().c_str());
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
}
|
||||
|
|
@ -90,7 +91,7 @@ void SalPresenceOp::presenceResponseEventCb(void *op_base, const belle_sip_respo
|
|||
|
||||
if (code>=300) {
|
||||
if (strcmp("SUBSCRIBE",belle_sip_request_get_method(request))==0){
|
||||
ms_message("subscription to [%s] rejected",op->getTo());
|
||||
ms_message("subscription to [%s] rejected",op->getTo().c_str());
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
}
|
||||
|
|
@ -121,7 +122,7 @@ void SalPresenceOp::presenceResponseEventCb(void *op_base, const belle_sip_respo
|
|||
if ((expires != NULL) && (belle_sip_header_expires_get_expires(expires) > 0)) {
|
||||
op->mRefresher=belle_sip_client_transaction_create_refresher(client_transaction);
|
||||
belle_sip_refresher_set_listener(op->mRefresher,presenceRefresherListenerCb,op);
|
||||
belle_sip_refresher_set_realm(op->mRefresher,op->mRealm);
|
||||
belle_sip_refresher_set_realm(op->mRefresher,L_STRING_TO_C(op->mRealm));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -143,7 +144,7 @@ void SalPresenceOp::presenceProcessTimeoutCb(void *user_ctx, const belle_sip_tim
|
|||
request = belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(client_transaction));
|
||||
|
||||
if (strcmp("SUBSCRIBE",belle_sip_request_get_method(request))==0){
|
||||
ms_message("subscription to [%s] timeout",op->getTo());
|
||||
ms_message("subscription to [%s] timeout",op->getTo().c_str());
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
}
|
||||
|
|
@ -192,7 +193,7 @@ void SalPresenceOp::handleNotify(belle_sip_request_t *req, belle_sip_dialog_t *d
|
|||
}
|
||||
if (!subscription_state_header || strcasecmp(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,belle_sip_header_subscription_state_get_state(subscription_state_header)) ==0) {
|
||||
sub_state=SalSubscribeTerminated;
|
||||
ms_message("Outgoing subscription terminated by remote [%s]",getTo());
|
||||
ms_message("Outgoing subscription terminated by remote [%s]",getTo().c_str());
|
||||
} else {
|
||||
sub_state=getSubscriptionState(BELLE_SIP_MESSAGE(req));
|
||||
}
|
||||
|
|
@ -249,7 +250,7 @@ void SalPresenceOp::presenceProcessRequestEventCb(void *op_base, const belle_sip
|
|||
return;
|
||||
}
|
||||
op->setOrUpdateDialog(dialog);
|
||||
ms_message("new incoming subscription from [%s] to [%s]",op->getFrom(),op->getTo());
|
||||
ms_message("new incoming subscription from [%s] to [%s]",op->getFrom().c_str(),op->getTo().c_str());
|
||||
}else if (strcmp(method,"NOTIFY")==0 && belle_sip_request_event_get_dialog(event)) {
|
||||
/*special case of dialog created by notify matching subscribe*/
|
||||
op->setOrUpdateDialog(belle_sip_request_event_get_dialog(event));
|
||||
|
|
@ -265,7 +266,7 @@ void SalPresenceOp::presenceProcessRequestEventCb(void *op_base, const belle_sip
|
|||
if (strcmp("NOTIFY",method)==0) {
|
||||
op->handleNotify(req, belle_sip_request_event_get_dialog(event));
|
||||
} else if (strcmp("SUBSCRIBE",method)==0) {
|
||||
op->mRoot->mCallbacks.subscribe_presence_received(op,op->getFrom());
|
||||
op->mRoot->mCallbacks.subscribe_presence_received(op,op->getFrom().c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -293,9 +294,9 @@ void SalPresenceOp::presenceProcessRequestEventCb(void *op_base, const belle_sip
|
|||
void SalPresenceOp::presenceProcessDialogTerminatedCb(void *ctx, const belle_sip_dialog_terminated_event_t *event) {
|
||||
SalPresenceOp * op= (SalPresenceOp *)ctx;
|
||||
if (op->mDialog && belle_sip_dialog_is_server(op->mDialog)) {
|
||||
ms_message("Incoming subscribtion from [%s] terminated",op->getFrom());
|
||||
ms_message("Incoming subscribtion from [%s] terminated",op->getFrom().c_str());
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.subscribe_presence_closed(op, op->getFrom());
|
||||
op->mRoot->mCallbacks.subscribe_presence_closed(op, op->getFrom().c_str());
|
||||
}
|
||||
op->setOrUpdateDialog(NULL);
|
||||
}/* else client dialog is managed by refresher*/
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ int SalRegisterOp::sendRegister(const char *proxy, const char *from, int expires
|
|||
void SalRegisterOp::registerRefresherListener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry) {
|
||||
SalRegisterOp * op = (SalRegisterOp *)user_pointer;
|
||||
belle_sip_response_t* response=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher)));
|
||||
ms_message("Register refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase,op->getProxy());
|
||||
ms_message("Register refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase,op->getProxy().c_str());
|
||||
|
||||
if (belle_sip_refresher_get_auth_events(refresher)) {
|
||||
if (op->mAuthInfo) sal_auth_info_delete(op->mAuthInfo);
|
||||
|
|
|
|||
338
src/sal/sal.cpp
338
src/sal/sal.cpp
|
|
@ -17,6 +17,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "sal/sal.h"
|
||||
#include "sal/call-op.h"
|
||||
#include "sal/presence-op.h"
|
||||
|
|
@ -27,6 +29,8 @@
|
|||
#include "tester_utils.h"
|
||||
#include "private.h"
|
||||
|
||||
#include "c-wrapper/internal/c-tools.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
|
@ -205,19 +209,21 @@ void Sal::processRequestEventCb (void *ud, const belle_sip_request_event_t *even
|
|||
}
|
||||
}
|
||||
|
||||
if (!op->mOrigin) {
|
||||
if (op->mOrigin.empty()) {
|
||||
/*set origin uri*/
|
||||
origin_address=belle_sip_header_address_create(NULL,belle_sip_request_extract_origin(req));
|
||||
op->setNetworkOriginAddress((SalAddress*)origin_address);
|
||||
belle_sip_object_unref(origin_address);
|
||||
}
|
||||
if (!op->mRemoteUserAgent) {
|
||||
if (op->mRemoteUserAgent.empty())
|
||||
op->setRemoteUserAgent(BELLE_SIP_MESSAGE(req));
|
||||
|
||||
if (op->mCallId.empty()) {
|
||||
op->mCallId = belle_sip_header_call_id_get_call_id(
|
||||
BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req), belle_sip_header_call_id_t))
|
||||
);
|
||||
}
|
||||
|
||||
if (!op->mCallId) {
|
||||
op->mCallId=ms_strdup(belle_sip_header_call_id_get_call_id(BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req), belle_sip_header_call_id_t))));
|
||||
}
|
||||
/*It is worth noting that proxies can (and will) remove this header field*/
|
||||
op->setPrivacyFromMessage((belle_sip_message_t*)req);
|
||||
|
||||
|
|
@ -258,8 +264,10 @@ void Sal::processResponseEventCb(void *user_ctx, const belle_sip_response_event_
|
|||
op->setRemoteContact(belle_sip_header_get_unparsed_value(BELLE_SIP_HEADER(remote_contact)));
|
||||
}
|
||||
|
||||
if (!op->mCallId) {
|
||||
op->mCallId=ms_strdup(belle_sip_header_call_id_get_call_id(BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(response), belle_sip_header_call_id_t))));
|
||||
if (op->mCallId.empty()) {
|
||||
op->mCallId = belle_sip_header_call_id_get_call_id(
|
||||
BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(response), belle_sip_header_call_id_t))
|
||||
);
|
||||
}
|
||||
|
||||
op->assignRecvHeaders((belle_sip_message_t*)response);
|
||||
|
|
@ -280,8 +288,8 @@ void Sal::processResponseEventCb(void *user_ctx, const belle_sip_response_event_
|
|||
op->mPendingAuthTransaction=NULL;
|
||||
}
|
||||
if (++op->mAuthRequests > 2) {
|
||||
ms_warning("Auth info cannot be found for op [%s/%s] after 2 attempts, giving up",op->getFrom()
|
||||
,op->getTo());
|
||||
ms_warning("Auth info cannot be found for op [%s/%s] after 2 attempts, giving up",op->getFrom().c_str()
|
||||
,op->getTo().c_str());
|
||||
op->mRoot->mCallbacks.auth_failure(op,op->mAuthInfo);
|
||||
op->mRoot->removePendingAuth(op);
|
||||
} else {
|
||||
|
|
@ -363,14 +371,14 @@ Sal::Sal(MSFactory *factory){
|
|||
/*first create the stack, which initializes the belle-sip object's pool for this thread*/
|
||||
mStack = belle_sip_stack_new(NULL);
|
||||
|
||||
mUserAgent=belle_sip_header_user_agent_new();
|
||||
mUserAgentHeader=belle_sip_header_user_agent_new();
|
||||
#if defined(PACKAGE_NAME) && defined(LIBLINPHONE_VERSION)
|
||||
belle_sip_header_user_agent_add_product(user_agent, PACKAGE_NAME "/" LIBLINPHONE_VERSION);
|
||||
#else
|
||||
belle_sip_header_user_agent_add_product(mUserAgent, "Unknown");
|
||||
belle_sip_header_user_agent_add_product(mUserAgentHeader, "Unknown");
|
||||
#endif
|
||||
appendStackStringToUserAgent();
|
||||
belle_sip_object_ref(mUserAgent);
|
||||
belle_sip_object_ref(mUserAgentHeader);
|
||||
|
||||
mProvider = belle_sip_stack_create_provider(mStack,NULL);
|
||||
enableNatHelper(TRUE);
|
||||
|
|
@ -387,17 +395,12 @@ Sal::Sal(MSFactory *factory){
|
|||
}
|
||||
|
||||
Sal::~Sal() {
|
||||
belle_sip_object_unref(mUserAgent);
|
||||
belle_sip_object_unref(mUserAgentHeader);
|
||||
belle_sip_object_unref(mProvider);
|
||||
belle_sip_object_unref(mStack);
|
||||
belle_sip_object_unref(mListener);
|
||||
if (mSupported) belle_sip_object_unref(mSupported);
|
||||
bctbx_list_free_with_data(mSupportedTags,ms_free);
|
||||
bctbx_list_free_with_data(mSupportedContentTypes, ms_free);
|
||||
if (mUuid) ms_free(mUuid);
|
||||
if (mRootCa) ms_free(mRootCa);
|
||||
if (mRootCaData) ms_free(mRootCaData);
|
||||
if (mLinphoneSpecs) ms_free(mLinphoneSpecs);
|
||||
if (mSupportedHeader)
|
||||
belle_sip_object_unref(mSupportedHeader);
|
||||
}
|
||||
|
||||
void Sal::setCallbacks(const Callbacks *cbs) {
|
||||
|
|
@ -461,15 +464,17 @@ void Sal::setTlsProperties(){
|
|||
if (!mTlsVerify) verify_exceptions = BELLE_TLS_VERIFY_ANY_REASON;
|
||||
else if (!mTlsVerifyCn) verify_exceptions = BELLE_TLS_VERIFY_CN_MISMATCH;
|
||||
belle_tls_crypto_config_set_verify_exceptions(crypto_config, verify_exceptions);
|
||||
if (mRootCa != NULL) belle_tls_crypto_config_set_root_ca(crypto_config, mRootCa);
|
||||
if (mRootCaData != NULL) belle_tls_crypto_config_set_root_ca_data(crypto_config, mRootCaData);
|
||||
if (!mRootCa.empty())
|
||||
belle_tls_crypto_config_set_root_ca(crypto_config, mRootCa.c_str());
|
||||
if (!mRootCaData.empty())
|
||||
belle_tls_crypto_config_set_root_ca_data(crypto_config, mRootCaData.c_str());
|
||||
if (mSslConfig != NULL) belle_tls_crypto_config_set_ssl_config(crypto_config, mSslConfig);
|
||||
belle_sip_tls_listening_point_set_crypto_config(tlp, crypto_config);
|
||||
belle_sip_object_unref(crypto_config);
|
||||
}
|
||||
}
|
||||
|
||||
int Sal::addListenPort(SalAddress* addr, bool_t is_tunneled) {
|
||||
int Sal::addListenPort(SalAddress* addr, bool is_tunneled) {
|
||||
int result;
|
||||
belle_sip_listening_point_t* lp;
|
||||
if (is_tunneled){
|
||||
|
|
@ -505,14 +510,13 @@ int Sal::addListenPort(SalAddress* addr, bool_t is_tunneled) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int Sal::setListenPort(const char *addr, int port, SalTransport tr, bool_t is_tunneled) {
|
||||
SalAddress* sal_addr = sal_address_new(NULL);
|
||||
int result;
|
||||
sal_address_set_domain(sal_addr,addr);
|
||||
sal_address_set_port(sal_addr,port);
|
||||
sal_address_set_transport(sal_addr,tr);
|
||||
result = addListenPort(sal_addr, is_tunneled);
|
||||
sal_address_destroy(sal_addr);
|
||||
int Sal::setListenPort (const string &addr, int port, SalTransport tr, bool isTunneled) {
|
||||
SalAddress *salAddr = sal_address_new(nullptr);
|
||||
sal_address_set_domain(salAddr, L_STRING_TO_C(addr));
|
||||
sal_address_set_port(salAddr, port);
|
||||
sal_address_set_transport(salAddr, tr);
|
||||
int result = addListenPort(salAddr, isTunneled);
|
||||
sal_address_destroy(salAddr);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -547,62 +551,48 @@ int Sal::isTransportAvailable(SalTransport t) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void Sal::makeSupportedHeader(){
|
||||
bctbx_list_t *it;
|
||||
char *alltags=NULL;
|
||||
size_t buflen=64;
|
||||
size_t written=0;
|
||||
void Sal::makeSupportedHeader () {
|
||||
if (mSupportedHeader) {
|
||||
belle_sip_object_unref(mSupportedHeader);
|
||||
mSupportedHeader = nullptr;
|
||||
}
|
||||
string tags = Utils::join(mSupportedTags, ", ");
|
||||
if (tags.empty())
|
||||
return;
|
||||
mSupportedHeader = belle_sip_header_create("Supported", tags.c_str());
|
||||
if (mSupportedHeader)
|
||||
belle_sip_object_ref(mSupportedHeader);
|
||||
}
|
||||
|
||||
if (mSupported){
|
||||
belle_sip_object_unref(mSupported);
|
||||
mSupported=NULL;
|
||||
}
|
||||
for(it=mSupportedTags;it!=NULL;it=it->next){
|
||||
const char *tag=(const char*)it->data;
|
||||
size_t taglen=strlen(tag);
|
||||
if (alltags==NULL || (written+taglen+1>=buflen)) alltags=reinterpret_cast<char *>(ms_realloc(alltags,(buflen=buflen*2)));
|
||||
written+=(size_t)snprintf(alltags+written,buflen-written,it->next ? "%s, " : "%s",tag);
|
||||
}
|
||||
if (alltags){
|
||||
mSupported=belle_sip_header_create("Supported",alltags);
|
||||
if (mSupported){
|
||||
belle_sip_object_ref(mSupported);
|
||||
}
|
||||
ms_free(alltags);
|
||||
void Sal::setSupportedTags (const string &tags) {
|
||||
vector<string> splittedTags = Utils::split(tags, ",");
|
||||
mSupportedTags.clear();
|
||||
for (const auto &tag : splittedTags)
|
||||
mSupportedTags.push_back(Utils::trim(tag));
|
||||
makeSupportedHeader();
|
||||
}
|
||||
|
||||
const string &Sal::getSupportedTags () const {
|
||||
if (mSupportedHeader)
|
||||
mSupported = belle_sip_header_get_unparsed_value(mSupportedHeader);
|
||||
else
|
||||
mSupported.clear();
|
||||
return mSupported;
|
||||
}
|
||||
|
||||
void Sal::addSupportedTag (const string &tag) {
|
||||
auto it = find(mSupportedTags.cbegin(), mSupportedTags.cend(), tag);
|
||||
if (it == mSupportedTags.cend()) {
|
||||
mSupportedTags.push_back(tag);
|
||||
makeSupportedHeader();
|
||||
}
|
||||
}
|
||||
|
||||
void Sal::setSupportedTags(const char* tags){
|
||||
mSupportedTags=bctbx_list_free_with_data(mSupportedTags,ms_free);
|
||||
if (tags){
|
||||
char *iter;
|
||||
char *buffer=ms_strdup(tags);
|
||||
char *tag;
|
||||
char *context=NULL;
|
||||
iter=buffer;
|
||||
while((tag=strtok_r(iter,", ",&context))!=NULL){
|
||||
iter=NULL;
|
||||
mSupportedTags=bctbx_list_append(mSupportedTags,ms_strdup(tag));
|
||||
}
|
||||
ms_free(buffer);
|
||||
}
|
||||
makeSupportedHeader();
|
||||
}
|
||||
|
||||
void Sal::addSupportedTag(const char* tag){
|
||||
bctbx_list_t *elem=bctbx_list_find_custom(mSupportedTags,(bctbx_compare_func)strcasecmp,tag);
|
||||
if (!elem){
|
||||
mSupportedTags=bctbx_list_append(mSupportedTags,ms_strdup(tag));
|
||||
makeSupportedHeader();
|
||||
}
|
||||
}
|
||||
|
||||
void Sal::removeSupportedTag(const char* tag){
|
||||
bctbx_list_t *elem=bctbx_list_find_custom(mSupportedTags,(bctbx_compare_func)strcasecmp,tag);
|
||||
if (elem){
|
||||
ms_free(elem->data);
|
||||
mSupportedTags=bctbx_list_erase_link(mSupportedTags,elem);
|
||||
makeSupportedHeader();
|
||||
void Sal::removeSupportedTag (const string &tag) {
|
||||
auto it = find(mSupportedTags.cbegin(), mSupportedTags.cend(), tag);
|
||||
if (it != mSupportedTags.cend()) {
|
||||
mSupportedTags.erase(it);
|
||||
makeSupportedHeader();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -617,21 +607,23 @@ ortp_socket_t Sal::getSocket() const {
|
|||
return -1;
|
||||
}
|
||||
|
||||
void Sal::setUserAgent(const char *user_agent) {
|
||||
belle_sip_header_user_agent_set_products(mUserAgent,NULL);
|
||||
belle_sip_header_user_agent_add_product(mUserAgent,user_agent);
|
||||
void Sal::setUserAgent (const string &value) {
|
||||
belle_sip_header_user_agent_set_products(mUserAgentHeader, nullptr);
|
||||
belle_sip_header_user_agent_add_product(mUserAgentHeader, L_STRING_TO_C(value));
|
||||
}
|
||||
|
||||
const char* Sal::getUserAgent() const {
|
||||
static char user_agent[255];
|
||||
belle_sip_header_user_agent_get_products_as_string(mUserAgent, user_agent, 254);
|
||||
return user_agent;
|
||||
const string &Sal::getUserAgent () const {
|
||||
char userAgent[256];
|
||||
belle_sip_header_user_agent_get_products_as_string(mUserAgentHeader, userAgent, sizeof(userAgent) - 1);
|
||||
mUserAgent = userAgent;
|
||||
return mUserAgent;
|
||||
}
|
||||
|
||||
void Sal::appendStackStringToUserAgent() {
|
||||
char stack_string[64];
|
||||
snprintf(stack_string, sizeof(stack_string) - 1, "(belle-sip/%s)", belle_sip_version_to_string());
|
||||
belle_sip_header_user_agent_add_product(mUserAgent, stack_string);
|
||||
void Sal::appendStackStringToUserAgent () {
|
||||
stringstream ss;
|
||||
ss << "(belle-sip/" << belle_sip_version_to_string() << ")";
|
||||
string stackStr = ss.str();
|
||||
belle_sip_header_user_agent_add_product(mUserAgentHeader, stackStr.c_str());
|
||||
}
|
||||
|
||||
void Sal::setKeepAlivePeriod(unsigned int value) {
|
||||
|
|
@ -655,70 +647,57 @@ int Sal::setTunnel(void *tunnelclient) {
|
|||
#endif
|
||||
}
|
||||
|
||||
bool_t Sal::isContentTypeSupported(const char *content_type) const {
|
||||
bctbx_list_t *item;
|
||||
for (item = mSupportedContentTypes; item != NULL; item = bctbx_list_next(item)) {
|
||||
const char *item_content_type = (const char *)bctbx_list_get_data(item);
|
||||
if (strcmp(item_content_type, content_type) == 0) return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
void Sal::setHttpProxyHost (const string &value) {
|
||||
belle_sip_stack_set_http_proxy_host(mStack, L_STRING_TO_C(value));
|
||||
}
|
||||
|
||||
void Sal::addContentTypeSupport(const char *content_type) {
|
||||
if ((content_type != NULL) && (isContentTypeSupported(content_type) == FALSE)) {
|
||||
mSupportedContentTypes = bctbx_list_append(mSupportedContentTypes, ms_strdup(content_type));
|
||||
}
|
||||
const string &Sal::getHttpProxyHost () const {
|
||||
mHttpProxyHost = belle_sip_stack_get_http_proxy_host(mStack);
|
||||
return mHttpProxyHost;
|
||||
}
|
||||
|
||||
void Sal::removeContentTypeSupport(const char *content_type) {
|
||||
if (content_type != NULL) {
|
||||
if (bctbx_list_find(mSupportedContentTypes, content_type)) {
|
||||
mSupportedContentTypes = bctbx_list_remove(mSupportedContentTypes, (char *)content_type);
|
||||
}
|
||||
}
|
||||
bool Sal::isContentEncodingAvailable (const string &contentEncoding) const {
|
||||
return belle_sip_stack_content_encoding_available(mStack, L_STRING_TO_C(contentEncoding));
|
||||
}
|
||||
|
||||
void Sal::useRport(bool_t use_rports) {
|
||||
bool Sal::isContentTypeSupported (const string &contentType) const {
|
||||
auto it = find_if(mSupportedContentTypes.cbegin(), mSupportedContentTypes.cend(),
|
||||
[contentType](string supportedContentType) { return contentType == supportedContentType; });
|
||||
return it != mSupportedContentTypes.cend();
|
||||
}
|
||||
|
||||
void Sal::addContentTypeSupport (const string &contentType) {
|
||||
if (!contentType.empty() && !isContentTypeSupported(contentType))
|
||||
mSupportedContentTypes.push_back(contentType);
|
||||
}
|
||||
|
||||
void Sal::removeContentTypeSupport (const string &contentType) {
|
||||
auto it = find(mSupportedContentTypes.begin(), mSupportedContentTypes.end(), contentType);
|
||||
if (it != mSupportedContentTypes.end())
|
||||
mSupportedContentTypes.erase(it);
|
||||
}
|
||||
|
||||
void Sal::useRport(bool use_rports) {
|
||||
belle_sip_provider_enable_rport(mProvider,use_rports);
|
||||
ms_message("Sal use rport [%s]", use_rports ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
void Sal::setContactLinphoneSpecs(const char *specs) {
|
||||
if (mLinphoneSpecs) {
|
||||
ms_free(mLinphoneSpecs);
|
||||
mLinphoneSpecs = NULL;
|
||||
}
|
||||
if (specs) {
|
||||
mLinphoneSpecs = ms_strdup(specs);
|
||||
}
|
||||
}
|
||||
|
||||
void Sal::setRootCa(const char* rootCa) {
|
||||
if (mRootCa) {
|
||||
ms_free(mRootCa);
|
||||
mRootCa = NULL;
|
||||
}
|
||||
if (rootCa)
|
||||
mRootCa = ms_strdup(rootCa);
|
||||
void Sal::setRootCa (const string &value) {
|
||||
mRootCa = value;
|
||||
setTlsProperties();
|
||||
}
|
||||
|
||||
void Sal::setRootCaData(const char* data) {
|
||||
if (mRootCaData) {
|
||||
ms_free(mRootCaData);
|
||||
mRootCaData = NULL;
|
||||
}
|
||||
if (data)
|
||||
mRootCaData = ms_strdup(data);
|
||||
void Sal::setRootCaData (const string &value) {
|
||||
mRootCaData = value;
|
||||
setTlsProperties();
|
||||
}
|
||||
|
||||
void Sal::verifyServerCertificates(bool_t verify) {
|
||||
void Sal::verifyServerCertificates(bool verify) {
|
||||
mTlsVerify=verify;
|
||||
setTlsProperties();
|
||||
}
|
||||
|
||||
void Sal::verifyServerCn(bool_t verify) {
|
||||
void Sal::verifyServerCn(bool verify) {
|
||||
mTlsVerifyCn = verify;
|
||||
setTlsProperties();
|
||||
}
|
||||
|
|
@ -728,15 +707,6 @@ void Sal::setSslConfig(void *ssl_config) {
|
|||
setTlsProperties();
|
||||
}
|
||||
|
||||
void Sal::setUuid(const char *uuid){
|
||||
if (mUuid){
|
||||
ms_free(mUuid);
|
||||
mUuid=NULL;
|
||||
}
|
||||
if (uuid)
|
||||
mUuid=ms_strdup(uuid);
|
||||
}
|
||||
|
||||
int Sal::createUuid(char *uuid, size_t len) {
|
||||
if (generateUuid(uuid, len) == 0) {
|
||||
setUuid(uuid);
|
||||
|
|
@ -746,21 +716,21 @@ int Sal::createUuid(char *uuid, size_t len) {
|
|||
}
|
||||
|
||||
int Sal::generateUuid(char *uuid, size_t len) {
|
||||
sal_uuid_t uuid_struct;
|
||||
SalUuid uuid_struct;
|
||||
int i;
|
||||
int written;
|
||||
|
||||
if (len==0) return -1;
|
||||
/*create an UUID as described in RFC4122, 4.4 */
|
||||
belle_sip_random_bytes((unsigned char*)&uuid_struct, sizeof(sal_uuid_t));
|
||||
uuid_struct.clock_seq_hi_and_reserved&=(unsigned char)~(1<<6);
|
||||
uuid_struct.clock_seq_hi_and_reserved|=(unsigned char)1<<7;
|
||||
uuid_struct.time_hi_and_version&=(unsigned char)~(0xf<<12);
|
||||
uuid_struct.time_hi_and_version|=(unsigned char)4<<12;
|
||||
belle_sip_random_bytes((unsigned char*)&uuid_struct, sizeof(SalUuid));
|
||||
uuid_struct.clockSeqHiAndReserved&=(unsigned char)~(1<<6);
|
||||
uuid_struct.clockSeqHiAndReserved|=(unsigned char)1<<7;
|
||||
uuid_struct.timeHiAndVersion&=(unsigned char)~(0xf<<12);
|
||||
uuid_struct.timeHiAndVersion|=(unsigned char)4<<12;
|
||||
|
||||
written=snprintf(uuid,len,"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", uuid_struct.time_low, uuid_struct.time_mid,
|
||||
uuid_struct.time_hi_and_version, uuid_struct.clock_seq_hi_and_reserved,
|
||||
uuid_struct.clock_seq_low);
|
||||
written=snprintf(uuid,len,"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", uuid_struct.timeLow, uuid_struct.timeMid,
|
||||
uuid_struct.timeHiAndVersion, uuid_struct.clockSeqHiAndReserved,
|
||||
uuid_struct.clockSeqLow);
|
||||
if ((written < 0) || ((size_t)written > (len +13))) {
|
||||
ms_error("sal_create_uuid(): buffer is too short !");
|
||||
return -1;
|
||||
|
|
@ -771,19 +741,18 @@ int Sal::generateUuid(char *uuid, size_t len) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void Sal::addPendingAuth(SalOp *op){
|
||||
if (bctbx_list_find(mPendingAuths,op)==NULL){
|
||||
mPendingAuths=bctbx_list_append(mPendingAuths,op);
|
||||
op->mHasAuthPending=TRUE;
|
||||
void Sal::addPendingAuth (SalOp *op) {
|
||||
auto it = find(mPendingAuths.cbegin(), mPendingAuths.cend(), op);
|
||||
if (it == mPendingAuths.cend()) {
|
||||
mPendingAuths.push_back(op);
|
||||
op->mHasAuthPending = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Sal::removePendingAuth(SalOp *op){
|
||||
if (op->mHasAuthPending){
|
||||
op->mHasAuthPending=FALSE;
|
||||
if (bctbx_list_find(mPendingAuths,op)){
|
||||
mPendingAuths=bctbx_list_remove(mPendingAuths,op);
|
||||
}
|
||||
void Sal::removePendingAuth (SalOp *op) {
|
||||
if (op->mHasAuthPending) {
|
||||
op->mHasAuthPending = false;
|
||||
mPendingAuths.remove(op);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -792,7 +761,7 @@ void Sal::setDefaultSdpHandling(SalOpSDPHandling sdp_handling_method) {
|
|||
mDefaultSdpHandling = sdp_handling_method;
|
||||
}
|
||||
|
||||
void Sal::enableNatHelper(bool_t enable) {
|
||||
void Sal::enableNatHelper(bool enable) {
|
||||
mNatHelperEnabled=enable;
|
||||
belle_sip_provider_enable_nat_helper(mProvider,enable);
|
||||
ms_message("Sal nat helper [%s]",enable?"enabled":"disabled");
|
||||
|
|
@ -814,9 +783,26 @@ void Sal::setDnsServers(const bctbx_list_t *servers){
|
|||
belle_sip_list_free(l);
|
||||
}
|
||||
|
||||
belle_sip_source_t *Sal::createTimer(belle_sip_source_func_t func, void *data, unsigned int timeout_value_ms, const char* timer_name) {
|
||||
void Sal::setDnsUserHostsFile (const string &value) {
|
||||
belle_sip_stack_set_dns_user_hosts_file(mStack, value.c_str());
|
||||
}
|
||||
|
||||
const string &Sal::getDnsUserHostsFile () const {
|
||||
mDnsUserHostsFile = belle_sip_stack_get_dns_user_hosts_file(mStack);
|
||||
return mDnsUserHostsFile;
|
||||
}
|
||||
|
||||
belle_sip_resolver_context_t *Sal::resolveA (const string &name, int port, int family, belle_sip_resolver_callback_t cb, void *data) {
|
||||
return belle_sip_stack_resolve_a(mStack, L_STRING_TO_C(name), port, family, cb, data);
|
||||
}
|
||||
|
||||
belle_sip_resolver_context_t *Sal::resolve (const string &service, const string &transport, const string &name, int port, int family, belle_sip_resolver_callback_t cb, void *data) {
|
||||
return belle_sip_stack_resolve(mStack, L_STRING_TO_C(service), L_STRING_TO_C(transport), L_STRING_TO_C(name), port, family, cb, data);
|
||||
}
|
||||
|
||||
belle_sip_source_t *Sal::createTimer (belle_sip_source_func_t func, void *data, unsigned int timeoutValueMs, const string &timerName) {
|
||||
belle_sip_main_loop_t *ml = belle_sip_stack_get_main_loop(mStack);
|
||||
return belle_sip_main_loop_create_timeout(ml, func, data, timeout_value_ms, timer_name);
|
||||
return belle_sip_main_loop_create_timeout(ml, func, data, timeoutValueMs, L_STRING_TO_C(timerName));
|
||||
}
|
||||
|
||||
void Sal::cancelTimer(belle_sip_source_t *timer) {
|
||||
|
|
@ -826,8 +812,8 @@ void Sal::cancelTimer(belle_sip_source_t *timer) {
|
|||
|
||||
belle_sip_response_t* Sal::createResponseFromRequest (belle_sip_request_t* req, int code ) {
|
||||
belle_sip_response_t *resp=belle_sip_response_create_from_request(req,code);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),BELLE_SIP_HEADER(mUserAgent));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp), mSupported);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),BELLE_SIP_HEADER(mUserAgentHeader));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp), mSupportedHeader);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
|
@ -952,7 +938,7 @@ int sal_create_uuid(Sal *ctx, char *uuid, size_t len) {
|
|||
}
|
||||
|
||||
void sal_set_uuid(Sal *ctx, const char *uuid) {
|
||||
ctx->setUuid(uuid);
|
||||
ctx->setUuid(L_C_TO_STRING(uuid));
|
||||
}
|
||||
|
||||
void sal_default_set_sdp_handling(Sal* h, SalOpSDPHandling handling_method) {
|
||||
|
|
@ -967,8 +953,8 @@ void sal_set_recv_error(Sal *sal,int value) {
|
|||
sal->setRecvError(value);
|
||||
}
|
||||
|
||||
int sal_enable_pending_trans_checking(Sal *sal, bool_t value) {
|
||||
return sal->enablePendingTransactionChecking(value);
|
||||
void sal_enable_pending_trans_checking(Sal *sal, bool value) {
|
||||
sal->enablePendingTransactionChecking(value);
|
||||
}
|
||||
|
||||
void sal_enable_unconditional_answer(Sal *sal,int value) {
|
||||
|
|
@ -999,7 +985,7 @@ void sal_set_transport_timeout(Sal* sal,int timeout) {
|
|||
sal->setTransportTimeout(timeout);
|
||||
}
|
||||
|
||||
void sal_enable_test_features(Sal*ctx, bool_t enabled) {
|
||||
void sal_enable_test_features(Sal*ctx, bool enabled) {
|
||||
ctx->enableTestFeatures(enabled);
|
||||
}
|
||||
|
||||
|
|
@ -1011,7 +997,7 @@ const SalErrorInfo *sal_op_get_error_info(const SalOp *op) {
|
|||
return op->getErrorInfo();
|
||||
}
|
||||
|
||||
bool_t sal_call_dialog_request_pending(const SalOp *op) {
|
||||
bool sal_call_dialog_request_pending(const SalOp *op) {
|
||||
auto callOp = dynamic_cast<const SalCallOp *>(op);
|
||||
return callOp->dialogRequestPending();
|
||||
}
|
||||
|
|
|
|||
159
src/sal/sal.h
159
src/sal/sal.h
|
|
@ -20,6 +20,9 @@
|
|||
#ifndef _L_SAL_H_
|
||||
#define _L_SAL_H_
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
#include "c-wrapper/internal/c-sal.h"
|
||||
|
|
@ -34,7 +37,7 @@ class SalSubscribeOp;
|
|||
class SalPresenceOp;
|
||||
class SalReferOp;
|
||||
|
||||
class Sal{
|
||||
class Sal {
|
||||
public:
|
||||
using OnCallReceivedCb = void (*) (SalCallOp *op);
|
||||
using OnCallRingingCb = void (*) (SalOp *op);
|
||||
|
|
@ -134,59 +137,55 @@ public:
|
|||
// ---------------------------------------------------------------------------
|
||||
// SIP parameters
|
||||
// ---------------------------------------------------------------------------
|
||||
void setSupportedTags (const char *tags);
|
||||
const char *getSupportedTags () const {
|
||||
return mSupported ? belle_sip_header_get_unparsed_value(mSupported) : nullptr;
|
||||
}
|
||||
void addSupportedTag (const char *tag);
|
||||
void removeSupportedTag (const char *tag);
|
||||
void setSupportedTags (const std::string &tags);
|
||||
const std::string &getSupportedTags () const;
|
||||
void addSupportedTag (const std::string &tag);
|
||||
void removeSupportedTag (const std::string &tag);
|
||||
|
||||
void setUserAgent (const char *userAgent);
|
||||
const char *getUserAgent() const;
|
||||
void setUserAgent (const std::string &value);
|
||||
const std::string &getUserAgent () const;
|
||||
void appendStackStringToUserAgent ();
|
||||
|
||||
bool_t isContentEncodingAvailable (const char *contentEncoding) {
|
||||
return (bool_t)belle_sip_stack_content_encoding_available(mStack, contentEncoding);
|
||||
}
|
||||
bool_t isContentTypeSupported (const char *contentType) const;
|
||||
void addContentTypeSupport (const char *contentType);
|
||||
void removeContentTypeSupport (const char *contentType);
|
||||
bool isContentEncodingAvailable (const std::string &contentEncoding) const;
|
||||
bool isContentTypeSupported (const std::string &contentType) const;
|
||||
void addContentTypeSupport (const std::string &contentType);
|
||||
void removeContentTypeSupport (const std::string &contentType);
|
||||
|
||||
void setDefaultSdpHandling (SalOpSDPHandling sdpHandlingMethod);
|
||||
|
||||
void setUuid (const char *uuid);
|
||||
void setUuid (const std::string &value) { mUuid = value; }
|
||||
int createUuid (char *uuid, size_t len);
|
||||
static int generateUuid (char *uuid, size_t len);
|
||||
|
||||
void enableNatHelper (bool_t enable);
|
||||
bool_t natHelperEnabled () const { return mNatHelperEnabled; }
|
||||
void enableNatHelper (bool value);
|
||||
bool natHelperEnabled () const { return mNatHelperEnabled; }
|
||||
|
||||
bool_t pendingTransactionCheckingEnabled () const { return mPendingTransactionChecking; }
|
||||
int enablePendingTransactionChecking (bool_t value) { mPendingTransactionChecking = value; return 0; }
|
||||
bool pendingTransactionCheckingEnabled () const { return mPendingTransactionChecking; }
|
||||
void enablePendingTransactionChecking (bool value) { mPendingTransactionChecking = value; }
|
||||
|
||||
void setRefresherRetryAfter (int value) { mRefresherRetryAfter = value; }
|
||||
int getRefresherRetryAfter () const { return mRefresherRetryAfter; }
|
||||
|
||||
void enableSipUpdateMethod (bool_t value) { mEnableSipUpdate = value; }
|
||||
void enableSipUpdateMethod (bool value) { mEnableSipUpdate = value; }
|
||||
void useSessionTimers (int expires) { mSessionExpires = expires; }
|
||||
void useDates (bool_t value) { mUseDates = value; }
|
||||
void useOneMatchingCodecPolicy (bool_t value) { mOneMatchingCodec = value; }
|
||||
void useRport (bool_t value);
|
||||
void enableAutoContacts (bool_t value) { mAutoContacts = value; }
|
||||
void enableTestFeatures (bool_t value) { mEnableTestFeatures = value; }
|
||||
void useNoInitialRoute (bool_t value) { mNoInitialRoute = value; }
|
||||
void useDates (bool value) { mUseDates = value; }
|
||||
void useOneMatchingCodecPolicy (bool value) { mOneMatchingCodec = value; }
|
||||
void useRport (bool value);
|
||||
void enableAutoContacts (bool value) { mAutoContacts = value; }
|
||||
void enableTestFeatures (bool value) { mEnableTestFeatures = value; }
|
||||
void useNoInitialRoute (bool value) { mNoInitialRoute = value; }
|
||||
void enableUnconditionalAnswer (int value) { belle_sip_provider_enable_unconditional_answer(mProvider, value); }
|
||||
void enableReconnectToPrimaryAsap (bool_t value) { belle_sip_stack_enable_reconnect_to_primary_asap(mStack, value); }
|
||||
void enableReconnectToPrimaryAsap (bool value) { belle_sip_stack_enable_reconnect_to_primary_asap(mStack, value); }
|
||||
|
||||
bctbx_list_t *getPendingAuths () const { return bctbx_list_copy(mPendingAuths); }
|
||||
const std::list<SalOp *> &getPendingAuths () const { return mPendingAuths; }
|
||||
|
||||
void setContactLinphoneSpecs (const char *specs);
|
||||
void setContactLinphoneSpecs (const std::string &value) { mLinphoneSpecs = value; }
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Network parameters
|
||||
// ---------------------------------------------------------------------------
|
||||
int setListenPort (const char *addr, int port, SalTransport tr, bool_t isTunneled);
|
||||
int setListenPort (const std::string &addr, int port, SalTransport tr, bool isTunneled);
|
||||
int getListeningPort (SalTransport tr);
|
||||
int isTransportAvailable (SalTransport t);
|
||||
|
||||
|
|
@ -197,14 +196,14 @@ public:
|
|||
|
||||
void setKeepAlivePeriod (unsigned int value);
|
||||
unsigned int getKeepAlivePeriod () const { return mKeepAlive; }
|
||||
void useTcpTlsKeepAlive (bool_t value) { mUseTcpTlsKeepAlive = value; }
|
||||
void useTcpTlsKeepAlive (bool value) { mUseTcpTlsKeepAlive = value; }
|
||||
|
||||
void setDscp (int dscp) { belle_sip_stack_set_default_dscp(mStack, dscp); }
|
||||
|
||||
int setTunnel (void *tunnelClient);
|
||||
|
||||
void setHttpProxyHost (const char *value) { belle_sip_stack_set_http_proxy_host(mStack, value); }
|
||||
const char *getHttpProxyHost () const { return belle_sip_stack_get_http_proxy_host(mStack); }
|
||||
void setHttpProxyHost (const std::string &value);
|
||||
const std::string &getHttpProxyHost () const;
|
||||
|
||||
void setHttpProxyPort (int value) { belle_sip_stack_set_http_proxy_port(mStack, value); }
|
||||
int getHttpProxyPort () const { return belle_sip_stack_get_http_proxy_port(mStack); }
|
||||
|
|
@ -219,12 +218,12 @@ public:
|
|||
// TLS parameters
|
||||
// ---------------------------------------------------------------------------
|
||||
void setSslConfig (void *sslConfig);
|
||||
void setRootCa (const char *value);
|
||||
void setRootCaData (const char *data);
|
||||
const char *getRootCa () const { return mRootCa; }
|
||||
void setRootCa (const std::string &value);
|
||||
void setRootCaData (const std::string &value);
|
||||
const std::string &getRootCa () const { return mRootCa; }
|
||||
|
||||
void verifyServerCertificates (bool_t value);
|
||||
void verifyServerCn (bool_t value);
|
||||
void verifyServerCertificates (bool value);
|
||||
void verifyServerCn (bool value);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -235,42 +234,38 @@ public:
|
|||
|
||||
void setDnsServers (const bctbx_list_t *servers);
|
||||
|
||||
void enableDnsSearch (bool_t value) { belle_sip_stack_enable_dns_search(mStack, (unsigned char)value); }
|
||||
bool_t dnsSearchEnabled () const { return (bool_t)belle_sip_stack_dns_search_enabled(mStack); }
|
||||
void enableDnsSearch (bool value) { belle_sip_stack_enable_dns_search(mStack, (unsigned char)value); }
|
||||
bool dnsSearchEnabled () const { return belle_sip_stack_dns_search_enabled(mStack); }
|
||||
|
||||
void enableDnsSrv (bool_t value) { belle_sip_stack_enable_dns_srv(mStack, (unsigned char)value); }
|
||||
bool_t dnsSrvEnabled () const { return (bool_t)belle_sip_stack_dns_srv_enabled(mStack); }
|
||||
void enableDnsSrv (bool value) { belle_sip_stack_enable_dns_srv(mStack, (unsigned char)value); }
|
||||
bool dnsSrvEnabled () const { return belle_sip_stack_dns_srv_enabled(mStack); }
|
||||
|
||||
void setDnsUserHostsFile (const char *value) { belle_sip_stack_set_dns_user_hosts_file(mStack, value); }
|
||||
const char *getDnsUserHostsFile () const { return belle_sip_stack_get_dns_user_hosts_file(mStack); }
|
||||
void setDnsUserHostsFile (const std::string &value);
|
||||
const std::string &getDnsUserHostsFile () const;
|
||||
|
||||
belle_sip_resolver_context_t *resolveA (const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data) {
|
||||
return belle_sip_stack_resolve_a(mStack, name, port, family, cb, data);
|
||||
}
|
||||
belle_sip_resolver_context_t *resolve (const char *service, const char *transport, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data) {
|
||||
return belle_sip_stack_resolve(mStack, service, transport, name, port, family, cb, data);
|
||||
}
|
||||
belle_sip_resolver_context_t *resolveA (const std::string &name, int port, int family, belle_sip_resolver_callback_t cb, void *data);
|
||||
belle_sip_resolver_context_t *resolve (const std::string &service, const std::string &transport, const std::string &name, int port, int family, belle_sip_resolver_callback_t cb, void *data);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Timers
|
||||
// ---------------------------------------------------------------------------
|
||||
belle_sip_source_t *createTimer (belle_sip_source_func_t func, void *data, unsigned int timeoutValueMs, const char *timerName);
|
||||
belle_sip_source_t *createTimer (belle_sip_source_func_t func, void *data, unsigned int timeoutValueMs, const std::string &timerName);
|
||||
void cancelTimer (belle_sip_source_t *timer);
|
||||
|
||||
|
||||
private:
|
||||
struct sal_uuid_t {
|
||||
unsigned int time_low;
|
||||
unsigned short time_mid;
|
||||
unsigned short time_hi_and_version;
|
||||
unsigned char clock_seq_hi_and_reserved;
|
||||
unsigned char clock_seq_low;
|
||||
struct SalUuid {
|
||||
unsigned int timeLow;
|
||||
unsigned short timeMid;
|
||||
unsigned short timeHiAndVersion;
|
||||
unsigned char clockSeqHiAndReserved;
|
||||
unsigned char clockSeqLow;
|
||||
unsigned char node[6];
|
||||
};
|
||||
|
||||
void setTlsProperties ();
|
||||
int addListenPort (SalAddress *addr, bool_t isTunneled);
|
||||
int addListenPort (SalAddress *addr, bool isTunneled);
|
||||
void makeSupportedHeader ();
|
||||
void addPendingAuth (SalOp *op);
|
||||
void removePendingAuth (SalOp *op);
|
||||
|
|
@ -292,36 +287,42 @@ private:
|
|||
|
||||
MSFactory *mFactory = nullptr;
|
||||
Callbacks mCallbacks = { 0 };
|
||||
MSList *mPendingAuths = nullptr; // List of SalOp
|
||||
std::list<SalOp *> mPendingAuths;
|
||||
belle_sip_stack_t *mStack = nullptr;
|
||||
belle_sip_provider_t *mProvider = nullptr;
|
||||
belle_sip_header_user_agent_t *mUserAgent = nullptr;
|
||||
belle_sip_header_user_agent_t *mUserAgentHeader = nullptr;
|
||||
belle_sip_listener_t *mListener = nullptr;
|
||||
void *mTunnelClient = nullptr;
|
||||
void *mUserPointer = nullptr; // User pointer
|
||||
int mSessionExpires = 0;
|
||||
unsigned int mKeepAlive = 0;
|
||||
char *mRootCa = nullptr;
|
||||
char *mRootCaData = nullptr;
|
||||
char *mUuid = nullptr;
|
||||
std::string mRootCa;
|
||||
std::string mRootCaData;
|
||||
std::string mUuid;
|
||||
int mRefresherRetryAfter = 60000; // Retry after value for refresher
|
||||
MSList *mSupportedTags = nullptr; // List of char *
|
||||
belle_sip_header_t *mSupported = nullptr;
|
||||
bool_t mOneMatchingCodec = FALSE;
|
||||
bool_t mUseTcpTlsKeepAlive = FALSE;
|
||||
bool_t mNatHelperEnabled = FALSE;
|
||||
bool_t mTlsVerify = TRUE;
|
||||
bool_t mTlsVerifyCn = TRUE;
|
||||
bool_t mUseDates = FALSE;
|
||||
bool_t mAutoContacts = TRUE;
|
||||
bool_t mEnableTestFeatures = FALSE;
|
||||
bool_t mNoInitialRoute = FALSE;
|
||||
bool_t mEnableSipUpdate = TRUE; // true by default
|
||||
std::vector<std::string> mSupportedTags;
|
||||
belle_sip_header_t *mSupportedHeader = nullptr;
|
||||
bool mOneMatchingCodec = false;
|
||||
bool mUseTcpTlsKeepAlive = false;
|
||||
bool mNatHelperEnabled = false;
|
||||
bool mTlsVerify = true;
|
||||
bool mTlsVerifyCn = true;
|
||||
bool mUseDates = false;
|
||||
bool mAutoContacts = true;
|
||||
bool mEnableTestFeatures = false;
|
||||
bool mNoInitialRoute = false;
|
||||
bool mEnableSipUpdate = true;
|
||||
SalOpSDPHandling mDefaultSdpHandling = SalOpSDPNormal;
|
||||
bool_t mPendingTransactionChecking = TRUE; // For testing purposes
|
||||
bool mPendingTransactionChecking = true; // For testing purposes
|
||||
void *mSslConfig = nullptr;
|
||||
bctbx_list_t *mSupportedContentTypes = nullptr; // List of char *
|
||||
char *mLinphoneSpecs = nullptr;
|
||||
std::vector<std::string> mSupportedContentTypes;
|
||||
std::string mLinphoneSpecs;
|
||||
|
||||
// Cache values
|
||||
mutable std::string mDnsUserHostsFile;
|
||||
mutable std::string mHttpProxyHost;
|
||||
mutable std::string mSupported;
|
||||
mutable std::string mUserAgent;
|
||||
|
||||
friend class SalOp;
|
||||
friend class SalCallOp;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "magic-search-p.h"
|
||||
|
||||
#include <bctoolbox/list.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "c-wrapper/internal/c-tools.h"
|
||||
#include "linphone/utils/utils.h"
|
||||
|
|
@ -119,7 +120,7 @@ list<SearchResult> MagicSearch::getContactListFromFilter(const string &filter, c
|
|||
list<SearchResult> returnList;
|
||||
LinphoneProxyConfig *proxy = nullptr;
|
||||
|
||||
if (filter.empty()) return list<SearchResult>();
|
||||
if (filter.empty()) return getAllFriends();
|
||||
|
||||
if (getSearchCache() != nullptr) {
|
||||
resultList = continueSearch(filter, withDomain);
|
||||
|
|
@ -170,6 +171,21 @@ void MagicSearch::setSearchCache(list<SearchResult> *cache) {
|
|||
d->mCacheResult = cache;
|
||||
}
|
||||
|
||||
list<SearchResult> MagicSearch::getAllFriends() {
|
||||
list<SearchResult> returnList;
|
||||
LinphoneFriendList *list = linphone_core_get_default_friend_list(this->getCore()->getCCore());
|
||||
|
||||
for (bctbx_list_t *f = list->friends ; f != nullptr ; f = bctbx_list_next(f)) {
|
||||
const LinphoneFriend *lFriend = reinterpret_cast<LinphoneFriend*>(f->data);
|
||||
const LinphoneAddress* lAddress = linphone_friend_get_address(lFriend);
|
||||
|
||||
if (lAddress) linphone_address_ref(const_cast<LinphoneAddress *>(lAddress));
|
||||
returnList.push_back(SearchResult(1, lAddress, lFriend));
|
||||
}
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
list<SearchResult> *MagicSearch::beginNewSearch(const string &filter, const string &withDomain) {
|
||||
list<SearchResult> *resultList = new list<SearchResult>();
|
||||
LinphoneFriendList *list = linphone_core_get_default_friend_list(this->getCore()->getCCore());
|
||||
|
|
@ -221,7 +237,9 @@ SearchResult MagicSearch::searchInFriend(const LinphoneFriend *lFriend, const st
|
|||
unsigned int weight = getMinWeight();
|
||||
const LinphoneAddress* lAddress = linphone_friend_get_address(lFriend);
|
||||
|
||||
if (!checkDomain(lFriend, lAddress, withDomain)) return SearchResult(weight, nullptr);
|
||||
if (!checkDomain(lFriend, lAddress, withDomain)) {
|
||||
if (!withDomain.empty()) return SearchResult(weight, nullptr);
|
||||
}
|
||||
|
||||
// NAME
|
||||
if (linphone_core_vcard_supported()) {
|
||||
|
|
@ -270,12 +288,18 @@ unsigned int MagicSearch::searchInAddress(const LinphoneAddress *lAddress, const
|
|||
}
|
||||
|
||||
unsigned int MagicSearch::getWeight(const string &stringWords, const string &filter) const {
|
||||
locale loc;
|
||||
string filterLC = filter;
|
||||
string stringWordsLC = stringWords;
|
||||
size_t weight = string::npos;
|
||||
|
||||
// Finding all occurrences of "filter" in "stringWords"
|
||||
for (size_t w = stringWords.find(filter);
|
||||
transform(stringWordsLC.begin(), stringWordsLC.end(), stringWordsLC.begin(), [](unsigned char c){ return tolower(c); });
|
||||
transform(filterLC.begin(), filterLC.end(), filterLC.begin(), [](unsigned char c){ return tolower(c); });
|
||||
|
||||
// Finding all occurrences of "filterLC" in "stringWordsLC"
|
||||
for (size_t w = stringWordsLC.find(filterLC);
|
||||
w != string::npos;
|
||||
w = stringWords.find(filter, w + filter.length())
|
||||
w = stringWordsLC.find(filterLC, w + filterLC.length())
|
||||
) {
|
||||
// weight max if occurence find at beginning
|
||||
if (w == 0) {
|
||||
|
|
@ -283,8 +307,8 @@ unsigned int MagicSearch::getWeight(const string &stringWords, const string &fil
|
|||
} else {
|
||||
bool isDelimiter = false;
|
||||
if (getUseDelimiter()) {
|
||||
// get the char before the matched filter
|
||||
const char l = stringWords.at(w - 1);
|
||||
// get the char before the matched filterLC
|
||||
const char l = stringWordsLC.at(w - 1);
|
||||
// Check if it's a delimiter
|
||||
for (const char d : getDelimiter()) {
|
||||
if (l == d) {
|
||||
|
|
@ -296,7 +320,7 @@ unsigned int MagicSearch::getWeight(const string &stringWords, const string &fil
|
|||
unsigned int newWeight = getMaxWeight() - (unsigned int)((isDelimiter) ? 1 : w + 1);
|
||||
weight = (weight != string::npos) ? weight + newWeight : newWeight;
|
||||
}
|
||||
// Only one search on the stringWords for the moment
|
||||
// Only one search on the stringWordsLC for the moment
|
||||
// due to weight calcul which dos not take into the case of multiple occurence
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,13 @@ private:
|
|||
**/
|
||||
void setSearchCache(std::list<SearchResult> *cache);
|
||||
|
||||
/**
|
||||
* Get all friends as SearchResult
|
||||
* @return all friends in a SearchResult list
|
||||
* @private
|
||||
**/
|
||||
std::list<SearchResult> getAllFriends();
|
||||
|
||||
/**
|
||||
* Begin the search from friend list
|
||||
* @param[in] filter word we search
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -9334,6 +9338,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -3904,6 +3908,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -3431,6 +3435,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -1720,6 +1724,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -953,6 +957,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -668,6 +672,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -708,6 +712,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -582,6 +586,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,3 +8,7 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -2513,6 +2517,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -1296,6 +1300,9 @@ namespace LinphonePrivate
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -483,6 +487,9 @@ namespace namespace_
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||
#endif
|
||||
#if __GNUC__ >=7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#endif
|
||||
//
|
||||
// End prologue.
|
||||
|
||||
|
|
@ -515,6 +519,9 @@ namespace namespace_
|
|||
|
||||
// Begin epilogue.
|
||||
//
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ static void _send_file(LinphoneChatRoom* cr, const char *sendFilepath) {
|
|||
}
|
||||
|
||||
static void _receive_file(bctbx_list_t *coresList, LinphoneCoreManager *lcm, stats *receiverStats, const char *receive_filepath, const char *sendFilepath) {
|
||||
if (BC_ASSERT_TRUE(wait_for_list(coresList, &lcm->stat.number_of_LinphoneMessageReceivedWithFile, receiverStats->number_of_LinphoneMessageReceivedWithFile+1, 10000))) {
|
||||
if (BC_ASSERT_TRUE(wait_for_list(coresList, &lcm->stat.number_of_LinphoneMessageReceivedWithFile, receiverStats->number_of_LinphoneMessageReceivedWithFile + 1, 10000))) {
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
LinphoneChatMessage *msg = lcm->stat.last_received_chat_message;
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ static void _receive_file(bctbx_list_t *coresList, LinphoneCoreManager *lcm, sta
|
|||
}
|
||||
|
||||
static void _receive_file_plus_text(bctbx_list_t *coresList, LinphoneCoreManager *lcm, stats *receiverStats, const char *receive_filepath, const char *sendFilepath, const char *text) {
|
||||
if (BC_ASSERT_TRUE(wait_for_list(coresList, &lcm->stat.number_of_LinphoneMessageReceivedWithFile, receiverStats->number_of_LinphoneMessageReceivedWithFile+1, 10000))) {
|
||||
if (BC_ASSERT_TRUE(wait_for_list(coresList, &lcm->stat.number_of_LinphoneMessageReceivedWithFile, receiverStats->number_of_LinphoneMessageReceivedWithFile + 1, 10000))) {
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
LinphoneChatMessage *msg = lcm->stat.last_received_chat_message;
|
||||
|
||||
|
|
@ -261,9 +261,9 @@ static void start_core_for_conference(bctbx_list_t *coreManagerList) {
|
|||
}
|
||||
|
||||
static LinphoneChatRoom * check_creation_chat_room_client_side(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, const LinphoneAddress *confAddr, const char* subject, int participantNumber, bool_t isAdmin) {
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreationPending, initialStats->number_of_LinphoneChatRoomStateCreationPending + 1, 5000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreated, initialStats->number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomAllInformationReceived, initialStats->number_of_LinphoneChatRoomAllInformationReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreationPending, initialStats->number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreated, initialStats->number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomAllInformationReceived, initialStats->number_of_LinphoneChatRoomAllInformationReceived + 1, 3000));
|
||||
char *deviceIdentity = linphone_core_get_device_identity(lcm->lc);
|
||||
LinphoneAddress *localAddr = linphone_address_new(deviceIdentity);
|
||||
bctbx_free(deviceIdentity);
|
||||
|
|
@ -291,9 +291,9 @@ static LinphoneChatRoom * create_chat_room_client_side(bctbx_list_t *lcs, Linpho
|
|||
linphone_chat_room_add_participants(chatRoom, participantsAddresses);
|
||||
|
||||
// Check that the chat room is correctly created on Marie's side and that the participants are added
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreationPending, initialStats->number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreated, initialStats->number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomAllInformationReceived, initialStats->number_of_LinphoneChatRoomAllInformationReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreationPending, initialStats->number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreated, initialStats->number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomAllInformationReceived, initialStats->number_of_LinphoneChatRoomAllInformationReceived + 1, 3000));
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(chatRoom),
|
||||
(expectedParticipantSize >= 0) ? expectedParticipantSize : (int)bctbx_list_size(participantsAddresses),
|
||||
int, "%d");
|
||||
|
|
@ -353,9 +353,9 @@ static void group_chat_room_creation_server (void) {
|
|||
|
||||
// Marie now changes the subject
|
||||
linphone_chat_room_set_subject(marieCr, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr), newSubject);
|
||||
|
|
@ -366,9 +366,9 @@ static void group_chat_room_creation_server (void) {
|
|||
linphone_address_unref(paulineAddr);
|
||||
BC_ASSERT_PTR_NOT_NULL(paulineParticipant);
|
||||
linphone_chat_room_set_participant_admin_status(marieCr, paulineParticipant, TRUE);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participant_admin_statuses_changed, initialMarieStats.number_of_participant_admin_statuses_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participant_admin_statuses_changed, initialLaureStats.number_of_participant_admin_statuses_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participant_admin_statuses_changed, initialMarieStats.number_of_participant_admin_statuses_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participant_admin_statuses_changed, initialLaureStats.number_of_participant_admin_statuses_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_participant_is_admin(paulineParticipant));
|
||||
|
||||
// Pauline adds Chloe to the chat room
|
||||
|
|
@ -380,9 +380,9 @@ static void group_chat_room_creation_server (void) {
|
|||
|
||||
// Check that the chat room is correctly created on Chloe's side and that she was added everywhere
|
||||
LinphoneChatRoom *chloeCr = check_creation_chat_room_client_side(coresList, chloe, &initialChloeStats, confAddr, newSubject, 3, FALSE);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participants_added, initialMarieStats.number_of_participants_added + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participants_added, initialPaulineStats.number_of_participants_added + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participants_added, initialLaureStats.number_of_participants_added + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participants_added, initialMarieStats.number_of_participants_added + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participants_added, initialPaulineStats.number_of_participants_added + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participants_added, initialLaureStats.number_of_participants_added + 1, 3000));
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 3, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(paulineCr), 3, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(laureCr), 3, int, "%d");
|
||||
|
|
@ -393,7 +393,7 @@ static void group_chat_room_creation_server (void) {
|
|||
linphone_address_unref(marieAddr);
|
||||
BC_ASSERT_PTR_NOT_NULL(marieParticipant);
|
||||
linphone_chat_room_set_participant_admin_status(paulineCr, marieParticipant, FALSE);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 2, 3000));
|
||||
BC_ASSERT_FALSE(linphone_participant_is_admin(marieParticipant));
|
||||
|
||||
// Marie tries to change the subject again but is not admin, so it is not changed
|
||||
|
|
@ -402,18 +402,18 @@ static void group_chat_room_creation_server (void) {
|
|||
|
||||
// Chloe begins composing a message
|
||||
linphone_chat_room_compose(chloeCr);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingActiveReceived, initialMarieStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingActiveReceived, initialPaulineStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneIsComposingActiveReceived, initialLaureStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingActiveReceived, initialMarieStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingActiveReceived, initialPaulineStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneIsComposingActiveReceived, initialLaureStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
const char *chloeTextMessage = "Hello";
|
||||
LinphoneChatMessage *chloeMessage = _send_message(chloeCr, chloeTextMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDelivered, initialChloeStats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneMessageReceived, initialLaureStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingIdleReceived, initialMarieStats.number_of_LinphoneIsComposingIdleReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingIdleReceived, initialPaulineStats.number_of_LinphoneIsComposingIdleReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneIsComposingIdleReceived, initialLaureStats.number_of_LinphoneIsComposingIdleReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDelivered, initialChloeStats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneMessageReceived, initialLaureStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingIdleReceived, initialMarieStats.number_of_LinphoneIsComposingIdleReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingIdleReceived, initialPaulineStats.number_of_LinphoneIsComposingIdleReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneIsComposingIdleReceived, initialLaureStats.number_of_LinphoneIsComposingIdleReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(marie->stat.last_received_chat_message), chloeTextMessage);
|
||||
linphone_chat_message_unref(chloeMessage);
|
||||
LinphoneAddress *chloeAddr = linphone_address_new(linphone_core_get_identity(chloe->lc));
|
||||
|
|
@ -427,10 +427,10 @@ static void group_chat_room_creation_server (void) {
|
|||
BC_ASSERT_PTR_NOT_NULL(laureParticipant);
|
||||
linphone_chat_room_remove_participant(paulineCr, laureParticipant);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr), newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneChatRoomStateTerminated, initialLaureStats.number_of_LinphoneChatRoomStateTerminated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_participants_removed, initialChloeStats.number_of_participants_removed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participants_removed, initialMarieStats.number_of_participants_removed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participants_removed, initialPaulineStats.number_of_participants_removed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneChatRoomStateTerminated, initialLaureStats.number_of_LinphoneChatRoomStateTerminated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_participants_removed, initialChloeStats.number_of_participants_removed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participants_removed, initialMarieStats.number_of_participants_removed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participants_removed, initialPaulineStats.number_of_participants_removed + 1, 3000));
|
||||
|
||||
// Pauline removes Marie and Chloe from the chat room
|
||||
marieAddr = linphone_address_new(linphone_core_get_identity(marie->lc));
|
||||
|
|
@ -447,8 +447,8 @@ static void group_chat_room_creation_server (void) {
|
|||
participantsToRemove = bctbx_list_append(participantsToRemove, chloeParticipant);
|
||||
linphone_chat_room_remove_participants(paulineCr, participantsToRemove);
|
||||
bctbx_list_free_with_data(participantsToRemove, (bctbx_list_free_func)linphone_participant_unref);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateTerminated, initialMarieStats.number_of_LinphoneChatRoomStateTerminated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneChatRoomStateTerminated, initialChloeStats.number_of_LinphoneChatRoomStateTerminated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateTerminated, initialMarieStats.number_of_LinphoneChatRoomStateTerminated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneChatRoomStateTerminated, initialChloeStats.number_of_LinphoneChatRoomStateTerminated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participants_removed, initialPaulineStats.number_of_participants_removed + 2, 1000));
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(paulineCr), 0, int, "%d");
|
||||
|
||||
|
|
@ -456,7 +456,7 @@ static void group_chat_room_creation_server (void) {
|
|||
wait_for_list(coresList, &dummy, 1, 1000);
|
||||
linphone_chat_room_leave(paulineCr);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateTerminationPending, initialPaulineStats.number_of_LinphoneChatRoomStateTerminationPending + 1, 100));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateTerminated, initialPaulineStats.number_of_LinphoneChatRoomStateTerminated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateTerminated, initialPaulineStats.number_of_LinphoneChatRoomStateTerminated + 1, 3000));
|
||||
|
||||
// Clean db from chat room
|
||||
linphone_core_manager_delete_chat_room(marie, marieCr, coresList);
|
||||
|
|
@ -540,8 +540,8 @@ static void group_chat_room_add_participant (void) {
|
|||
|
||||
// Pauline begins composing a message
|
||||
linphone_chat_room_compose(paulineCr);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingActiveReceived, initialMarieStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneIsComposingActiveReceived, initialPaulineStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingActiveReceived, initialMarieStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneIsComposingActiveReceived, initialPaulineStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
|
||||
// Now, Chloe is upgrading to group chat client
|
||||
linphone_core_set_network_reachable(chloe->lc, FALSE);
|
||||
|
|
@ -562,9 +562,9 @@ static void group_chat_room_add_participant (void) {
|
|||
|
||||
// Check that the chat room is correctly created on Chloe's side and that she was added everywhere
|
||||
LinphoneChatRoom *chloeCr = check_creation_chat_room_client_side(coresList, chloe, &initialChloeStats, confAddr, initialSubject, 3, FALSE);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participants_added, initialMarieStats.number_of_participants_added + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participants_added, initialPaulineStats.number_of_participants_added + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participants_added, initialLaureStats.number_of_participants_added + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participants_added, initialMarieStats.number_of_participants_added + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participants_added, initialPaulineStats.number_of_participants_added + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participants_added, initialLaureStats.number_of_participants_added + 1, 3000));
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 3, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(paulineCr), 3, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(laureCr), 3, int, "%d");
|
||||
|
|
@ -679,14 +679,14 @@ static void group_chat_room_message (bool_t encrypt) {
|
|||
|
||||
// Chloe begins composing a message
|
||||
linphone_chat_room_compose(chloeCr);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingActiveReceived, initialMarieStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingActiveReceived, initialPaulineStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingActiveReceived, initialMarieStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingActiveReceived, initialPaulineStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
const char *chloeTextMessage = "Hello";
|
||||
LinphoneChatMessage *chloeMessage = _send_message(chloeCr, chloeTextMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingIdleReceived, initialMarieStats.number_of_LinphoneIsComposingIdleReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingIdleReceived, initialPaulineStats.number_of_LinphoneIsComposingIdleReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingIdleReceived, initialMarieStats.number_of_LinphoneIsComposingIdleReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingIdleReceived, initialPaulineStats.number_of_LinphoneIsComposingIdleReceived + 1, 3000));
|
||||
LinphoneChatMessage *marieLastMsg = marie->stat.last_received_chat_message;
|
||||
if (!BC_ASSERT_PTR_NOT_NULL(marieLastMsg))
|
||||
goto end;
|
||||
|
|
@ -699,14 +699,14 @@ static void group_chat_room_message (bool_t encrypt) {
|
|||
|
||||
// Pauline begins composing a messagewith some accents
|
||||
linphone_chat_room_compose(paulineCr);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingActiveReceived, initialMarieStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneIsComposingActiveReceived, initialChloeStats.number_of_LinphoneIsComposingActiveReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingActiveReceived, initialMarieStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneIsComposingActiveReceived, initialChloeStats.number_of_LinphoneIsComposingActiveReceived + 1, 3000));
|
||||
const char *paulineTextMessage = "Héllö Dàrling";
|
||||
LinphoneChatMessage *paulineMessage = _send_message(paulineCr, paulineTextMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageReceived, initialChloeStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingIdleReceived, initialMarieStats.number_of_LinphoneIsComposingIdleReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneIsComposingIdleReceived, initialChloeStats.number_of_LinphoneIsComposingIdleReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageReceived, initialChloeStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingIdleReceived, initialMarieStats.number_of_LinphoneIsComposingIdleReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneIsComposingIdleReceived, initialChloeStats.number_of_LinphoneIsComposingIdleReceived + 1, 3000));
|
||||
marieLastMsg = marie->stat.last_received_chat_message;
|
||||
if (!BC_ASSERT_PTR_NOT_NULL(marieLastMsg))
|
||||
goto end;
|
||||
|
|
@ -1097,9 +1097,9 @@ static void group_chat_room_change_subject (void) {
|
|||
|
||||
// Marie now changes the subject
|
||||
linphone_chat_room_set_subject(marieCr, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr), newSubject);
|
||||
|
|
@ -1148,9 +1148,9 @@ static void group_chat_room_change_subject_non_admin (void) {
|
|||
|
||||
// Marie now changes the subject
|
||||
linphone_chat_room_set_subject(paulineCr, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr), initialSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr), initialSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr), initialSubject);
|
||||
|
|
@ -1264,11 +1264,11 @@ static void group_chat_room_send_message_with_participant_removed (void) {
|
|||
LinphoneChatMessage *laureMessage = _send_message(laureCr, laureTextMessage);
|
||||
linphone_chat_message_unref(laureMessage);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageDelivered, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingIdleReceived, initialMarieStats.number_of_LinphoneIsComposingIdleReceived, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingIdleReceived, initialPaulineStats.number_of_LinphoneIsComposingIdleReceived, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageDelivered, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneIsComposingIdleReceived, initialMarieStats.number_of_LinphoneIsComposingIdleReceived, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneIsComposingIdleReceived, initialPaulineStats.number_of_LinphoneIsComposingIdleReceived, 3000));
|
||||
|
||||
end:
|
||||
// Clean db from chat room
|
||||
|
|
@ -1370,9 +1370,9 @@ static void group_chat_room_come_back_after_disconnection (void) {
|
|||
|
||||
// Marie now changes the subject
|
||||
linphone_chat_room_set_subject(marieCr, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr), newSubject);
|
||||
|
|
@ -1447,14 +1447,14 @@ static void group_chat_room_create_room_with_disconnected_friends_base (bool_t i
|
|||
goto end;
|
||||
|
||||
if (initial_message) {
|
||||
if (BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, 1, 10000))) {
|
||||
if (BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, 1, 3000))) {
|
||||
LinphoneChatMessage *msg = linphone_chat_room_get_last_message_in_history(paulineCr);
|
||||
if (BC_ASSERT_PTR_NOT_NULL(msg)) {
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(msg), "Salut");
|
||||
linphone_chat_message_unref(msg);
|
||||
}
|
||||
}
|
||||
if (BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneMessageReceived, 1, 10000))) {
|
||||
if (BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_LinphoneMessageReceived, 1, 3000))) {
|
||||
LinphoneChatMessage *msg = linphone_chat_room_get_last_message_in_history(laureCr);
|
||||
if (BC_ASSERT_PTR_NOT_NULL(msg)) {
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(msg), "Salut");
|
||||
|
|
@ -1723,9 +1723,9 @@ static void group_chat_room_notify_after_disconnection (void) {
|
|||
// Marie now changes the subject
|
||||
const char *newSubject = "New subject";
|
||||
linphone_chat_room_set_subject(marieCr, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr), newSubject);
|
||||
|
|
@ -1736,9 +1736,9 @@ static void group_chat_room_notify_after_disconnection (void) {
|
|||
// Marie now changes the subject
|
||||
newSubject = "Let's go drink a beer";
|
||||
linphone_chat_room_set_subject(marieCr, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 2, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 2, 3000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 2, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 2, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr), newSubject);
|
||||
BC_ASSERT_STRING_NOT_EQUAL(linphone_chat_room_get_subject(paulineCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr), newSubject);
|
||||
|
|
@ -1746,7 +1746,7 @@ static void group_chat_room_notify_after_disconnection (void) {
|
|||
linphone_core_set_network_reachable(pauline->lc, TRUE);
|
||||
wait_for_list(coresList, &dummy, 1, 1000);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 2, 3000));
|
||||
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr), newSubject);
|
||||
|
||||
|
|
@ -1757,9 +1757,9 @@ static void group_chat_room_notify_after_disconnection (void) {
|
|||
// Marie now changes the subject
|
||||
newSubject = "Let's go drink a mineral water !";
|
||||
linphone_chat_room_set_subject(marieCr, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 3, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 3, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 3, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 3, 3000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 3, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 3, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr), newSubject);
|
||||
BC_ASSERT_STRING_NOT_EQUAL(linphone_chat_room_get_subject(paulineCr), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr), newSubject);
|
||||
|
|
@ -1781,7 +1781,7 @@ static void group_chat_room_notify_after_disconnection (void) {
|
|||
linphone_core_set_network_reachable(pauline->lc, TRUE);
|
||||
wait_for_list(coresList, &dummy, 1, 1000);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 3, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 3, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr), newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 1, 1000));
|
||||
BC_ASSERT_TRUE(linphone_participant_is_admin(laureParticipantFromPauline));
|
||||
|
|
@ -1893,7 +1893,6 @@ static void group_chat_room_send_refer_to_all_devices (void) {
|
|||
linphone_core_manager_destroy(laure);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void group_chat_room_add_device (void) {
|
||||
LinphoneCoreManager *marie1 = linphone_core_manager_create("marie_rc");
|
||||
LinphoneCoreManager *pauline1 = linphone_core_manager_create("pauline_rc");
|
||||
|
|
@ -1997,7 +1996,6 @@ static void group_chat_room_add_device (void) {
|
|||
linphone_core_manager_destroy(pauline2);
|
||||
linphone_core_manager_destroy(laure);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void multiple_is_composing_notification(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_create("marie_rc");
|
||||
|
|
@ -2146,8 +2144,8 @@ static void group_chat_room_fallback_to_basic_chat_room (void) {
|
|||
linphone_chat_room_add_participants(marieCr, participantsAddresses);
|
||||
|
||||
// Check that the group chat room creation fails and that a fallback to a basic chat room is done
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneChatRoomStateCreationFailed, initialMarieStats.number_of_LinphoneChatRoomStateCreationFailed, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 1, int, "%d");
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesBasic);
|
||||
|
|
@ -2202,8 +2200,8 @@ static void group_chat_room_creation_fails_if_invited_participants_dont_support_
|
|||
linphone_chat_room_add_participants(marieCr, participantsAddresses);
|
||||
|
||||
// Check that the group chat room creation fails
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationFailed, initialMarieStats.number_of_LinphoneChatRoomStateCreationFailed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationFailed, initialMarieStats.number_of_LinphoneChatRoomStateCreationFailed + 1, 3000));
|
||||
bctbx_list_free_with_data(participantsAddresses, (bctbx_list_free_func)linphone_address_unref);
|
||||
participantsAddresses = NULL;
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_state(marieCr), LinphoneChatRoomStateCreationFailed, int, "%d");
|
||||
|
|
@ -2307,16 +2305,16 @@ static void group_chat_room_migrate_from_basic_chat_room (void) {
|
|||
msg = linphone_chat_room_create_message(marieCr, "Did you migrate?");
|
||||
linphone_chat_message_send(msg);
|
||||
linphone_chat_message_unref(msg);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomAllInformationReceived, initialMarieStats.number_of_LinphoneChatRoomAllInformationReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomAllInformationReceived, initialMarieStats.number_of_LinphoneChatRoomAllInformationReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesConference);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 1, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(marieCr), 2, int, "%d");
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreationPending, initialPaulineStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreated, initialPaulineStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomAllInformationReceived, initialPaulineStats.number_of_LinphoneChatRoomAllInformationReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreationPending, initialPaulineStats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreated, initialPaulineStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomAllInformationReceived, initialPaulineStats.number_of_LinphoneChatRoomAllInformationReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(paulineCr) & LinphoneChatRoomCapabilitiesConference);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(paulineCr), 1, int, "%d");
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 1000));
|
||||
|
|
@ -2374,8 +2372,8 @@ static void group_chat_room_migrate_from_basic_to_client_fail (void) {
|
|||
linphone_chat_room_add_participants(marieCr, participantsAddresses);
|
||||
|
||||
// Check that the group chat room creation fails and that a fallback to a basic chat room is done
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneChatRoomStateCreationFailed, initialMarieStats.number_of_LinphoneChatRoomStateCreationFailed, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 1, int, "%d");
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesBasic);
|
||||
|
|
@ -2455,16 +2453,16 @@ static void group_chat_room_migrate_from_basic_to_client_fail (void) {
|
|||
msg = linphone_chat_room_create_message(marieCr, "And now, did you migrate?");
|
||||
linphone_chat_message_send(msg);
|
||||
linphone_chat_message_unref(msg);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomAllInformationReceived, initialMarieStats.number_of_LinphoneChatRoomAllInformationReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 2, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomAllInformationReceived, initialMarieStats.number_of_LinphoneChatRoomAllInformationReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesConference);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 1, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(marieCr), 5, int, "%d");
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreationPending, initialPaulineStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreated, initialPaulineStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomAllInformationReceived, initialPaulineStats.number_of_LinphoneChatRoomAllInformationReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreationPending, initialPaulineStats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreated, initialPaulineStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomAllInformationReceived, initialPaulineStats.number_of_LinphoneChatRoomAllInformationReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(paulineCr) & LinphoneChatRoomCapabilitiesConference);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(paulineCr), 1, int, "%d");
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 3, 1000));
|
||||
|
|
@ -2527,13 +2525,13 @@ static void group_chat_donot_room_migrate_from_basic_chat_room (void) {
|
|||
msg = linphone_chat_room_create_message(marieCr, "Did you migrate?");
|
||||
linphone_chat_message_send(msg);
|
||||
linphone_chat_message_unref(msg);
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesBasic);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 1, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(marieCr), 2, int, "%d");
|
||||
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreationPending, initialPaulineStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreationPending, initialPaulineStats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreated, initialPaulineStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(paulineCr) & LinphoneChatRoomCapabilitiesBasic);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(paulineCr), 1, int, "%d");
|
||||
|
|
@ -2676,8 +2674,8 @@ static void group_chat_room_unique_one_to_one_chat_room (void) {
|
|||
// Marie sends a message
|
||||
const char *textMessage = "Hello";
|
||||
LinphoneChatMessage *message = _send_message(marieCr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(pauline->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
|
|
@ -2695,8 +2693,8 @@ static void group_chat_room_unique_one_to_one_chat_room (void) {
|
|||
// Marie sends a new message
|
||||
textMessage = "Hey again";
|
||||
message = _send_message(marieCr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(pauline->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
|
|
@ -2742,8 +2740,8 @@ static void group_chat_room_unique_one_to_one_chat_room_recreated_from_message_b
|
|||
// Marie sends a message
|
||||
const char *textMessage = "Hello";
|
||||
LinphoneChatMessage *message = _send_message(marieCr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(pauline->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
|
|
@ -2774,8 +2772,8 @@ static void group_chat_room_unique_one_to_one_chat_room_recreated_from_message_b
|
|||
// Pauline sends a new message
|
||||
textMessage = "Hey you";
|
||||
message = _send_message(paulineCr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageDelivered, initialPaulineStats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageDelivered, initialPaulineStats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(marie->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
|
|
@ -2846,8 +2844,8 @@ static void group_chat_room_unique_one_to_one_chat_room_recreated_from_message_2
|
|||
// Marie sends a message
|
||||
const char *textMessage = "Hello";
|
||||
LinphoneChatMessage *message = _send_message(marieCr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(pauline->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
|
|
@ -2869,8 +2867,8 @@ static void group_chat_room_unique_one_to_one_chat_room_recreated_from_message_2
|
|||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesOneToOne);
|
||||
textMessage = "Hey you";
|
||||
message = _send_message(marieCr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageDelivered, initialMarieStats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(pauline->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
}
|
||||
|
|
@ -2880,8 +2878,11 @@ static void group_chat_room_unique_one_to_one_chat_room_recreated_from_message_2
|
|||
linphone_core_set_network_reachable(pauline2->lc, TRUE);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie2->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarie2Stats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie2->stat.number_of_LinphoneChatRoomStateCreated, initialMarie2Stats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie2->stat.number_of_LinphoneChatRoomAllInformationReceived, initialMarie2Stats.number_of_LinphoneChatRoomAllInformationReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline2->stat.number_of_LinphoneChatRoomStateCreationPending, initialPauline2Stats.number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline2->stat.number_of_LinphoneChatRoomStateCreated, initialPauline2Stats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline2->stat.number_of_LinphoneChatRoomAllInformationReceived, initialPauline2Stats.number_of_LinphoneChatRoomAllInformationReceived + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline2->stat.number_of_LinphoneMessageReceived, initialPauline2Stats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
linphone_core_manager_delete_chat_room(marie, marieCr, coresList);
|
||||
linphone_core_manager_delete_chat_room(pauline, paulineCr, coresList);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateTerminated, initialMarieStats.number_of_LinphoneChatRoomStateTerminated + 1, 3000));
|
||||
|
|
@ -2929,16 +2930,16 @@ static void group_chat_room_join_one_to_one_chat_room_with_a_new_device (void) {
|
|||
// Marie1 sends a message
|
||||
const char *textMessage = "Hello";
|
||||
LinphoneChatMessage *message = _send_message(marie1Cr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie1->stat.number_of_LinphoneMessageDelivered, initialMarie1Stats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie1->stat.number_of_LinphoneMessageDelivered, initialMarie1Stats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(pauline->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
// Pauline answers to the previous message
|
||||
textMessage = "Hey. How are you?";
|
||||
message = _send_message(paulineCr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageDelivered, initialPaulineStats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie1->stat.number_of_LinphoneMessageReceived, initialMarie1Stats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageDelivered, initialPaulineStats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie1->stat.number_of_LinphoneMessageReceived, initialMarie1Stats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(marie1->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
|
|
@ -2961,16 +2962,16 @@ static void group_chat_room_join_one_to_one_chat_room_with_a_new_device (void) {
|
|||
// Marie2 sends a new message
|
||||
textMessage = "Fine and you?";
|
||||
message = _send_message(marie2Cr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie2->stat.number_of_LinphoneMessageDelivered, initialMarie2Stats.number_of_LinphoneMessageDelivered + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie2->stat.number_of_LinphoneMessageDelivered, initialMarie2Stats.number_of_LinphoneMessageDelivered + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 2, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(pauline->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
// Pauline answers to the previous message
|
||||
textMessage = "Perfect!";
|
||||
message = _send_message(paulineCr, textMessage);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageDelivered, initialPaulineStats.number_of_LinphoneMessageDelivered + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie2->stat.number_of_LinphoneMessageReceived, initialMarie2Stats.number_of_LinphoneMessageReceived + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageDelivered, initialPaulineStats.number_of_LinphoneMessageDelivered + 2, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie2->stat.number_of_LinphoneMessageReceived, initialMarie2Stats.number_of_LinphoneMessageReceived + 1, 3000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(marie2->stat.last_received_chat_message), textMessage);
|
||||
linphone_chat_message_unref(message);
|
||||
|
||||
|
|
@ -3377,7 +3378,7 @@ static void find_one_to_one_chat_room (void) {
|
|||
// Chloe leave the chat room
|
||||
linphone_chat_room_leave(chloeCr);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneChatRoomStateTerminationPending, initialChloeStats.number_of_LinphoneChatRoomStateTerminationPending + 1, 100));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneChatRoomStateTerminated, initialChloeStats.number_of_LinphoneChatRoomStateTerminated + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneChatRoomStateTerminated, initialChloeStats.number_of_LinphoneChatRoomStateTerminated + 1, 3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participants_removed, initialPaulineStats.number_of_participants_removed + 1, 1000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participants_removed, initialMarieStats.number_of_participants_removed + 1, 1000));
|
||||
|
||||
|
|
@ -3690,8 +3691,7 @@ test_t group_chat_tests[] = {
|
|||
TEST_NO_TAG("Reinvited after removed from group chat room with several devices", group_chat_room_reinvited_after_removed_with_several_devices),
|
||||
TEST_NO_TAG("Notify after disconnection", group_chat_room_notify_after_disconnection),
|
||||
TEST_NO_TAG("Send refer to all participants devices", group_chat_room_send_refer_to_all_devices),
|
||||
// TODO: Use when we support adding a new device in created conf
|
||||
//TEST_ONE_TAGS("Admin add device and doesn't lose admin status", group_chat_room_add_device, "LeaksMemory"),
|
||||
TEST_NO_TAG("Admin add device and doesn't lose admin status", group_chat_room_add_device),
|
||||
TEST_NO_TAG("Send multiple is composing", multiple_is_composing_notification),
|
||||
TEST_ONE_TAG("Fallback to basic chat room", group_chat_room_fallback_to_basic_chat_room, "LeaksMemory"),
|
||||
TEST_NO_TAG("Group chat room creation fails if invited participants don't support it", group_chat_room_creation_fails_if_invited_participants_dont_support_it),
|
||||
|
|
|
|||
|
|
@ -868,12 +868,13 @@ static void long_term_presence_phone_alias(void) {
|
|||
}
|
||||
|
||||
static const char* random_phone_number(void) {
|
||||
static char phone[10];
|
||||
static char phone[11];
|
||||
int i;
|
||||
phone[0] = '+';
|
||||
for (i = 1; i < 10; i++) {
|
||||
phone[i] = '0' + rand() % 10;
|
||||
}
|
||||
phone[10] = '\0';
|
||||
return phone;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,9 @@ static void quality_reporting_not_sent_if_low_bandwidth (void) {
|
|||
static void on_report_send_remove_fields (const LinphoneCall *call, SalStreamType stream_type, const LinphoneContent *content) {
|
||||
char *body = bctbx_strdup(linphone_content_get_string_buffer(content));
|
||||
/* Corrupt start of the report */
|
||||
strncpy(body, "corrupted report is corrupted", strlen("corrupted report is corrupted"));
|
||||
const char *corrupted_str = "corrupted report is corrupted";
|
||||
size_t corrupted_len = strlen(corrupted_str);
|
||||
strncpy(body, corrupted_str, corrupted_len);
|
||||
linphone_content_set_string_buffer((LinphoneContent *)content, body);
|
||||
bctbx_free(body);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -482,6 +482,29 @@ static void custom_tones_setup(void){
|
|||
linphone_core_manager_destroy(mgr);
|
||||
}
|
||||
|
||||
static void search_friend_without_filter(void) {
|
||||
LinphoneMagicSearch *magicSearch = NULL;
|
||||
bctbx_list_t *resultList = NULL;
|
||||
LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE);
|
||||
LinphoneFriendList *lfl = linphone_core_get_default_friend_list(manager->lc);
|
||||
|
||||
_create_friends_from_tab(manager->lc, lfl, sFriends, sSizeFriend);
|
||||
|
||||
magicSearch = linphone_magic_search_new(manager->lc);
|
||||
|
||||
resultList = linphone_magic_search_get_contact_list_from_filter(magicSearch, "", "");
|
||||
|
||||
if (BC_ASSERT_PTR_NOT_NULL(resultList)) {
|
||||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), S_SIZE_FRIEND, int, "%d");
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
|
||||
linphone_magic_search_unref(magicSearch);
|
||||
linphone_core_manager_destroy(manager);
|
||||
}
|
||||
|
||||
static void search_friend_all_domains(void) {
|
||||
LinphoneMagicSearch *magicSearch = NULL;
|
||||
bctbx_list_t *resultList = NULL;
|
||||
|
|
@ -630,8 +653,19 @@ static void search_friend_with_phone_number(void) {
|
|||
|
||||
if (BC_ASSERT_PTR_NOT_NULL(resultList)) {
|
||||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 3, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[11], NULL);//"sip:+111223344@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, sFriends[10], NULL);//"sip:+33655667788@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[11], NULL);//"sip:+33655667788@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, sFriends[10], NULL);//"sip:+111223344@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 2, sFriends[5], NULL);//"sip:marie@sip.example.org"
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
linphone_magic_search_reset_search_cache(magicSearch);
|
||||
|
||||
resultList = linphone_magic_search_get_contact_list_from_filter(magicSearch, "5566", "");
|
||||
|
||||
if (BC_ASSERT_PTR_NOT_NULL(resultList)) {
|
||||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, sFriends[11], NULL);//"sip:+33655667788@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 2, sFriends[5], NULL);//"sip:marie@sip.example.org"
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
|
@ -846,6 +880,59 @@ static void search_friend_with_name(void) {
|
|||
linphone_core_manager_destroy(manager);
|
||||
}
|
||||
|
||||
static void search_friend_with_name_with_uppercase(void) {
|
||||
LinphoneMagicSearch *magicSearch = NULL;
|
||||
bctbx_list_t *resultList = NULL;
|
||||
LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE);
|
||||
LinphoneFriendList *lfl = linphone_core_get_default_friend_list(manager->lc);
|
||||
const char *stephanie1SipUri = {"sip:toto@sip.example.org"};
|
||||
const char *stephanie2SipUri = {"sip:stephanie@sip.example.org"};
|
||||
LinphoneFriend *stephanie1Friend = linphone_core_create_friend(manager->lc);
|
||||
LinphoneFriend *stephanie2Friend = linphone_core_create_friend(manager->lc);
|
||||
LinphoneVcard *stephanie1Vcard = linphone_factory_create_vcard(linphone_factory_get());
|
||||
LinphoneVcard *stephanie2Vcard = linphone_factory_create_vcard(linphone_factory_get());
|
||||
const char *stephanie1Name = {"STEPHANIE delarue"};
|
||||
const char *stephanie2Name = {"alias delarue"};
|
||||
|
||||
_create_friends_from_tab(manager->lc, lfl, sFriends, sSizeFriend);
|
||||
|
||||
linphone_vcard_set_full_name(stephanie1Vcard, stephanie1Name); // STEPHANIE delarue
|
||||
linphone_vcard_set_url(stephanie1Vcard, stephanie1SipUri); //sip:toto@sip.example.org
|
||||
linphone_vcard_add_sip_address(stephanie1Vcard, stephanie1SipUri);
|
||||
linphone_friend_set_vcard(stephanie1Friend, stephanie1Vcard);
|
||||
linphone_core_add_friend(manager->lc, stephanie1Friend);
|
||||
|
||||
linphone_vcard_set_full_name(stephanie2Vcard, stephanie2Name); // alias delarue
|
||||
linphone_vcard_set_url(stephanie2Vcard, stephanie2SipUri); //sip:stephanie@sip.example.org
|
||||
linphone_vcard_add_sip_address(stephanie2Vcard, stephanie2SipUri);
|
||||
linphone_friend_set_vcard(stephanie2Friend, stephanie2Vcard);
|
||||
linphone_core_add_friend(manager->lc, stephanie2Friend);
|
||||
|
||||
magicSearch = linphone_magic_search_new(manager->lc);
|
||||
|
||||
resultList = linphone_magic_search_get_contact_list_from_filter(magicSearch, "stephanie", "");
|
||||
|
||||
if (BC_ASSERT_PTR_NOT_NULL(resultList)) {
|
||||
BC_ASSERT_EQUAL(bctbx_list_size(resultList), 2, int, "%d");
|
||||
_check_friend_result_list(manager->lc, resultList, 0, stephanie1SipUri, NULL);//"sip:toto@sip.example.org"
|
||||
_check_friend_result_list(manager->lc, resultList, 1, stephanie2SipUri, NULL);//"sip:stephanie@sip.example.org"
|
||||
bctbx_list_free_with_data(resultList, (bctbx_list_free_func)linphone_magic_search_unref);
|
||||
}
|
||||
|
||||
linphone_magic_search_reset_search_cache(magicSearch);
|
||||
|
||||
_remove_friends_from_list(lfl, sFriends, sSizeFriend);
|
||||
linphone_friend_list_remove_friend(lfl, stephanie1Friend);
|
||||
linphone_friend_list_remove_friend(lfl, stephanie2Friend);
|
||||
if (stephanie1Friend) linphone_friend_unref(stephanie1Friend);
|
||||
if (stephanie2Friend) linphone_friend_unref(stephanie2Friend);
|
||||
if (stephanie1Vcard) linphone_vcard_unref(stephanie1Vcard);
|
||||
if (stephanie2Vcard) linphone_vcard_unref(stephanie2Vcard);
|
||||
|
||||
linphone_magic_search_unref(magicSearch);
|
||||
linphone_core_manager_destroy(manager);
|
||||
}
|
||||
|
||||
static void search_friend_large_database(void) {
|
||||
char *dbPath = bc_tester_res("db/friends.db");
|
||||
char *searchedFriend = "6295103032641994169";
|
||||
|
|
@ -891,6 +978,7 @@ test_t setup_tests[] = {
|
|||
TEST_NO_TAG("Codec usability", codec_usability_test),
|
||||
TEST_NO_TAG("Codec setup", codec_setup),
|
||||
TEST_NO_TAG("Custom tones setup", custom_tones_setup),
|
||||
TEST_ONE_TAG("Search friend without filter", search_friend_without_filter, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend from all domains", search_friend_all_domains, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend from one domain", search_friend_one_domain, "MagicSearch"),
|
||||
TEST_ONE_TAG("Multiple looking for friends with the same cache", search_friend_research_estate, "MagicSearch"),
|
||||
|
|
@ -900,6 +988,7 @@ test_t setup_tests[] = {
|
|||
TEST_ONE_TAG("Search friend in call log", search_friend_in_call_log, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend last item is the filter", search_friend_last_item_is_filter, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend with name", search_friend_with_name, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend with uppercase name", search_friend_with_name_with_uppercase, "MagicSearch"),
|
||||
TEST_ONE_TAG("Search friend in large friends database", search_friend_large_database, "MagicSearch")
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#define L_ENABLE_ATTR_ACCESS(CLASS, ATTR_TYPE, ATTR_NAME) \
|
||||
template<typename AttrSpy, ATTR_TYPE CLASS::*Attr> \
|
||||
struct L_INTERNAL_STRUCT_L_ATTR_GET(CLASS, ATTR_NAME) { \
|
||||
friend constexpr ATTR_TYPE (CLASS::*get(AttrSpy *)) { \
|
||||
friend constexpr ATTR_TYPE CLASS::*get(AttrSpy *) { \
|
||||
return Attr; \
|
||||
} \
|
||||
}; \
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
struct L_INTERNAL_STRUCT_ATTR_SPY(ATTR_NAME); \
|
||||
template<> \
|
||||
struct L_INTERNAL_STRUCT_ATTR_SPY(ATTR_NAME)<CLASS> { \
|
||||
friend constexpr ATTR_TYPE (CLASS::*get(L_INTERNAL_STRUCT_ATTR_SPY(ATTR_NAME)<CLASS> *)); \
|
||||
friend constexpr ATTR_TYPE CLASS::*get(L_INTERNAL_STRUCT_ATTR_SPY(ATTR_NAME)<CLASS> *); \
|
||||
}; \
|
||||
template struct L_INTERNAL_STRUCT_L_ATTR_GET(CLASS, ATTR_NAME)< \
|
||||
L_INTERNAL_STRUCT_ATTR_SPY(ATTR_NAME)<CLASS>, \
|
||||
|
|
|
|||
|
|
@ -683,9 +683,11 @@ class SandCastleTranslator(Translator):
|
|||
if len(lines) > 0:
|
||||
lines.insert(0, '<summary>')
|
||||
lines.append('</summary>')
|
||||
|
||||
def translate_reference(self, ref):
|
||||
|
||||
def translate_function_reference(self, ref):
|
||||
refStr = Translator.translate_reference(self, ref, absName=True)
|
||||
return '<see cref="{0}()" />'.format(refStr)
|
||||
|
||||
def translate_class_reference(self, ref):
|
||||
refStr = Translator.translate_reference(self, ref, absName=True)
|
||||
if isinstance(ref, FunctionReference):
|
||||
refStr += '()'
|
||||
return '<see cref="{0}" />'.format(refStr)
|
||||
|
|
|
|||
|
|
@ -491,13 +491,7 @@ if __name__ == '__main__':
|
|||
parser = AbsApi.CParser(project)
|
||||
parser.functionBl = \
|
||||
['linphone_vcard_get_belcard',\
|
||||
'linphone_core_get_current_vtable',\
|
||||
'linphone_call_set_native_video_window_id',\
|
||||
'linphone_call_get_native_video_window_id',\
|
||||
'linphone_core_get_native_preview_window_id',\
|
||||
'linphone_core_set_native_preview_window_id',\
|
||||
'linphone_core_set_native_video_window_id',\
|
||||
'linphone_core_get_native_video_window_id']
|
||||
'linphone_core_get_current_vtable']
|
||||
parser.classBl += 'LinphoneCoreVTable'
|
||||
parser.methodBl.remove('getCurrentCallbacks')
|
||||
parser.parse_all()
|
||||
|
|
|
|||
|
|
@ -183,7 +183,11 @@ namespace Linphone
|
|||
obj.nativePtr = ptr;
|
||||
obj.handle = GCHandle.Alloc(obj, GCHandleType.WeakTrackResurrection);
|
||||
objPtr = GCHandle.ToIntPtr(obj.handle);
|
||||
#if WINDOWS_UWP
|
||||
belle_sip_object_data_set(ptr, "cs_obj", objPtr, IntPtr.Zero);
|
||||
#else
|
||||
belle_sip_object_data_set(ptr, "cs_obj", objPtr, null);
|
||||
#endif
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
|
@ -377,13 +381,9 @@ namespace Linphone
|
|||
}
|
||||
{{/isLinphoneFactory}}
|
||||
{{#isLinphoneCall}}
|
||||
[DllImport(LinphoneWrapper.LIB_NAME)]
|
||||
static extern IntPtr linphone_call_get_native_video_window_id(IntPtr thiz);
|
||||
[DllImport(LinphoneWrapper.LIB_NAME)]
|
||||
static extern void linphone_call_set_native_video_window_id(IntPtr thiz, IntPtr id);
|
||||
|
||||
/// Get the native window handle of the video window, casted as an unsigned long.
|
||||
public string NativeVideoWindowId
|
||||
public string NativeVideoWindowIdString
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -396,13 +396,9 @@ namespace Linphone
|
|||
}
|
||||
{{/isLinphoneCall}}
|
||||
{{#isLinphoneCore}}
|
||||
[DllImport(LinphoneWrapper.LIB_NAME)]
|
||||
static extern IntPtr linphone_core_get_native_video_window_id(IntPtr thiz);
|
||||
[DllImport(LinphoneWrapper.LIB_NAME)]
|
||||
static extern void linphone_core_set_native_video_window_id(IntPtr thiz, IntPtr id);
|
||||
|
||||
/// Get the native window handle of the video window.
|
||||
public string NativeVideoWindowId
|
||||
public string NativeVideoWindowIdString
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -414,13 +410,8 @@ namespace Linphone
|
|||
}
|
||||
}
|
||||
|
||||
[DllImport(LinphoneWrapper.LIB_NAME)]
|
||||
static extern IntPtr linphone_core_get_native_preview_window_id(IntPtr thiz);
|
||||
[DllImport(LinphoneWrapper.LIB_NAME)]
|
||||
static extern void linphone_core_set_native_preview_window_id(IntPtr thiz, IntPtr id);
|
||||
|
||||
/// Get the native window handle of the video preview window.
|
||||
public string NativePreviewWindowId
|
||||
public string NativePreviewWindowIdString
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue