How to invok lookup() and get attr from the caller, without side effects?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

How to invok lookup() and get attr from the caller, without side effects?

Rodrigo Pimenta Carvalho

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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Răzvan Crainea-2

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
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Rodrigo Pimenta Carvalho

Hi Razvan Crainea.


I didn't know about this possibility.


I will try this idea now.


Thank you very much!!


Best regards.



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



De: [hidden email] <[hidden email]> em nome de Răzvan Crainea <[hidden email]>
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Rodrigo Pimenta Carvalho
In reply to this post by Răzvan Crainea-2

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:[hidden email] SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br>;tag=179920819
To: <sip:6001@myDomain.com.br>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: <sip:[hidden email].240.204:60033;transport=tcp>
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="sip:6001@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_SPnuV5xqtnSX@myDomain.com.br>;tag=12586028
To: <sip:6001@myDomain.com.br>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <sip:crdphmacl_SPnuV5xqtnSX@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: [hidden email] <[hidden email]> em nome de Răzvan Crainea <[hidden email]>
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

sevpal
Hi, have you tried/considered running a simple query on the database and parsing for the information you need?
 
Sent: Tuesday, June 21, 2016 10:39 AM
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:[hidden email] SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br>;tag=179920819
To: <sip:6001@myDomain.com.br>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: <sip:[hidden email].240.204:60033;transport=tcp>
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="sip:6001@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_SPnuV5xqtnSX@myDomain.com.br>;tag=12586028
To: <sip:6001@myDomain.com.br>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <sip:crdphmacl_SPnuV5xqtnSX@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: [hidden email] <[hidden email]> em nome de Răzvan Crainea <[hidden email]>
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Newlin, Ben

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.

 

Ben Newlin

 

From: <[hidden email]> on behalf of sevpal <[hidden email]>
Reply-To: sevpal <[hidden email]>, OpenSIPS users mailling list <[hidden email]>
Date: Tuesday, June 21, 2016 at 11:20 AM
To: OpenSIPS users mailling list <[hidden email]>
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?

 

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

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:[hidden email] SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <sip:[hidden email]>;tag=179920819
To: <sip:[hidden email]>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: <sip:[hidden email].240.204:60033;transport=tcp>
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="sip:[hidden email]", 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:[hidden email]>;tag=12586028
To: <sip:[hidden email]>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <sip:[hidden email].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: [hidden email] <[hidden email]> em nome de Răzvan Crainea <[hidden email]>
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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

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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Rodrigo Pimenta Carvalho
In reply to this post by sevpal

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: [hidden email] <[hidden email]> em nome de sevpal <[hidden email]>
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?
 
Sent: Tuesday, June 21, 2016 10:39 AM
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:[hidden email] SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br>;tag=179920819
To: <sip:6001@myDomain.com.br>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: <sip:[hidden email].240.204:60033;transport=tcp>
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="sip:6001@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_SPnuV5xqtnSX@myDomain.com.br>;tag=12586028
To: <sip:6001@myDomain.com.br>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <sip:crdphmacl_SPnuV5xqtnSX@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: [hidden email] <[hidden email]> em nome de Răzvan Crainea <[hidden email]>
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Răzvan Crainea-2
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: [hidden email] [hidden email] em nome de sevpal [hidden email]
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?
 
Sent: Tuesday, June 21, 2016 10:39 AM
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 [hidden email] SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br>;tag=179920819
To: <sip:6001@myDomain.com.br>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: [hidden email]
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="sip:6001@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 [hidden email] 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@myDomain.com.br>;tag=12586028
To: <sip:6001@myDomain.com.br>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <sip:crdphmacl_SPnuV5xqtnSX@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: [hidden email] [hidden email] em nome de Răzvan Crainea [hidden email]
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Johan De Clercq
In reply to this post by Newlin, Ben

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

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Newlin, Ben
Sent: Tuesday, June 21, 2016 5:24 PM
To: sevpal <[hidden email]>; OpenSIPS users mailling list <[hidden email]>
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.

 

Ben Newlin

 

From: <[hidden email]> on behalf of sevpal <[hidden email]>
Reply-To: sevpal <[hidden email]>, OpenSIPS users mailling list <[hidden email]>
Date: Tuesday, June 21, 2016 at 11:20 AM
To: OpenSIPS users mailling list <[hidden email]>
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?

 

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

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 <a href="sip:6001@myDomain.com.br">sip:6001@... SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <<a href="sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br">sip:crdphmacl_SPnuV5xqtnSX@...>;tag=179920819
To: <<a href="sip:6001@myDomain.com.br">sip:6001@...>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: <<a href="sip:crdphmacl_SPnuV5xqtnSX@xxx.yyy.240.204:60033;transport=tcp">sip:crdphmacl_SPnuV5xqtnSX@....240.204:60033;transport=tcp>
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="<a href="sip:6001@myDomain.com.br">sip:6001@...", 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 <a href="sip:crdphmacl_SPnuV5xqtnSX@131.221.240.204:60672;transport=tcp;line=c6356a7d87d6f81">sip:crdphmacl_SPnuV5xqtnSX@131.221.240.204:60672;transport=tcp;line=c6356a7d87d6f81 SIP/2.0
Record-Route: <<a href="sip:myDomain.com.br;transport=tcp;lr;nat=yes;did=0b.b9e0cfe5">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: <<a href="sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br">sip:crdphmacl_SPnuV5xqtnSX@...>;tag=12586028
To: <<a href="sip:6001@myDomain.com.br">sip:6001@...>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <<a href="sip:crdphmacl_SPnuV5xqtnSX@xxx.yyy.240.204:60672;transport=tcp">sip:crdphmacl_SPnuV5xqtnSX@....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: [hidden email] <[hidden email]> em nome de Răzvan Crainea <[hidden email]>
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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

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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Rodrigo Pimenta Carvalho

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: [hidden email] <[hidden email]> em nome de johan de clercq <[hidden email]>
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: [hidden email] [mailto:[hidden email]] On Behalf Of Newlin, Ben
Sent: Tuesday, June 21, 2016 5:24 PM
To: sevpal <[hidden email]>; OpenSIPS users mailling list <[hidden email]>
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.

 

