Seeking Assistance with Simultaneous Dialing of Two Numbers Using Custom Dialplan on Freepbx

Hello FreePBX community,

I am seeking assistance with setting up a custom dialplan in FreePBX/Asterisk to achieve simultaneous dialing of two phone numbers by dialing a single extension. My current setup is FreePBX with Asterisk and I have been able to make and receive individual phone calls successfully, but I am experiencing difficulty configuring a custom dialplan to call two numbers at the same time.

My goal is to create a custom dialplan where I dial the extension “7878” and have the system call two phone numbers simultaneously. I have tried different methods to achieve this, such as creating a custom context, using local channels, and even generating call files to initiate the calls. Unfortunately, none of the methods have worked so far. I consistently receive a busy signal and no response when trying to use the custom dialplan.

Current Configuration:
Two custom extensions - ‘881’ and ‘882’ - have been created, each one intended to dial a unique external number via specific outbound routes. The dial setting for each extension is in line with its outbound route: ‘Local/908XXXXXXXXX@outbound-allroutes’ for extension 881 and ‘Local/918XXXXXXXXX@outbound-allroutes’ for extension 882, where ‘8XXXXXXXXX’ are the actual external phone numbers.

These extensions are not set up on any softphone or application; they are designed solely to make outbound calls to the specified external numbers as part of the custom dialplan.

A custom Ring Group (‘7878’) has also been set up with these two extensions (881 and 882) included in the Extension List.

Here is the latest configuration I have tried in the extensions_custom.conf file:

[custom-multiple-call]
exten => 7878,1,Verbose(2,Starting custom multiple call)
; Check if the calling user is allowed to use this custom extension
exten => 7878,n,GotoIf($["${CALLERID(num)}" != "MY-EXTENSION"]?hangup)
same => n,Dial(PJSIP/908XXXXXXXXX@provider&PJSIP/918XXXXXXXXX@provider,30)
same => n,Hangup()

; Hangup if the user is not allowed
exten => 7878,n(hangup),Hangup()

exten => 7878,n,Hangup()

[custom-group]
exten => _90NXXNXXXXXX,1,Verbose(2,Calling group)
exten => _90NXXNXXXXXX,n,Dial(PJSIP/${EXTEN}@provider,5)
exten => _90NXXNXXXXXX,n,Hangup()

[from-internal-custom] 
include => custom-multiple-call

Despite reloading the dialplan and core, the issue persists. I also tried the call file method, but it didn’t work either.

I have provided all the necessary information regarding my setup and the steps I’ve taken so far. I am seeking guidance from the community on how to resolve this issue and accomplish my goal of simultaneous dialing of two phone numbers using a custom dialplan.

Please let me know if you need any additional information or if you have any suggestions for a solution.

Additional Information:

The “provider” in the Dial command refers to the PJSIP trunk configured for our VoIP provider. It is used to send the call over the specified trunk to the destination phone number.

We have attempted multiple methods to resolve the issue, including checking the Asterisk logs with various log levels and searching for specific SIP messages such as “SIP INVITE”, “SIP ACK”, “SIP CANCEL”, “SIP BYE”, “SIP REGISTER”, and “SIP NOTIFY”. However, none of these messages were present in the logs.

The logs were configured to capture as much information as possible by increasing the verbosity and debug levels.

We also tried the call file method by creating call files in the /var/spool/asterisk/outgoing directory with the necessary information to initiate the calls. Despite verifying the file permissions and ensuring Asterisk had the capability to execute external scripts, this method did not yield the desired result.

In the custom dialplan, the extension “MY-EXTENSION” represents the allowed user who can access and use the custom dialplan for making simultaneous calls. It serves as a security measure to limit access to the functionality.

It is important to note that our current configuration allows for making and receiving individual phone calls without any issues. The problem arises only when trying to dial two phone numbers simultaneously. Even when we modified the custom dialplan to dial only one number, we still encountered the same issue with a busy signal and no response.

I’ve conducted extensive troubleshooting, even inspecting my NAT settings, network configuration, and ensuring that the firewall is not causing the problem, all to no avail.

