<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hello OpenSIPS team, userlist,</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I've recently started integrating OpenSIPS with CGrateS using the available CGrateS module[1], and so far everything has been working as expected. But now I think I may have hit an issue (possibly a bug) where OpenSIPS is not sending the correct OriginID request parameter value to CGrateS engine as set in the script when sending the "SessionSv1.ProcessCDR" request at the end of the call.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">My scenario is, a call comes into OpenSIPS from FreeSWITCH (a-leg), OpenSIPS matches the dialed phone number (To User) with a prefix in dr_rules and interprets that the dialed phone number is a local on-net number and the call can be completed locally without sending to upstream carrier, so it forwards the call back to FreeSWITCH (b-leg). The call connects just fine with FreeSWITCH and completes as expected. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Before I forward back the call to FreeSWITCH, I invoke the cgrates_auth() and cgrates_acc() functions for both legs of the call separately. Attached file 'OpenSIPS_CGrateS_route.cfg' has my CGRATES_AUTH route blocks from my script. I'm using the multiple sessions usage way[2] to auth/acc the two call legs separately with CGrateS. Both call legs do get authorized with CGrateS engine correctly and get terminated just fine after the call is ended, but it's when OpenSIPS sends CGrateS engine the "SessionSv1.ProcessCDR" request at the end for b-leg, it sends the wrong OriginID there. It sends the OriginID for a-leg in the "SessionSv1.ProcessCDR" request for b-leg, and that same OriginID in the "SessionSv1.ProcessCDR" request for a-leg as well, to which CGrateS throws an error saying it already exists [{"id":132,"result":null,"error":"EXISTS"}] and only logs the CDR for one call leg. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">In my OpenSIPS script, I've correctly defined unique OriginID's for the two call legs <br><br>For a-leg - $cgr(OriginID) = $ci;</div><div class="gmail_default" style="font-family:verdana,sans-serif">For b-leg - $(cgr(OriginID)[$avp(sessionTag)]) = $ci + "_bleg";<br><br>OpenSIPS is honoring the defined OriginID's for all other previous requests (like "SessionSv1.AuthorizeEventWithDigest", "SessionSv1.InitiateSession", "SessionSv1.TerminateSession" etc) to CGrateS engine just not when sending the "SessionSv1.ProcessCDR" request for b-leg. <br><br>Attached are also the ngrep capture logs from the CGrateS instance showing all exchanges between OpenSIPS and CGrateS, raw and parsed separately for a-leg and b-leg messages for easy reading. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I'm using OpenSIPS (3.4.5 (x86_64/linux))<br>OpenSIPS IP in ngrep logs 192.168.2.204<br>CGrateS IP in ngrep logs 192.168.2.203</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">[1] <a href="https://opensips.org/docs/modules/3.4.x/cgrates.html">https://opensips.org/docs/modules/3.4.x/cgrates.html</a><br>[2] <a href="https://opensips.org/docs/modules/3.4.x/cgrates.html#idp5630528">https://opensips.org/docs/modules/3.4.x/cgrates.html#idp5630528</a><br><br>Please let me know if I'm missing something in my config or doing something wrong here.<br><br>Thanks,</div><div class="gmail_default" style="font-family:verdana,sans-serif">Sal</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div>
</div>