How to parse RPID from asterisk?

Антон Шудяев
Tue, Apr 8, 2025 9:10 AM

I have presence subscription to extension on asterisk using
application/pidf+xml. I receive NOTIFY:
NOTIFY sip:342@192.168.2.30:5060;ob SIP/2.0
Via: SIP/2.0/UDP 192.168.2.168:5060
;rport;branch=z9hG4bKPj2c595bca-61f9-4c1f-a491-6ae2e7ebf409
From: sip:667@192.168.2.168;tag=204a5b90-76cd-4a5e-ad54-e0f1bc08bdff
To: sip:342@192.168.2.30;tag=295cbffa-e196-4ae1-bd7b-6c7fd2b727f4
Contact: sip:192.168.2.168:5060
Call-ID: 0e6511a9-f1a1-4bb2-a8a3-092ff42eae93
CSeq: 9841 NOTIFY
Event: presence
Subscription-State: active;expires=585
Allow-Events: message-summary, presence, dialog, refer
Max-Forwards: 70
User-Agent: FPBX-16.0.40.10(18.24.2)
Content-Type: application/pidf+xml
Content-Length:  474

<?xml version="1.0" encoding="UTF-8"?>

<presence entity="sip:667@192.168.2.168" 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">
<note>On the phone</note>
<tuple id="667">
<status>
<basic>open</basic>
</status>
<contact priority="1">sip:342@192.168.2.30</contact>
</tuple>
dm:person
rpid:activities
<rpid:on-the-phone />
</rpid:activities>
</dm:person>
</presence>

With pjsip_pres_get_status i can obtain pjsip_pres_status, where i have
only rpid.activity == PJRPID_ACTIVITY_UNKNOWN. Also i haven't pointer to
person xml node, only to tuples. What is the way to process on-the-phone
activity, which means that extension is busy?

I have presence subscription to extension on asterisk using application/pidf+xml. I receive NOTIFY: NOTIFY sip:342@192.168.2.30:5060;ob SIP/2.0 Via: SIP/2.0/UDP 192.168.2.168:5060 ;rport;branch=z9hG4bKPj2c595bca-61f9-4c1f-a491-6ae2e7ebf409 From: <sip:667@192.168.2.168>;tag=204a5b90-76cd-4a5e-ad54-e0f1bc08bdff To: <sip:342@192.168.2.30>;tag=295cbffa-e196-4ae1-bd7b-6c7fd2b727f4 Contact: <sip:192.168.2.168:5060> Call-ID: 0e6511a9-f1a1-4bb2-a8a3-092ff42eae93 CSeq: 9841 NOTIFY Event: presence Subscription-State: active;expires=585 Allow-Events: message-summary, presence, dialog, refer Max-Forwards: 70 User-Agent: FPBX-16.0.40.10(18.24.2) Content-Type: application/pidf+xml Content-Length: 474 <?xml version="1.0" encoding="UTF-8"?> <presence entity="sip:667@192.168.2.168" 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"> <note>On the phone</note> <tuple id="667"> <status> <basic>open</basic> </status> <contact priority="1">sip:342@192.168.2.30</contact> </tuple> <dm:person> <rpid:activities> <rpid:on-the-phone /> </rpid:activities> </dm:person> </presence> With *pjsip_pres_get_status* i can obtain *pjsip_pres_status*, where i have only *rpid.activity == PJRPID_ACTIVITY_UNKNOWN*. Also i haven't pointer to person xml node, only to tuples. What is the way to process on-the-phone activity, which means that extension is busy?
AG
Adrian Georgescu
Tue, Apr 8, 2025 10:38 AM

You can parse PIDFs using this module:

https://github.com/AGProjects/python3-sipsimple/blob/master/sipsimple/payloads/pidf.py
python3-sipsimple/sipsimple/payloads/pidf.py at master · AGProjects/python3-sipsimple
github.com

On 8. Apr 2025, at 06:10, Антон Шудяев ashudyaev@gmail.com wrote:

I have presence subscription to extension on asterisk using application/pidf+xml. I receive NOTIFY:
NOTIFY sip:342@192.168.2.30:5060;ob SIP/2.0
Via: SIP/2.0/UDP 192.168.2.168:5060;rport;branch=z9hG4bKPj2c595bca-61f9-4c1f-a491-6ae2e7ebf409
From: <sip:667@192.168.2.168 mailto:sip%3A667@192.168.2.168>;tag=204a5b90-76cd-4a5e-ad54-e0f1bc08bdff
To: <sip:342@192.168.2.30 mailto:sip%3A342@192.168.2.30>;tag=295cbffa-e196-4ae1-bd7b-6c7fd2b727f4
Contact: <sip:192.168.2.168:5060 http://192.168.2.168:5060/>
Call-ID: 0e6511a9-f1a1-4bb2-a8a3-092ff42eae93
CSeq: 9841 NOTIFY
Event: presence
Subscription-State: active;expires=585
Allow-Events: message-summary, presence, dialog, refer
Max-Forwards: 70
User-Agent: FPBX-16.0.40.10(18.24.2)
Content-Type: application/pidf+xml
Content-Length:  474

