Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

interactive voice response 3

Status
Not open for further replies.

hzBlueTooth

Programmer
Dec 9, 2003
5
0
0
GB
hello
i am trying to make use of voice modem instead of a dialogic board. i have to do this using java. basically i have to detect/send dtmf and voice through a modem.i would be really grateful for your response.
haris
 
Hi pansophic,

I'm in trouble. Can you help me?
My task: call to phone and play wav file

all works but I don't know WHEN (what event) need to play wav file.

now I use MediaTermConnAvailableEv:

//-----------------------------------------------
case MediaTermConnAvailableEv.ID: //400
int term_con_state = m_destTerminalConnection.getState();

//if destination side answer on call.
//THIS IS DON'T WORK!!!
if(term_con_state == TermConnActiveEv.ID)
{
try{
playSound(mtc, filename);
} catch (Exception excp)
{
}
}
break;
//--------------------------------------------------

Playing start before recepient answer on my call.

Help me please.

Vladimir
 
vovik64, your problem is a simple one. Use a Computer Telephony Integration card (like Dialogic, Natural Microsystems or Brooktrout) instead of a modem. Modems are historically very poor at doing any call progress tone detection. If you read the help forum on SourceForge you will find that there are several threads with exactly the same issue.

If you really want to, you can write a routine that listens for audio (broad band noise, rather than the narrow band tone of the ring back) or listens for a change in cadence (ringback in the US is 1 second on, 3 seconds off generally). If the tone's cadence stops, then you probably have an answer. Also, if you have received a broad band signal, it is probably audio, because call progress tones are very narrow band.

But, this functionality is already built in to the CTI cards, so there is no development time, and they perform extremely well if they are configured for their actual environment. Also, d4j (Dialogic for Java) is supported now by XTAPI, so you don't even have to port your code to C.


pansophic
 
KRYNNA,

> (1) How to differentiate the TermConnCreatedEv, TermConnAvaliableEv, MediaTermConnState.

I'm not sure that I follow what you want to do. Each of those events exists already as part of a case select, so the program already differentiates them.

> (2) Also, usePlayURL seems to be will not play the URL until .startPlaying() method being involved, same as useRecordURL, it will started to record until .startRecordin() method being invloved, am I correct?

I believe this to be true. Since I have always put the two together, I've never worried about whether the .startPlaying() is required.

> (3) Finally, the code of MediaTermConnStateEv seems to check it is in playing,
    if yes, nothing to do,
    if no, check "is it in recoding"
           if yes, nothing to do
           if no, start recording, then following,
                  check timeout.
> am I correct?

I believe that is true.

> If my unstanding is correct, will it start the recording before playing, since this event just check is it playing or recording, before the startPlaying() method, the connection also is in no playing and no recording status.

No, I believe that the first time that the MediaTermConnStateEv.ID event fires is when you start playing. I don't believe that it fires before then. But you have to remember that these examples are EXTREMELY simple. They do not handle many of the possible asynchronous events that may occur.

> (4) if I would like to add my DTMF after the play wav (for sure my plan will no play 1 wav and detect 1 DMTF signal), where should I put my code? MediaTermConnAvailableEv??

There is a DTMF digit received event, MediaTermConnDtmfEv that you can trigger on. Turn DTMF detection on with mtc.setDtmfDetction(true) method.

Look at the JVoiceMail sample code that is delivered with JTAPI for examples of how to use it.


pansophic
 
Thanks pansophic,

I understand what you mean, and I think I know how to use the DTMF.

And the problem of differentiating the TermConnCreatedEv, TermConnAvaliableEv, MediaTermConnState. I ask it because I need to create a IVRS menu, like
Machine speak -> XXX, press 1; YYY, press 2; ZZZ, press 3
User press [2]
.....

The idea to achieve it, I will create a buffer. when DTMF event occured, then the PressKey will added into the buffer.

On the otherhand, my procedure of the menu will keep looking the buffer when it except a User Input.

So the problem is. where is the BEST place to put my main menu code?

so I would like to know more are the time the system will fire the events, especially the Media's events and th Term's events because I found that the can occur at the same time.

^^
 
What you are describing is the challenge of event driven code. Any event can (and frequently will) occur at any time. You have to be able to account for this in your coding.

You will have several things to keep track of (states, if you will). Typically you will play a greeting when the call initially comes in. This event is relatively easy to spot, it is works exactly the same as the JAnsweringMachine or JVoiceMail.

Like the JVoiceMail, you will want to turn on DTMF detection, probably before you begin playing the greeting so that familiar callers can bypass the message.

When a user dials a digit, you check to see if there are any digits in the buffer yet. If not, you will stop the playing message, change the state of the call to the appropriate level (based on their digit), clear the digit buffer, and play the next appropriate message. If you are collecting multiple digits for a prompt, you will stop the playing message and set an interdigit timer. If that timer expires before the next digit is entered, then you will either disconnect the call, or route the caller to a message telling them that you have not collected enough digits. The state of the call will tell you which message to begin playing again.

So, I would probably put the initial greeting in the media stream available event, and then call a subroutine from the DTMF digit received event to check and see what message (if any) should be played.


pansophic
 
Hi pansophic,

Thanks for your help and now I already created a simple IVRS menu.

Thank you again, and I believe I cannot create this simple menu without your help.
 
KRYNNA,

If the software performs well, consider GPLing it and providing it to sfrare, the XTAPI maintainer at sourceforge. I have seen a number of requests for similar software.


pansophic
 
Hi pansophic,

Ok, then I just name your Net name in Acknowledgement since I must show all of our discussion in my final report.

And I think If my s/w really work fine (hopefully), I will ask my project supervisor for procedure for GPL it. ^^

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top