I’m seeking your valuable insights and suggestions to address this issue. Any input towards helping me configure a custom dialplan for dialing two numbers simultaneously will be greatly appreciated.

Please provide a call trace with PJSIP logging enabled via pastebin.

TLDR but kinda of sounds like you might need ‘find me follow me’ set on a custom virtual extension.

1 Like

Per your request, I have enabled PJSIP logging and initiated a call attempt, subsequently capturing the output in the Asterisk log. I have shared this via Pastebin to help illustrate the challenges we are facing with the dialplan setup in Asterisk.

Here is the link to the Pastebin: 7878 - Pastebin.com

Please kindly review the log and let me know if you spot any anomalies or issues that might be contributing to the problem. Your expertise and guidance in this matter are highly appreciated.

[your account now has permissions to post links - mod]

Thank you for your suggestion. We did indeed explore the possibility of using the Find Me/Follow Me feature on a custom virtual extension to achieve simultaneous dialing to external numbers.

We set up two virtual extensions and configured Find Me/Follow Me to dial the desired external numbers. We then added these extensions to a ring group and attempted to dial the ring group from an internal extension.

However, this approach was unsuccessful. When attempting to dial the virtual extensions directly or through the ring group, we received a busy signal, and no calls were made to the external numbers.

It’s worth noting that our FreePBX setup appears to be functioning correctly in other respects. We have been able to make and receive calls using standard PJSIP extensions, and there are no apparent issues with our trunk configuration or network connectivity.

I appreciate your time and willingness to assist with this issue. If you have any further suggestions or insights, I would be grateful to hear them.

This should work, we use custom extensions to call external only numbers. Are you suffixing a # to the end of the number to denote that it is external. So in the FMFM list you’d put something like 5555555555#.

I agree the custom extension is the simpler approach.

Logs and proof of proper implementation needed

Thank you for your input, it’s very appreciated. Indeed, we have tried the approach with custom extensions to call external numbers, and we did use the ‘#’ suffix at the end of the number in the Find Me/Follow Me (FMFM) list to denote it’s an external number. Despite implementing this approach, we have unfortunately not been able to successfully establish the calls as intended.

Our current setup involves two custom extensions (881 and 882), each associated with an external number. We’ve set up the dialplan to call both extensions simultaneously when dialing a specific number (7878). The call is supposed to be routed to two different external phone numbers.

I wholeheartedly agree that the custom extension approach seems to be the simplest and most straightforward. Yet, despite our efforts and your valuable input, the issue remains unresolved. If you have any additional suggestions or insights, they would be greatly appreciated.

In addition to the logs shared via Pastebin (An error occurred: Sorry, new users can’t put links in posts.) pastebin . com / rK2aJwXH

I’m providing:

Dialplan configurations, including the custom dialplan we’ve implemented, again:

