[jitsi-dev] Jigasi account selection


#1

Hi,

A month ago I asked some questions about having multiple SIP accounts in Jigasi. I understood that accounts are added like this (in sip-communicator.properties):

net.java.sip.communicator.impl.protocol.sip.acc1.XXXXX

net.java.sip.communicator.impl.protocol.sip.acc2.XXXXX

However, I am unable to find the logic for actually loading these accounts. In fact, the only place I see the sip-communicator.properties file used is in Main.java and my traces end there. Can someone point me to the right direction? I need a way to programmatically choose the login account.

Best regards,
Markus


#2

Hi,

This is done inside jitsi-protocol bundle:
https://github.com/jitsi/jitsi/blob/be0540e2b75cc30d437daad88cb3467580eff0cc/src/net/java/sip/communicator/service/protocol/AccountManager.java#L130

Regards
damencho

···

On Tue, Feb 6, 2018 at 5:46 AM, <markus.kullberg@teliacompany.com> wrote:

Hi,

A month ago I asked some questions about having multiple SIP accounts in
Jigasi. I understood that accounts are added like this (in
sip-communicator.properties):

net.java.sip.communicator.impl.protocol.sip.acc1.XXXXX

net.java.sip.communicator.impl.protocol.sip.acc2.XXXXX

However, I am unable to find the logic for actually loading these accounts.
In fact, the only place I see the sip-communicator.properties file used is
in Main.java and my traces end there. Can someone point me to the right
direction? I need a way to programmatically choose the login account.

Best regards,

Markus

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev


#3

Hi,

I don't think I can achieve what I'm trying to do in that file. What I'm trying to do is to choose a certain SIP account based on the "source" field of a DialIQ (https://github.com/jitsi/jigasi/blob/master/src/main/java/org/jitsi/jigasi/xmpp/CallControl.java#L182). Am I right to assume that to do this I first have to update the SIP provider? It seems like Jigasi does not support registering multiple accounts simultaneously, since the setSipProvider method checks if a SIP provider is already set. I tried by separating the registration and setting SIP provider like this https://pastebin.com/MRN0CBWH . Now however I am stuck, because I thought that all SIP accounts in sip-communicator.properties were iterated inside this loop https://github.com/jitsi/jigasi/blob/master/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java#L109 , but it turns out that the if-clause is never evaluated to true.

So my question is that is it possible to have Jigasi register multiple SIP accounts at the same time and choose which one to use at runtime when the DialIQ is received? In Jitsi Desktop it is possible to be logged in with multiple accounts so I assume the same should apply for Jitsi-Meet? I would appreciate any kind of guidance.

Regards,
Markus

···

-----Original Message-----
From: dev [mailto:dev-bounces@jitsi.org] On Behalf Of Damian Minkov
Sent: 6. helmikuuta 2018 16:43
To: Jitsi Developers <dev@jitsi.org>
Subject: Re: [jitsi-dev] Jigasi account selection

Hi,

This is done inside jitsi-protocol bundle:
https://github.com/jitsi/jitsi/blob/be0540e2b75cc30d437daad88cb3467580eff0cc/src/net/java/sip/communicator/service/protocol/AccountManager.java#L130

Regards
damencho

On Tue, Feb 6, 2018 at 5:46 AM, <markus.kullberg@teliacompany.com> wrote:

Hi,

A month ago I asked some questions about having multiple SIP accounts
in Jigasi. I understood that accounts are added like this (in
sip-communicator.properties):

net.java.sip.communicator.impl.protocol.sip.acc1.XXXXX

net.java.sip.communicator.impl.protocol.sip.acc2.XXXXX

However, I am unable to find the logic for actually loading these accounts.
In fact, the only place I see the sip-communicator.properties file
used is in Main.java and my traces end there. Can someone point me to
the right direction? I need a way to programmatically choose the login account.

Best regards,

Markus

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev


#4

Hi,

Pasting code somewhere doesn't work, there is no easy way to diff. The
best way is to fork the project and push your changes in a branch in
your fork, this way a developer can easily see a diff and give you
comments.
So the code in jigasi uses only one sip provider that is found and if
there are multiple they will be ignored.
You need to change the code to ignore the one that is set to sipGW and
when you receive the iq to choose the provider:

for (ServiceReference<ProtocolProviderService> ref : refs)
{
    ProtocolProviderService pps = osgiContext.getService(ref);

    if (ProtocolNames.SIP.equals(pps.getProtocolName()))
    {
        if (pps.getAccountID()
            .getAccountPropertyString("MYCUSTOMCONFIG")
                .equals("DIAL_URL"))
        {
            // use this sip provider pps

            break;
        }
    }
}

