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

Răzvan Crainea razvan at opensips.org
Wed Jun 22 08:57:26 CEST 2016


Hi, Rodrigo!


Can you print the $ru variable before and after each lookup() query? 
Something like:

$var(ru) = $ru;
xlog("R-URI before caller lookup: $ru\n");
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
xlog("R-URI after caller lookup: $ru\n");
...
# now do the real lookup for the callee
xlog("R-URI before callee lookup: $ru\n");
lookup("location");
xlog("R-URI after callee lookup: $ru\n");

Make sure they are all correct, or if they are not, send me these logs.

Thanks,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com

On 06/21/2016 07:39 PM, Rodrigo Pimenta Carvalho wrote:
>
> Hi Sevpal.
>
>
> Yes. That is what I was doing. It worked very well.
>
> 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.
>
>
> For the callee, everything is all right.
>
>
> 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 sevpal <sevpal at aol.com>
> *Enviado:* terça-feira, 21 de junho de 2016 12:20
> *Para:* OpenSIPS users mailling list
> *Assunto:* 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 
> <users-bounces at lists.opensips.org> em nome de Răzvan Crainea 
> <razvan at opensips.org>
> *Enviado:* terça-feira, 21 de junho de 2016 04:24
> *Para:* 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
> Home — OpenSIPS Solutions <http://www.opensips-solutions.com/>
> 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
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
> ------------------------------------------------------------------------
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> _______________________________________________
> Users mailing list
> 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/242b3334/attachment-0001.htm>


More information about the Users mailing list