What a novel idea! I've not done that but I think I can get you going down the right path. If your system is similar to mine you'll find the following files that will serve as examples:
For digital faxing:
/etc/asterisk/extensions.conf
/var/lib/asterisk/bin/fax-process.pl
For emails with audio message attachments:
/etc/asterisk/extensions_additional.conf
/var/lib/asterisk/bin/audio-email.pl
We'll focus on the second action by taking a look at the part of the extensions_additional.conf file that deals with audio attachments:
[app-dictate-send]
include => app-dictate-send-custom
exten => *35,1,Answer
exten => *35,n,Macro(user-callerid,)
exten => *35,n,Noop(CallerID is ${AMPUSER})
exten => *35,n,Set(DICTENABLED=${DB(AMPUSER/${AMPUSER}/dictate/enabled)})
exten => *35,n,GotoIf($[$["x${DICTENABLED}"="x"]|$["x${DICTENABLED}"="xdisabled"]]?nodict:dictok)
exten => *35,n(nodict),Playback(feature-not-avail-line)
exten => *35,n,Hangup
exten => *35,n(dictok),Read(DICTFILE,enter-filename-short,,,,)
exten => *35,n,Set(DICTEMAIL=${DB(AMPUSER/${AMPUSER}/dictate/email)})
exten => *35,n,Set(DICTFMT=${DB(AMPUSER/${AMPUSER}/dictate/format)})
exten => *35,n,Set(NAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => *35,n,Playback(dictation-being-processed)
exten => *35,n,System(/var/lib/asterisk/bin/audio-email.pl --file /var/lib/asterisk/sounds/dictate/${AMPUSER}/${DICTFILE}.raw --attachment dict-${DICTFILE} --format ${DICTFMT} --to ${DICTEMAIL} --subject "Dictation from ${NAME} Attached")
exten => *35,n,Playback(dictation-sent)
exten => *35,n,Macro(hangupcall,)
; end of [app-dictate-send]
You'll see that the /var/lib/asterisk/bin/audio-email.pl is referenced. The function runs line by line so if someone hangsup (ie line 8) then the .pl file is never fired off. But before this function can function it needs to be included like this:
include => app-dictate-send
I'm not going to print out the .pl file here. If you can write a pl file that will turn down the volume on your office jukebox when you manually run it, you can definitely set up Asterisk to fire off the pl when you get an incoming call.
Take a look at the /var/lib/asterisk/bin/fax-process.pl to see how asterisk fires off emails.
Now you'll probably want to adjust the first file I referenced above: /etc/asterisk/extensions.conf. This file tells Asterisk what to do when calls first come in. Take a look near the top of the file for this:
[from-did-direct]
include => ext-findmefollow
include => ext-local
You could create something like "turn_down_music.pl" and include it in a function like [app-lower-music]. You would then include it with:
[from-did-direct]
include => app-lower-music
include => ext-findmefollow
include => ext-local
Note that the [ext-local] file is defined in the extensions_additional.conf file but referenced in the the extensions.conf file. You can create your own custom extensions file and reference it in the extensions.conf file like this:
#include extensions_custom.conf
#include extensions_music.conf
Also note that # does not comment lines out. Instead ; comments lines out.
I have gained a lot from these two books:
Good luck!
There's no single standard. You've got two choices: either add a dialplan entry to modify the presented incoming number for one of the two cases (ie, for calls matching 0091), or make sure that both types of calls go through a single dialplan/flow that defines a common source number format.
In either case, your dialplan needs to rewrite some or all source numbers.
Given that, choose a format that will last. At Cloudvox, we went with E.164 (+CCnumber) because it fairly cleanly supports worldwide numbers. We rewrite caller ID values to E.164 and present that CID to apps. http://help.cloudvox.com/faqs/getting-started/incoming-call-settings is one version of what I described above.
Troy, Cloudvox
Best Answer
Ok, i found solution,
It was fairly simple while trying to run script.. with
system(/path/to/script)..
previously it didn't work due to the conflicts among the context while trying to intercept freepbx routing with manual routing.
As it would send notification on every Inbound hosted from same provider (or atleast with same context)
I wrote more to skip if its not certain DDI number.