Trunk Link to Draytek Vigor IP PBX2820


(Paul Hadley) #1

I have been setting up a trunk link to dial extensions on a Dreytek Vigor IP PBX2820.

Calls from the IP PBX2820 are working fine from a trunk on the IP PBX2820 to my FPBX 15.0

Calls from the FPBX 15.0 back to the IP PBX2820 are also fine so long as the extension answers.

However if the call is not answered the the IP PBX2820 sends a request for the FPBX 13.0 to forward the call to the “vmpbx” with the following showing in the logs.

Now forwarding PJSIP/207-00000358 to ‘Local/vmpbx@from-pstn’

My guess is that my FPBX 13.0 is rejecting that request as “vmpbx” doesn’t match a call pattern for the trunk.

If the request was a transfer to say “8500” instead of “vmpbx” then I would add “8500” to the outbound call pattern and the transfer would be completed but I can’t see a way to complete this when the request is “vmpbx”.

Would anyone have any thoughts on how I might resolve this and get “vmpbx” request sent through the trunk?


(Lorne Gaetz) #2

You can fix this with a bit of custom dialplan:

[from-pstn-custom]
exten => vmpbx,1,Noop(Entering user defined context from-pstn-custom in extensions_custom.conf)
exten => vmpbx,n,Hangup   ; modify to send call to wherever you want

General advice is to never (ever!) use the context from-pstn-custom, but this is one use case where it would be acceptable. You need to figure out what to do with these calls and modify the second line to suit. Note that the forwarding address is context from-pstn, so the FreePBX system is treating this forwarded call as and INBOUND call, meaning it will follow an inbound route. If you’re not careful, you could easily create an infinite loop here.


(Paul Hadley) #3

Thanks for the advice much appreciated.

Your custom dial I understand, I just need to modify “Hangup” on the second to whatever I want the action on my PBX to be.

I have looked at the logs when I make a call and can see a call [9281] from my extension (207 FPBX) to remote extension (175 PBX2820) and I understand it to the point where 175 is ringing and then times out the PBX2820 wants to transfer to Voice Mail [9282] and then on to line [9283] where the call is not accepted. At this point I have to admit I am a little confused, I thought that was my PBX refusing the call because it had no route although now I am wondering if its the remote PBX refusing the call?

How do I understand from the call log what action I need to insert into the customer dial plan to prevent the call failing and make it go through?

Any help you can offer as ever much appreciated.

9281[2021-01-16 00:21:56] VERBOSE[19305][C-000001f0] app_dial.c: PJSIP/00_Wedd_PBX_Out-0000039c is ringing

9282[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] app_dial.c: Now forwarding PJSIP/207-0000039b to ‘Local/vmpbx@from-pstn’ (thanks to PJSIP/00_Wedd_PBX_Out-0000039c)

9283[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] app_dial.c: Not accepting call completion offers from call-forward recipient Local/vmpbx@from-pstn-0000005f;1

9284[2021-01-16 00:22:05] VERBOSE[19382][C-000001f0] pbx.c: Executing [vmpbx@from-pstn:1] Set("Local/vmpbx@from-pstn-0000005f;2", "__FROM_DID=vmpbx") in new stack

9285[2021-01-16 00:22:05] VERBOSE[19382][C-000001f0] pbx.c: Executing [vmpbx@from-pstn:2] NoOp("Local/vmpbx@from-pstn-0000005f;2", "Received an unknown call with DID set to vmpbx") in new stack

9286[2021-01-16 00:22:05] VERBOSE[19382][C-000001f0] pbx.c: Executing [vmpbx@from-pstn:3] Goto("Local/vmpbx@from-pstn-0000005f;2", "s,a2") in new stack

9287[2021-01-16 00:22:05] VERBOSE[19382][C-000001f0] pbx_builtins.c: Goto (from-pstn,s,2)

9288[2021-01-16 00:22:05] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@from-pstn:2] Answer("Local/vmpbx@from-pstn-0000005f;2", "") in new stack

9289[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] app_dial.c: Local/vmpbx@from-pstn-0000005f;1 answered PJSIP/207-0000039b

9290[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] app_stack.c: Local/vmpbx@from-pstn-0000005f;1 Internal Gosub(sub-send-obroute-email,s,1(175,175,2,1610756515,(207) PH Nun Study,207)) start

