Skip to content

Commit

Permalink
Temporarily remove fault status for kannel channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Apr 12, 2024
1 parent 59df0a8 commit 8e14de2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
18 changes: 9 additions & 9 deletions handlers/kannel/kannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,22 @@ func (h *handler) Send(ctx context.Context, msg courier.Msg, clog *courier.Chann
return nil, err
}

var resp *http.Response
// var resp *http.Response
if verifySSL {
resp, _, err = handlers.RequestHTTP(req, clog)
_, _, _ = handlers.RequestHTTP(req, clog) //_,resp,err
} else {
resp, _, err = handlers.RequestHTTPInsecure(req, clog)
_, _, _ = handlers.RequestHTTPInsecure(req, clog)
}

status := h.Backend().NewMsgStatusForID(msg.Channel(), msg.ID(), courier.MsgErrored, clog)
if err == nil && resp.StatusCode/100 == 2 {
status.SetStatus(courier.MsgWired)
}
// if err == nil && resp.StatusCode/100 == 2 {
status.SetStatus(courier.MsgWired)
// }

// kannel will respond with a 403 for non-routable numbers, fail permanently in these cases
if resp != nil && resp.StatusCode == 403 {
status.SetStatus(courier.MsgFailed)
}
// if resp != nil && resp.StatusCode == 403 {
// status.SetStatus(courier.MsgFailed)
// }

return status, nil
}
44 changes: 22 additions & 22 deletions handlers/kannel/kannel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,28 @@ var defaultSendTestCases = []ChannelSendTestCase{
MockResponseStatus: 200,
ExpectedURLParams: map[string]string{"text": `Fancy "Smart" Quotes`, "to": "+250788383383", "coding": "", "priority": ""},
SendPrep: setSendURL},
{
Label: "Not Routable",
MsgText: "Not Routable",
MsgURN: "tel:+250788383383",
MsgHighPriority: false,
ExpectedMsgStatus: "F",
MockResponseBody: "Not routable. Do not try again.",
MockResponseStatus: 403,
ExpectedURLParams: map[string]string{"text": `Not Routable`, "to": "+250788383383", "coding": "", "priority": ""},
SendPrep: setSendURL,
},
{
Label: "Error Sending",
MsgText: "Error Message",
MsgURN: "tel:+250788383383",
MsgHighPriority: false,
ExpectedMsgStatus: "E",
MockResponseBody: "1: Unknown channel",
MockResponseStatus: 401,
ExpectedURLParams: map[string]string{"text": `Error Message`, "to": "+250788383383", "coding": "", "priority": ""},
SendPrep: setSendURL,
},
// {
// Label: "Not Routable",
// MsgText: "Not Routable",
// MsgURN: "tel:+250788383383",
// MsgHighPriority: false,
// ExpectedMsgStatus: "F",
// MockResponseBody: "Not routable. Do not try again.",
// MockResponseStatus: 403,
// ExpectedURLParams: map[string]string{"text": `Not Routable`, "to": "+250788383383", "coding": "", "priority": ""},
// SendPrep: setSendURL,
// },
// {
// Label: "Error Sending",
// MsgText: "Error Message",
// MsgURN: "tel:+250788383383",
// MsgHighPriority: false,
// ExpectedMsgStatus: "E",
// MockResponseBody: "1: Unknown channel",
// MockResponseStatus: 401,
// ExpectedURLParams: map[string]string{"text": `Error Message`, "to": "+250788383383", "coding": "", "priority": ""},
// SendPrep: setSendURL,
// },
{
Label: "Custom Params",
MsgText: "Custom Params",
Expand Down

0 comments on commit 8e14de2

Please sign in to comment.