3CX automatic change of numbers weekly

I'm not sure to understand the use case. Do you have incoming calls that need to have this menu with 5 options and then transfer the call to 5 different mobile numbers depending on the selected option? Or you need to make calls to these 5 numbers every Saturday automatically? In this case, what do you need to do with these calls? Play a prompt and drop it?
 
  • Like
Reactions: Evolute IT
I realize this is a self-serving comment. For that I apologize, but let us be pragmatic for a minute. Building a custom solution from scratch is financially impractical. I am not saying it cannot be done, it absolutely can. But unless you work for free, you have already consumed more of our time, and yours, discussing how to create a solution than it would cost to implement a commercial solution.

The rule of thumb should always be, if I can get a commercial tool that meets my needs, comes with 24/7 support, has a track record of maintaining compatibility with new versions of 3CX, and the cost is comparable to, or less than, anything I can build myself, logic should say go with the commercial tool.

You said "the customer does not want to incur additional license or software costs". Unless you plan on spending countless hours building, testing, updating, and managing future compatibility changes for free, this does not make business sense to me. As a business owner myself, you would have to come up with an extremely strong business case to go with a custom solution if there is a better commercial option available for a better price.

You do not owe me or anyone else (other than the customer) an explanation for why custom is the only option. But I hope you are being realistic about the investment you are going to need to make to implement this project, now, and going forward. The labor and on-going support numbers will never make sense.
 
I'm not sure to understand the use case. Do you have incoming calls that need to have this menu with 5 options and then transfer the call to 5 different mobile numbers depending on the selected option? Or you need to make calls to these 5 numbers every Saturday automatically? In this case, what do you need to do with these calls? Play a prompt and drop it?
Hi, there's an IVR with 5 options, each option connected to a queue containing an extension with an associated mobile phone. These people rotate through the service, and the mobile phone number change must be done on Saturday night when no operator is physically present in the company. Therefore, on Saturday at 11:30 PM, Option 1 associated with queue 1 containing extension 1 must be switched from operator A's mobile phone to operator B's mobile phone.


I found this solution. What do you think? The CFD changes the selected numbers. The operator must remember to change the mobile phone number in the global settings during the week. OK, operator prerequisite.

I Find

https://www.pjsip.org/pjsip/docs/html/page_pjsip_samples_pjsua.htm

C#:
$PjsuaPath = "C:\Tools\PJSIP\pjsua.exe"

$Arguments = @(
"--id", "sip:[email protected]",
"--registrar", "sip:pbx.local",
"--realm", "*",
"--username", "998",
"--password", "SUPERPASSWORD",
"--max-calls", "1",
"--duration", "20",
"sip:[email protected]"
)

Write-Host "Starting SIP trigger..." -ForegroundColor Cyan

$process = Start-Process `
    -FilePath $PjsuaPath `
    -ArgumentList $Arguments `
    -NoNewWindow `
    -Wait `
    -PassThru

if ($process.ExitCode -eq 0) {
    Write-Host "SIP call completed successfully." -ForegroundColor Green
}
else {
    Write-Host "SIP call FAILED with exit code $($process.ExitCode)" -ForegroundColor Red
    exit 1
}

This PowerShell script can run on any client/server connected at that time as a scheduled operation. Obviously, a secure extension (no external calls, etc.) must be created for the script.

What do you think?

Thnak You
 
What do you think?
Yes, pjsua is a good optio. You just have to build it yourself. If it’s sufficient for you to start the call from a remote Windows computer, there are also SIP clients that can be launched via the command line with parameters and thus automated.

We use almost exclusively Debian 3CX. In the past, we built sipcmd (or rather a slightly modified version of it) on another PC, then copied it to the 3CX and ran it there via a cron job.

If you have a Windows-based 3CX, you can also take advantage of the integrated PowerShell. For example:
https://www.3cx.de/forum/threads/automatischer-statuswechsel-problem.121456/post-439013
I’ve heard that there are still people today who run PowerShell on the 3CX for such tasks. You just have to uninstall it before major upgrades - like from v18 to v20 - and then reinstall it afterward.
 
PJSip is distributed as source code. This means you have to compile the source into an executable. If your 3CX is running on Linux, you also have to use a C++ compiler to create an additional dependent component. More fun. Once you have successfully compiled the executable for your platform, and you have debugged the scripts, and you have figured out the correct authentication parameters (not obvious), then you can use a Windows scheduled task or chron job to schedule execution. But, assuming you get that working reliably, then you still have the real weak-point in your solution -- relying on humans to ALWAYS remember, once a week, to change the schedule. I will defer to your wisdom to determine if this is the "best" path for your customer, and you.
 
Hi everyone, I found a solution that I'm posting simply because it might be useful to others. It's certainly not the most suitable, but it works. I created a fake trunk based on an IP address containing the IP address of the machine running the script. At this point, I set the Call Flow Designer created as the default destination for the trunk. I created the following code in C# dotnetwork core 10 and scheduled the program to run via task scheduler at the desired time. If I used an extension, I had problems with registration.


C#:
using System;
using System.Net;
using System.Collections.Generic;
using System.Threading.Tasks;
using SIPSorcery.Net;
using SIPSorcery.SIP;
using SIPSorcery.SIP.App;
using SIPSorcery.Media;

Console.WriteLine("=== TRUNK CALL TEST ===");

// PBX
string pbxIp = "Enter Ip Address 3CX PBX";
int pbxPort = "Enter Sip Port 5060";

// TRANSPORT
var sipTransport = new SIPTransport();
sipTransport.EnableTraceLogs();

sipTransport.AddSIPChannel(
    new SIPUDPChannel(new IPEndPoint(IPAddress.Any, 0)));

var userAgent = new SIPUserAgent(sipTransport, null);


var mediaSession = new VoIPMediaSession();



string fromUri = "sip:[email protected]";



string dstUri = $"sip:99999@{pbxIp}:{pbxPort}";

var callDescriptor = new SIPCallDescriptor(
    null,   // username
    null,   // password
    dstUri,
    fromUri,
    dstUri,
    null,
    new List<string>(),
    null,
    SIPCallDirection.Out,
    null,
    null,
    null
);

Console.WriteLine("Sending INVITE to trunk...");

bool ok = await userAgent.Call(dstUri, null, null, mediaSession);

Console.WriteLine($"CALL RESULT: {ok}");

await Task.Delay(30000);

sipTransport.Shutdown();
Console.WriteLine("DONE");
 

Members Online Now

No members online now.

Forum statistics

Threads
111,834
Messages
589,287
Members
164,662
Latest member
DejanMDS