Replies: 3 comments
-
The PipeTo extension methods in that project currently work with RTCPeerConnection instances which are specific to WebRTC. The RTCPeerConnection inherits from RTPSession which works with SIP. There's not a big leap to add a PipeTo method for RTPSession and wire up SIP. It's an interesting idea and I'll see if I can come up with a demo in the next little while. |
Beta Was this translation helpful? Give feedback.
-
@sipsorcery Have a Successful call from OpenAI Realtime. Thanks for help: public static class RTPSessionExtensions
{
public static void PipeAudioTo(this RTPSession source, RTPSession destination)
{
source.OnRtpPacketReceived += (ep, media, rtpPacket) =>
{
if (media == SDPMediaTypesEnum.audio && !destination.IsClosed)
{
destination.SendAudio((uint)rtpPacket.Payload.Length, rtpPacket.Payload);
}
};
}
public static void PipeAudioTo(this IMediaSession source, RTPSession destination)
{
if (source is not RTPSession {} rtp)
{
throw new InvalidOperationException();
}
rtp.PipeAudioTo(destination);
}
public static void PipeAudioTo(this RTPSession source, IMediaSession destination)
{
if (destination is not RTPSession {} rtp)
{
throw new InvalidOperationException();
}
source.PipeAudioTo(rtp);
}
} // connect to SIP
// add openAI
_openAiSession.OnPeerConnectionConnected += () =>
{
_openAiSession.PeerConnection.Do(x =>
{
x.PipeAudioTo(_sipSession);
_sipSession.PipeAudioTo(x);
});
var responseResult = _openAiSession.DataChannelMessenger.SendResponseCreate(
RealtimeVoicesEnum.alloy,
"Hi from the openAI!");
}; |
Beta Was this translation helpful? Give feedback.
-
Example now available here. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I need call from OpenAI Realtime API to the user phone and start conversation. I saw Sipcorcery OpenAI package have a pipes, but I didn't figure out how it works
Beta Was this translation helpful? Give feedback.
All reactions