[Users] How to setup the openser with presence function?

Charles Wang lazy.charles at gmail.com
Sun May 27 15:42:23 CEST 2007


Hi all,

I use two X-Lite SIP clients with Contact list supported. I want to use chat
(text mode) with each sip clients(X-Lite) via Openser.
I study the documents of Openser ( http://openser.org/docs/ ), I think the
modules ( presence, pua, pua_usrloc, pua_mi ) should what I need.
But I don't know how to set it up. I can't see any online or offline
information for both Xlite1 and Xlite2. Of couse, I add both of them as
friends in contact list on X-Lite software.

Can anyone kind to give me some tips or any URL to reference please?


Xlite1  ==chat==> Openser ==Chat==> Xlite2

# -- presence params --
loadmodule "presence.so"
modparam("presence", "db_url", "mysql://openser:openserrw@localhost
/openser")
modparam("presence", "max_expires", 3600)
modparam("presence", "force_active", 1)
modparam("presence", "server_address", "sip:127.0.0.1:5060" )

#### I don't know how to configure them in DB
# loadmodule "pua.so"
# modparam("pua", "db_url", "mysql://openser:openserrw@localhost/openser")
# loadmodule "pua_mi.so"
# loadmodule "pua_usrloc.so"

route[0]
{
 xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
 force_rport();
 if(msg:len > max_len)
 {

  xlog("L_INFO", "Message too big - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
  sl_send_reply("513", "Message Too Big");
  exit;
 }
 if (!mf_process_maxfwd_header("10"))
 {
  xlog("L_INFO", "Too many hops - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
  sl_send_reply("483", "Too Many Hops");
  exit;
 }
 if(!is_method("REGISTER"))
 {
  if(nat_uac_test("19"))
  {
   record_route(";nat=yes");
  }
  else
  {
   record_route();
  }
 }
 if(is_method("CANCEL") || is_method("BYE"))
 {
  end_media_session();
 }
 if (is_method("NOTIFY")) {
  sl_send_reply("200", "OK");
  exit;
 };

 if(loose_route())
 {
  if(!has_totag())
  {
   xlog("L_INFO", "Initial loose-routing rejected - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
   sl_send_reply("403", "Initial Loose-Routing Rejected");
   exit;
  }
  if(nat_uac_test("19") || search("^Route:.*;nat=yes"))
  {
   fix_nated_contact();
   if(!search("^Content-Length:[ ]*0"))
   {
    setbflag(6);
   }
  }
  if(is_method("BYE"))
  {
   setflag(24); # account failed transactions
   setflag(25); # account successful transactions
  }
  # mark as loose-routed for acc
  setflag(26);
  route(11);
 }
 if(is_method("REGISTER"))
 {
  route(10);
 }
 setflag(24); # account failed transactions
 setflag(25); # account successful transactions

 if(is_method("INVITE"))
 {
  route(12);
 }
 if(is_method("CANCEL") || is_method("ACK"))
 {
  route(16);
 }

 ## Added for Presence
 if(is_method("PUBLISH") || is_method("SUBSCRIBE") || is_method("MESSAGE"))
 {
  route(19);
 }

 route(17);
}
route[19]
{
 xlog("L_INFO", "route[19] Presence Handling Router - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
 # absorb retransmissions
 if (! t_newtran())
 {
    sl_reply_error();
    exit;
 };

 if(is_method("PUBLISH"))
 {
  handle_publish();
  t_release();
 } else if(is_method("SUBSCRIBE")) {
  handle_subscribe();
  t_release();
 };
 exit;
}



-- 

Best Regards
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20070527/2d1cd15e/attachment.htm>


More information about the sr-users mailing list