Re: [pjsip] PJSUA2 - How to get AccountConfig from Account?

C(
Carsten (Tropby)
Mon, Jun 6, 2016 9:28 PM

Hello Zarko,

I have found a solution for me for that case.

For me I have overwritten the create and modify method from Account so I can
store AccountConifg in my  VOIPAccount.

class VOIPAccount : public pj::Account
{
public:
explicit VOIPAccount();

virtual void onRegState(pj::OnRegStateParam &prm);
virtual void onRegStarted(pj::OnRegStartedParam &prm);
virtual void onIncomingCall(pj::OnIncomingCallParam &iprm);

void create(const pj::AccountConfig &cfg,
            bool make_default=false);

};

void VOIPAccount::create(const pj::AccountConfig &cfg, bool make_default)

{

printf( "Account CREATED!!!\n" );



// Do some stuff with AccountConfig



pj::Account::create( cfg, make_default );

}

Maybe you can do it too? Or someone knows a better solution for that :D

Kind Regards,

Carsten

Von: pjsip [mailto:pjsip-bounces@lists.pjsip.org] Im Auftrag von Zarko
Coklin
Gesendet: Montag, 6. Juni 2016 23:10
An: pjsip@lists.pjsip.org
Betreff: [pjsip] PJSUA2 - How to get AccountConfig from Account?

Hi all!

AccountConfig is used to create an Account in PJSIP. I expected if I have a
pointer to Account it would be easy to retrieve AccountConfig using PJSUA2
API. However, that does not seem to be the case. Am I missing something?

For example, if the account is already created and I have to change Proxy
Server address, users of PJSUA2 are forced to go through Account::modify
method which requires a whole AccountConfig structure to be passed in. Would
it not be better to be able to get a reference of the AccountConfig
structure used to create an account, change parameter here and there, invoke
Account::modify and be done?

Regards,

Zarko


Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

Hello Zarko, I have found a solution for me for that case. For me I have overwritten the create and modify method from Account so I can store AccountConifg in my VOIPAccount. class VOIPAccount : public pj::Account { public: explicit VOIPAccount(); virtual void onRegState(pj::OnRegStateParam &prm); virtual void onRegStarted(pj::OnRegStartedParam &prm); virtual void onIncomingCall(pj::OnIncomingCallParam &iprm); void create(const pj::AccountConfig &cfg, bool make_default=false); }; void VOIPAccount::create(const pj::AccountConfig &cfg, bool make_default) { printf( "Account CREATED!!!\n" ); // Do some stuff with AccountConfig pj::Account::create( cfg, make_default ); } Maybe you can do it too? Or someone knows a better solution for that :D Kind Regards, Carsten Von: pjsip [mailto:pjsip-bounces@lists.pjsip.org] Im Auftrag von Zarko Coklin Gesendet: Montag, 6. Juni 2016 23:10 An: pjsip@lists.pjsip.org Betreff: [pjsip] PJSUA2 - How to get AccountConfig from Account? Hi all! AccountConfig is used to create an Account in PJSIP. I expected if I have a pointer to Account it would be easy to retrieve AccountConfig using PJSUA2 API. However, that does not seem to be the case. Am I missing something? For example, if the account is already created and I have to change Proxy Server address, users of PJSUA2 are forced to go through Account::modify method which requires a whole AccountConfig structure to be passed in. Would it not be better to be able to get a reference of the AccountConfig structure used to create an account, change parameter here and there, invoke Account::modify and be done? Regards, Zarko --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus
Žarko Coklin
Mon, Jun 6, 2016 10:07 PM

Hi Carsten!

Thanks for sharing the info. I guess I will have to do the same on my end. I am surprised to find out it is already not part of PJSUA2.

Zarko

On Jun 6, 2016 5:30 PM, "Carsten (Tropby)" Tropby@elektronik2000.de wrote:
Hello Zarko,
I have found a solution for me for that case.
For me I have overwritten the create and modify method from Account so I can store AccountConifg in my  VOIPAccount.

class VOIPAccount : public pj::Account

{

public:

explicit VOIPAccount();



virtual void onRegState(pj::OnRegStateParam &prm);

virtual void onRegStarted(pj::OnRegStartedParam &prm);

virtual void onIncomingCall(pj::OnIncomingCallParam &iprm);



void create(const pj::AccountConfig &cfg,

            bool make_default=false);

};

void VOIPAccount::create(const pj::AccountConfig &cfg, bool make_default)
{
printf( "Account CREATED!!!\n" );

// Do some stuff with AccountConfig

pj::Account::create( cfg, make_default );

}

Maybe you can do it too? Or someone knows a better solution for that :D

Kind Regards,
Carsten

Von: pjsip [mailto:pjsip-bounces@lists.pjsip.org] Im Auftrag von Zarko Coklin
Gesendet: Montag, 6. Juni 2016 23:10
An: pjsip@lists.pjsip.org
Betreff: [pjsip] PJSUA2 - How to get AccountConfig from Account?

Hi all!

AccountConfig is used to create an Account in PJSIP. I expected if I have a pointer to Account it would be easy to retrieve AccountConfig using PJSUA2 API. However, that does not seem to be the case. Am I missing something?

For example, if the account is already created and I have to change Proxy Server address, users of PJSUA2 are forced to go through Account::modify method which requires a whole AccountConfig structure to be passed in. Would it not be better to be able to get a reference of the AccountConfig structure used to create an account, change parameter here and there, invoke Account::modify and be done?

Regards,

Zarko

[https://ipmcdn.avast.com/images/2016/icons/icon-envelope-tick-round-orange_184x116-v1.png]https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient    Virenfrei. www.avast.comhttps://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient

Hi Carsten! Thanks for sharing the info. I guess I will have to do the same on my end. I am surprised to find out it is already not part of PJSUA2. Zarko On Jun 6, 2016 5:30 PM, "Carsten (Tropby)" <Tropby@elektronik2000.de> wrote: Hello Zarko, I have found a solution for me for that case. For me I have overwritten the create and modify method from Account so I can store AccountConifg in my VOIPAccount. class VOIPAccount : public pj::Account { public: explicit VOIPAccount(); virtual void onRegState(pj::OnRegStateParam &prm); virtual void onRegStarted(pj::OnRegStartedParam &prm); virtual void onIncomingCall(pj::OnIncomingCallParam &iprm); void create(const pj::AccountConfig &cfg, bool make_default=false); }; void VOIPAccount::create(const pj::AccountConfig &cfg, bool make_default) { printf( "Account CREATED!!!\n" ); // Do some stuff with AccountConfig pj::Account::create( cfg, make_default ); } Maybe you can do it too? Or someone knows a better solution for that :D Kind Regards, Carsten Von: pjsip [mailto:pjsip-bounces@lists.pjsip.org] Im Auftrag von Zarko Coklin Gesendet: Montag, 6. Juni 2016 23:10 An: pjsip@lists.pjsip.org Betreff: [pjsip] PJSUA2 - How to get AccountConfig from Account? Hi all! AccountConfig is used to create an Account in PJSIP. I expected if I have a pointer to Account it would be easy to retrieve AccountConfig using PJSUA2 API. However, that does not seem to be the case. Am I missing something? For example, if the account is already created and I have to change Proxy Server address, users of PJSUA2 are forced to go through Account::modify method which requires a whole AccountConfig structure to be passed in. Would it not be better to be able to get a reference of the AccountConfig structure used to create an account, change parameter here and there, invoke Account::modify and be done? Regards, Zarko [https://ipmcdn.avast.com/images/2016/icons/icon-envelope-tick-round-orange_184x116-v1.png]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Virenfrei. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>