Jigasi and Twilio - can't connect to SIP trunk

What did you do to get Jigasi work with Twilio for outbound calls?

Was there any solution to this? I’m running into the same problem now. I can’t make the connection through Twilio’s settings.

@ealbers @CorporateComm
Unfortunately I haven’t found any solutions to this, yet.
Maybe @damencho could help us.

I just got twilio and Jitsi working for both inbound and outbound calls. I will try and write up a quick tutorial over the weekend

1 Like

@Jacob_Smith I’d be very interested in seeing your step by step for twilio integration. Trying to do the same thing myself, and frankly, I’m lost.

To connect calls coming in to your conference, you need to:

  1. Purchase a phone number from Twilio.
  2. Have a SIP domain (not SIP Trunking) registered. You will need to create an entry under the authentication section - I recommend the number that you purchased for the username.
  3. Create a TwimlBin named: ToSIPClient
    For initial testing, I recommend putting:
            <?xml version="1.0" encoding="UTF-8"?>
                <Dial answerOnBridge="true">

That will redirect the user to siptest conference room on your jitsi server (by default). We can change that later.

  1. When you install Jigasi, it will prompt you for your sip number during install. This is the full path of the number and the SIP domain you registered.
    Example: 15551234567@YOUR_SIP_NAME.sip.us1.twilio.com
    You will the enter the password you created in step 2.

  2. Restarting Jigasi should get you able to dial in to the default conference room.

To send to a custom conference room, you will need to update your ToSIPClient to something like:

<?xml version="1.0" encoding="UTF-8"?>
      	<Gather numDigits="8" action="YOUR_SERVER_ADDRESS_HERE">
          <Say>Please enter the 8 digit room code, followed by the pound key.</Say>

Then, wherever you send that action to, will receive a POST message with a parameter Digits that includes what the user entered. You can then find a conference / meeting, etc. based on however you “link” the two in your database. For us, we have “meetings” that include a Jitsi conference. Each Meeting object gets a random 8 digit number assigned to it. Then, when this endpoint is hit, we look up the meeting based on that 8 digit number, then return the following XML payload to Twilio:

            <?xml version="1.0" encoding="UTF-8"?>
                <Dial answerOnBridge="true">

You do need to update your jigasi sip configuration file to include:

Twilio only forwards headers that are prefixed with X- and, by default, Jigasi doesn’t look for headers prefixed with X-.

Please let me know if this helped or if there are further areas that could be clarified. Once I have a bit more time, I’d like to record a video walkthrough on a new server so I’m sure I hit all the steps and hopefully make it easier for people in the future. Let me know what further questions I can help answer!


Just put together a quick tutorial below - take a look and let me know if it helps or if I’m forgetting a few steps and need to go back through our config to see what I missed!

Hi @Jacob_Smith ,

Thanks a lot for the tuturial.
For outgoing calls, do you need do anything in twilio?

Best Regards,
Fernando Gomes

I’ll definitely be giving this a try this week. Thank you for all your hard work!

Yes, sorry, forgot that part of the flow!

You’ll want another TwimlBin called SipClientOutbound with the following:

<?xml version="1.0" encoding="UTF-8"?>
    <Dial answerOnBridge="true" callerId="{{#e164}}{{From}}{{/e164}}">{{#e164}}{{To}}{{/e164}}</Dial>

Then, on your number’s SIP Domain, paste the URL of your TwimlBin into the Voice Configuration Request URL field. That way, when Twilio gets the “message” from your SIP caller (in this case, Jigasi), it will run the TwimlBin which will then tell twilio to actually execute the call.

https://www.twilio.com/blog/registering-sip-phone-twilio-inbound-outbound was a great resource for me in figuring all of this out (well, that and a health amount of trial and error :laughing: and goes into some more detail on other ways to set things up).

By the way, would anyone be interested in a live walkthrough of setting this all up? I’m by no means an expert and still have to google / troubleshoot a bunch, but there hasn’t been a bunch of video documentation for jitsi / jigasi for a few years now. I figure we could do a live screenshare with questions and answers between anyone on the call and then upload it to YouTube to be a reference for people (heck, I want a reference for myself 6 months from now when I have to upgrade our server, haha (: )

1 Like

When you say “YOUR_SERVER_ADDRESS_HERE” what do you mean?

You have prosody with ldap auth? After I enable it, inbound calls fails.

Best Regards,
Fernando Gomes

@Jacob_Smith YOUR_SERVER_ADDRESS_HERE, I put the new TwiML bin address to process the response, and I see the correct request in jigasi, but i’ve the auth problem. If you have prosody with ldap auth, can you share?

Best Regards,
Fernando Gomes

We are not using LDAP Auth, so I’m not sure what the solution would be. Do you have any logs from Jigasi and/or Jicofo when an inbound call comes in?

Jigasi 2020-03-30 16:44:49.044 INFO: [509] org.jitsi.jigasi.SipGateway.incomingCallReceived().188 Incoming call received...
Jigasi 2020-03-30 16:44:49.045 INFO: [510] org.jitsi.jigasi.SipGatewaySession.run().1281 [ctx=15855830890442051914491] Wait thread cancelled
Jigasi 2020-03-30 16:44:49.046 INFO: [509] org.jitsi.jigasi.JvbConference.setXmppProvider().539 [ctx=15855830890442051914491] Using ProtocolProviderServiceJabberImpl(Jabber:39e7be66@meet.jitsi/39e7be66)
Jigasi 2020-03-30 16:44:49.105 INFO: [511] impl.protocol.jabber.OperationSetBasicTelephonyJabberImpl.registrationStateChanged().125 Jingle : ON 
Jigasi 2020-03-30 16:44:49.105 INFO: [511] org.jitsi.jigasi.JvbConference.registrationStateChanged().577 [ctx=15855830890442051914491] Registering XMPP.
Jigasi 2020-03-30 16:44:49.116 INFO: [511] impl.protocol.jabber.ProtocolProviderServiceJabberImpl.authenticated().2535 Authenticated: false
Jigasi 2020-03-30 16:44:49.118 INFO: [511] org.jitsi.jigasi.JvbConference.joinConferenceRoom().648 [ctx=15855830890442051914491] Joining JVB conference room: 1234
Jigasi 2020-03-30 16:44:49.122 SEVERE: [511] org.jitsi.jigasi.JvbConference.joinConferenceRoom().760 [ctx=15855830890442051914491]java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.rangeCheck(ArrayList.java:657)
        at java.util.ArrayList.get(ArrayList.java:433)
        at net.java.sip.communicator.impl.protocol.jabber.OperationSetMultiUserChatJabberImpl.getCanonicalRoomName(OperationSetMultiUserChatJabberImpl.java:658)
        at net.java.sip.communicator.impl.protocol.jabber.OperationSetMultiUserChatJabberImpl.findRoom(OperationSetMultiUserChatJabberImpl.java:316)
        at org.jitsi.jigasi.JvbConference.joinConferenceRoom(JvbConference.java:650)
        at org.jitsi.jigasi.JvbConference.registrationStateChanged(JvbConference.java:569)
        at net.java.sip.communicator.service.protocol.AbstractProtocolProviderService.fireRegistrationStateChanged(AbstractProtocolProviderService.java:187)
        at net.java.sip.communicator.service.protocol.AbstractProtocolProviderService.fireRegistrationStateChanged(AbstractProtocolProviderService.java:141)
        at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.connectAndLogin(ProtocolProviderServiceJabberImpl.java:1389)
        at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.connectAndLogin(ProtocolProviderServiceJabberImpl.java:970)
        at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.initializeConnectAndLogin(ProtocolProviderServiceJabberImpl.java:795)
        at net.java.sip.communicator.impl.protocol.jabber.ProtocolProviderServiceJabberImpl.register(ProtocolProviderServiceJabberImpl.java:500)
        at org.jitsi.jigasi.util.RegisterThread.run(RegisterThread.java:59)
Jigasi 2020-03-30 16:44:49.123 INFO: [511] org.jitsi.jigasi.JvbConference.stop().500 [ctx=15855830890442051914491] Removing account Jabber:39e7be66@meet.jitsi/39e7be66
Jigasi 2020-03-30 16:44:49.133 INFO: [511] impl.protocol.jabber.OperationSetBasicTelephonyJabberImpl.registrationStateChanged().132 Jingle : OFF 
Jigasi 2020-03-30 16:44:49.135 INFO: [200] org.jitsi.jigasi.SipGatewaySession.handleCallState().1138 [ctx=15855830890442051914491] SIP call ended: CallPeerChangeEvent: type=CallPeerStatusChange oldV=net.java.sip.communicator.service.protocol.CallPeerState:Incoming Call newV=net.java.sip.communicator.service.protocol.CallPeerState:Failed for peer=+xxx_my_number_xxx<+xxx_my_number_xxx@xxx_my_domain_xxx.sip.us1.twilio.com>;status=Failed
Jigasi 2020-03-30 16:44:49.135 INFO: [200] org.jitsi.jigasi.SipGatewaySession.sipCallEnded().629 [ctx=15855830890442051914491] Sip call ended: Call: id=1585583089043320554496 peers=0
Jigasi 2020-03-30 16:44:49.135 SEVERE: [200] org.jitsi.jigasi.AbstractGateway.notifyCallEnded().120 [ctx=15855830890442051914491] Call resource not exists for session.
Jigasi 2020-03-30 16:44:49.135 INFO: [200] org.jitsi.jigasi.SipGatewaySession.peerStateChanged().1204 null SIP peer state: Failed

but in jicofo it seems to work:

Jicofo 2020-03-30 16:50:47.756 INFO: [46] org.jitsi.jicofo.JitsiMeetConferenceImpl.log() Lip-sync enabled in 1234@muc.meet.jitsi
Jicofo 2020-03-30 16:50:47.757 INFO: [46] org.jitsi.jicofo.JitsiMeetConferenceImpl.log() Joining the room: 1234@muc.meet.jitsi
Jicofo 2020-03-30 16:50:48.209 INFO: [29] org.jitsi.jicofo.ChatRoomRoleAndPresence.log() Chat room event ChatRoomMemberPresenceChangeEvent[type=MemberJoined sourceRoom=org.jitsi.impl.protocol.xmpp.ChatRoomImpl@4d4afe25 member=ChatMember[1234@muc.meet.jitsi/b193a31f, jid: null]@1035462137]
Jicofo 2020-03-30 16:50:48.210 INFO: [29] org.jitsi.jicofo.JitsiMeetConferenceImpl.log() Member 1234@muc.meet.jitsi/b193a31f joined.

Anyone can help?

Best Regards,
Fernando Gomes

Did you set up a jicofo account for jigasi? That was one part I missed when doing my initial setup.


I think not, can you show me your example?

Best Regards,
Fernando Gomes

In your jigasi sip-communicator.properties file, make sure these values are uncommented and set.


Save, then run the following:

prosodyctl register jigasi yourdomain.com somepassword

May need to restart jicofo, prosody, and jigasi:

/etc/init.d/jicofo restart
/etc/init.d/prosody restart
/etc/init.d/jigasi restart


Yes I’ve this enabled with the docker default.

Best Regards,
Fernando Gomes

Had the same error (Index out of bounds) with a docker-jitsi-meet setup: https://github.com/jitsi/docker-jitsi-meet/issues/339

I could solve it by setting org.jitsi.jigasi.MUC_SERVICE_ADDRESS=muc.meet.jitsi in the jigasi sip-communicator.properties but am now stuck on not having audio in the call-in connection. I do not use twilio but sipgate.