PIONEERS Played with Kamailio?

Discussion in 'Developers' Corner' started by wardmundy, Jan 12, 2019.

Tags:
  1. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,432
    Likes Received:
    2,450
    Just getting started with Kamailio. Has anyone else played with this? If not, would you like to??
     
  2. kenn10

    kenn10 Guru-ish

    Joined:
    Dec 16, 2007
    Messages:
    770
    Likes Received:
    96
    Never played with it but it does have the internal plumbing to support shared call appearances. It would be an interesting front-end for Asterisk or FreeSwitch.
     
  3. billsimon

    billsimon Experienced in Asterisk, FreePBX, and SIP

    Joined:
    Jan 2, 2011
    Messages:
    899
    Likes Received:
    272
    I have used its cousin, OpenSIPS, for a few years. It's very suitable as a SIP router, proxy, registrar, load balancer, protocol-adapter (TLS to UDP for example) and general SIP responder (responding to junk scans or OPTIONS packets for example).

    kenn10: it has the "internal plumbing" to do SIP. So whatever a shared call appearance is, if you can do it with SIP, then you could probably do it with kamailio or opensips. If you're just talking about multiple registration and stuff like that then you can do that easily with your Asterisk pbx using pjsip.
     
  4. kenn10

    kenn10 Guru-ish

    Joined:
    Dec 16, 2007
    Messages:
    770
    Likes Received:
    96
    @billsimon The type of shared call appearance to which I refer is "Key System" type functionality where multiple phones can register to an extension and the buttons light up for busy, hold, idle, etc. for subscribed phones on that extension. The boss/secretary type of function. This is a major business function lacking from Asterisk that no one seems to feel is important except for large businesses who end up utilizing Cisco or Avaya systems to have the feature. I see a lot of cloud business systems (Vonage, 8X8, Jive) offering the functionality now on a variety of Sip phones.
     
    wardmundy likes this.
  5. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,432
    Likes Received:
    2,450
  6. billsimon

    billsimon Experienced in Asterisk, FreePBX, and SIP

    Joined:
    Jan 2, 2011
    Messages:
    899
    Likes Received:
    272
    @wardmundy what are you hoping to do with kamailio?
     
  7. kenn10

    kenn10 Guru-ish

    Joined:
    Dec 16, 2007
    Messages:
    770
    Likes Received:
    96
    I think this could (and no doubt others have) scale Asterisk for multiple servers or cloud instances and provide a higher level of redundancy and load balancing. Unfortunately, its also another layer on top of FreePBX since you have to have trunks, stations, etc. set up in the Asterisk as well as in the Siremis/Kamailio arrangement.

    I don't know if Siremis does this but it would be great to have an app that would remove or greatly reduce the need for FreePBX to setup the Asterisk server for extensions and trunks. I'm sure by now that @wardmundy has already been looking into all of this so I look forward to his comments.
     
  8. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,432
    Likes Received:
    2,450
    My initial thoughts are to leave Siremis out of the mix for now and create extensions, trunks, and routes on the Asterisk server which would be hidden from everything except Kamailio. Then use matching extension names and passwords on the Kamailio server where endpoints would be registered. All dialing from those endpoints would then be passed directly from Kamailio to Asterisk for regular processing just as you do today. If you want redundancy, just bring up a second matching Asterisk platform, and one line of code on Kamailio does the trick. Haven't got all of it working just yet, but so far, so good.
     
  9. krzykat

    krzykat Guru

    Joined:
    Aug 2, 2008
    Messages:
    1,368
    Likes Received:
    327
    Watching thread and anxious to see results. Have you considered fusionPBX for a redundancy? I am thinking for emergency failover only, not the full freePBX setup, but more the phones to be registered and ring groups that will allow for in / out calls while primary server is down??
     
  10. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,432
    Likes Received:
    2,450
  11. krzykat

    krzykat Guru

    Joined:
    Aug 2, 2008
    Messages:
    1,368
    Likes Received:
    327
    I first used OpenSER many years ago to do calling card applications in conjunction with A2B coupled with Asterisk with Joe Roper. There may be people that want to use it for billing of their Asterisk servers as well, and I don't know what @jroper is up to any more, but he may take an interest in your journey here.
     
    wardmundy likes this.
  12. billsimon

    billsimon Experienced in Asterisk, FreePBX, and SIP

    Joined:
    Jan 2, 2011
    Messages:
    899
    Likes Received:
    272
    I don't know whether Kamailio has this, but OpenSIPS has a feature called mid-registrar. (https://www.opensips.org/Documentation/Tutorials-MidRegistrar) This would eliminate having to set up your endpoints on the Kamailio server. Just pass through registration requests to Asterisk and if Asterisk agrees that the phone authenticated, then OpenSIPS considers it registered and stores the location at the proxy. This would also work well with your back-end redundancy plan.
     
    wardmundy likes this.
  13. ou812

    ou812 Guru

    Joined:
    Oct 18, 2007
    Messages:
    449
    Likes Received:
    68
    I'm having trouble registering a phone, I followed the instructions but I think there is a problem with my default settings as the logs say it's not configured,

    [email protected]:~# cat /var/log/syslog | grep kamailio
    Jan 14 15:14:49 register100 kamailio[2965]: Kamailio not yet configured. Edit /etc/default/kamailio first. ... failed!
    Jan 14 16:16:18 register100 kamailio[3491]: Stopping Kamailio SIP server: kamailio:.
    Jan 14 16:16:27 register100 kamailio: INFO: <core> [tcp_main.c:4745]: init_tcp(): using epoll_lt as the io watch method (auto detected)
    Jan 14 16:16:27 register100 kamailio[3503]: Starting Kamailio SIP server: kamailio:loading modules under config path: /usr/lib/x86_64-linux-gnu/kamailio/modules/

    my /etc/default/kamailio was copied from instructions and looks like this.

    #
    # Kamailio startup options
    #

    # Set to yes to enable kamailio, once configured properly.
    RUN_KAMAILIO=yes

    # User to run as
    USER=kamailio

    # Group to run as
    GROUP=kamailio

    # Amount of shared and private memory to allocate
    # for the running Kamailio server (in Mb)
    SHM_MEMORY=128
    PKG_MEMORY=4

    # Config file
    CFGFILE=/etc/kamailio/kamailio.cfg

    Not sure were I went wrong any help would be appreciated.

    Gary.
     
  14. ou812

    ou812 Guru

    Joined:
    Oct 18, 2007
    Messages:
    449
    Likes Received:
    68
    I set the time zone on the server and rebooted and the fail warning is gone from the logs, systemctl status kamailio looks good, but I still can't register, I turned off cloud firewall on this vps to make sure.
     
  15. ou812

    ou812 Guru

    Joined:
    Oct 18, 2007
    Messages:
    449
    Likes Received:
    68
    I believe now my issue was in creating a user, when I add user I get a access denied.

    ERROR 1045 (28000): Access denied for user 'kamailioro'@'localhost' (using password: YES)
    INFO: user '4500' already exists
     
  16. billsimon

    billsimon Experienced in Asterisk, FreePBX, and SIP

    Joined:
    Jan 2, 2011
    Messages:
    899
    Likes Received:
    272
    Use tcpdump to examine general network traffic. Try sngrep for SIP traffic specifically. Increase debug level in the kamailio.cfg so that you get more output to your syslog.
     
  17. ou812

    ou812 Guru

    Joined:
    Oct 18, 2007
    Messages:
    449
    Likes Received:
    68
    I am able to create users if I change /etc/kamailio/kamctlrc DBROUSER="kamailio" and corresponding password
     
  18. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,432
    Likes Received:
    2,450
    In Kamailio, it's the UAC Module. Other than Slide #17 on Mid-Registrar from Fred Posner, there aren't many clues for something well above my pay grade. I haven't been able to get it to work using the UACReg List in Siremis.
     
  19. dicko

    dicko Still learning but earning

    Joined:
    Oct 30, 2015
    Messages:
    555
    Likes Received:
    192
    If you want to dabble in using kamalio as a front end sip proxy , you might want to try dsiprouter

    https://github.com/dOpensource/dsiprouter

    It will do the grunt work of getting a basic kamailio system and provide you with a functioning GUI front end to aa kamailio proxy for any number of pbxes

    You can add siremis if you want but a full function pbx is perhaps better left to fusionpbx or freepbx
     
    #19 dicko, Jan 15, 2019
    Last edited: Jan 15, 2019
    wardmundy likes this.
  20. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,432
    Likes Received:
    2,450
    @dicko: Nice find! Very smooth install and setup except on CentOS 7 it kept erroring out on downloading the Kamailio packages from the repo so I manually installed them and then reran the installer. Worked like a champ. No glitches in the setup, and they support Skyetel which made configuring everything else a one-minute setup. HINT: $50 Skyetel credit still available on Nerd Vittles.

    On dSIPRouter:

    Carrier Groups: used defaults
    PBX/Endpoint: added one of our existing Incredible PBX VPS servers with its public IP address (write down assigned ID number)
    Domains: added the FQDN associated with the new dSIPRouter/Kamailio VPS; choose PassThru to PBX option with PBX ID number
    Inbound DID Mapping: added DID from Skyetel and mapped it to Incredible PBX VPS
    Global Outbound Routes: set default route to 1 which was Skyetel

    On the PBX:

    1. Added a trunk for Kamailio with the IP address of the dSIPRouter/Kamailio VPS:
    Code:
    type=friend
    port=5060
    nat=yes
    insecure=port,invite
    host=xxx.xxx.xxx.xxx
    disallow=all
    context=from-trunk
    allow=ulaw
    
    2. Added an outbound route pointing to the Kamailio trunk in step #1
    3. Added an inbound route for the 11-digit DID from Skyetel
    4. WhiteList the Kamailio VPS IP address with /root/add-ip

    Kamailio Packages (if you get errors on initial install, execute the following and rerun installer):
    Code:
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-xmpp-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-ldap-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-gzcompress-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-outbound-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-debuginfo-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-presence-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-unixodbc-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-utils-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-tls-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-mysql-5.1.6-16.el7.centos.x86_64.rpm
    yum -y install http://download.opensuse.org/repositories/home:/kamailio:/v5.1.x-rpms/CentOS_7/x86_64/kamailio-postgresql-5.1.6-16.el7.centos.x86_64.rpm
    
    WARNING WARNING WARNING: After you reboot, you'll need to add some entries to firewalld to get things working:
    Code:
    # nnnn for SSH port if you plan to change it
    # Do NOT change SSH port until after reboot, or you will be locked out!!
    firewall-cmd --zone=public --permanent --add-port=nnnn/tcp
    firewall-cmd --zone=public --add-port=nnnn/tcp
    # next two required to get web access to portal
    firewall-cmd --zone=public --add-port=5000/tcp
    firewall-cmd --zone=public --permanent --add-port=5000/tcp
    # next required to talk SIP
    firewall-cmd --zone=public --add-port=5060/udp
    firewall-cmd --zone=public --permanent --add-port=5060/udp
    
     
    #20 wardmundy, Jan 15, 2019
    Last edited: Jan 15, 2019
    krzykat likes this.