OpenWrt Forum Archive

Topic: releasing PBX (supporting Asterisk) interface for LuCI

The content of this topic has been archived between 6 Apr 2018 and 30 Apr 2018. Unfortunately there are posts – most likely complete pages – missing.

(1) OK, since you are using attitude adjustment, you should not need to use the *old* ipks provided above (perhaps they don't work very well anymore). You can build this very PBX package by selecting it in "make menuconfig". It should appear alongside all the other LuCI apps. There have been many fixes and improvements since I released the original ipk and source for testing.

(2) To get func_cut, you have to select it from "make menuconfig" as well. It's under Network-Telephony, along with all the other asterisk-related stuff. The resulting package for me is  asterisk18-func-cut_1.8.7.1-1_brcm47xx.ipk

(3) Finally, you should really simply make a direct calls between users for testing, not through google-talk, because any number of other things could be going wrong with google-talk. Lets say your users are 1111 and 2222. With the SIP client registered with user 1111, simply dial 2222 to ring the other user.

(4) I have not finalized the package dependencies of luci-pbx quite yet, but I agree it's time I did so. When you select luci-pbx, you should have all the necessary prerequisites selected automatically. It's on the TODO list!

(5) Here are a list of packages I have selected, which should help anybody building from trunk:

asterisk18
asterisk18-codec-a-mu
asterisk18-codec-alaw
asterisk18-func-cut
asterisk18-res-clioriginate

When you hit ENTER on the asterisk18 package, you get an additional list of chan and app packages. There I have the following selected:

asterisk18-app-authenticate
asterisk18-app-disa
asterisk18-app-setcallerid
asterisk18-app-system
asterisk18-chan-gtalk

I hope this helps! I agree that this should already be automatic, and I'm sorting all that out as I go along.

Cheers!

Oooh, that presents a problem...  I've not built anything OpenWRT related, whether firmware images or packages, so I'll have to learn how, before I'm able to proceed with this.  I've always just installed what's in the stock Repo.

Anyhow, I do appreciate your assistance, and will start looking into building from SVN in the next few hours!

Do you hang out in IRC?  I'm on there...

(1) Sorry, I only visit IRC when I'm doing work on the PBX front-end. I don't seem to have any free time lately, so I prefer to spend whatever time I do have actually coding this stuff up!

(2) Actually, I don't think you need to learn to build from SVN. You can find all the packages and images in the snapshots built daily from trunk:

http://downloads.openwrt.org/snapshots/trunk/

But if you prefer to build from source, by all means, learn! One more savvy person is never a bad thing for such a project big_smile

Cheers!

Well, after completely reflashing my router with yesterday's newest from that repo, the luci-app-pbx (now available from the repo) seems completely incapable of changing any of the asterisk config files according to it's settings.  It can, and did change firewall rules according to the external config, but none of the users, GV accounts and such could be set up.

On the other hand, before this major update, when the config's had been successfully saved, the same firewall rules did not permit WAN-side client registrations (still not sure why).  This was my major reasoning for the upgrade (hoping that the newest would fix this issue), and now, of course, nothing can be tested...

...at least not without manual configuration of all the asterisk GV and user account info, and I can't seem to remember how the configs that worked differed from those that are available in online how-tos.

So, I'm again attempting to find the correct settings for all of this, so that I can check to see if the firewall will permit the external registrations, and just wanted to notify you of the newest errors for further troubleshooting.

BTW, I did reinstall any and all asterisk and pbx packages, to no avail.  Nothing has changed, as far as the config files not being edited by the luci-app-pbx settings.  I don't know how it may have been, but I guess it's possible that it's PEBKAC-caused.  I'll continue doing what I am able, to troubleshoot.  If you have any hints, I'm all ears!!

edit:  After looking around a bit, I may have discovered something...  In the /tmp/ dir, there are currently 10 dir's called pbx.xxxxx.  Within these dir's, are .TMP and .conf files, that don't seem to be getting copied over to the correct places within the /etc/asterisk/ dir.  Not sure, as yet, why, but I thought it might be relevant.

edit#2:  Tried to chmod 777 /etc/asterisk/ -R (bad idea for long term, I know), and save changes again; No Go.  Then, uninstalled all asterisk and pbx related packages, deleted all dir's that the uninstalls left behind (most were empty), and reinstalled fresh again; Also No Go.  Not sure what else to do, and can't seem to figure out the manual config's, either.  I'm at a standstill, I'm afraid (mostly due to my own ignorance, granted), until this issue can be solved with the luci-app-pbx package.

(Last edited by tekoholic on 25 Nov 2011, 18:41)

@tekoholic,

Thanks for the report. It sounds like the /etc/init.d/pbx-asterisk script is exiting before it has a change to copy over the new config files. Please try:

/etc/init.d/pbx-asterisk restart

and see if it spits out any error messages.

I'll reproduce your set up and try it myself a little later today (hopefully I'll have time before the day is over). I had discovered and fixed a problem whereby the script was exiting if there is no pbx-voicemail configuration found. Perhaps the build which you downloaded and installed does not have my fix yet. To see if it has it or not, please run this command on the command-line:

grep exit /etc/init.d/pbx-asterisk

If you come up with output that reads "[ "$enabled" != "yes" ] && exit", then the version you have is the one before my fix! You can edit the /etc/init.d/pbx-asterisk file (with vi), and change the line to read:

    [ "$enabled" != "yes" ] && return

(note the change from exit to return). Otherwise, reinstall the luci-app-pbx package and check whether the line has changed. Eventially my changes should make it to the snapshot build.

OK, I just checked, and my change has indeed made it into the snapshot build. So simply reinstalling the package should fix that issue. Another problem I discovered is that the configuration did not contain default values for the RTP ports used by asterisk. This could make the asterisk configuration NOT in line with the firewall rules if those ports don't end up in the configuration file. Please check whether this file:

/etc/config/pbx-advanced

contains:

        option 'rtpstart' '19850'
        option 'rtpend' '19900'

and if not, add those two lines under the:

config 'settings' 'advanced'

section. Something tell me this should not have been a problem since to set up remote usage you have to hit "Save&Apply" in the Advanced settings page at least once, at which point those values *should* be introduced into the config file. However, for completeness sake, these options should be there.

Cheers!

@dancho,

IC you are heavily / actively developing this package. Wouldn't it be nice to have the source code hosted on any GIT (my preference) and/or SVN server for anyone who builds the package to retrieve the latest version?

mazilo: its part of the regular luci feed.

dancho wrote:

Thanks for the report. It sounds like the /etc/init.d/pbx-asterisk script is exiting before it has a change to copy over the new config files. Please try:

/etc/init.d/pbx-asterisk restart

and see if it spits out any error messages.

I'll reproduce your set up and try it myself a little later today (hopefully I'll have time before the day is over). I had discovered and fixed a problem whereby the script was exiting if there is no pbx-voicemail configuration found. Perhaps the build which you downloaded and installed does not have my fix yet. To see if it has it or not, please run this command on the command-line:

grep exit /etc/init.d/pbx-asterisk

If you come up with output that reads "[ "$enabled" != "yes" ] && exit", then the version you have is the one before my fix! You can edit the /etc/init.d/pbx-asterisk file (with vi), and change the line to read:

    [ "$enabled" != "yes" ] && return

(note the change from exit to return). Otherwise, reinstall the luci-app-pbx package and check whether the line has changed. Eventially my changes should make it to the snapshot build.

This was a problem, and once fixed, created another:

# /etc/init.d/pbx-asterisk restart
mv: can't rename '/tmp/pbx.xxxxx/inext.TMP': No such file or directory
mv: can't rename '/tmp/pbx.xxxxx/sip_regs.TMP': No such file or directory
mv: can't rename '/tmp/pbx.xxxxx/sip_peers.TMP': No such file or directory

/etc/config/pbx-advanced contained the lines expected, already.

Thanx, so much, for your help on this!  I do appreciate it, and hope that it is helpful to you and/or others, as well.

edit:  In addition to the 3 errors shown above, the status page for the PBX module shows any google talk account as disconnected.  Not sure where to look for further diagnostic info, but still banging on it!

(Last edited by tekoholic on 28 Nov 2011, 15:52)

tekoholic wrote:
# /etc/init.d/pbx-asterisk restart
mv: can't rename '/tmp/pbx.xxxxx/inext.TMP': No such file or directory
mv: can't rename '/tmp/pbx.xxxxx/sip_regs.TMP': No such file or directory
mv: can't rename '/tmp/pbx.xxxxx/sip_peers.TMP': No such file or directory

This is not an error per-se. You simply don't have any SIP accounts configured. Things should be working.

tekoholic wrote:

Edit:  In addition to the 3 errors shown above, the status page for the PBX module shows any google talk account as disconnected.  Not sure where to look for further diagnostic info, but still banging on it!

On the command-line, run the command:

  rasterisk

and in the asterisk console that starts, type in:

  jabber show connections

Paste the result of that here.

Also, look for any errors that may be popping up as you sit idle in the asterisk console, and paste those here too.

Didn't need to do any more than just run asterisk -r, got the following error repeatedly, for each account attempted:

[Nov 28 17:33:01] ERROR[14428]: res_jabber.c:3123 aji_initialize: JABBER ERROR: No DNS gtalk-user_gmail_com for client to  talk.google.com

