Blind Call Transfer does not work

rated by 0 users
This post has 32 Replies | 3 Followers

Top 500 Contributor
Posts 16
Points 230
hha Posted: 08-21-2009 3:04 AM

I am using asterisk 1.4.25.1, Diva SoftIP 1.2, SJPhone and X-lite 3.0. Diva Server is registered in Asterisk server. I am trying to test the blind call transfer feature.

Firstly, The story is very simple. I have an IVR program which will transfer the call to X-lite phone(1002) when there is an incoming call from SJPhone(1003). The phone number used to listen the incoming call in the IVR program is 555.

I could successfully test the blind call transfer and blind call transfer in active state with Line Test utility of Diva Server.

But I could not successfully test the Transfer with consultation, primary call on hold and primary call not on hold. It was saying "Did not receive transfer complete event" for both tests.

When I tested the blind call transfer, It caused the target phone ring. But the primary call and the call generated by the IVR program were not connected. It was obvious when I hang up the target phone because it had no impact on the primary call. As a result, there was no audio between them.

The next thing is the transfer call generated by Diva was automatically disconnected after a few seconds.

Here is the code.

Private Sub btnTransfer_Click()
    CallIn.TransferNoHold = True
    retVal = CallIn.BlindCallTransfer("1002")
End Sub

This was generated when I tested the blind call transfer with the Line Test utility.

Executing [555@default:1] Dial("SIP/1003-084ca6e0", "SIP/555|30") in new stack
-- Called 555
-- Got SIP response 302 "Moved Temporarily" back from 192.168.8.4
-- Now forwarding SIP/1003-084ca6e0 to 'Local/1002@default' (thanks to SIP/555-084d4cb0)
-- Executing [1002@default:1] Dial("Local/1002@default-3e16,2", "SIP/1002|30") in new stack
-- Called 1002
-- SIP/1002-084fa250 is ringing
-- Local/1002@default-3e16,1 is ringing
-- SIP/1002-084fa250 answered Local/1002@default-3e16,2
-- Local/1002@default-3e16,1 stopped sounds
-- Local/1002@default-3e16,1 answered SIP/1003-084ca6e0
== Spawn extension (default, 1002, 1) exited non-zero on 'Local/1002@default-3e16,2'
== Spawn extension (default, 555, 1) exited non-zero on 'SIP/1003-084ca6e0'

This was generated when I tested the blind call transfer in my application.

Executing [555@default:1] Dial("SIP/1003-084ca6e0", "SIP/555|30") in new stack
-- Called 555
-- SIP/555-084d4cb0 is ringing
-- SIP/555-084d4cb0 answered SIP/1003-084ca6e0
-- Packet2Packet bridging SIP/1003-084ca6e0 and SIP/555-084d4cb0
-- Executing [1002@default:1] Dial("SIP/555-08504478", "SIP/1002|30") in new stack
-- Called 1002
-- SIP/1002-084eb068 is ringing
-- SIP/1002-084eb068 answered SIP/555-08504478
== Spawn extension (default, 1002, 1) exited non-zero on 'SIP/555-08504478'
== Spawn extension (default, 555, 1) exited non-zero on 'SIP/1003-084ca6e0'
 
*****************************************Info*******************************************
555 --> asterisk user ID that was used by IVRProgram to listen the incoming call and to transfer it.
1002 --> asterisk user ID of the transferred phone.
1003 --> asterisk user ID of the calling phone

Find the attachment for log file generated by Dialogic Diva Diagnostics utility, please.

Can anybody tell me what is happening and how to fix it, please?

Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

When doing call transfers using SIP you shoudl use the following SDK functions:

CallDeflection - this is effectively a BlindTransfer and will result in a 302 Redirect being sent back to the calling party. The calling party will then re-invite to the new destination.  Please note that you shoudl not use the SDK function BlindTransfer, use the CallDeflection function instead. This is only in SDK 5.5 which has just been released so please download and update your system accordingly. As you are using the Component API you should copy the new dlls and also use DivaRegisterComponent.bat to register the new DivaSDK.dll and also please ensure that you delete the Interop.DIVASDKLib.dll to make sure you will be using the new dlls. If intellisense in Visual Studio does not offer MyCall.CallDeflection then the new dll has not been registered correclty.

