datso / react-native-pjsip

A PJSIP module for React Native.
http://datso.github.io/react-native-pjsip
GNU General Public License v3.0
271 stars 228 forks source link

How to set the user agent? #233

Open dariomalfatti-centropaghe opened 3 years ago

dariomalfatti-centropaghe commented 3 years ago

I'm trying to set the user agent but I cannot figure out how to do that. I tryed to set the header in the makeCall method like this:

const call = await endpoint.makeCall(a, n, {
  'X-UA': 'My app (v0.0.6 Android)'
});

and in the configuration of the createAccount method like this:

const configuration = {
    name: accountInfo.account.sipName,
    username: accountInfo.account.sipUserName,
    password: accountInfo.account.sipPassword,
    domain: accountInfo.account.sipDomain,
    transport: accountInfo.account.sipTransport,
    proxy: accountInfo.account.sipProxy,
    regHeaders: {
        'user-agent': 'My app (v0.0.6 Android)',
    },
};

I take a look at the source code where it set the user agent:

if (mServiceConfiguration.isUserAgentNotEmpty()) {
    epConfig.getUaConfig().setUserAgent(mServiceConfiguration.getUserAgent());
} else {
    epConfig.getUaConfig().setUserAgent("React Native PjSip ("+ mEndpoint.libVersion().getFull() +")");
}

I cannot configure mServiceConfiguration.getUserAgent() from my react native app. Is there any way to set it up?

dariomalfatti-centropaghe commented 3 years ago

Anyone can help me please? Thanks