<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahad Khan</title>
    <description>The latest articles on DEV Community by Ahad Khan (@ahad_khan).</description>
    <link>https://dev.to/ahad_khan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3394502%2Fbd2fa543-6175-4016-8351-4ce61b4f10b2.jpg</url>
      <title>DEV Community: Ahad Khan</title>
      <link>https://dev.to/ahad_khan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahad_khan"/>
    <language>en</language>
    <item>
      <title>How to Build a SIP-to-OpenAI Voice Gateway in C#</title>
      <dc:creator>Ahad Khan</dc:creator>
      <pubDate>Wed, 11 Nov 2026 09:01:36 +0000</pubDate>
      <link>https://dev.to/ahad_khan/how-to-build-a-sip-to-openai-voice-gateway-in-c-4c03</link>
      <guid>https://dev.to/ahad_khan/how-to-build-a-sip-to-openai-voice-gateway-in-c-4c03</guid>
      <description>&lt;p&gt;If you already have a SIP phone system, you can give an AI voice agent its own extension. A caller dials the extension, speaks normally, and hears the OpenAI Realtime model’s reply on the same call.&lt;/p&gt;

&lt;p&gt;I’m affiliated with VaxVoIP, and this walkthrough uses our VaxVoIP SIP Call OpenAI SDK for Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the gateway does
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;SIP phone or PBX ↔ C# gateway ↔ OpenAI Realtime&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SIP sets up and ends the phone call, and RTP carries the audio. The SDK handles the SIP stack, bridges audio in both directions, and connects to OpenAI Realtime. You can build the gateway without writing WebRTC code or implementing a SIP stack.&lt;/p&gt;

&lt;p&gt;Your C# application decides which calls to accept, what instructions to give the voice agent, and which application functions the agent can use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it with the C# sample
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://youtu.be/AdeVdR6r7bQ" rel="noopener noreferrer"&gt;Watch the C# SIP-to-OpenAI gateway demo on YouTube&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the &lt;a href="https://www.vaxvoip.com/serveraisdk/SampleCode/cSharp.zip" rel="noopener noreferrer"&gt;C# sample project&lt;/a&gt;, extract it on Windows, and open the project in Visual Studio.&lt;/li&gt;
&lt;li&gt;Configure your OpenAI API key in the product-order demo. Load the key from an environment variable or a secret store to keep it out of source control.&lt;/li&gt;
&lt;li&gt;Run the sample, register a SIP softphone with the gateway, and dial &lt;strong&gt;101&lt;/strong&gt;. Ask the product-order agent whether it supports laptops and listen for the spoken reply.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After preparing the prompt, model, and tools, the sample’s incoming-call handler accepts the call with one SDK call.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AcceptCallSession&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;KeyOpenAI&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ModelPrompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"coral"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sample also shows how to connect the voice agent to your application data. When the caller asks about a product, the model can request a lookup. The C# application checks the product and returns the result so the model can answer the caller.&lt;/p&gt;

&lt;p&gt;Once the softphone test works, route a test extension from your PBX to the gateway. For an internal help desk, you could change the prompt and replace the product lookup with a function that retrieves support hours or checks ticket status.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.vaxvoip.com/agent-ai-sdk" rel="noopener noreferrer"&gt;VaxVoIP SIP Agent OpenAI SDK and documentation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What you can build
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;AI receptionists&lt;/strong&gt; that greet callers, find out what they need, and route them to the right person or department.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customer support agents&lt;/strong&gt; that answer common questions, check order or ticket status, and hand off to a human when needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Telemarketing agents&lt;/strong&gt; that call opted-in leads, ask qualifying questions, and book follow-up calls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart AI autodialers&lt;/strong&gt; that make reminder calls, return callbacks, run post-service surveys, and log call outcomes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart IVRs&lt;/strong&gt; that let callers explain what they need in their own words and route them to the right queue or self-service option.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Appointment booking agents&lt;/strong&gt; that check availability, book or reschedule appointments, and confirm the details over the phone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Order-taking agents&lt;/strong&gt; that check product availability, collect order details, and read them back for confirmation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multilingual voice agents&lt;/strong&gt; that answer questions in the caller’s preferred language and transfer calls when human help is needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Internal help desk agents&lt;/strong&gt; that check ticket status or gather the information needed to open a new ticket.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>csharp</category>
      <category>openai</category>
      <category>voip</category>
      <category>sip</category>
    </item>
    <item>
      <title>How I Trained My Own On-Premises Speech-to-Speech AI System (Fully Offline)</title>
      <dc:creator>Ahad Khan</dc:creator>
      <pubDate>Tue, 29 Jul 2025 12:35:27 +0000</pubDate>
      <link>https://dev.to/ahad_khan/how-i-trained-my-own-on-premises-speech-to-speech-ai-system-fully-offline-89c</link>
      <guid>https://dev.to/ahad_khan/how-i-trained-my-own-on-premises-speech-to-speech-ai-system-fully-offline-89c</guid>
      <description>&lt;p&gt;In this post, I’ll share how I trained and deployed a complete speech-to-speech AI pipeline that runs entirely offline, without any dependency on third-party cloud APIs.&lt;/p&gt;