9291[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@sub-send-obroute-email:1] GotoIf("Local/vmpbx@from-pstn-0000005f;1", "0?sendEmail") in new stack

9292[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@sub-send-obroute-email:2] NoOp("Local/vmpbx@from-pstn-0000005f;1", "email notifications disabled…exiting.") in new stack

9293[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@sub-send-obroute-email:3] Return("Local/vmpbx@from-pstn-0000005f;1", "") in new stack

9294[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] app_stack.c: Spawn extension (from-pstn, , 1) exited non-zero on ‘Local/vmpbx@from-pstn-0000005f;1’

9295[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] app_stack.c: Local/vmpbx@from-pstn-0000005f;1 Internal Gosub(sub-send-obroute-email,s,1(175,175,2,1610756515,(207) PH Nun Study,207)) complete GOSUB_RETVAL=

9296[2021-01-16 00:22:05] VERBOSE[19384][C-000001f0] bridge_channel.c: Channel Local/vmpbx@from-pstn-0000005f;1 joined ‘simple_bridge’ basic-bridge <8dfe3423-5be7-4706-83c1-5e0f8f3462ad>

9297[2021-01-16 00:22:05] VERBOSE[19305][C-000001f0] bridge_channel.c: Channel PJSIP/207-0000039b joined ‘simple_bridge’ basic-bridge <8dfe3423-5be7-4706-83c1-5e0f8f3462ad>

9298[2021-01-16 00:22:05] WARNING[19382][C-000001f0] chan_sip.c: This function can only be used on SIP channels.

9299[2021-01-16 00:22:05] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@from-pstn:3] Log("Local/vmpbx@from-pstn-0000005f;2", "WARNING,Friendly Scanner from ") in new stack

9300[2021-01-16 00:22:05] WARNING[19382][C-000001f0] Ext. s: Friendly Scanner from

9301[2021-01-16 00:22:05] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@from-pstn:4] Wait("Local/vmpbx@from-pstn-0000005f;2", "2") in new stack

9302[2021-01-16 00:22:07] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@from-pstn:5] Playback("Local/vmpbx@from-pstn-0000005f;2", "ss-noservice") in new stack

9303[2021-01-16 00:22:07] VERBOSE[19382][C-000001f0] file.c: <Local/vmpbx@from-pstn-0000005f;2> Playing ‘ss-noservice.g722’ (language ‘en’)

9304[2021-01-16 00:22:12] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@from-pstn:6] SayAlpha("Local/vmpbx@from-pstn-0000005f;2", "vmpbx") in new stack

9305[2021-01-16 00:22:12] VERBOSE[19382][C-000001f0] file.c: <Local/vmpbx@from-pstn-0000005f;2> Playing ‘letters/v.g722’ (language ‘en’)

9306[2021-01-16 00:22:13] VERBOSE[19382][C-000001f0] file.c: <Local/vmpbx@from-pstn-0000005f;2> Playing ‘letters/m.g722’ (language ‘en’)

9307[2021-01-16 00:22:13] VERBOSE[19382][C-000001f0] file.c: <Local/vmpbx@from-pstn-0000005f;2> Playing ‘letters/p.g722’ (language ‘en’)

9308[2021-01-16 00:22:14] VERBOSE[19382][C-000001f0] file.c: <Local/vmpbx@from-pstn-0000005f;2> Playing ‘letters/b.g722’ (language ‘en’)

9309[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] file.c: <Local/vmpbx@from-pstn-0000005f;2> Playing ‘letters/x.g722’ (language ‘en’)

9310[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@from-pstn:7] Hangup("Local/vmpbx@from-pstn-0000005f;2", "") in new stack

