Noob custom dialplan dial external number

Sorry maybe a really nooby question but i’m trying to learn how the dial() dialplan function works. Below I am trying to test if I call extension “1” it will dial out to my external cell phone number. When I dial extension “1” on a softphone no action is taken and the call just seems to hang until a timeout is reached. What am I doing that’s stupid here? In dial i’ve passed SIP, my trunk name which is configured correctly, and the number I want to dial (my cell phone). I’ve been able to get other basic commands to work like Playback, SayDigits, etc.

[from-internal-custom]
include = dial-my-number

[dial-my-number]
exten = 1,1,Answer
same = n,Dial(SIP/my_trunk_name/1234567890)

I assume that you had
[from-internal-custom]
include => dial-my-number

[dial-my-number]
exten => 1,1,Answer()
same => n,Dial(SIP/my_trunk_name/1234567890)
[/quote]

Otherwise, I have no idea what is wrong in your case, but bypassing all the ‘machinery’ of FreePBX can cause many issues (number format, prefix, caller ID, required headers, etc.)

You might try Dial(Local/1234567890@outbound-allroutes) instead of specifying the trunk explicitly.

If you still have trouble, viewing the Asterisk log may show you what’s wrong. To include a SIP trace, type
sip set debug on
at the Asterisk console prompt, then make a test call.

There are many ways to route to external numbers without custom dialplan.

  1. Create a Custom Extension with the Dial parameter set to Local/1234567890@outbound-allroutes
  2. Create a Ring Group with 1234567890# as a member, possibly the only one.
  3. Forward an extension to 1234567890.
  4. Set up Follow Me on an extension with 1234567890# as a member.
  5. Set up a Misc Destination with the Dial field set to 1234567890.
  6. Create a Speed Dial pointing to 1234567890.

These methods have different characteristics and are best suited for different purposes.

Thanks for your reply Stewart. Dialing using the local format you provided does work. I have tried turning the sip debug on like you suggested but it doesn’t seem to throw any errors due to the call hanging forever.

It might not make any sense to do this but if I change the Dial(SIP/my_trunk_name/###) to Dial(SIP/outgoing_trunk_name/###) it will throw the following -
Received response: “Forbidden” from “Ext 4000” sip:[email protected]:5160
Everyone is busy/congested at this time
Channel ‘SIP/4000-0000007a’ sent to invalid extension but no invalid handler: context,exten,priority=outbound-allroutes,1,2

But maybe that is expected since it needs the general trunk name instead of the outbound sip trunk name?

Edit: You do need to use the outbound trunk name :upside_down_face:. Got it working thanks again Stewart.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.