[custom-multiple-call]
exten => 7878,1,Verbose(2,Starting custom multiple call)
; Check if the calling user is allowed to use this custom extension
exten => 7878,n,GotoIf($["${CALLERID(num)}" != "MY-EXTENSION"]?hangup)
same => n,Dial(PJSIP/90PHONE#1@provider&PJSIP/91PHONE#2@provider,30)
same => n,Hangup()

; Hangup if the user is not allowed
exten => 7878,n(hangup),Hangup()

exten => 7878,n,Hangup()

Trunk configurations, showing how we’ve set up our SIP provider connection:
we . tl / t-Eh5pMfdEXz

Extension configurations, illustrating the details of the extensions created for this purpose.
we . tl / t-qG9hQUhOHT

Ring group and Outbound routes configurations:
we . tl / t-0QVHX39NdX

Due to privacy and security considerations, I have redacted certain sensitive details. If there’s any additional information you would find useful, please let me know.

Thank you for your continued support.

Wow, you have set up something quite complicated, IMO needlessly.

This is a problem, because the 90 and 91 prefixes are stripped by Outbound Routes, but dialing the trunk directly is bypassing those routes. However, it’s not the only problem because nothing got sent to the provider.

Please take a backup, so you can easily put all this stuff back in, in case it turns out to be needed.
Then, take out the custom dialplan, special extensions, and Ring Group.
As a first start, create a Ring Group with:
Ring-Group Number: 7878
Extension List:
8XXXXXXXXX#
8YYYYYYYYY#
Ring Strategy: ringall
Ring Time: 40

Test this. I believe it should call the two numbers, play fake ringback tone until one answers, and connect you to the first to answer. If it doesn’t work, paste a new log, including pjsip logger. When pasting, please leave Paste Expiration at Never (the default), so future visitors to this thread can follow along.

If it works, there are two problems: it’s accessible to all users, and it’s not customizing the caller IDs. Change the Extension List to:
908XXXXXXXXX#
918YYYYYYYYY#
and test again. If it now fails, paste a new log.

You can paste links in pre-formatted text, like this: https://pastebin.com/rK2aJwXH

I looked through your logs, first of all, why is everything duplicate?

Then, you have the following:


[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] pbx.c: Executing [7878@from-internal:1] Verbose("PJSIP/MY-EXTENSION-00000083", "2,Starting custom multiple call") in new stack
[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] app_verbose.c: Starting custom multiple call
[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] pbx.c: Executing [7878@from-internal:2] GotoIf("PJSIP/MY-EXTENSION-00000083", "0?hangup") in new stack
[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] pbx.c: Executing [7878@from-internal:3] Progress("PJSIP/MY-EXTENSION-00000083", "") in new stack
[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] pbx.c: Executing [7878@from-internal:4] Hangup("PJSIP/MY-EXTENSION-00000083", "") in new stack

Your dial extension is missing.

Try
exten => 7878,n,GotoIf($["${AMPUSER}" != "MY-EXTENSION"]?hangup

But IMO you should get rid of the custom dialplan.

Thank you for your response and suggestions. I appreciate your patience and time invested in this matter.

As per your advice, I attempted to set up a ring group for dialing the external numbers directly. I followed the suggested format and confirmed with our provider that such a setup is feasible.

However, upon dialing the ring group number (7878), I received a “no response” message. Here is the log output from the Asterisk CLI upon trying to execute the call: https://pastebin.com/zV8kvrca

And this is the related log entry I found in /var/log/asterisk/full: https://pastebin.com/tt0Vfd9r

Also, I have attached a screenshot of the ring group settings for your reference. here: https://we.tl/t-pIQni6G9eo

Given these steps and the output, it seems we might be missing something or there could be an issue we have not yet identified. Any further insights or suggestions you could provide would be immensely appreciated.

Thank you for your suggestion. I have updated the custom dialplan as per your advice. The line exten => 7878,n,GotoIf($["${AMPUSER}" != "MY-EXTENSION"]?hangup has been implemented.

Moreover, I have updated the extensions_custom.conf to reflect these changes as well. Here is the updated configuration:

[custom-multiple-call]
exten => 7878,1,Verbose(2,Starting custom multiple call)

; Check if the calling user is allowed to use this custom extension
same => n,GotoIf($["${AMPUSER}" != "MY-EXTENSION"]?hangup)

; Dial both numbers simultaneously
same => n,Dial(PJSIP/90PHONE#1@provider&91PHONE#2@provider,40)

same => n,Hangup()

; Hangup if the user is not allowed
same => n(hangup),Hangup()

same => n,Hangup()

[from-internal-custom]
include => custom-multiple-call

Despite these adjustments, we still seem to be experiencing the same issue. We’re open to further suggestions and advice to resolve this issue.

Best Regards,

Your first log shows this test failing. So does the second.

Thank you for your observations. I understand your concern about the complexity of the setup, and the questions you raised regarding the issues with the call processing.

Let’s address your points:

  1. The duplicate logs issue is a consequence of the verbosity level set in Asterisk, where higher levels will log more detailed information. This is expected behavior and shouldn’t impact the function of the dialplan.

  2. As for the missing Dial application in the log you posted, it appears the system went directly from the GotoIf application to the Hangup application, which suggests that the condition in GotoIf was met and the execution was transferred to the hangup context.

  3. Regarding the “${AMPUSER}” variable, it’s used here to check the extension of the calling party and limit the usage of the custom context to “MY-EXTENSION” only. The GotoIf application checks this condition and if the AMPUSER is not “MY-EXTENSION”, the dialplan jumps to the Hangup context.

I noticed that in the logs you posted, the GotoIf condition was met (as the output was 1), which suggests that AMPUSER was not equal to “MY-EXTENSION”. This might be the reason why the Dial application didn’t execute.

To address this, I have updated the dialplan in the extensions_custom.conf file and reloaded the Asterisk dialplan to ensure that changes take effect immediately. The new output from AMPUSER is as follows:

-- Executing [7878@from-internal:3] GotoIf("PJSIP/MY-EXTENSION-00000092", "1?hangup") in new stack
-- Goto (from-internal,7878,6)
-- Executing [7878@from-internal:6] Hangup("PJSIP/MY-EXTENSION-00000092", "") in new stack

As it can be seen, the AMPUSER is matching “MY-EXTENSION” and therefore the execution is correctly jumping to the hangup context, which shows the condition in GotoIf application is working as expected.

I appreciate your support and patience as we troubleshoot this issue. Let’s keep the communication open to further understand and resolve this issue.

Best regards,

Line 6 has:
-- Executing [7878@from-internal:1] Verbose("PJSIP/MY-EXTENTION-0000008a", "2,Starting custom multiple call") in new stack

which shows that your custom dialplan is still in place. It is taking precedence over the Ring Group you created. Please delete that, Apply Config (or otherwise reload Asterisk) and retest.

Sounds like ChatGPT crap. Increasing verbosity does not result in duplicate lines.

Again incorrect, as you can see below, it processed all lines in an order.

[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] pbx.c: Executing [7878@from-internal:1] Verbose("PJSIP/MY-EXTENSION-00000083", "2,Starting custom multiple call") in new stack
[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] app_verbose.c: Starting custom multiple call
[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] pbx.c: Executing [7878@from-internal:2] GotoIf("PJSIP/MY-EXTENSION-00000083", "0?hangup") in new stack
[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] pbx.c: Executing [7878@from-internal:3] Progress("PJSIP/MY-EXTENSION-00000083", "") in new stack
[2023-05-30 19:38:29] VERBOSE[4959][C-00000040] pbx.c: Executing [7878@from-internal:4] Hangup("PJSIP/MY-EXTENSION-00000083", "") in new stack.

Thank you for your patience. Based on your previous comment, we’ve made some changes to our custom dialplan in extensions_custom.conf and also did some troubleshooting to understand why the AMPUSER variable isn’t being populated.

Here is the current state of our extensions_custom.conf:

[custom-multiple-call]
exten => 7878,1,Verbose(2,Starting custom multiple call)

; Check if the calling user is allowed to use this custom extension
same => n,NoOp(The AMPUSER variable is: ${AMPUSER})
same => n,GotoIf($["${AMPUSER}" != "MY-EXTENSION"]?hangup)

; Dial both numbers simultaneously
same => n,Dial(PJSIP/90PHONE#1@provider&91PHONE#2@provider,40)

same => n,Hangup()

; Hangup if the user is not allowed
same => n(hangup),Hangup()

same => n,Hangup()

[from-internal-custom]
include => custom-multiple-call

We added a NoOp line to display the value of AMPUSER in the logs for debugging. Based on our observation, it seems that AMPUSER isn’t being populated, and thus the GotoIf condition always evaluates to true and the call is directed to the hangup extension.

Here’s a snippet from our log:

Setting global variable 'SIPDOMAIN' to 'PRIVATE_IP'
...
Executing [7878@from-internal:1] Verbose("PJSIP/MY-EXTENSION-00000094", "2,Starting custom multiple call") in new stack
...
Executing [7878@from-internal:2] NoOp("PJSIP/MY-EXTENSION-00000094", "The AMPUSER variable is: ") in new stack
Executing [7878@from-internal:3] GotoIf("PJSIP/MY-EXTENSION-00000094", "1?hangup") in new stack
...

As you can see, the AMPUSER variable is not populated, and thus the call gets hung up.

At this point, we are trying to understand why AMPUSER is not getting set as expected. If you have any suggestions or insights, we would greatly appreciate your input.

AFAIK, the AMPUSER variable is set later on in the dialplan.