And you just need to set custom account properties in the config file

net.java.sip.communicator.impl.protocol.sip.acc1.MYCUSTOMCONFIG=something@myprovider1.com
net.java.sip.communicator.impl.protocol.sip.acc2.MYCUSTOMCONFIG=something@myprovider2.com

If you enter correctly the accounts in the properties files all of
them are loaded.
But you need to take care of them, register, add register listeners
... look at SipGateway.initProvider and the RegisterThread there.

An easier approach will be to make sure that everywhere in the code
where there is a reference to SipGateway sipGateway, like
https://github.com/jitsi/jigasi/blob/c29ec5588e7b42012508c7e7a74f46645a968118/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java#L61,
convert it to List< SipGateway > ... and create multiple SipGateways
based on the multiple sip protocol providers and when you need to
handle the iq you need to choose the correct SipGateway.

Now when I'm thinking about this, I don't see a reason to go over this
complicated, unmaintained path of modifying jigasi. You can simply
install asterisk, configure your providers there, make jigasi call the
asterisk and at the logic there, choosing different providers in the
dial-plan based on the destination. Just a thought.

Regards
damencho

···

On Thu, Feb 8, 2018 at 7:44 AM, <markus.kullberg@teliacompany.com> wrote:

Hi,

I don't think I can achieve what I'm trying to do in that file. What I'm trying to do is to choose a certain SIP account based on the "source" field of a DialIQ (https://github.com/jitsi/jigasi/blob/master/src/main/java/org/jitsi/jigasi/xmpp/CallControl.java#L182). Am I right to assume that to do this I first have to update the SIP provider? It seems like Jigasi does not support registering multiple accounts simultaneously, since the setSipProvider method checks if a SIP provider is already set. I tried by separating the registration and setting SIP provider like this https://pastebin.com/MRN0CBWH . Now however I am stuck, because I thought that all SIP accounts in sip-communicator.properties were iterated inside this loop https://github.com/jitsi/jigasi/blob/master/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java#L109 , but it turns out that the if-clause is never evaluated to true.

So my question is that is it possible to have Jigasi register multiple SIP accounts at the same time and choose which one to use at runtime when the DialIQ is received? In Jitsi Desktop it is possible to be logged in with multiple accounts so I assume the same should apply for Jitsi-Meet? I would appreciate any kind of guidance.

Regards,
Markus

-----Original Message-----
From: dev [mailto:dev-bounces@jitsi.org] On Behalf Of Damian Minkov
Sent: 6. helmikuuta 2018 16:43
To: Jitsi Developers <dev@jitsi.org>
Subject: Re: [jitsi-dev] Jigasi account selection

Hi,

This is done inside jitsi-protocol bundle:
https://github.com/jitsi/jitsi/blob/be0540e2b75cc30d437daad88cb3467580eff0cc/src/net/java/sip/communicator/service/protocol/AccountManager.java#L130

Regards
damencho

On Tue, Feb 6, 2018 at 5:46 AM, <markus.kullberg@teliacompany.com> wrote:

Hi,

A month ago I asked some questions about having multiple SIP accounts
in Jigasi. I understood that accounts are added like this (in
sip-communicator.properties):

net.java.sip.communicator.impl.protocol.sip.acc1.XXXXX

net.java.sip.communicator.impl.protocol.sip.acc2.XXXXX

However, I am unable to find the logic for actually loading these accounts.
In fact, the only place I see the sip-communicator.properties file
used is in Main.java and my traces end there. Can someone point me to
the right direction? I need a way to programmatically choose the login account.

Best regards,

Markus

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev


#5

Hi,

Thanks for your reply. I managed to do it using the easier approach (using multiple SipGateways). Now I'm a bit worried about how this will behave when multiple calls are started at the same time. From my understanding we create only one CallControl instance which handles every DialIQ, and I don't see any threading apart from the registering service. Is there something I need to keep in mind if using this approach, e.g. is it possible that a new SipGateway is set before the previous call is created with the old SipGateway? Will something happen with an ongoing call if the SipGateway is changed?

I also considered Asterisk but I am not familiar with the software at all and it seemed non-trivial to use, so I would prefer not to add another layer.

Regards,
Markus

···

