Call processing script to divert to a DN when calling 9

Gilles (Transacom)

Gold Partner
Advanced Certified
Joined
Dec 24, 2020
Messages
45
Reaction score
42
Hi,

Is there an example call processing script that shows how to divert to a DN (for exemple ring group 8101) when an extension dials 9?
Trying to create this script for a hotel configuration where rooms dial 9 to reach the reception.

Thanks,
Gilles
 
Another option is: use a dummy extension, have all incoming internal calls forwarded to the call group 8101, give the extension the SIP ID 9 and activate direct SIP calls ( Admin / System / Options / Allow Direct SIP calling).
 
  • Like
Reactions: Evolute IT
Or:
C#:
#nullable disable
using CallFlow;
using System;
using System.IO;
using System.Threading.Tasks;

namespace dummy
{
    public class RouteTo8101: ScriptBase<RouteTo8101>
    {
        // process incoming call
        public override async Task<bool> StartAsync()
        {
            await MyCall.AssureMedia().ContinueWith(
                    x=>{
                        return MyCall.RouteTo("8101", null, 60);
                       }
                        ).Unwrap();
            return true;
        }
    }
}
 
  • Like
Reactions: Gilles (Transacom)
Or write a new CFD App with only one transfer (to 8101) block, build it, expand the zip, copy the much larger .cs file content and save it as a new call processing script.
 
There are definitely other options. Another thing that comes to mind is changing the route/dial plan on the phone using a template.
 
Or:
C#:
#nullable disable
using CallFlow;
using System;
using System.IO;
using System.Threading.Tasks;

namespace dummy
{
    public class RouteTo8101: ScriptBase<RouteTo8101>
    {
        // process incoming call
        public override async Task<bool> StartAsync()
        {
            await MyCall.AssureMedia().ContinueWith(
                    x=>{
                        return MyCall.RouteTo("8101", null, 60);
                       }
                        ).Unwrap();
            return true;
        }
    }
}
Thanks !
 
But this works everytime everywhere. Is that really what you want?
 
But this works everytime everywhere. Is that really what you want?
Well, since I am creating a call processing script that runs "When a user dials a code" with dial code 9, it works just fine!
The final script will be a bit more complex because the effective destination will depend on the department from which it was dialed.
 
The final script will be a bit more complex because the effective destination will depend on the department from which it was dialed.
I would do and expect something like that too :)
 
  • Like
Reactions: Gilles (Transacom)
I just tried this on V18. Dial codes must start with an asterisk ( * ). While that is not a significant requirement, I will mention that you can make single-digit extensions (9 for example) using the 3CX Call Control API. We have been doing this for years without issue.
 
  • Like
Reactions: fxbastler
I just tried this on V18. Dial codes must start with an asterisk ( * ).
Yes, that's right, nice to know. But that wasn't the question ;) It's a v20.
 
  • Like
Reactions: Evolute IT

Forum statistics

Threads
111,954
Messages
589,923
Members
164,852
Latest member
priya