Presence events between sip and verto

Hi,

In verto we can subscribe for presence events for an endpoint but we only get the events related to call channel events, there is no event for un/registration or other presence events like in sip.

i’ve made a patch to get the registration status:

it works for verto endpoints.

My issue is using both type of endpoints, in verto if i do a subscribe for a sip endpoint i can’t get registered status and any other presence related events…

Is there a way to accomplish this?

Thanks,
António

The key is the presence_id, I’m not sure we even hooked that up all the way.

Hi Brian,
yes, using presence_id we got blf working, but no other presence events (registered, away, dnd,…).

To get the blf events in verto i’m doing:

var presence = 'presence.1002@default.com';
  vertoHandle.subscribe(presence, {
    handler: function(v, e) {
      console.log("***presence event e:", e, "id: "+presence);
    }
  });

Got the correct events when making a call to 1002 from 1000:

***presence event e: {data: {…}, eventChannel: 'presence.1002@default.com', eventSerno: 0, subscribedChannel: 'presence.1002@default.com'} id: presence.1002@default.com
main.js:96 ***presence event e: {data: {…}, eventChannel: 'presence.1002@default.com', eventSerno: 1, subscribedChannel: 'presence.1002@default.com'} id: presence.1002@default.com

But if i change in softphone 1002 to “away”, i don’t get the notify event…

The publish event is received:

recv 1025 bytes from udp/[192.168.10.183]:56480 at 10:21:36.908992:
------------------------------------------------------------------------
PUBLISH sip:1002@default.com SIP/2.0
Via: SIP/2.0/UDP 192.168.10.183:56480;branch=z9hG4bK.7UmhuhqLA;rport
From: <sip:1002@default.com>;tag=IYE9CY3~u
To: sip:1002@default.com
CSeq: 35 PUBLISH
Call-ID: SyQSYo693K
Max-Forwards: 70
Route: <sip:192.168.10.182;transport=udp;lr>
Supported: replaces, outbound, gruu, record-aware
Event: presence
Expires: 300
User-Agent: Linphone-Desktop/5.0.8 Qt/5.15.2 LinphoneSDK/5.2.15
SIP-If-Match: 47opGc95
Content-Type: application/pidf+xml
Content-Length: 491

<?xml version="1.0" encoding="UTF-8"?>
<presence xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" xmlns:pidfonline="http://www.linphone.org/xsds/pidfonline.xsd" entity="sip:1002@default.com" xmlns="urn:ietf:params:xml:ns:pidf">
 <tuple id="pm884u">
  <status>
   <basic>open</basic>
   <pidfonline:online/>
  </status>
  <contact priority="0.8">sip:1002@default.com</contact>
  <timestamp>2023-02-02T09:21:36Z</timestamp>
 </tuple>
</presence>

And other sip devices get the notify:

send 1254 bytes to udp/[192.168.10.189]:52384 at 10:21:36.910843:
------------------------------------------------------------------------
NOTIFY sip:1003@192.168.10.189:52384;ob SIP/2.0
Via: SIP/2.0/UDP 192.168.10.182;rport;branch=z9hG4bKjyUN8r9cHUNDN
Max-Forwards: 70
From: <sip:1002@default.com>;tag=MK41c1Zsj3Dh
To: "1003" <sip:1003@default.com>;tag=e7d6dedb2c63432b8959bfa0f37e5491
Call-ID: c05dbc97d961447aaf75a8761c8c58e6
CSeq: 137591151 NOTIFY
Contact: <sip:1002@192.168.10.182:5060>
User-Agent: Default Softswitch
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Event: presence
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Subscription-State: active;expires=588
Content-Type: application/pidf+xml
Content-Length: 430

<?xml version="1.0" encoding="ISO-8859-1"?> 
<presence xmlns='urn:ietf:params:xml:ns:pidf' 
xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' 
xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' 
xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='sip:1002@default.com'>
 <tuple id='t6a5ed77e'>
  <status>
   <basic>open</basic>
  </status>
 </tuple>
 <dm:person id='p06360c4a'>
  <dm:note>Available</dm:note>
 </dm:person>
</presence>

My patch solves this issue for verto, after applying the patch, the verto endpoint receives the presence data:

2023-02-01 20:47:48.140113 99.83% [INFO] mod_verto.c:618 WRITE 192.168.10.183:54531 [{"jsonrpc":"2.0","id":18,"method":"verto.event","params":{"data":{"rpid":"away","status":"Available","event_type":"presence"},"eventChannel":"presence.1002@default.com","eventSerno":3,"subscribedChannel":"presence.1002@default.com"}}]

But when a SIP device do a subscribe to an endpoint only register in verto, it gets notify with status “unregistered”,

send 1259 bytes to udp/[192.168.10.189]:52384 at 10:50:41.275477:
------------------------------------------------------------------------
NOTIFY sip:1003@192.168.10.189:52384;ob SIP/2.0
Via: SIP/2.0/UDP 192.168.10.182;rport;branch=z9hG4bKaQt8j2X1BHceB
Max-Forwards: 70
From: <sip:1001@default.com>;tag=iZXaW4Bgj714
To: "1003" <sip:1003@default.com>;tag=55a2ea808f5a4145965b3e01f9bb8b5b
Call-ID: 3e98df489ac347f3a410ccf28569c84c
CSeq: 137678402 NOTIFY
Contact: <sip:1001@192.168.10.182:5060>
User-Agent: Default Softswitch
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Event: presence
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Subscription-State: active;expires=600
Content-Type: application/pidf+xml
Content-Length: 435

<?xml version="1.0" encoding="ISO-8859-1"?> 
<presence xmlns='urn:ietf:params:xml:ns:pidf' 
xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' 
xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' 
xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='sip:1001@default.com'>
 <tuple id='t6a5ed77e'>
  <status>
   <basic>closed</basic>
  </status>
 </tuple>
 <dm:person id='p06360c4a'>
  <dm:note>Unregistered</dm:note>
 </dm:person>
</presence>

but is registered:
mine::1001@default.com client 192.168.10.183:54531 CONN_REG (WSS)

i guess that we could change sofia_presence but don’t know where would be the right place… or if even possible.

What you think?

Thanks,

Regards,
António

Could you do a PR so we can correct this?

/b

Sure, i will try to create one to solve the issue.
Can you look at the PR for mod_verto ?

Thanks,
António

Yes, once its posted, up date here, and i’ll get a push notice to go check it out.

/b