Inbound route edit for extensions_additional.conf

we knew extensions_additional.conf is auto generated by freepbx,
i added a subroute for inbound route, when finished then restart freepbx.

Gosub(sub-send-notification,s,1)

[sub-send-notification] is wrote in extensions_custom.conf,
when i have new settings, then apply config, i need add this subroute for each one again, I have a few inbound routes, so add it serval times, and [fwconsole restart] to make it Taking effect
Is there any method to add it dynamically, please help me!

exten => s/_96110,1,ExecIf($["${FROM_DID}" = ""]?Set(__FROM_DID=${EXTEN}))
exten => s/_96110,n,Gosub(sub-record-check,s,1(in,${EXTEN},dontcare))
exten => s/_96110,n,Set(returnhere=1)
exten => s/_96110,n,Gosub(app-blacklist-check,s,1())
exten => s/_96110,n(did),Set(CDR(did)=${FROM_DID})
exten => s/_96110,n,GotoIf(${LEN(${BLDEST})}?${BLDEST})
exten => s/_96110,n(callerid),ExecIf($[ "${CALLERID(name)}" = "" ] ?Set(CALLERID(name)=${CALLERID(num)}))

exten => s/_96110,n,Gosub(sub-send-notification,s,1)

exten => s/_96110,n,Set(CHANNEL(musicclass)=thai)
exten => s/_96110,n,Set(__MOHCLASS=thai)
exten => s/_96110,n,Set(__REVERSAL_REJECT=FALSE)
exten => s/_96110,n,GotoIf($["${REVERSAL_REJECT}"!="TRUE"]?post-reverse-charge)
exten => s/_96110,n,GotoIf($["${CHANNEL(reversecharge)}"="1"]?macro-hangupcall)
exten => s/_96110,n(post-reverse-charge),Noop()
exten => s/_96110,n,Set(__CALLINGNAMEPRES_SV=${CALLERID(name-pres)})
exten => s/_96110,n,Set(__CALLINGNUMPRES_SV=${CALLERID(num-pres)})
exten => s/_96110,n,Set(CALLERID(name-pres)=allowed_not_screened)
exten => s/_96110,n,Set(CALLERID(num-pres)=allowed_not_screened)
exten => s/_96110,n(did-cid-hook),Noop(CallerID Entry Point)
exten => s/_96110,n(dest-ext),Goto(from-did-direct,1000,1)

What does your send-notification do?

If you can put it before any inbound route processing, just set Context for your trunk to point to a context in extensions_custom.conf, which performs the desired logic then returns to from-trunk.

Or, if you can put it after the inbound route processing, just make a Custom Destination that calls send-notification and use the Return option to go to (for example) from-did-direct.

how?
Please say it in details with many thanks!

send-notification: when any inbound call comes, there is a notice of incoming details sent.

incoming call caller 1 >> inbound route 1 >> extension 100
incoming call caller 2 >> inbound route 2 >> extension 200
incoming call caller 3 >> inbound route 3 >> extension 300
incoming call caller 4 >> inbound route 4 >> extension 400

I understand your point
incoming call caller 1 >> Custom Destination 1 >> send-notification >> inbound route 1 >> extension 100
it means i need set Custom Destination for each inbound route. because Return to different extension.

I just want to set it for all inbound routes once.
Am i clear?

Change the Context for your trunk(s) to (for example) from-trunk-notification.
Put in extensions_custom.conf

[from-trunk-notification]
exten => _.,1,Gosub(sub-send-notification,s,1)
exten => _.,n,goto(from-trunk,${EXTEN},1)

Of course, this will call sub-send-notification on all incoming calls, so you may need to add some filtering.

Another approach is to not modify the dialplan at all, but run a script that looks at the Asterisk log, CDRs, CELs, etc. and sends notifications when needed. This has the advantage that problems with sending notifications will not cause calls to fail or be delayed.

exten => _.,1,Gosub(sub-send-notification,s,1)

YES, only this, works well.
Thanks so much

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