<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi <font style="font-size:11pt" face="Calibri, sans-serif" color="#000000">Răzvan Crainea</font>.</p>
<p><br>
</p>
<p>Thank you very much for trying to help me.</p>
<p>Yesterday my boss asked me to work in another part of our project. So, I will have to pause this verification for a while. When I return to it, I will check the log.</p>
<p><br>
</p>
<p>Best regards.<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: +55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> users-bounces@lists.opensips.org <users-bounces@lists.opensips.org> em nome de Răzvan Crainea <razvan@opensips.org><br>
<b>Enviado:</b> quarta-feira, 22 de junho de 2016 03:57<br>
<b>Para:</b> users@lists.opensips.org<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] How to invok lookup() and get attr from the caller, without side effects?</font>
<div> </div>
</div>
<div><tt>Hi, </tt><tt>Rodrigo!</tt><br>
<br>
<br>
<tt>Can you print the </tt><tt>$r</tt><tt>u variable before and after each lookup() query? Something like:</tt><br>
<br>
<tt>$var(ru) = $ru;</tt><br>
<tt>xlog("R-URI before caller lookup: $ru\n");</tt><br>
<tt>lookup("location", "", "$fu"); # this takes the caller from FROM uri, which I think is more suitable than from contact uri</tt><br>
<tt>$ru = $var(ru);</tt><br>
<tt># continue your processing here</tt><br>
<tt>xlog("R-URI after caller lookup: $ru\n");</tt><br>
<tt></tt><tt>...</tt><br>
<tt># now do the real lookup for the callee</tt><br>
<tt></tt><tt>xlog("R-URI before callee lookup: $ru\n");</tt><br>
<tt>lookup("location");</tt><br>
<tt>xlog("R-URI after callee lookup: $ru\n");</tt><br>
<br>
<tt>Make sure they are all correct, or if they are not, send me these logs.</tt><br>
<br>
<tt>Than</tt><tt>ks</tt><tt>,</tt><br>
<br>
<pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a id="LPlnk851113" class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
<div style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;" id="LPBorder_GT_14665871884700.3158307190380488">
<table style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" id="LPContainer_14665871884650.4834779686569677" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" id="TextCell_14665871884660.5307106323168034">
<div id="LPRemovePreviewContainer_14665871884660.8285657559193569"></div>
<div style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height: 21px;" id="LPTitle_14665871884660.8174378471172087">
<a target="_blank" href="http://www.opensips-solutions.com/" style="text-decoration: none;" id="LPUrlAnchor_14665871884680.4187491294278174">Home — OpenSIPS Solutions</a></div>
<div style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;" id="LPMetadata_14665871884680.6749392097849429">
www.opensips-solutions.com</div>
<div style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;" id="LPDescription_14665871884690.4431969203923727">
OpenSIPS is a mature Open Source implementation of a SIP server. OpenSIPS is more than a SIP proxy/router as it includes application-level functionalities.</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="moz-cite-prefix">On 06/21/2016 07:39 PM, Rodrigo Pimenta Carvalho wrote:<br>
</div>
<blockquote type="cite">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Sevpal.</p>
<p><br>
</p>
<p>Yes. That is what I was doing. It worked very well.</p>
<p>But, nowadays I'm using db_mode = 0 for usrloc. So, the information is always only in RAM. In this case, the query will return no result. That is why I'm trying to read the attr column from table location, from RAM, and get specific information for the caller.</p>
<p><br>
</p>
<p>For the callee, everything is all right.</p>
<p><br>
</p>
<p>Regards.<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: +55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b>
<a class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.opensips.org">
users-bounces@lists.opensips.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org">
<users-bounces@lists.opensips.org></a> em nome de sevpal <a class="moz-txt-link-rfc2396E" href="mailto:sevpal@aol.com">
<sevpal@aol.com></a><br>
<b>Enviado:</b> terça-feira, 21 de junho de 2016 12:20<br>
<b>Para:</b> OpenSIPS users mailling list<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] How to invok lookup() and get attr from the caller, without side effects?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div style="font-size:12pt; font-family:'Calibri'; color:#000000">
<div>Hi, have you tried/considered running a simple query on the database and parsing for the information you need?</div>
<div style="font-size:small; text-decoration:none; font-family:"Calibri"; font-weight:normal; color:#000000; font-style:normal; display:inline">
<div style="font:10pt tahoma">
<div> </div>
<div style="background:#f5f5f5">
<div style=""><b>From:</b> <a title="pimenta@inatel.br" href="mailto:pimenta@inatel.br">
Rodrigo Pimenta Carvalho</a> </div>
<div><b>Sent:</b> Tuesday, June 21, 2016 10:39 AM</div>
<div><b>To:</b> <a title="users@lists.opensips.org" href="mailto:users@lists.opensips.org">
OpenSIPS users mailling list</a> </div>
<div><b>Subject:</b> Re: [OpenSIPS-Users] How to invok lookup() and get attr from the caller, without side effects?</div>
</div>
</div>
<div> </div>
</div>
<div style="font-size:small; text-decoration:none; font-family:"Calibri"; font-weight:normal; color:#000000; font-style:normal; display:inline">
<div id="divtagdefaultwrapper" style="font-size:12pt; font-family:calibri,arial,helvetica,sans-serif; color:#000000; background-color:#ffffff">
<p>Hi <font style="font-size:11pt" face="Calibri, sans-serif" color="#000000">Răzvan</font>.</p>
<p> </p>
<p>I have tried that idea. But that didn't work. The SIP INVITE message is being changed by the OpenSIPS in a wrong way, in my point of view.</p>
<p>Do you know some way to save the entire SIP INVITE message before calling lookup() and then make the saved message take place after the lookup() execution?</p>
<p> </p>
<p>My original message is:</p>
<p> </p>
<div><span style="color:rgb(0,111,201)">INVITE <a class="moz-txt-link-abbreviated" href="mailto:sip:6001@myDomain.com.br">
sip:6001@myDomain.com.br</a> SIP/2.0</span><br>
<span style="color:rgb(0,111,201)">Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215</span><br>
<span style="color:rgb(0,111,201)">From: <sip:crdphmacl_SPnuV5xqtnSX@<span style="color:rgb(0,111,201)">myDomain</span>.com.br>;tag=179920819</span><br>
<span style="color:rgb(0,111,201)">To: <sip:6001@<span style="color:rgb(0,111,201)">myDomain</span>.com.br></span><br>
<span style="color:rgb(0,111,201)">Call-ID: 1410250893</span><br>
<span style="color:rgb(0,111,201)">CSeq: 21 INVITE</span><br>
<span style="color:rgb(0,111,201)">Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:crdphmacl_SPnuV5xqtnSX@xxx.yyy.240.204:60033;transport=tcp">
<sip:crdphmacl_SPnuV5xqtnSX@xxx.yyy.240.204:60033;transport=tcp></a></span><br>
<span style="color:rgb(0,111,201)">Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="sip:6001@<span style="color:rgb(0,111,201)">myDomain</span>.com.br", response="0f4c122d2a0a28dea6194c235cd77430",
algorithm=MD5</span><br>
<span style="color:rgb(0,111,201)">Content-Type: application/sdp</span><br>
<span style="color:rgb(0,111,201)">Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO</span><br>
<span style="color:rgb(0,111,201)">Max-Forwards: 70</span><br>
<span style="color:rgb(0,111,201)">User-Agent: Linphone/3.6.1 (eXosip2/4.0.0)</span><br>
<span style="color:rgb(0,111,201)">Subject: Phone call</span><br>
<span style="color:rgb(0,111,201)">Content-Length: 227</span></div>
<br>
<p>This is being changed to:</p>
<p> </p>
<div><span style="color:rgb(0,111,201)">INVITE <span style="color:rgb(255,0,0)"><a class="moz-txt-link-abbreviated" href="mailto:sip:crdphmacl_SPnuV5xqtnSX@131.221.240.204:60672;transport=tcp;line=c6356a7d87d6f81">sip:crdphmacl_SPnuV5xqtnSX@131.221.240.204:60672;transport=tcp;line=c6356a7d87d6f81</a>
SIP/2.0</span></span><br>
<span style="color:rgb(0,111,201)">Record-Route: <sip:<span style="color:rgb(0,111,201)">myDomain</span>.com.br;transport=tcp;lr;nat=yes;did=0b.b9e0cfe5></span><br>
<span style="color:rgb(0,111,201)">Via: SIP/2.0/TCP <span style="color:rgb(0,111,201)">
myDomain</span>.com.br:5060;branch=z9hG4bKe2db.49d54587.0;i=1</span><br>
<span style="color:rgb(0,111,201)">Via: SIP/2.0/TCP 192.168.21.40:5090;received=<span style="color:rgb(0,111,201)">xxx.yyy</span>.240.204;rport=60672;branch=z9hG4bK716249970</span><br>
<span style="color:rgb(0,111,201)">From: <sip:crdphmacl_SPnuV5xqtnSX@<span style="color:rgb(0,111,201)">myDomain</span>.com.br>;tag=12586028</span><br>
<span style="color:rgb(0,111,201)">To: <sip:6001@<span style="color:rgb(0,111,201)">myDomain</span>.com.br></span><br>
<span style="color:rgb(0,111,201)">Call-ID: 1106771604</span><br>
<span style="color:rgb(0,111,201)">CSeq: 21 INVITE</span><br>
<span style="color:rgb(0,111,201)">Contact: <sip:crdphmacl_SPnuV5xqtnSX@<span style="color:rgb(0,111,201)">xxx.yyy</span>.240.204:60672;transport=tcp></span><br>
<span style="color:rgb(0,111,201)">Content-Type: application/sdp</span><br>
<span style="color:rgb(0,111,201)">Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO</span><br>
<span style="color:rgb(0,111,201)">Max-Forwards: 70</span><br>
<span style="color:rgb(0,111,201)">User-Agent: Linphone/3.6.1 (eXosip2/4.0.0)</span><br>
<span style="color:rgb(0,111,201)">Subject: Phone call</span><br>
<span style="color:rgb(0,111,201)">Content-Length: 224</span></div>
<p> </p>
<p>So, the caller is receiving its own SIP INVITE.<br>
</p>
<p>That is why when A calls B, is A that rings, not B.</p>
<p> </p>
<p>It is becoming a bit complicated. So, I suspect I'm going to the incorrect direction....
<br>
</p>
<p> </p>
<p>Best regards.</p>
<p> </p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:calibri,arial,helvetica,sans-serif; margin:0px">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: +55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="width:98%; display:inline-block">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b>
<a class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.opensips.org">
users-bounces@lists.opensips.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org">
<users-bounces@lists.opensips.org></a> em nome de Răzvan Crainea <a class="moz-txt-link-rfc2396E" href="mailto:razvan@opensips.org">
<razvan@opensips.org></a><br>
<b>Enviado:</b> terça-feira, 21 de junho de 2016 04:24<br>
<b>Para:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">
users@lists.opensips.org</a><br>
<b>Assunto:</b> Re: [OpenSIPS-Users] How to invok lookup() and get attr from the caller, without side effects?</font>
<div> </div>
</div>
<div>
<p><tt>Hi, Rodrigo!</tt></p>
<p><tt><br>
</tt></p>
<p><tt>Have you tried restoring the R-URI after the caller lookup? Something like:</tt></p>
<p><tt><br>
</tt></p>
<p><tt>$var(ru) = $ru;</tt></p>
<p><tt>lookup("location", "", "$fu"); # this takes the caller from FROM uri, which I think is more suitable than from contact uri</tt></p>
<p><tt>$ru = $var(ru);</tt></p>
<p><tt># continue your processing here<br>
</tt></p>
<p><tt>....</tt></p>
<p><tt># now do the real lookup for the callee</tt></p>
<p><tt>lookup("location");</tt></p>
<p><tt><br>
</tt></p>
<p><tt>Don't do the lookups in the reversed way, because you might loose some contacts.</tt></p>
<p><tt><br>
</tt></p>
<p><tt>Best regards,</tt></p>
<pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a id="LPlnk925360" class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
<div id="LPBorder_GT_14665081476460.4076791762148423" style="overflow:auto; margin-bottom:20px; width:100%; text-indent:0px" contenteditable="false">
<table id="LPContainer_14665081476430.3959761845830473" style="overflow:auto; border-top:rgb(200,200,200) 1px dotted; width:90%; border-bottom:rgb(200,200,200)
1px dotted; color:rgb(0,0,0); padding-bottom:20px; padding-top:20px; margin-top:20px; background-color:rgb(255,255,255)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td id="TextCell_14665081476440.11327963056423607" colspan="2" style="vertical-align:top; padding:0px; display:table-cell">
<div id="LPTitle_14665081476440.178337023690203" style=""><a id="LPUrlAnchor_14665081476450.8245898287686168" href="http://www.opensips-solutions.com/" target="_blank" style="text-decoration:none">Home — OpenSIPS Solutions</a></div>
<div id="LPMetadata_14665081476450.7986499792204279" style=""><a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></div>
<div id="LPDescription_14665081476460.5765572521696759" style="">OpenSIPS is a mature Open Source implementation of a SIP server. OpenSIPS is more than a SIP proxy/router as it includes application-level functionalities.</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="moz-cite-prefix">On 06/20/2016 09:02 PM, Rodrigo Pimenta Carvalho wrote:<br>
</div>
<blockquote type="cite">
<div id="divtagdefaultwrapper" style="font-size:12pt; font-family:calibri,arial,helvetica,sans-serif; color:#000000; background-color:#ffffff">
<p>Dear OpenSIPS-users,</p>
<p> </p>
<p>The table location has the column attr where I use to <span>store specific additional information for each registration</span>.</p>
<p>Whenever A calls B, I have to read this specific information from the A record and from the B record. That is, I need to get and handle specific information about the caller and callee.</p>
<p> </p>
<p>For the callee, I use to invoke the lookup("location") function that put the needed information in the attr_avp. That is good and works very well. Then, I just have to read the attr_avp to get such specific information.</p>
<p> </p>
<p>For the caller, I use to invoke:</p>
<p> </p>
<p><span style="color:rgb(0,111,201)">$var(aorChamador) = $(ct.fields(uri));</span></p>
<p><span><span style="color:rgb(0,111,201)">lookup("location","","$var(aorChamador)");</span><br>
</span></p>
<p> </p>
<p>However it causes amazing side effect in the SIP signaling. Ex: When A calls B, B stays quiet and A rings. So A can answer A. Crazy!</p>
<p>According to the documentation, lookup will <span><span>overwritten</span></span> the
<span>Request-URI. <span>I guess that is why the SIP signaling become incoherent.</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>How could I get the caller attr specific information without side effects?</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>Any hint will be very helpful!!</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>Best regards.</span></span><br>
</p>
<p> </p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:calibri,arial,helvetica,sans-serif; margin:0px">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: +55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre>_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
<hr>
_______________________________________________<br>
Users mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre>_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</body>
</html>