[Serusers] global contact list

Vaclav Kubart vaclav.kubart at iptel.org
Thu May 10 16:23:43 CEST 2007


Hi,
what URI (exactly) holds the SUBSCRIBE request for the list?  In your
resource list you have list with name 'sip:bartaj-list at test.intra'. This
must be exactly the same as in SUBSCRIBE's To header field.

I think that it is ok that it couldn't find the UID in uri table.

	Vaclav

On Thu, May 10, 2007 at 03:53:46PM +0200, Barta János wrote:
> Hello!
> 
> Thanks Vaclav, it is clear now. I modified the contacts settings in the client, but nothing changed :-(.
> I received the next error messages:
> 
> 3(16917) ERROR: rls_handler.c:484: XCAP query problems
> 3(16917) XCAP query failed
> 
> What should I see in the MySQL querry? 
> 
> 
> I can see now (in the global contact list case):
> 
> select uid,flags from uri where username='bartaj-list' AND did='10.22.1.210'
> , but in the answer (Response OK) the Payload field is empty.
> 
> 	mysql> select uid,flags from uri where username='bartaj-list' AND did='10.22.1.210';
> 	Empty set (0.00 sec)
> 
> In the right case (user contact list) the answer contained the username parameter:
> select uid,flags from uri where username='bartaj' AND did='10.22.1.210'
> Answer -> bartaj
> 
> 	mysql> select uid,flags from uri where username='bartaj' AND did='10.22.1.210';
> 	 -------- ------- 
> 	| uid    | flags |
> 	 -------- ------- 
> 	| bartaj |    61 |
> 	 -------- ------- 
> 	1 row in set (0.00 sec)
> 
> 	mysql>	
> 
> 
> Maybe is this the problem?
> Do I have to add any other parameters into the MYSQL database (in the global lists cases)?
> 
> By,
> Jani
> 
>  
> 
> -----Original Message-----
> From: Vaclav Kubart [mailto:vaclav.kubart at iptel.org] 
> Sent: Friday, April 20, 2007 9:56 AM
> To: Barta János
> Cc: serusers at iptel.org
> Subject: Re: [Serusers] global contact list
> 
> Hi,
> I'm very sorry for delayed reply but... ;-)
> 
> Your config seems to be OK for first (and second) look.
> 
> I have used list subscripriptions with EyeBeam in this way:
> 
> I added the list URI in my contact list (exactly the same way like other contacts), so I had something like:
> 
>  contacts:
>   - user1 at somewhere.com
>   - user2 at somewhere.com
>   - hr at somewhere.com
>   - ...
>   - franta-list at somewhere.com
> 
> Where userx at ... are 'normal' users and hr at ... is resource list as defined in global resource list - in your case it could be bartaj-list at test.intra or hr2 at test.intra.
> 
> The franta-list at ... is uri used to subscribe to user's resource list when I'm using my user with uri franta at somewhere.com (i.e. the resource list on XCAP is stored in user's directory as described in presence handbook).
> 
> After the subscription is created, the list in contact window was expanded and seemd something like:
>   - user1 at somewhere.com
>   - user2 at somewhere.com
>   - hr at somewhere.com
>       |
> 	   - smith at somewhere.com
> 	   - ...
>   - ...
> 
> If I tried to use "Subscribe to contact list" feature, I think I had to put franta-list at somewhere.com as contact-list URI (or hr at somewhere.com could be used too).  But in this case EyeBeam was not sending the Supported:eventlist header thus it was unusable for me...
> 
> Have you seen any error messages in SER's log?
> 
> 	Vaclav
> 
> On Tue, Apr 17, 2007 at 05:01:24PM  0200, Barta János wrote:
> > Hello!
> > 
> > Thanks for your answer again, and I'm sorry for the delayed answer, but I was out of office.
> > I attached my config file.
> > 
> > My biggest problem is, that I don't know, what I should see :-(.
> > I have an eyeBeam window, that contains the "Calls & Conntats" parameters.
> > 
> > In this window I can see my (user) contact list, but I didn't see the global one.
> > For example (the PC is my user contact list):
> > 
> > -PC
> > -105
> > -12345
> > -barta
> > 
> > and it is working fine, but I can not see here (in this window) the global one:
> > 
> > sip:~# cat /var/www/xcap-root/rls-services/global/index
> > <?xml version="1.0" encoding="UTF-8"?> <rls-services>
> > 
> >  <service uri="sip:bartaj-list at test.intra">  <list name="Human 
> > resources">  <entry uri="sip:test1 at test.intra">  
> > <display-name>bartaj</display-name>
> >  </entry>
> >  <entry uri="sip:test2 at test.intra">
> >  <display-name>12345</display-name>
> >  </entry>
> >  </list>
> >  <packages>
> >  <package>presence</package>
> >  </packages>
> >  </service>
> > 
> >  <service uri="sip:hr2 at test.intra">
> >  <list name="Human resources">
> >  <entry uri="sip:test1 at test.intra">
> >  <display-name>bartaj</display-name>
> >  </entry>
> >  <entry uri="sip:test2 at test.intra">
> >  <display-name>12345</display-name>
> >  </entry>
> >  </list>
> >  <packages>
> >  <package>presence</package>
> >  </packages>
> >  </service>
> > 
> > </rls-services>
> > 
> > 
> > I think in that case I should see the next tree:
> > 
> > -PC
> > -105
> > -12345
> > -barta
> > 
> > -Human resources
> > -bartaj
> > -12345
> > 
> > 
> > 
> > As You asked, I made a capture between the SER and XCAP.
> > 
> > It was a little difficult, because I didn't see interesting traffic between the SER and XCAP, but a few minutes later I realised, that the SER for the communication (in that case) uses the loopback (lo) interface.
> > 
> > You can see here the capture, that I made on the lo interface:
> > 
> >  1 0.000000 127.0.0.1 -> 127.0.0.1 TCP 37512 > www [SYN] Seq=0 Len=0 
> > MSS=16396 TSV=3808162073 TSER=0 WS=0
> >  2 0.000056 127.0.0.1 -> 127.0.0.1 TCP www > 37512 [SYN, ACK] Seq=0 
> > Ack=1 Win=32767 Len=0 MSS=16396 TSV=3808162073 TSER=3808162073 WS=0
> >  3 0.000065 127.0.0.1 -> 127.0.0.1 TCP 37512 > www [ACK] Seq=1 Ack=1 
> > Win=32767 Len=0 TSV=3808162073 TSER=3808162073
> >  4 0.000072 127.0.0.1 -> 127.0.0.1 HTTP GET 
> > /xcap/pres-rules/users/12345/presence-rules.xml HTTP/1.1
> >  5 0.000079 127.0.0.1 -> 127.0.0.1 TCP www > 37512 [ACK] Seq=1 Ack=113 
> > Win=32767 Len=0 TSV=3808162073 TSER=3808162073
> >  6 0.000545 127.0.0.1 -> 127.0.0.1 HTTP HTTP/1.1 200 OK
> >  7 0.000559 127.0.0.1 -> 127.0.0.1 TCP 37512 > www [ACK] Seq=113 
> > Ack=262 Win=32767 Len=0 TSV=3808162074 TSER=3808162074
> >  8 0.000571 127.0.0.1 -> 127.0.0.1 HTTP Continuation or non-HTTP 
> > traffic
> >  9 0.000578 127.0.0.1 -> 127.0.0.1 TCP 37512 > www [ACK] Seq=113 
> > Ack=870 Win=32767 Len=0 TSV=3808162074 TSER=3808162074 10 0.005535 
> > 127.0.0.1 -> 127.0.0.1 TCP 37513 > www [SYN] Seq=0 Len=0 MSS=16396 
> > TSV=3808162079 TSER=0 WS=0
> > 11 0.005556 127.0.0.1 -> 127.0.0.1 TCP www > 37513 [SYN, ACK] Seq=0 
> > Ack=1 Win=32767 Len=0 MSS=16396 TSV=3808162079 TSER=3808162079 WS=0
> > 12 0.005565 127.0.0.1 -> 127.0.0.1 TCP 37513 > www [ACK] Seq=1 Ack=1 
> > Win=32767 Len=0 TSV=3808162079 TSER=3808162079
> > 13 0.005616 127.0.0.1 -> 127.0.0.1 HTTP GET 
> > /xcap/pres-rules/users/bartaj/presence-rules.xml HTTP/1.1
> > 14 0.005623 127.0.0.1 -> 127.0.0.1 TCP www > 37513 [ACK] Seq=1 Ack=114 
> > Win=32767 Len=0 TSV=3808162079 TSER=3808162079
> > 15 0.005989 127.0.0.1 -> 127.0.0.1 HTTP HTTP/1.1 200 OK
> > 16 0.006000 127.0.0.1 -> 127.0.0.1 TCP 37513 > www [ACK] Seq=114 
> > Ack=262 Win=32767 Len=0 TSV=3808162079 TSER=3808162079
> > 17 0.006011 127.0.0.1 -> 127.0.0.1 HTTP Continuation or non-HTTP 
> > traffic
> > 18 0.006017 127.0.0.1 -> 127.0.0.1 TCP 37513 > www [ACK] Seq=114 
> > Ack=870 Win=32767 Len=0 TSV=3808162079 TSER=3808162079
> > 19 2.979491 127.0.0.1 -> 127.0.0.1 HTTP GET 
> > /xcap/rls-services/global/index HTTP/1.1 20 2.979722 127.0.0.1 -> 
> > 127.0.0.1 HTTP HTTP/1.1 200 OK
> > 21 2.979734 127.0.0.1 -> 127.0.0.1 TCP 37512 > www [ACK] Seq=209 
> > Ack=1126 Win=32767 Len=0 TSV=3808165053 TSER=3808165053
> > 22 2.979745 127.0.0.1 -> 127.0.0.1 HTTP Continuation or non-HTTP 
> > traffic
> > 23 2.979751 127.0.0.1 -> 127.0.0.1 TCP 37512 > www [ACK] Seq=209 
> > Ack=1887 Win=32767 Len=0 TSV=3808165053 TSER=3808165053
> > 
> > 
> > 
> > You can see, that in the message number 19 the SER downloaded the index file.
> > 
> > This file contains correct information:
> > 
> > 
> > sip:~# wget 127.0.0.1/xcap/rls-services/global/index
> > --17:22:43-- http://127.0.0.1/xcap/rls-services/global/index
> >  => `index'
> > Connecting to 127.0.0.1:80... connected.
> > HTTP request sent, awaiting response... 200 OK
> > Length: 761 [text/plain]
> > 
> > 100%[====================================>] 761 --.--K/s
> > 
> > 17:22:43 (7.26 MB/s) - `index' saved [761/761]
> > 
> > sip:~#
> > sip:~# cat index
> > <?xml version="1.0" encoding="UTF-8"?> <rls-services>
> > 
> >  <service uri="sip:bartaj-list at test.intra">  <list name="Human 
> > resources">  <entry uri="sip:test1 at test.intra">  
> > <display-name>bartaj</display-name>
> >  </entry>
> >  <entry uri="sip:test2 at test.intra">
> >  <display-name>12345</display-name>
> >  </entry>
> >  </list>
> >  <packages>
> >  <package>presence</package>
> >  </packages>
> >  </service>
> > 
> >  <service uri="sip:hr2 at test.intra">
> >  <list name="Human resources">
> >  <entry uri="sip:test1 at test.intra">
> >  <display-name>bartaj</display-name>
> >  </entry>
> >  <entry uri="sip:test2 at test.intra">
> >  <display-name>12345</display-name>
> >  </entry>
> >  </list>
> >  <packages>
> >  <package>presence</package>
> >  </packages>
> >  </service>
> > 
> > </rls-services>
> > sip:~#
> > 
> > 
> > 
> > And at last, how can I add query_rls_services and query_resource_list log informations into the config file?
> > 
> > Thx,
> > Jani
> > 
> > 
> > 
> > Hi,
> > this part of config file is not sufficient for me, but I guess that 
> > RLS related things stayed as in the original config you mentioned... 
> > In which way it doesn't work? (For example it returns non OK 
> > responses?) Please could you try to capture HTTP traffic between XCAP 
> > server and SER? (If SER really queries the right resource list 
> > document.)
> > 
> > You can add more log information around important config parts (query_rls_services and query_resource_list functions are most important here).
> > 
> > BTW the second message you sent is not subscription to resource list or user, it is subscription to event package 'sip-profile' (content of Event header field) which is not supported by SER.
> > 
> > It is possible to use registration status as source for presence - in this case you have to have PA module on your server handling registrations and PA module parameter 'use_callbacks' must be set to 1.
> > 
> > Vaclav
> > 
> > 
> > 
> > -----Original Message-----
> > From: Vaclav Kubart [mailto:vaclav.kubart at iptel.org]
> > Sent: Tuesday, April 03, 2007 11:18 AM
> > To: Barta János
> > Cc: serusers at iptel.org
> > Subject: Re: [Serusers] global contact list
> > 
> > 
> > ______________________________________________________________________
> > _________ Állást keres? 3300  lehetőséget kínál a CV-Online Ne 
> > keressen tovább! Portálunkon Magyarország vezető vállalatainak több mint 3300 friss állásajánlatából válogathat!
> > 
> > http://ad.adverticum.net/b/cl,1,6022,139845,209300/click.prm
> 
> > sip:/opt/etc/ser# cat ./ser_pa.cfg
> > log_stderror=yes
> > debug=5         # debug level (cmd line: -dddddddddd)
> > check_via=no    # (cmd. line: -v)
> > dns=no           # (cmd. line: -r)
> > rev_dns=no      # (cmd. line: -R)
> > port=5060
> > children=2
> > alias="test.intra"
> > #alias="ipp.test.intra"
> > alias="10.22.1.210"
> > mhomed=yes  # usefull for multihomed hosts, small performance penalty 
> > #tcp_accept_aliases=yes # accepts the tcp alias via option (see NEWS) 
> > #tcp_poll_method="sigio_rt"
> > 
> > # ------------------ module loading ----------------------------------
> > 
> > loadmodule "/opt/lib/ser/modules/sl.so"
> > loadmodule "/opt/lib/ser/modules/avp.so"
> > loadmodule "/opt/lib/ser/modules/avpops.so"
> > loadmodule "/opt/lib/ser/modules/tm.so"
> > loadmodule "/opt/lib/ser/modules/rr.so"
> > loadmodule "/opt/lib/ser/modules/maxfwd.so"
> > loadmodule "/opt/lib/ser/modules/usrloc.so"
> > loadmodule "/opt/lib/ser/modules/registrar.so"
> > loadmodule "/opt/lib/ser/modules/textops.so"
> > loadmodule "/opt/lib/ser/modules/mysql.so"
> > loadmodule "/opt/lib/ser/modules/dialog.so"
> > loadmodule "/opt/lib/ser/modules/rls.so"
> > loadmodule "/opt/lib/ser/modules/pa.so"
> > loadmodule "/opt/lib/ser/modules/presence_b2b.so"
> > loadmodule "/opt/lib/ser/modules/uri.so"
> > loadmodule "/opt/lib/ser/modules/uri_db.so"
> > loadmodule "/opt/lib/ser/modules/domain.so"
> > loadmodule "/opt/lib/ser/modules/fifo.so"
> > loadmodule "/opt/lib/ser/modules/xmlrpc.so"
> > loadmodule "/opt/lib/ser/modules/xlog.so"
> > #loadmodule "/opt/lib/ser/modules/unixsock.so"
> > loadmodule "/opt/lib/ser/modules/msilo.so"
> > 
> > # Uncomment this if you want digest authentication # mysql.so must be 
> > loaded !
> > loadmodule "/opt/lib/ser/modules/auth.so"
> > #loadmodule "/opt/lib/ser/modules/auth_db.so"
> > 
> > loadmodule "/opt/lib/ser/modules/acc_radius.so"
> > loadmodule "/opt/lib/ser/modules/mediaproxy.so"
> > loadmodule "/opt/lib/ser/modules/auth_radius.so"
> > 
> > # ----------------- setting module-specific parameters --------------- 
> > ############################# modparam("mediaproxy", 
> > "mediaproxy_socket", "/var/run/mediaproxy.sock")
> > modparam("auth_radius","radius_config","/etc/radiusclient-ng/radiuscli
> > ent.conf")
> > 
> > #########################
> > # -- acc params -- #
> > #########################
> > modparam("acc_radius","radius_config","/etc/radiusclient-ng/radiusclie
> > nt.conf")
> > modparam("acc_radius", "log_flag", 1)
> > modparam("acc_radius", "log_missed_flag", 2)
> > 
> > 
> > modparam("msilo","registrar","sip:registrar at test.intra")
> > modparam("msilo","use_contact",0)
> > modparam("msilo","expire_time",7200)
> > 
> > # -- usrloc params --
> > 
> > # -- auth params --
> > # Uncomment if you are using auth module # #modparam("auth_db", 
> > "calculate_ha1", yes) # # If you set "calculate_ha1" parameter to yes 
> > (which true in this config), # uncomment also the following parameter) 
> > # #modparam("auth_db", "password_column", "password")
> > 
> > # -- rr params --
> > # add value to ;lr param to make some broken UAs happy modparam("rr", 
> > "enable_full_lr", 1)
> > 
> > modparam("rls", "min_expiration", 200) modparam("rls", 
> > "max_expiration", 300) modparam("rls", "default_expiration", 300) 
> > modparam("rls", "auth", "none") modparam("rls", "xcap_root", 
> > "http://localhost/xcap") modparam("rls", "reduce_xcap_needs", 1) 
> > modparam("rls", "db_mode", 1) modparam("rls", "db_url", 
> > "mysql://xxxxxxxxxxx:yyyyyyyyy@10.22.1.222/ser_pa")
> > 
> > modparam("pa", "use_db", 1)
> > # allow storing authorization requests for offline users into database 
> > modparam("pa", "use_offline_winfo", 1) # how often try to remove old 
> > stored authorization requests modparam("pa", "offline_winfo_timer", 
> > 600) # how long stored authorization requests live modparam("pa", 
> > "offline_winfo_expiration", 600) modparam("pa", "db_url", 
> > "mysql://xxxxxxxxxxx:yyyyyyyyy@10.22.1.222/ser_pa")
> > # mode of PA authorization: none, implicit or xcap modparam("pa", 
> > "auth", "xcap") modparam("pa", "auth_xcap_root", 
> > "http://localhost/xcap") # do not authorize watcherinfo subscriptions 
> > modparam("pa", "winfo_auth", "none") # use only published information 
> > if set to 0 modparam("pa", "use_callbacks", 1) # don't accept internal 
> > subscriptions from RLS, ...
> > modparam("pa", "accept_internal_subscriptions", 1) # maximum value of 
> > Expires for subscriptions modparam("pa", 
> > "max_subscription_expiration", 600) # maximum value of Expires for 
> > publications modparam("pa", "max_publish_expiration", 120) # how often 
> > test if something changes and send NOTIFY modparam("pa", 
> > "timer_interval", 10)
> > 
> > # route for generated SUBSCRIBE requests for presence 
> > modparam("presence_b2b", "presence_route", 
> > "<sip:127.0.0.1;transport=tcp;lr>")
> > # waiting time from error to new attepmt about SUBSCRIBE 
> > modparam("presence_b2b", "on_error_retry_time", 60) # how long wait 
> > for NOTIFY with Subscription-Status=terminated after unsubscribe 
> > modparam("presence_b2b", "wait_for_term_notify", 33) # how long before 
> > expiration send renewal SUBSCRIBE request modparam("presence_b2b", 
> > "resubscribe_delta", 30) # minimal time to send renewal SUBSCRIBE 
> > request from receiving previous response modparam("presence_b2b", 
> > "min_resubscribe_time", 60) # default expiration timeout 
> > modparam("presence_b2b", "default_expiration", 3600) # process 
> > internal subscriptions to presence events modparam("presence_b2b", 
> > "handle_presence_subscriptions", 1)
> > 
> > modparam("usrloc", "db_mode", 2)
> > modparam("domain", "db_mode", 1)
> > #modparam("domain|uri_db|acc|auth_db|usrloc|msilo", "db_url", 
> > "mysql://xxxxxxxxxxx:yyyyyyyyy@10.22.1.222/ser_pa")
> > modparam("domain|uri_db|auth_db|usrloc|msilo", "db_url", 
> > "mysql://xxxxxxxxxxx:yyyyyyyyy@10.22.1.222/ser_pa")
> > 
> > modparam("fifo", "fifo_file", "/tmp/ser_fifo")
> > 
> > # -------------------------  request routing logic -------------------
> > 
> > # main routing logic
> > 
> > route{
> >         # XML RPC
> >         if (method == "POST" ||  method == "GET") {
> >                 create_via();
> >                 dispatch_rpc();
> >                 break;
> >         }
> > 
> >         # initial sanity checks -- messages with
> >         # max_forwards==0, or excessively long requests
> >         if (!mf_process_maxfwd_header("10")) {
> >                 sl_send_reply("483","Too Many Hops");
> >                 break;
> >         };
> >         if (msg:len >=  max_len ) {
> >                 sl_send_reply("513", "Message too big");
> >                 break;
> >         };
> > 
> >         # we record-route all messages -- to make sure that
> >         # subsequent messages will go through our proxy; that's
> >         # particularly good if upstream and downstream entities
> >         # use different transport protocol
> >         if (!method=="REGISTER") record_route();
> > 
> >         if ((method=="INVITE") or (method=="BYE") or (method=="CANCEL"))
> >         {
> >             setflag(1);
> >         }
> > 
> >         # subsequent messages withing a dialog should take the
> >         # path determined by record-routing
> >         if (loose_route()) {
> >                 # mark routing logic in request
> >                 append_hf("P-hint: rr-enforced\r\n");
> >                 route(1);
> >                 break;
> >         };
> > 
> >         # if the request is for other domain use UsrLoc
> >         # (in case, it does not work, use the following command
> >         # with proper names and addresses in it)
> >         if (uri==myself) {
> > 
> >                 if (!lookup_domain("To")) {
> >                         xlog("L_ERR", "Unknown domain to: %tu from: %fu\n");
> >                         route(1);
> >                         break;
> >                 }
> > 
> >                 if (method=="SUBSCRIBE") {
> >                         if (!t_newtran()) {
> >                                 sl_reply_error();
> >                                 break;
> >                         };
> > 
> >                         if (@to.tag=="") {
> >                                 # only for new subscriptions (with 
> > empty to tag)
> > 
> >                                 if (lookup_user("To")) {
> >                                         # existing user -> it is subscription to PA
> >                                         if (handle_subscription("registrar")) {
> >                                                 if ((@msg.event=~"presence\.winfo")) {
> >                                                         # new watcher info subscription
> >                                                         # sends one watcher info NOTIFY message with all saved authorization requests
> >                                                         xlog("L_ERR", "dumping stored winfo to %fu\n");
> >                                                         dump_stored_winfo("registrar", "presence");
> >                                                 }
> >                                                 else {
> >                                                         # new presence subscription
> >                                                         if ((@msg.event=~"presence") && (%subscription_status=="pending")) {
> >                                                                 # if offline user and new pending subscription
> >                                                                 if (!target_online("registrar")) {
> >                                                                         #%subscription_status="waiting"; # store it as waiting subscription
> >                                                                         xlog("L_ERR", "storing 'pending' winfo to: %tu, from: %fu\n");
> >                                                                         store_winfo("registrar");
> >                                                                 }
> >                                                         }
> >                                                 }
> >                                         }
> >                                         break;
> >                                 }
> > 
> >                                 if ((@msg.supported=~"eventlist")) {
> >                                         # such user doesn't exist and Supported header field
> >                                         #    -> probably RLS subscription
> > 
> >                                         if (lookup_domain("From")) {
> >                                                 if (lookup_user("From")) {
> >                                                         if (is_simple_rls_target("$uid-list")) {
> >                                                                 # log(1, "it is simple subscription!\n");
> >                                                                 # takes From UID and makes XCAP query for user's
> >                                                                 # list named "default"
> >                                                                 if (!query_resource_list("default")) {
> >                                                                         t_reply("404", "No such user list");
> >                                                                         break;
> >                                                                 }
> >                                                         }
> >                                                 }
> >                                         }
> > 
> >                                         if (!have_flat_list()) {
> >                                                 # query_resource_list failed or was not called
> >                                                 # do standard RLS query acording to To/AOR
> >                                                 if (!query_rls_services()) {
> >                                                         log(1, "XCAP query failed\n");
> >                                                         t_reply("404", "No such list URI");
> >                                                         break;
> >                                                 }
> >                                         }
> > 
> > 
> >                                         if (!radius_www_authorize("test.intra")) {
> >                                             www_challenge("test.intra", "0");
> >                                             break;
> >                                         };
> >                                         handle_rls_subscription("1");
> >                                 }
> >                                 else {
> >                                         # not resource list subscription -> invalid user
> >                                         xlog("L_ERR", "subscription to invalid user %tu\n");
> >                                         t_reply("404", "User not found");
> >                                 }
> > 
> >                                 break;
> >                         }
> >                         else {
> >                                 # renewal subscriptions - try to handle it as RLS and if failed, handle it as PA subscription
> >                                 # FIXME: better will be test like existing_rls_subscription()
> >                                 #        and existing_subscription("registrar")
> >                                 if (!handle_rls_subscription("0")) {
> >                                         handle_subscription("registrar");
> >                                 }
> >                                 break;
> >                         }
> >                 };
> > 
> >                 # get user (common for all other messages than SUBSCRIBE)
> >                 if (!lookup_user("To")) {
> >                         # log(1, "Unknown user - message should be forwarded?");
> > #                       # break;
> >                         append_hf("P-hint: unknown user\r\n");
> >                         route(1);
> >                         break;
> >                 }
> > 
> >                 if (method=="PUBLISH") {
> >                         if (!t_newtran()) {
> > #                          log(1, "newtran error\n");
> >                            sl_reply_error();
> >                            break;
> >                         };
> >                         handle_publish("registrar");
> > 
> >                         # deliver messages to online user
> >                         # TODO: only if user goes from offline to online?
> >                         if (target_online("registrar")) {
> >                                 # log(1, "Dumping stored messages\n");
> >                                 # dump stored messages - route it through myself (otherwise routed via DNS!)
> >                                 if (m_dump("sip:127.0.0.1")) {
> >                                         xlog("L_ERR", "MSILO: offline messages for %fu dumped\n");
> >                                 }
> >                         }
> > 
> >                         break;
> >                 };
> > 
> >                 if (method=="NOTIFY") {
> >                         if (!t_newtran()) {
> >                            log(1, "newtran error\n");
> >                            sl_reply_error();
> >                            break;
> >                         };
> >                         # handle notification sent in internal subscriptions (presence_b2b)
> >                         if (!handle_notify()) {
> >                                 t_reply("481", "Unable to handle notification");
> >                         }
> >                         break;
> >                 };
> > 
> >                 if (method=="MESSAGE") {
> > 
> >                         if 
> > (authorize_message("http://localhost/xcap")) {
> > 
> >                                 # use usrloc for delivery
> >                                 if (lookup("location")) {
> > 
> >                                         log(1, "Delivering MESSAGE using usrloc\n");
> >                                         t_on_failure("1");
> >                                         if (!t_relay()) {
> >                                                 sl_reply_error();
> >                                         }
> > 
> >                                         break;
> >                                 }
> >                                 else {
> >                                         # store messages for offline user
> >                                         xlog("L_ERR", "MSILO: storing 
> > MESSAGE for %tu\n");
> > 
> >                                         if (!t_newtran()) {
> >                                            log(1, "newtran error\n");
> >                                            sl_reply_error();
> >                                            break;
> >                                         };
> > 
> >                                         # store only text messages NOT isComposing... !
> >                                         if (search("^(Content-Type|c):.*application/im-iscomposing\ xml.*")) {
> >                                                 log(1, "it is only isComposing message - ignored\n");
> >                                                 t_reply("202", "Ignored");
> >                                                 break;
> >                                         }
> > 
> >                                         if (m_store("0", "sip:127.0.0.1")) {
> >                                                 # log(1, "MSILO: offline message stored\n");
> >                                                 if (!t_reply("202", "Accepted")) {
> >                                                         sl_reply_error();
> >                                                 };
> >                                         } else {
> >                                                 log(1, "MSILO: error storing offline message\n");
> >                                                 if (!t_reply("503", "Service Unavailable")) {
> >                                                         sl_reply_error();
> >                                                 };
> >                                         };
> >                                         break;
> >                                 }
> >                                 break;
> >                         }
> >                         else {
> >                                 # log(1, "unauthorized message\n");
> >                                 sl_reply("403", "Forbidden");
> >                         }
> >                         break;
> >                 }
> > 
> >                 if (method=="REGISTER") {
> > 
> >                        if (!radius_www_authorize("test.intra")) {
> >                            www_challenge("test.intra", "0");
> >                            break;
> >                        };
> > 
> >                         save("location");
> > 
> >                         # dump stored messages - route it through myself (otherwise routed via DNS!)
> >                         if (m_dump("sip:127.0.0.1")) {
> >                                 xlog("L_ERR", "MSILO: offline messages for %fu dumped\n");
> >                         }
> >                         break;
> >                 };
> > 
> >                 # native SIP destinations are handled using our USRLOC DB
> >                 if (!lookup("location")) {
> >                         sl_send_reply("404", "Not Found");
> >                         break;
> >                 };
> >         };
> > #       append_hf("P-hint: usrloc applied\r\n");
> >         route(1);
> > }
> > 
> > #route[1]
> > #{
> > #       # send it out now; use stateful forwarding as it works reliably
> > #       # even for UDP2TCP
> > #       if (!t_relay()) {
> > #               sl_reply_error();
> > #       };
> > #}
> > 
> > 
> > #failure_route[1] {
> > #       # forwarding failed -- check if the request was a MESSAGE
> > #       if (!method=="MESSAGE") { break; };
> > #       log(1, "MSILO: MESSAGE forward failed - storing it\n");
> > #
> > #       # we have changed the R-URI with the contact address, ignore it now
> > #       if (m_store("0", "")) {
> > #               t_reply("202", "Accepted");
> > #       } else {
> > #               log(1, "MSILO: offline message NOT stored\n");
> > #               t_reply("503", "Service Unavailable");
> > #       };
> > #}
> > 
> >  
> > 
> > route[1]
> > {
> > 
> >     if (method=="INVITE")
> >     {
> >         t_on_reply("1");
> >         t_on_failure("1");
> >         use_media_proxy();
> >     }
> >     else if (method=="BYE|CANCEL") {
> >        end_media_session();
> >     }
> > 
> >     # send it out now; use stateful forwarding as it works reliably
> >     # even for UDP2TCP
> >     if (!t_relay()) {
> >             sl_reply_error();
> >     };
> > }
> > 
> >  
> > 
> > onreply_route[1]
> > {
> >     if (status=~"(183)|2[0-9][0-9]") {
> >          use_media_proxy();
> >      };
> >      if (status=~"[3-6]0[0-9]") {
> >          end_media_session();
> >          break;
> >      }
> > }
> > failure_route[1]
> > {
> >     # forwarding failed -- check if the request was a MESSAGE
> >     if (!method=="MESSAGE") { break; };
> >     log(1, "MSILO: MESSAGE forward failed - storing it\n");
> >     # we have changed the R-URI with the contact address, ignore it now
> >     if (m_store("0", "")) {
> >         t_reply("202", "Accepted");
> >     } else {
> >         log(1, "MSILO: offline message NOT stored\n");
> >         t_reply("503", "Service Unavailable");
> >     };
> >     end_media_session();
> > }
> 
> 
> 
> 
> 
> ___________________________________________________________________________________________
> Lehet, hogy ma pont az ön kedvenc kötetét kínáljuk nagy engedménnyel? 
> Érdemes betérni hozzánk, naponta új akcióval várjuk!
> http://ad.adverticum.net/b/cl,1,6022,165977,228257/click.prm



More information about the sr-users mailing list