Author |
|
rrojo Intermediate
Joined: February 15 2008 Location: United States Posts: 3
|
Posted: February 15 2008 at 3:55pm | IP Logged
|
|
|
I have a simple SIP application that makes calls and waits for the user to press a key on the phone. I can make the call and play numerious wave files. However, the issue is that when I press a key on the phone, it does not fire the DTMF Decoder Callback.
If I call into the application, the DTMF Decorder Callback does fire. However, when I call out, it does not fire.
I set the DTMFDecoder for each line that I use. Is there any setting that I need to set that will allow me to detect the DTMF tones thus firing the DTMF Decoder Callback for outbound calls?
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 18 2008 at 9:12am | IP Logged
|
|
|
Hi rrojo,
Thanks for posting.
You >>>
I have a simple SIP application that makes calls and waits for the user to press a key on the phone. I can make the call and play numerious wave files. However, the issue is that when I press a key on the phone, it does not fire the DTMF Decoder Callback.
If I call into the application, the DTMF Decorder Callback does fire. However, when I call out, it does not fire.
<<< Support
There must be a logic problem in the app.
The existing “in-band” DTMF decoder blocks a VOIP app can instantiate need to be fed sample block data. This sample block data can come from whatever source your app requires.
For example: For a typical IVR app where users call your app (or your app calls them), you want to take received sample block data from the phone line and send it to an “in-band” DTMF decoder you have instantiated. Note: Your app should instantiate a dedicated single “in-band” DTMF decoder for each phone line. Your app gets the received sample block data from the phone line’s receiver IVR channels. See the OpenRxIvrChannel() API proc for more info. The first step is to make sure that when your app makes an outgoing call, this Rx IVR callback procedure you have registered is getting called.
You then take this received sample block data (that gets sent to your callback proc) and write it to the input of the dedicated DTMF decoder for the phone line. Doing this will allow your app to decode “in-band” DTMF from the far end of the call. The DTMF decoder will then call your DTMF callback when it determines DTMF ON/OFF transitions.
If the logic in the app is correct, it will not matter if your app calls out or if someone call into it. You should always gets phone line received sample block data from the phone line to send to your DTMF decoder.
Another possibility is to use the phone line record capability of the media engine as the source of the DTMF sample block data. See the StartPhoneLineRecording() API proc. In this case your app can register a callback proc that will get called when Rx+Tx mixed data fro the phone line is available. This mixed Rx+Tx sample block data can also be written to the DTMF decoder you have instantiated for the phone line. This way, DTMF decoding would be performed on all received and transmitted audio of the phone line. This is just another option.
Repost with additional info if none of this helps.
Note:
We are working on a release of the media engine that will incorporate all in-band and out-of-band RFC2833 DTMF capability. This will probably be rolled into the v6 product. It will make life so much easier for apps requiring DTMF. Apps won’t have to deal with handling sample block data for in-band DTMF detection. Also, RFC2833 DTMF for digits 0,1,2,3,4,5,6,7,8,9,#,*,A,B,C,D and “Flash” will be supported. The app will basically configure the media engine and sit back and wait for DTMF ON/OFF events to be sent to the app. All current legacy DTMF will still be supported. Just a heads up.
Support
|
Back to Top |
|
|
rrojo Intermediate
Joined: February 15 2008 Location: United States Posts: 3
|
Posted: February 22 2008 at 9:35am | IP Logged
|
|
|
The IvrCallBack method is being fired all the time [as it should be?] and it is return the status true. On the other hand the DTMFDecoder is not being fired at all. Also, we are using "in-band" DTMF.
Something to consider is that we find it weird is we have two threads using the same media engine instance, the same call back procedure, and the same paramaters
Below is the code of the IvrCallBack method.
Code:
void IvrCallbackProc0(VoipMediaEngine.IVR_RECOGNITION_DATA IvrRecognitionData)
{
MyMediaEngine MediaEngine;
MyUserSpecifiedDataClass myDataObj;
bool status;
//// access the user defined parameter.
myDataObj = (MyUserSpecifiedDataClass)IvrRecognitionData.UserData;
MediaEngine = myDataObj.MediaEngine;
VoipMediaEngine.DtmfDecoder pDtmfDecoder = myDataObj.DtmfDecoder;
try
{
status = pDtmfDecoder.DtmfDecoderWrite(IvrRecognitionData.SampleBuffe r);
}
catch (Exception ex)
{
//ex = ex;
MessageBox.Show("Exception caught in IvrCallbackProc0: " + ex.Message);
}
}
|
|
|
Below is the code that sets the DTMF. I am calling SetDtmf per phone line, after StartSipTelephony and before SipTelephonyEnable.
Code:
private void SetDtmf(int PhoneLine)
{
VoipMediaEngine.TELEPHONY_RETURN_VALUE status;
VoipMediaEngine.DtmfDecoder DtmfDecoder0 = new VoipMediaEngine.DtmfDecoder();
MyUserSpecifiedDataClass myDataObj = new MyUserSpecifiedDataClass();
myDataObj.MediaEngine = MediaEngine;
myDataObj.PhoneLine = PhoneLine;
status = DtmfDecoder0.CreateDtmfDecoder(
MediaEngine,
false, // use PCM samples.
8000, // sample rate.
160, // number of samples per input block.
160, // filter block N size. generally set to the same as the num samples per block.
false, // immediate mode.
DtmfDecoderCallbackProc, // handler proc.
myDataObj // handler proc instance data.
);
if (status != VoipMediaEngine.TELEPHONY_RETURN_VALUE.SipSuccess)
{
LogErrorMessage(MediaEngine, status, "CreateDtmfDecoder() Error.");
DtmfDecoder0.DestroyDtmfDecoder();
}
VoipMediaEngine.RxIvrChannel RxIvrChannel0 = new VoipMediaEngine.RxIvrChannel();
int RxIvrSamplesPerIvrBuffer0 = 0;
int RxIvrBytesPerIvrBuffer0 = 0;
bool SamplesInByteArray0 = false;
myDataObj.DtmfDecoder = DtmfDecoder0;
status = RxIvrChannel0.OpenRxIvrChannel(
MediaEngine,
PhoneLine,
IvrCallbackProc0,
myDataObj, //MediaEngine,
true, // Perform conversion.
VoipMediaEngine.AUDIO_BANDWIDTH.AUDIO_BW_ULAW_8K,
ref RxIvrSamplesPerIvrBuffer0,
ref RxIvrBytesPerIvrBuffer0,
ref SamplesInByteArray0
);
if (status != VoipMediaEngine.TELEPHONY_RETURN_VALUE.SipSuccess)
{
LogErrorMessage(MediaEngine, status, "OpenRxIvrChannel() Error.");
}
}
|
|
|
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 22 2008 at 10:57am | IP Logged
|
|
|
Hi rrojo,
Thanks for forwarding your email to this post. Your code looks OK but we must be missing something. We are taking your code and trying a test. Hang on...
Support
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 22 2008 at 6:43pm | IP Logged
|
|
|
Hi Richard,
We looked at your code and nothing strange pops out at us. So we decided to code up a simple example app. Its in your support FTP account. See the directory:
“Example Source Code\2-22-08”
Here is a summary:
MakeCallDetectFarEndInBandDtmf
Shows how to:
1)
Initialize the media engine.
2)
Make 2 calls to 2 different destinations at the same time using individual call threads (i.e. each outgoing call has its own thread).
3)
Monitor each phone line's Rx IVR data and wait for the far end to send "in-band" DTMF signals. When DTMF digits are detected, display them in the console window.
4)
Terminate the application when the user presses any key in the console window or when both far end parties hang up.
This sample should help answer your questions. Looking at your code snippets you posted, we tried to use a very similar code layout regarding data element and callback procs.
Post again to this thread if you run into more difficulties.
Make sure to use these samples with the latest v5.12.8.1 media engine update from your FTP support account.
Your paid support hours for February are fulfilled. If your team needs further enhanced support this month, we will log any extra hours and invoice you. Otherwise make sure your group returns the March enhanced customer support invoice and we can continue again at the beginning of March.
Have a good weekend,
Support
|
Back to Top |
|
|
rrojo Intermediate
Joined: February 15 2008 Location: United States Posts: 3
|
Posted: February 26 2008 at 10:13am | IP Logged
|
|
|
Thank your for the sample code. However, it seems that I am getting the same result as when I try to make a call from the my application.
They both are able to make the call out, but the DTMF is just not firing. The only difference that I noticed was the following line in the IVRCallbackProc method:
status = pDtmfDecoder.DtmfDecoderWrite(IvrRecognitionData.SampleBuffe r);
Is always returning true in my application, but false in the sample application.
Changes I did to the sample code:
- Changed the DomainName.
- The HostName was never used in the code, so I commented it out.
- Changed the IpAddressOfThisHostStr.
- Changed the SipProxy.
- Removed the Loging Message to Server.
- Removed the Authentication.
- Making a call using MakeCall method, verse, the MarkCallUri method.
Any ideas?
Thank You,
Richard
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 26 2008 at 12:59pm | IP Logged
|
|
|
Richard,
Hmmm… something strange is going on.
Regarding your changes:
- Changed the DomainName. (this is OK)
- The HostName was never used in the code, so I commented it out. (this is OK – thanks for pointing this out)
- Changed the IpAddressOfThisHostStr. (this is OK)
- Changed the SipProxy. (this is OK)
- Removed the Loging Message to Server. (this is OK)
- Removed the Authentication. (this is OK)
- Making a call using MakeCall method, verse, the MakeCallUri method. (this is OK)
We just re-tested the sample app we sent you. We replaced the MakeCallUri() API proc and used the MakeCall() API proc instead. We get in-band DTMF detection no problem. The C# sample should execute right out of the box – even with your changes.
You >>>
The only difference that I noticed was the following line in the IVRCallbackProc method:
status = pDtmfDecoder.DtmfDecoderWrite(IvrRecognitionData.SampleBuffe r);
Is always returning true in my application, but false in the sample application.
<<< Support
Something screwy is going on. We used VS2005 to build the sample. When we run our sample code, this proc never returns false. If the DtmfDecoderWrite() fails, then the DTMF decoder is not initialized somehow.
Question 1 + 2
Assuming your app is receiving valid in-band DTMF tones, if the incoming DTMF signals are too hot (loud), the DTMF decoders in your app may be clipping. In this case, they won’t function properly.
What’s the amplitude of the received in-band DTMF?
What is the source of your in-band DTMF signals?
Some things to try (We are just throwing these ideas out there – if you have already tried some of these, then great):
1)
Is your app receiving in-band DTMF? We need to know this for sure.
To verify this, try enabling call recording on the phone line that is trying to detect the incoming DTMF. See the StartPhoneLineRecording() API proc for more details. Set up your app to record to a wave file. The wave file you record for the phone line should contain all in-band received DTMF tones your app receives. Can you hear the tones in this recorded wave file? Upload this recorded wave file to your support FTP account and we will look at it.
2)
As a test scenario:
Using the C++ single line soft phone example app that comes with the media engine, call your DTMF decoding app. What happens? Can your app decode in-band DTMF from the sample app? It should be able to.
It’s got to be something simple.
Support
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: March 13 2008 at 8:06am | IP Logged
|
|
|
Hi rrojo,
We will be working today with Alex on this. Keep in touch with him as we follow up…
Further discussions regarding your in-band DTMF issues will be conducted on this thread:
Issues After Upgrading to DLL v5.12.8.1
http://www.lanscapecorp.com/forum/forum_posts.asp?TID=444&TP N=1
Thanks,
Support
|
Back to Top |
|
|
|
|