Call Scripts to Bring Your Preferred AI Voice Provider Into 3CX

KyriacosS_3CX

Staff member
Joined
May 8, 2025
Messages
2,408
Reaction score
2,033

Choose OpenAI, Gemini or Grok and run the conversation where the call already lives.​

3CX now has ready-made call script samples for OpenAI Realtime, Google Gemini Live and xAI Grok, giving system admins more choice over the AI provider behind their voice agent. Bring your preferred provider into existing 3CX call flows while ke...
Continue reading the Original Blog Post.
 
Last edited by a moderator:
Yes! This is great. Definitely leading the industry with this type of open integration. Very powerful for full Ai voice agents.
 
For those trying Gemini, I recommend Gemini 3.8 Live which has been released a few weeks ago and works much better than Gemini 3.1 Flash Live Preview, which is used by default:
https://blog.google/innovation-and-...i-3-8-live-gemini-3-8-live-extended-thinking/
With the update 10 today I have been testing some Gemini Live call scripts using the 3.8 live model. Working good. Question, when I was testing direct in Google Ai Studio it has 3 tools; function calling, automatic function response, and grounding with Google Search. I know I can attach a custom function to hit our Gemini knowledge, but was wondering if can use the grounding with google search directly with the 3cx call script? I am looking at it and testing myself as well. Thanks.
 
For those trying Gemini, I recommend Gemini 3.8 Live which has been released a few weeks ago and works much better than Gemini 3.1 Flash Live Preview, which is used by default:
https://blog.google/innovation-and-...i-3-8-live-gemini-3-8-live-extended-thinking/
In testing. Not sure if just iPhone speakerphone. I have my call script; testing without speakerphone, opening prompt plays once as it should. If I have speakerphone on it plays twice. If I mute microphone with speakerphone on it plays once. But I am not really in an echo room. Not sure how speakerphone is triggering the prompt to play twice fully. Odd one. Have you seen this?
 
The Google grounding, that should be "addable" easily, but the model as I understand it is somewhat flexible on when it uses it, and this element should be part of the prompt (up to here I am talking from experience).
Now, the below is not tested, and is ChatGPT's opinion but within a framework setup to assist with creating AI backed Call Flow scripts:

You can enable Google Search grounding in every Gemini API call, but enabling it does not force Gemini to search. Google explicitly says the model still decides whether to use it. Google documentation

For a generateContent REST request, add:

"tools": [
{ "google_search": {} }
]
That makes search available. An instruction such as “Always search Google before answering” encourages its use but isn’t a hard guarantee. The function-calling ANY setting is documented for forcing function calls; it should not be treated as a guaranteed switch for built-in Google Search grounding. Grounding documentation, function-calling documentation

To enforce this in your application, enable search, explicitly request it, then check the returned groundingMetadata—including webSearchQueries, groundingChunks, and groundingSupports. Reject or retry responses that lack the grounding evidence you require. This guarantees your application only accepts grounded responses, though a retry may still fail to produce one. Response metadata
 
  • Like
Reactions: UCMUserAZ
The iPhone speakerphone issue, if you share a simple script that we can test on other installs, perhaps it can be traced? It's not something I heard before about.
 
  • Like
Reactions: UCMUserAZ
The Google grounding, that should be "addable" easily, but the model as I understand it is somewhat flexible on when it uses it, and this element should be part of the prompt (up to here I am talking from experience).
Now, the below is not tested, and is ChatGPT's opinion but within a framework setup to assist with creating AI backed Call Flow scripts:

You can enable Google Search grounding in every Gemini API call, but enabling it does not force Gemini to search. Google explicitly says the model still decides whether to use it. Google documentation

For a generateContent REST request, add:

"tools": [
{ "google_search": {} }
]
That makes search available. An instruction such as “Always search Google before answering” encourages its use but isn’t a hard guarantee. The function-calling ANY setting is documented for forcing function calls; it should not be treated as a guaranteed switch for built-in Google Search grounding. Grounding documentation, function-calling documentation

To enforce this in your application, enable search, explicitly request it, then check the returned groundingMetadata—including webSearchQueries, groundingChunks, and groundingSupports. Reject or retry responses that lack the grounding evidence you require. This guarantees your application only accepts grounded responses, though a retry may still fail to produce one. Response metadata
will test this out and report back results. Thanks for the insight.
 
  • Like
