How to get the exact call duration of outgoing calls from a PBX?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14

Thread: How to get the exact call duration of outgoing calls from a PBX?

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Post How to get the exact call duration of outgoing calls from a PBX?

    Recently I've been into PBX call accounting programming on VB.Net 2010. My results are way too successful including friendly user-interface and connection datareceiving coding. Except for one. That is the call duration of calls, incoming and especially those outgoing. In my project I didn't use any API (like TAPI for PBXs) thus is there any option how to detect the state of the outgoing call, whether is still ringing, ended without answer or answer at some point of time...because in my project nevertheless what call state is being processed, I'm getting the total call duration from the moment that call was initiated to the moment is being finished or not-answered.

    Here is a sample of my project where the DataReceived event is fired whenever there's something to parse from PBX to the PC.

    Programming language : Visual Studio 2010 Ultimate - Visual Basic .Net
    Database : Microsoft SQL Database
    PBX Machine : Panasonic KX-TEM824

    P.s. If you need to provide some code I'll post a sample of my project where the DataReceived Event is being handled.

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Re: How to get the exact call duration of outgoing calls from a PBX?

    A few quick questions...

    1: Do you get a event when the call gets connected?
    2: Are there any status bits in the data packet that you receive?
    3: do you have any documentation on the Comms with the PBX ?

    BTW.. Glad to see you getting somewhere with this..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Re: How to get the exact call duration of outgoing calls from a PBX?

    1.Of course I do get event whenever a call is initiated or before-hand recorded in PBX.
    The DataReceivedEvent fires and reads the possible bytes in the serial port storing them in a byte-array and quickly encoding it into ASCII characters and afterwards invoking a new thread address of a textbox (in my case) to display it to the user which works fine.
    2.Probably there must be some status bit but I never checked in fact don't recognize which one of the bits are the signaling ones for the call duration.
    3.You mean if I have any manufacturer manual on how to program the PBX? Not a hard-copy but I found on the internet by google-ing. But no sign of evidence of what I'm looking for I guess.

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Re: How to get the exact call duration of outgoing calls from a PBX?

    I think you misunderstood Q1..

    I know you get an Event when a Call is initiated (user pick up the phone and dials), You also get an event for when the call is ended (user hangs up). But is there an event when the call gets connected (dialing party answers the phone).

    could you posibly post a link to the manual and a few example strings that you receive from the PBX...

    lets look them over...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Re: How to get the exact call duration of outgoing calls from a PBX?

    Here's the link

    http://www.tlc-direct.co.uk/Technica...ser_Manual.pdf

    And this a part 1 of the receiving the other one is another thread, in a private sub which is cold by the Me.Invoke method.

    Code:
    Dim n As Integer = srpPBX.BytesToRead() 'Declare n as Integer, system-defined class type variable and set it's value to the bytes-to-be-read from the serial port srtPBX.
            Dim comBuffer(n - 1) As Byte 'Declare comBuffer as Byte, system-defined class type array set to the sum of bytes-read minus one, since bytes don't start to count from 0.
            Dim BytesReceived As Integer = 0 'Declare BytesReceived as Integer, system-defined class type variable and set to 0. This is a counter for the bytes-received.
    
            Try
                BytesReceived = srpPBX.Read(comBuffer, 0, n) 'Set BytesReceived to bytes read from n , starting from 0 and storing them into comBuffer.
                If BytesReceived > 0 Then 'If BytesReceived is bigger than 0 then...
    
                    x = System.Text.Encoding.ASCII.GetString(comBuffer) 'Convert the received bytes by ASCII format-encoding and set it to x string.
    
                End If
                Me.Invoke(New MethodInvoker(AddressOf ReceivedText)) 'Since the control that is needed to operate is declared in another thread an invoke is necessary here with address to ReceivedText.
    
            Catch ex As Exception
                MessageBox.Show("Error: " & ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error) 'Catch exception/s that might occurr anytime by any reason into a simplified message box followed by a critical sign within.
            End Try
    This is all I can provide atm. Looking forward as soon as possible to pm me.

  6. #6
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Re: How to get the exact call duration of outgoing calls from a PBX?

    I see your not quite understanding me today...

    I was looking for this Feature Guide that has instructions on the data received via the RS232 port... the user guide is useless, and will not help here..

    as for example strings, I want to see what data the PBX sends you not the CODE... Like in the guide.. Sec 1.20.1 (PG 149)

    12/31/04 12:52PM 103 05 12345678901234567890123456789012 00:00'16" . . . .
    12/31/04 12:53PM 103 02 incoming 00:01'43" . . . .
    12/31/04 12:54PM 101 02 incoming 00:07'48" . . . .
    12/31/04 1:04PM 103 06 092. . . 1438 00:00'06"
    12/31/04 1:04PM 102 05 < DISA incoming > . . . .
    Is this the data that you are getting ????
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  7. #7
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Re: How to get the exact call duration of outgoing calls from a PBX?

    I do some string replacements and do split the string array into words to store them in seven different columns in a table of my database. I'm giving you here some e.g. of my app logging.

    3/1/12 11:00AM 110 02 049294936 00:00'56" ....
    3/1/12 11:01AM 110 02 044430430 00:00'33" ....
    3/1/12 11:03AM 110 02 044168978 00:00'57" ....
    3/1/12 11:04AM 110 01 044305558 00:02'40" ....
    3/1/12 11:08AM 110 02 044204554 00:01'11" ....
    and this is another logical problem I get whenever there are more than one calls recorded in the PBX and when I try to open connection it sends me entire call records in a single string (x, the message string). So I put some breakpoints and copied the whole string to a notepad for further reference and this is what I captured today.

    3/ 1/12 11:10AM 110 02 049148866 00:01'06" .... " & vbCrLf & " 3/ 1/12 11:12AM 110 02 044307623 00:01'19" .... " & vbCrLf & " 3/ 1/12 11:14AM 110 02 044433342 00:00'50" .... " & vbCrLf & " 3/ 1/12 11:17AM 110 02 049554063 00:00'47" .... " & vbCrLf & " 3/ 1/12 11:19AM 101 02 < DISA incoming > 00:00'38" .... 0" & vbCrLf & " 3/ 1/12 *11:20AM 110 02 < DISA incoming > 00:01'39" .... 0" & vbCrLf & ""

  8. #8
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Re: How to get the exact call duration of outgoing calls from a PBX?

    Okay, Looking through this your not calculating the Call time, but been handed it by the PBX. In this case we cant help you at all, you need to get in touch with the Supplier/Manufaturer of the PBX and get answers from them...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  9. #9
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Re: How to get the exact call duration of outgoing calls from a PBX?

    Yeah I believe I'm restrained by the options provided from the Panasonic itself. So you mean that there is no flag that indicates start, hold, and pick up phone to see the exact call duration in this KX-TEM824?

    P.s. I solved out the multi-records string that comes from PBX whenever I'm not logging the calls at the proper time. So only the calculation of the exact outgoing call time is the problem...

  10. #10
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Re: How to get the exact call duration of outgoing calls from a PBX?

    The thing is your getting one event for the entire call... The PBX handles the Start, pickup, and hangup, does calculations and spits out one record for the call. on PG 150 of the Feature guide it lists the break down of the string you receive. No status bits there..

    You need to speak to someone who knows the firmware to sort this one out..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  11. #11
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,876

    Re: How to get the exact call duration of outgoing calls from a PBX?

    Sounds beyond the features of the PBX. What decade did they retire that model?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  12. #12
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Re: How to get the exact call duration of outgoing calls from a PBX?

    Ok let's assume that I have some other PBX machine plugged in to my PC. What would be the logic or the code to extract the exact call duration of outgoing calls let's assume yours PG150 PBX machine? Since my Panasonic KX-TEM824 is an old school one that doesn't provide specific info...

  13. #13
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Re: How to get the exact call duration of outgoing calls from a PBX?

    It all Depends on how the PBX stores the Data..

    There are some that store an event for Call, Pickup & Hangup, that allows you to real-time read and calculate the call durations, and show activity etc..

    Then there are some (like yours) that store and event at the end of the call, You only get historical info, and call duration is calculated within the PBX..

    The 'Code for all of them are about the same.. It's the Comms Protocol that differs for each one, and is often unique for each Manufacturer and Model ...

    More than that we cant help you..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  14. #14
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Exclamation Re: How to get the exact call duration of outgoing calls from a PBX?

    One more question? In this Panasonic KX-TEM824 happens that the machine sends the message in the various format...it puts vbCrLF in different parts of the message not at a static position 100%. One example lately I recorded was this and is so terrible and maybe impossible to reformat it by replacement method of string. Should I increase the baudrate of the connection so maybe the message comes properly or what would you suggest in this case?


    "3/7/ 12 3:50 108 02 6060001108 00:00'48" .. .. 3 / 7" & vbCrLf & "/12 3:51PM 102 01 00 49 17" & vbCrLf & "34973369 00:00'33" ...." & vbCrLf & "3/7/12 3:51P M 1" & vbCrLf & "02 02 00491734973369 00:00'43" ...." & vbCrLf & "3/ 7/12 3:54PM 102 02 00491734973369" & vbCrLf & "00:00'2 1" ...." & vbCrLf & "3/7/12 3: 55PM 102 02 044659912 " & vbCrLf & "00:00'24" ...."

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center