<?xml version="1.0" encoding="UTF-8"?> <presence entity="sip:667@192.168.2.168 <mailto:sip%3A667@192.168.2.168>" 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"> <note>On the phone</note> <tuple id="667"> <status> <basic>open</basic> </status> <contact priority="1">sip:342@192.168.2.30 <mailto:sip%3A342@192.168.2.30></contact> </tuple> <dm:person> <rpid:activities> <rpid:on-the-phone /> </rpid:activities> </dm:person> </presence>

With pjsip_pres_get_status i can obtain pjsip_pres_status, where i have only rpid.activity == PJRPID_ACTIVITY_UNKNOWN. Also i haven't pointer to person xml node, only to tuples. What is the way to process on-the-phone activity, which means that extension is busy?


Visit our blog: http://blog.pjsip.org

pjsip mailing list -- pjsip@lists.pjsip.org
To unsubscribe send an email to pjsip-leave@lists.pjsip.org

You can parse PIDFs using this module: https://github.com/AGProjects/python3-sipsimple/blob/master/sipsimple/payloads/pidf.py python3-sipsimple/sipsimple/payloads/pidf.py at master · AGProjects/python3-sipsimple github.com > On 8. Apr 2025, at 06:10, Антон Шудяев <ashudyaev@gmail.com> wrote: > > I have presence subscription to extension on asterisk using application/pidf+xml. I receive NOTIFY: > NOTIFY sip:342@192.168.2.30:5060;ob SIP/2.0 > Via: SIP/2.0/UDP 192.168.2.168:5060;rport;branch=z9hG4bKPj2c595bca-61f9-4c1f-a491-6ae2e7ebf409 > From: <sip:667@192.168.2.168 <mailto:sip%3A667@192.168.2.168>>;tag=204a5b90-76cd-4a5e-ad54-e0f1bc08bdff > To: <sip:342@192.168.2.30 <mailto:sip%3A342@192.168.2.30>>;tag=295cbffa-e196-4ae1-bd7b-6c7fd2b727f4 > Contact: <sip:192.168.2.168:5060 <http://192.168.2.168:5060/>> > Call-ID: 0e6511a9-f1a1-4bb2-a8a3-092ff42eae93 > CSeq: 9841 NOTIFY > Event: presence > Subscription-State: active;expires=585 > Allow-Events: message-summary, presence, dialog, refer > Max-Forwards: 70 > User-Agent: FPBX-16.0.40.10(18.24.2) > Content-Type: application/pidf+xml > Content-Length: 474 > > <?xml version="1.0" encoding="UTF-8"?> > <presence entity="sip:667@192.168.2.168 <mailto:sip%3A667@192.168.2.168>" 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"> > <note>On the phone</note> > <tuple id="667"> > <status> > <basic>open</basic> > </status> > <contact priority="1">sip:342@192.168.2.30 <mailto:sip%3A342@192.168.2.30></contact> > </tuple> > <dm:person> > <rpid:activities> > <rpid:on-the-phone /> > </rpid:activities> > </dm:person> > </presence> > > With pjsip_pres_get_status i can obtain pjsip_pres_status, where i have only rpid.activity == PJRPID_ACTIVITY_UNKNOWN. Also i haven't pointer to person xml node, only to tuples. What is the way to process on-the-phone activity, which means that extension is busy? > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list -- pjsip@lists.pjsip.org > To unsubscribe send an email to pjsip-leave@lists.pjsip.org
JK
Jaco Kroon
Tue, Apr 8, 2025 11:44 AM

Hi,

I suspect this question is better asked on the asterisk project compared
to pjsip - whilst asterisk utilizes pjsip it's an independent project
distinct from asterisk.

https://community.asterisk.org/

https://docs.asterisk.org/Asterisk-Community/Mailing-Lists/ (although
for these questions you're probably off on the forums which seems to see
more activity).

You can also try IRC channel #asterisk on Libera.chat.

Unfortunately I don't have a more detailed answer for you regarding the
actual question.

Kind regards,
Jaco

On 2025/04/08 11:10, Антон Шудяев wrote:

