DNIS in VAD

Discussion in 'CRM / Helpdesk / App Integration' started by SWSDEV, Jan 16, 2014.

Thread Status:
Not open for further replies.
  1. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    What setting in 3CX needs to be changed so that the DNIS in the IVR shows the DID originally dialed instead of the extension of the IVR?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Hi Shahzad,

    You can get that information using the 3CX Call Control API (http://www.3cx.com/blog/docs/call-control-api/) from a DLL (and call that DLL from an external code execution component).

    The code you need to use could be something like this:

    Code:
        public string GetOriginalDestination(string ani, string dnis)
        {
          DN dn = PhoneSystem.Root.GetDNByNumber(dnis);
          ActiveConnection[] activeConnectionArray = dn.GetActiveConnections();
          foreach (ActiveConnection activeConnection in activeConnectionArray)
          {
            if (activeConnection.ExternalParty == ani) return activeConnection.DialedNumber;
          }
    
          return String.Empty;
        }
    
    Hope the information helps.

    Kind regards.
     
  3. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    Will that code not work if there are multiple connection in the IVR at the same time?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    If the calls are from different ANIs, then it will work. If you have many calls from the same ANI, then you will need to also check the date and time of the call in order to determine yours...
     
  6. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    Modified Code to avoid doing a loop

    Code:
            public string GetOriginalDestination(string ani, string dnis)
            {
                DN dn = PhoneSystem.Root.GetDNByNumber(dnis);
                ActiveConnection[] activeConnectionArray = dn.GetActiveConnections();
    
                var activeConnection = activeConnectionArray.FirstOrDefault(ac => ac.ExternalParty == ani);
    
                if (activeConnection == null)
                    return String.Empty;
                else
                    return activeConnection.DialedNumber;
            }
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    The dialed number property on the object is BLANK.

    Is there something in the SIP settings for the Trunk that has to be set for the value to show up?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    I've been doing some tests, and maybe you need to look into the AttachedData property. That property is a collection of information related to the call, try with that property.
     
  9. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    See screenshot attached for Visual Studio watch on the entire ActiveConnection object.

    The attached data doesn't have it either.
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    You may need to adjust the inbound parameters for your trunk. Try changing the values for the fields "To: User Part" or "To: Display Name". That could change the value 10002 in the screenshot to the dialed number.
     
  11. SWSDEV

    SWSDEV Member

    Joined:
    Feb 23, 2008
    Messages:
    256
    Likes Received:
    0
    We checked and we already have it set to "CalledNum".

    What else should it be set to?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Well it depends on how you're receiving the call from your trunk, but you may try with "CalledName" in case that field has the phone number. You're saying that it is confiugred with CalledNum, but currently you're receiving the 3CX port number. Try with that, or send a trace of the SIP INVITE message received by 3CX from the trunk.
     
Thread Status:
Not open for further replies.