Bugs item #1790628, was opened at 2007-09-08 14:36
Message generated for change (Comment added) made by miconda
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1790628&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver devel
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Iñaki Baz (ibc_sf)
Assigned to: Daniel-Constantin Mierla (miconda)
Summary: [presence] "server_address" parameter is a limitation

Initial Comment:
I've a multidomain OpenSer with a table in which I decide with type of SIP 
messages can be routed from one local or external domain to each local domain 
(based on message URI).

With this I can implement permissions system inter-domain, and a system similar 
to XCAP but in server side (with no client requeriments). The client can send a 
SUBSCRIBE for other domain and OpenSer allows or denies it based on the table 
content.

But unfortunatelly all my system is "canceled" by the "server_address" 
parameter:
http://www.openser.org/docs/modules/1.2.x/presence.html#AEN190

This parameter forces OpenSer to send a "Contact" header in 200-OK, so 
following SUBSCRIBE messages from clients will go to that URI instead of the 
URI of the "To" header of the SUBSCRIBE message.

Because of it, a initial "SUBSCRIBE" is allowed because I allow SUBSCRIBE from 
"domain1.com" to "domain2.org":
  
  SUBSCRIBE sip:[EMAIL PROTECTED]
  From: sip:[EMAIL PROTECTED]
  To:   sip:[EMAIL PROTECTED]

But in the 200 OK I get a "Contact: sip:server_IP:5060" so the following 
SUBSCRIBE refresh is:

  SUBSCRIBE sip:server_IP:5060
  From: sip:[EMAIL PROTECTED]
  To:   sip:[EMAIL PROTECTED]

But this message is denied by my OpenSer because I don't allow it. If I allow 
it then I just can't deny any SUBSCRIBE inter-domain, so my aim is lost.


So I ask: couldn't be possible not to include that "Contact" header in the 200 
OK? Maybe it would be RFC not compliant?

Regards.

----------------------------------------------------------------------

>Comment By: Daniel-Constantin Mierla (miconda)
Date: 2007-09-10 16:49

Message:
Logged In: YES 
user_id=1246013
Originator: NO

The second subscribe is clear in-dialog, because has to-tag. Your config
file is not doing the right filter, check if the to-tag exists and if yes,
handle the subscribe. If your presence server is a different box, then main
proxy should do record_route()/loose_route(). If it is same box, then there
is no Route header.

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2007-09-10 16:46

Message:
Logged In: YES 
user_id=1844020
Originator: YES

I've tryed with Twinkle 1.1 and X-Lite, and it both cases the SUBSCRIBE
refresh (each 1 hour by default) is done to the URI indicated in the
received "Contact" header of the "200 OK" or "Notify" from OpenSer presence
module. But the **more strange** thing (for me) is that they seem
"in-dialog" messages (look at the "totag") but they HAVE NOT "Route"
header, so they are not mathed in "loose_route()"... so what to do??


This is the first SUBSCRIBE of X-Lite when just started:


U 2007/09/10 15:22:57.545370 212.121.235.18:41652 -> 85.92.0.210:5060
SUBSCRIBE sip:[EMAIL PROTECTED] SIP/2.0
Via: SIP/2.0/UDP
192.168.1.30:41652;branch=z9hG4bK-d87543-4808af0cb50f827c-1--d87543-;rport
Max-Forwards: 70
Contact: <sip:[EMAIL PROTECTED]:41652>
To: "ibc"<sip:[EMAIL PROTECTED]>
From: "Angel"<sip:[EMAIL PROTECTED]>;tag=1f1cdd66
Call-ID: M2NlYmE1MGQ2ZjlkOGJkN2M2M2E5Njk3MTEyMmM4ZTQ.
CSeq: 1 SUBSCRIBE
Subject:
Expires: 60
Accept: multipart/related, application/rlmi+xml, application/pidf+xml
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE,
SUBSCRIBE, INFO
User-Agent: X-Lite release 1011s stamp 41150
Event: presence
Content-Length: 0