SuperVisedTransfer - this function will accept the incoming call so you can play prompts etc, then when you submit the transfer a SIP Refer will be sent to the calling party which will then call to the new destination.

Top 500 Contributor
Posts 16
Points 230

Hi Vic Small,

Thanks for your reply. Now I have installed SDK 5.5 and tested for blind call transfer by using CallDeflection as you suggested. It works. But to be perfectly honest, I don't quite understand the difference between BlindCallTransfer and CallDeflection.

Could you give some brief explanation on the difference between them, please?

The next thing is that I have never used SuperVisedTransfer and can't find any sample codes demonstrating the use of SuperVisedTransfer method. BTW, I am very new to this technology.

Could you point me to some URL where I can get the knowledge of how to use SuperVisedTransfer, please?

The last thing is I still get the "Did not receive transfer complete event" message when I tested the transfers with consultation call, primary call on hold or not on hold. Any clues on that, please?

Thanks in advance.

Thanks and Regards,

hha

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

The differences between types of call transfer can be subtle and also vary slightlly depending on the underlying network technology you are using.

The difference between Call Deflection and Blind Transfer is that with CD you don't answer the call. When the call comes in you just 'deflect' it to another destination. This is the method used in line test tool to do an IP 'blind transfer' so I was replicating that in code as you said it worked ok.

To use supervised transfer you can do the following (in psuedo code):

Call1.Listen

Call1.Answer

Call1.playprompt, accept dtmf etc  - so here your IVR could be asking for the destination number for the call to be transferred to.

Call2.Connect- make a second call leg to the transfer destination.

When Call2 is answered do Call1.CompleteSupervisedTransfer(Call2)   - this will transfer call1 to call2.

 Not sure about the event message issue, it could be a spurious error. Check the return codes you get when using your own code and see how that goes.

  • | Post Points: 20
Top 500 Contributor
Posts 16
Points 230

Hi Vic,

Thanks you for your explanation.

I have tested the supervised transfer according to what you said. Unfortunately, It does not work and it keeps saying DivaResultNoChannel when I try to make second leg call to the transfer destination.

Only 4 voice channels are available for the license of my Diva SoftIP product.

Could you check the code to find out where did I go wrong, please?

Here is my code.

Dim WithEvents CallIn As DivaCall
Dim WithEvents CallTransfer As DivaCall
Dim suspend As Boolean
Dim receivedTones As String

Private Sub LogToWindow(s As String)
    If log.ListIndex > 800 Then log.RemoveItem (0)
    Call log.AddItem(Time & " - " & s)
    log.ListIndex = log.ListCount - 1
End Sub

Private Sub btnTransfer_Click()
    retVal = CallIn.CallDeflection("1002")
End Sub

Private Sub CallIn_OnConnected()
    'Notice: Safe to stream voice file here as we are sure the call will get connected.
    'This is the saftest place to do streaming and recording in the asynchronous mode.
    'retVal = CallIn.SendVoiceFile("DefaultGreeting.wav")
   
    'retVal = CallIn.SendVoiceFilesEx("DefaultGreeting.wav", "0123456789")
    'LogToWindow ("Connected, stream announcement")
    'If (retVal = DivaResultSuccess) Then
    '    LogToWindow ("Sending voice stream...")
    'Else
    '    LogToWindow ("Failed to stream voice file.")
    'End If
   
    CallIn.EnableDigitDetection = True
    retVal = CallIn.SendVoiceFilesEx("DefaultGreeting.wav", "0123456789")
End Sub

Private Sub CallIn_OnDisconnected()
    LogToWindow ("OnDisconnected event was fired.")
    CallIn.Disconnect
    CallTransfer.Disconnect
End Sub

