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

sevpal sevpal at aol.com
Tue Jun 21 17:20:57 CEST 2016


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

From: Rodrigo Pimenta Carvalho 
Sent: Tuesday, June 21, 2016 10:39 AM
To: OpenSIPS users mailling list 
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.comHome — OpenSIPS Solutions
      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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160621/6763272d/attachment-0001.htm>


More information about the Users mailing list