U 2007/09/10 15:22:57.660995 85.92.0.210:5060 -> 212.121.235.18:41652
SIP/2.0 202 OK
Via: SIP/2.0/UDP
192.168.1.30:41652;branch=z9hG4bK-d87543-f632bd2b9d536c42-1--d87543-;rport=41652;received=212.121.235.18
To: "ibc"<sip:[EMAIL PROTECTED]>;tag=10.11644.1189430577.8
From: "Angel"<sip:[EMAIL PROTECTED]>;tag=1f1cdd66
Call-ID: M2NlYmE1MGQ2ZjlkOGJkN2M2M2E5Njk3MTEyMmM4ZTQ.
CSeq: 2 SUBSCRIBE
Expires: 60
Contact: <sip:85.92.0.210>
Server: OpenSER (1.2.2-notls (i386/linux))
Content-Length: 0


U 2007/09/10 15:22:57.662020 85.92.0.210:5060 -> 212.121.235.18:41652
NOTIFY sip:[EMAIL PROTECTED]:41652 SIP/2.0
Via: SIP/2.0/UDP 85.92.0.210;branch=z9hG4bK036a.7e894d97.0
To: sip:[EMAIL PROTECTED];tag=1f1cdd66
From: sip:[EMAIL PROTECTED];tag=10.11644.1189430577.8
CSeq: 2 NOTIFY
Call-ID: M2NlYmE1MGQ2ZjlkOGJkN2M2M2E5Njk3MTEyMmM4ZTQ.
Content-Length: 317
User-Agent: OpenSER (1.2.2-notls (i386/linux))
Max-Forwards: 70
Event: presence
Contact: <sip:85.92.0.210>
Subscription-State: active;expires=60
Content-Type: application/pidf+xml

<?xml version="1.0" encoding="UTF-8"?>
<presence xmlns="urn:ietf:params:xml:ns:pidf"
entity="sip:[EMAIL PROTECTED]"><tuple
id="ffcmwn"><status><basic>open</basic></status></tuple>
  <tuple xmlns="urn:ietf:params:xml:ns:pidf" id="0x8162278">
    <status>
      <basic>open</basic>
    </status>
  </tuple>
</presence>




And after 10 minutes (presence refresh in X-Lite) the following SUBSCRIBE
from X-Lite is this:


U 2007/09/10 15:30:17.509807 212.121.235.18:34386 -> 85.92.0.210:5060
SUBSCRIBE sip:85.92.0.210 SIP/2.0
Via: SIP/2.0/UDP
192.168.1.30:34386;branch=z9hG4bK-d87543-8a2f8478f3011a1a-1--d87543-;rport
Max-Forwards: 70
Contact: <sip:[EMAIL PROTECTED]:34386>
To: <sip:[EMAIL PROTECTED]>;tag=10.11644.1189430963.13
From: "Angel"<sip:[EMAIL PROTECTED]>;tag=ec353876
Call-ID: NDk3YTllOTQ2ODZkNjVlZWY1ZDY4ZTdlMzI5ZDVjODg.
CSeq: 4 SUBSCRIBE
Expires: 60
User-Agent: X-Lite release 1011s stamp 41150
Event: presence.winfo
Content-Length: 0



So what can I do? A "in-dialog" message should contain a "Route" header,
but those SUBSCRIBE messages have not it, why??

Oh, now I'm really confused.

----------------------------------------------------------------------

Comment By: Daniel-Constantin Mierla (miconda)
Date: 2007-09-10 15:47

Message:
Logged In: YES 
user_id=1246013
Originator: NO

The your sip device (phone) is broken, ask the vendor to fix it. Should
not send an out-of-dialog request to the contact address in a previous
200ok. Either sends the subscribe in same dialog, using the contact, route
set and appropriate To tag, or makes a new dialog, by putting the right
domain of the destination user.


----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2007-09-10 15:34

Message:
Logged In: YES 
user_id=1844020
Originator: YES

