your message:


PUBLISH
sip:x.x.x.x:5060 SIP/2.0.
...
Content-Type: application/vq-rtcpxr.
...

and config of kamailio:

if(method == "PUBLISH" && hash_body("application/vq-rtcpxr"))

your message has body application/vq-rtcpxr (not application/sdp as i wrote) and you should check exactly this.


Wbr,
Alexandr





On 24 November 2014 at 18:49, A Acosta <ashlin.jonesacosta@pnmac.com> wrote:
Alexander: Thanks for helping me figure all this out! I'm still having trouble not really understanding what exactly the "method" keyword does, and what part of the SIP message it actually reads. I've tried to use the method keyword with simple assignment operator and also using the =~ operator in conjunction with POSIX regular expressions, but I fail to see the routing logic trigger the query and actually write anything to the database. I know it's something I'm missing with regards to the method keyword because I've tested with passing it nothing but a dot (.) and can see records trying to be written to the database, so my logic isn't entirely bad. Below is a sample of what a PUBLISH message looks like for a Polycom phone inside my company. Which line does the method keyword read from exactly?


U x.x.x.x:5060 -> x.x.x.x:5060
PUBLISH sip:x.x.x.x:5060 SIP/2.0.
Record-Route: <sip:x.x.x.x:5060;lr;sipXecs-rs=%2Aauth%7E.%2Afrom%7EQjE1NEI1NUEtRTRCNzkyODQ%60%2189a33b59bd9ef79073ccd9f158406648>.
Via: SIP/2.0/UDP x.x.x.x;branch=z9hG4bK-XX-fc34SZW2jzuKVqbP6rMSlXLQrA.
Via: SIP/2.0/UDP x.x.x.x:5060;branch=z9hG4bK714a53a90CB1CA4.
From: "Mr. Jones" <sip:xxx@domain.com>;tag=B154B55A-E4B79284.
To: <sip:x.x.x.x:5060>.
Cseq: 1 PUBLISH.
Call-Id: 770c811a-4b32fac4-ad6fc8fa@x.x.x.x.
Contact: <sip:xxx@x.x.x.x:5060;x-sipX-nonat>.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER.
Event: vq-rtcpxr.
User-Agent: PolycomSoundPointIP-SPIP_550-UA/4.0.6.0711.
Accept-Language: en.
Max-Forwards: 20.
Expires: 3600.
Content-Type: application/vq-rtcpxr.
Content-Length: 711.
Date: Mon, 24 Nov 2014 17:37:20 GMT.
.
VQIntervalReport.
LocalMetrics:.
TimeStamps:START=2014-11-24T17:13:21Z STOP=2014-11-24T17:37:20Z.
SessionDesc:PT=0 PPS=50 SSUP=off.
CallID:06c19fda-eea0-1232-499f-005056b324c2.
ToID:"+15552200000" <sip:+15552200000@x.x.x.x>.
FromID:"Mr. Jones" <sip:+15552220000@domain.com>.
LocalAddr:IP=x.x.x.x PORT=10008 SSRC=1203061302.
RemoteAddr:IP=x.x.x.x PORT=30538 SSRC=2224798254.
JitterBuffer:JBA=3 JBR=5 JBN=50 JBM=150 JBX=160.
PacketLoss:NLR=0.0 JDR=0.0.
BurstGapLoss:BLD=0.0 BD=0 GLD=0.0 GD=65535 GMIN=16.
Delay:RTD=0 ESD=78 IAJ=0.
Signal:RERL=127.
QualityEst:RLQ=93 RCQ=92 MOSLQ=4.1 MOSCQ=4.1.


On Fri, Nov 21, 2014 at 11:58 PM, Alexandr Dubovikov <alexandr.dubovikov@gmail.com> wrote:

Sorry. Should be has_body ;-)

With mobile regards,
Alexandr

On Nov 22, 2014 12:59 AM, "A Acosta" <ashlin.jonesacosta@pnmac.com> wrote:
Alex, thanks for the reply.

I'm getting the following errors while trying to use hash_body

"kamailio: ERROR: <core> [cfg.y:3301]: yyparse(): cfg. parser: failed to find command hash_body (params 1)"
"kamailio: : <core> [cfg.y:3441]: yyerror_at(): parse error in config file /usr/local/etc/kamailio//kamailio.cfg, line 98, column 53: unknown command, missing loadmodule?#012"

On Thu, Nov 20, 2014 at 11:52 PM, Alexandr Dubovikov <alexandr.dubovikov@gmail.com> wrote:
Hi Ashlin,

you should implement it in this way:

1.  set for all Polycom devices IP of your homer capture server as collector IP.
2. check if method is PUBLISH and it has Event == vq-rtcpxr and/or Content-type: application/vq-rtcpxr
3. extract CallID: from SDP body. (don't use Call-ID from PUBLISH)
4. make custom SQL insert to the log_capture or to the sip_capture table with original CallID value from SDP body
5. send reply 200 OK

something like this:

 if (method == "PUBLISH" && hash_body("application/sdp"))
 {
                if(sdp_get_line_startswith("$avp(callid)", "CalllID:)) {
                        #cut off CalliD:  and insert it to DB as correlation_id
                       sql_query("cb", "INSERT INTO logs_capture(...,correlaton_id,....) VALUES (...., $avp(callid),...);";
                                               
                }
                t_reply("200","PUBLISH RECORDED");
                exit(0);
}

Wbr,
Alexandr


On 11/21/2014 2:30 AM, A Acosta wrote:

    #ALL MESSAGES
    if($sht(a=>method::all) > 0) {
        sql_query("cb", "INSERT INTO stats_method (from_date, to_date, method, total) VALUES($var(f_date), $var(t_date), 'ALL', $sht(a=>method::all))");
        $sht(a=>method::all) = 0;
    }

}

I managed to get this working with Opensips with the help of the following link:http://wiki.sipfoundry.org/display/sipXecs/Setting+up+an+RTCP-XR+collector+for+Polycom+Productivity+Suite

However, Kamailio's routing logic syntax is different and I'm having a hard time parsing through it. This is what the RTCP-XR collection logic looks like in the Opensips routing logic: 

# main request routing logic

route{
        #For example, you can capture only needed methods...
        if (method =~ "^(INVITE|ACK|CANCEL|BYE|REFER|PRACK|UPDATE)") {
                sip_capture();
        }

        else if (method =~ "^PUBLISH" && !$ct =~ "x-sipX-nonat" && $rd = "domain.com" ) {
                #xlog("$rd=================================");
                perl_exec("messagedump");
                t_reply("200","PUBLISH RECORDED");
        }

        exit;
}

onreply_route {

        #And only needed reply or needed requests method
        if(status =~ "^(1[0-9][0-9]|[3[0-9][0-9]|4[0-9]|[56][0-9][0-9])") {
        if($rm =~ "^(INVITE|ACK|CANCEL|BYE|REFER|PRACK|UPDATE)") {
                sip_capture();
        }
        exit;
}
}

Any help would be appreciated. 
--
Ashlin Jones-Acosta
Telephony Systems Engineer
Infrastructure Technology
Direct: (805) 222-0934
PennyMac


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev




--
Ashlin Jones-Acosta
Telephony Systems Engineer
Infrastructure Technology
Direct: (805) 222-0934
PennyMac

_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev




--
Ashlin Jones-Acosta
Telephony Systems Engineer
Infrastructure Technology
Direct: (805) 222-0934
PennyMac

_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev