Need Asterisk and Phonegmone help.

Discussion in 'PhoneGnome Support Forum' started by DocGizmo, Sep 15, 2008.

  1. DocGizmo New Member

    I have read and followed several posts related to connecting Phonegnome and Asterisk, but have not yet figured out the optimal setup for what I hoped I could do. First let me say I'm currently running the "PBX-In-A-Flash" setup of Asterisk which uses the FreePBX front end. What I hoped I could do is two things. First I would like to be able to place calls from the Phonegnome box using it's FXS (locally attached phone) port, and have it use the Asterisk outbound routes and trunks I have setup (link it was simply another SIP extension). The other think I hope to do is to use the Phonegnome's FXO (the PSTN phone line dial tone) port as an outgoing trunk to my Asterisk system.

    Using the blog from Phonegnomes web site I setup an ITSP in my Phonegnome box that connects to me Asterisk server. I used the settings in a trunk setup (incoming settings) setting the user context to the PSTN number. If I use the context of "from-internal" I can dial other internal extensions to the PBX, but when it uses my outgoing routes and trunks it fails to connect the 2 calls (I see it dialing out, but do not hear ring nor voice). If I use the context "from-trunk" any number I call (other than internal extensions which still work as before) end up calling back into my PBX as if the call was an incoming call from the outside world.

    Does anyone know the correct configuration to get these 2 (seemingly) simply things to work? I know this all is technically possible if the box was a generic SPA-3000, but not sure if the highly customized Phonegnome firmware they apply to the SPA-3000 does this. By the way, I do not know if it makes a difference, but the outgoing trunk to my PBX is a PSTN connected to a SPA-3102 I bought hoping to use as another Phonegnome box as soon as they had firmware for this box, and it works correctly when used from a standard SIP/IAX2 client (including the FXS port on the SPA-3102 as well).
  2. PhoneGnome Moderator

    It can be difficult to avoid looping here if PhoneGnome is setup to deliver calls to the asterisk server and the asterisk server is setup to deliver calls to PhoneGnome. The following info should help.

    General idea:

    1. calls from PhoneGnome phone (FXS) to your server will use the ITSP logic, as you note. This logic assumes the user is dialing per the dialing plan of the number associated with the phonegnome box. PhoneGnome ITSP settings define how PhoneGnome will "translate" this pattern to the dialing plan of the ITSP provider (in this case your asterisk peer). This is controlled by the "native country code" and "international dialing prefix" of the PhoneGnome ITSP settings. Basically, PhoneGnome first normalizes what the user dials to a full e164 number and then applies the ITSP logic rules to decide what pattern to send to the ITSP. If the country is the "native" code, then the number is passed without a prefix. If it is not the "native" country, then the number is prefixed with the "international dialing prefix" specified for the ITSP. In Asterisk language. this "pattern" that PhoneGnome ultimately sends to your server using the abive logic is the "extension" your Asterisk server will see.

    2. For calls from your Asterisk server to the PhoneGnome FXO port, you will send these calls using the SoftGnome SIP credentials for the account (see under Features / SoftGnome on My PhoneGnome). You must prefix the number/pattern with '##" and then whatever pattern you want to deliver to the FXO port to force PhoneGnome to pass the pattern to the FXO port untouched.

    Simplified setting idea/examples:

    For Gnome to Asterisk setup:

    sip.conf:

    Code:
    [6505557890]
    type=user
    context=gnome-in
    username=6505557890
    secret=SECRET
    host=dynamic
    dtmfmode=rfc2833
    disallow=all
    allow=ulaw
    allow=alaw
    It's important that the entry be named the same as your PhoneGnome number and the username also be that value (change the 6505557890 above to whatever your phone number is)

    Then create an ITSP entry at My PhoneGnome with the following settings:

    SIP Host: your_asterisk_server
    SIP Username: 6505557890
    SIP Password: SECRET
    Require domain in From header? No
    Domain:
    Require username in From header? Yes

    Depending on your asterisk server environment, you may also need

    canreinvite=no

    NOTE: The host value in the ITSP settings used above must use a real/public IP address. Your asterisk server must have a real IP address (not internal NAT address) for this to work.

    The calls will come to the "gnome-in" context in extensions.conf which should be a context that handles a NANP dialing plan. If you want to have PhoneGnome always pass the raw e164 number, set the "native country code" to 0 (zero) and make the "international prefix" blank (empty/null).

    Now, if the above ITSP is set on My PhoneGnome to handle long-distance and/or national calls, PhoneGnome will automatically attempt to place the acall through your sterisk server whenever a user dials such a number on the PhoneGnome phone (FXS).

    For placing calls from Asterisk to the Gnome FXO port, have Asterisk register using the SoftGnome credentials, e.g:

    sip.conf:

    Code:
    register => soft-39125014:SECRET@pgp01.televolution.net
    
    [soft-39125014] 
    type=peer   
    port=5060   
    fromuser=soft-39125014
    fromdomain=pgp01.televolution.net
    username=soft-39125014
    secret=SECRET
    auth=md5   
    host=pgp01.televolution.net
    dtmfmode=rfc2833
    context=from-gnome
    qualify=1200
    disallow=all  
    allow=ulaw
    allow=alaw
    Where "soft-39125014" and "SECRET" are the SoftGnome credentials for your account (replace with the values for your account from My PhoneGnome). Again, you may also need "canreinvite=no"

    Then, in extensions.conf, have some context/pattern mechanism to send calls to PhoneGnome via the above peer/registration such as:

    Code:
    [gnome-out]
    exten => _NXXXXXX,1,Dial(SIP/##${EXTEN}@soft-39125014)
    Hopefully, this helps get you going.