当前位置:   article > 正文

linphone-LinphoneProxyConfigImpl文件对应的JNI层文件分析_prxcfg.enableavpf

prxcfg.enableavpf

说明

这个主要是被linphonecore调用,其数据是存储在文件中的.

个人说明

从上一篇开始, 本系列作为linphone下c语言的函数追踪, 一是对整体的代码结构做一些了解, 二是按着顺序来做体会一下c的代码,有更深一层次的了解, 三是把本系列作为后面分析逻辑的时候,作为工具字典进行使用.

内容比较长, 先给自己打一个定海神针. 本系列就是作为工具用的.所以慢慢坚持下来慢慢找.

官方说明

/**
 * The LinphoneProxyConfig object represents a proxy configuration to be used by the LinphoneCore object. Its fields must not be used directly in favour of the accessors methods.
 * Once created and filled properly the LinphoneProxyConfig can be given to LinphoneCore with {@link LinphoneCore#addProxyConfig(LinphoneProxyConfig)}. This will automatically triggers the registration, if enabled.
 *<br>The proxy configuration are persistent to restarts because they are saved in the configuration file. As a consequence, after {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)} there might already be a default proxy that can be examined with {@link LinphoneCore#getDefaultProxyConfig()} .
 *
 */
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

解释

UML 类图

LinphoneProxyConfigImpl

native 函数

private native void finalize(long ptr);
private native int getState(long nativePtr);
private native void setExpires(long nativePtr, int delay);
private native int getExpires(long nativePtr);
private native long createProxyConfig( long nativePtr);


private native long newLinphoneProxyConfig();

private native void edit(long ptr);
private native void done(long ptr);

private native void setIdentity(long ptr,String identity);
private native String getIdentity(long ptr);
private native void setAddress(long ptr, long address);
private native long getAddress(long ptr);
private native int setProxy(long ptr,String proxy);
private native String getProxy(long ptr);


private native void enableRegister(long ptr,boolean value);
private native boolean isRegisterEnabled(long ptr);

private native boolean isRegistered(long ptr);
private native void setDialPrefix(long ptr, String prefix);
private native String getDialPrefix(long ptr);

private native String normalizePhoneNumber(long ptr,String number);
private native long normalizeSipUri(long ptr,String username);

private native String getDomain(long ptr);

private native void setDialEscapePlus(long ptr, boolean value);
private native boolean getDialEscapePlus(long ptr);

private native String getRoute(long ptr);
private native int setRoute(long ptr,String uri);
private native void enablePublish(long ptr,boolean enable);
private native boolean publishEnabled(long ptr);
private native void setContactParameters(long ptr, String params);

private native int lookupCCCFromIso(long nativePtr, String iso);
private native int lookupCCCFromE164(long nativePtr, String e164);

private native int getError(long nativeptr);

private native void setPrivacy(long nativePtr, int mask);

private native int getPrivacy(long nativePtr);

private native void enableAvpf(long nativePtr, boolean enable);

private native boolean avpfEnabled(long nativePtr);

private native void setAvpfRRInterval(long nativePtr, int interval);

private native int getAvpfRRInterval(long nativePtr);

private native String getContactParameters(long ptr);

private native void setContactUriParameters(long ptr, String params);

private native String getContactUriParameters(long ptr);


private native long getErrorInfo(long nativePtr);

private native void enableQualityReporting(long nativePtr, boolean enable);


private native boolean qualityReportingEnabled(long nativePtr);

private native void setQualityReportingInterval(long nativePtr, int interval);

private native int getQualityReportingInterval(long nativePtr);

private native void setQualityReportingCollector(long nativePtr, String collector);

private native String getQualityReportingCollector(long nativePtr);

private native void setRealm(long nativePtr, String realm);

private native String getRealm(long nativePtr);

private native void setPublishExpires(long nativePtr, int expires);

private native int getPublishExpires(long nativePtr);

private native boolean isPhoneNumber(long nativePtr,String username);


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92

finalize

extern "C" void  Java_org_linphone_core_LinphoneProxyConfigImpl_finalize(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    LinphoneProxyConfig *proxy=(LinphoneProxyConfig*)ptr;
    linphone_proxy_config_set_user_data(proxy,NULL);
    linphone_proxy_config_unref(proxy);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

LinphoneProxyConfig

submodules/linphone/coreapi/private.h:struct _LinphoneProxyConfig
  • 1
struct _LinphoneProxyConfig
{
    belle_sip_object_t base;
    void *user_data;
    struct _LinphoneCore *lc;
    char *reg_proxy;
    char *reg_identity;
    LinphoneAddress* identity_address;
    char *reg_route;
    char *quality_reporting_collector;
    char *realm;
    char *contact_params;
    char *contact_uri_params;
    int expires;
    int publish_expires;
    SalOp *op;
    SalCustomHeader *sent_headers;
    char *type;
    struct _SipSetupContext *ssctx;
    int auth_failures;
    char *dial_prefix;
    LinphoneRegistrationState state;
    LinphoneAVPFMode avpf_mode;

    bool_t commit;
    bool_t reg_sendregister;
    bool_t publish;
    bool_t dial_escape_plus;

    bool_t send_publish;
    bool_t quality_reporting_enabled;
    uint8_t avpf_rr_interval;
    uint8_t quality_reporting_interval;

    time_t deletion_date;
    LinphonePrivacyMask privacy;
    /*use to check if server config has changed  between edit() and done()*/
    LinphoneAddress *saved_proxy;
    LinphoneAddress *saved_identity;
    /*---*/
    LinphoneAddress *pending_contact; /*use to store previous contact in case of network failure*/
    LinphoneEvent *long_term_event;
    unsigned long long previous_publish_config_hash[2];

};
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45

SalCustomHeader

submodules/linphone/include/sal/sal.h:struct SalCustomHeader;
submodules/linphone/include/sal/sal.h:typedef struct SalCustomHeader SalCustomHeader;
  • 1
  • 2

LinphoneRegistrationState

submodules/linphone/coreapi/linphonecore.h:typedef enum _LinphoneRegistrationState{
submodules/linphone/coreapi/linphonecore.h:}LinphoneRegistrationState;
  • 1
  • 2
/**
 * LinphoneRegistrationState describes proxy registration states.
**/
typedef enum _LinphoneRegistrationState{
    LinphoneRegistrationNone, /**<Initial state for registrations */
    LinphoneRegistrationProgress, /**<Registration is in progress */
    LinphoneRegistrationOk, /**< Registration is successful */
    LinphoneRegistrationCleared, /**< Unregistration succeeded */
    LinphoneRegistrationFailed  /**<Registration failed */
}LinphoneRegistrationState;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

LinphoneAVPFMode

/**
 * Enum describing RTP AVPF activation modes.
**/
enum _LinphoneAVPFMode{
    LinphoneAVPFDefault=-1, /**<Use default value defined at upper level*/
    LinphoneAVPFDisabled, /**<AVPF is disabled*/
    LinphoneAVPFEnabled /**<AVPF is enabled */
};
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

LinphonePrivacyMask

submodules/linphone/coreapi/linphonecore.h:typedef unsigned int LinphonePrivacyMask;
  • 1

LinphoneEvent

submodules/linphone/coreapi/event.h:struct _LinphoneEvent;
submodules/linphone/coreapi/event.h:typedef struct _LinphoneEvent LinphoneEvent;
submodules/linphone/coreapi/private.h:struct _LinphoneEvent{
  • 1
  • 2
  • 3
struct _LinphoneEvent{
    belle_sip_object_t base;
    LinphoneSubscriptionDir dir;
    LinphoneCore *lc;
    SalOp *op;
    SalCustomHeader *send_custom_headers;
    LinphoneSubscriptionState subscription_state;
    LinphonePublishState publish_state;
    void *userdata;
    char *name;
    int expires;
    bool_t terminating;
    bool_t is_out_of_dialog_op; /*used for out of dialog notify*/
    bool_t internal;
};
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

linphone_proxy_config_set_user_data

submodules/linphone/coreapi/linphone_proxy_config.h:LINPHONE_PUBLIC void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cfg, void *ud);
submodules/linphone/coreapi/proxy.c:void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cfg, void *ud) {
  • 1
  • 2
void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cfg, void *ud) {
    cfg->user_data = ud;
}
  • 1
  • 2
  • 3