Private Sub CallIn_OnRecordEnded(ByVal Reason As DIVASDKLib.DivaRecordEndReason)
    LogToWindow ("OnRecordEnded event was fired.")
    'mimicking infinite loop occured when caller hung up during recording.
    ' For i = 0 To 10000
    '    LogToWindow (i)
    '    'Solution to workaround the problem
    '    If i = 5000 Then
    '        CallIn.Disconnect
    '        Exit For
    '    End If
    'Next i
End Sub

Private Sub CallIn_OnSuppServeCompleted(ByVal bSuccess As Long)
    LogToWindow ("Call has been transferred")
End Sub

Private Sub CallIn_OnToneReceived(ByVal cTone As Byte)
    LogToWindow ("Tone received...." & Chr(cTone))
       
    receivedTones = receivedTones & Chr(cTone)
    If Len(receivedTones) > 3 Then
        CallIn.ClearDetectedDigits
        CallIn.ClearDetectedTones
        CallIn.EnableDigitDetection = False
        retVal = CallTransfer.Connect(receivedTones)
        receivedTones = ""
    End If
End Sub

Private Sub CallIn_OnVoiceStreamed(ByVal bWrapped As Long)
    LogToWindow ("OnVoiceStreamed event was fired.")
    'LogToWindow ("announcement ended, start recording")
    'CallIn.EnableDigitDetection = True
    'retVal = CallIn.RecordVoiceFile("Message2.wav", DivaAudioDefault, 20, 0, "1")
    'LogToWindow ("recording ended with reason " & retVal)
End Sub

Private Sub CallTransfer_OnConnected()
    CallIn.CompleteSupervisedCallTransfer (CallTransfer)
End Sub

Private Sub Disconnect_Click()
    retVal = CallIn.Disconnect()
    bCallActive = False
    LogToWindow ("Call Disconnected")
End Sub

Private Sub Form_Load()
    Set CallIn = CreateObject("DivaSDK.DivaCall")
    CallIn.LocalNumber = "9872288"
    Call CallIn.Listen(DivaListenServiceAnalogAll, "")
    LogToWindow ("Listen for analog calls enabled")
    CallIn.SignalEvents = True
    CallIn.AsyncMode = True
    CallIn.MaxChannels = 2
   
    Set CallTransfer = CreateObject("DivaSDK.DivaCall")
    CallTransfer.LocalNumber = 1234
    CallTransfer.SignalEvents = True
    CallTransfer.AsyncMode = True
    CallTransfer.MaxChannels = 2
End Sub

Private Sub CallIn_OnIncomingCall()
    CallIn.Alert
    LogToWindow ("Incoming Call from <" & CallIn.CallingNumber & ">")
    retVal = CallIn.Answer(DivaCallType_Voice)
    If (retVal = DivaResultSuccess) Then
        LogToWindow ("Connecting...")
    Else
        LogToWindow ("Caller disconnected")
    End If
End Sub

Thanks and Regards,

hha

  • | Post Points: 5
Top 500 Contributor
Posts 16
Points 230

Hi Vic,

Find the attachment for SDK traces, please.

Thanks in advance.

Regards,

hha

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

When your application is making more than one simultaneous call you need to use the DivaSystem and DivaInstance methods and create your call objects under Instance. Simple example here:

  SysObj = CreateObject("DivaSDK.DivaSystem")
        InstObj = SysObj.CreateInstance(True, 4, 7, 1024)
        Call1 = InstObj.CreateCall
        Call2 = InstObj.CreateCall

        Call1.AsyncMode = True
        Call1.SignalEvents = True

        Call2.AsyncMode = True
        Call2.SignalEvents = True

Note that this method is ok for very simple apps but not suitable for many channels as you have to code duplicate event handlers for each call object, but its ok for quick test apps.

A more practical method  is to use a call handler class, details in the online training course here: http://www.dialogic.com/support/training/ see 'Using the Dialogic Diva Component API' 

  • | Post Points: 20
Top 500 Contributor
Posts 16
Points 230

Hi Vic,

Thanks you for reply.

I have changed the code accordingly to your suggestion. Now I don't get the DivaReasonNoChannel error anymore. I can play the prompt, get the dtmf input from user and make the call to transfer destination. While the transfer destination was ringing, I could hear the OnHold music playing. I also noticed, after a few minutes, OnSuppServeCompleted method was invoked. But the problem is it was playing non-stop and I can't here anything althought I made the noise from the transfer destination after answering the transferred call.

I made some changes to code.

Private Sub CallIn_OnToneReceived(ByVal cTone As Byte)
    LogToWindow ("Tone received...." & Chr(cTone))
       
    receivedTones = receivedTones & Chr(cTone)
    If Len(receivedTones) > 3 Then
        CallIn.ClearDetectedDigits
        CallIn.ClearDetectedTones
        CallIn.EnableDigitDetection = False
       
        retVal = CallIn.SetupSupervisedCallTransfer(CallTransfer)
        If retVal = DivaResultSuccess Then
            retVal = CallTransfer.Connect(receivedTones)
        End If
        receivedTones = ""
    End If
End Sub

 

Private Sub CallTransfer_OnConnected()
    'CallIn.Retrieve
    retVal = CallIn.CompleteSupervisedCallTransfer(CallTransfer)
End Sub

When I checked the SDK traces, I saw the message saying "Supplementary service not supported: ECT".

Find the attachment for SDK traces, please.

Could you explain me what is going on and how to fix this problem, please?

  • | Post Points: 5
Top 500 Contributor
Posts 16
Points 230

Hi Vic,

Find the attachment for the Diva traces of that problem, please.

Thanks in advance.

Thanks and Regards,

hha

  • | Post Points: 5
Top 500 Contributor
Posts 16
Points 230

Hi Vic,

Any answer for me, please?

Thanks in advance.

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

I usually do not use the SetupCallTransfer function as I find it easier to create my own consultation call as a completely normal call and then when it is connected I just issue CompletesupervisedTransfer. Why don't you try that method as in the code snippet I gave before and below. One point is that CompleteSupervisedTransfer defaults to expecting the primary call on hold so either put it on hold or set Call1.TransferNoHold = True before completing the transfer. I'd advise you try that first as there is no need to put an IP call on hold anyway.

Call1.Listen

Call1.Answer

Call1.playprompt, accept dtmf etc  - so here your IVR could be asking for the destination number for the call to be transferred to.

Call2.Connect- make a second call leg to the transfer destination.

When Call2 is answered do Call1.CompleteSupervisedTransfer(Call2)   - this will transfer call1 to call2.

 

  • | Post Points: 20
Top 500 Contributor
Posts 16
Points 230

Hi Vic,

Thanks you for your reply.

I have already tested the supervised call transfer by not using SetupCallTransfer function. There was no difference just like before. It seemed the two calls were not connected at all.

Could you explain me why it kept saying "Supplementary service not supported: ECT" in SDK traces, please?

Thanks in advance,

Regards,

hha

 

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

Difficult to tell why it is returning "ECT not supported" as the Diva trace is not from the same calls as the SDK trace but as it appears that SoftIP doesn't attempt to send any SIP transfer commands it looks like the setup for the transfer is incorrect. 

Try this application, press the listen button, then call into the app. When the call is connected enter the destination number in the "Consul Transfer Destination" field and press the C.Transfer button.

This app uses the method I described above and generally works fine. If it doesn't work please send a SDK trace and Diva trace taken at the same time.

  • | Post Points: 35
Top 500 Contributor
Posts 16
Points 230

Hi Vic,

Thanks you for your reply.

I have run and tested the given application. There was no difference and the problem still persists.

Find the attachment for SDK trace, please.

Many Thanks,

hha

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

Can you post the Diva trace of the same call please so I can see what is happening to the SIP ?, thanks.

  • | Post Points: 20
Page 1 of 3 (33 items) 1 2 3 Next > | RSS