Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
feat(integration): auto assign callpro user
Browse files Browse the repository at this point in the history
close #69
  • Loading branch information
Enkhtuvshin0513 authored and batamar committed Dec 16, 2019
1 parent 1c7387b commit 6770a31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pipeline:
branch:
- master
- develop
- staging
event:
- push

Expand Down
6 changes: 4 additions & 2 deletions src/callpro/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ const init = async app => {
app.post('/callpro-receive', async (req, res, next) => {
debugRequest(debugCallPro, req);

const { numberTo, numberFrom, disp, recordUrl, callID } = req.body;
const { numberTo, numberFrom, disp, recordUrl, callID, owner } = req.body;
const integration = await Integrations.findOne({ phoneNumber: numberTo }).lean();

if (!integration) {
debugCallPro(`Integrtion not found with: ${numberTo}`);
debugCallPro(`Integration not found with: ${numberTo}`);
return next();
}

Expand Down Expand Up @@ -107,6 +107,7 @@ const init = async app => {
payload: JSON.stringify({
content: disp,
conversationId: conversation.erxesApiId,
owner,
}),
},
});
Expand All @@ -128,6 +129,7 @@ const init = async app => {
customerId: customer.erxesApiId,
content: disp,
integrationId: integration.erxesApiId,
owner,
}),
},
});
Expand Down

0 comments on commit 6770a31

Please sign in to comment.