Ben Newlin

 

From: <[hidden email]> on behalf of sevpal <[hidden email]>
Reply-To: sevpal <[hidden email]>, OpenSIPS users mailling list <[hidden email]>
Date: Tuesday, June 21, 2016 at 11:20 AM
To: OpenSIPS users mailling list <[hidden email]>
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?

 

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

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 <a style="color: blue; text-decoration: underline;" href="sip:6001@myDomain.com.br"> sip:6001@... SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <<a style="color: blue; text-decoration: underline;" href="sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br">sip:crdphmacl_SPnuV5xqtnSX@...>;tag=179920819
To: <<a style="color: blue; text-decoration: underline;" href="sip:6001@myDomain.com.br">sip:6001@...>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: <<a style="color: blue; text-decoration: underline;" href="sip:crdphmacl_SPnuV5xqtnSX@xxx.yyy.240.204:60033;transport=tcp">sip:crdphmacl_SPnuV5xqtnSX@....240.204:60033;transport=tcp>
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="<a style="color: blue; text-decoration: underline;" href="sip:6001@myDomain.com.br">sip:6001@...", 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 <a style="color: blue; text-decoration: underline;" href="sip:crdphmacl_SPnuV5xqtnSX@131.221.240.204:60672;transport=tcp;line=c6356a7d87d6f81">sip:crdphmacl_SPnuV5xqtnSX@131.221.240.204:60672;transport=tcp;line=c6356a7d87d6f81 SIP/2.0
Record-Route: <<a style="color: blue; text-decoration: underline;" href="sip:myDomain.com.br;transport=tcp;lr;nat=yes;did=0b.b9e0cfe5">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: <<a style="color: blue; text-decoration: underline;" href="sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br">sip:crdphmacl_SPnuV5xqtnSX@...>;tag=12586028
To: <<a style="color: blue; text-decoration: underline;" href="sip:6001@myDomain.com.br">sip:6001@...>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <<a style="color: blue; text-decoration: underline;" href="sip:crdphmacl_SPnuV5xqtnSX@xxx.yyy.240.204:60672;transport=tcp">sip:crdphmacl_SPnuV5xqtnSX@....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: [hidden email] <[hidden email]> em nome de Răzvan Crainea <[hidden email]>
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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

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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: How to invok lookup() and get attr from the caller, without side effects?

Rodrigo Pimenta Carvalho
In reply to this post by Răzvan Crainea-2

Hi Răzvan Crainea.


Thank you very much for trying to help me.

Yesterday my boss asked me to work in another part of our project. So, I will have to pause this verification for a while. When I return to it, I will check the log.


Best regards.


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



De: [hidden email] <[hidden email]> em nome de Răzvan Crainea <[hidden email]>
Enviado: quarta-feira, 22 de junho de 2016 03:57
Para: [hidden email]
Assunto: Re: [OpenSIPS-Users] How to invok lookup() and get attr from the caller, without side effects?
 
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
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/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: [hidden email] [hidden email] em nome de sevpal [hidden email]
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?
 
Sent: Tuesday, June 21, 2016 10:39 AM
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 [hidden email] SIP/2.0
Via: SIP/2.0/TCP 192.168.21.40:5090;rport;branch=z9hG4bK876727215
From: <sip:crdphmacl_SPnuV5xqtnSX@myDomain.com.br>;tag=179920819
To: <sip:6001@myDomain.com.br>
Call-ID: 1410250893
CSeq: 21 INVITE
Contact: [hidden email]
Proxy-Authorization: Digest username="crdphmacl_SPnuV5xqtnSX", realm="localhost", nonce="5769458c000001cc263a7c0d6995dc48d42288ec6f8e4048", uri="sip:6001@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 [hidden email] 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@myDomain.com.br>;tag=12586028
To: <sip:6001@myDomain.com.br>
Call-ID: 1106771604
CSeq: 21 INVITE
Contact: <sip:crdphmacl_SPnuV5xqtnSX@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: [hidden email] [hidden email] em nome de Răzvan Crainea [hidden email]
Enviado: terça-feira, 21 de junho de 2016 04:24
Para: [hidden email]
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
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users