Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
presence:configuration-file [2011/09/07 14:25] – 92.112.156.8 | presence:configuration-file [2012/03/22 12:40] (current) – removed spam 80.250.1.245 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== OpenSER Configuration File For Presence Server ====== | ||
+ | |||
+ | ==== Example started from default configuration file ==== | ||
+ | |||
+ | The example uses ' | ||
+ | |||
+ | <code c># | ||
+ | # $Id$ | ||
+ | # | ||
+ | # simple quick-start config script | ||
+ | # | ||
+ | |||
+ | # ----------- global configuration parameters ------------------------ | ||
+ | |||
+ | /* Uncomment these lines to enter debugging mode */ | ||
+ | debug=7 | ||
+ | fork=no | ||
+ | log_stderror=yes | ||
+ | |||
+ | check_via=no # | ||
+ | dns=no | ||
+ | rev_dns=no | ||
+ | listen=udp: | ||
+ | children=4 | ||
+ | |||
+ | |||
+ | # | ||
+ | # uncomment the following lines for TLS support | ||
+ | # | ||
+ | #listen = tls: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #tls_method = TLSv1 | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # ------------------ module loading ---------------------------------- | ||
+ | mpath="/ | ||
+ | |||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | |||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | |||
+ | |||
+ | # Uncomment this if you want digest authentication | ||
+ | # mysql.so must be loaded ! | ||
+ | #loadmodule "/ | ||
+ | #loadmodule "/ | ||
+ | |||
+ | # ----------------- setting module-specific parameters --------------- | ||
+ | |||
+ | # -- usrloc params -- | ||
+ | # Uncomment this if you want to use SQL database | ||
+ | # for persistent storage and comment the previous line | ||
+ | modparam(" | ||
+ | |||
+ | # -- auth params -- | ||
+ | # Uncomment if you are using auth module | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # If you set " | ||
+ | # uncomment also the following parameter) | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # -- rr params -- | ||
+ | # add value to ;lr param to make some broken UAs happy | ||
+ | modparam(" | ||
+ | |||
+ | # -- presence params -- | ||
+ | modparam(" | ||
+ | " | ||
+ | modparam(" | ||
+ | modparam(" | ||
+ | modparam(" | ||
+ | |||
+ | # -- mi_fifo params -- | ||
+ | modparam(" | ||
+ | |||
+ | # ------------------------- | ||
+ | |||
+ | # main routing logic | ||
+ | |||
+ | route{ | ||
+ | # initial sanity checks -- messages with | ||
+ | # max_forwards==0, | ||
+ | if (!mf_process_maxfwd_header(" | ||
+ | sl_send_reply(" | ||
+ | exit; | ||
+ | }; | ||
+ | |||
+ | if (msg:len >= 2048 ) { | ||
+ | sl_send_reply(" | ||
+ | exit; | ||
+ | }; | ||
+ | |||
+ | # 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==" | ||
+ | record_route(); | ||
+ | |||
+ | # subsequent messages withing a dialog should take the | ||
+ | # path determined by record-routing | ||
+ | if (loose_route()) { | ||
+ | # mark routing logic in request | ||
+ | append_hf(" | ||
+ | route(1); | ||
+ | }; | ||
+ | |||
+ | if (!uri==myself) { | ||
+ | # mark routing logic in request | ||
+ | append_hf(" | ||
+ | # if you have some interdomain connections via TLS | ||
+ | # | ||
+ | # | ||
+ | # exit; | ||
+ | #} else if(uri=~" | ||
+ | # | ||
+ | # exit; | ||
+ | #} | ||
+ | route(1); | ||
+ | }; | ||
+ | |||
+ | # 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) { | ||
+ | |||
+ | # presence handling | ||
+ | if( is_method(" | ||
+ | route(2); | ||
+ | |||
+ | if (method==" | ||
+ | |||
+ | # Uncomment this if you want to use digest authentication | ||
+ | #if (!www_authorize(" | ||
+ | # | ||
+ | # exit; | ||
+ | #}; | ||
+ | |||
+ | save(" | ||
+ | exit; | ||
+ | }; | ||
+ | |||
+ | # native SIP destinations are handled using our USRLOC DB | ||
+ | if (!lookup(" | ||
+ | sl_send_reply(" | ||
+ | exit; | ||
+ | }; | ||
+ | append_hf(" | ||
+ | }; | ||
+ | |||
+ | route(1); | ||
+ | } | ||
+ | |||
+ | |||
+ | route[1] { | ||
+ | # send it out now; use stateful forwarding as it works reliably | ||
+ | # even for UDP2TCP | ||
+ | if (!t_relay()) { | ||
+ | sl_reply_error(); | ||
+ | }; | ||
+ | exit; | ||
+ | } | ||
+ | |||
+ | # presence handling route | ||
+ | route[2] | ||
+ | { | ||
+ | # absorb retransmissions | ||
+ | if (! t_newtran()) | ||
+ | { | ||
+ | sl_reply_error(); | ||
+ | exit; | ||
+ | }; | ||
+ | |||
+ | if(is_method(" | ||
+ | { | ||
+ | handle_publish(); | ||
+ | t_release(); | ||
+ | } else if( is_method(" | ||
+ | handle_subscribe(); | ||
+ | t_release(); | ||
+ | }; | ||
+ | |||
+ | exit; | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Stand alone presence server ==== | ||
+ | |||
+ | |||
+ | The example uses ' | ||
+ | |||
+ | For NAT traversal you have to use fix_nated_contact() from ' | ||
+ | |||
+ | <code c> | ||
+ | # | ||
+ | # $Id$ | ||
+ | # | ||
+ | # simple quick-start config script | ||
+ | # | ||
+ | |||
+ | # ----------- global configuration parameters ------------------------ | ||
+ | |||
+ | /* Uncomment these lines to enter debugging mode */ | ||
+ | debug=7 | ||
+ | fork=no | ||
+ | log_stderror=yes | ||
+ | |||
+ | check_via=no | ||
+ | dns=no | ||
+ | rev_dns=no | ||
+ | listen=udp: | ||
+ | children=4 | ||
+ | |||
+ | # | ||
+ | # uncomment the following lines for TLS support | ||
+ | # | ||
+ | #listen = tls: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #tls_method = TLSv1 | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # ------------------ module loading ---------------------------------- | ||
+ | mpath="/ | ||
+ | |||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | loadmodule " | ||
+ | |||
+ | ## Uncomment this line if this presence server is handling Dialog Info presence ( BLF ) | ||
+ | #loadmodule " | ||
+ | |||
+ | ## Uncomment this line if this presence server is handling MWI ( Message Waiting Indicator, the voicemail light ) | ||
+ | #loadmodule " | ||
+ | |||
+ | # ----------------- setting module-specific parameters --------------- | ||
+ | |||
+ | # -- rr params -- | ||
+ | # add value to ;lr param to make some broken UAs happy | ||
+ | modparam(" | ||
+ | |||
+ | # -- presence params -- | ||
+ | modparam(" | ||
+ | |||
+ | modparam(" | ||
+ | |||
+ | modparam(" | ||
+ | |||
+ | modparam(" | ||
+ | |||
+ | # ------------------------- | ||
+ | |||
+ | # main routing logic | ||
+ | |||
+ | route{ | ||
+ | # initial sanity checks -- messages with | ||
+ | # max_forwards==0, | ||
+ | if (!mf_process_maxfwd_header(" | ||
+ | sl_send_reply(" | ||
+ | exit; | ||
+ | }; | ||
+ | |||
+ | if (msg:len >= 2048 ) { | ||
+ | sl_send_reply(" | ||
+ | exit; | ||
+ | }; | ||
+ | |||
+ | # 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 (!is_method(" | ||
+ | sl_send_reply(" | ||
+ | exit; | ||
+ | } | ||
+ | |||
+ | # presence handling | ||
+ | if (! t_newtran()) | ||
+ | { | ||
+ | sl_reply_error(); | ||
+ | exit; | ||
+ | }; | ||
+ | |||
+ | if(is_method(" | ||
+ | { | ||
+ | handle_publish("" | ||
+ | t_release(); | ||
+ | } else if( is_method(" | ||
+ | { | ||
+ | handle_subscribe(); | ||
+ | t_release(); | ||
+ | }; | ||
+ | |||
+ | exit; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Presence-Related Stuff ===== | ||
+ | |||
+ | {{indexmenu> | ||