Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2021-246 17:26:03
Size: 248
Editor: Singpolyma
Comment: Stub page for sgx-twilio
Revision 6 as of 2021-247 14:46:51
Size: 2513
Editor: cpe6031973e8333-cm30b7d4bae370
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

Providing the below SGX services is not free; if you find them useful please consider supporting infrastructure costs [[https://liberapay.com/singpolyma/|on Liberapay]], [[https://www.patreon.com/singpolyma|on Patreon]], or by becoming a paying customer of [[https://jmp.chat|JMP]].
Line 6: Line 8:

== Inbound Calls ==

 1. In Twilio, go to `Develop > Explore Products > Elastic SIP Trunking` and create a new trunk with any name.
 2. In your new trunk go to Origination settings
 3. Add a SIP URI: `sip:user%5C40domain.tld%40cheogram.com@sip.cheogram.com` (replace `user` with your Jabber ID localpart and `domain.tld` with your Jabber ID domainpart)
 4. In the left panel under your trunk go to Numbers
 5. Top-right `Add a number > Add an existing number` and choose your number

Incoming calls to that number will now ring you on Jingle.

== Outbound Calls ==

 1. In Twilio, go to `Develop > Explore Products > Functions`
 2. Make a new function with any name, use this code:
    {{{
exports.handler = function(context, event, callback) {
  let twiml = new Twilio.twiml.VoiceResponse();
  if(event.From != "SIP URI FROM INBOUND SECTION ABOVE") {
    console.log("Bad from: " + event.From);
    twiml.hangup();
  } else {
    let tel = event.To.split("@")[0].replace(/^sip:/, "");
    twiml.dial({ callerId: "YOUR TWILIO NUMBER" }).number(tel);
  }

  return callback(null, twiml);
};
    }}}
 3. Save and "Deploy all" -- make a note of the function's domain name
 4. In Twilio, go to `Develop > Explore Products > Voice`
 5. In the sidebar under Manage pick SIP domains
 6. Make a domain with any name. Use an IP access control list with the IP `192.99.233.116`
 7. Set "A call comes in" webhook to `https://<function domain>/<function path>`
 8. Save
 9. Open Gajim or another client that support XML console and sent this XML in the console:

    {{{
<iq to="cheogram.com" type="set" id="cmd1">
 <command xmlns="http://jabber.org/protocol/commands" node="sip-proxy-set">
  <x xmlns="jabber:x:data">
   <field var="sip-proxy">
    <value>YOUR TWILIO SIP DOMAIN</value>
   </field>
  </x>
 </command>
</iq>
    }}}
 10. Disconnect and reconnect your Jabber account, you should now be able to place voice calls via Cheogram

Providing the below SGX services is not free; if you find them useful please consider supporting infrastructure costs on Liberapay, on Patreon, or by becoming a paying customer of JMP.

Run the register command on cheogram.com and enter gateway twilio.sgx.soprani.ca or chat with xmpp:cheogram.com bot and say register twilio.sgx.soprani.ca

Source: https://github.com/pesvut/sgx-twilio

Inbound Calls

  1. In Twilio, go to Develop > Explore Products > Elastic SIP Trunking and create a new trunk with any name.

  2. In your new trunk go to Origination settings
  3. Add a SIP URI: sip:user%5C40domain.tld%40cheogram.com@sip.cheogram.com (replace user with your Jabber ID localpart and domain.tld with your Jabber ID domainpart)

  4. In the left panel under your trunk go to Numbers
  5. Top-right Add a number > Add an existing number and choose your number

Incoming calls to that number will now ring you on Jingle.

Outbound Calls

  1. In Twilio, go to Develop > Explore Products > Functions

  2. Make a new function with any name, use this code:
    • exports.handler = function(context, event, callback) {
        let twiml = new Twilio.twiml.VoiceResponse();
        if(event.From != "SIP URI FROM INBOUND SECTION ABOVE") {
          console.log("Bad from: " + event.From);
          twiml.hangup();
        } else {
          let tel = event.To.split("@")[0].replace(/^sip:/, "");
          twiml.dial({ callerId: "YOUR TWILIO NUMBER" }).number(tel);
        }
      
        return callback(null, twiml);
      };
  3. Save and "Deploy all" -- make a note of the function's domain name
  4. In Twilio, go to Develop > Explore Products > Voice

  5. In the sidebar under Manage pick SIP domains
  6. Make a domain with any name. Use an IP access control list with the IP 192.99.233.116

  7. Set "A call comes in" webhook to https://<function domain>/<function path>

  8. Save
  9. Open Gajim or another client that support XML console and sent this XML in the console:
    • <iq to="cheogram.com" type="set" id="cmd1">
              <command xmlns="http://jabber.org/protocol/commands" node="sip-proxy-set">
                      <x xmlns="jabber:x:data">
                              <field var="sip-proxy">
                                      <value>YOUR TWILIO SIP DOMAIN</value>
                              </field>
                      </x>
              </command>
      </iq>
  10. Disconnect and reconnect your Jabber account, you should now be able to place voice calls via Cheogram

TwilioSetup (last edited 2022-198 00:17:59 by root)