Reactions: KyriacosS_3CX
The iPhone speakerphone issue, if you share a simple script that we can test on other installs, perhaps it can be traced? It's not something I heard before about.
figured out issue. Gemini Live prompts are real picky I am learning. Some tweaks to the prompting and it is not repeating anymore. I had originally had in the prompt to handle customer interruptions. On speaker it must pickup noise and Gemini thinks it is a customer interruption. Also, i am doing this with 3.8 live. Thanks.
 
  • Like
Reactions: KyriacosS_3CX
The Google grounding, that should be "addable" easily, but the model as I understand it is somewhat flexible on when it uses it, and this element should be part of the prompt (up to here I am talking from experience).
Now, the below is not tested, and is ChatGPT's opinion but within a framework setup to assist with creating AI backed Call Flow scripts:

You can enable Google Search grounding in every Gemini API call, but enabling it does not force Gemini to search. Google explicitly says the model still decides whether to use it. Google documentation

For a generateContent REST request, add:

"tools": [
{ "google_search": {} }
]
That makes search available. An instruction such as “Always search Google before answering” encourages its use but isn’t a hard guarantee. The function-calling ANY setting is documented for forcing function calls; it should not be treated as a guaranteed switch for built-in Google Search grounding. Grounding documentation, function-calling documentation

To enforce this in your application, enable search, explicitly request it, then check the returned groundingMetadata—including webSearchQueries, groundingChunks, and groundingSupports. Reject or retry responses that lack the grounding evidence you require. This guarantees your application only accepts grounded responses, though a retry may still fail to produce one. Response metadata
in testing..i found registering a function RegisterGoogleSearchTool() and then using the google_Search tool within a c# function works good. and the grounded search works great. This is great stuff. And 3cx integrates seamlessly with all the audio. I have not looked yet, but can we enable recording these calls as well inside 3cx if it never hits a live person? I am working on transfers from the script to a department or external number right now, but will look into recording and reporting next. Thanks in advance.
 
  • Like
Reactions: KyriacosS_3CX
The Google grounding, that should be "addable" easily, but the model as I understand it is somewhat flexible on when it uses it, and this element should be part of the prompt (up to here I am talking from experience).
Now, the below is not tested, and is ChatGPT's opinion but within a framework setup to assist with creating AI backed Call Flow scripts:

You can enable Google Search grounding in every Gemini API call, but enabling it does not force Gemini to search. Google explicitly says the model still decides whether to use it. Google documentation

For a generateContent REST request, add:

"tools": [
{ "google_search": {} }
]
That makes search available. An instruction such as “Always search Google before answering” encourages its use but isn’t a hard guarantee. The function-calling ANY setting is documented for forcing function calls; it should not be treated as a guaranteed switch for built-in Google Search grounding. Grounding documentation, function-calling documentation

To enforce this in your application, enable search, explicitly request it, then check the returned groundingMetadata—including webSearchQueries, groundingChunks, and groundingSupports. Reject or retry responses that lack the grounding evidence you require. This guarantees your application only accepts grounded responses, though a retry may still fail to produce one. Response metadata
dynamic transfers are working perfect. Another transfer_call function registration. Caller id is preserved on the transfer, which is good. Audio good. Moving along to next. At some point I will setup some functions to query some backend systems. But all working great! For reference, using what KyriascosS mentioned above for Gemini Live. We are familiar with the Gemini ecosystem so staying within that environment for now. Thanks.
 
The Google grounding, that should be "addable" easily, but the model as I understand it is somewhat flexible on when it uses it, and this element should be part of the prompt (up to here I am talking from experience).
Now, the below is not tested, and is ChatGPT's opinion but within a framework setup to assist with creating AI backed Call Flow scripts:

You can enable Google Search grounding in every Gemini API call, but enabling it does not force Gemini to search. Google explicitly says the model still decides whether to use it. Google documentation

For a generateContent REST request, add:

"tools": [
{ "google_search": {} }
]
That makes search available. An instruction such as “Always search Google before answering” encourages its use but isn’t a hard guarantee. The function-calling ANY setting is documented for forcing function calls; it should not be treated as a guaranteed switch for built-in Google Search grounding. Grounding documentation, function-calling documentation

To enforce this in your application, enable search, explicitly request it, then check the returned groundingMetadata—including webSearchQueries, groundingChunks, and groundingSupports. Reject or retry responses that lack the grounding evidence you require. This guarantees your application only accepts grounded responses, though a retry may still fail to produce one. Response metadata
Added in a texting function within the call script. So the gemini live has access to text customer information as needed in the conversation. Works great.
 

Forum statistics

Threads
112,535
Messages
593,087
Members
165,747
Latest member
Hugh_Wilson