Yes, I apply that filter only to not-in-dialog SUBSCRIBE (does exist
SUBSCRIBE in-dialog?).

My problem is:

- Imagine "server_address" for presence module is:   sip:mydomain.org
- My SIP client sends a SUBSCRIBE for presence of an user:
 
    SUBSCRIBE sip:[EMAIL PROTECTED]
    To: sip:[EMAIL PROTECTED]

- So it receives a "200 OK" with Contact: sip.mydomain.org.
- After 500 seconds (or whatever configured in SIP client for subscribe 
  refresh) my SIP client sends again a SUBSCRIBE for each buddy. This
SUBSCRIBE 
  is **NOT in-dialog** (of course), but it goes to URI of "200 OK"
"Contact" header:

    SUBSCRIBE sip:mydomain.org
    To: sip:[EMAIL PROTECTED]

- So there is my problem, because I can't match the SUBSCRIBE URI against
my permissions table since now the URI is not the URI of "To" header.

For that, what I do is detect SUBSCRIBES to "sip:mydomain.org" and changes
the URI with the "To" before my permissions table.


----------------------------------------------------------------------

Comment By: Daniel-Constantin Mierla (miconda)
Date: 2007-09-10 13:06

Message:
Logged In: YES 
user_id=1246013
Originator: NO

Your filter is not applied very correct for what you want to do. The
server has to set a contact address in 200ok, to establish the dialog of
SUBSCRIBE. If the phone sends another SUBSCRIBE in the same dialog, it has
to populate the To tag and use the contact address in r-uri. Such messages
should not be denied, but should be sent to/handled by presence server.

The presence server will reject any SUBSCRIBE with To tag that does not
correspond to an existing dialog. So, the solution is to apply the filter
only for SUBSCRIBE messages without To tag.

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2007-09-10 11:50

Message:
Logged In: YES 
user_id=1844020
Originator: YES

Thanks a lot for the explanation. Let me just a question to be sure:

So, in the trunk version if I don't set the "server_address" parameter and
receive a SUBSCRIBE like:

  SUBSCRIBE sip:[EMAIL PROTECTED]
  From: sip:[EMAIL PROTECTED]
  To: sip:[EMAIL PROTECTED]

Then do you mean that the generated "Contact" will be "sip:domain2.org"?

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2007-09-10 11:32

Message:
Logged In: NO 


I have not paid attention that you are using 1.2.x branch. The improvement
has been made in the trunk only.


----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2007-09-10 11:27

Message:
Logged In: YES 
user_id=1844020
Originator: YES

Hi, you say that 'server address' parameter is not compulsory, but if I
not set it I can't start OpenSer because an error:

  0(0) PRESENCE:mod_init:ERROR server_address parameter has no value
  0(0) init_mod(): Error while initializing module presence
  ERROR: error while initializing modules

So? isn't it compulsory?

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2007-09-10 11:05

Message:
Logged In: NO 

Hello Iñaki,

The 'server address' parameter is not compulsory. If not set, the address
to be inserted in Contact header for replies and Notify messages is taken
from the Subscribe receive info for the destination: ip addr, port and
protocol.

regards, 

Anca Vamanu

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2007-09-08 22:36

Message:
Logged In: YES 
user_id=1844020
Originator: YES

I've found a solution for my problem:

  modparam("presence","server_address","sip:just_presence.domain.org")

So when OpenSer receives a SUBSCRIBE with URI
"sip:just_presence.domain.org" then I rewrite URI:

  $ru = $tu;

And after that my permissions table (based in URI) is readed to allow or
deny the SUBSCRIBE.


Anyway, a easier solution would be not to include a "Contact" header in
the "200 OK" to "SUBSCRIBE/PUBLISH" or "NOTIFY" messages from OpenSer's
"presence" module. The only issue could be if that "Contact" is RFC
requeriment for those type of messages, so I'll investigate it.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1790628&group_id=139143

_______________________________________________
Devel mailing list
Devel@openser.org
http://openser.org/cgi-bin/mailman/listinfo/devel

Reply via email to