9311[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Spawn extension (from-pstn, s, 7) exited non-zero on ‘Local/vmpbx@from-pstn-0000005f;2’

9312[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Executing [h@from-pstn:1] Macro("Local/vmpbx@from-pstn-0000005f;2", "hangupcall,") in new stack

9313[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@macro-hangupcall:1] GotoIf("Local/vmpbx@from-pstn-0000005f;2", "1?theend") in new stack

9314[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx_builtins.c: Goto (macro-hangupcall,s,3)

9315[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@macro-hangupcall:3] ExecIf("Local/vmpbx@from-pstn-0000005f;2", "0?Set(CDR(recordingfile)=)") in new stack

9316[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@macro-hangupcall:4] NoOp("Local/vmpbx@from-pstn-0000005f;2", " montior file= ") in new stack

9317[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@macro-hangupcall:5] GotoIf("Local/vmpbx@from-pstn-0000005f;2", "1?skipagi") in new stack

9318[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx_builtins.c: Goto (macro-hangupcall,s,7)

9319[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Executing [s@macro-hangupcall:7] Hangup("Local/vmpbx@from-pstn-0000005f;2", "") in new stack

9320[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] app_macro.c: Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘Local/vmpbx@from-pstn-0000005f;2’ in macro ‘hangupcall’

9321[2021-01-16 00:22:15] VERBOSE[19382][C-000001f0] pbx.c: Spawn extension (from-pstn, h, 1) exited non-zero on ‘Local/vmpbx@from-pstn-0000005f;2’

9322[2021-01-16 00:22:15] VERBOSE[19384][C-000001f0] bridge_channel.c: Channel Local/vmpbx@from-pstn-0000005f;1 left ‘simple_bridge’ basic-bridge <8dfe3423-5be7-4706-83c1-5e0f8f3462ad>

9323[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] bridge_channel.c: Channel PJSIP/207-0000039b left ‘simple_bridge’ basic-bridge <8dfe3423-5be7-4706-83c1-5e0f8f3462ad>

9324[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] app_macro.c: Spawn extension (macro-dialout-trunk, s, 44) exited non-zero on ‘PJSIP/207-0000039b’ in macro ‘dialout-trunk’

9325[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Spawn extension (from-internal, 175, 12) exited non-zero on ‘PJSIP/207-0000039b’

9326[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [h@from-internal:1] Macro("PJSIP/207-0000039b", "hangupcall") in new stack

9327[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@macro-hangupcall:1] GotoIf("PJSIP/207-0000039b", "1?theend") in new stack

9328[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx_builtins.c: Goto (macro-hangupcall,s,3)

9329[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@macro-hangupcall:3] ExecIf("PJSIP/207-0000039b", "0?Set(CDR(recordingfile)=)") in new stack

9330[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@macro-hangupcall:4] NoOp("PJSIP/207-0000039b", "Local/vmpbx@from-pstn-0000005f;1 montior file= ") in new stack

9331[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@macro-hangupcall:5] GotoIf("PJSIP/207-0000039b", "1?skipagi") in new stack

9332[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx_builtins.c: Goto (macro-hangupcall,s,7)

9333[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@macro-hangupcall:7] Hangup("PJSIP/207-0000039b", "") in new stack

9334[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] app_macro.c: Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘PJSIP/207-0000039b’ in macro ‘hangupcall’

9335[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Spawn extension (from-internal, h, 1) exited non-zero on ‘PJSIP/207-0000039b’

9336[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] app_stack.c: PJSIP/207-0000039b Internal Gosub(crm-hangup,s,1) start

9337[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@crm-hangup:1] NoOp("PJSIP/207-0000039b", "Sending Hangup to CRM") in new stack

9338[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@crm-hangup:2] NoOp("PJSIP/207-0000039b", "HANGUP CAUSE: 16") in new stack

9339[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@crm-hangup:3] ExecIf("PJSIP/207-0000039b", "0?Set(__CRM_VOICEMAIL=)") in new stack

9340[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@crm-hangup:4] NoOp("PJSIP/207-0000039b", "MASTER CHANNEL: 1610756515.1175 = 1610756515.1175") in new stack

9341[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@crm-hangup:5] GotoIf("PJSIP/207-0000039b", "0?return") in new stack

9342[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@crm-hangup:6] Set("PJSIP/207-0000039b", "__CRM_HANGUP=1") in new stack

9343[2021-01-16 00:22:15] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@crm-hangup:7] AGI("PJSIP/207-0000039b", "agi://127.0.0.1/sangomacrm.agi") in new stack

9344[2021-01-16 00:22:16] VERBOSE[19305][C-000001f0] res_agi.c: <PJSIP/207-0000039b>AGI Script agi://127.0.0.1/sangomacrm.agi completed, returning 0

9345[2021-01-16 00:22:16] VERBOSE[19305][C-000001f0] pbx.c: Executing [s@crm-hangup:8] Return("PJSIP/207-0000039b", "") in new stack

9346[2021-01-16 00:22:16] VERBOSE[19305][C-000001f0] app_stack.c: Spawn extension (from-internal, h, 1) exited non-zero on ‘PJSIP/207-0000039b’

9347[2021-01-16 00:22:16] VERBOSE[19305][C-000001f0] app_stack.c: PJSIP/207-0000039b Internal Gosub(crm-hangup,s,1) complete GOSUB_RETVAL=


(Paul Hadley) #4

Is there a sensible reference document (ideally with examples) nof the options I can apply to line, I am afraid I am very new to setting up outside the FPBX GUI?


(Lorne Gaetz) #5

The dialplan provided above is Asterisk diaplan, so any resource explaining Asterisk will point you in the right direction. Or you can describe what you want to happen and we can try to assist.


(Paul Hadley) #6

Thanks for your help and advice again. Did some testing and some googling and came to understand from your previous advice

[from-pstn-custom]
exten => vmpbx,1,Noop(Entering user defined context from-pstn-custom in extensions_custom.conf)
exten => vmpbx,n,Hangup ; modify to send call to wherever you want

that if I added an entry like this

[from-pstn-custom]
exten => vmpbx,1,Noop(Entering user defined context from-pstn-custom in extensions_custom.conf)
exten => vmpbx,n,Dial([SIP/vmpbx@weddington.xxx.xxx:5070,50,tr]

When I got the failure my PBX dialled back but the caller was presented (from the IP PBX2820) with an offer to select an extension to call, this then called the extension and also allowed voice mail to work.

So I worked towards a solution of

FPBX user calls PBX2820 extension (170) number, >
FPBX calls [vmpbx@weddington.xxx.xxx:5070] >
Call establishes, >
Call pauses, >
FPBX sends request for called extension (170) and then >
PBX2820 processes the call to the extension and voice mail as required.

Removing the FPBX Outbound Rules and just using this I was working on something like this

[from-pstn-custom]
exten => 170,1,Noop(Entering user defined context from-pstn-custom in extensions_custom.conf)
exten => 170,n,Dial([SIP/vmpbx@weddington.xxx.xxx:5070,50,tr]
exten => 170,n,wait(3)
exten => 170,n,SendDTMF(170)

With a possible modification to include a range of 17X extensions on the remote PBX
and a variable to the SendDTMF(17?)to reflect the extension selected but couldn’t
seem to get it go through. However while trying to research SendDTMF function I came across
this simple solution`

exten => n,Dial (SIP/97,60,D(ww1234))

So I went with this entry and got a result.

[fom-internal-custom]
exten => 170,1,Dial(SIP/vmpbx@weddington.xxx.xxx:5070,50,D(ww170))

to cover the range of extensions (10) on the PBX2820 I just added additional lines

[from-internal-custom]
exten => 170,1,Dial(SIP/vmpbx@weddington.xxx.xxx:5070,50,D(ww170))
exten => 171,1,Dial(SIP/vmpbx@weddington.xxx.xxx:5070,50,D(ww171))
exten => 172,1,Dial(SIP/vmpbx@weddington.xxx.xxx:5070,50,D(ww172))

So with a bit of luck, some google research and your much appreciated advice I
have a working solution. I am sure there is a more eloquent way to write this, but for
me this is fine.

Again, thanks for your help.


(Lorne Gaetz) #7

Can be done with a single line.

[from-internal-custom]
exten => _17X,1,Dial(SIP/vmpbx@weddington.xxx.xxx:5070,50,D(ww${EXTEN}))

(Paul Hadley) #8

I knew there would be, my inexperience certainly shows. Again thanks for your help (and patience).


(Paul Hadley) #9

Just out of interest, is there a way to limit the information in {EXTEN} so that a user could dial 9170 but only pass the 170 to the external PBX?


(Lorne Gaetz) #10
[from-internal-custom]
exten => _917X,1,Dial(SIP/vmpbx@weddington.xxx.xxx:5070,50,D(ww${EXTEN:1}))

(Paul Hadley) #11

Your are clever, I have much to learn !! Thanks for that.