Merge branch 'master' into outgoing-calls

This commit is contained in:
m5r
2021-08-30 06:58:00 +08:00
92 changed files with 6276 additions and 3211 deletions

View File

@ -52,13 +52,13 @@ async function getTwimlApplication(
}
const twimlApps = await twilioClient.applications.list();
const twimlApp = twimlApps.find((app) => app.friendlyName === "Shellphone");
const twimlApp = twimlApps.find((app) => app.friendlyName.startsWith("Shellphone"));
if (twimlApp) {
return updateTwimlApplication(twilioClient, twimlApp.sid);
}
return twilioClient.applications.create({
friendlyName: "Shellphone",
friendlyName: getTwiMLName(),
smsUrl: `https://${serverRuntimeConfig.app.baseUrl}/api/webhook/incoming-message`,
smsMethod: "POST",
voiceUrl: `https://${serverRuntimeConfig.app.baseUrl}/api/webhook/call`,
@ -77,4 +77,15 @@ async function updateTwimlApplication(twilioClient: twilio.Twilio, twimlAppSid:
return twilioClient.applications.get(twimlAppSid).fetch();
}
function getTwiMLName() {
switch (serverRuntimeConfig.app.baseUrl) {
case "local.shellphone.app":
return "Shellphone LOCAL";
case "dev.shellphone.app":
return "Shellphone DEV";
case "www.shellphone.app":
return "Shellphone";
}
}
export default setTwilioWebhooks;

View File

@ -30,6 +30,13 @@ const HelpModal: FunctionComponent<Props> = ({ isHelpModalOpen, closeModal }) =>
</a>{" "}
and we will help you get started!
</p>
<p>
Don&#39;t miss out on free $10 Twilio credit by using{" "}
<a className="underline" href="https://www.twilio.com/referral/gNvX8p">
our referral link
</a>
.
</p>
</div>
</div>
</div>

View File

@ -32,7 +32,7 @@ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
await session.$revoke();
return {
redirect: {
destination: Routes.Home().pathname,
destination: Routes.LandingPage().pathname,
permanent: false,
},
};

View File

@ -94,7 +94,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async ({ req, res }
await session.$revoke();
return {
redirect: {
destination: Routes.Home().pathname,
destination: Routes.LandingPage().pathname,
permanent: false,
},
};

View File

@ -133,7 +133,7 @@ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
await session.$revoke();
return {
redirect: {
destination: Routes.Home().pathname,
destination: Routes.LandingPage().pathname,
permanent: false,
},
};