<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>Voicemail</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2 FACE="Arial">Hello,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I'm trying for long hours to put voicemail working in my network. I'm using SEMS version from CVS and SER 0.8.12</FONT>
<BR><FONT SIZE=2 FACE="Arial">I read many past emails from the serusers list and I follow the examples in FAQ by Jiri.</FONT>
<BR><FONT SIZE=2 FACE="Arial">I create a group in ser's database named &quot;voicemail&quot; with serctl acl grante &lt;username&gt; &lt;group&gt; and put there all my usernames registered in SER's database.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">I'm having always 2 problems;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">- is_user_in(&quot;Request-URI&quot;, &quot;voicemail&quot;) always return false even if the user is in the group of voicemail in tables grp from SER'c database;</FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">- if I force setflag(4) to be true I always get the error &quot;could not contact announcement server&quot; or &quot;could not contact voicemail server&quot;</FONT></P>
<BR>

<P><FONT SIZE=2 FACE="Arial">Does anyone have some idea what is happening?</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Thank you.</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Arial">João</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Arial">Here are my config files:</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">#</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># simple quick-start config script</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">## vm_proxy 2004/01/26 Joao Sampaio</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Courier New"># ----------- global configuration parameters ------------------------</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">#debug=3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # debug level (cmd line: -dddddddddd)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#fork=yes</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#log_stderror=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd line: -E)</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">/* Uncomment these lines to enter debugging mode </FONT>
<BR><FONT SIZE=2 FACE="Courier New">debug=7</FONT>
<BR><FONT SIZE=2 FACE="Courier New">fork=no</FONT>
<BR><FONT SIZE=2 FACE="Courier New">log_stderror=yes</FONT>
<BR><FONT SIZE=2 FACE="Courier New">*/</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">check_via=no&nbsp;&nbsp;&nbsp; # (cmd. line: -v)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: -r)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">rev_dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: -R)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">port=5060</FONT>
<BR><FONT SIZE=2 FACE="Courier New">children=4</FONT>
<BR><FONT SIZE=2 FACE="Courier New">fifo=&quot;/tmp/ser_fifo&quot;</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># ------------------ module loading ----------------------------------</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># $Id: vm_proxy.cfg,v 1.1 2003/10/30 14:52:41 jiri Exp $</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># simple proxy script for forwarding to voicemail server</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># for unavailable users</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/sl.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/tm.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/rr.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/maxfwd.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/mysql.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/group.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/usrloc.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/registrar.so&quot;</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># time to give up on ringing -- global timer, applies to </FONT>
<BR><FONT SIZE=2 FACE="Courier New">#&nbsp;&nbsp;&nbsp; all transactions</FONT>
<BR><FONT SIZE=2 FACE="Courier New">modparam(&quot;tm&quot;, &quot;fr_inv_timer&quot;, 10)</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># database with user group membership</FONT>
<BR><FONT SIZE=2 FACE="Courier New">modparam(&quot;group&quot;, &quot;db_url&quot;, &quot;mysql://ser:heslo@localhost/ser&quot;)</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Courier New"># ---------------------&nbsp; request routing logic -------------------</FONT>
<BR><FONT SIZE=2 FACE="Courier New">route {</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!mf_process_maxfwd_header(&quot;10&quot;)) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">log(&quot;LOG: Too many hops\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;483&quot;, &quot;Alas Too Many Hops&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!(method==&quot;REGISTER&quot;)) record_route();</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (loose_route()) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_relay();</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!uri==myself) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_relay();</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (method == &quot;REGISTER&quot;) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!save(&quot;location&quot;)) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_reply_error();</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># does the user wish redirection on no availability? (i.e., is he</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># in the voicemail group?) -- determine it now and store it in</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># flag 4, before we rewrite the flag using UsrLoc</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (1){&nbsp; #is_user_in(&quot;Request-URI&quot;, &quot;voicemail&quot;)) {&nbsp;&nbsp; ###Force setflag(4) to be true###</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">setflag(4);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># native SIP destinations are handled using our USRLOC DB</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!lookup(&quot;location&quot;)) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># handle user which was not found</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">route(4);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># if user is on-line and is in voicemail group, enable redirection</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (method == &quot;INVITE&quot; &amp;&amp; isflagset(4)) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_on_failure(&quot;1&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_relay();</FONT>
<BR><FONT SIZE=2 FACE="Courier New">}</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># ------------- handling of unavailable user ------------------</FONT>
<BR><FONT SIZE=2 FACE="Courier New">route[4] {</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># non-Voip -- just send &quot;off-line&quot;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!(method == &quot;INVITE&quot; || method == &quot;ACK&quot; || method == &quot;CANCEL&quot;)) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;404&quot;, &quot;Not Found&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># not voicemail subscriber</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!isflagset(4)) { </FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;404&quot;, &quot;Not Found and no voicemail turned on&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># forward to voicemail now</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">rewritehostport(&quot;10.112.64.121:5090&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_relay_to_udp(&quot;10.112.64.121&quot;, &quot;5090&quot;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2 FACE="Courier New">}</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># if forwarding downstream did not succeed, try voicemail running</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># at bat.iptel.org:5090</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">failure_route[1] {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">revert_uri();</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">rewritehostport(&quot;10.112.64.121:5090&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">append_branch();</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_relay_to_udp(&quot;10.112.64.121&quot;, &quot;5090&quot;);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">}</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Arial">-----------------------------------------------------------------------------------------------------------------------------------------------------------------------</FONT></P>
<BR>

<P><FONT SIZE=2 FACE="Courier New">#</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># $Id: voicemail.cfg,v 1.2 2003/10/10 06:27:18 jiri Exp $</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># this script is configured for use as voicemail UAS; it processes</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># INVITEs and BYEs and asks SEMS to record media via &quot;vm&quot;; in this</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># script, all record-routing and other constructs known from proxy</FONT>
<BR><FONT SIZE=2 FACE="Courier New"># scripts are not present&nbsp; -- it is a simple UAS </FONT>
<BR><FONT SIZE=2 FACE="Courier New">#</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># ----------- global configuration parameters ------------------------</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">#debug= &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # debug level (cmd line: -dddddddddd)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#fork=no</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#log_stderror=yes &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd line: -E)</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">debug=4</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#fork=no</FONT>
<BR><FONT SIZE=2 FACE="Courier New">log_stderror=yes</FONT>
<BR><FONT SIZE=2 FACE="Courier New">check_via=no&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: -v)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">dns=no&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: -r)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">rev_dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: -R)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">port=5090</FONT>
<BR><FONT SIZE=2 FACE="Courier New">#children=4</FONT>
<BR><FONT SIZE=2 FACE="Courier New">fifo=&quot;/tmp/vm_ser_fifo&quot;</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># ------------------ module loading ----------------------------------</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/sl.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/tm.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/maxfwd.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/mysql.so&quot;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">loadmodule &quot;/usr/lib/ser/modules/vm.so&quot;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2 FACE="Courier New"># ----------------- setting module-specific parameters ---------------</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">modparam(&quot;voicemail&quot;, &quot;db_url&quot;,&quot;mysql://ser:heslo@localhost/ser&quot;)</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># -------------------------&nbsp; request routing logic -------------------</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"># main routing logic</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">route{</FONT>
</P>
<BR>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># initial sanity checks -- messages with</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># max_forwars==0, or excessively long requests</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!mf_process_maxfwd_header(&quot;10&quot;)) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (msg:len &gt; max_len){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #len_gt( max_len )) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;513&quot;, &quot;Message too big&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!uri==myself) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;404&quot;, &quot;not reponsible for host in r-uri&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>
<BR>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New"># Voicemail specific configuration - begin</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if(method==&quot;ACK&quot; || method==&quot;INVITE&quot; || method==&quot;BYE&quot;){</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (!t_newtran()) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">log(1,&quot;could not create new transaction\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;500&quot;,&quot;could not create new transaction&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_reply(&quot;100&quot;,&quot;Trying -- just wait a minute !&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if(method==&quot;INVITE&quot;){</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">log(1,&quot;**************** vm start - begin ******************\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (uri=~&quot;9999@10.112.64.121&quot;){&nbsp;&nbsp; #&quot;sip:as_welcome@.*&quot; || uri=~&quot;sip:as_nomoney@.*&quot;) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!vm(&quot;/tmp/am_fifo&quot;, &quot;announcement&quot;)) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(1,&quot;couldn't contact announcement server\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_reply(&quot;500&quot;, &quot;couldn not contact announcement server&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">} else {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if(!vm(&quot;/tmp/am_fifo&quot;,&quot;voicemail&quot;)){</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">log(1,&quot;could not contact the answer machine\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_reply(&quot;500&quot;,&quot;could not contact the answer machine&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">log(1,&quot;**************** vm start - end ******************\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">} else if(method==&quot;BYE&quot;){</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">log(1,&quot;**************** vm end - begin ******************\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if(!vm(&quot;/tmp/am_fifo&quot;,&quot;bye&quot;)){</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">log(1,&quot;could not contact the answer machine\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">t_reply(&quot;500&quot;,&quot;could not contact the answer machine&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">log(1,&quot;**************** vm end - end ******************\n&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">if (method==&quot;CANCEL&quot;) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;200&quot;, &quot;cancels are junked here&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">break;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">};</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">sl_send_reply(&quot;501&quot;, &quot;method not understood here&quot;);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">}</FONT>
</P>
<BR>
<BR>
<BR>
<BR>
<BR>

<P><B><FONT COLOR="#000080" SIZE=4 FACE="Times New Roman">________________________</FONT></B>
<BR><B><FONT COLOR="#000080" SIZE=4 FACE="Times New Roman">João Sampaio</FONT></B>
</P>

<P><FONT COLOR="#000080" SIZE=2 FACE="Times New Roman">PT Inovação, SA</FONT>
</P>

<P><FONT COLOR="#000080" SIZE=2 FACE="Times New Roman">SRM - Serviços e Redes Móveis</FONT>
</P>

<P><FONT COLOR="#000080" SIZE=2 FACE="Times New Roman">email: est-j-sampaio@ptinovacao.pt</FONT>
<BR><FONT COLOR="#000080" SIZE=2 FACE="Times New Roman">Tlf:&nbsp; +351 234511160-1907 / +351 234403421</FONT>
</P>

</BODY>
</HTML>