\r
switch_status_t FSMediaStream::write_frame(const switch_frame_t *frame, switch_io_flag_t flags)\r
{\r
+ RTP_DataFrame rtp;\r
+\r
if (!switch_channel_ready(m_fsChannel)) {\r
return SWITCH_STATUS_FALSE;\r
}\r
m_callOnStart = false;\r
}\r
\r
+ if ((frame->flags & SFF_CNG)) {\r
+ return SWITCH_STATUS_SUCCESS;\r
+ }\r
+\r
if ((frame->flags & SFF_RAW_RTP) != 0) {\r
RTP_DataFrame rtp((const BYTE *) frame->packet, frame->packetlen, false);\r
- if (GetPatch()->PushFrame(rtp))\r
- return SWITCH_STATUS_SUCCESS;\r
- } else if (frame->flags == 0) {\r
- RTP_DataFrame rtp;\r
- rtp.SetPayloadType(mediaFormat.GetPayloadType());\r
- rtp.SetPayloadSize(frame->datalen);\r
- rtp.SetTimestamp(frame->timestamp);\r
- rtp.SetSyncSource(frame->ssrc);\r
- rtp.SetMarker(frame->m);\r
- memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);\r
- if (GetPatch()->PushFrame(rtp))\r
+ if (GetPatch()->PushFrame(rtp)) {\r
return SWITCH_STATUS_SUCCESS;\r
+ }\r
+ } \r
+ \r
+ /* If we reach this code it means a call to an ivr or something else that does not generate timestamps\r
+ Its possible that frame->timestamp is set but not guarenteed and is best ignored for the time being.\r
+ We are probably relying on the rtp stack to generate the timestamp and ssrc for us at this point.\r
+ As a quick hack I am going to keep a sample counter and increment it by frame->samples but it would be \r
+ better if we could engage whatever it is in opal that makes it generate the timestamp.\r
+ */\r
+\r
+ rtp.SetPayloadType(mediaFormat.GetPayloadType());\r
+ rtp.SetPayloadSize(frame->datalen);\r
+\r
+ m_timeStamp += frame->samples;\r
+ rtp.SetTimestamp(m_timeStamp);\r
+ \r
+ //rtp.SetTimestamp(frame->timestamp);\r
+ //rtp.SetSyncSource(frame->ssrc);\r
+ //rtp.SetMarker(frame->m);\r
+\r
+ memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);\r
+\r
+ if (GetPatch()->PushFrame(rtp)) {\r
+ return SWITCH_STATUS_SUCCESS;\r
}\r
\r
+\r
return SWITCH_STATUS_FALSE;\r
}\r
\r