How to install an application on Elastix? - asterisk

Does anyone know, how to install an application on Elastix? In my case it is Answering Machine Detection(AMD). I need this application to detect outgoing calls, and if the answering machine is fax, hangup.
I tried to modify config files(modules.conf, extensions.conf, extensions_override_elastix.conf, amd.conf) as it is told in Asterisk documentation and forums, but non of it worked. CLI console doesn't show AMD output, and I think that AMD isn't even enabled there.
I've been looking for the answer for 3 or 4 weeks now and found almost nothing.
There must be something I've overlooked.
Maybe I should change something in the database(asterisk) or Elastix PBX settings?
Here's what I did:
Modified /etc/asterisk/amd.conf file. Appended this to the end:
[general]
initial_silence = 2250
greeting = 1500
after_greeting_silence = 1250
total_analysis_time = 5000
min_word_length = 100
between_words_silence = 50
maximum_number_of_words = 8
silence_threshold = 256
Modified /etc/asterisk/modules.conf. Appended this to the end:
load = > app_amd.so
Modified /etc/asterisk/extensions_override_elastix.conf
[outgoing] ;context
exten => s,1,Answer()
exten => s,n,AMD()
exten => s,n,NoOp(${AMDSTATUS})
exten => s,n,GotoIf($[${AMDSTATUS}=HUMAN]?humn:mach)
exten => s,n(mach),WaitForSilence(3000,1,20)
exten => s,n,Playback(${VOICEFILE})
exten => s,n,Hangup()
exten => s,n(humn),WaitForSilence(500)
exten => s,n,Playback(${VOICEFILE})
exten => s,n,Hangup()
Seeking for settings in database, in case if Elastix works through its database. Elastix writes logs into asterisk.cdr table - that's the only useful thing I've found.
I suppose, the CLI console should "say" something related to AMD application when I am calling, but it works as usual, without AMD enabled.
Thank you in advance!

You should add at options page to dialling param "M(amd)"
After that you should create macro-amd like described in manual.
That macro will be fired on call after call answered and before call bridged to other peer.

Related

Call hangup take time - asterisk dialplan