The only thing changed about that line was the work "user" in gtalk-user-gmail...  Where user is, username was, but ALL else is quoted (time-stamp changes, of course).

edit:  Router's DNS servers are set as 8.8.8.8 and 8.8.4.4, so you'd think that it'd be able to resolve a google address...  Sorry, this shoulda' been included in first post...

(Last edited by tekoholic on 28 Nov 2011, 18:40)

@tekoholic,

Well here is the real question: Can you resolve talk.google.com on the commandline?

Try:

  host talk.google.com

and/or

  nslookup talk.google.com

and tell us the result. Also, can you please post the contents of:

cat /etc/resolv.conf

Thanks.

OK, very odd...

# host talk.google.com
-ash: host: not found
# cat /etc/resolv.conf 
search lan
nameserver 127.0.0.1
root@AP-1:/etc/config# nslookup talk.google.com
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost

Name:      talk.google.com
Address 1: 2001:4860:b007::7d iy-in-x7d.1e100.net
Address 2: 209.85.225.125 iy-in-f125.1e100.net

Can you please do me a favor and restart asterisk on the commandline and see if the DNS error goes away? It could have come up before DNS was ready and gotten stuck in a state where it can't resolve names. I reported a similar problem in the sip module to Digium and they corrected it in 1.8.7, but perhaps jabber also suffers from the same or similar bug in 1.8.4.

/etc/init.d/asterisk restart

Did that, and no go.  However, I think I may have discovered the issue:

When I pasted that error in, I ONLY changed the username.  I did not change the address, which seemed to me to have an additional space preceding it in the error.  I just went to the Diagnostics page of LuCI, and from there, pinged "talk.google.com" successfully (error is still present in asterisk).  I then attempted to ping " talk.google.com", and got an instantaneous "Bad Address Specified" error.

If you can lead me to the file within which that address is specified, I bet ditching the excessive space kills the error!!

@tekoholic:

Simply run this command:

grep talk.google.com /etc/asterisk/*

and you'll get a list of all the locations where it's specified.

Cheers,
Iordan

Well, unfortunately, that did not help.

The only file within which the address is specified has it (seemingly) correct:

/etc/asterisk/jabber_users.conf =

[gtalk-user_gmail_com]
type=client
serverhost=talk.google.com
username=user@gmail.com/Talk
secret=password
timeout=150
status=away
statusmessage="Online for VOICE ONLY, may lose messages"

So, although I'm not sure of any of this, the address must be getting mangled elsewhere, if it's getting mangled at all.  I'm not sure what else to look for.  My PC's and phones, all of which utilize the router's internal DNS for their own resolution, can ping / log into talk.google.com, so I'm at a loss...

One last thing to try. Drop a file called dnsmgr.conf in /etc/asterisk/ with these contents:

[general]
enable=yes              ; enable creation of managed DNS lookups
                        ;   default is 'no'
refreshinterval=60      ; refresh managed DNS lookups every <n> seconds
                        ;   default is 300 (5 minutes)

Then, restart asterisk with /etc/init.d/asterisk restart

Unfortunately, that seems to have had no immediate effect.

edit:  Waited 30 minutes, no apparent changes.  Un / Reinstalled all relevant packages, cleaned up all files that were not deleted by the uninstalls, etc...  I'll wait for next updates.

(Last edited by tekoholic on 29 Nov 2011, 00:38)

@tekoholic:

I built OpenWRT from trunk (I have to for my routers, because I need the proprietary Broadcom drivers), but the source for the PBX is the same as what's used to build the snapshots. I tried to reproduce your problem, but I can't. I put in the Google DNS servers in Network->Interfaces->LAN, and asterisk still happily authenticates to talk.google.com. I tried adding the servers after the LAN IP of my router, and also after the LAN IP of my router, but neither seemed to break anything! I am getting my outside address via DHCP, but here is a report from another guy on a different platform with a problem that looks very similar to yours:

http://forums.plugpbx.org/index.php?topic=247.10;wap2

This is not a problem with the PBX interface, but something to do with asterisk and the network settings of your box.

@nikescar (and anybody else following this thread and willing to help out in testing)

a while ago you reported some issues with port fowarding. I am currently doing a from-scratch test with the latest PBX source available from the SVN repository (essentially, the code which is available in the OpenWRT snapshots. I've created two users and configured a Google Talk account. so far, I can call PSTN numbers with no trouble through the Google Talk account, and I can also make calls between my two configured user SIP accounts. What's more, both users are registered with Asterisk from a remote location (i.e. I am traversing the OpenWRT firewall successfully for both SIP and RTP).

Can you please try the latest snapshot version on your router, and see? Keep in mind that your settings will be wiped when you flash the snapshot version and you'll have to reconfigure.

http://downloads.openwrt.org/snapshots/trunk/

Alternatively, do an svn update in the OpenWRT trunk, update your feeds, and rebuild!

Thanks!

@dancho

OK, now I'm just embarassed (hopefully, it won't happen again!)...  I just decided to kill the whole setup, and start over.  This time (I know, I know...) I went with the jffs image, so that the overlay and the squashfs won't fight, and things are back up with minimal effort.

One thing I'll mention:  /etc/init.d/pbx... is NOT corrected in the latest available pkg, I had to edit it again.  However, now, I'm back up!!  Thanx for the help, and I'll let you know if I run into any other bugs!

edit:  Holy cow, apparently I spoke too soon...  Now, after just adding users, ONE GV account (that reg'd successfully until the users and the rest), and enabling external registration, the status page shows the following, without exception:

No                                                show                                              

No                                                

Channel              Location             State   Application(Data)             
0 active channels
0 active calls
0 calls processed

This happened before, while I was troubleshooting the other stuff, so I'll do a complete un/reinstall again, see about what is causing it.

(Last edited by tekoholic on 30 Nov 2011, 00:46)

@tekoholic:

My apologies. I only checked the brcm47xx luci-app-pbx package, and it was corrected. I guess not all the architectures are built at the same time. Eventually, all of them will have the fix.

Thanks for starting from scratch and verifying it works! Please try to stay up-to-date with the luci-app-pbx and luci-app-pbx-voicemail packages to help me test them if it's not too much trouble!

Cheers!

dancho wrote:

@tekoholic:

My apologies. I only checked the brcm47xx luci-app-pbx package, and it was corrected. I guess not all the architectures are built at the same time. Eventually, all of them will have the fix.

Thanks for starting from scratch and verifying it works! Please try to stay up-to-date with the luci-app-pbx and luci-app-pbx-voicemail packages to help me test them if it's not too much trouble!

Cheers!

1.  No apologies necessary.  Fact is, I feel like your apology is bass-ackwards; I should apologize to you, for all the time I've occupied (particularly with what may have turned out to be PEBKAC...).

2.  You're very welcome.  I'm no coder, but I try to do what I am able (I break stuff like no other!!), in the interests of getting bugs found / fixed!

3.  I'll continue, at your request, to assault ya' with anything further I find that might need fixin', with the pbx package, but I'm not sure if I'll ever have a reason to install the voicemail package in an operating environment.  All of our voicemail arrives with us via email, and is held on the GV servers until then.

I may take an old router, if / when I've got one that worx, and the time to undergo it, and make it a test-box, for this sort of purpose!



edit:  OK, I think we're in business...  Again, completely uninstalled all involved, reinstalled as clean as possible, and saved / applied one settings change at a time, checked status, then moved on to next.  I did change a few passwords to more commonly acceptable format, but otherwise, no changes were made to original settings.  Account stays reg'd, outbound calling worx clear as a bell, inbound isn't tested yet.

(Last edited by tekoholic on 30 Nov 2011, 02:35)

@tekoholic (and anybody else who will be using Google Voice for inbound calls):

One warning about inbound calls with Google Voice. At the moment, Asterisk's (and to some extent, I suppose Freeswitch's) implementation of the Goole Talk Jingle protocol seems to be a bit hacky and in flux. Hence, there are known issues with Asterisk and inbound Google Voice calls. This PBX creates the best possible configuration for such calls that I've been able to come up with after much research. I've tried all sorts of tricks and hacks, and this appears to have as good a success-rate in capturing inbound calls as I've been able to achieve. I and a lot of other people have reported the problem to Digium, but even if they are working on a better implementation of the jingle protocol, it won't make it into the version in use in OpenWRT (1.8.4.4) until it's upgraded. However, for the moment, I am not aware of a trouble-free fix even in cutting edge Asterisk versions.

Something that does work consistently is a service like IPKall, or Sipgate. Sipgate gives you a real US phone number and unlimited inbound calls. They also provide SIP settings, which should work great with this PBX. You would have zero trouble with inbound calls over SIP.

IPKall also gives you a real US phone number, but they don't give you SIP settings. They forward to an existing VoIP account, which the local users on your PBX are! For IPKall, once you sign up and log in, you need to give them as the "SIP Phone Number" either "s" if you want them to ring all users enabled for incoming calls, or "someusername" if you want only someusername to ring. For "SIP Proxy" you would give them your.domain.name:YYYY. You need to set up DDNS or have a domain name and a static IP address (if you have a static IP address, you can do away with domain names and just give the static IP). Also, YYYY is the port number you set up in "Advanced Settings"->"Remote Usage".

Just some ideas.

Sorry, posts 51 to 50 are missing from our archive.