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 SMS
Go to Develop > Phone Numbers > Manage > Active Numbers
- Click on the phone number you want to add
- Go to the Configure tab
Scroll down to 'Messaging' and change 'A message Comes in' to the url http://twilio.sgx.soprani.ca/sms
Inbound Calls
In Twilio, go to Develop > Explore Products > Elastic SIP Trunking and create a new trunk with any name.
- In your new trunk go to Origination settings
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)
- In the left panel under your trunk go to Numbers
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
In Twilio, go to Develop > Explore Products > Functions
- 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); };
- Save and "Deploy all" -- make a note of the function's domain name
In Twilio, go to Develop > Explore Products > Voice
- In the sidebar under Manage pick SIP domains
Make a domain with any name. Use an IP access control list with the IP 51.161.87.91
Set "A call comes in" webhook to https://<function domain>/<function path>
- Save
- 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>
- Disconnect and reconnect your Jabber account, you should now be able to place voice calls, and send/receive SMS via Cheogram.