Forward Incoming Calls to an external number

Hi there,

Im using Freepbx with PBX Firmware: 6.12.65-32.

So im stuck in a problem for a long time, if i call my trunk from an external number and then use misc dest. or fallow me to forward calls to an external number the call fail or use another trunk to call the external number.

so in this case i have set up a trunk that works and incoming calls -> Set Destination on my extension , with fallow me configure if after 5 initial rings i dont answer , calls will be forwarded to my external number. In this case system uses another trunk and then calls me with that trunk number, it does not just forward the call how it works in mobile phones.

i also used ring group with misc destination but the same the system use another trunk to call me not just to forward the calls.

is there anything i can do to make this happent.

Talk to you itsp. You are probably sending an invalid number when forwarding the call. It works via an extension because that is treated as a normal outbound call

044xxxxxx calls 038xxxxxx after this i have used fallow me, misc destin., features code to enable call forward *72, to forward to another external number in this case my phone 044xxxxxx.

normal outbound call just type 044xxxxxx and i can make the call.

so exp. 044222222 calls 038321321 and then system uses another trunk 038222333 and calls the misc dest. 044111222.
and then 044222222 can talk with 044111222.

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [[email protected]:1] Set(“SIP/VALA-BUCAJ-000024af”, “GROUP()=OUT_9”) in new stack
– Executing [[email protected]:2] Goto(“SIP/VALA-BUCAJ-000024af”, “from-trunk,+38138606806,1”) in new stack
– Goto (from-trunk,+38138606806,1)
– Executing [[email protected]:1] Set(“SIP/VALA-BUCAJ-000024af”, “__DIRECTION=INBOUND”) in new stack
– Executing [[email protected]:2] Gosub(“SIP/VALA-BUCAJ-000024af”, “sub-record-check,s,1(in,+38138606806,dontcare)”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?initialized”) in new stack
– Executing [[email protected]:2] Set(“SIP/VALA-BUCAJ-000024af”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [[email protected]:3] Set(“SIP/VALA-BUCAJ-000024af”, “NOW=1485257311”) in new stack
– Executing [[email protected]:4] Set(“SIP/VALA-BUCAJ-000024af”, “__DAY=24”) in new stack
– Executing [[email protected]:5] Set(“SIP/VALA-BUCAJ-000024af”, “__MONTH=01”) in new stack
– Executing [[email protected]:6] Set(“SIP/VALA-BUCAJ-000024af”, “__YEAR=2017”) in new stack
– Executing [[email protected]:7] Set(“SIP/VALA-BUCAJ-000024af”, “__TIMESTR=20170124-122831”) in new stack
– Executing [[email protected]:8] Set(“SIP/VALA-BUCAJ-000024af”, “__FROMEXTEN=unknown”) in new stack
– Executing [[email protected]:9] Set(“SIP/VALA-BUCAJ-000024af”, “__MON_FMT=wav”) in new stack
– Executing [[email protected]:10] NoOp(“SIP/VALA-BUCAJ-000024af”, “Recordings initialized”) in new stack
– Executing [[email protected]:11] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [[email protected]:12] Set(“SIP/VALA-BUCAJ-000024af”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [[email protected]:13] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [[email protected]:14] GotoIf(“SIP/VALA-BUCAJ-000024af”, “2?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [[email protected]:17] GotoIf(“SIP/VALA-BUCAJ-000024af”, “1?sub-record-check,in,1”) in new stack
– Goto (sub-record-check,in,1)
– Executing [[email protected]:1] NoOp(“SIP/VALA-BUCAJ-000024af”, “Inbound Recording Check to +38138606806”) in new stack
– Executing [[email protected]:2] Set(“SIP/VALA-BUCAJ-000024af”, “FROMEXTEN=unknown”) in new stack
– Executing [[email protected]:3] ExecIf(“SIP/VALA-BUCAJ-000024af”, “9?Set(FROMEXTEN=049785250)”) in new stack
– Executing [[email protected]:4] Gosub(“SIP/VALA-BUCAJ-000024af”, “recordcheck,1(dontcare,in,+38138606806)”) in new stack
– Executing [[email protected]:1] NoOp(“SIP/VALA-BUCAJ-000024af”, “Starting recording check against dontcare”) in new stack
– Executing [[email protected]:2] Goto(“SIP/VALA-BUCAJ-000024af”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [[email protected]:3] Return(“SIP/VALA-BUCAJ-000024af”, “”) in new stack
– Executing [[email protected]:5] Return(“SIP/VALA-BUCAJ-000024af”, “”) in new stack
– Executing [[email protected]:3] Gosub(“SIP/VALA-BUCAJ-000024af”, “app-blacklist-check,s,1()”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?blacklisted”) in new stack
– Executing [[email protected]:2] Set(“SIP/VALA-BUCAJ-000024af”, “CALLED_BLACKLIST=1”) in new stack
– Executing [[email protected]:3] Return(“SIP/VALA-BUCAJ-000024af”, “”) in new stack
– Executing [[email protected]:4] Set(“SIP/VALA-BUCAJ-000024af”, “__FROM_DID=+38138606806”) in new stack
– Executing [[email protected]:5] Set(“SIP/VALA-BUCAJ-000024af”, “CDR(did)=+38138606806”) in new stack
– Executing [[email protected]:6] ExecIf(“SIP/VALA-BUCAJ-000024af”, “1 ?Set(CALLERID(name)=049785250)”) in new stack
– Executing [[email protected]:7] Set(“SIP/VALA-BUCAJ-000024af”, “CHANNEL(musicclass)=default”) in new stack
– Executing [[email protected]:8] Set(“SIP/VALA-BUCAJ-000024af”, “__MOHCLASS=default”) in new stack
[2017-01-24 12:28:31] WARNING[13435][C-0000563f]: func_channel.c:538 func_channel_read: Unknown or unavailable item requested: ‘reversecharge’
– Executing [[email protected]:9] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?macro-hangupcall”) in new stack
– Executing [[email protected]:10] Set(“SIP/VALA-BUCAJ-000024af”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
– Executing [[email protected]:11] Set(“SIP/VALA-BUCAJ-000024af”, “CALLERPRES()=allowed_not_screened”) in new stack
– Executing [[email protected]:12] Goto(“SIP/VALA-BUCAJ-000024af”, “ext-miscdests,1,1”) in new stack
– Goto (ext-miscdests,1,1)
– Executing [[email protected]:1] NoOp(“SIP/VALA-BUCAJ-000024af”, “MiscDest: Florian Cell Phone”) in new stack
– Executing [[email protected]:2] Goto(“SIP/VALA-BUCAJ-000024af”, “from-internal,049944508,1”) in new stack
– Goto (from-internal,049944508,1)
– Executing [[email protected]:1] Macro(“SIP/VALA-BUCAJ-000024af”, “user-callerid,LIMIT,EXTERNAL,”) in new stack
– Executing [[email protected]:1] Set(“SIP/VALA-BUCAJ-000024af”, “TOUCH_MONITOR=1485257311.44415”) in new stack
– Executing [[email protected]:2] Set(“SIP/VALA-BUCAJ-000024af”, “AMPUSER=049785250”) in new stack
– Executing [[email protected]:3] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?report”) in new stack
– Executing [[email protected]:4] ExecIf(“SIP/VALA-BUCAJ-000024af”, “1?Set(REALCALLERIDNUM=049785250)”) in new stack
– Executing [[email protected]:5] Set(“SIP/VALA-BUCAJ-000024af”, “AMPUSER=”) in new stack
– Executing [[email protected]:6] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?limit”) in new stack
– Executing [[email protected]:7] Set(“SIP/VALA-BUCAJ-000024af”, “AMPUSERCIDNAME=”) in new stack
– Executing [[email protected]:8] GotoIf(“SIP/VALA-BUCAJ-000024af”, “1?report”) in new stack
– Goto (macro-user-callerid,s,16)
– Executing [[email protected]:16] GotoIf(“SIP/VALA-BUCAJ-000024af”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,30)
– Executing [[email protected]:30] Set(“SIP/VALA-BUCAJ-000024af”, “CALLERID(number)=049785250”) in new stack
– Executing [[email protected]:31] Set(“SIP/VALA-BUCAJ-000024af”, “CALLERID(name)=049785250”) in new stack
– Executing [[email protected]:32] Set(“SIP/VALA-BUCAJ-000024af”, “CDR(cnum)=049785250”) in new stack
– Executing [[email protected]:33] Set(“SIP/VALA-BUCAJ-000024af”, “CDR(cnam)=049785250”) in new stack
– Executing [[email protected]:34] Set(“SIP/VALA-BUCAJ-000024af”, “CHANNEL(language)=en”) in new stack
– Executing [[email protected]:2] Gosub(“SIP/VALA-BUCAJ-000024af”, “sub-record-check,s,1(out,049944508,dontcare)”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/VALA-BUCAJ-000024af”, “9?initialized”) in new stack
– Goto (sub-record-check,s,10)
– Executing [[email protected]:10] NoOp(“SIP/VALA-BUCAJ-000024af”, “Recordings initialized”) in new stack
– Executing [[email protected]:11] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [[email protected]:12] Set(“SIP/VALA-BUCAJ-000024af”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [[email protected]:13] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [[email protected]:14] GotoIf(“SIP/VALA-BUCAJ-000024af”, “3?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [[email protected]:17] GotoIf(“SIP/VALA-BUCAJ-000024af”, “1?sub-record-check,out,1”) in new stack
– Goto (sub-record-check,out,1)
– Executing [[email protected]:1] NoOp(“SIP/VALA-BUCAJ-000024af”, “Outbound Recording Check from 049785250 to 049944508”) in new stack
– Executing [[email protected]:2] Set(“SIP/VALA-BUCAJ-000024af”, “RECMODE=”) in new stack
– Executing [[email protected]:3] ExecIf(“SIP/VALA-BUCAJ-000024af”, “1?Goto(routewins)”) in new stack
– Goto (sub-record-check,out,7)
– Executing [[email protected]:7] Gosub(“SIP/VALA-BUCAJ-000024af”, “recordcheck,1(dontcare,out,049944508)”) in new stack
– Executing [[email protected]:1] NoOp(“SIP/VALA-BUCAJ-000024af”, “Starting recording check against dontcare”) in new stack
– Executing [[email protected]:2] Goto(“SIP/VALA-BUCAJ-000024af”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [[email protected]:3] Return(“SIP/VALA-BUCAJ-000024af”, “”) in new stack
– Executing [[email protected]:8] Return(“SIP/VALA-BUCAJ-000024af”, “”) in new stack
– Executing [[email protected]:3] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0 ?Set(CDR(accountcode)=)”) in new stack
– Executing [[email protected]:4] Set(“SIP/VALA-BUCAJ-000024af”, “MOHCLASS=default”) in new stack
– Executing [[email protected]:5] Set(“SIP/VALA-BUCAJ-000024af”, “_NODEST=”) in new stack
– Executing [[email protected]:6] Macro(“SIP/VALA-BUCAJ-000024af”, “dialout-trunk,9,049944508,off”) in new stack
– Executing [[email protected]:1] Set(“SIP/VALA-BUCAJ-000024af”, “DIAL_TRUNK=9”) in new stack
– Executing [[email protected]:2] GosubIf(“SIP/VALA-BUCAJ-000024af”, “0?sub-pincheck,s,1()”) in new stack
– Executing [[email protected]:3] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?disabletrunk,1”) in new stack
– Executing [[email protected]:4] Set(“SIP/VALA-BUCAJ-000024af”, “DIAL_NUMBER=049944508”) in new stack
– Executing [[email protected]:5] Set(“SIP/VALA-BUCAJ-000024af”, “DIAL_TRUNK_OPTIONS=Ttr”) in new stack
– Executing [[email protected]:6] Set(“SIP/VALA-BUCAJ-000024af”, “OUTBOUND_GROUP=OUT_9”) in new stack
– Executing [[email protected]:7] GotoIf(“SIP/VALA-BUCAJ-000024af”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [[email protected]:9] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?skipoutcid”) in new stack
– Executing [[email protected]:10] Set(“SIP/VALA-BUCAJ-000024af”, “DIAL_TRUNK_OPTIONS=Tt”) in new stack
– Executing [[email protected]:11] Macro(“SIP/VALA-BUCAJ-000024af”, “outbound-callerid,9”) in new stack
– Executing [[email protected]:1] ExecIf(“SIP/VALA-BUCAJ-000024af”, “1?Set(CALLERPRES()=allowed_not_screened)”) in new stack
– Executing [[email protected]:2] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(REALCALLERIDNUM=049785250)”) in new stack
– Executing [[email protected]:3] GotoIf(“SIP/VALA-BUCAJ-000024af”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [[email protected]:6] Set(“SIP/VALA-BUCAJ-000024af”, “USEROUTCID=”) in new stack
– Executing [[email protected]:7] Set(“SIP/VALA-BUCAJ-000024af”, “EMERGENCYCID=”) in new stack
– Executing [[email protected]:8] Set(“SIP/VALA-BUCAJ-000024af”, “TRUNKOUTCID=”) in new stack
– Executing [[email protected]:9] GotoIf(“SIP/VALA-BUCAJ-000024af”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,14)
– Executing [[email protected]:14] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [[email protected]:15] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [[email protected]:16] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [[email protected]:17] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(CALLERPRES()=prohib_passed_screen)”) in new stack
– Executing [[email protected]:18] Set(“SIP/VALA-BUCAJ-000024af”, “CDR(outbound_cnum)=049785250”) in new stack
– Executing [[email protected]:19] Set(“SIP/VALA-BUCAJ-000024af”, “CDR(outbound_cnam)=049785250”) in new stack
– Executing [[email protected]:12] GosubIf(“SIP/VALA-BUCAJ-000024af”, “1?sub-flp-9,s,1()”) in new stack
– Executing [[email protected]:1] ExecIf(“SIP/VALA-BUCAJ-000024af”, “1?Return()”) in new stack
– Executing [[email protected]:13] Set(“SIP/VALA-BUCAJ-000024af”, “OUTNUM=049944508”) in new stack
– Executing [[email protected]:14] Set(“SIP/VALA-BUCAJ-000024af”, “custom=SIP/VALA-BUCAJ”) in new stack
– Executing [[email protected]:15] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)Tt)”) in new stack
– Executing [[email protected]:16] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(DIAL_TRUNK_OPTIONS=TtM(confirm))”) in new stack
– Executing [[email protected]:17] Macro(“SIP/VALA-BUCAJ-000024af”, “dialout-trunk-predial-hook,”) in new stack
– Executing [[email protected]:1] MacroExit(“SIP/VALA-BUCAJ-000024af”, “”) in new stack
– Executing [[email protected]:18] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?bypass,1”) in new stack
– Executing [[email protected]:19] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(CONNECTEDLINE(num,i)=049944508)”) in new stack
– Executing [[email protected]:20] ExecIf(“SIP/VALA-BUCAJ-000024af”, “0?Set(CONNECTEDLINE(name,i)=CID:049785250)”) in new stack
– Executing [[email protected]:21] GotoIf(“SIP/VALA-BUCAJ-000024af”, “0?customtrunk”) in new stack
– Executing [[email protected]:22] Dial(“SIP/VALA-BUCAJ-000024af”, “SIP/VALA-BUCAJ/049944508,300,Tt”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/VALA-BUCAJ/049944508
– SIP/VALA-BUCAJ-000024b0 is making progress passing it to SIP/VALA-BUCAJ-000024af
– SIP/VALA-BUCAJ-000024b0 is ringing
– SIP/VALA-BUCAJ-000024b0 is making progress passing it to SIP/VALA-BUCAJ-000024af
== Spawn extension (macro-dialout-trunk, s, 22) exited non-zero on ‘SIP/VALA-BUCAJ-000024af’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 049944508, 6) exited non-zero on ‘SIP/VALA-BUCAJ-000024af’
– Executing [[email protected]:1] Hangup(“SIP/VALA-BUCAJ-000024af”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/VALA-BUCAJ-000024af’

1 Like

update the dial plan on the trunk you want to use to have a prefix, say 9, then in the follow me you add that prefix to the beginning of the follow me number. set the dial plan to strip the prefix. this will force the follow me to use the trunk with the prefix.

okay i have set prefix 9 at trunk , and now how to strip the prefix and where , in outgoing calls ?

read the text in the trunk dialed number manipulation rules.

f the number matches the combined values in the prefix plus the match pattern boxes, the rule will be applied and all subsequent rules ignored.
Upon a match, the prefix, if defined, will be stripped.

in this case i will force to use that trunk that is called not the other trunk.

the problem still is the same cuz i dont want that to happent i just want the forward thing.

you are making this really hard. my guess as to why the forwarding is failing is that you are not sending a caller id that you provider recognizes. what i have suggested should fix.

.
this is my trunk and outgoing calls.

two things

  1. add an outbound cid if you don’t have one in the trunk.
  2. change the dial pattern - put the 9 in the prefix and delete what you have in the caller id. you should probably also add the appropriate dial patterns. if you are US based, then you want both the 10 and 11 digit pattern and if you allow 7 digit dialing add that pattern and in the prepend field add the local area code.

Extremely easy: Custom Destinations. I’m doing this in production right now.

Create a Custom Destination. If the number you want to forward to is 1-800-555-1212, your target attribute would be:

from-internal,8005551212,1

“from-internal” is the Asterisk context used by default in FreePBX to handle inbound calls. The next variable is the number you are forwarding to. Your SIP provider and outbound call rules may require you to prefix this with a 1 (if you’re in the US, Canada, or some of the Caribbean; adjust as appropriate for other regions). The next variable must be 1 so that it picks the first rule in the “from-internal” context

Then set this as the destination on your appropriate Inbound Routes and you’re calls are good to go (pun intended).

1 Like

Also done with Misc Destination.