pjsip Digest, Vol 67, Issue 9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all

I have made a lot of progress and ditched Python for C in order to get more
control over the variable, but I am still struggling to get it working

I use both call backs: on_buddy_evsub_state and on_buddy_state as can be
seen below.

this is my NOTIFY

NOTIFY sip:0203xxxxxxx at 10.5.2.127:5060;ob SIP/2.0
From: "0203xxxxxxxx"<sip:0203xxxxxxx@xxxxxxxxxxxxxxxxxxxxxx
>;tag=1367182964394
To: "0203xxxxxxxxx"<sip:0203xxxxxxxxxx at xxxxxxxxxxxxx.co.uk
>;tag=cKnOOkeiuRWuulQiTj6W77U4281FYi7G
Call-ID: TySlOKdi.cXb5M-YNRNHQ0fYDYpz8f1.
CSeq: 138472919 NOTIFY
Via: SIP/2.0/UDP x.x.x.x:5060;branch=z9hG4bK-14a077a-92d3674-6278e5b3
Content-Type: application/pidf+xml
Contact: <sip:0203xxxxxxxxx at xxxxxxxxxxxxxxxx.co.uk:5060;maddr=x.x.x.x>
User-Agent:  Nortel SESM 14.0.9.11
Max-Forwards: 20
Supported:
com.nortelnetworks.firewall,p-3rdpartycontrol,nosec,join,x-nortel-sipvc
Subscription-Expires: 151
Event: presence
Subscription-State: active;expires=151
Content-Length: 634

<?xml version="1.0" encoding="UTF-8"?>
<presence xmlns="urn:ietf:params:xml:ns:pidf"
 xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
 xmlns:rp="urn:ietf:params:xml:ns:pidf:rpid"
entity="pres:xxxxxxxxxxxxxx at xxxxxxxxxxxxxx.co.uk">
<tuple
id="TySlOKdi.cXb5M-YNRNHQ0fYDYpz8f1.:cKnOOkeiuRWuulQiTj6W77U4281FYi7G:1367182964394-0">
<status>
<basic>open</basic>
</status>
<rp:class>Summary</rp:class></tuple>
<dm:person
id="TySlOKdi.cXb5M-YNRNHQ0fYDYpz8f1.:cKnOOkeiuRWuulQiTj6W77U4281FYi7G:1367182964394-1">
<status>
<basic>open</basic>
</status>
<rp:activities>
<rp:on-the-phone/>
</rp:activities>
</dm:person>
</presence>


I can get the basic_open working on the on_buddy_state but that does not
pull the <person> attribute, and I can get the
pjsip_rx_data_get_info(rdata) working on the on_buddy_evsub_state but that
only gives the cSeq number of the NOTIFY and some more info, but not the
body of the SIP message that I could then parse.


Could someone maybe shed some light on this. I have a feeling it is very
easy once showed.

thanks
Marc




/* Get presence information */
static void on_buddy_evsub_state( pjsua_buddy_id buddy_id,  pjsip_evsub
*sub, pjsip_event *event)
{
    char event_info[80];

    PJ_UNUSED_ARG(sub);

    event_info[0] = '\0';

    if (event->type == PJSIP_EVENT_TSX_STATE &&
            event->body.tsx_state.type == PJSIP_EVENT_RX_MSG)
    {
        pjsip_rx_data *rdata = event->body.tsx_state.src.rdata;
        snprintf(event_info, sizeof(event_info),
                 " (RX %s)",
                 pjsip_rx_data_get_info(rdata));
    }

    PJ_LOG(4,(THIS_FILE,
              "Buddy %d: subscription state: %s (event: %s - %s)",
              buddy_id, pjsip_evsub_get_state_name(sub),
              pjsip_event_str(event->type),
              event_info));
}



/* Get presence information */
static void on_buddy_state(pjsua_buddy_id buddy_id)
{
    pjsua_buddy_info info;
    pjsua_buddy_get_info(buddy_id, &info);
pjrpid_element rpid;
rpid = info.rpid;
pjsip_pres_status presence_status;
presence_status = info.pres_status;

    PJ_LOG(3,(THIS_FILE, "%.*s status is %.*s, pres_status count is %d "
 "- rpid %d)",
      (int)info.uri.slen,
      info.uri.ptr,
      (int)info.status_text.slen,
  info.status_text.ptr,
  presence_status.info_cnt,
  presence_status.info[0].basic_open
      ));
}



On Mon, Mar 4, 2013 at 3:36 PM, <pjsip-request at lists.pjsip.org> wrote:

> Send pjsip mailing list submissions to
>         pjsip at lists.pjsip.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
> or, via email, send a message with subject or body 'help' to
>         pjsip-request at lists.pjsip.org
>
> You can reach the person managing the list at
>         pjsip-owner at lists.pjsip.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of pjsip digest..."
>
>
> Today's Topics:
>
>    1. Python PJSUA - Struggling with rpidf presence (Marc de Corny)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 4 Mar 2013 15:36:29 +0000
> From: Marc de Corny <marcdecorny@xxxxxxxxx>
> To: pjsip at lists.pjsip.org
> Subject: Python PJSUA - Struggling with rpidf presence
> Message-ID:
>         <
> CA+myZ6dmCt7YNg5Kypp0ACYW9XH1DtfNvvheBaeszmNaNRMwKA at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi All
>
> Just started playing with PJSIP and after the usual initial struggle to get
> it up and working. I now have a good proof of concept.
>
> However I am really struggling on getting the Presence to work. Our SIP
> platform uses RFC 4480 which I can see is supported, but in the default
> setup it looks like PJSIP is not reading the additional fields
>
> this is what I am trying to extract from the XML:
>
> <presence xmlns="urn:ietf:params:xml:ns:pidf"
>  xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
>  xmlns:rp="urn:ietf:params:xml:ns:pidf:rpid"
> entity="pres:02xxxxxxxxx at domain.co.uk">
> <tuple
>
> id="wrP8h.Vvw7aZYC4gi5xCB.A7.3YeE8gA:UhbkuR5fTXHHVec4y5vh-Er9C7uG3T4f:1361743276261-0">
> <status>
> <basic>open</basic>
> </status>
> <rp:class>Summary</rp:class></tuple>
> <dm:person
>
> id="wrP8h.Vvw7aZYC4gi5xCB.A7.3YeE8gA:UhbkuR5fTXHHVec4y5vh-Er9C7uG3T4f:1361743276261-1">
> <status>
> <basic>open</basic>
> </status>
> <rp:user-input>active</rp:user-input>
> <rp:activities>
> <rp:unknown/>
> </rp:activities>
> </dm:person>
> </presence>
>
> I decided to use the Python and pjsua setup as it seemed like the easiest,
> but I cannot seem to manage to get the presence to be read successfully. It
> looks like there are API commands to define the extra fields to be parsed,
> but I cannot find them documented for Python. Am I missing something or is
> this a limitation of the Python APIs?
>
> This must be something quite basic that all have come across, but I could
> not find anything in the help pages
>
> Many thanks
> Marc
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20130304/85c71d28/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
> ------------------------------
>
> End of pjsip Digest, Vol 67, Issue 9
> ************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20130430/913608bb/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux