<HTML><HEAD>
<META content="text/html; charset=windows-1250" http-equiv=Content-Type>
<STYLE style="DISPLAY: none" type=text/css><!-- P {margin-top:0;margin-bottom:0;} --></STYLE>
</HEAD>
<BODY dir=ltr>
<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="font-color: black"><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" color=#000000
face="Calibri, sans-serif">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 sip:6001@myDomain.com.br
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:
<sip:crdphmacl_SPnuV5xqtnSX@xxx.yyy.240.204:60033;transport=tcp></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)">sip:crdphmacl_SPnuV5xqtnSX@131.221.240.204:60672;transport=tcp;line=c6356a7d87d6f81
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 style="FONT-FAMILY: calibri,arial,helvetica,sans-serif; MARGIN: 0px"
name="divtagdefaultwrapper">
<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" color=#000000
face="Calibri, sans-serif"><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> terça-feira, 21 de junho de 2016
04:24<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>
<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">
<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; POSITION: relative; 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
style="VERTICAL-ALIGN: top; POSITION: relative; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; PADDING-LEFT: 0px; DISPLAY: table-cell; PADDING-RIGHT: 0px"
colSpan=2>
<DIV id=LPRemovePreviewContainer_14665081476440.715657754829526></DIV>
<DIV id=LPTitle_14665081476440.178337023690203
style='FONT-SIZE: 21px; FONT-FAMILY: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",tahoma,arial,sans-serif; FONT-WEIGHT: 400; COLOR: rgb(0,120,215); LINE-HEIGHT: 21px; TOP: 0px'><A
id=LPUrlAnchor_14665081476450.8245898287686168
style="TEXT-DECORATION: none" href="http://www.opensips-solutions.com/"
target=_blank>Home — OpenSIPS Solutions</A></DIV>
<DIV id=LPMetadata_14665081476450.7986499792204279
style='FONT-SIZE: 14px; FONT-FAMILY: "wf_segoe-ui_normal","Segoe UI","Segoe WP",tahoma,arial,sans-serif; FONT-WEIGHT: 400; COLOR: rgb(102,102,102); MARGIN: 10px 0px 16px; LINE-HEIGHT: 14px'>www.opensips-solutions.com</DIV>
<DIV id=LPDescription_14665081476460.5765572521696759
style='OVERFLOW: hidden; FONT-SIZE: 14px; FONT-FAMILY: "wf_segoe-ui_normal","Segoe UI","Segoe WP",tahoma,arial,sans-serif; FONT-WEIGHT: 400; COLOR: rgb(102,102,102); DISPLAY: block; LINE-HEIGHT: 20px; MAX-HEIGHT: 100px'>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 style="FONT-FAMILY: calibri,arial,helvetica,sans-serif; MARGIN: 0px"
name="divtagdefaultwrapper">
<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>
<P>
<HR>
_______________________________________________<BR>Users mailing
list<BR>Users@lists.opensips.org<BR>http://lists.opensips.org/cgi-bin/mailman/listinfo/users<BR></DIV></DIV></DIV></BODY></HTML>