I wrote dialplan for my Asterisk system. The extension.conf is :
extensions.conf
[from-pstn]
exten =>s,1,Verbose(1, Caller ${CALLERID(all)} has entered the paf IVR)
same=>n,Answer()
same=>n,Wait(3)
same=>n,Playback(welcome)
same=>n,GoSub(post,ss,1)
same=>n,Playback(thanks)
same=>n,Hangup()
[post]
include => default_cont
exten => ss,1,Background(gud/post)
same=>n,WaitExten(5)
exten => 1,1,Set(CDR(aa)=136)
same=>n,Return()
exten => 2,1,Set(CDR(aa)=137)
same=>n,Return()
[default_cont]
exten => i,1,Playback(invalid)
same=> n,Hangup()
exten => t,1,Playback(timeout)
same=> n,Hangup()
exten => h,1,DeadAGI(convert_recordings.sh)
same=>n,DeadAGI(my_uploader.php,${var1},${CALLERID(num)},${CDR(var2)},${CDR(aa)})`
When i call to my asterisk system. it takes time to hangup after playing thanks audio file. Actually, call hangup after all AGI execution are completed and my_uploader.php execution takes time. But i need instant hangup after playing thanks message. System only executes AGI files after the call is completely hangup. How can i solve this problem ?
Thats becuase you have h extensions in your dialplan
So it will take time while you agi on h-extension ends.
You can use cdr info and run external script based on that. You can write dialplan on hexten(not agi). You can write faster(not blocking) agi.
Very likly your uploaded or conversion task take time. You have only notate somewhere in db what you have to do and do that in external thread, not in asterisk.
That way you will not block asterisk thread.

Execute dialplan context from command line

I'm trying to execute an extension from the command line (via asterisk -rx "command") on a context that makes a AGI based query to determine which extension needs to be dialed (these extensions are updated on the DB).
It's something like this:
[autodialer]
exten => 2,1,Answer()
exten => 2,n,AGI(database_query.php); Makes a database query and generates vars
exten => 2,n,Set(CALLERID(name)=${db_customer_name}); Sets callerid from DB data
exten => 2,n,Dial(SIP/${db_customer_extension}); Also, extensions are stored on DB
exten => 2,n,Playback(custom/important_message)
exten => 2,n,SayDigits(${important_numbers}); The message, stored on DB too.
exten => h,1,Hangup()
Here, I need that context executed from command line, without having to dial it from any extension (it is supposed to be executed with a crontab every X time).
I tried with originate command, but I think I misunderstood the command syntax and didn't work.
I think that it should be something like: asterisk -rx "channel originate 2#autodialer" and then Asterisk executes that context and we're all happy with our important numbers.
I know that's not the right syntax, just trying to explain how I imagine it could work.
Thanks for your help.
There are no way do originate only one leg. You have supply second argument(other channel dest)
if you not need other channel, create context like this
[wait]
exten =>s,1,Wait(10000)
and use
asterisk -rx "channel originate 2#autodialer s#wait"
Read this article:
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
NOTE: it is not recommended do diallout apps for people with less then 5 years dedicated asterisk experience. If you want one, use vicidial.org or other dialler.

Call recordings in Asterisk using MixMonitor

I'm just starting out with Asterisk and following the O'Reilly Guide to set up a test Asterisk server. I have set up a VM with CentOS 6.4, which has 1GB RAM and 50 GB HDD.
After installation, I set up soft phones successfully on 2 PCs which were able to call each other. I have to record these calls now - on searching, I found this site and ediiting my extensions.conf accordingly.
Here's my extensions.conf
[globals]
EXT_TESTTWO=SIP/0000FFFF0002
EXT_TESTONE=SIP/0000FFFF0001
[default]
exten => 0000FFFF0001,hint,SIP/0000FFFF0001
exten => 0000FFFF0002,hint,SIP/0000FFFF0002
[Queues]
exten => 7001,1,Verbose(2,${CALLERID(all)} entering the support queue)
same => n,Queue(support)
same => n,Hangup()
exten => 7002,1,Verbose(2,${CALLERID(all)} entering the sales queue)
same => n,Queue(sales)
same => n,Hangup()
[macro-automon]
exten => s,1,Set(MONITOR_FILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)})
same => n,Playback(beep) ; optional - hear when recording starts
same => n,MixMonitor(${MONITOR_FILENAME}.wav,b)
[LocalSets]
include => Queues ; allow phones to call queues
exten => 101,1,Dial(${EXT_TESTONE},20,m) ; Replace 0000FFFF0001 with your device name
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
exten => 102,1,Noop(Dialing 102);
exten => 102,n,Macro(automon) ; start monitor
exten => 102,n,Dial(SIP/0000FFFF0002,30) ; 30 secs
exten => 102,n,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => 102-NOANSWER,1,Voicemail(20,us) ; If unavailable, send to voicemail w/ unavail announce
exten => 102-NOANSWER,n,Playback(vm-goodbye)
exten => 102-NOANSWER,n,Hangup
exten => 102-BUSY,1,Voicemail(${MACRO_EXTEN},bs) ; If busy, send to voicemail w/ busy announce
exten => 102-BUSY,n,Playback(vm-goodbye)
exten => 102-BUSY,n,Hangup
exten => _102-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
;exten => 102,1,Dial(${EXT_TESTTWO},20,m) ;Replace 0000FFFF0002 with your device name
;same => n,Playback(vm-nobodyavail) ; Play "no one's available"
;same => n,Hangup()
The calling from 101 to 102 and 102 to 101 work fine. But there are no recordings which come under /var/spool/asterisk/monitor. Moreover, during the call, I get the following debug output:
Read factory 0x7f971001f428 was pretty quick last time, waiting for them.
Read factory 0x7f971001f428 and write factory 0x7f9710020068 both fail to provide 160 samples
No remote address on RTP instance '0x7f9710009258' so dropping frame
Read factory 0x7f971001f428 was pretty quick last time, waiting for them.
Read factory 0x7f971001f428 and write factory 0x7f9710020068 both fail to provide 160 samples
No remote address on RTP instance '0x7f9710009258' so dropping frame
Read factory 0x7f971001f428 was pretty quick last time, waiting for them.
Read factory 0x7f971001f428 and write factory 0x7f9710020068 both fail to provide 160 samples
No remote address on RTP instance '0x7f9710009258' so dropping frame
Read factory 0x7f971001f428 was pretty quick last time, waiting for them.
Read factory 0x7f971001f428 and write factory 0x7f9710020068 both fail to provide 160 samples
No remote address on RTP instance '0x7f9710009258' so dropping frame
Read factory 0x7f971001f428 was pretty quick last time, waiting for them.
Read factory 0x7f971001f428 and write factory 0x7f9710020068 both fail to provide 160 samples
No remote address on RTP instance '0x7f9710009258' so dropping frame
Read factory 0x7f971001f428 was pretty quick last time, waiting for them.
What am I doing wrong here? How can I enable call recordings for both incoming and outgoing calls on a particular extension?
When you using mixmonitor you have check that your sip devices have
directmedia=no
Also you can have more info by enabling debugging
If you have followed the O'Reilly book as is, it asks you to create a user called asteriskpbx and run the rest of the configurations as that user. As a result, during the installation process in the beginning, the /var/spool/asterisk/monitor folder may have write permissions only for root. You need to give write permissions to for the user/ group which is actually writing into the folder (i.e writing the .wav file to that location).
chmod -R 775 /var/spool/asterisk/monitor
This should fix it for you. hope this helps.

Asterisk CDR Report shows "s" in the destination field

I have had issue on an platform for quite sometime now, when somebody calls in to ivr system, the cdr report destination field shows an 's' in place of the called number.
The inbound route for the DID is set to the ivr menu.
Here is my dial plan:
"
exten => 800000031,1,Set(__FROM_DID=${EXTEN})
exten => 800000031,n,Gosub(app-blacklist-check,s,1)
exten => 800000031,n,ExecIf($[ "${CALLERID(name)}" = "" ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => 800000031,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => 800000031,n,Set(CALLERPRES()=allowed_not_screened)
exten => 800000031,n(dest-ext),Goto(ivr-3,s,1)*
"
I suspect the issue is on the last line but the file is not allowed to be edited directly.
Will appreciate any help.
s is the default extension in asterisk , go through the logs and try to find out on what context that call was executed. It usually happens when you do not create a context for any specific DID in extension.conf. then the call is being routed to asterisk default context
Use ${EXTEN} instead of s in Goto(ivr-3,s,1), Also in ivr-3 context create a dialplan using wildcard symbol. e.g
exten => 800000031,1,Set(__FROM_DID=${EXTEN})
exten => 800000031,n,Gosub(app-blacklist-check,${EXTEN},1)
exten => 800000031,n,ExecIf($[ "${CALLERID(name)}" = "" ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => 800000031,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => 800000031,n,Set(CALLERPRES()=allowed_not_screened)
exten => 800000031,n(dest-ext),Goto(ivr-3,${EXTEN},1)
[ivr-3]
exten => _X.,1,NoOp("Hello world")
We have an IVR. When an external caller listens to IVR and decides to hangup before IVR ends talking, in report we see "s" as Destination. Otherwise, in report we see extension dialed after or while IVR is talking. I guess it's normal. If You have been hacked You'd see other various destinations but not "s".
Solved on ours, there was no default destination set for the reception ring group. We pointed it back to the IVR and now no longer see the s destination.
Most likly that mean you have been hacked. Please check that you have no guest calls enabled, contact security expert to find hole and fix it.

Asterisk incoming call DID question (number dialed)

I am setting up a new Asterisk system at a hosted Asterisk provider using 1.4.38, moving from a self-hosted version 1.2. Whereas before I could do:
[incoming]
exten => _1NXXNXXXXXX,1,DoSomething
Now, it appears the incoming context will only get properly called if it is:
[incoming]
exten => s,1,DoSomething
How do I determine what number was dialed in this scenario? We have dozens of numbers and I need to be able to know which was called to route correctly...
Thanks,
Ben
You can use a pattern. I have this line in a running asterisk instance:
exten => 5858876463,1,Set(__FROM_DID=${EXTEN})
However, to answer your question, you can use the ${EXTEN} variable to decide what number was called. E.g.
exten => s,1,SomeScript(${EXTEN})

Resources