..

Retrieving P-Asserted-Identity and Remote-Party-ID from SIP Message headers

..

Developer Group

Developer Group
Connect with thousands of other developers to brainstorm ideas, share best practices and tips - or just chat about the latest emerging technologies making noise in the field. And of course, get the most up-to-date service and support news from Dialogic.
Dialogic PowerMedia HMP GlobalCall and R4 API

Retrieving P-Asserted-Identity and Remote-Party-ID from SIP Message headers

  • Apologies for the length of this question.

    Some background; I have an application in which the user for a telephone is emailed the call details (caller, length of call etc) after the call is completed. If a phone rings but the usual operator is not available, any other user may pick up the call. I would like the email to go to the user who picked up the call rather than the absent user who was called. However, I am struggling for a method to identify  the user who picked up the call, from the SIP message header. I had hoped to idenify the user from one of two fields in the SIP message header associated with the GCEV_CONNECTED event: namely P-Asserted-Identity or Remote-Party-ID

    Part of a TCP dump associated with the 200 OK message:

    ...
    > Status-Line SIP/2.0 200 OK
    > Message Header
        > Via: SIP/2.0/UDP 192.168.80.50:5060;branch=z9hG4bk-36-d451-eb5ea87-f716a208
        > From: "Ext 2910"<sip:2910@192.168.80.50>;tag=f7180638-3250a8c0-13c4-65014-36-3f373d36-36
        > To: <sip:2902@192.168.100.10>;tag=749046~6986e0d9-4f9b-4be5-a059-e690e7e506af-18995125
          Date: Tue, 19 Nov 2019 12:28:48 GMT
          Call-ID: f7199e40-3250a8c0-13c4-65014-36-7e604f1-=36
        > CSeq: 1 INVITE
          Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFERE, SUBSCRIBE, NOTIFY
          Allow-Events: presence
          Supported: replaces
          Supported: X-csco-srtp-fallback
          Supported: Geolocation
        > P-Asserted-Identity: "John Smith" <sip:2902@192.168.100.10>
        > Remote-Party-ID: "John Smith" <sip:2902@192.168.100.10>;party=called;screen=yes;privacy=off
        > Contact: <sip:2902@192.168.80.50:5060>
          Content-Type: application/sdp
          Content-Length: 274
    
    
    Some bits of source code which are called on opening the virtual board(s), GlobalCall device(s), and on processing the GCEV_CONNECTED event:

    //
    int virtualBoardCreate (int boardCount, IP_VIRTBOARD *pVirtBoards)
    {
        ...
        for (int i = 0; i < boardCount; i++)
        {
            IP_VIRTBOARD    *pVirtBoard = pVirtBoardsIdea;
    
            ...
            pVirtBoard->sip_signaling_port = 5060;
            pVirtBoard->sip_msginfo_mask = IP_SIP_MSGINFO_ENABLE | IP_SIP_MIME_ENABLE;
        }
    
        return 0;
    }
    
    //
    int GlobalCallDeviceOnOpenEx (unsigned long DEVH)
    {
        ...
        GC_PARM_BLKP    parmblkp = NULL;
    
        if ((result = gc_util_insert_parm_ref (&parmblkp, IPSET_CONFIG, IPPARM_REGISTER_SIP_HEADER, strlen (pAllowEvents) + 1, pAllowEvents)) != GC_SUCCESS)
            return result;
    
        if ((result = gc_util_insert_parm_ref (&parmblkp, IPSET_CONFIG, IPPARM_REGISTER_SIP_HEADER, strlen (pPAssertedIdentity) + 1, pPAssertedIdentity)) != GC_SUCCESS)
            return result;
    
        if ((result = gc_util_insert_parm_ref (&parmblkp, IPSET_CONFIG, IPPARM_REGISTER_SIP_HEADER, strlen (pRemotePartyId) + 1, pRemotePartyId)) != GC_SUCCESS)
            return result;
    
        return 0;
    }
    
    //
    const char *getSetIDText (int setID)
    {
        // convert numeric setID to text
        ...
    }
    
    //
    const char *getParmIDText (int parmID)
    {
        // convert numeric parmID to text
        ...
    }
    
    //
    int GlobalCallDeviceGcevConnected (const METAEVENT& metaevent)
    {
        GC_PARM_BLKP    parmblkp ((GC_PARM_BLKP) metaevent.extevtdatap);
    
        int parmctr = 0;
    
        GC_PARM_DATA_EXT    parm;
        INIT_GC_PARM_DATA_EXT(&parm);
    
        while ((gc_util_next_parm_ex (parmblkp, &parm)) == GC_SUCCESS)
        {
            printf ("\n");
    
            switch (parm.set_ID)
            {
                case IPSET_SIP_MSGINFO:
                    printf ("parmctr : %i", parmctr++);
                    printf ("set_ID  : %s", getSetIDText (parm.set_ID));
                    printf ("parm_ID : %s",  getParmIDText (parm.parm_ID));
                    printf ("pData   : %s", (char *) parm.pData);
                    break;
    
                // all other known values of parm.set_ID catered for)
                ...
            }
        }
    
        return 0;
    }

    The output text generated by the function GlobalCallDeviceGcevConnected above:

    parmctr : 0
    set_ID  : IPSET_SDP
    parm_ID : IPPARM_SDP_OFFER
    pData   : v=0
     o=CiscoSystemsCCM-SIP 749223 1 IN IP4 192.168.100.10
     s=SIP Call
     c=IN IP4 192.168.100.10
     b=TIAS:64000
     b=AS:64
     t=0 0
     m=audio 24666 RTP/AVP 0 8 96 a=rtpmap:0 PCMU/8000
     a=ptime:20
     a=rtpmap:8 PCMA/8000
     a=rtpmap:96 telephone-event/8000
     a=fmtp:96 0-15
    
    parmctr : 1
    set_ID  : IPSET_SIP_MSGINFO
    parm_ID : IPPARM_CONTACT_URI
    pData   : sip:2902@192.168.100.10:5060^[0^P
    
    parmctr : 2
    set_ID  : IPSET_SIP_MSGINFO
    parm_ID : IPPARM_CALLID_HDR
    pData   : f7199e40-3250a8c0-13c4-65014-19-212ff6b3-19
    
    parmctr : 3
    set_ID  : IPSET_SIP_MSGINFO
    parm_ID : IPPARM_FROM
    pData   : "Ext 2910"<sip:2910@192.168.80.50>;tag=f7180638-3250a8c0-13c4-65014-19-afd3c09-19^[0^S
    
    parmctr : 4
    set_ID  : IPSET_SIP_MSGINFO
    parm_ID : IPPARM_TO
    pData   : <sip:2902@192.168.100.10>;tag=749223~6986e0d9-4f9b-4be5-a059-e690e7e506af-18995131

    As can be seen, the fields I am interested in (P-Asserted-Identity and Remote-Party-ID are present in the SIP message header, but are not extracted into the IP parameter buffers.

    I have referred to the manual globalcall_for_ip_hmp_v12.pdf, section 4.9 Setting and retrieving SIP Message Header Fields and to my alarm, in Section 4.9.4, Registering SIP Header Fields to be retrieved,

    (pages 183-184), the two fields I want do not seem to be listed.

    Have I missed something, or is there another method of retrieving a user's id from the SIP Message headers (or any other part of HMP / GlobalCall) ?

    Regards

  • Hi,

    I guess the main question here could be are you running the application in 1PCC or 3PCC mode.

    I know it works on 1PCC mode after connected event, and suspect 3PCC you need to call it on receipt of the GC SIP 200ok event and not the connected event as it would have been cleared (or I suspect).

    Regards,

    Jeff

    Jeff