<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>For question 1, you can use SWITCH_CHANNEL_SESSION_LOG if you have a NULL session pointer.</div><div><br></div><div>Chris</div><div><br></div><div><br>On Aug 4, 2013, at 8:54 PM, Seven Du &lt;<a href="mailto:dujinfang@gmail.com">dujinfang@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div>
                <div>
                    Hi,
                </div><div><br></div><div>1) when use switch_rtp without a session&nbsp;SWITCH_RTP_FLAG_DEBUG_RTP_READ complaining no session attached because it use&nbsp;SWITCH_CHANNEL_SESSION_LOG.</div><div><br></div><div>Suggested fix:</div><div><br></div><div>use&nbsp;SWITCH_CHANNEL_SESSION_LOG where possible and&nbsp;SWITCH_CHANNEL_LOG when no session.</div><div><br></div><div>also, I think the following code is wrong because there's no rtp_session-&gt;session:</div><div><br></div><div>if (!rtp_session-&gt;session) {</div><div><div><span style="white-space:pre">        </span>rtp_session-&gt;flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ] = 0;</div><div><span style="white-space:pre">        </span>switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session-&gt;session), SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");</div><div><span style="white-space:pre">        </span>} else {</div></div><div><span style="white-space:pre">        </span>...</div><div><br></div><div>I can fix and push if confirmed.</div><div><br></div><div>2)&nbsp;switch_rtp_zerocopy_read_frame() blocks forever if no RTP comes. Anyway to make it non block? I tried the following code &nbsp;it blocks even with&nbsp;SWITCH_IO_FLAG_NOBLOCK.</div><div><br></div><div>I tried the following code in mod_skel, I can make a diff if necessary.</div><div><br></div><div><br></div><div><div><span style="white-space:pre">        </span>rtp_flag[SWITCH_RTP_FLAG_IO] = 1;</div><div><span style="white-space:pre">        </span>rtp_flag[SWITCH_RTP_FLAG_AUTOADJ] = 1;</div><div><span style="white-space:pre">        </span>rtp_flag[SWITCH_RTP_FLAG_DATAWAIT] = 0;</div><div><span style="white-space:pre">        </span>rtp_flag[SWITCH_RTP_FLAG_VIDEO] = 1;</div><div><span style="white-space:pre">        </span>rtp_flag[SWITCH_RTP_FLAG_NOBLOCK] = 1;</div><div><span style="white-space:pre">        </span>rtp_flag[SWITCH_RTP_FLAG_AUTO_CNG] = 1;</div><div><span style="white-space:pre">        </span>// rtp_flag[SWITCH_RTP_FLAG_DEBUG_RTP_READ] = 1;</div><div><span style="white-space:pre">        </span>// rtp_flag[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE] = 1;</div><div><br></div><div><span style="white-space:pre">        </span>rtp_session = switch_rtp_new(IP, //local</div><div><span style="white-space:pre">                </span>50002, //recv port</div><div><span style="white-space:pre">                </span>IP,</div><div><span style="white-space:pre">                </span>42000, //remote, doesn't matter for us, but can't be 0</div><div><span style="white-space:pre">                </span>96, // payload_type</div><div><span style="white-space:pre">                </span>1,</div><div><span style="white-space:pre">                </span>90000,</div><div><span style="white-space:pre">                </span>rtp_flag,</div><div><span style="white-space:pre">                </span>NULL, &amp;err, pool);</div><div><br></div><div><span style="white-space:pre">        </span>if (!rtp_session) {</div><div><span style="white-space:pre">                </span>switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error: %s\n", err);</div><div><span style="white-space:pre">                </span>goto done;</div><div><span style="white-space:pre">        </span>}</div><div><br></div><div><span style="white-space:pre">        </span>while(!done) {</div><div><span style="white-space:pre">                </span>// status = switch_rtp_zerocopy_read_frame(rtp_session, &amp;read_frame, SWITCH_IO_FLAG_NOBLOCK);</div><div><span style="white-space:pre">                </span>status = switch_rtp_zerocopy_read_frame(rtp_session, &amp;read_frame, SWITCH_IO_FLAG_NONE);</div><div><span style="white-space:pre">                </span>switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "read %d\n", read_frame.packetlen);</div><div><span style="white-space:pre">                </span>switch_yield(100000);</div><div><span style="white-space:pre">        </span>}</div></div><div><br></div>
                <div><div>Thanks for help.</div><div><br></div><div><br></div><div>--&nbsp;</div><div>Seven Du</div><div><span style="font-size: 10pt; "><a href="http://www.freeswitch.org.cn">http://www.freeswitch.org.cn</a></span></div><div><a href="http://about.me/dujinfang">http://about.me/dujinfang</a></div><div><div><a href="http://www.dujinfang.com">http://www.dujinfang.com</a></div></div><div><br></div><div>Sent with <a href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div><div><br></div></div>
            </div></blockquote><blockquote type="cite"><div><span>_________________________________________________________________________</span><br><span>Professional FreeSWITCH Consulting Services:</span><br><span><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></span><br><span><a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></span><br><span></span><br><span>FreeSWITCH-powered IP PBX: The CudaTel Communication Server</span><br><span><a href="http://www.cudatel.com">http://www.cudatel.com</a></span><br><span></span><br><span>Official FreeSWITCH Sites</span><br><span><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></span><br><span><a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a></span><br><span><a href="http://www.cluecon.com">http://www.cluecon.com</a></span><br><span></span><br><span>FreeSWITCH-dev mailing list</span><br><span><a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a></span><br><span><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a></span><br><span>UNSUBSCRIBE:http://<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev">lists.freeswitch.org/mailman/options/freeswitch-dev</a></span><br><span><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></span><br></div></blockquote></body></html>