Hi, my setup is verry simple, only 3 SIPextensions for home use…
I also have one cloud PBX, with 3 SIP extensions … if i want to call to those extensions, i use 1 extension as a trunk and then i call the other 2 left…
This was working perfect in FreePBX, but now i want to convert it to Asterisk … but cant figure it out
What i did in FreePBX:
reated 3 chan_sip extensions (local use), this is all working fine,…
Then created a chan_sip trunk , just outgoing is enough, dont need incoming…
This is what FreePBX created for the trunk in the sip files:
[64673-sip]
host=xxxx
username=64673
secret=xxx
type=peer
context=from-trunk-sip-64673-sip
My local extensions are 4 digits, the cloud extensions are 5 digits long…
So i created an outbound route in freePBX with pattern XXXXX
When i call from a local extension to another local ! Works
When i call from a local extension to another extension on cloud PBX, works!! it uses the above trunk
Below is what FreePBX created in extensions file, … I tried copying it to asterisk extensions file, but doesnt work
there is probably a lot of unneeded lines below…
How can i make a simple extensions file, that uses a dialplan like
When i call 4 digits, it needs to call to another local extension
When i call 5 digits, it needs to use that trunk that i specified in the sip.conf file
The trunk works, when i do a “Sip show peers” , i see it as state OK , the same as in freePBX
thnx for all the help!!
[globals]
OUT_2 = SIP/64673-sip
OUTCID_2 = 64673
[from-trunk-sip-64673-sip]
include => from-trunk-sip-64673-sip-custom
exten => _.,1,Set(GROUP()=OUT_2)
exten => _.,n,Goto(from-trunk,${EXTEN},1)
;--== end of [from-trunk-sip-64673-sip] ==--;
[ext-trunk]
include => ext-trunk-custom
exten => 2,1,Set(TDIAL_STRING=SIP/64673-sip)
exten => 2,n,Set(DIAL_TRUNK=2)
exten => 2,n,Goto(ext-trunk,tdial,1)
exten => tdial,1,Set(OUTBOUND_GROUP=OUT_${DIAL_TRUNK})
exten => tdial,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}" = ""]?nomax)
exten => tdial,n,GotoIf($[${GROUP_COUNT(OUT_${DIAL_TRUNK})} >= ${OUTMAXCHANS_${DIAL_TRUNK}}]?hangit)
exten => tdial,n(nomax),ExecIf($["${CALLINGNAMEPRES_SV}" != ""]?Set(CALLERPRES(name-pres)=${CALLINGNAMEPRES_SV}))
exten => tdial,n,ExecIf($["${CALLINGNUMPRES_SV}" != ""]?Set(CALLERPRES(num-pres)=${CALLINGNUMPRES_SV}))
exten => tdial,n,Set(DIAL_NUMBER=${FROM_DID})
exten => tdial,n,GosubIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]?sub-flp-${DIAL_TRUNK},s,1())
exten => tdial,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER})
exten => tdial,n,Set(DIAL_TRUNK_OPTIONS=${IF($["${DB_EXISTS(TRUNK/${DIAL_TRUNK}/dialopts)}" = "1"]?${DB_RESULT}:${TRUNK_OPTIONS})})
exten => tdial,n,Dial(${TDIAL_STRING}/${OUTNUM}${TDIAL_SUFFIX},${TRUNK_RING_TIMER},${DIAL_TRUNK_OPTIONS})
exten => tdial,n,Set(CALLERID(number)=${CALLERID(number):0:40})
exten => tdial,n,Set(CALLERID(name)=${CALLERID(name):0:40})
exten => tdial,n(hangit),Hangup
;--== end of [ext-trunk] ==--;
[outbound-allroutes]
include => outbound-allroutes-custom
include => outrt-2 ; 64673
exten => foo,1,Noop(bar)
;--== end of [outbound-allroutes] ==--;
[outrt-2] ; 64673
include => outrt-2-custom
exten => _XXXXX,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _XXXXX,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
exten => _XXXXX,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=${CALLEE_ACCOUNCODE}))
exten => _XXXXX,n,Set(_ROUTEID=2)
exten => _XXXXX,n,Set(_ROUTENAME=64673)
exten => _XXXXX,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _XXXXX,n,Set(_CALLERIDNAMEINTERNAL=${CALLERID(name)})
exten => _XXXXX,n,Set(_CALLERIDNUMINTERNAL=${CALLERID(num)})
exten => _XXXXX,n,Set(_EMAILNOTIFICATION=FALSE)
exten => _XXXXX,n,Set(_NODEST=)
exten => _XXXXX,n,Macro(dialout-trunk,2,${EXTEN},,off)
exten => _XXXXX,n,Macro(outisbusy,)
;--== end of [outrt-2] ==--;