I would like to setup a dialplan to play audio at certain durations.
For example..
play an Audio file to say that the call duration is one minute, then play another file stating two minutes, then another saying ten minutes.
For that you can use goto and function RAND
pro-sip*CLI> core show function RAND
-= Info about function 'RAND' =-
[Synopsis]
Choose a random number in a range.
[Description]
Choose a random number between <min> and <max>. <min> defaults to '0', if
not specified, while <max> defaults to 'RAND_MAX' (2147483647 on many
systems).
Example: Set(junky=${RAND(1,8)}); Sets junky to a random number between
1 and 8, inclusive.
[Syntax]
RAND([min][,max])
[Arguments]
Not available
[See Also]
Not available
You also can just name files as 1.wav,2.wav etc and use playback(${RAND(1,2)} or you can add that to musiconhold folder and play random MOH
Related
My call records are getting store in /var/log/asterisk/cdr-csv/Master.csv file. i want to limit the number of call to be stored ni this file, after that it should start form the beginning,
so for this what could be procedure
You can't limit number of records by asterisk
But you easy can rotate files by using logrotate linux utility.
For that you should create file /etc/logrotate.d/asterisk_cdr
/var/log/asterisk/cdr-csv/*csv {
missingok
rotate 5
size 2000k
create 0640 asterisk asterisk
}
For more info see documentation for logrotated
I'm using the parameter m(mymusic) in my call to Dial() to let the caller hear some music instead of the boring ring tone. However I'd like to have a different music file after some time. The time when the music changes should easily be changeable (by editing a variable), so it is no option to just create a music-on-hold-file which has X seconds of music 1 and then Y seconds of music 2.
What I want is basically this, but without a second Dial() and without an actual second call to ${device}, because that creates two "missed call" entries for one missed call, and it interrupts the phone's ring tone.
Set(time_until_new_music=20);
Dial(${device},${time_until_new_music},gm(music1));
if ( "${DIALSTATUS}" == "NOANSWER" ) {
Dial(${device},,m(music2));
}
Is this possible somehow?
Hold class can have unlimited number of different sound file of any length
Number of musiconhold classes also unlimited. So you can create your own set for every need
However you can't control from dialplan class info. You can use external steaming app and forward to that app param you need. Require expert level in both asterisk and linux.
Something like this may work:
s,1,Set(time_until_new_music=20)
s,2,Dial(${device},${time_until_new_music},gm(music1))
s,3,GotoIf($[${DIALSTATUS}=NOANSWER]?s,4:s,5)
s,4,Dial(${device},,m(music2))
s,5,Hangup()
I'm having a hard time thinking about a solution for this problem,
I'm using asterisk to develop a phone ivr smart application which needs some time to read number to the caller, the way asterisk work is using the file say.conf for building the audio files to play for the number to input.
For example, if I write saynumber(123) it will go into say.conf file and find the matching regex and then build list of files to play (for the example it will play /digits/hundred then digits/and then digits/twenty then digits/three,
Now to the problem:
The command SayNumber is not listening to the user input while playing the files which means that the user cant interrupt the system by typing some number on his phone and it's not convenient for the user.
The command Read(var,filestoplayseperatedby&) is capable of listening to the user dtmf input while playing list of files.
What I'm trying to achieve is getting the list of the files based on the say.conf file to a variable, then after I got the file I will use the Read command and the it will say the number while listening to the user input. I also don't want to use tts engines since its a multilingual application that not all of them are tts available (Hebrew etc.) Also tts won't solve the main issue listening to the user input while playing.
Sorry for my English, since I'm not a native English speaker.
Here is a part from the asterisk say.conf file:
_[n]um:X000000000 => num:${SAY:0:1}, digits/billion
_[n]um:XXXXXXXXXX => num:${SAY:0:1}, digits/billion, num:${SAY:1}
_[n]um:XX000000000 => num:${SAY:0:2}, digits/billion
_[n]um:XXXXXXXXXXX => num:${SAY:0:2}, digits/billion, num:${SAY:2}
_[n]um:XXX000000000 => num:${SAY:0:3}, digits/billion
_[n]um:XXXXXXXXXXXX => num:${SAY:0:3}, digits/billion, num:${SAY:3}
Any help will be appreciated.
You have 2 options
1) change saydigits to read digits(c/c++ programming)
2) give correct string to READ app(using fastagi/agi or other method)
We ask the caller to record their name then press hash key #. If the hash key has been pressed they should move to next step, otherwise go back and ask them to record the name again.
exten => s,n(RecordName), Playback(Please Record Your Name After Beeb then press '#')
exten => s,n,Record(recordpath/namefile.wav,60)
exten => s,n,GotoIf ('# isn't pressed')?RecordName)
Is there any way to detect if # is pressed at the end of Record command?
Please check documentation of Record command.
It clearly say which variables it set on # key.
pro-sip*CLI> core show application Record
-= Info about application 'Record' =-
[Synopsis]
Record to a file.
[Description]
If filename contains '%d', these characters will be replaced with a number
incremented by one each time the file is recorded. Use 'core show file formats'
to see the available formats on your system User can press '#' to terminate
the recording and continue to the next priority. If the user hangs up during
a recording, all data will be lost and the application will terminate.
${RECORDED_FILE}: Will be set to the final filename of the recording.
${RECORD_STATUS}: This is the final status of the command
DTMF:A terminating DTMF was received ('#' or '*', depending upon
option 't')
SILENCE:The maximum silence occurred in the recording.
SKIP:The line was not yet answered and the 's' option was specified.
TIMEOUT:The maximum length was reached.
HANGUP:The channel was hung up.
ERROR:An unrecoverable error occurred, which resulted in a WARNING
to the logs.
[Syntax]
Record(filename.format[,silence[,maxduration[,options]]])
[Arguments]
format
Is the format of the file type to be recorded (wav, gsm, etc).
silence
Is the number of seconds of silence to allow before returning.
maxduration
Is the maximum recording duration in seconds. If missing or 0 there
is no maximum.
options
a: Append to existing recording rather than replacing.
n: Do not answer, but record anyway if line not yet answered.
q: quiet (do not play a beep tone).
s: skip recording if the line is not yet answered.
t: use alternate '*' terminator key (DTMF) instead of default '#'
x: Ignore all terminator keys (DTMF) and keep recording until hangup.
k: Keep recorded file upon hangup.
y: Terminate recording if *any* DTMF digit is received.
[See Also]
Not available
I am dealing with Message Passing IPCS method. I do have few question regarding this:
KEY field in ipcs -q shows me 0x00000000 what does this means ?
Can i see what messsage is passes using msqid ?
If two entries are present (for a particular user) after executing command ipcs -q. Does this means that two messages were passed by this particular user ?
If used-bytes and message fields are set as 0 what does this mean?
Is there away to see if message queue is full or not?
How many queues can we have for one particular user?
I tried goggling, but was not able to find answer to these questions.
Please help
1. The "key" field of the Shared memory segments is usually 0x00000000. This indicates the IPC_PRIVATE key specified during creation of the shared memory segment. The manual of shmget() contains more details.
2. AFAIK, this cannot be done. If any msg is "de-queued" from the msgQ, then the intended receiver will not see it.
3. The 2 entries in the list of message queues indicates that there are currently 2 active message queues on the system identified by their corresponding unique keys.
Creating additional msgQ : ipcmk -Q
Deleting an existing msgQ : ipcrm -Q <unique-key>
4. The used-bytes and messages fields set to 0 indicate that currently no transfers have occurred using that particular msgQ.
5. Currently one way to do this to obtain the number of msgs currently queued-up in the msgQ programmatically as shown in the following C snippet. Next this can be compared with the size of the msgQ as demonstrated in this answer.
int ret = msgctl(msqid, IPC_STAT, &buf);
uint msg = (uint)(buf.msg_qnum);
printf("msgs in Q = %u\n", msg);
6. There exists a limit on the total memory used by all the msgQs on the system combined together. This can be obtained by ulimit -q. The amount of bytes used in a msgQ is listed under the used-bytes column in the output of ipcs -Q. The total number of msgQs is limited only by the amount of memory available to create a new msgQ from the msgQ memory pool limit seen above.
Also checkout the latter part of this answer for a few sample operations on POSIX message queues.