Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

PUSH TO TALK over Internet

Discussion in 'Multiplayer' started by mehrdad3dgs, Aug 8, 2018.

  1. mehrdad3dgs

    mehrdad3dgs

    Joined:
    Mar 17, 2015
    Posts:
    8
    HELLO ALL
    i want to make an push to talk project that works with internet connection.
    please help me.
    thanks a lot
     
    chgeorgiadis likes this.
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    There's several threads on sending voice data. Push to talk would just be taking an input to activate/deactivate the sending of voice data.
     
  3. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    How much experience do you have with talk over the internet? A simple SIP call would be sufficient. You can stop the udp stream when it's not active and start it again when the button is pressed.
     
  4. mehrdad3dgs

    mehrdad3dgs

    Joined:
    Mar 17, 2015
    Posts:
    8
    Could you send me a sample unity project?
     
  5. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    No, I don't have any such thing. I plan on implementing one in the next six months or so, but I've not done it yet.

    First off, do you know how to do communication over the internet? Are you having one of your clients be the host, or will you have public servers?

    Here is how I would handle something like this:

    Install a SIP engine on a public server. I've used an engine called Asterisk before, it's very easy to install and configure. It also has a REST interface for adding numbers, and most importantly, it's released under GPL.

    On each client, I'd create a SIP call leg. You'll need a SIP client library for this. It's a simple TCP socket on the server's port 5060. You send a REGISTER to tell the server where the phone is, then just wait for an INVITE.

    I'd have the host of your game send a conference call request to everyone else in the party to the public server. The Asterisk server will find everybody (it knows where they are from the REGISTER) and sends out the INVITE.

    Now what happens next depends on circumstance. If you only have two players talking to each other, there is no reason for Asterisk to be involved anymore, and it will get out of the way and directly connect the two phones. If, however, there are more players than that, the server must stay in the line of communication because it's responsible for sound mixing. You can however, transfer it to another asterisk server (probably one on your game host itself.)

    I worked in telecom for 5 years, the SIP protocol is very powerful, but can be difficult to understand if you've never done udp / low level socket stuff before.
     
    mehrdad3dgs likes this.
  6. mehrdad3dgs

    mehrdad3dgs

    Joined:
    Mar 17, 2015
    Posts:
    8
    i am a beginner to do this
    if have an sample project for me,was so good :-(
     
  7. Positivits

    Positivits

    Joined:
    Aug 9, 2018
    Posts:
    1
    I want to make similar push project, following topic.








    ----------------
    Qunb
     
    mehrdad3dgs likes this.
  8. mehrdad3dgs

    mehrdad3dgs

    Joined:
    Mar 17, 2015
    Posts:
    8
  9. mehrdad3dgs

    mehrdad3dgs

    Joined:
    Mar 17, 2015
    Posts:
    8
    please help me
    i could not solve this problem yet
     
  10. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    Where are you stuck? How far have you progressed in your Project, what Problem is keeping you back? It really helps if you could point to a specific issue you need help with. People here are kind and helpful, but they are unlikely to just write an entire application for you. Do your homework, research the subject, and write the required scripts to connect Clients, sample audio, package the data for Network Transfer. Then, when you get stuck, ask a specific question and you'll see lots of helpful answers.
     
  11. Slaghton

    Slaghton

    Joined:
    Sep 9, 2013
    Posts:
    139
    I found a simple push to talk script awhile back and tried it in a project. If I find it, ill edit/post it up.
     
  12. thejimbarnes

    thejimbarnes

    Joined:
    Jun 16, 2017
    Posts:
    15
    Why not just use discord and create your own channel that people can join
     
  13. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The majority of gamers use their own voice coms, such as discord or teamspeak. In game voice features end up largely used for throwing racist insults or otherwise to irritate other players. I wouldn't add this to a game unless I wanted to become the in game speech police.
     
  14. chgeorgiadis

    chgeorgiadis

    Joined:
    Jan 30, 2018
    Posts:
    51
    @newjerseyrunner What would you suggest for a SIP client library? I tried Ozeki (.dll) but it seems that is not be compatible with Unity 2018.

     
  15. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    Why would it not be compatible? A dll is a dll and doesn’t care what it’s attached to as long as it has a c binding. You probably just have to dlopen and dlsym yourself if there is no c# header.
     
  16. chgeorgiadis

    chgeorgiadis

    Joined:
    Jan 30, 2018
    Posts:
    51
    Sorry, you are right @newjerseyrunner , i didnt use the right words. Using the latest Ozeki in Unity 2018 i have the message :

    "Unloading broken assembly Assets/Plugins/OzekiSDK.dll, this assembly can cause crashes in the runtime"

    that i was meant as "not compatible". I have an asterisk server which works just fine (with X-lite and some other "softphones") but i can not make calls through Unity and i need to make a SIP client as you said. Any suggestions for SIP client?
     
    Last edited: Oct 15, 2018