&lt;p&gt;Using open-source models and GPU acceleration, I built a multilingual voice communication engine that can listen, understand, translate, and speak in real time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;The system captures live audio, detects speech, transcribes it, processes it through a local language model, translates it into another language, and finally speaks it back — all in milliseconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Here’s a summary of the steps:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Capture incoming voice audio in raw PCM format&lt;/li&gt;
&lt;li&gt;Detect voice activity and trim silence&lt;/li&gt;
&lt;li&gt;Transcribe speech using Whisper&lt;/li&gt;
&lt;li&gt;Generate intelligent responses using a fine-tuned LLaMA model&lt;/li&gt;
&lt;li&gt;Translate back to the original language using NLLB&lt;/li&gt;
&lt;li&gt;Convert the translated text to speech using MMS TTS&lt;/li&gt;
&lt;li&gt;Send the audio response back to the user in real time&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;p&gt;Language: CSharp, Python&lt;br&gt;
Audio Format: 16kHz, mono, 16-bit PCM&lt;br&gt;
Speech Recognition: Whisper (OpenAI)&lt;br&gt;
VAD: Silero VAD&lt;br&gt;
LLM: LLaMA 3.2B / 8B (fine-tuned)&lt;br&gt;
Translation: Meta NLLB-200 3.3B&lt;br&gt;
Text-to-Speech: MMS TTS (Facebook)&lt;br&gt;
Hardware: NVIDIA H200 GPU (Blackwell), also tested with H100&lt;/p&gt;

&lt;h2&gt;
  
  
  Pipeline Overview
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Audio Input&lt;/li&gt;
&lt;li&gt;Voice Activity Detection (Silero Model)&lt;/li&gt;
&lt;li&gt;Speech Recognition (Whisper)&lt;/li&gt;
&lt;li&gt;Language Model (LLaMA)&lt;/li&gt;
&lt;li&gt;Translation (NLLB)&lt;/li&gt;
&lt;li&gt;Text-to-Speech (MMS TTS)&lt;/li&gt;
&lt;li&gt;Audio Output&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Hardware Recommendations
&lt;/h2&gt;

&lt;p&gt;To achieve real-time performance, I recommend:&lt;/p&gt;

&lt;p&gt;Primary GPU: NVIDIA H200 (Blackwell, 141GB HBM3e)&lt;br&gt;
Alternative: NVIDIA H100 (80GB HBM3)&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s Next
&lt;/h2&gt;

&lt;p&gt;I’m currently extending this system to include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Language-based routing for SIP calls&lt;/li&gt;
&lt;li&gt;Real-time speaker sentiment detection&lt;/li&gt;
&lt;li&gt;WebRTC Integration for Website-Based AI Voice Agents&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To test and develop an AI-powered support agent, I connected the pipeline with our SIP Server by using SIP SDK to handle real-time RTP audio, enabling full duplex voice conversations between callers and the AI agent over standard VoIP calls.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.vaxvoip.com/webrtc-overview" rel="noopener noreferrer"&gt;WebRTC and SIP Integration for Web to VoIP Solutions&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.vaxvoip.com/agent-ai-sdk" rel="noopener noreferrer"&gt;VoIP Development with OpenAI SDK&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.vaxvoip.com/voipblog/speech-to-speech-ai-engine" rel="noopener noreferrer"&gt;Building a Speech-to-Speech AI Engine&lt;/a&gt;&lt;/p&gt;

