Follow

Asterisk Configuration - IAX

Configuring IAX

  1. Go to https://admin.onsip.com and login. Go to the configuration tab and note your VOIP username and password. We use RSA keys for authentication purposes.

    If you haven't already saved the OnSIP public key, you can get it by doing the following from a shell prompt:
    cd /var/lib/asterisk/keys
    wget http://www.jnctn.com/jnctn.pub
    
    Edit /etc/asterisk/iax.conf, replacing MY_USERNAME and MY_PASSWORD in the "register => " statement below with your VOIP username and password.
    ; The "general" context should already exist in iax.conf
    ; Add a line to register with with Junction Networks
    ;
    [general]
    register => MY_USERNAME:MY_PASSWORD@iax.jnctn.net
    
    *** Please note that your VOIP password is not the same as the password you selected when you signed up for service and now use to access your account information via the OnSIP web site. You can find your OnSIP VOIP username and password by logging into the OnSIP web site athttps://admin.onsip.com and going to the configuration tab. ***

    Edit /etc/asterisk/iax.conf and create a user entry and a peer entry for Junction Networks.
    ;
    ; A context for incoming calls from Junction Networks
    ;
    [jnctn]                 ; <-- Name must be [jnctn]
    type=user
    auth=rsa
    inkeys=jnctn
    context=arbitrary-name  ; <-- Should match the context you
                            ;     are using in extensions.conf
    
    ;
    ; A context for outgoing calls to Junction Networks
    ;
    [jnctn_out]
    type=peer
    host=iax.jnctn.net
    username=MY_USERNAME
    secret=MY_PASSWORD
    
    *** Please note that your VOIP password is not the same as the password you selected when you signed up for service and now use to access your account information via the OnSIP web site. You can find your Junction Networks VOIP username and password by logging into the OnSIP web site athttps://admin.onsip.com and going to the configuration tab. ***
  2. Edit the /etc/asterisk/extensions.conf and add an extension which will send outgoing calls to OnSIP. For example...
    ; ---------------------------------------------------------
    ; This context is used to send all outgoing calls to
    ; Junction Networks for connection to the PSTN.
    ; ---------------------------------------------------------
    [outgoing]
    exten => _1NXXNXXXXXX,1,Dial(IAX2/jnctn_out/${EXTEN})
    exten => _1NXXNXXXXXX,2,Congestion()
    exten => _1NXXNXXXXXX,102,Busy()
    
    
    To provide your own caller-id number on outbound calls, add the following prior to the Dial line. (Renumbering the priority as appropriate)
    [outgoing]
    ; Enter CID line here
    ; for Asterisk 1.6 ONLY, also use Set(CALLERPRES()=allowed)
    exten => _1NXXNXXXXXX,1,Set(CALLERID(num)=15555551234)
    exten => _1NXXNXXXXXX,2,Dial(IAX2/jnctn_out/${EXTEN})
    exten => _1NXXNXXXXXX,3,Congestion()
    exten => _1NXXNXXXXXX,103,Busy()
    
    
    Most basic setups have the dial statement as position 1. In this case you need to move dial to position 2. Keep in mind, the number you enter for caller-id needs to be a valid 11 digit number (1[2-9]XX[2-9]XXXXXX).

    While we honor caller-id name, we cannot forward it to the PSTN so we cannot reliably deliver name information via caller-id. On the PSTN, the caller-id number is matched to the number database of the local telephone company to determine the name provided with caller-id.

    These examples assume that you are setting up a "generic" Asterisk configuration. The examples do not account for any conflicting entries already in your configuration files. Please edit your files accordingly.

    Add a context to your extensions.conf to process incoming calls. Here is an example which answers the call and reads back any digits you press.
    ; ---------------------------------------------------------
    ; [arbitrary-name] is the context referred to by the
    ; [jnctn] user in iax.conf.  This is where your
    ; custom incoming call processing should go.
    ;
    ; Replace 1NXXNXXXXXX in the exten => lines below with
    ; the DID you are subscribing to. If you are subscribing
    ; to multiple DIDs, add entries for each DID.
    ;
    ; For sample purposes, this section will read back the
    ; dialed number and then test DTMF by reading back each
    ; digit pressed by the caller.
    ;
    ;        *** International DID Subscribers ***
    ; Note that pattern, _1NXXNXXXXXX, in the exten => lines
    ; below will only match North American numbers. If you
    ; have subscribed to any International DID's, you will
    ; need to add appropriate extensions to match those DID's.
    ; ---------------------------------------------------------
    
    [arbitrary-name]  ; <-- Should match the context you have
                      ;     under [jnctn] in iax.conf
    
    exten => _1NXXNXXXXXX,1,Playback(beep)
    exten => _1NXXNXXXXXX,2,SayDigits(${EXTEN})
    exten => _1NXXNXXXXXX,3,Goto(testdtmf|s|1)
    
    ;
    ; This context is used by the sample [arbitrary-name]
    ; context above to read back each digit you press.
    ;
    [testdtmf]
    exten => s,1,Background(beep)
    exten => s,2,ResponseTimeout(60)
    exten => s,3,WaitExten(10)
    exten => _x,1,SayDigits(${EXTEN})
    exten => _x,2,Goto(testdtmf|s|1)
    exten => i,1,Goto(testdtmf|s|1)
    exten => t,1,Hangup
    
    
    
  3. Finally, remember to "reload" your Asterisk configuration. From a shell prompt you can type:
    asterisk -r -x "reload"
    
    At this point you should be able to confirm that you are registered with Junction Network for incoming calls. From a shell prompt you can type:
    asterisk -r -x "iax2 show registry"
    
    This should report your "State" as "Registered". If your "State" is "Rejected", return to step 4 and confirm that you have used the correct username and password.

    That's it. Once you've confirmed that you are receiving incoming calls, you should modify your dialplan to appropriately dispatch your calls.

Note: With an OS upgrade IAX is upgraded or patched. The new version of IAX requires a entry "requirecalltoken=no" The default is yes and IAX will not accept calls when set to yes.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk