change sip_nat.conf through SSH

Discussion in 'General' started by coryjsanders, Apr 17, 2010.

  1. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    I'm trying to edit my sip_nat.conf file. I am SSH into the box. I enter su asterisk and then I get a line that says bash-3.1$. Can someone tell me what to enter so I can get to my sip_nat.conf file? I need to changethe public IP someone else put in. Thanks.
     
  2. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    su means "switch user" but the asterisk user can't do a lot of things for good reason,

    just login as root (who can do anything) and

    vi /etc/asterisk/sip_nat.conf

    vi is probably the only editor you have and is a little esoteric in it's ui, so maybe

    yum -y install mc

    and then run "midnight commander"

    mc

    will leave you in a little less alien environment
     
  3. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    Okay. I got the blue screen on mc with two columns of files. Can't seem to find anything labled sip_nat.conf I was able to get to the black screen with my settings before following your direcitons and installing mc, but I could only delete the previous public IP. could not enter anything. Can you tell me how to get to sip_nat.conf in mc and then how to edit it if you don't think it is going to be obvious. Thanks, Dicko. I really appreciate your help.
     
  4. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    navigate to the root directory (successively going to the top line in the column and selecting it) then navigate down to etc, select it, then asterisk, then select sip_nat.cinf then F4 (edit).

    When you've done all that please find a tutorial on bash, it will help you understand the environment you chose to install, otherwise you will not so understand, and that is a bad thing.

    basically it's a RTFM scenario and will be for a while, but eventually you will "get-it"

    dicko
     
  5. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    okay. Did it. I am able to make calls to other extension behind my firewall no problem. I used the endpoint manager to set up the extensions. I have three Polycom phones, and total of 6 extensions set up on various lines. I have one line, ext. 2001, set to be my incoming route, with the radio button checked for extension and 2001 selected. I still can not receive an outside call or make one. One time it worked. It was very strange. I had just brought the pbx up, I dialed, and the extension rang. voice was going through no problem. The phone was actually programmed with the old public IP address in server.1.reg and the proxy. Then I changed the config files to the new public IP and it didn't work. Changed the route at my SIP provider. They just gave me this:
     
  6. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    These are my trunk details:

    type=friend
    trustrpid=yes
    dendrpid=yes
    host=thier public IP
    context=from-trunk
    canreinvite=no
    insecure=very
     
  7. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    Then you need to investigate how your inbound routes are set up (but more significantly how to handle the spurious e164 + at the beginning of the "INVITE" your carrier sends you, (other posts around here for that problem ) quick answer is to set up a catch all inbound route, I suggest you cuddle up with a copy of "Elastix Without Tears" for a few hours, it will hopefully be enlightening in many areas.

    regards

    dicko
     
  8. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    okay. So I got to the inbound route section in Elastix w/o Tears. Set my Inbound Route without the DID and CID and she rang! Watson, would you please come in here!

    Now I just have two problems. When I dial out it says, "All Circuits are busy." and, on one phone I have ext. 2000 and 2003 set up. I can dial out to the other extensions from 2000 and 2003, but I can not dial in to them from any of the other 4 I have set up.
     
  9. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    Good, Progress. Then hopefully when you have read the whole thing (maybe twice) you will be closer, if not there. There are many posts here also, use the search button, the chances are your questions have already been answered. Follow the KISS principle start of walking with one phone to one extension until you can run.

    dicko
     
  10. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    Okay, Dicko. Really appreciate the help. Going to have to bit the bullet and print out Tears. Lock myself in for the storm and read the whole thing, as you so patiently and politely keep urging. Cheers.
     
  11. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    You are welcome, I would note you are probably the first person here who thinks of me as patient and polite, I must do something about that :)

    But +1 karma to you for "getting it"

    regards

    dicko
     
  12. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    dicko, Interesting thing: I had my system up and working so I could make a call directly in to a phone (the Inbound Route I had set, going to an extension). I could 4-digit dial to each phone. Then I changed something on my Trunk and Outbound Route, and the phones wouldn't work anymore. I was extremely frustated. Put things back the way they were, still would not work. Left it alone over the weekend. Had the bright idea to reprogram the phones through my TFTP server on my laptop. Phonew rebooted, and volla, they were back to working. Somehow they lost registration to the server. I thiink it had somethig to to with the endpoint manager, because it says in Tears that it will configure the phones as the extension, that it assumes they are in a native state. If I am programming them myself it seems that there could be a corruiption somehow. Your thoughts?
     
  13. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    Normally one would set the phones to factory default, make sure the dhcp server is the only one running on your network ( or set option 66 (tftpserver) in your preferred dhcp server) and it should just work (within the bounds of what the "vendor" files contain) change the line in /etc/xinet.d/tftp to

    server_args = -s -c -vv /tftpboot

    ( service xinetd restart )

    and you can tail -f /var/log/messages to verify your phones are using your tftp server.

    dicko
     
  14. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    Okay. So a few things. Do want to work towards using the tftp server in my box. I want to tell you two things and ask you one thing.

    First tell: When my inbound route would not work on ext. 2001 (and it had previously worked fine), I deleted it and put it on another extension. It worked. The phone that had 2001 and 2002 on it (an IP450) could still not be dialed to, nor could you dial out. I tried a lot of stuff in its config files and rebooted several times. Then I copied the config data from another phone, pasted it over the 450s existing data, manually replaced all 2003 and 2004 to 2001 and 2002. She works. I think somethign got whacked out. It happened when I did something to my Trunk and Outbound Route. Seems strange.

    Second tell: I unplugged my WAN cable from my router to see if I could make calls behind the firewall with no Internet. Seemed to work. I programmed two lines to the address of my Elastix box and I could call back and forth to each other. Was trying to see if it was better to set the line registry in the Polycom's config file as the address of the Elastix box (192.168.1.101) instead of the Public IP of my cable modem/router's WAN setting.

    When I plug everything back in I have trouble. I can dial to some phones from some phones, but there is no consistency.

    What is the deal? Will this be solved if I boot from the Elastix box tftp server? If I do this, will the phones be able to update remotely? Outside of the firewall?
     
  15. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    I don't like to use the Endpoint Configuration Manager because it seems that it only supports one extension per phone. I like to use the multiple extensions per phone. Is that troule in Elastix?

    Also, Is there such a thing as shared line appearance in Elastix? I sell a hosted service powered by Metaswitch. You can put the same line registry details on two different phones, and set reg.x.type="shared" instead of "private" Then, when someone picks up the line on the phone you are monitoring, the light on your line lights. Let's you know if someone is on the phone. Good for the Polycom boxcar attachments that go with the IP650/670, and good for a secretary who wants to montitor her boss, if she has just a 2 or 3 or 4 or 6 line phone. Thanks!
     
  16. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    I suggested before you use one extension on one phone, a connection is a ip/port pair, if you have two connections using the same port and ip, it won't work, change the port on the second(snd third) extension.

    If you unplug your WAN and use sip, there might be a problem that asterisk will have a hard time getting over, you will need a local caching dns server to resolve you SIP providers ip if you use a name not an IP (whether you use that provider for the call or not) (plenty of posts here on that one too)

    The deal is all about the network infra structure, I suggest you spend some time getting up to speed on the basics.

    Finally any IP protocol can be routed, it is up to you to provide that routing, if you want to use tftp then it runs on UDP/69 there are however risks involved (the t in tftp stands for trivial), so only allow tftp connections from trusted networks.
     
  17. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    Seriously my friend you need to do more reading and less asking, all your questions have been asked and answered already, yes some phones can, and no some phones can't . google is your friend.

    dicko
     
  18. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    dicko. YOu suggust, "change the port on the second(snd third) extension." By this do you mean change the config files in the phones settings so that port on the second registry is 5062, the third 5063, and so on? If this is the case, how does this affect my SIP provider? He is sending me on 5060 only. I only have 5060 open in the firewall for UDP. Two seperate things? Ports behind the firewall and in front?

    I have the following in a phone:
    reg.1.server.1.address="public IP of my cable modem/router" reg.1.server.1.port="5060"
    reg.1.outboundProxy.address="public IP of my cable modem/router" reg.1.outboundProxy.port="5060"

    reg.2.server.1.address="public IP of my cable modem/router" reg.2.server..port="5060"
    reg.2.outboundProxy.address="public IP of my cable modem/router" reg.2.outboundProxy.port="5060"

    I hear you saying set the phones' config files like this:

    reg.1.server.1.address="public IP of my cable modem/router" reg.1.server.1.port="5060"
    reg.1.outboundProxy.address="public IP of my cable modem/router" reg.1.outboundProxy.port="5060"

    reg.2.server.1.address="public IP of my cable modem/router" reg.2.server..port="5062"
    reg.2.outboundProxy.address="public IP of my cable modem/router" reg.2.outboundProxy.port="5062"

    If this is the case, would the outbound proxy also go out on a different port?
     
  19. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    basically yes different ports for the extensions, freepbx must agree if you do it bass ackwards, but you need to more of a self starter, as I said before, all asked and answered already. Until then KISS, dont miss the

    http://voip-info.org./

    in my footer
     
  20. coryjsanders

    Joined:
    Mar 25, 2010
    Messages:
    181
    Likes Received:
    0
    Okay, Dicko. Went with one registration per phone. Had to manhandle my IP450. It just would not register. Had to take a known good config script from the config files I use with my Hosted VOIP provider, paste it into the registry of the affected phone, change the data to work with my Elastix switch, and it came up. Three phones and three lines. One Inbound Route working perfectly on one of them.

    Then you know what? I still couldn't get my outbound trunk working. Was reading over and over in Tears. Figured out by reading over the Dial Pattern that another trunk I had set up previously was causing trouble. The other Trunk had the same local outgoing rules/Dial Pattern, and I am not programmed with that provider. So Elastix was taking that Trunk first, and I was getting the nasty little message. I deleted the other trunk, and I made my first outbound call no trouble. I don't think I was ever as happy.

    Now on to the fun stuff.

    I'll need to revisit setting up the tftp server on my Elastix box with you. Going to need a little hand holding inbetween steps. Don't get too pissed at me. Thanks a million for hanging with me.

    Best regards. Cory

    By the way, when one addresses you, is it proper to capitalize the D in dicko?
     

Share This Page