</description>
      <category>voip</category>
      <category>sip</category>
      <category>ai</category>
      <category>gpu</category>
    </item>
    <item>
      <title>How I Integrated OpenAI with a SIP Server and Built a Multilingual Smart AI Agent for IP Telephony</title>
      <dc:creator>Ahad Khan</dc:creator>
      <pubDate>Mon, 28 Jul 2025 15:26:46 +0000</pubDate>
      <link>https://dev.to/ahad_khan/how-i-integrated-openai-with-a-sip-server-and-built-a-multilingual-smart-ai-agent-for-ip-telephony-5jl</link>
      <guid>https://dev.to/ahad_khan/how-i-integrated-openai-with-a-sip-server-and-built-a-multilingual-smart-ai-agent-for-ip-telephony-5jl</guid>
      <description>&lt;p&gt;In this post, I’ll share how I integrated &lt;a href="https://openai.com/" rel="noopener noreferrer"&gt;OpenAI’s real-time API&lt;/a&gt; with our SIP Server to create an intelligent voice agent capable of live transcription and AI-generated voice replies — all over a VoIP network.&lt;/p&gt;

&lt;p&gt;This project demonstrates how traditional SIP-based telephony can be enhanced using powerful AI services like GPT-4o, without needing to replace existing infrastructure.&lt;/p&gt;




&lt;h2&gt;
  
  
  What We Built
&lt;/h2&gt;

&lt;p&gt;Using &lt;a href="https://www.vaxvoip.com/multilingual-voice-agent-openai-voip" rel="noopener noreferrer"&gt;VoIP SIP SDK&lt;/a&gt;, I developed a multilingual AI voice agent for VoIP systems. It captures real-time SIP audio in PCM format, streams it to OpenAI’s speech-to-speech WebSocket API, and receives back AI-generated audio replies in real time.&lt;/p&gt;

&lt;p&gt;The system performs the following tasks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Captures live SIP call audio in raw PCM format
&lt;/li&gt;
&lt;li&gt;Streams the audio to OpenAI’s real-time speech-to-speech API via WebSocket
&lt;/li&gt;
&lt;li&gt;Receives the AI-generated audio response from OpenAI
&lt;/li&gt;
&lt;li&gt;Sends the synthesized audio back to the caller via RTP&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Language:&lt;/strong&gt; C#, VBNet
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VoIP SDK:&lt;/strong&gt; VoIP SIP Server SDK
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI Services:&lt;/strong&gt; OpenAI GPT-4o (realtime Speech-to-Speech APIs) &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audio Handling:&lt;/strong&gt; Named Pipes, PCM audio streaming
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How the Integration Works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Incoming SIP Call&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A SIP call is received on the server and accepted using SIP SDK.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audio Captured in Real Time&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The SDK provides access to the raw PCM audio stream from the RTP packets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Streaming to OpenAI WebSocket&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A client connects to OpenAI’s real-time speech-to-speech API and streams the PCM audio over WebSocket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AI-Generated Audio Response&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
OpenAI processes the audio, understands the intent, and returns an AI-generated audio reply.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audio Playback to Caller&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The received audio is injected directly into the SIP call as RTP media, allowing real-time AI voice interaction.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Real-World Use Cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Smart IVR Systems that answer customer queries&lt;/li&gt;
&lt;li&gt;AI-based call routing by understanding caller intent&lt;/li&gt;
&lt;li&gt;Language translation over SIP calls&lt;/li&gt;
&lt;li&gt;VoIP chatbots that feel human&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Related Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.vaxvoip.com/multilingual-voice-agent-openai-voip" rel="noopener noreferrer"&gt;Develop a Multilingual Conversational Agent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.vaxvoip.com/voipblog/voip-sip-sdk-guide" rel="noopener noreferrer"&gt;What is VoIP SIP SDK? A Complete Guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What’s Next
&lt;/h2&gt;

&lt;p&gt;We’re actively expanding this system to support:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Multilingual translation across real-time SIP calls
&lt;/li&gt;
&lt;li&gt;Emotion detection to adapt responses based on caller sentiment
&lt;/li&gt;
&lt;li&gt;Integration with WebRTC gateways to enable AI voice interaction for website visitors
&lt;/li&gt;
&lt;li&gt;Open-source plugins and developer tools for easier integration and customization&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you're working on a similar VoIP+AI project, or want to integrate OpenAI with your SIP platform, feel free to connect or ask questions below. I’d love to collaborate or share more details.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Tags:&lt;/em&gt;  &lt;/p&gt;

&lt;h1&gt;
  
  
  voip #openai #sip #ai
&lt;/h1&gt;

</description>
      <category>voip</category>
      <category>ai</category>
      <category>sip</category>
      <category>openai</category>
    </item>
  </channel>
</rss>
