Author Topic: Setting up VoIP....  (Read 10934 times)

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Setting up VoIP....
« on: August 20, 2008, 05:47:17 am »
Guys

I started playing with VoIP a month or so ago after I signed up for my broadband provider's VoIP. I understand from previous comments (I think Zaerc or Thom) that SIP can be a little challenging to setup when you are routing over NATs - assuming this is because of the UDP component.

Anyway, I haven't done much so far except get a WiFi SIP phone connected to Asterisk (very nice) and making calls etc between the onscreen Orbiter and the phone. I setup a SIP trunk to my provider and had to guess the parameters a little bit because the terminology doesn't always match. And set up a route and connected one to the other. In the dial plan I am just using 9 for an external line and passing all the other numbers as is, so "9|."

My core connects directly to my broadband router's LAN port, the broadband router is running as a router (ie not bridging or using PPPoE, which I am not interested in) - I set the router up with a "Virtual Server" (basically a NAT) for the SIP port and disabled the SIP functionality on the router (otherwise it intercepts the traffic and doesn't let you set up the NAT!). The NAT points to the core's external interface. And I configure the core's firewall to allow that traffic.

Essentially, I cannot place calls. Whilst tinkering I got various errors depending how I called. Sometimes I just came back with an announcement that the number doesn't work as dialed, or a message saying there was network congestion, etc.

So I called my provider, 1) to check if they had any experience setting up Asterisk on the parameters for their network (not really, except that they said it had been hard in the past!), and 2) to ask them to check their logs to see if my traffic is even getting to them.

Interestingly, their logs indicated they could see me placing lots of calls and could even tell me the numbers I was attempting to call. BUT, he said that the logs suggested that they were successful... they clearly were not, so I'm not sure how to interpret that!

Can anyone out there make any suggestions on the NAT'ing and other configuration that might help - I'm assuming that it is just a problem with the NAT side of things...

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Setting up VoIP....
« Reply #1 on: August 20, 2008, 02:59:53 pm »
Guys

I started playing with VoIP a month or so ago after I signed up for my broadband provider's VoIP. I understand from previous comments (I think Zaerc or Thom) that SIP can be a little challenging to setup when you are routing over NATs - assuming this is because of the UDP component.

Anyway, I haven't done much so far except get a WiFi SIP phone connected to Asterisk (very nice) and making calls etc between the onscreen Orbiter and the phone. I setup a SIP trunk to my provider and had to guess the parameters a little bit because the terminology doesn't always match. And set up a route and connected one to the other. In the dial plan I am just using 9 for an external line and passing all the other numbers as is, so "9|."

My core connects directly to my broadband router's LAN port, the broadband router is running as a router (ie not bridging or using PPPoE, which I am not interested in) - I set the router up with a "Virtual Server" (basically a NAT) for the SIP port and disabled the SIP functionality on the router (otherwise it intercepts the traffic and doesn't let you set up the NAT!). The NAT points to the core's external interface. And I configure the core's firewall to allow that traffic.

Essentially, I cannot place calls. Whilst tinkering I got various errors depending how I called. Sometimes I just came back with an announcement that the number doesn't work as dialed, or a message saying there was network congestion, etc.

So I called my provider, 1) to check if they had any experience setting up Asterisk on the parameters for their network (not really, except that they said it had been hard in the past!), and 2) to ask them to check their logs to see if my traffic is even getting to them.

Interestingly, their logs indicated they could see me placing lots of calls and could even tell me the numbers I was attempting to call. BUT, he said that the logs suggested that they were successful... they clearly were not, so I'm not sure how to interpret that!

Can anyone out there make any suggestions on the NAT'ing and other configuration that might help - I'm assuming that it is just a problem with the NAT side of things...
My best bet would be to study about Asterisk - there is useful site called

http://www.voip-info.org/wiki/view/Asterisk&utm_source=voip-info&utm_medium=pbox&utm_campaign=pbox1&utm_content=Asterisk

The answer to your problems probably lie in logs (look at /var/log/asterisk...)

HTH,

Regards,

Bulek.
Thanks in advance,

regards,

Bulek.

jeangot

  • Guru
  • ****
  • Posts: 233
    • View Profile
Re: Setting up VoIP....
« Reply #2 on: August 20, 2008, 11:27:12 pm »
Hello,

Bulek is right, you have to start in Asterisk. Run:
asterisk -r
from a ssh session in the core, then type "sip debug" which will enable sip debugging (possibly deprecated command, but still works). Then when you make a call, you will want to watch for the "INVITE" message being sent from your core to your Voip provider (as opposed to the one from your internal phone to the core). There you need to see what number string you are sending to the provider and compare this to how the provider expects the calls (for example do they need a leading 1 for USA, or not).
Until you don't see the calls being sent out in the right format, it will not work, and this is a dialplan problem. Only once the calls are going out in the right format, then you may be facing provider issues or NAt issues (unlikely because Asterisk should handle all that properly).

Who is your provider by the way?

Jean

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Setting up VoIP....
« Reply #3 on: August 22, 2008, 09:10:34 am »
Hello Colin,

I started playing with VoIP a month or so ago after I signed up for my broadband provider's VoIP. I understand from previous comments (I think Zaerc or Thom) that SIP can be a little challenging to setup when you are routing over NATs - assuming this is because of the UDP component.

a couple of notes:
  • Because you do NAT, please read the note regarding NAT on the wiki http://wiki.linuxmce.org/index.php/1&1  Especially the part about externhost and localnet
  • You should try to use the automatic phone lines setup in the web admin page, and not play with the SIP settings manually
  • As far as I know, the built in dialplan already asked for a 9 to be dialed for an outside line

Basically, the default SIP phone line wizard works fine. If you do NAT, there is some additional configuration that you have to take care of.

hth
regards
Oliver

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #4 on: August 22, 2008, 11:12:06 pm »
Thanks all for the replies - will get on to this.

Oliver - quick question. Would love just to use the wizard, but there are only a handful of VoIP providers there, and certainly no Australian ones, so its not really an option! Whatever happened in the opening up of this? Ages ago there was a plan to add the basic parameters for lots more providers, but then I recall the approach changed from having a custom script do all the work to abstracting the providers' data into a separate file from the script to make it much easier to add new providers.

After that I don't recall seeing any more and RC2 just looks like the same providers in the setup wizard...

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #5 on: August 22, 2008, 11:45:10 pm »
Oliver - another question! In that wiki article it asks you to put those config lines in the [global] section, but there isn't one. There is only one section called [general].... what do I do?

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #6 on: August 23, 2008, 03:00:05 am »
Curiouser and curiouser!

Haven't played with telephony for several weeks and was just above to restart, hence this topic. Now I have, seems I can make outbound calls after all.... no idea what changed.

However - the call connects (no Caller ID even though I have set it in the trunk and extension) but the line is absolutely dead - no sound whatsoever in either direction. I found some config advice for Freepbx and my provider and used that. Then the call cannot complete and in the log it says it can't find something to do with audio (can't remember the exact message) - assumed this was to do with the codec, so I removed disallow=all and left in allow=g729 (both of which came from the advice) and set the SIP phone to G729.

Now I can make calls again, but still no sound at all... and no messages in the log that are obvious (even/especially with debug turned on!)

The other thing is I cannot make inbound calls at all. But I am clearly getting through to the core because I can see debug events with my mobile phone number coming from my provider's IP addresses, and I can hear the "The number you have dialed is not in service" message coming from Asterisk (I know it is Asterisk because clearly QoS is not setup correctly and it is all distorted, plus its an American accent, and I'm in Australia)

This last bit, to me, suggests there is still a codec issue as some audio at least can get down the line, even if it is just Asterisk telling me it can't complete the call!

I have an inbound route that has the DID and CID matching fields blank, which apparently means it will accept all calls. And the Set Destination is set to send the call to the extension I am testing with....

Any thoughts on either the audio issue or the inbound call issue??

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #7 on: August 23, 2008, 04:44:17 am »
OK, got an inbound call working only by setting the Allow anonymous inbound SIP calls setting in the general settings section... The help on that suggests that this might be bad by allowing anyone to initiate a call with me (although my NATs wouldn't allow that).. should I be concerned? Why is the call not authenticated?

Still have the audio issue though, but it seems to have changed slightly (or more likely my understanding of it after testing!)

Both inbound and outbound calls connect (Caller ID only works on inbound calls), but no audio at all in either direction....

But this is the kicker - if I put my SIP phone on hold, suddenly I can hear the on hold music on my mobile phone. If I unhold, audio comes to life perfectly in both directions! This is true whether the call is inbound or outbound initiated...

Smacks of NAT issues again... Have been searching around but still can't find a certain answer on what ports I should be forwarding to the core (don't really care that this is an open forward at this stage, I trust the core's firewall!) Have forwarded SIP on UDP/5060, but what about RTP? One doc suggested ports 8766-35000, assuming UDP only. Didn't make any difference, and the audio still works after the hold/unhold thing even without any RDP, so I'm assuming it is somehow initiating the stream outbound irrespective of the bound-ness of the call...

Please can someone enlighten me???

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #8 on: August 23, 2008, 08:18:28 am »
Final update for the day - after much messing around, with firewall rules (RTP on ports 10000-20000), and setting the externip, etc. It finally all sprang to life. Both inbound and outbound calls worked perfectly, and audio in both directions.

Then realised that I had added the extension directly into Freepbx so LMCE knew nothing about it. It didn't seem to mind and would happily receive calls from the extension, just didn't present it as an option anywhere.

So I decided that as it was the general config (sip.conf and sip_nat.conf and sip_additional.conf) and the firewall rules I had been playing with, not the extensions. I would just remove the extension I added directly. And add a device in LMCE properly (as I have done before). After a few reloads and regens, I got LMCE to accept the device and auto-create the extension in Freepbx again. Calls still working.

So I decided to do a full reboot, just to make sure everything was OK. Bang! No outbound calls now (all circuits busy) but inbound calls work perfectly, CallerID and everything!!!

The "full" log is now logging events in debug mode saying something about authentication:

[Aug 23 15:50:16] NOTICE[9045] chan_sip.c: Failed to authenticate on INVITE to '
"pl_40" <sip:0290432xxx@sip.internode.on.net>;tag=as7e3f4931'

and


<------------->
[Aug 23 15:50:16] VERBOSE[9045] logger.c: --- (6 headers 0 lines) ---
[Aug 23 15:50:16] VERBOSE[9045] logger.c:
<--- SIP read from 203.2.134.1:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 150.101.201.169:5060;received=150.101.201.169;branch=z9hG4bK1a5
20ea9;rport=5060
From: "pl_40" <sip:0290432XXX@sip.internode.on.net>;tag=as7e3f4931
To: <sip:0419405XXX@sip.internode.on.net>;tag=1217283924-1219470616155
Call-ID: 4f6d36bb679d4b6338bdb5295a9d67f1@sip.internode.on.net
CSeq: 102 INVITE
WWW-Authenticate: DIGEST qop="auth",nonce="BroadWorksXfk7tbhi3Tu55bdiBW",algorit
hm=MD5,realm="BroadWorks"
Content-Length: 0


<------------->

???
« Last Edit: August 27, 2008, 04:49:04 am by colinjones »

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #9 on: August 27, 2008, 01:46:31 am »
does this error message mean anything to anyone?

jeangot

  • Guru
  • ****
  • Posts: 233
    • View Profile
Re: Setting up VoIP....
« Reply #10 on: August 27, 2008, 02:03:55 am »
Colinjones,

presumably internode/Broadworks is your voip provider, yes?
If so, what this means is that they did not accept your request to authenticate in their sip proxy. Could be because of another registration waiting to time out, but judging by the time between your messages, I would doubt that.
So the most obvious reason would be to double check once again the login and password you supplied for your voip provider line. First in LMCE, and if that doesn't help, then maybe in AMP?
A let obvious reason could be that your voip provider blocked you if you're out of funds or something?

In AMP you should see in the overview that the "trunk" for outbound calls is "offline", becuase of the problem above, and the consequence obviously is that you cannot make outbound calls.

When I had similar problems (but caused mostly by a bugged sip proxy), doing a "reload" from the asterisk console (asterisk -r) would sometimes help, as asterisk would try to negoatiate the authentication again from scratch with the sip proxy.

Jean

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #11 on: August 27, 2008, 02:53:05 am »
Jean - thanks for helping!

No idea who Broadworks is, but Internode is my VoIP (and ISP) provider, yes. I agree it does look like they are rejecting my connection attempts, however 1) I can make inbound calls, no problem and 2) it was working perfectly for inbound and outbound for hours, so I decided to reboot and as soon as I did that, outbound calls died.

I double checked the login and password and it definitely hasn't changed (it my phone number and my normal ISP password) from prior to the reboot. I check this in the FreePBX interface under Phones Setup in the admin console. Which I assume you meant by AMP, given that I am configuring my VoIP using the "manually" option in LMCE, is there another place I should be looking in for these details? You seem to suggest there is one for LMCE and one for FreePBX/AMP....

In the FreePBX System Status, it confirms that the (1) trunk is online and registered (2 different bar charts). Occasionally I see the registered bar drop to 0 and then go back to 1, which I assume is the trunk normally reregistering itself? When I attempt an outbound call and get the "all circuits busy" message, I see the "total active calls" and "total active channels" bar charts jump to 1. But the internal and external calls bar charts stay at 0.

When I try to make an inbound call, this succeeds and connects. Now I see the "total active channels" at 2, and both the "total active calls" and "internal calls" at 1. But "external calls" is 0.

The trunk seems to be in place, and for the life of me the dial plans are as before when it worked and seem to make sense (should be matching my calls), just doesn't dial out. If the authentication with my provider were the issue, wouldn't calls in both directions fail?? What else can I do to troubleshoot this?

jeangot

  • Guru
  • ****
  • Posts: 233
    • View Profile
Re: Setting up VoIP....
« Reply #12 on: August 27, 2008, 04:12:35 am »
Colinjones,

sorry it's really difficult to say what the problem is, since it's basically the voip provider who doesn't like you at the moment, and they are the best suited to say why.
There shouldn't be a different password in LMCE or FreePBX (which web admin seems to be called AMP). i just wasn't sure if you were in manual mode or not. In the normal mode, the password would be written by the user in the LMCE admin whcih would then write it into Freepbx, so if it's correct in freepbx, that's all that matters.
Did you try the "reload" at the asterisk console? This refreshes the sip proxy registration and has helped me in the past.

It seems that the "not authorized" message comes in response to your INVITE, so if you are really registered into Internode's servers (according to freepbx which shows the trunk as online), then there is a small possibility that Internode just doesn't like that particular call. I assume that dialing domestic calls with a leading 0 is the correct format expected by internode.
You did check that it was not a balance/credit issue with them, right? Did you try calling a different number? Maybe you could try an international call as well (in case it's a dialplan issue). They should expect those either starting with the country code (E164 format) or with a 00 in front (or whatever the correct code may be in your country for international access). If that works, then you will want to format your domestic calls into the same international format (by adding your own country code) and see if that helps.

Depending on how responsive their support is, you could simply ask them what they don't like about your calls, maybe it will enlighten us?

PS: I'm not completely sure if seing the registered trunk drop to 0 in FreePBX is normal or not, but I *believe* I've seen the same in my system on occasion.

Jean

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #13 on: August 27, 2008, 01:49:40 pm »
Strange! Thanks Jean, seem to have sorted it now, but not sure how... either a password issue with the provider (they swear blind that the password I was using successfully for days could not possibly have worked!) or the outbound trunk config required username attribute as well as the fromuser attribute, but again, it was working perfectly for days with only the latter... either way, I'm not screwing with it any more as it works now :)

Out of interest, should the Call routing section of the web admin actually be routing calls as it suggests, or does this not work when in "manual" mode, or have I messed it up by configuring parts manually? Obviously, setting up extensions/phones through the web admin rather than the FreePBX interface is necessary so that LMCE knows about them as devices and can do its stuff, but it isn't clear to me how much of the other configuration you can safely configure through the FreePBX. At the moment inbound calls just ring and ring and never divert in line with the web admin config. I know you can configure IVR through FreePBX as well, but don't want to get LMCE in a knot!
« Last Edit: August 27, 2008, 01:55:07 pm by colinjones »

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Setting up VoIP....
« Reply #14 on: August 27, 2008, 02:02:20 pm »
Actually another question about the LMCE call routing - given that it is by user, how can it know which user's rules to follow unless the IVR picks up first and asks the caller which user they are calling for? Does it have to be determined via the caller ID? or have separate indial numbers?