Advertisement
Guest User

kamailio_route_presence

a guest
Mar 31st, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. route[PRESENCE] {
  2. if(!is_method("PUBLISH|NOTIFY|SUBSCRIBE"))
  3. return;
  4.  
  5. #!ifdef WITH_PRESENCE
  6. if (!t_newtran())
  7. {
  8. sl_reply_error();
  9. exit;
  10. };
  11.  
  12. if(is_method("NOTIFY"))
  13. {
  14. rls_handle_notify();
  15. #t_release();
  16. #exit;
  17. /* the call to t_release is no longer needed in 1.5 */
  18. }
  19. else
  20. if(is_method("PUBLISH"))
  21. {
  22. xlog("L_INFO", "Handling publish request - R=$ru ID=$ci\n");
  23. #handle_publish();
  24. if($hdr(Sender)!= $null)
  25. handle_publish("$hdr(Sender)");
  26. else
  27. handle_publish();
  28.  
  29. t_release();
  30. }
  31. else
  32. if( is_method("SUBSCRIBE"))
  33. {
  34. xlog("L_INFO", "Handling subscribe request for event '$hdr(Event)' - R=$ru ID=$ci\n");
  35. #handle_subscribe();
  36.  
  37. $var(ret_code)= rls_handle_subscribe();
  38. xlog("L_INFO", "Subscribe RLS:::::::::::::::: $var(ret_code)");
  39. if($var(ret_code)== 10) {
  40.  
  41. #if($hdr(Sender)!= $null)
  42. # handle_subscribe("$hdr(Sender)");
  43. #else
  44. handle_subscribe();
  45. }
  46. t_release();
  47. }
  48. exit;
  49. #!endif
  50.  
  51. # if presence enabled, this part will not be executed
  52. if (is_method("PUBLISH") || $rU==$null)
  53. {
  54. sl_send_reply("404", "Not here in plm mea");
  55. exit;
  56. }
  57. return;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement