[OpenSIPS-Users] How to invok lookup() and get attr from the caller, without side effects?
Rodrigo Pimenta Carvalho
pimenta at inatel.br
Wed Jun 22 14:13:57 CEST 2016
Hi Johan and Ben.
Yes. AVPops is a easy solution. However, it is easy for dada stored in DB.
What about data stored in RAM?
I'm using db_mode = 0 for module usrloc (so user location is always in RAM). So, if AVPops could extract data from the RAM too, as it does with queries and DB, it would be very easy.
I have looked for a solution using avp_db_query, but it works only over DB, not over RAM.
That is why I started trying to use function lookup() and avp attr, to get caller specific information.
Best regards.
RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979
________________________________
De: users-bounces at lists.opensips.org <users-bounces at lists.opensips.org> em nome de johan de clercq <johan at democon.be>
Enviado: quarta-feira, 22 de junho de 2016 07:35
Para: 'OpenSIPS users mailling list'; 'sevpal'
Assunto: Re: [OpenSIPS-Users] How to invok lookup() and get attr from the caller, without side effects?
Ben is correct. In my opinion, a very easy solution.
From: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] On Behalf Of Newlin, Ben
Sent: Tuesday, June 21, 2016 5:24 PM
To: sevpal <sevpal at aol.com>; OpenSIPS users mailling list <users at 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-bounces at lists.opensips.org<mailto:users-bounces at lists.opensips.org>> on behalf of sevpal <sevpal at aol.com<mailto:sevpal at aol.com>>
Reply-To: sevpal <sevpal at aol.com<mailto:sevpal at aol.com>>, OpenSIPS users mailling list <users at lists.opensips.org<mailto:users at lists.opensips.org>>
Date: Tuesday, June 21, 2016 at 11:20 AM
To: OpenSIPS users mailling list <users at lists.opensips.org<mailto:users at 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:pimenta at inatel.br>
Sent: Tuesday, June 21, 2016 10:39 AM
To: OpenSIPS users mailling list<mailto:users at 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:6001 at myDomain.com.br SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <sip:crdphmacl_SPnuV5xqtnSX at myDomain.com.br>;tag=179920819
To: <sip:6001 at myDomain.com.br>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: <sip:crdphmacl_SPnuV5xqtnSX at xxx.yyy.240.204:60033;transport=tcp>
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="sip:6001 at 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 at 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_SPnuV5xqtnSX at myDomain.com.br>;tag=12586028
To: <sip:6001 at myDomain.com.br>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <sip:crdphmacl_SPnuV5xqtnSX at 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-bounces at lists.opensips.org<mailto:users-bounces at lists.opensips.org> <users-bounces at lists.opensips.org<mailto:users-bounces at lists.opensips.org>> em nome de Răzvan Crainea <razvan at opensips.org<mailto:razvan at opensips.org>>
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: users at lists.opensips.org<mailto:users at 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>
Home - OpenSIPS Solutions<http://www.opensips-solutions.com/>
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 at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
________________________________
_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160622/4d813d65/attachment-0001.htm>
More information about the Users
mailing list