[SR-Users] Add PIDF-LO object to INVITE

Adarsh Chauhan adarshchauhan at hotmail.com
Tue Aug 31 19:27:25 CEST 2021


Hi All,

I am trying to add PIDF-LO XML to INVITE, however i have had little success so far.
My end goal is to create an invite like mentioned in
https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-sipre/4010daf5-445e-4d8d-bb0c-b0c84ef280e8

I have the following config:


request_route{
    xlog("L_DBG","REQUEST RECEIVED \n ($mb) \n");
    if (is_method("INVITE")) {
           xinfo("$ua\n");
           regex_substring("$ua", "([a-f0-9]{12})",0, 1, "$var(asd)");

           if($var(asd)!="") {
               http_client_query("http://127.0.0.1/location/$var(asd)","$var(result)");
               xdbg("$rc ,[$var(result)]\n");

           if(!has_body("application/pidf+xml")) {
               set_body_multipart("$rb", "application/sdp", "delimiter");
                msg_apply_changes();
                append_body_part($(var(result){s.unquote}), "application/pidf+xml");
                msg_apply_changes();
                }
                }else {
                    xerr("NO MAC ADDRESS FOUND\n");
                    }
                }
            route("forward");
}

which achieves the following but doesn't have the xml in the correct format. I have explored most of the modules but couldnt find a handy function for this.



INVITE sip:service at 10.0.1.133:5060 SIP/2.0

Via: SIP/2.0/TCP 169.254.172.2;branch=z9hG4bK3de6.d3b4cddbcbdba59a3e190c41b06ada15.0;i=1

From: sipp <sip:sipp at 1.1.1.1:45907>;tag=21113SIPpTag001

To: service <sip:service at 10.0.1.133:5060>

Call-ID: 1-21113 at 1.1.1.1

CSeq: 1 INVITE

Contact: sip:sipp at 1.1.1.1:45907

Max-Forwards: 70

Subject: Performance Test

Content-Length:   937

Content-Type: multipart/mixed;boundary="delimiter"

Mime-Version: 1.0


--delimiter

Content-Type: application/sdp


v=0

o=user1 53655765 2353687637 IN IP4 172.31.87.143

s=-

c=IN IP4 1.1.1.1

t=0 0

m=audio 6000 RTP/AVP 0

a=rtpmap:0 PCMU/8000


--delimiter

Content-Type: application/pidf+xml


<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<presence xmlns:xsd=\"http:/ /www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/ XMLSchema-instance\" entity=\"sip:U

SER9 at SBSBVR00Test0m.ABC.com\" xmlns=\"urn:ietf:params:xml:ns:pidf\">\n<tuple id=\"tuple0\">\n<status>\n<geopriv xmlns=\"urn:ietf:params:xml:ns:pidf:geopriv10\">\n<civicAddre

ss xmlns=\"urn:ietf:params:xml:ns:pidf:geopriv10:civicAddr\">\n['<STS>Ave</STS>\\n', '<A1>WA</A1>\\n', '<A3>Redmond</A3>\\n', '<RD>163rd</RD>\\n', '<PC>98052</PC>\\n', '<POD

>NE</POD>\\n', '<NAM>Contoso Corporation </NAM>\\n', '<HNO>3910</HNO>\\n', '<country>US</country>\\n']\n</civicAddress>\n</geopriv>\n</status>\n</tuple>\n</presence>

--delimiter--

Regards,
Adarsh Chauhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210831/f8ecb6bc/attachment.htm>


More information about the sr-users mailing list