I have presence subscription to extension on asterisk using
application/pidf+xml. I receive NOTIFY:
NOTIFY sip:342@192.168.2.30:5060;ob SIP/2.0
Via: SIP/2.0/UDP
192.168.2.168:5060;rport;branch=z9hG4bKPj2c595bca-61f9-4c1f-a491-6ae2e7ebf409
From: <sip:667@192.168.2.168
mailto:sip%3A667@192.168.2.168>;tag=204a5b90-76cd-4a5e-ad54-e0f1bc08bdff
To: <sip:342@192.168.2.30
mailto:sip%3A342@192.168.2.30>;tag=295cbffa-e196-4ae1-bd7b-6c7fd2b727f4
Contact: <sip:192.168.2.168:5060 http://192.168.2.168:5060>
Call-ID: 0e6511a9-f1a1-4bb2-a8a3-092ff42eae93
CSeq: 9841 NOTIFY
Event: presence
Subscription-State: active;expires=585
Allow-Events: message-summary, presence, dialog, refer
Max-Forwards: 70
User-Agent: FPBX-16.0.40.10(18.24.2)
Content-Type: application/pidf+xml
Content-Length:   474

<?xml version="1.0" encoding="UTF-8"?>

<presence entity="sip:667@192.168.2.168 <mailto:sip%3A667@192.168.2.168>" 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">
 <note>On the phone</note>
 <tuple id="667">
  <status>
   <basic>open</basic>
  </status>
  <contact priority="1">sip:342@192.168.2.30
mailto:sip%3A342@192.168.2.30</contact>
 </tuple>
 dm:person
  rpid:activities
   <rpid:on-the-phone />
  </rpid:activities>
 </dm:person>
</presence>

With pjsip_pres_get_status i can obtain pjsip_pres_status, where i
have only rpid.activity == PJRPID_ACTIVITY_UNKNOWN. Also i haven't
pointer to person xml node, only to tuples. What is the way to process
on-the-phone activity, which means that extension is busy?


Visit our blog:http://blog.pjsip.org

pjsip mailing list --pjsip@lists.pjsip.org
To unsubscribe send an email topjsip-leave@lists.pjsip.org

Hi, I suspect this question is better asked on the asterisk project compared to pjsip - whilst asterisk utilizes pjsip it's an independent project distinct from asterisk. https://community.asterisk.org/ https://docs.asterisk.org/Asterisk-Community/Mailing-Lists/ (although for these questions you're probably off on the forums which seems to see more activity). You can also try IRC channel #asterisk on Libera.chat. Unfortunately I don't have a more detailed answer for you regarding the actual question. Kind regards, Jaco On 2025/04/08 11:10, Антон Шудяев wrote: > I have presence subscription to extension on asterisk using > application/pidf+xml. I receive NOTIFY: > NOTIFY sip:342@192.168.2.30:5060;ob SIP/2.0 > Via: SIP/2.0/UDP > 192.168.2.168:5060;rport;branch=z9hG4bKPj2c595bca-61f9-4c1f-a491-6ae2e7ebf409 > From: <sip:667@192.168.2.168 > <mailto:sip%3A667@192.168.2.168>>;tag=204a5b90-76cd-4a5e-ad54-e0f1bc08bdff > To: <sip:342@192.168.2.30 > <mailto:sip%3A342@192.168.2.30>>;tag=295cbffa-e196-4ae1-bd7b-6c7fd2b727f4 > Contact: <sip:192.168.2.168:5060 <http://192.168.2.168:5060>> > Call-ID: 0e6511a9-f1a1-4bb2-a8a3-092ff42eae93 > CSeq: 9841 NOTIFY > Event: presence > Subscription-State: active;expires=585 > Allow-Events: message-summary, presence, dialog, refer > Max-Forwards: 70 > User-Agent: FPBX-16.0.40.10(18.24.2) > Content-Type: application/pidf+xml > Content-Length:   474 > > <?xml version="1.0" encoding="UTF-8"?> > <presence entity="sip:667@192.168.2.168 > <mailto:sip%3A667@192.168.2.168>" 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"> >  <note>On the phone</note> >  <tuple id="667"> >   <status> >    <basic>open</basic> >   </status> >   <contact priority="1">sip:342@192.168.2.30 > <mailto:sip%3A342@192.168.2.30></contact> >  </tuple> >  <dm:person> >   <rpid:activities> >    <rpid:on-the-phone /> >   </rpid:activities> >  </dm:person> > </presence> > > With *pjsip_pres_get_status* i can obtain *pjsip_pres_status*, where i > have only *rpid.activity == PJRPID_ACTIVITY_UNKNOWN*. Also i haven't > pointer to person xml node, only to tuples. What is the way to process > on-the-phone activity, which means that extension is busy? > > _______________________________________________ > Visit our blog:http://blog.pjsip.org > > pjsip mailing list --pjsip@lists.pjsip.org > To unsubscribe send an email topjsip-leave@lists.pjsip.org