+1
Not a bug

IR.EVENT_ONLINE & IR.EVENT_OFFLINE doesn't work for SIP device

Эмиль Боев 4 years ago in iRidium Script / AV and Driver scripts • updated 4 years ago 14
BeeToo.AddListener(IR.EVENT_ONLINE, IR.GetDevice('SIP'), function () {
    //some code
});
BeeToo.AddListener(IR.EVENT_OFFLINE, IR.GetDevice('SIP'), function () {
    //some code
});

Device is connected, fir sure! Incoming calls working.
But now evend handling for Online and Offline.
Hello Эмиль,

EVENT_ONLINE with SIP works when:
1. i2 control was started
2. Driver is disconnected, and you use IR.GetDevice('SIP').Connect();
3. You maximize i2 control (background mode is off).

EVENT_OFFLINE with SIP works when:
1. You minimize i2 control (background mode is off).

EVENT_OFFLINE with SIP doesn't work when:
2. Driver is connected, and you use IR.GetDevice('SIP').Disconnect();

What situation do you use?
I'm using official 2.2.1 version of i2control from AppStore and on win64.
What situation do you use? When should EVENT_ONLINE or EVENT_OFFLINE must work, but they don't work?

V2.2.1 and V2.2.2 work at the same
They should work for the SIP the same way, as the do for other native devices (AMX driver for example).

At the very start of i2control app natove driver automatically connecting and EVENT_ONLINE must take place.
But it doesn't.

When one calling device.Disconnect() method - SIP is trully disconnecting.
BUT: it doesn't fire EVENT_OFFLINE event. But it should to.
They should work for the SIP the same way, as the do for other native devices (AMX driver for example).
At the very start of i2control app natove driver automatically connecting and EVENT_ONLINE must take place.
But it doesn't.
I answered you in the my first post:
"EVENT_ONLINE with SIP works when i2 control was started."
For example:
I use this code:
IR.AddListener(IR.EVENT_ONLINE, IR.GetDevice('SIP'), function () {
 IR.Log("SIP is Online");
});
When i2 control start, I get a log:
[02-04-2015 13:09:29.404] DEBUG CDialogSystem::ShowPage(main)
[02-04-2015 13:09:29.413] DEBUG CIridiumCore::ChangeOrientation(3)
[02-04-2015 13:09:29.423] DEBUG Loading is complete
[02-04-2015 13:09:29.487] SIP REGISTRATION ... Online. Start Registration ...
[02-04-2015 13:09:29.493] DEBUG AddMethod REGISTER
[02-04-2015 13:09:29.513] INFO SIP is Online
[02-04-2015 13:09:29.608] DEBUG AddMethod REGISTER
[02-04-2015 13:09:29.719] SIP REGISTRATION ... End Registration ...
How you can see:
[02-04-2015 13:09:29.513] INFO SIP is Online
What is not correct?

Then:
When one calling device.Disconnect() method - SIP is trully disconnecting.
BUT: it doesn't fire EVENT_OFFLINE event. But it should to.
Yes, it is. And I answered you about this in the my first post:
"EVENT_OFFLINE with SIP doesn't work when:
2. Driver is connected, and you use IR.GetDevice('SIP').Disconnect();
"
This action is not processed in i2 control now. We added your idea in the backlog.

May be I missed something?
[02-04-2015 13:09:29.513] INFO SIP is OnlineSorry, i missed your words:

V2.2.1 and V2.2.2 work at the same

So, current:

IR.AddListener(IR.EVENT_ONLINE, IR.GetDevice('SIP'), function () { IR.Log("SIP is Online"); });

Is already working in V2.2.1?



Last question:

how does SIP's EVENT_ONLINE & EVENT_OFFLINE work when background mode is on?
We don't advise use EVENT_OFFLINE, when you use background mode.

Why?
The Background mode allows drivers to work even if you minimize the app.
So, when background mode is on, and you minimize the app -> nothing happens. EVENT_ONLINE & EVENT_OFFLINE aren't happen.
After 3 minutes (or 19 minutes, if you use Location tag) the app will be closed by iOS. The app doesn't receive EVENT_OFFLINE when it happens, because iOS stops the app externally, not as a normal process of app closing. And EVENT_OFFLINE do not have time to work.

It is already marked as "not an error" (it means closed)