[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-developers] LinphoneProxyConfig doesn't have addCustomHead

From: J Alex Antony Vijay
Subject: Re: [Linphone-developers] LinphoneProxyConfig doesn't have addCustomHeader method
Date: Tue, 8 Mar 2016 10:23:10 +0530

I have resolved this issue.

I modified 3 files to fix this issue.

1. I added the below code in file.

extern "C" jstring Java_org_linphone_core_LinphoneProxyConfigImpl_getCustomHeader(JNIEnv*  env
                                                                                  ,jobject  thiz
                                                                                  ,jlong ptr, jstring jheader_name) {
    const char *name=env->GetStringUTFChars(jheader_name,NULL);
    const char *value=linphone_proxy_config_get_custom_header((LinphoneProxyConfig*)ptr,name);
    env->ReleaseStringUTFChars(jheader_name, name);
    return value ? env->NewStringUTF(value) : NULL;

extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_addCustomHeader(JNIEnv*  env
                                                                               ,jobject  thiz
                                                                               ,jlong ptr, jstring jheader_name, jstring jheader_value) {
    const char *name=env->GetStringUTFChars(jheader_name,NULL);
    const char *value=env->GetStringUTFChars(jheader_value,NULL);
    env->ReleaseStringUTFChars(jheader_name, name);
    env->ReleaseStringUTFChars(jheader_value, value);

2. Then added below code in file:

    private native void addCustomHeader(long nativePtr, String key,String value);
    public void addCustomHeader(String key,String value) {
        addCustomHeader(nativePtr, key, value);

    private native String getCustomHeader(long nativePtr, String key);
    public String getCustomHeader(String key) {
        return getCustomHeader(nativePtr, key);

3. Then, added below code in LinphoneProxyConfig file.

void addCustomHeader(String key,String value);

String getCustomHeader(String key);

In my code, I am adding the x-header as below:

LinphoneProxyConfig proxyConfig = linphoneCore.createProxyConfig(----);
proxyConfig.addCustomHeader("X-Test1", "testing");
proxyConfig.addCustomHeader("X-Test2", "2nd test");

It is working fine..

On Fri, Mar 4, 2016 at 12:50 PM, J Alex Antony Vijay <address@hidden> wrote:

    Yesterday I took the latest code and successfully compiled it for Android. It is working fine with I am able to register successfully and i am able to make calls.

Now I am trying to use my server with some custom header.
I was trying to find a way to add custom header in REGISTER request. But I couldn't find any method to add.

I have done this in iPhone using "linphone_proxy_config_get_custom_header" directly.

But in Android, the method itself not available in Also "addCustomHeader" in "" file.

But I can see other implementation like;
  1. Java_org_linphone_core_LinphoneInfoMessageImpl_addHeader
  2. Java_org_linphone_core_LinphoneCallParamsImpl_addCustomHeader
  3. Java_org_linphone_core_LinphoneCallParamsImpl_addCustomSdpAttribute
  4. Java_org_linphone_core_LinphoneCallParamsImpl_addCustomSdpMediaAttribute
  5. Java_org_linphone_core_LinphoneEventImpl_addCustomHeader
  6. Java_org_linphone_core_LinphoneChatMessageImpl_addCustomHeader

I don't know how to resolved this issue.

Any idea.


J Alex Antony Vijay.


J Alex Antony Vijay.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]