<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][15905] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=15905">15905</a></dd>
<dt>Author</dt> <dd>bottleman</dd>
<dt>Date</dt> <dd>2009-12-11 06:18:29 -0600 (Fri, 11 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>fix rtp timer initialisation.
implement alerting-indication option and channel variable.
implement progress-indication option and channel variable.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodendpointsmod_h323changestxt">freeswitch/trunk/src/mod/endpoints/mod_h323/changes.txt</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_h323h323confxml">freeswitch/trunk/src/mod/endpoints/mod_h323/h323.conf.xml</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_h323mod_h323cpp">freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.cpp</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_h323mod_h323h">freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodendpointsmod_h323changestxt"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_h323/changes.txt (15904 => 15905)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_h323/changes.txt        2009-12-11 05:14:45 UTC (rev 15904)
+++ freeswitch/trunk/src/mod/endpoints/mod_h323/changes.txt        2009-12-11 12:18:29 UTC (rev 15905)
</span><span class="lines">@@ -1,5 +1,7 @@
</span><del>-
-fix to build with trunk changes.
</del><ins>+fix rtp timer initialisation.
+implement alerting-indication option and channel variable.
+implement progress-indication option and channel variable.
+fix short DTMF warnings.
</ins><span class="cx"> remove SWITCH_RTP_FLAG_AUTOADJ because its not work correctly and not do anything reliable in our cases.
</span><span class="cx"> fix faststart in progress handling
</span><span class="cx"> fixxxxes
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_h323h323confxml"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_h323/h323.conf.xml (15904 => 15905)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_h323/h323.conf.xml        2009-12-11 05:14:45 UTC (rev 15904)
+++ freeswitch/trunk/src/mod/endpoints/mod_h323/h323.conf.xml        2009-12-11 12:18:29 UTC (rev 15905)
</span><span class="lines">@@ -12,6 +12,8 @@
</span><span class="cx">     &lt;param name=&quot;h245tunneling&quot; value=&quot;true&quot;/&gt;  &lt;!-- optional --&gt;
</span><span class="cx">     &lt;param name=&quot;h245insetup&quot; value=&quot;true&quot;/&gt;  &lt;!-- optional --&gt;
</span><span class="cx">     &lt;param name=&quot;jitter-size&quot; value=&quot;60&quot;/&gt;  &lt;!-- optional --&gt;
</span><ins>+    &lt;param name=&quot;progress-indication&quot; value=&quot;8&quot;/&gt; &lt;!-- optional - PI value in progress message--&gt;
+    &lt;param name=&quot;alerting-indication&quot; value=&quot;8&quot;/&gt; &lt;!-- optional - PI value in alerting message--&gt;
</ins><span class="cx">   &lt;/settings&gt;
</span><span class="cx">   &lt;listeners&gt;
</span><span class="cx">     &lt;listener name=&quot;default&quot;&gt;
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_h323mod_h323cpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.cpp (15904 => 15905)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.cpp        2009-12-11 05:14:45 UTC (rev 15904)
+++ freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.cpp        2009-12-11 12:18:29 UTC (rev 15905)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>-        Version 0.0.13
</del><ins>+        Version 0.0.16
</ins><span class="cx"> */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;mod_h323.h&quot;
</span><span class="lines">@@ -361,6 +361,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     switch_xml_t xmlSettings = switch_xml_child(cfg, &quot;settings&quot;);
</span><ins>+        m_pi = 8;
+        m_ai = 0;
</ins><span class="cx">     if (xmlSettings) {
</span><span class="cx">         for (switch_xml_t xmlParam = switch_xml_child(xmlSettings, &quot;param&quot;); xmlParam != NULL; xmlParam = xmlParam-&gt;next) {
</span><span class="cx">             const char *var = switch_xml_attr_soft(xmlParam, &quot;name&quot;);
</span><span class="lines">@@ -405,8 +407,11 @@
</span><span class="cx">                                 m_gkPrefixes.AppendString(val);
</span><span class="cx">                         } else if (!strcasecmp(var, &quot;gk-retry&quot;)) {
</span><span class="cx">                                 m_gkretry = atoi(val);
</span><del>-                        } 
-                        
</del><ins>+                        } else if (!strcasecmp(var, &quot;progress-indication&quot;)) {
+                                m_pi = atoi(val);
+                        } else if (!strcasecmp(var, &quot;alerting-indication&quot;)) {
+                                m_ai = atoi(val);
+                        }                        
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -821,6 +826,89 @@
</span><span class="cx">         return ( status == SWITCH_STATUS_SUCCESS);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void FSH323Connection::AnsweringCall(AnswerCallResponse response){
+
+        PTRACE(4, &quot;mod_h323\t======&gt;FSH323Connection::AnsweringCall [&quot;&lt;&lt;*this&lt;&lt;&quot;]&quot;);
+        
+        switch (response) {
+                case AnswerCallDeferredWithMedia:{
+                        PTRACE(2, &quot;H323\tAnswering call: &quot; &lt;&lt; response);
+                        if (!Lock())
+                                return;
+                        if (!mediaWaitForConnect) {
+                                // create a new facility PDU if doing AnswerDeferredWithMedia
+                                H323SignalPDU want245PDU;
+                                H225_Progress_UUIE &amp; prog = want245PDU.BuildProgress(*this);
+                                PBoolean sendPDU = TRUE;
+
+                                if (SendFastStartAcknowledge(prog.m_fastStart))
+                                        prog.IncludeOptionalField(H225_Progress_UUIE::e_fastStart);
+                                else {
+                                        // See if aborted call
+                                        if (connectionState == ShuttingDownConnection){
+                                                Unlock();
+                                                return;
+                                        }
+                                        // Do early H.245 start
+                                        H225_Facility_UUIE &amp; fac = *want245PDU.BuildFacility(*this, FALSE, H225_FacilityReason::e_startH245);
+                                        earlyStart = TRUE;
+                                        if (!h245Tunneling &amp;&amp; (controlChannel == NULL)) {
+                                                if (!StartControlChannel()){
+                                                        Unlock();
+                                                        return;
+                                                }
+                                                fac.IncludeOptionalField(H225_Facility_UUIE::e_h245Address);
+                                                controlChannel-&gt;SetUpTransportPDU(fac.m_h245Address, TRUE);
+                                        } 
+                                        else
+                                                sendPDU = FALSE;
+                                }
+                                const char *vpi = switch_channel_get_variable(m_fsChannel, &quot;progress-indication&quot;); 
+                                unsigned pi = 8;
+                                if (vpi){
+                                        pi = atoi(vpi); 
+                                }
+                                else pi = m_endpoint-&gt;m_pi;
+                                if ((pi&lt; 1) || (pi &gt; 8)||(pi == 7)) pi = 8;
+                                want245PDU.GetQ931().SetProgressIndicator(pi);
+                                if (sendPDU) {
+                                        HandleTunnelPDU(&amp;want245PDU);
+                                        WriteSignalPDU(want245PDU);
+                                }
+                        }
+                        InternalEstablishedConnectionCheck();
+                        Unlock();
+                        return;
+                } 
+                case AnswerCallPending :{
+                        if (alertingPDU != NULL) {
+                                if (!Lock())
+                                        return;
+                                // send Q931 Alerting PDU
+                                PTRACE(3, &quot;H225\tSending Alerting PDU&quot;);
+                                
+                                const char *vai = switch_channel_get_variable(m_fsChannel, &quot;alerting-indication&quot;); 
+                                unsigned ai = 0;
+                                if (vai){
+                                        ai = atoi(vai); 
+                                }
+                                else ai = m_endpoint-&gt;m_ai;
+                                if ((ai&lt; 0) || (ai &gt; 8)||(ai == 7)) ai = 8;
+                                if (ai &gt; 0)
+                                        (*alertingPDU).GetQ931().SetProgressIndicator(ai);
+                                
+                                HandleTunnelPDU(alertingPDU);
+                                WriteSignalPDU(*alertingPDU);
+                                alertingTime = PTime();
+                                InternalEstablishedConnectionCheck();
+                                Unlock();
+                                return;
+                        }
+                }
+                default :H323Connection::AnsweringCall(response);
+        } 
+}
+
</ins><span class="cx"> void FSH323Connection::OnEstablished(){
</span><span class="cx"> 
</span><span class="cx">         PTRACE(4, &quot;mod_h323\t======&gt;PFSH323Connection::OnEstablished [&quot;&lt;&lt;*this&lt;&lt;&quot;]&quot;);
</span><span class="lines">@@ -1229,6 +1317,7 @@
</span><span class="cx">                 m_switchCodec = NULL;
</span><span class="cx">                 return false;
</span><span class="cx">             }
</span><ins>+                        switch_channel_set_variable(m_fsChannel,&quot;timer_name&quot;,&quot;soft&quot;);
</ins><span class="cx">         } else {
</span><span class="cx">             switch_core_session_set_video_read_codec(m_fsSession, m_switchCodec);
</span><span class="cx">             switch_channel_set_flag(m_fsChannel, CF_VIDEO);
</span><span class="lines">@@ -1278,11 +1367,13 @@
</span><span class="cx">         PTRACE(4, &quot;mod_h323\t-------------------&gt;samples_per_packet = &quot;&lt;&lt;m_switchCodec-&gt;implementation-&gt;samples_per_packet);
</span><span class="cx">         PTRACE(4, &quot;mod_h323\t-------------------&gt;actual_samples_per_second = &quot;&lt;&lt;m_switchCodec-&gt;implementation-&gt;actual_samples_per_second);
</span><span class="cx">         
</span><del>-        if (!m_conn-&gt;m_startRTP) {                        
-                flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT|SWITCH_RTP_FLAG_AUTO_CNG|SWITCH_RTP_FLAG_RAW_WRITE);                
</del><ins>+        if ((!m_conn-&gt;m_startRTP)&amp;&amp;(GetDirection() == IsReceiver)) {                        
+                flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT|SWITCH_RTP_FLAG_AUTO_CNG|SWITCH_RTP_FLAG_RAW_WRITE);
+                PTRACE(4, &quot;mod_h323\t-------------------&gt;timer_name = &quot;&lt;&lt;switch_channel_get_variable(m_fsChannel, &quot;timer_name&quot;));
</ins><span class="cx">                 if ((var = switch_channel_get_variable(m_fsChannel, &quot;timer_name&quot;))) {
</span><span class="cx">                         timer_name = (char *) var;
</span><span class="cx">                 }
</span><ins>+                PTRACE(4, &quot;mod_h323\t-------------------&gt;timer_name = &quot;&lt;&lt;timer_name);
</ins><span class="cx">                 tech_pvt-&gt;rtp_session = switch_rtp_new((const char *)m_RTPlocalIP,
</span><span class="cx">                                                                                            m_RTPlocalPort,
</span><span class="cx">                                                                                            (const char *)m_RTPremoteIP,
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_h323mod_h323h"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.h (15904 => 15905)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.h        2009-12-11 05:14:45 UTC (rev 15904)
+++ freeswitch/trunk/src/mod/endpoints/mod_h323/mod_h323.h        2009-12-11 12:18:29 UTC (rev 15905)
</span><span class="lines">@@ -126,6 +126,7 @@
</span><span class="cx">     PString gatekeeper;
</span><span class="cx"> };
</span><span class="cx"> class FSGkRegThread;
</span><ins>+
</ins><span class="cx"> class FSH323EndPoint:public H323EndPoint {
</span><span class="cx"> 
</span><span class="cx">     PCLASSINFO(FSH323EndPoint, H323EndPoint);
</span><span class="lines">@@ -156,7 +157,8 @@
</span><span class="cx">     }
</span><span class="cx">         FSH323Connection * FSMakeCall(const PString &amp; dest,void *userData);
</span><span class="cx">         list &lt;FSListener&gt; m_listeners;
</span><del>-        
</del><ins>+        int m_ai;
+        int m_pi;
</ins><span class="cx">         protected:
</span><span class="cx">                 PStringList m_gkPrefixes;
</span><span class="cx">                 switch_endpoint_interface_t *m_freeswitch;
</span><span class="lines">@@ -168,7 +170,6 @@
</span><span class="cx">                 bool m_h245insetup;
</span><span class="cx">                 int m_gkretry;
</span><span class="cx">                 FSGkRegThread* m_thread;
</span><del>-                
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -219,6 +220,7 @@
</span><span class="cx">     void setRemoteAddress(const char* remoteIP, WORD remotePort);
</span><span class="cx">         virtual void OnSetLocalCapabilities();
</span><span class="cx">         virtual bool OnAlerting(const H323SignalPDU &amp;alertingPDU, const PString &amp;user);
</span><ins>+        virtual void AnsweringCall(AnswerCallResponse response);
</ins><span class="cx">         virtual void OnEstablished();
</span><span class="cx">         bool SetLocalCapabilities();
</span><span class="cx">         static bool decodeCapability(const H323Capability&amp; capability, const char** dataFormat, int* payload = 0, PString* capabName = 0);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>