<p>Hi all.</p>
<p>I have a problem for the following scenario.<br>When I make a call for PSTN and on hook by PSTN side,<br>Cisco As can&#39;t send BYE&nbsp;for SER.</p>
<p>&nbsp; 01. [UA via Asterisk] dialing &quot;08022223333&quot; -&gt; [SER]<br>&nbsp; 02. [SER] prefix(&quot;0333&quot;) and rewritehostport(&quot;my.cisco.ip.address:5060&quot;) -&gt; [Cisco]<br>&nbsp; 03. [Cisco] dial-peer voice 6000 pots, translate-outgoing called from &quot;033308022223333&quot; to &quot;008022223333&quot;
<br>&nbsp; 04. [Cisco] process an outbound call to &quot;008022223333&quot; -&gt; [e.g. Mobile]<br>&nbsp; 05. [e.g. Mobile] Catch call<br>&nbsp; 06. [SER] log CDR start<br>&nbsp; 07. [Cisco] talking<br>&nbsp; 08. [e.g. Mobile] On hook and call disconnect
<br>&nbsp; 09. [Cisco] can&#39;t send BYE&nbsp;for SER *****why??*****<br>&nbsp; 10. [UA via Asterisk] On hook<br>&nbsp; 11. [UA via Asterisk] Send BYE&nbsp;for SER<br>&nbsp; 12. [SER] log CDR End [Cisco] Call finished</p>
<p>But another scenario, if make a call from PSTN to Asterisk and<br>on hook by PSTN side, Cisco As send BYE to SER.</p>
<p>&nbsp; 01. [e.g. Mobile] dialing &quot;0377771111(Asterisk user number)&quot;<br>&nbsp; 02. [Cisco] receive &quot;77771111&quot; call number<br>&nbsp; 03. [Cisco] dial-peer voice 5000 voip, session target ipv4:my.ser.ip.address -&gt; [SER]
<br>&nbsp; 04. [SER] process an incoming call to &quot;0377771111&quot; -&gt; [UA via Asterisk]<br>&nbsp; 05. [UA via Asterisk] Catch call<br>&nbsp; 06. [SER] log CDR start<br>&nbsp; 07. [UA via Asterisk] talking<br>&nbsp; 08. [e.g. Mobile] On hook and call disconnect
<br>&nbsp; 09. [Cisco] Send BYE to SER<br>&nbsp; 10. [SER] log CDR End [Cisco] Call&nbsp;finished<br>&nbsp; 11. [UA via Asterisk] receive BYE from SER</p>
<p>And sorry for my diffucult example.</p>
<p>Why Cisco AS 5300 can&#39;t send BYE to SER<br>When PSTN call is disconnected by PSTN side?</p>
<p>My ser.cfg as follows:</p>
<p># --------------------------------------------------------------------------<br># global configuration parameters<br># --------------------------------------------------------------------------<br>fork=no<br>log_stderror=yes
<br>check_via=no<br>dns=no<br>rev_dns=no<br>listen=my.ser.ip.address<br>port=5060<br>fifo=&quot;/tmp/ser_fifo&quot;<br>fifo_db_url=&quot;mysql://ser:heslo@localhost/ser&quot;</p>
<p># --------------------------------------------------------------------------<br># module loading<br># --------------------------------------------------------------------------<br>loadmodule &quot;/usr/local/lib/ser/modules/mysql.so&quot;
<br>loadmodule &quot;/usr/local/lib/ser/modules/sl.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/tm.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/rr.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/maxfwd.so&quot;
<br>loadmodule &quot;/usr/local/lib/ser/modules/usrloc.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/registrar.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/textops.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/auth.so&quot;
<br>loadmodule &quot;/usr/local/lib/ser/modules/auth_db.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/avpops.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/permissions.so&quot;<br>loadmodule &quot;/usr/local/lib/ser/modules/acc.so&quot;
<br>loadmodule &quot;/usr/local/lib/ser/modules/exec.so&quot;</p>
<p># --------------------------------------------------------------------------<br># setting module-specific parameters<br># --------------------------------------------------------------------------<br>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;, 2)
<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;rr&quot;, &quot;enable_full_lr&quot;, 1)<br>modparam(&quot;usrloc&quot;, &quot;db_url&quot;, &quot;
mysql://ser:heslo@localhost/ser&quot;)<br>modparam(&quot;auth_db&quot;, &quot;db_url&quot;, &quot;mysql://ser:heslo@localhost/ser&quot;)<br>modparam(&quot;permissions&quot;, &quot;db_url&quot;, &quot;mysql://ser:heslo@localhost
/ser&quot;)<br>modparam(&quot;tm&quot;, &quot;fr_inv_timer&quot;, 27)<br>modparam(&quot;tm&quot;, &quot;fr_inv_timer_avp&quot;, &quot;inv_timeout&quot;)<br>modparam(&quot;permissions&quot;, &quot;db_mode&quot;, 1)<br>modparam(&quot;permissions&quot;, &quot;trusted_table&quot;, &quot;trusted&quot;)
<br>modparam(&quot;acc&quot;, &quot;db_url&quot;, &quot;mysql://ser:heslo@localhost/ser&quot;)<br>modparam(&quot;acc&quot;, &quot;db_flag&quot;, 2)<br>modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 3)</p>
<p># --------------------------------------------------------------------------<br># route pattern<br># --------------------------------------------------------------------------<br>route {<br>&nbsp;<br>&nbsp; if (!mf_process_maxfwd_header(&quot;10&quot;)) { 
<br>&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;); <br>&nbsp;&nbsp;&nbsp; break; <br>&nbsp; };</p>
<p>&nbsp; if ( msg:len &gt; max_len ) { <br>&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;513&quot;, &quot;Message too big&quot;); <br>&nbsp;&nbsp;&nbsp; break; <br>&nbsp; }; <br>&nbsp; <br>&nbsp; record_route(); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp; if (loose_route()) {<br>&nbsp;&nbsp;&nbsp; if (method==&quot;ACK&quot;) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acc_db_request(&quot;01:CallStart\n&quot;, &quot;acc&quot;);<br>&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp; if (method==&quot;BYE&quot; || method==&quot;CANCEL&quot;) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acc_db_request(&quot;02:CallEnd\n&quot;, &quot;acc&quot;);<br>&nbsp;&nbsp;&nbsp; };
<br>&nbsp;&nbsp;&nbsp; t_relay();<br>&nbsp;&nbsp;&nbsp; break; <br>&nbsp; };</p>
<p>&nbsp; if (uri==myself) { <br>&nbsp;&nbsp;&nbsp; if (method==&quot;REGISTER&quot;) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!www_authorize(&quot;&quot;, &quot;subscriber&quot;)) { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www_challenge(&quot;&quot;, &quot;0&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }; 
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; save(&quot;location&quot;); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; <br>&nbsp;&nbsp;&nbsp; };</p>
<p>&nbsp;&nbsp;&nbsp; if (search(&quot;^(f|From): <a href="mailto:.*@(my\.cisco\.ip\.address">.*@(my\.cisco\.ip\.address</a>)&quot;)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #PSTN Incoming call from Cisco AS 5300 e.g. 0377771111<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rewritehost(&quot;my.asterisk.ip.address
&quot;);<br>&nbsp;&nbsp;&nbsp; };</p>
<p>&nbsp;&nbsp;&nbsp; lookup(&quot;aliases&quot;);</p>
<p>&nbsp;&nbsp;&nbsp; if (!lookup(&quot;location&quot;)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (method==&quot;INVITE&quot; &amp;&amp; !search(&quot;^(f|From): <a href="mailto:.*@(my\.cisco\.ip\.address">.*@(my\.cisco\.ip\.address</a>)&quot;)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!proxy_authorize(&quot;&quot;, &quot;subscriber&quot;)) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_challenge(&quot;&quot;, &quot;0&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (uri=~&quot;^sip:0[0-9]{10}@&quot;) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # PSTN Outgoing call to Cisco AS 5300 e.g. 08022223333<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prefix(&quot;0333&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rewritehostport(&quot;my.cisco.ip.address:5060&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; avp_write(&quot;i:45&quot;, &quot;inv_timeout&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;404&quot;, &quot;Not Found&quot;); 
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; consume_credentials();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }; <br>&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp; <br>&nbsp; };</p>
<p>&nbsp; if (!t_relay()) {<br>&nbsp;&nbsp;&nbsp; sl_reply_error(); <br>&nbsp; }; <br>&nbsp; <br>} </p>
<p>And my Cisco AS 5300 config as follows:</p>
<p>voice call send-alert<br>voice rtp send-recv</p>
<p>voice service pots <br>&nbsp;fax protocol t38 ls-redundancy 0 hs-redundancy 0 fallback cisco</p>
<p>voice service voip <br>&nbsp;fax protocol t38 ls-redundancy 0 hs-redundancy 0 fallback cisco<br>&nbsp;sip<br>&nbsp; min-se&nbsp; 60 </p>
<p>translation-rule 50<br>&nbsp;Rule 0 0333 0<br>&nbsp;Rule 1 ^7777 037777</p>
<p>voice class codec 2<br>&nbsp;codec preference 1 g711ulaw<br>&nbsp;codec preference 2 g711alaw</p>
<p>dial-peer voice 5000 voip<br>&nbsp;tone ringback alert-no-PI<br>&nbsp;description ser-asterisk-cisco-test<br>&nbsp;huntstop<br>&nbsp;destination-pattern 77771111$<br>&nbsp;translate-outgoing called 50<br>&nbsp;voice-class codec 2<br>&nbsp;session protocol sipv2
<br>&nbsp;session target ipv4:my.ser.ip.address<br>&nbsp;dtmf-relay rtp-nte<br>&nbsp;max-conn 1</p>
<p>dial-peer voice 6000 pots<br>&nbsp;application session<br>&nbsp;max-conn 2<br>&nbsp;destination-pattern 0333T<br>&nbsp;progress_ind alert enable 8<br>&nbsp;translate-outgoing called 50<br>&nbsp;port 0:D</p>
<p>Thanks,<br>Sahria</p>