Routing DID Numbers sent via DNIS over ANI

Discussion in '3CX Phone System - General' started by miroesq, Mar 3, 2011.

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

    Joined:
    Mar 2, 2011
    Messages:
    5
    Likes Received:
    0
    HI,

    I just downloaded 3CX and plan on just using the free version as this is for my home use. I had been using Trixbox/Asterisk and Fusionpbx/FreeSWITCH and have had some issues so wanted to try out 3CX. I am making and receiving calls, but am trying to get incoming calls to route based on DID. I have one primary number and two virtual numbers that are all forwarded to the same account by my VoIP provider (RNK Telecom) who is using an Asterisk System.

    My VoIP provider is forwarding the DIDs using DNIS over ANI. For the life of me, I can't figure out how to set this up. In 3CX I go to Generic VoIP Provider then to the DID tab and have added all three numbers there. Then I go to the Source ID tab and select "source Identification by DID" then I clicked on add and selected all and now all three DIDs are added to the small window. (I have read in other ports that I may have to add a wildcard to the beginning or end of the numbers). In the "SIP Field containing DID numbers" I selected "To: User Part"

    After clicking apply, the external number that I had inputed into the account details of the Generic VoIP Provider account shows up underneath the Generic VoIP Provider in the tree and the three DID numbers which I entered show up under this external number. For my purpose here, I will call this the TRUNK SECTION. (Please note that the external number or trunk is also one of the three DIDs which entered). In this section under "Office Hours", I selected connect to extension and I chose extension 732. I also checked off "same as office hours" as I do not want any time restrictions.

    I went to each of the three DIDs that were created under the external number and forwarded them each to different extensions. For my purpose here, I will call this the DID SECTION. Not sure what to put into the DID/DDI Name and DID/DDI number/mask so I tried putting different combinations in the two different fields and still all incoming calls continue to go to the same 732 extension.

    It seemed to me that since I had chosen to send all calls to extension 732 in the TRUNK SECTION, then the flow process would prevent the calls from going beyond this point thereby never making it to the DID SECTION to end up at the proper destinations. So I forwarded the calls to hunt group 7000 which had all extensions as part of the group, made a test call and all the extensions rang. Didn't think this would work at all, but I was desperate.

    Looking at the extension status I see the different DIDs when I make a call from an outside line, so I know my VoIP provider is passing along proper signals that are working. Although I have no idea where to go from here, I feel that the issue lies in the Inbound Parameters section and SIP Field containing DID numbers selection.

    Any help is highly appreciated. Thanks
     
  2. abc123

    abc123 Active Member

    Joined:
    Nov 9, 2009
    Messages:
    712
    Likes Received:
    1
    Can you either turn on verbose debugging or run a wireshark capture and then do an inbound call to one of the two virtual dids?

    We will be able to see from the invite request what your provider is sending and adjust accordingly.

    Also can you check your inbound rules? You should have one for each of the dids you mentioned. 3cx should have created the relevant mask for you (nothing in the first section, the full did in the second section, select the provider) and you just need to select where you want to send it to.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. miroesq

    Joined:
    Mar 2, 2011
    Messages:
    5
    Likes Received:
    0
    I do have inbound routes for each DID. Doesn't make sense to me that I would have to input a destination for the trunk, but maybe 3CX vets the DIDs before terminating the trunk. Please note that I have replaced my username and IP address with xxxxx and xxx.xxx.xxx.xxx

    03:45:31.453 [CM503003]: Call(1): Call to sip:732@192.168.1.200 has failed; Cause: 487 Request Terminated; from IP:192.168.1.732:5060
    03:45:31.450 [CM503003]: Call(1): Call to sip:731@192.168.1.200 has failed; Cause: 487 Request Terminated; from IP:192.168.1.731:5060
    03:45:31.447 [CM503003]: Call(1): Call to sip:733@192.168.1.200 has failed; Cause: 487 Request Terminated; from IP:192.168.1.733:5060
    03:45:31.349 [CM503008]: Call(1): Call is terminated
    03:45:27.956 [CM503025]: Call(1): Calling RingAll800:732Ext.732733Ext.733731Ext.731@[Dev:sip:731@192.168.1.731:5060]
    03:45:27.955 [MS210002] C:1.4:Offer provided. Connection(transcoding mode): 192.168.1.200:7004(7005)
    03:45:27.949 [CM503025]: Call(1): Calling RingAll800:732Ext.732733Ext.733731Ext.731@[Dev:sip:733@192.168.1.733:5060]
    03:45:27.948 [MS210002] C:1.3:Offer provided. Connection(transcoding mode): 192.168.1.200:7002(7003)
    03:45:27.943 [CM503025]: Call(1): Calling RingAll800:732Ext.732733Ext.733731Ext.731@[Dev:sip:732@192.168.1.732:5060]
    03:45:27.941 [MS210002] C:1.2:Offer provided. Connection(transcoding mode): 192.168.1.200:7000(7001)
    03:45:27.905 [CM503004]: Call(1): Route 1: RingAll800:732Ext.732733Ext.733731Ext.731@[Dev:sip:732@192.168.1.732:5060,Dev:sip:733@192.168.1.733:5060,Dev:sip:731@192.168.1.731:5060]
    03:45:27.879 [MS210000] C:1.1:Offer received. RTP connection: 216.143.130.111:49180(49181)
    03:45:27.877 [CM503010]: Making route(s) to <sip:800@192.168.1.200:5060>
    03:45:27.874 Remote SDP is set for legC:1.1
    03:45:27.874 [CM505003]: Provider:[Generic VoIP Provider -] Device info: Device Not Identified: User Agent not matched; Capabilities:[reinvite, replaces, able-no-sdp, recvonly] UserAgent: [Asterisk PBX] PBX contact: [sip:xxxxx@192.168.1.200:5060]
    03:45:27.869 [CM503001]: Call(1): Incoming call from 9147559223@(Ln.10000@Generic VoIP Provider -) to <sip:800@192.168.1.200:5060>
    03:45:27.745 [CM503012]: Inbound out-of-office hours rule (unnamed) for 10000 forwards to DN:800
    03:45:27.737 Looking for inbound target: called=xxxxx; caller=9147559223
    03:45:27.734 [CM500002]: Info on incoming INVITE:
    INVITE sip:xxxxx@xxx.xxx.xxx.xxx:5060;rinstance=e1c482736d764b5a SIP/2.0
    Via: SIP/2.0/UDP 216.143.130.36;branch=z9hG4bK6535.ef564503.0
    Via: SIP/2.0/UDP 216.143.130.111:5060;received=216.143.130.111;branch=z9hG4bK79314605;rport=5060
    Max-Forwards: 69
    Record-Route: <sip:216.143.130.36;lr=on;ftag=as2e9bf497>
    Contact: <sip:9147559223@216.143.130.111>
    To: <sip:xxxxx@216.143.130.36>
    From: "UNAVAILABLE"<sip:9147559223@216.143.130.111>;tag=as2e9bf497
    Call-ID: 7e33340736db60d605b37bd93b37aba5@216.143.130.111
    CSeq: 102 INVITE
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
    Date: Thu, 03 Mar 2011 01:45:21 GMT
    Supported: replaces
    User-Agent: Asterisk PBX
    Content-Length: 0

    03:45:07.250 Currently active calls [none]

    Thanks for the help
     
  4. abc123

    abc123 Active Member

    Joined:
    Nov 9, 2009
    Messages:
    712
    Likes Received:
    1
    The important information we need has been xxxxx'd out by you.

    However, it looks like you always blanked it out with 5 x's (xxxxx)

    The INVITE sip:xxxxx@xxx.xxx.xxx.xxx:5060 is what 3cx is using. If you are getting a user name and not the DID here then the problem is the voip provider. How can they expect you to use the did if they dont send it in the sip invite?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. miroesq

    Joined:
    Mar 2, 2011
    Messages:
    5
    Likes Received:
    0
    Well, the xxxxx is a username not a number. In fact when I tried putting it in the external number field, it would not take letters in the format, so I just put the primary number, even though that is not the way my provider works. Basically, the primary number along with all the virtual numbers are forwarded to this username at my IP address as follows:

    INVITE sip:xxxxx@xxx.xxx.xxx.xxx:5060;rinstance=e1c482736d764b5a SIP/2.0

    So this being the only invite string, then you are absolutely right. However, I do see my different virtual numbers in the log when I call into them from an outside phone, so perhaps I can route the calls not based on the DIDs themselves, but the DID number that comes in this heading:

    From: "UNAVAILABLE"<sip:9147559223@216.143.130.111>;tag=as2e9bf497

    So basically I need to figure out what is the context of the 9147559223 in that string. I saw custom variables and values in the Source ID tab so I'm thinking that's where the answer lies.

    Thanks
     
Thread Status:
Not open for further replies.