<div>Hi</div>
<div>&nbsp;</div>
<div>here is my config</div>
<div>&nbsp;</div>
<div>iam able to dial *86, i get voice message that no voice messages</div>
<div>&nbsp;</div>
<div>But the call&nbsp; rewriting when the user not available</div>
<div>it should go to asterisks voice mail</div>
<div>&nbsp;</div>
<div>ram</div>
<div>&nbsp;</div>
<div>
<p>[root@sert openser]# more openser.cfg<br>#<br># $Id: openser.cfg,v 1.5 2005/10/28 19:45:33 bogdan_iancu Exp $<br>#<br># simple quick-start config script<br>#</p>
<p># ----------- global configuration parameters ------------------------</p>
<p>debug=3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # debug level (cmd line: -dddddddddd)<br>log_facility=LOG_LOCAL7<br>fork=yes<br>log_stderror=no&nbsp;&nbsp;&nbsp; # (cmd line: -E)</p>
<p>/* Uncomment these lines to enter debugging mode<br>fork=no<br>log_stderror=yes<br>*/</p>
<p>check_via=no&nbsp;&nbsp;&nbsp; # (cmd. line: -v)<br>dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: -r)<br>rev_dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: -R)<br>port=5060<br>children=4<br>fifo=&quot;/tmp/openser_fifo&quot;</p>
<p># ------------------ module loading ----------------------------------</p>
<p>loadmodule &quot;/usr/local/lib/openser/modules/tm.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/sl.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/acc.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/rr.so&quot;
<br>loadmodule &quot;/usr/local/lib/openser/modules/maxfwd.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/mysql.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/usrloc.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/registrar.so&quot;
<br>loadmodule &quot;/usr/local/lib/openser/modules/auth.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/auth_db.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/textops.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/uri.so&quot;
<br>loadmodule &quot;/usr/local/lib/openser/modules/uri_db.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/group.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/msilo.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/nathelper.so&quot;
<br>loadmodule &quot;/usr/local/lib/openser/modules/enum.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/domain.so&quot;<br>loadmodule &quot;/usr/local/lib/openser/modules/xlog.so&quot;</p>
<p>&nbsp;</p>
<p>fifo_db_url=&quot;mysql://openser:openserrw@localhost/openser&quot;</p>
<p><br>modparam(&quot;usrloc|acc|auth_db|group|msilo&quot;, &quot;db_url&quot;, &quot;mysql://openser:openserrw@localhost/openser&quot;)</p>
<p><br># ----------------- setting module-specific parameters ---------------<br># -- usrloc params --<br>/* 0 -- dont use mysql, 1 -- write_through, 2--write_back */<br>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;, 2)
<br>modparam(&quot;usrloc&quot;, &quot;timer_interval&quot;, 10)<br>modparam(&quot;usrloc&quot;, &quot;use_domain&quot;, 1)<br>modparam(&quot;registrar&quot;, &quot;use_domain&quot;, 1)<br># -- auth params --<br>modparam(&quot;auth_db&quot;, &quot;calculate_ha1&quot;, yes)
<br>modparam(&quot;auth_db&quot;, &quot;password_column&quot;, &quot;password&quot;)<br>#modparam(&quot;auth_db&quot;, &quot;use_rpid&quot;, 1)<br>modparam(&quot;auth&quot;, &quot;nonce_expire&quot;, 300)<br>modparam(&quot;auth&quot;, &quot;rpid_prefix&quot;, &quot;&lt;sip:&quot;)
<br>modparam(&quot;auth&quot;, &quot;rpid_suffix&quot;, &quot;@myip&gt;;party=calling;id-type=subscriber;screen=yes;privacy=off&quot;)</p>
<p># -- rr params --<br># add value to ;lr param to make some broken UAs happy<br>modparam(&quot;rr&quot;, &quot;enable_full_lr&quot;, 1)</p>
<p># -- acc params --<br># report ACKs too for sake of completeness -- as we account PSTN<br># destinations which are RR, ACKs should show up<br>modparam(&quot;acc&quot;, &quot;report_ack&quot;, 1)<br>modparam(&quot;acc&quot;, &quot;log_level&quot;, 1)
<br># if BYE fails (telephone is dead, record-routing broken, etc.), generate<br># a report nevertheless -- otherwise we would have no STOP event; =&gt; 1<br>#modparam(&quot;acc&quot;, &quot;failed_transactions&quot;, 1)</p>

<p># that is the flag for which we will account -- don't forget to<br># set the same one :-)<br># Usage of flags is as follows:<br>#&nbsp;&nbsp; 1 == should account(all to gateway),<br>#&nbsp;&nbsp; 3 == should report on missed calls (transactions to 
<a href="http://iptel.org">iptel.org</a>'s users),<br>#&nbsp;&nbsp; 4 == destination user wishes to use voicemail<br>#&nbsp;&nbsp; 6 == nathelper<br>#<br>modparam(&quot;acc&quot;, &quot;log_flag&quot;, 1)<br>modparam(&quot;acc&quot;, &quot;db_flag&quot;, 1)
<br>modparam(&quot;acc&quot;, &quot;log_missed_flag&quot;, 3)<br>modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 3)</p>
<p># report to syslog: From, i-uri, status, digest id, method<br>modparam(&quot;acc&quot;, &quot;log_fmt&quot;, &quot;fisumdpr&quot;)</p>
<p># -- tm params --<br>modparam(&quot;tm&quot;, &quot;fr_timer&quot;, 15)<br>modparam(&quot;tm&quot;, &quot;fr_inv_timer&quot;, 25)<br>modparam(&quot;tm&quot;, &quot;wt_timer&quot;, 30)</p>
<p># -- msilo params<br>modparam(&quot;msilo&quot;, &quot;registrar&quot;, &quot;<a href="mailto:sip:registrar@mydomain.com">sip:registrar@mydomain.com</a>&quot;)</p>
<p># -- enum params --<br>modparam(&quot;enum&quot;, &quot;domain_suffix&quot;, &quot;e164.arpa.&quot;)</p>
<p># -- multi-domain<br>modparam(&quot;domain&quot;, &quot;db_mode&quot;, 1)<br># -------------------------&nbsp; request routing logic -------------------</p>
<p># main routing logic<br>#Routing Script<br>route {<br>&nbsp;#check for old messages: could mean a problem with the DNS entries or some other loop-causer...<br>&nbsp;if (!mf_process_maxfwd_header(&quot;10&quot;))<br>&nbsp;{<br>&nbsp;&nbsp; xlog(&quot;L_WARN&quot;, &quot;WARNING: Too many hops\n&quot;);
<br>&nbsp;&nbsp; sl_send_reply(&quot;483&quot;, &quot;Too many hops, forward count exceeded limit\n&quot;);<br>&nbsp;&nbsp; return;<br>&nbsp;};</p>
<p>&nbsp;#check for extremely large messages; we don't need a sip dos attack<br>&nbsp;if (msg:len &gt;= 2048)<br>&nbsp;{<br>&nbsp;&nbsp; xlog(&quot;L_WARN&quot;, &quot;WARNING: Message too large, &gt;= 2048 bytes\n&quot;);<br>&nbsp;&nbsp; sl_send_reply(&quot;513&quot;, &quot;Message too large, exceeded limit\n&quot;);
<br>&nbsp;&nbsp; return;<br>&nbsp;};</p>
<p>&nbsp;#record everything besides registers and acks<br>&nbsp;if(method!=&quot;REGISTER&quot; &amp;&amp; method!=&quot;ACK&quot;)<br>&nbsp;{<br>&nbsp; setflag(1);<br>&nbsp;};</p>
<p>&nbsp;#do not send to voicemail if BYE or CANCEL<br>&nbsp;#is used to end call before user pickup or timeout<br>&nbsp;if(method==&quot;CANCEL&quot; || method==&quot;BYE&quot;)<br>&nbsp;{<br>&nbsp; setflag(10);<br>&nbsp;};</p>
<p>&nbsp;#grant route if route headers already present<br>&nbsp;if (loose_route())<br>&nbsp;{<br>&nbsp;&nbsp; route(1);<br>&nbsp;&nbsp; return;<br>&nbsp;};</p>
<p>&nbsp;#Always require authentication, which could result in a PSTN, ie $$$<br>&nbsp;if (method==&quot;REGISTER&quot;)<br>&nbsp;{<br>&nbsp;&nbsp; if(!www_authorize(&quot;<a href="http://domain.com">domain.com</a>&quot;, &quot;subscriber&quot;))
<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; www_challenge(&quot;<a href="http://domain.com">domain.com</a>&quot;, &quot;0&quot;);<br>&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; else<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; #Save into user database, used below when checking if user is available
<br>&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;REGISTER: User Authenticated Correctly\n&quot;);<br>&nbsp;&nbsp;&nbsp; save(&quot;location&quot;);<br>&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp; };<br>&nbsp;};</p>
<p>&nbsp;if (method==&quot;INVITE&quot;)<br>&nbsp;{<br>&nbsp; if (uri=~&quot;sip:1[0-9]+@.*&quot;)<br>&nbsp; {<br>&nbsp;&nbsp; #authorize if a call is going to PSTN<br>&nbsp;&nbsp; if(!proxy_authorize(&quot;<a href="http://domain.com">domain.com</a>&quot;, &quot;subscriber&quot;))
<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; proxy_challenge(&quot;<a href="http://domain.com">domain.com</a>&quot;, &quot;0&quot;);<br>&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp; };</p>
<p>&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;CALL: Call to international number\n&quot;);<br>#&nbsp;&nbsp; rewritehostport(&quot;voip_gw.domain.net:5060&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rewritehostport(&quot;myprovider-voip:port&quot;);<br>&nbsp; }<br>&nbsp; else if(uri=~&quot;sip:\*86@.*&quot;)
<br>&nbsp; {<br>&nbsp;&nbsp; #authorize if a call is going to PSTN<br>&nbsp;&nbsp; if(!proxy_authorize(&quot;<a href="http://domain.com">domain.com</a>&quot;, &quot;subscriber&quot;))<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; proxy_challenge(&quot;<a href="http://domain.com">
domain.com</a>&quot;, &quot;0&quot;);<br>&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp; };</p>
<p>&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;CALL: Call to check voicemail\n&quot;);<br>&nbsp;&nbsp; rewritehostport(&quot;asterisk-server-ip:5090&quot;);<br>&nbsp; }<br>&nbsp; else<br>&nbsp; {<br>&nbsp;&nbsp; if (does_uri_exist())</p>
<p>{<br>&nbsp;&nbsp;&nbsp; #Call is to sip client, so do nothing but route<br>&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;CALL: Sip client\n&quot;);<br>&nbsp;&nbsp;&nbsp; if (!lookup(&quot;location&quot;))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;404&quot;, &quot;Not Found&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp; log(1, &quot;ERROR: User Not Found\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; else<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; #authorize if a call is going to PSTN<br>&nbsp;&nbsp;&nbsp; if(!proxy_authorize(&quot;<a href="http://domain.com">domain.com
</a>&quot;, &quot;subscriber&quot;))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp; proxy_challenge(&quot;domain&quot;, &quot;0&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; };</p>
<p>&nbsp;&nbsp;&nbsp; #Call destination is PSTN, so send it to the gateway (<a href="http://Net.com">Net.com</a>)<br>&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;CALL: PSTN gateway\n&quot;);<br>#&nbsp;&nbsp;&nbsp; rewritehostport(&quot;voip_gw.domain.net:5060&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rewritehostport(&quot;myprovider-voip:port&quot;);</p>
<p>&nbsp;&nbsp; };<br>&nbsp; };</p>
<p>&nbsp; #Make sure that all subsequent requests go through us;<br>&nbsp; record_route();<br>&nbsp;}<br>&nbsp;else<br>&nbsp;{<br>&nbsp; if (does_uri_exist())<br>&nbsp; {<br>&nbsp;&nbsp; #Call is to sip client, so do nothing but route<br>&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;CALL: Sip client\n&quot;);
<br>&nbsp;&nbsp; if (!lookup(&quot;location&quot;))<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>&nbsp;&nbsp;&nbsp; log(1, &quot;ERROR: User Not Found\n&quot;);</p>
<p>&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp; };<br>&nbsp; }<br>&nbsp; else<br>&nbsp; {<br>&nbsp;&nbsp; #Call destination is PSTN, so send it to the gateway (<a href="http://Net.com">Net.com</a>)<br>&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;CALL: PSTN gateway\n&quot;);<br>&nbsp;&nbsp; rewritehostport(&quot;voip_gw.domain.net:5060&quot;);
</p>
<p>&nbsp; };<br>&nbsp; record_route();<br>&nbsp;};</p>
<p>&nbsp;#ALL PROCESSING IS DONE, SO ROUTE<br>&nbsp;route(1);<br>}</p>
<p><br>route[1]<br>{<br>#send the call outward</p>
<p>&nbsp;if(method==&quot;INVITE&quot; &amp;&amp; !isflagset(10))<br>&nbsp;{<br>&nbsp; t_on_failure(&quot;2&quot;);<br>&nbsp;};</p>
<p>&nbsp;if (!t_relay())<br>&nbsp;{<br>&nbsp; xlog(&quot;L_WARN&quot;, &quot;ERROR: t_relay failed&quot;);<br>&nbsp; sl_reply_error();<br>&nbsp;};</p>
<p>}</p>
<p>failure_route[2]<br>{<br>&nbsp;if(!t_was_cancelled())<br>&nbsp;{<br>&nbsp; revert_uri();<br>&nbsp; rewritehostport(&quot;asterisk-ip-voicemail:5090&quot;);<br>&nbsp; append_branch();<br>&nbsp; #PREVENT SOME CRAZY VOICEMAIL LOOP<br>&nbsp; xlog(&quot;L_INFO&quot;, &quot;INFO: CALL TO VOICEMAIL&quot;);
<br>&nbsp; setflag(10);<br>&nbsp; route(1);<br>&nbsp;}<br>}</p></div>
<div><br>&nbsp;</div>
<div>&nbsp;</div>
<div>ram</div>