ClearlyIP’s Tips and Tricks
For those of you who love to use the terminal when it comes to debugging Asterisk issues, today we will talk about one helpful command.
When we are working remotely on an Asterisk/FreePBX environment, sometimes we would like to test things, but what happens when nobody is at the remote location? How can we test, for example, if the PBX can dial out? Or how can we have a sense of the call quality or replicate any NAT issue?
For this we can take advantage of Asterisk Command Line using the following command:
channel originate Local/XXXXXXXXXX@from-internal extension *43@from-internal
Let’s Break Down This Command Into Its Parts:
- channel originate
This will create a new channel inside Asterisk and connect it to a dialplan extension or a specific application.
In this case, we are dialing within Asterisk into the Asterisk dialplan. With this Asterisk will dial XXXXXXXXXX (which is our destination number, for example, our cell number). It will start searching for any dialing pattern in the from-internal context. In this case, if there is a pattern for a 10-digit number, Asterisk will dial out to this number using the associated trunk
- extension *43@from-internal
With this, the channel originate command will connect the originated channel when dialing our cell number to extension *43@from-internal. *43@from-internal is the default feature code for the echo test function.
Here’s An Example Showing How to Run the Command:
*CLI> channel originate Local/19203833100@from-internal extension *43@from-internal
Since FreePBX dialplan is standard in terms of contexts and functions, we can assume our command will dial our cell phone and send that call to the echo test feature, and with this, we can check if our PBX can dial out and detect any NAT issue with the echo test.
Finally, you can modify this command to dial an internal extension instead of the echo test feature.