getState

extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState(   JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    return (jint)linphone_call_get_state((LinphoneCall*)ptr);
}
  • 1
  • 2
  • 3
  • 4
  • 5

linphone_call_get_state

submodules/linphone/coreapi/linphonecall.c:LinphoneCallState linphone_call_get_state(const LinphoneCall *call){
  • 1

/**
 * Retrieves the call's current state.
**/
LinphoneCallState linphone_call_get_state(const LinphoneCall *call){
    return call->state;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

setExpires

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setExpires(JNIEnv*  env,jobject thiz,jlong ptr,jint delay) {
    linphone_proxy_config_set_expires((LinphoneProxyConfig *) ptr, (int) delay);
}
  • 1
  • 2
  • 3

linphone_proxy_config_set_expires

submodules/linphone/coreapi/proxy.c:void linphone_proxy_config_set_expires(LinphoneProxyConfig *cfg, int val){
  • 1
  • 2
void linphone_proxy_config_set_expires(LinphoneProxyConfig *cfg, int val){
    if (val<0) val=600;
    cfg->expires=val;
}
  • 1
  • 2
  • 3
  • 4

getExpires

extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_getExpires(JNIEnv*  env,jobject thiz,jlong ptr) {
    return linphone_proxy_config_get_expires((LinphoneProxyConfig *) ptr);
}
  • 1
  • 2
  • 3

linphone_proxy_config_get_expires

submodules/linphone/coreapi/linphone_proxy_config.h:LINPHONE_PUBLIC int linphone_proxy_config_get_expires(const LinphoneProxyConfig *cfg);


submodules/linphone/coreapi/proxy.c:int linphone_proxy_config_get_expires(const LinphoneProxyConfig *cfg){
  • 1
  • 2
  • 3
  • 4

linphone_proxy_config_get_expires

submodules/linphone/coreapi/proxy.c:int linphone_proxy_config_get_expires(const LinphoneProxyConfig *cfg){
  • 1
/**
 * @return the duration of registration.
**/
int linphone_proxy_config_get_expires(const LinphoneProxyConfig *cfg){
    return cfg->expires;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

createProxyConfig

//ProxyConfig

extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_createProxyConfig(JNIEnv* env, jobject thiz, jlong lc) {
    LinphoneProxyConfig* proxy = linphone_core_create_proxy_config((LinphoneCore *)lc);
    linphone_proxy_config_set_user_data(proxy,env->NewWeakGlobalRef(thiz));
    return (jlong) proxy;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

linphone_core_create_proxy_config

submodules/linphone/coreapi/proxy.c:LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc) {
  • 1
LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc) {
    LinphoneProxyConfig *cfg = belle_sip_object_new(LinphoneProxyConfig);
    linphone_proxy_config_init(lc,cfg);
    return cfg;
}
  • 1
  • 2
  • 3
  • 4
  • 5

linphone_proxy_config_init

static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *cfg) {
    const char *dial_prefix = lc ? lp_config_get_default_string(lc->config,"proxy","dial_prefix",NULL) : NULL;
    const char *identity = lc ? lp_config_get_default_string(lc->config, "proxy", "reg_identity", NULL) : NULL;
    const char *proxy = lc ? lp_config_get_default_string(lc->config, "proxy", "reg_proxy", NULL) : NULL;
    const char *route = lc ? lp_config_get_default_string(lc->config, "proxy", "reg_route", NULL) : NULL;
    const char *realm = lc ? lp_config_get_default_string(lc->config, "proxy", "realm", NULL) : NULL;
    const char *quality_reporting_collector = lc ? lp_config_get_default_string(lc->config, "proxy", "quality_reporting_collector", NULL) : NULL;
    const char *contact_params = lc ? lp_config_get_default_string(lc->config, "proxy", "contact_parameters", NULL) : NULL;
    const char *contact_uri_params = lc ? lp_config_get_default_string(lc->config, "proxy", "contact_uri_parameters", NULL) : NULL;

    cfg->expires = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_expires", 3600) : 3600;
    cfg->reg_sendregister = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_sendregister", 1) : 1;
    cfg->dial_prefix = dial_prefix ? ms_strdup(dial_prefix) : NULL;
    cfg->dial_escape_plus = lc ? lp_config_get_default_int(lc->config, "proxy", "dial_escape_plus", 0) : 0;
    cfg->privacy = lc ? lp_config_get_default_int(lc->config, "proxy", "privacy", LinphonePrivacyDefault) : LinphonePrivacyDefault;
    cfg->identity_address = identity ? linphone_address_new(identity) : NULL;
    cfg->reg_identity = cfg->identity_address ? linphone_address_as_string(cfg->identity_address) : NULL;
    cfg->reg_proxy = proxy ? ms_strdup(proxy) : NULL;
    cfg->reg_route = route ? ms_strdup(route) : NULL;
    cfg->realm = realm ? ms_strdup(realm) : NULL;
    cfg->quality_reporting_enabled = lc ? lp_config_get_default_int(lc->config, "proxy", "quality_reporting_enabled", 0) : 0;
    cfg->quality_reporting_collector = quality_reporting_collector ? ms_strdup(quality_reporting_collector) : NULL;
    cfg->quality_reporting_interval = lc ? lp_config_get_default_int(lc->config, "proxy", "quality_reporting_interval", 0) : 0;
    cfg->contact_params = contact_params ? ms_strdup(contact_params) : NULL;
    cfg->contact_uri_params = contact_uri_params ? ms_strdup(contact_uri_params) : NULL;
    cfg->avpf_mode = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf", LinphoneAVPFDefault) : LinphoneAVPFDefault;
    cfg->avpf_rr_interval = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf_rr_interval", 5) : 5;
    cfg->publish_expires=-1;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

inphone_proxy_config_set_user_data

void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cfg, void *ud) {
    cfg->user_data = ud;
}
  • 1
  • 2
  • 3

newLinphoneProxyConfig

edit

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_edit(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    linphone_proxy_config_edit((LinphoneProxyConfig*)proxyCfg);
}
  • 1
  • 2
  • 3

linphone_proxy_config_edit

void linphone_proxy_config_edit(LinphoneProxyConfig *cfg){
    /*store current config related to server location*/
    linphone_proxy_config_store_server_config(cfg);
    linphone_proxy_config_compute_publish_params_hash(cfg);

    if (cfg->publish && cfg->long_term_event){
        linphone_event_pause_publish(cfg->long_term_event);
    }
    /*stop refresher in any case*/
    linphone_proxy_config_pause_register(cfg);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

linphone_proxy_config_store_server_config

/*store current config related to server location*/
static void linphone_proxy_config_store_server_config(LinphoneProxyConfig* cfg) {
    if (cfg->saved_identity) linphone_address_destroy(cfg->saved_identity);
    if (cfg->identity_address)
        cfg->saved_identity = linphone_address_clone(cfg->identity_address);
    else
        cfg->saved_identity = NULL;

    if (cfg->saved_proxy) linphone_address_destroy(cfg->saved_proxy);
    if (cfg->reg_proxy)
        cfg->saved_proxy = linphone_address_new(cfg->reg_proxy);
    else
        cfg->saved_proxy = NULL;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

linphone_proxy_config_compute_publish_params_hash

/*
 * return true if computed value has changed
 */
bool_t linphone_proxy_config_compute_publish_params_hash(LinphoneProxyConfig * cfg) {
    char * source = NULL;
    char hash[33];
    char saved;
    unsigned long long previous_hash[2];
    previous_hash[0] = cfg->previous_publish_config_hash[0];
    previous_hash[1] = cfg->previous_publish_config_hash[1];

    source = ms_strcat_printf(source, "%i",cfg->privacy);
    source=append_linphone_address(cfg->identity_address, source);
    source=append_string(cfg->reg_proxy,source);
    source=append_string(cfg->reg_route,source);
    source=append_string(cfg->realm,source);
    source = ms_strcat_printf(source, "%i",cfg->publish_expires);
    source = ms_strcat_printf(source, "%i",cfg->publish);
    belle_sip_auth_helper_compute_ha1(source, "dummy", "dummy", hash);
    ms_free(source);
    saved = hash[16];
    hash[16] = '\0';
    cfg->previous_publish_config_hash[0] = strtoull(hash, (char **)NULL, 16);
    hash[16] = saved;
    cfg->previous_publish_config_hash[1] = strtoull(&hash[16], (char **)NULL, 16);
    return previous_hash[0] != cfg->previous_publish_config_hash[0] || previous_hash[1] != cfg->previous_publish_config_hash[1];
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

linphone_event_pause_publish

submodules/linphone/coreapi/event.h:LINPHONE_PUBLIC void linphone_event_pause_publish(LinphoneEvent *lev);
submodules/linphone/coreapi/proxy.c:        linphone_event_pause_publish(cfg->long_term_event);
submodules/linphone/coreapi/event.c:void linphone_event_pause_publish(LinphoneEvent *lev) {
  • 1
  • 2
  • 3
  • 4

linphone_proxy_config_pause_register

void linphone_proxy_config_pause_register(LinphoneProxyConfig *cfg){
    if (cfg->op) sal_op_stop_refreshing(cfg->op);
}
  • 1
  • 2
  • 3

done

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_done(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    linphone_proxy_config_done((LinphoneProxyConfig*)proxyCfg);
}
  • 1
  • 2
  • 3

linphone_proxy_config_done

/**
 * Commits modification made to the proxy configuration.
**/
int linphone_proxy_config_done(LinphoneProxyConfig *cfg)
{
    LinphoneProxyConfigAddressComparisonResult res;

    if (!linphone_proxy_config_check(cfg->lc,cfg))
        return -1;

    /*check if server address as changed*/
    res = linphone_proxy_config_is_server_config_changed(cfg);
    if (res != LinphoneProxyConfigAddressEqual) {
        /* server config has changed, need to unregister from previous first*/
        if (cfg->op) {
            if (res == LinphoneProxyConfigAddressDifferent) {
                _linphone_proxy_config_unregister(cfg);
            }
            sal_op_set_user_pointer(cfg->op,NULL); /*we don't want to receive status for this un register*/
            sal_op_unref(cfg->op); /*but we keep refresher to handle authentication if needed*/
            cfg->op=NULL;
        }
        if (cfg->long_term_event) {
            if (res == LinphoneProxyConfigAddressDifferent) {
                _linphone_proxy_config_unpublish(cfg);
            }

        }
    }
    if (linphone_proxy_config_compute_publish_params_hash(cfg)) {
        ms_message("Publish params have changed on proxy config [%p]",cfg);
        if (cfg->long_term_event) {
            if (!cfg->publish) {
                /*publish is terminated*/
                linphone_event_terminate(cfg->long_term_event);
            }
            linphone_event_unref(cfg->long_term_event);
            cfg->long_term_event = NULL;
        }
        if (cfg->publish) cfg->send_publish=TRUE;
    } else {
        ms_message("Publish params have not changed on proxy config [%p]",cfg);
    }
    cfg->commit=TRUE;
    linphone_proxy_config_write_all_to_config_file(cfg->lc);
    return 0;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47

setIdentity

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setIdentity(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jidentity) {
    const char* identity = env->GetStringUTFChars(jidentity, NULL);
    linphone_proxy_config_set_identity((LinphoneProxyConfig*)proxyCfg,identity);
    env->ReleaseStringUTFChars(jidentity, identity);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_proxy_config_set_identity

int linphone_proxy_config_set_identity_address(LinphoneProxyConfig *cfg, const LinphoneAddress *addr){
    if (!addr || linphone_address_get_username(addr)==NULL){
        char* as_string = addr ? linphone_address_as_string(addr) : ms_strdup("NULL");
        ms_warning("Invalid sip identity: %s", as_string);
        ms_free(as_string);
        return -1;
    }
    if (cfg->identity_address != NULL) {
        linphone_address_destroy(cfg->identity_address);
    }
    cfg->identity_address=linphone_address_clone(addr);

    if (cfg->reg_identity!=NULL) {
        ms_free(cfg->reg_identity);
    }
    cfg->reg_identity= linphone_address_as_string(cfg->identity_address);
    return 0;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

getIdentity

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getIdentity(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    const char* identity = linphone_proxy_config_get_identity((LinphoneProxyConfig*)proxyCfg);
    if (identity) {
        return env->NewStringUTF(identity);
    } else {
        return NULL;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

linphone_proxy_config_get_identity

const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *cfg){
    return cfg->reg_identity;
}
  • 1
  • 2
  • 3

setAddress

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setAddress(JNIEnv* env,jobject thiz,jlong proxyCfg,jlong jidentity) {
    linphone_proxy_config_set_identity_address((LinphoneProxyConfig*)proxyCfg, (LinphoneAddress*) jidentity);
}
  • 1
  • 2
  • 3

linphone_proxy_config_set_identity_address

int linphone_proxy_config_set_identity_address(LinphoneProxyConfig *cfg, const LinphoneAddress *addr){
    if (!addr || linphone_address_get_username(addr)==NULL){
        char* as_string = addr ? linphone_address_as_string(addr) : ms_strdup("NULL");
        ms_warning("Invalid sip identity: %s", as_string);
        ms_free(as_string);
        return -1;
    }
    if (cfg->identity_address != NULL) {
        linphone_address_destroy(cfg->identity_address);
    }
    cfg->identity_address=linphone_address_clone(addr);

    if (cfg->reg_identity!=NULL) {
        ms_free(cfg->reg_identity);
    }
    cfg->reg_identity= linphone_address_as_string(cfg->identity_address);
    return 0;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

getAddress

extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_getAddress(JNIEnv*  env
                                                                        ,jobject  thiz
                                                                        ,jlong ptr) {
    return (jlong)linphone_friend_get_address((LinphoneFriend*)ptr);
}
  • 1
  • 2
  • 3
  • 4
  • 5

setProxy

extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setProxy(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jproxy) {
    const char* proxy = env->GetStringUTFChars(jproxy, NULL);
    jint err=linphone_proxy_config_set_server_addr((LinphoneProxyConfig*)proxyCfg,proxy);
    env->ReleaseStringUTFChars(jproxy, proxy);
    return err;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_proxy_config_set_server_addr

int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *cfg, const char *server_addr){
    LinphoneAddress *addr=NULL;
    char *modified=NULL;

    if (cfg->reg_proxy!=NULL) ms_free(cfg->reg_proxy);
    cfg->reg_proxy=NULL;

    if (server_addr!=NULL && strlen(server_addr)>0){
        if (strstr(server_addr,"sip:")==NULL && strstr(server_addr,"sips:")==NULL){
            modified=ms_strdup_printf("sip:%s",server_addr);
            addr=linphone_address_new(modified);
            ms_free(modified);
        }
        if (addr==NULL)
            addr=linphone_address_new(server_addr);
        if (addr){
            cfg->reg_proxy=linphone_address_as_string(addr);
            linphone_address_destroy(addr);
        }else{
            ms_warning("Could not parse %s",server_addr);
            return -1;
        }
    }
    return 0;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

getProxy

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getProxy(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    const char* proxy = linphone_proxy_config_get_addr((LinphoneProxyConfig*)proxyCfg);
    if (proxy) {
        return env->NewStringUTF(proxy);
    } else {
        return NULL;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

enableRegister

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enableRegister(JNIEnv* env,jobject thiz,jlong proxyCfg,jboolean enableRegister) {
    linphone_proxy_config_enable_register((LinphoneProxyConfig*)proxyCfg,enableRegister);
}
  • 1
  • 2
  • 3

linphone_proxy_config_enable_register

submodules/linphone/coreapi/linphone_proxy_config.h:LINPHONE_PUBLIC void linphone_proxy_config_enable_register(LinphoneProxyConfig *cfg, bool_t val);

submodules/linphone/coreapi/linphone_proxy_config.h:#define linphone_proxy_config_enableregister linphone_proxy_config_enable_register
  • 1
  • 2
  • 3

linphone_proxy_config_enableregister

submodules/linphone/coreapi/proxy.c:void linphone_proxy_config_enableregister(LinphoneProxyConfig *cfg, bool_t val){
  • 1
void linphone_proxy_config_enableregister(LinphoneProxyConfig *cfg, bool_t val){
    cfg->reg_sendregister=val;
}
  • 1
  • 2
  • 3

isRegisterEnabled

extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegisterEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    return (jboolean)linphone_proxy_config_register_enabled((LinphoneProxyConfig*)proxyCfg);
}
  • 1
  • 2
  • 3

linphone_proxy_config_register_enabled

bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *cfg){
    return cfg->reg_sendregister;
}
  • 1
  • 2
  • 3

isRegistered

extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_isRegistered(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    return (jboolean)linphone_proxy_config_is_registered((LinphoneProxyConfig*)proxyCfg);
}
  • 1
  • 2
  • 3

linphone_proxy_config_is_registered

bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *cfg){
    return cfg->state == LinphoneRegistrationOk;
}
  • 1
  • 2
  • 3

setDialPrefix

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialPrefix(JNIEnv* env
                                                                    ,jobject thiz
                                                                    ,jlong proxyCfg
                                                                    ,jstring jprefix) {
    const char* prefix = env->GetStringUTFChars(jprefix, NULL);
    linphone_proxy_config_set_dial_prefix((LinphoneProxyConfig*)proxyCfg,prefix);
    env->ReleaseStringUTFChars(jprefix, prefix);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

linphone_proxy_config_set_dial_prefix

void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix){
    if (cfg->dial_prefix!=NULL){
        ms_free(cfg->dial_prefix);
        cfg->dial_prefix=NULL;
    }
    if (prefix && prefix[0]!='\0') cfg->dial_prefix=ms_strdup(prefix);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

getDialPrefix

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDialPrefix(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    const char * prefix = linphone_proxy_config_get_dial_prefix((LinphoneProxyConfig*)proxyCfg);
    return prefix ? env->NewStringUTF(prefix) : NULL;
}
  • 1
  • 2
  • 3
  • 4

linphone_proxy_config_get_dial_prefix

const char *linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg){
    return cfg->dial_prefix;
}
  • 1
  • 2
  • 3

normalizePhoneNumber

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_normalizePhoneNumber(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jnumber) {
    if (jnumber == 0) {
        ms_error("cannot normalized null number");
    }
    char * normalized_phone;
    const char* number = env->GetStringUTFChars(jnumber, NULL);
    int len = env->GetStringLength(jnumber);
    if (len == 0) {
        ms_warning("cannot normalize empty number");
        return jnumber;
    }
    normalized_phone = linphone_proxy_config_normalize_phone_number((LinphoneProxyConfig*)proxyCfg,number);
    jstring normalizedNumber = env->NewStringUTF(normalized_phone ? normalized_phone : number);
    env->ReleaseStringUTFChars(jnumber, number);
    ms_free(normalized_phone);
    return normalizedNumber;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

linphone_proxy_config_normalize_phone_number

char* linphone_proxy_config_normalize_phone_number(LinphoneProxyConfig *proxy, const char *username) {
    LinphoneProxyConfig *tmpproxy = proxy ? proxy : linphone_proxy_config_new();
    char* result = NULL;
    if (linphone_proxy_config_is_phone_number(tmpproxy, username)){
        dial_plan_t dialplan = {0};
        char * flatten=flatten_number(username);
        ms_debug("Flattened number is '%s' for '%s'",flatten, username);

        /*if proxy has a dial prefix, modify phonenumber accordingly*/
        if (tmpproxy->dial_prefix!=NULL && tmpproxy->dial_prefix[0]!='\0'){
            lookup_dial_plan_by_ccc(tmpproxy->dial_prefix,&dialplan);
            ms_debug("Using dial plan '%s'",dialplan.country);
            /* the number already starts with + or international prefix*/
            if (flatten[0]=='+'||strstr(flatten,dialplan.icp)==flatten){
                ms_debug("Prefix already present.");
                if (tmpproxy->dial_escape_plus) {
                    result = replace_plus_with_icp(flatten,dialplan.icp);
                } else {
                    result = replace_icp_with_plus(flatten,dialplan.icp);
                }
            }else{
                /*0. keep at most national number significant digits */
                char* flatten_start = flatten + MAX(0, (int)strlen(flatten) - (int)dialplan.nnl);
                ms_debug("Prefix not present. Keeping at most %d digits: %s", dialplan.nnl, flatten_start);

                /*1. First prepend international calling prefix or +*/
                /*2. Second add prefix*/
                /*3. Finally add user digits */
                result = ms_strdup_printf("%s%s%s"
                                            , tmpproxy->dial_escape_plus ? dialplan.icp : "+"
                                            , dialplan.ccc
                                            , flatten_start);
                ms_debug("Prepended prefix resulted in %s", result);
            }
        }
        if (result==NULL) {
            result = flatten;
        } else {
            ms_free(flatten);
        }
    }
    if (proxy==NULL) linphone_proxy_config_destroy(tmpproxy);
    return result;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45

linphone_proxy_config_is_phone_number

bool_t linphone_proxy_config_is_phone_number(LinphoneProxyConfig *proxy, const char *username){
    const char *p;
    for(p=username;*p!='\0';++p){
        if (isdigit(*p) ||
            *p==' ' ||
            *p=='.' ||
            *p=='-' ||
            *p==')' ||
            *p=='(' ||
            *p=='/' ||
            *p=='+' ||
            (unsigned char)*p==0xca || (unsigned char)*p==0xc2 || (unsigned char)*p==0xa0 // non-breakable space (iOS uses it to format contacts phone number)
            ) {
            continue;
        }
        return FALSE;
    }
    return TRUE;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

dial_plan_t

*
 * http://en.wikipedia.org/wiki/Telephone_numbering_plan
 * http://en.wikipedia.org/wiki/Telephone_numbers_in_Europe
 */
typedef struct dial_plan{
    const char *country;
    const char* iso_country_code; /* ISO 3166-1 alpha-2 code, ex: FR for France*/
    char  ccc[8]; /*country calling code*/
    int nnl; /*maximum national number length*/
    const char * icp; /*international call prefix, ex: 00 in europe*/

}dial_plan_t;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

flatten_number

//remove anything but [0-9] and +
static char *flatten_number(const char *number){
    char *result=ms_malloc0(strlen(number)+1);
    char *w=result;
    const char *r;
    for(r=number;*r!='\0';++r){
        if (*r=='+' || isdigit(*r)){
            *w++=*r;
        }
    }
    *w++='\0';
    return result;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

lookup_dial_plan_by_ccc

static bool_t lookup_dial_plan_by_ccc(const char *ccc, dial_plan_t *plan){
    int i;
    for(i=0;dial_plans[i].country!=NULL;++i){
        if (strcmp(ccc,dial_plans[i].ccc)==0){
            *plan=dial_plans[i];
            return TRUE;
        }
    }
    /*else return a generic "most common" dial plan*/
    *plan=most_common_dialplan;
    strcpy(plan->ccc,ccc);
    return FALSE;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

replace_plus_with_icp

static char* replace_plus_with_icp(char *phone, const char* icp){
    return (icp && phone[0]=='+') ? ms_strdup_printf("%s%s", icp, phone+1) : ms_strdup(phone);
}
  • 1
  • 2
  • 3

replace_icp_with_plus

static char* replace_icp_with_plus(char *phone, const char *icp){
    return (strstr(phone, icp) == phone) ?  ms_strdup_printf("+%s", phone+strlen(icp)) : ms_strdup(phone);
}
  • 1
  • 2
  • 3

linphone_proxy_config_destroy

static void _linphone_proxy_config_destroy(LinphoneProxyConfig *cfg);

  • 1
  • 2
  • 3

void _linphone_proxy_config_destroy(LinphoneProxyConfig *cfg){
    if (cfg->reg_proxy!=NULL) ms_free(cfg->reg_proxy);
    if (cfg->reg_identity!=NULL) ms_free(cfg->reg_identity);
    if (cfg->identity_address!=NULL) linphone_address_destroy(cfg->identity_address);
    if (cfg->reg_route!=NULL) ms_free(cfg->reg_route);
    if (cfg->quality_reporting_collector!=NULL) ms_free(cfg->quality_reporting_collector);
    if (cfg->ssctx!=NULL) sip_setup_context_free(cfg->ssctx);
    if (cfg->realm!=NULL) ms_free(cfg->realm);
    if (cfg->type!=NULL) ms_free(cfg->type);
    if (cfg->dial_prefix!=NULL) ms_free(cfg->dial_prefix);
    if (cfg->contact_params) ms_free(cfg->contact_params);
    if (cfg->contact_uri_params) ms_free(cfg->contact_uri_params);
    if (cfg->saved_proxy!=NULL) linphone_address_destroy(cfg->saved_proxy);
    if (cfg->saved_identity!=NULL) linphone_address_destroy(cfg->saved_identity);
    if (cfg->sent_headers!=NULL) sal_custom_header_free(cfg->sent_headers);
    if (cfg->pending_contact) linphone_address_unref(cfg->pending_contact);
    _linphone_proxy_config_release_ops(cfg);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

normalizeSipUri

extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_normalizeSipUri(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jusername) {
    const char* username = env->GetStringUTFChars(jusername, NULL);
    LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri((LinphoneProxyConfig*)proxyCfg, username);
    env->ReleaseStringUTFChars(jusername, username);
    return (jlong) addr;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_proxy_config_normalize_sip_uri

LinphoneAddress* linphone_proxy_config_normalize_sip_uri(LinphoneProxyConfig *proxy, const char *username) {
    enum_lookup_res_t *enumres=NULL;
    char *enum_domain=NULL;
    char *tmpurl;
    LinphoneAddress *uri;

    if (!username || *username=='\0') return NULL;

    if (is_enum(username,&enum_domain)){
        if (proxy) {
            linphone_core_notify_display_status(proxy->lc,_("Looking for telephone number destination..."));
        }
        if (enum_lookup(enum_domain,&enumres)<0){
            if (proxy) {
                linphone_core_notify_display_status(proxy->lc,_("Could not resolve this number."));
            }
            ms_free(enum_domain);
            return NULL;
        }
        ms_free(enum_domain);
        tmpurl=enumres->sip_address[0];
        uri=linphone_address_new(tmpurl);
        enum_lookup_res_free(enumres);
        return _linphone_core_destroy_addr_if_not_sip(uri);
    }
    /* check if we have a "sip:" or a "sips:" */
    if ( (strstr(username,"sip:")==NULL) && (strstr(username,"sips:")==NULL) ){
        /* this doesn't look like a true sip uri */
        if (strchr(username,'@')!=NULL){
            /* seems like sip: is missing !*/
            tmpurl=ms_strdup_printf("sip:%s",username);
            uri=linphone_address_new(tmpurl);
            ms_free(tmpurl);
            if (uri){
                return _linphone_core_destroy_addr_if_not_sip(uri);
            }
        }

        if (proxy!=NULL){
            /* append the proxy domain suffix but remove any custom parameters/headers */
            LinphoneAddress *uri=linphone_address_clone(linphone_proxy_config_get_identity_address(proxy));
            linphone_address_clean(uri);
            if (uri==NULL){
                return NULL;
            } else {
                linphone_address_set_display_name(uri,NULL);
                linphone_address_set_username(uri,username);
                return _linphone_core_destroy_addr_if_not_sip(uri);
            }
        } else {
            return NULL;
        }
    }
    uri=linphone_address_new(username);
    if (uri!=NULL){
        return _linphone_core_destroy_addr_if_not_sip(uri);
    }

    return NULL;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60

linphone_core_notify_display_status

submodules/linphone/coreapi/vtables.c:void linphone_core_notify_display_status(LinphoneCore *lc, const char *message) {
  • 1
void linphone_core_notify_display_status(LinphoneCore *lc, const char *message) {
    NOTIFY_IF_EXIST(display_status, lc,message);
    cleanup_dead_vtable_refs(lc);
}
  • 1
  • 2
  • 3
  • 4

NOTIFY_IF_EXIST

#define NOTIFY_IF_EXIST(function_name, ...) \
    MSList* iterator; \
    VTableReference *ref; \
    bool_t has_cb = FALSE; \
    for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next)\
        if ((ref=(VTableReference*)iterator->data)->valid && (lc->current_vtable=ref->vtable)->function_name) {\
            lc->current_vtable->function_name(__VA_ARGS__);\
            has_cb = TRUE;\
        }\
    if (has_cb) ms_message("Linphone core [%p] notifying [%s]",lc,#function_name)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

cleanup_dead_vtable_refs

static void cleanup_dead_vtable_refs(LinphoneCore *lc){
    MSList *it,*next_it;
    for(it=lc->vtable_refs; it!=NULL; ){
        VTableReference *ref=(VTableReference*)it->data;
        next_it=it->next;
        if (ref->valid==0){
            ref->valid=0;
            lc->vtable_refs=ms_list_remove_link(lc->vtable_refs, it);
            ms_free(ref);
        }
        it=next_it;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

enum_lookup_res_free

submodules/linphone/coreapi/vtables.c:static void cleanup_dead_vtable_refs(LinphoneCore *lc)
  • 1
static void cleanup_dead_vtable_refs(LinphoneCore *lc){
    MSList *it,*next_it;
    for(it=lc->vtable_refs; it!=NULL; ){
        VTableReference *ref=(VTableReference*)it->data;
        next_it=it->next;
        if (ref->valid==0){
            ref->valid=0;
            lc->vtable_refs=ms_list_remove_link(lc->vtable_refs, it);
            ms_free(ref);
        }
        it=next_it;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

_linphone_core_destroy_addr_if_not_sip

static LinphoneAddress* _linphone_core_destroy_addr_if_not_sip( LinphoneAddress* addr ){
    if( linphone_address_is_sip(addr) ) {
        return addr;
    } else {
        linphone_address_destroy(addr);
        return NULL;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

linphone_address_is_sip

/**
 * returns true if address is a routable sip address
 */
bool_t linphone_address_is_sip(const LinphoneAddress *uri){
    return sal_address_is_sip(uri);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_address_destroy

linphone_address_set_display_name

/**
 * Destroys a LinphoneAddress object (actually calls linphone_address_unref()).
 * @deprecated Use linphone_address_unref() instead
**/
void linphone_address_destroy(LinphoneAddress *u){
    sal_address_unref(u);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

getDomain

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getDomain(JNIEnv* env
                                                                            ,jobject thiz
                                                                            ,jlong proxyCfg) {
    const char* domain = linphone_proxy_config_get_domain((LinphoneProxyConfig*)proxyCfg);
    if (domain) {
        return env->NewStringUTF(domain);
    } else {
        return NULL;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

linphone_proxy_config_get_domain

const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg){
    return cfg->identity_address ? linphone_address_get_domain(cfg->identity_address) : NULL;
}
  • 1
  • 2
  • 3

setDialEscapePlus

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setDialEscapePlus(JNIEnv* env,jobject thiz,jlong proxyCfg,jboolean value) {
    linphone_proxy_config_set_dial_escape_plus((LinphoneProxyConfig*)proxyCfg,value);
}
  • 1
  • 2
  • 3

linphone_proxy_config_set_dial_escape_plus

void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val){
    cfg->dial_escape_plus=val;
}
  • 1
  • 2
  • 3

getDialEscapePlus

extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_getDialEscapePlus(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    return (jboolean) linphone_proxy_config_get_dial_escape_plus((LinphoneProxyConfig*)proxyCfg);
}
  • 1
  • 2
  • 3

linphone_proxy_config_get_dial_escape_plus

bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg){
    return cfg->dial_escape_plus;
}
  • 1
  • 2
  • 3

getRoute

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getRoute(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    const char* route = linphone_proxy_config_get_route((LinphoneProxyConfig*)proxyCfg);
    if (route) {
        return env->NewStringUTF(route);
    } else {
        return NULL;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

linphone_proxy_config_get_route

const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *cfg){
    return cfg->reg_route;
}
  • 1
  • 2
  • 3

setRoute

extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_setRoute(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jroute) {
    if (jroute != NULL) {
        const char* route = env->GetStringUTFChars(jroute, NULL);
        jint err=linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,route);
        env->ReleaseStringUTFChars(jroute, route);
        return err;
    } else {
        return (jint)linphone_proxy_config_set_route((LinphoneProxyConfig*)proxyCfg,NULL);
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

linphone_proxy_config_set_route

int linphone_proxy_config_set_route(LinphoneProxyConfig *cfg, const char *route)
{
    if (cfg->reg_route!=NULL){
        ms_free(cfg->reg_route);
        cfg->reg_route=NULL;
    }
    if (route!=NULL && route[0] !='\0'){
        SalAddress *addr;
        char *tmp;
        /*try to prepend 'sip:' */
        if (strstr(route,"sip:")==NULL && strstr(route,"sips:")==NULL){
            tmp=ms_strdup_printf("sip:%s",route);
        }else tmp=ms_strdup(route);
        addr=sal_address_new(tmp);
        if (addr!=NULL){
            sal_address_destroy(addr);
            cfg->reg_route=tmp;
            return 0;
        }else{
            ms_free(tmp);
            return -1;
        }
    } else {
        return 0;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

enablePublish

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_enablePublish(JNIEnv* env
                                                                                ,jobject thiz
                                                                                ,jlong proxyCfg
                                                                                ,jboolean val) {
    linphone_proxy_config_enable_publish((LinphoneProxyConfig*)proxyCfg,val);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_proxy_config_enable_publish

void linphone_proxy_config_enable_publish(LinphoneProxyConfig *cfg, bool_t val){
    cfg->publish=val;
}
  • 1
  • 2
  • 3

publishEnabled

extern "C" jboolean Java_org_linphone_core_LinphoneProxyConfigImpl_publishEnabled(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    return (jboolean)linphone_proxy_config_publish_enabled((LinphoneProxyConfig*)proxyCfg);
}
  • 1
  • 2
  • 3

linphone_proxy_config_publish_enabled

bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *cfg){
    return cfg->publish;
}
  • 1
  • 2
  • 3

setContactParameters

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactParameters(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jparams) {
    const char* params = jparams ? env->GetStringUTFChars(jparams, NULL) : NULL;
    linphone_proxy_config_set_contact_parameters((LinphoneProxyConfig*)proxyCfg, params);
    if (jparams) env->ReleaseStringUTFChars(jparams, params);
}
  • 1
  • 2
  • 3
  • 4
  • 5

linphone_proxy_config_set_contact_parameters

void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *cfg, const char *contact_params){
    if (cfg->contact_params) {
        ms_free(cfg->contact_params);
        cfg->contact_params=NULL;
    }
    if (contact_params){
        cfg->contact_params=ms_strdup(contact_params);
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

lookupCCCFromIso

extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromIso(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring jiso) {
    const char* iso = env->GetStringUTFChars(jiso, NULL);
    int prefix = linphone_dial_plan_lookup_ccc_from_iso(iso);
    env->ReleaseStringUTFChars(jiso, iso);
    return (jint) prefix;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_dial_plan_lookup_ccc_from_iso

int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) {
    dial_plan_t* dial_plan;
    for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) {
        if (strcmp(iso, dial_plan->iso_country_code)==0) {
            return atoi(dial_plan->ccc);
        }
    }
    return -1;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

lookupCCCFromE164

extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_lookupCCCFromE164(JNIEnv* env, jobject thiz, jlong proxyCfg, jstring je164) {
    const char* e164 = env->GetStringUTFChars(je164, NULL);
    int prefix = linphone_dial_plan_lookup_ccc_from_e164(e164);
    env->ReleaseStringUTFChars(je164, e164);
    return (jint) prefix;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_dial_plan_lookup_ccc_from_e164

int linphone_dial_plan_lookup_ccc_from_e164(const char* e164) {
    dial_plan_t* dial_plan;
    dial_plan_t* elected_dial_plan=NULL;
    unsigned int found;
    unsigned int i=0;
    if (e164[1]=='1') {
        /*USA case*/
        return 1;
    }
    do {
        found=0;
        i++;
        for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) {
            if (strncmp(dial_plan->ccc,&e164[1],i) == 0) {
                elected_dial_plan=dial_plan;
                found++;
            }
        }
    } while ((found>1 || found==0) && i < sizeof(dial_plan->ccc));
    if (found==1) {
        return atoi(elected_dial_plan->ccc);
    } else {
        return -1; /*not found */
    }

}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

getError

extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_getError(JNIEnv*  env,jobject thiz,jlong ptr) {
    return linphone_proxy_config_get_error((LinphoneProxyConfig *) ptr);
}
  • 1
  • 2
  • 3

linphone_proxy_config_get_error

LinphoneReason linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg) {
    return linphone_error_info_get_reason(linphone_proxy_config_get_error_info(cfg));
}
  • 1
  • 2
  • 3

linphone_error_info_get_reason

submodules/linphone/coreapi/misc.c:LinphoneReason linphone_error_info_get_reason(const LinphoneErrorInfo *ei){
  • 1

linphone_error_info_get_reason

/**
 * Get reason code from the error info.
 * @param ei the error info.
 * @return a #LinphoneReason
 * @ingroup misc
**/
LinphoneReason linphone_error_info_get_reason(const LinphoneErrorInfo *ei){
    const SalErrorInfo *sei=(const SalErrorInfo*)ei;
    return linphone_reason_from_sal(sei->reason);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

linphone_reason_from_sal

LinphoneReason linphone_reason_from_sal(SalReason r){
    LinphoneReason ret=LinphoneReasonNone;
    switch(r){
        case SalReasonNone:
            ret=LinphoneReasonNone;
            break;
        case SalReasonIOError:
            ret=LinphoneReasonIOError;
            break;
        case SalReasonUnknown:
        case SalReasonInternalError:
            ret=LinphoneReasonUnknown;
            break;
        case SalReasonBusy:
            ret=LinphoneReasonBusy;
            break;
        case SalReasonDeclined:
            ret=LinphoneReasonDeclined;
            break;
        case SalReasonDoNotDisturb:
            ret=LinphoneReasonDoNotDisturb;
            break;
        case SalReasonForbidden:
            ret=LinphoneReasonBadCredentials;
            break;
        case SalReasonNotAcceptable:
            ret=LinphoneReasonNotAcceptable;
            break;
        case SalReasonNotFound:
            ret=LinphoneReasonNotFound;
            break;
        case SalReasonRedirect:
            ret=LinphoneReasonNone;
            break;
        case SalReasonTemporarilyUnavailable:
            ret=LinphoneReasonTemporarilyUnavailable;
            break;
        case SalReasonServiceUnavailable:
            ret=LinphoneReasonIOError;
            break;
        case SalReasonRequestPending:
            ret=LinphoneReasonTemporarilyUnavailable; /*might not be exactly the perfect matching, but better than LinphoneReasonNone*/
            break;
        case SalReasonUnauthorized:
            ret=LinphoneReasonUnauthorized;
            break;
        case SalReasonUnsupportedContent:
            ret=LinphoneReasonUnsupportedContent;
        break;
        case SalReasonNoMatch:
            ret=LinphoneReasonNoMatch;
        break;
        case SalReasonRequestTimeout:
            ret=LinphoneReasonNotAnswered;
        break;
        case SalReasonMovedPermanently:
            ret=LinphoneReasonMovedPermanently;
        break;
        case SalReasonGone:
            ret=LinphoneReasonGone;
        break;
        case SalReasonAddressIncomplete:
            ret=LinphoneReasonAddressIncomplete;
        break;
        case SalReasonNotImplemented:
            ret=LinphoneReasonNotImplemented;
        break;
        case SalReasonBadGateway:
            ret=LinphoneReasonBadGateway;
        break;
        case SalReasonServerTimeout:
            ret=LinphoneReasonServerTimeout;
        break;
    }
    return ret;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76

setPrivacy

extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setPrivacy(JNIEnv*  env
                                                                            ,jobject  thiz
                                                                            ,jlong cp
                                                                            ,jint privacy) {
    linphone_call_params_set_privacy((LinphoneCallParams*)cp,privacy);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_call_params_set_privacy

submodules/linphone/coreapi/call_params.h:LINPHONE_PUBLIC void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy);

submodules/linphone/coreapi/call_params.c:void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy) {
  • 1
  • 2
  • 3
  • 4
void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy) {
    params->privacy=privacy;
}
  • 1
  • 2
  • 3

getPrivacy

extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_getPrivacy(JNIEnv*  env,jobject thiz,jlong ptr) {
    return linphone_proxy_config_get_privacy((LinphoneProxyConfig *) ptr);
}
  • 1
  • 2
  • 3

linphone_proxy_config_get_privacy

LinphonePrivacyMask linphone_proxy_config_get_privacy(const LinphoneProxyConfig *params) {
    return params->privacy;
}
  • 1
  • 2
  • 3

enableAvpf

JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_enableAvpf(JNIEnv *env, jobject thiz, jlong ptr, jboolean enable) {
    linphone_proxy_config_enable_avpf((LinphoneProxyConfig *)ptr, (bool)enable);
}
  • 1
  • 2
  • 3

linphone_proxy_config_enable_avpf

void linphone_proxy_config_enable_avpf(LinphoneProxyConfig *cfg, bool_t enable) {
    cfg->avpf_mode=enable ? LinphoneAVPFEnabled : LinphoneAVPFDisabled;
}
  • 1
  • 2
  • 3

avpfEnabled

JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_avpfEnabled(JNIEnv *env, jobject thiz, jlong ptr) {
    return linphone_proxy_config_avpf_enabled((LinphoneProxyConfig *)ptr);
}
  • 1
  • 2
  • 3

linphone_proxy_config_avpf_enabled

bool_t linphone_proxy_config_avpf_enabled(LinphoneProxyConfig *cfg) {
    if (cfg->avpf_mode==LinphoneAVPFDefault && cfg->lc){
        return linphone_core_get_avpf_mode(cfg->lc)==LinphoneAVPFEnabled;
    }
    return cfg->avpf_mode == LinphoneAVPFEnabled;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_core_get_avpf_mode

submodules/linphone/coreapi/linphonecore.c:LinphoneAVPFMode linphone_core_get_avpf_mode(const LinphoneCore *lc){
  • 1
/**
 * Return AVPF enablement. See linphone_core_set_avpf_mode() .
 * @param lc the core
 * @return the avpf enablement mode.
 * @ingroup media_parameters
**/
LinphoneAVPFMode linphone_core_get_avpf_mode(const LinphoneCore *lc){
    return lc->rtp_conf.avpf_mode;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

setAvpfRRInterval

JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setAvpfRRInterval(JNIEnv *env, jobject thiz, jlong ptr, jint interval) {
    linphone_proxy_config_set_avpf_rr_interval((LinphoneProxyConfig *)ptr, (uint8_t)interval);
}
  • 1
  • 2
  • 3

linphone_proxy_config_set_avpf_rr_interval

void linphone_proxy_config_set_avpf_rr_interval(LinphoneProxyConfig *cfg, uint8_t interval) {
    if (interval > 5) interval = 5;
    cfg->avpf_rr_interval = interval;
}
  • 1
  • 2
  • 3
  • 4

getAvpfRRInterval

JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getAvpfRRInterval(JNIEnv *env, jobject thiz, jlong ptr) {
    return (jint)linphone_proxy_config_get_avpf_rr_interval((LinphoneProxyConfig *)ptr);
}
  • 1
  • 2
  • 3

linphone_proxy_config_get_avpf_rr_interval

uint8_t linphone_proxy_config_get_avpf_rr_interval(const LinphoneProxyConfig *cfg) {
    return cfg->avpf_rr_interval;
}
  • 1
  • 2
  • 3

getContactParameters

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getContactParameters(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    const char* params = linphone_proxy_config_get_contact_parameters((LinphoneProxyConfig*)proxyCfg);
    return params ? env->NewStringUTF(params) : NULL;
}
  • 1
  • 2
  • 3
  • 4

linphone_proxy_config_get_contact_parameters

const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *cfg){
    return cfg->contact_params;
}
  • 1
  • 2
  • 3

setContactUriParameters

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setContactUriParameters(JNIEnv* env,jobject thiz,jlong proxyCfg,jstring jparams) {
    const char* params = jparams ? env->GetStringUTFChars(jparams, NULL) : NULL;
    linphone_proxy_config_set_contact_uri_parameters((LinphoneProxyConfig*)proxyCfg, params);
    if (jparams) env->ReleaseStringUTFChars(jparams, params);
}
  • 1
  • 2
  • 3
  • 4
  • 5

linphone_proxy_config_set_contact_uri_parameters

void linphone_proxy_config_set_contact_uri_parameters(LinphoneProxyConfig *cfg, const char *contact_uri_params){
    if (cfg->contact_uri_params) {
        ms_free(cfg->contact_uri_params);
        cfg->contact_uri_params=NULL;
    }
    if (contact_uri_params){
        cfg->contact_uri_params=ms_strdup(contact_uri_params);
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

getContactUriParameters

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getContactUriParameters(JNIEnv* env,jobject thiz,jlong proxyCfg) {
    const char* params = linphone_proxy_config_get_contact_uri_parameters((LinphoneProxyConfig*)proxyCfg);
    return params ? env->NewStringUTF(params) : NULL;
}
  • 1
  • 2
  • 3
  • 4
  • 5

linphone_proxy_config_get_contact_uri_parameters

const char *linphone_proxy_config_get_contact_uri_parameters(const LinphoneProxyConfig *cfg){
    return cfg->contact_uri_params;
}
  • 1
  • 2
  • 3

getErrorInfo

extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_getErrorInfo(JNIEnv*  env,jobject thiz,jlong ptr) {
    return (jlong)linphone_proxy_config_get_error_info((LinphoneProxyConfig *) ptr);
}
  • 1
  • 2
  • 3

linphone_proxy_config_get_error_info

const LinphoneErrorInfo *linphone_proxy_config_get_error_info(const LinphoneProxyConfig *cfg){
    return linphone_error_info_from_sal_op(cfg->op);
}
  • 1
  • 2
  • 3

linphone_error_info_from_sal_op

submodules/linphone/coreapi/private.h:static MS2_INLINE const LinphoneErrorInfo *linphone_error_info_from_sal_op(const SalOp *op){
  • 1
static MS2_INLINE const LinphoneErrorInfo *linphone_error_info_from_sal_op(const SalOp *op){
    if (op==NULL) return (LinphoneErrorInfo*)sal_error_info_none();
    return (const LinphoneErrorInfo*)sal_op_get_error_info(op);
}
  • 1
  • 2
  • 3
  • 4

enableQualityReporting

JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_enableQualityReporting(JNIEnv *env, jobject thiz, jlong ptr, jboolean enable) {
    linphone_proxy_config_enable_quality_reporting((LinphoneProxyConfig *)ptr, (bool)enable);
}
  • 1
  • 2
  • 3

linphone_proxy_config_enable_quality_reporting

void linphone_proxy_config_enable_quality_reporting(LinphoneProxyConfig *cfg, bool_t val){
    cfg->quality_reporting_enabled = val;
}
  • 1
  • 2
  • 3

qualityReportingEnabled

setQualityReportingInterval

JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setQualityReportingInterval(JNIEnv *env, jobject thiz, jlong ptr, jint interval) {
    linphone_proxy_config_set_quality_reporting_interval((LinphoneProxyConfig *)ptr, (uint8_t)interval);
}
  • 1
  • 2
  • 3

linphone_proxy_config_set_quality_reporting_interval

void linphone_proxy_config_set_quality_reporting_interval(LinphoneProxyConfig *cfg, uint8_t interval) {
    cfg->quality_reporting_interval = interval;
}
  • 1
  • 2
  • 3

getQualityReportingInterval

JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getQualityReportingInterval(JNIEnv *env, jobject thiz, jlong ptr) {
    return (jint)linphone_proxy_config_get_quality_reporting_interval((LinphoneProxyConfig *)ptr);
}
  • 1
  • 2
  • 3

linphone_proxy_config_get_quality_reporting_interval

int linphone_proxy_config_get_quality_reporting_interval(LinphoneProxyConfig *cfg) {
    return cfg->quality_reporting_interval;
}
  • 1
  • 2
  • 3

setQualityReportingCollector

JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setQualityReportingCollector(JNIEnv *env, jobject thiz, jlong ptr, jstring jcollector) {
    if (jcollector){
        const char *collector=env->GetStringUTFChars(jcollector, NULL);
        linphone_proxy_config_set_quality_reporting_collector((LinphoneProxyConfig *)ptr, collector);
        env->ReleaseStringUTFChars(jcollector,collector);
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

linphone_proxy_config_set_quality_reporting_collector

void linphone_proxy_config_set_quality_reporting_collector(LinphoneProxyConfig *cfg, const char *collector){
    if (collector!=NULL && strlen(collector)>0){
        LinphoneAddress *addr=linphone_address_new(collector);
        if (!addr){
            ms_error("Invalid SIP collector URI: %s. Quality reporting will be DISABLED.",collector);
        } else {
            if (cfg->quality_reporting_collector != NULL){
                ms_free(cfg->quality_reporting_collector);
            }
            cfg->quality_reporting_collector = ms_strdup(collector);
        }

        if (addr){
            linphone_address_destroy(addr);
        }
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

getQualityReportingCollector

JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getQualityReportingCollector(JNIEnv *env, jobject thiz, jlong ptr) {
    jstring jvalue = env->NewStringUTF(linphone_proxy_config_get_quality_reporting_collector((LinphoneProxyConfig *)ptr));
    return jvalue;
}
  • 1
  • 2
  • 3
  • 4

linphone_proxy_config_get_quality_reporting_collector

const char *linphone_proxy_config_get_quality_reporting_collector(const LinphoneProxyConfig *cfg){
    return cfg->quality_reporting_collector;
}
  • 1
  • 2
  • 3

setRealm

JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setRealm(JNIEnv *env, jobject thiz, jlong ptr, jstring jrealm) {
    if (jrealm){
        const char *realm=env->GetStringUTFChars(jrealm, NULL);
        linphone_proxy_config_set_realm((LinphoneProxyConfig *)ptr, realm);
        env->ReleaseStringUTFChars(jrealm,realm);
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

inphone_proxy_config_set_realm

void linphone_proxy_config_set_realm(LinphoneProxyConfig *cfg, const char *realm)
{
    if (cfg->realm!=NULL) {
        ms_free(cfg->realm);
    }
    cfg->realm=ms_strdup(realm);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

getRealm

JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getRealm(JNIEnv *env, jobject thiz, jlong ptr) {
    jstring jvalue = env->NewStringUTF(linphone_proxy_config_get_realm((LinphoneProxyConfig *)ptr));
    return jvalue;
}
  • 1
  • 2
  • 3
  • 4

linphone_proxy_config_get_realm

const char* linphone_proxy_config_get_realm(const LinphoneProxyConfig *cfg)
{
    return cfg?cfg->realm:NULL;
}
  • 1
  • 2
  • 3
  • 4

setPublishExpires

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setPublishExpires(JNIEnv*  env
                                                                                    ,jobject thiz
                                                                                    ,jlong ptr
                                                                                    ,jint jval) {
    linphone_proxy_config_set_publish_expires((LinphoneProxyConfig *) ptr, jval);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

linphone_proxy_config_set_publish_expires

void linphone_proxy_config_set_publish_expires(LinphoneProxyConfig *cfg, int expires) {
    cfg->publish_expires=expires;
}
  • 1
  • 2
  • 3

getPublishExpires

extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_getPublishExpires(JNIEnv*  env,jobject thiz,jlong ptr) {
    return (jint)linphone_proxy_config_get_publish_expires((LinphoneProxyConfig *) ptr);
}
  • 1
  • 2
  • 3

linphone_proxy_config_get_publish_expires

int linphone_proxy_config_get_publish_expires(const LinphoneProxyConfig *cfg) {
    if (cfg->publish_expires<0) {
        return cfg->expires; /*default value is same as register*/
    } else {
        return cfg->publish_expires;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

isPhoneNumber

JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_isPhoneNumber(JNIEnv *env, jobject thiz, jlong ptr, jstring jusername) {
    if(jusername){
        const char *username=env->GetStringUTFChars(jusername, NULL);
        bool_t res = linphone_proxy_config_is_phone_number((LinphoneProxyConfig *)ptr, username);
        env->ReleaseStringUTFChars(jusername,username);
        return (jboolean) res;
    } else {
        return JNI_FALSE;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

linphone_proxy_config_is_phone_number

bool_t linphone_proxy_config_is_phone_number(LinphoneProxyConfig *proxy, const char *username){
    const char *p;
    for(p=username;*p!='\0';++p){
        if (isdigit(*p) ||
            *p==' ' ||
            *p=='.' ||
            *p=='-' ||
            *p==')' ||
            *p=='(' ||
            *p=='/' ||
            *p=='+' ||
            (unsigned char)*p==0xca || (unsigned char)*p==0xc2 || (unsigned char)*p==0xa0 // non-breakable space (iOS uses it to format contacts phone number)
            ) {
            continue;
        }
        return FALSE;
    }
    return TRUE;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/128733
推荐阅读
相关标签
  

闽ICP备14008679号