-----Original Message-----
From: dev [mailto:dev-bounces@jitsi.org] On Behalf Of Damian Minkov
Sent: 8. helmikuuta 2018 17:06
To: Jitsi Developers <dev@jitsi.org>
Subject: Re: [jitsi-dev] Jigasi account selection

Hi,

Pasting code somewhere doesn't work, there is no easy way to diff. The best way is to fork the project and push your changes in a branch in your fork, this way a developer can easily see a diff and give you comments.
So the code in jigasi uses only one sip provider that is found and if there are multiple they will be ignored.
You need to change the code to ignore the one that is set to sipGW and when you receive the iq to choose the provider:

for (ServiceReference<ProtocolProviderService> ref : refs) {
    ProtocolProviderService pps = osgiContext.getService(ref);

    if (ProtocolNames.SIP.equals(pps.getProtocolName()))
    {
        if (pps.getAccountID()
            .getAccountPropertyString("MYCUSTOMCONFIG")
                .equals("DIAL_URL"))
        {
            // use this sip provider pps

            break;
        }
    }
}

And you just need to set custom account properties in the config file

net.java.sip.communicator.impl.protocol.sip.acc1.MYCUSTOMCONFIG=something@myprovider1.com
net.java.sip.communicator.impl.protocol.sip.acc2.MYCUSTOMCONFIG=something@myprovider2.com

If you enter correctly the accounts in the properties files all of them are loaded.
But you need to take care of them, register, add register listeners ... look at SipGateway.initProvider and the RegisterThread there.

An easier approach will be to make sure that everywhere in the code where there is a reference to SipGateway sipGateway, like https://github.com/jitsi/jigasi/blob/c29ec5588e7b42012508c7e7a74f46645a968118/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java#L61,
convert it to List< SipGateway > ... and create multiple SipGateways based on the multiple sip protocol providers and when you need to handle the iq you need to choose the correct SipGateway.

Now when I'm thinking about this, I don't see a reason to go over this complicated, unmaintained path of modifying jigasi. You can simply install asterisk, configure your providers there, make jigasi call the asterisk and at the logic there, choosing different providers in the dial-plan based on the destination. Just a thought.

Regards
damencho

On Thu, Feb 8, 2018 at 7:44 AM, <markus.kullberg@teliacompany.com> wrote:

Hi,

I don't think I can achieve what I'm trying to do in that file. What I'm trying to do is to choose a certain SIP account based on the "source" field of a DialIQ (https://github.com/jitsi/jigasi/blob/master/src/main/java/org/jitsi/jigasi/xmpp/CallControl.java#L182). Am I right to assume that to do this I first have to update the SIP provider? It seems like Jigasi does not support registering multiple accounts simultaneously, since the setSipProvider method checks if a SIP provider is already set. I tried by separating the registration and setting SIP provider like this https://pastebin.com/MRN0CBWH . Now however I am stuck, because I thought that all SIP accounts in sip-communicator.properties were iterated inside this loop https://github.com/jitsi/jigasi/blob/master/src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java#L109 , but it turns out that the if-clause is never evaluated to true.

So my question is that is it possible to have Jigasi register multiple SIP accounts at the same time and choose which one to use at runtime when the DialIQ is received? In Jitsi Desktop it is possible to be logged in with multiple accounts so I assume the same should apply for Jitsi-Meet? I would appreciate any kind of guidance.

Regards,
Markus

-----Original Message-----
From: dev [mailto:dev-bounces@jitsi.org] On Behalf Of Damian Minkov
Sent: 6. helmikuuta 2018 16:43
To: Jitsi Developers <dev@jitsi.org>
Subject: Re: [jitsi-dev] Jigasi account selection

Hi,

This is done inside jitsi-protocol bundle:
https://github.com/jitsi/jitsi/blob/be0540e2b75cc30d437daad88cb3467580
eff0cc/src/net/java/sip/communicator/service/protocol/AccountManager.j
ava#L130

Regards
damencho

On Tue, Feb 6, 2018 at 5:46 AM, <markus.kullberg@teliacompany.com> wrote:

Hi,

A month ago I asked some questions about having multiple SIP accounts
in Jigasi. I understood that accounts are added like this (in
sip-communicator.properties):

net.java.sip.communicator.impl.protocol.sip.acc1.XXXXX

net.java.sip.communicator.impl.protocol.sip.acc2.XXXXX

However, I am unable to find the logic for actually loading these accounts.
In fact, the only place I see the sip-communicator.properties file
used is in Main.java and my traces end there. Can someone point me to
the right direction? I need a way to programmatically choose the login account.

Best regards,

Markus

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev