Ben is correct.  In my opinion, a very easy solution. 

 

From: users-boun...@lists.opensips.org 
[mailto:users-boun...@lists.opensips.org] On Behalf Of Newlin, Ben
Sent: Tuesday, June 21, 2016 5:24 PM
To: sevpal <sev...@aol.com>; OpenSIPS users mailling list 
<users@lists.opensips.org>
Subject: Re: [OpenSIPS-Users] How to invok lookup() and get attr from the 
caller, without side effects?

 

It also seems like AVPOPS module [1] may be a good solution here as it has 
functions to pull data from a database into AVPs based by user.

 

[1] http://www.opensips.org/html/docs/modules/2.2.x/avpops.html

 

Ben Newlin

 

From: <users-boun...@lists.opensips.org 
<mailto:users-boun...@lists.opensips.org> > on behalf of sevpal <sev...@aol.com 
<mailto:sev...@aol.com> >
Reply-To: sevpal <sev...@aol.com <mailto:sev...@aol.com> >, OpenSIPS users 
mailling list <users@lists.opensips.org <mailto:users@lists.opensips.org> >
Date: Tuesday, June 21, 2016 at 11:20 AM
To: OpenSIPS users mailling list <users@lists.opensips.org 
<mailto:users@lists.opensips.org> >
Subject: Re: [OpenSIPS-Users] How to invok lookup() and get attr from the 
caller, without side effects?

 

Hi, have you tried/considered running a simple query on the database and 
parsing for the information you need?

 

From: Rodrigo Pimenta Carvalho <mailto:pime...@inatel.br>  

Sent: Tuesday, June 21, 2016 10:39 AM

To: OpenSIPS users mailling list <mailto:users@lists.opensips.org>  

Subject: Re: [OpenSIPS-Users] How to invok lookup() and get attr from the 
caller, without side effects?

 

Hi Răzvan.

 

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.

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?

 

My original message is:

 

INVITE sip:6...@mydomain.com.br SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <sip:crdphmacl_spnuv5xqt...@mydomain.com.br>;tag=179920819
To: <sip:6...@mydomain.com.br>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: <sip:crdphmacl_spnuv5xqt...@xxx.yyy.240.204:60033;transport=tcp>
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", 
realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", 
uri="sip:6...@mydomain.com.br", response="0f4c122d2a0a28dea6194c235cd77430", 
algorithm=MD5
Content-Type: application/sdp
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, 
INFO
Max-Forwards: 70
User-Agent: Linphone/3.6.1 (eXosip2/4.0.0)
Subject: Phone call
Content-Length:   227

 

This is being changed to:

 

INVITE 
sip:crdphmacl_SPnuV5xqtnSX@131.221.240.204:60672;transport=tcp;line=c6356a7d87d6f81
 SIP/2.0
Record-Route: <sip:myDomain.com.br;transport=tcp;lr;nat=yes;did=0b.b9e0cfe5>
Via: SIP/2.0/TCP myDomain.com.br:5060;branch=z9hG4bKe2db.49d54587.0;i=1
Via: SIP/2.0/TCP 
192.168.21.40:5090;received=xxx.yyy.240.204;rport=60672;branch=z9hG4bK716249970
From: <sip:crdphmacl_spnuv5xqt...@mydomain.com.br>;tag=12586028
To: <sip:6...@mydomain.com.br>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <sip:crdphmacl_spnuv5xqt...@xxx.yyy.240.204:60672;transport=tcp>
Content-Type: application/sdp
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, 
INFO
Max-Forwards: 70
User-Agent: Linphone/3.6.1 (eXosip2/4.0.0)
Subject: Phone call
Content-Length:   224

 

So, the caller is receiving its own SIP INVITE.

That is why when A calls B, is A that rings, not B.

 

It is becoming a bit complicated. So, I suspect I'm going to the incorrect 
direction.... 

 

Best regards.

 

RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979

 

  _____  

De: users-boun...@lists.opensips.org <mailto:users-boun...@lists.opensips.org>  
<users-boun...@lists.opensips.org <mailto:users-boun...@lists.opensips.org> > 
em nome de Răzvan Crainea <raz...@opensips.org <mailto:raz...@opensips.org> >
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: users@lists.opensips.org <mailto:users@lists.opensips.org> 
Assunto: Re: [OpenSIPS-Users] How to invok lookup() and get attr from the 
caller, without side effects? 

 

Hi, Rodrigo!

 

Have you tried restoring the R-URI after the caller lookup? Something like:

 

$var(ru) = $ru;

lookup("location", "", "$fu"); # this takes the caller from FROM uri, which I 
think is more suitable than from contact uri

$ru = $var(ru);

# continue your processing here

....

# now do the real lookup for the callee

lookup("location");

 

Don't do the lookups in the reversed way, because you might loose some contacts.

 

Best regards,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com <http://www.opensips-solutions.com> 


 <http://www.opensips-solutions.com/> Home — OpenSIPS Solutions

www.opensips-solutions.com <http://www.opensips-solutions.com> 

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.

On 06/20/2016 09:02 PM, Rodrigo Pimenta Carvalho wrote:

Dear OpenSIPS-users,

 

The table location has the column attr where I use to store specific additional 
information for each registration.

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.

 

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.

 

For the caller, I use to invoke:

 

$var(aorChamador) = $(ct.fields(uri));

lookup("location","","$var(aorChamador)");

 

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!

According to the documentation, lookup will overwritten the Request-URI. I 
guess that is why the SIP signaling become incoherent.

 

How could I get the caller attr specific information without side effects?

 

Any hint will be very helpful!!

 

Best regards.

 

RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979

 

_______________________________________________
Users mailing list
Users@lists.opensips.org <mailto:Users@lists.opensips.org> 
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 

  _____  

_______________________________________________
Users mailing list
Users@lists.opensips.org <mailto:Users@lists.opensips.org> 
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to